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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 83441 - (hide annotations)
Sat Jun 5 13:52:53 2010 UTC (9 years, 7 months ago) by jasonw
File size: 3245 byte(s)
Renamed branch eve3 to eve. The eve branch serves as the new branch for the EVE project.
1 manus 76432 note
2 manus 82735 description: "Actual type for real type."
3 manus 56535 legal: "See notice at end of class."
4     status: "See notice at end of class."
5 manus 9656 date: "$Date$"
6 manus 82735 revision: "$Revision$"
7 dinov 3375
8 manus 82735 class REAL_A
9 grator 18
10     inherit
11     BASIC_A
12 manus 82735 rename
13     make as cl_make
14 grator 18 redefine
15 manus 82735 is_real_32, is_real_64, associated_class, same_as, is_numeric,
16     process, heaviest
17 grator 18 end
18    
19 manus 41732 create
20 manus 82735 make
21 manus 41732
22     feature {NONE} -- Initialization
23    
24 manus 82735 make (n: INTEGER)
25     -- Create instance of INTEGER_A represented by `n' bits.
26     require
27     valid_n: n = 32 or n = 64
28 manus 41732 do
29 manus 82735 size := n.to_integer_8
30     cl_make (associated_class.class_id)
31     ensure
32     size_set: size = n
33 manus 41732 end
34    
35 manus 57234 feature -- Visitor
36    
37 manus 76432 process (v: TYPE_A_VISITOR)
38 manus 57234 -- Process current element.
39     do
40 manus 82735 v.process_real_a (Current)
41 manus 57234 end
42    
43 dinov 3078 feature -- Property
44    
45 manus 82735 is_real_32: BOOLEAN
46     -- Is the current type a real 32-bit type?
47     do
48     Result := size = 32
49     end
50 dinov 3078
51 manus 82735 is_real_64: BOOLEAN
52     -- Is the current type a real 64-bit type?
53     do
54     Result := size = 64
55     end
56    
57 manus 72419 feature -- Access
58    
59 manus 76432 associated_class: CLASS_C
60 manus 11302 -- Class REAL
61 manus 82735 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 manus 9656 end
68 dinov 3078
69 manus 82735 size: INTEGER_8
70     -- Current is stored on `size' bits.
71    
72 manus 72419 feature -- IL code generation
73    
74 manus 76432 heaviest (other: TYPE_A): TYPE_A
75 manus 72419 -- `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 dinov 3181 feature {COMPILER_EXPORTER}
86 grator 18
87 manus 76432 is_numeric: BOOLEAN = True
88 grator 18 -- Is the current type a numeric type ?
89    
90 manus 82735 c_type: TYPE_C
91 grator 18 -- C type
92 manus 32079 do
93 manus 82735 if size = 32 then
94     Result := real32_c_type
95     else
96     Result := real64_c_type
97     end
98 manus 9656 end
99 grator 18
100 manus 76432 same_as (other: TYPE_A): BOOLEAN
101 grator 18 -- Is the current type the same as `other' ?
102     do
103 manus 82735 Result := attached {REAL_A} other as r and then size = r.size
104 manus 9656 end
105 grator 18
106 manus 82735 invariant
107     correct_size: size = 32 or size = 64
108    
109 manus 76432 note
110 manus 82735 copyright: "Copyright (c) 1984-2010, Eiffel Software"
111 manus 58027 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
112 manus 56535 licensing_options: "http://www.eiffel.com/licensing"
113     copying: "[
114     This file is part of Eiffel Software's Eiffel Development Environment.
115 manus 58027
116 manus 56535 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 manus 58027
122 manus 56535 Eiffel Software's Eiffel Development Environment is
123 manus 82735 distributed in the hope that it will be useful, but
124 manus 56535 WITHOUT ANY WARRANTY; without even the implied warranty
125     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
126 manus 82735 See the GNU General Public License for more details.
127 manus 58027
128 manus 56535 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 manus 82735 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
132 manus 56535 ]"
133     source: "[
134 manus 82735 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 manus 56535 ]"
140    
141 manus 47234 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