1 |
note |
2 |
description: "[ |
3 |
Actual type for manifest real constant types. By default they are considered as REAL_64, |
4 |
but will conform to REAL_32 until we are able to check if a manifest real will only fit in |
5 |
either a REAL_32 or REAL_64. |
6 |
]" |
7 |
legal: "See notice at end of class." |
8 |
status: "See notice at end of class." |
9 |
date: "$Date$" |
10 |
revision: "$Revision$" |
11 |
|
12 |
class |
13 |
MANIFEST_REAL_A |
14 |
|
15 |
inherit |
16 |
REAL_A |
17 |
redefine |
18 |
default_create, convert_to, intrinsic_type, process |
19 |
end |
20 |
|
21 |
SHARED_TYPES |
22 |
redefine |
23 |
default_create |
24 |
end |
25 |
|
26 |
create |
27 |
default_create |
28 |
|
29 |
feature {NONE} -- Initialization |
30 |
|
31 |
default_create |
32 |
do |
33 |
-- By default we always create a manifest real constant as if it was a 64-bit value. |
34 |
make (64) |
35 |
end |
36 |
|
37 |
feature -- Visitor |
38 |
|
39 |
process (v: TYPE_A_VISITOR) |
40 |
-- Process current element. |
41 |
do |
42 |
v.process_manifest_real_a (Current) |
43 |
end |
44 |
|
45 |
feature -- Property |
46 |
|
47 |
intrinsic_type: REAL_A |
48 |
-- Real type of current manifest real. |
49 |
-- It is always a REAL_64. |
50 |
do |
51 |
Result := real_64_type |
52 |
end |
53 |
|
54 |
feature {COMPILER_EXPORTER} -- Implementation |
55 |
|
56 |
convert_to (a_context_class: CLASS_C; a_target_type: TYPE_A): BOOLEAN |
57 |
-- <Precursor> |
58 |
local |
59 |
l_info: CONVERSION_INFO |
60 |
l_feat: FEATURE_I |
61 |
do |
62 |
if attached {REAL_A} a_target_type as l_real and then l_real.size = 32 then |
63 |
l_feat := base_class.feature_table.item_id ({PREDEFINED_NAMES}.truncated_to_real_name_id) |
64 |
-- We protect ourself in case the `truncated_to_real' routine |
65 |
-- would have been removed from the REAL_64 class. |
66 |
if l_feat /= Void then |
67 |
create {FEATURE_CONVERSION_INFO} l_info.make_to (Current, l_real, base_class, l_feat) |
68 |
Result := True |
69 |
end |
70 |
context.set_last_conversion_info (l_info) |
71 |
else |
72 |
Result := Precursor {REAL_A} (a_context_class, a_target_type) |
73 |
end |
74 |
end |
75 |
|
76 |
invariant |
77 |
correct_size: size = 64 |
78 |
|
79 |
note |
80 |
copyright: "Copyright (c) 1984-2010, Eiffel Software" |
81 |
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" |
82 |
licensing_options: "http://www.eiffel.com/licensing" |
83 |
copying: "[ |
84 |
This file is part of Eiffel Software's Eiffel Development Environment. |
85 |
|
86 |
Eiffel Software's Eiffel Development Environment is free |
87 |
software; you can redistribute it and/or modify it under |
88 |
the terms of the GNU General Public License as published |
89 |
by the Free Software Foundation, version 2 of the License |
90 |
(available at the URL listed under "license" above). |
91 |
|
92 |
Eiffel Software's Eiffel Development Environment is |
93 |
distributed in the hope that it will be useful, but |
94 |
WITHOUT ANY WARRANTY; without even the implied warranty |
95 |
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
96 |
See the GNU General Public License for more details. |
97 |
|
98 |
You should have received a copy of the GNU General Public |
99 |
License along with Eiffel Software's Eiffel Development |
100 |
Environment; if not, write to the Free Software Foundation, |
101 |
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
102 |
]" |
103 |
source: "[ |
104 |
Eiffel Software |
105 |
5949 Hollister Ave., Goleta, CA 93117 USA |
106 |
Telephone 805-685-1006, Fax 805-685-6869 |
107 |
Website http://www.eiffel.com |
108 |
Customer support http://support.eiffel.com |
109 |
]" |
110 |
|
111 |
end |