/[eiffelstudio]/branches/eth/eve/Src/Eiffel/API/evaluated_type/real_a.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/API/evaluated_type/real_a.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89347 - (show annotations)
Fri Aug 10 15:09:25 2012 UTC (7 years, 4 months ago) by jasonw
File size: 3227 byte(s)
<<Merged from trunk#89346.>>
1 note
2 description: "Actual type for real type."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date: "$Date$"
6 revision: "$Revision$"
7
8 class REAL_A
9
10 inherit
11 BASIC_A
12 rename
13 make as cl_make
14 redefine
15 is_real_32, is_real_64, base_class, same_as, is_numeric,
16 process, heaviest
17 end
18
19 create
20 make
21
22 feature {NONE} -- Initialization
23
24 make (n: INTEGER)
25 -- Create instance of INTEGER_A represented by `n' bits.
26 require
27 valid_n: n = 32 or n = 64
28 do
29 size := n.to_integer_8
30 cl_make (base_class.class_id)
31 ensure
32 size_set: size = n
33 end
34
35 feature -- Visitor
36
37 process (v: TYPE_A_VISITOR)
38 -- Process current element.
39 do
40 v.process_real_a (Current)
41 end
42
43 feature -- Property
44
45 is_real_32: BOOLEAN
46 -- Is the current type a real 32-bit type?
47 do
48 Result := size = 32
49 end
50
51 is_real_64: BOOLEAN
52 -- Is the current type a real 64-bit type?
53 do
54 Result := size = 64
55 end
56
57 feature -- Access
58
59 base_class: CLASS_C
60 -- Class REAL
61 do
62 if size = 32 then
63 Result := System.real_32_class.compiled_class
64 else
65 Result := System.real_64_class.compiled_class
66 end
67 end
68
69 size: INTEGER_8
70 -- Current is stored on `size' bits.
71
72 feature -- IL code generation
73
74 heaviest (other: TYPE_A): TYPE_A
75 -- `other' if `other' is heavier than Current,
76 -- Current otherwise.
77 do
78 if other.is_real_64 then
79 Result := other
80 else
81 Result := Current
82 end
83 end
84
85 feature {COMPILER_EXPORTER}
86
87 is_numeric: BOOLEAN = True
88 -- Is the current type a numeric type ?
89
90 c_type: TYPE_C
91 -- C type
92 do
93 if size = 32 then
94 Result := real32_c_type
95 else
96 Result := real64_c_type
97 end
98 end
99
100 same_as (other: TYPE_A): BOOLEAN
101 -- Is the current type the same as `other' ?
102 do
103 Result := attached {REAL_A} other as r and then size = r.size
104 end
105
106 invariant
107 correct_size: size = 32 or size = 64
108
109 note
110 copyright: "Copyright (c) 1984-2010, Eiffel Software"
111 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
112 licensing_options: "http://www.eiffel.com/licensing"
113 copying: "[
114 This file is part of Eiffel Software's Eiffel Development Environment.
115
116 Eiffel Software's Eiffel Development Environment is free
117 software; you can redistribute it and/or modify it under
118 the terms of the GNU General Public License as published
119 by the Free Software Foundation, version 2 of the License
120 (available at the URL listed under "license" above).
121
122 Eiffel Software's Eiffel Development Environment is
123 distributed in the hope that it will be useful, but
124 WITHOUT ANY WARRANTY; without even the implied warranty
125 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
126 See the GNU General Public License for more details.
127
128 You should have received a copy of the GNU General Public
129 License along with Eiffel Software's Eiffel Development
130 Environment; if not, write to the Free Software Foundation,
131 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
132 ]"
133 source: "[
134 Eiffel Software
135 5949 Hollister Ave., Goleta, CA 93117 USA
136 Telephone 805-685-1006, Fax 805-685-6869
137 Website http://www.eiffel.com
138 Customer support http://support.eiffel.com
139 ]"
140
141 end -- class REAL_32_A

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23