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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89347 - (show annotations)
Fri Aug 10 15:09:25 2012 UTC (7 years, 6 months ago) by jasonw
File size: 4004 byte(s)
<<Merged from trunk#89346.>>
1 note
2 description: "Actual type for integer constant type NATURAL_64."
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
9 MANIFEST_NATURAL_64_A
10
11 inherit
12 NATURAL_A
13 redefine
14 convert_to, intrinsic_type, process
15 end
16
17 SHARED_TYPES
18
19 create
20 make_for_constant
21
22 feature {NONE} -- Initialization
23
24 make_for_constant (convertible_to_integer_64: BOOLEAN)
25 -- Create instance of NATURAL_A represented by 64 bits
26 -- and that can be converted to INTEGER_64 iff
27 -- `is_convertible_to_integer_64' is `True'.
28 do
29 is_convertible_to_integer_64 := convertible_to_integer_64
30 make (64)
31 ensure
32 size_set: size = 64
33 is_convertible_to_integer_64_set: is_convertible_to_integer_64 = convertible_to_integer_64
34 end
35
36 feature -- Visitor
37
38 process (v: TYPE_A_VISITOR)
39 -- Process current element.
40 do
41 v.process_manifest_natural_64_a (Current)
42 end
43
44 feature -- Property
45
46 is_convertible_to_integer_64: BOOLEAN
47 -- Is manifest constant value compatible with INTEGER_64?
48
49 intrinsic_type: NATURAL_A
50 -- Real type of current manifest integer.
51 do
52 Result := natural_64_type
53 end
54
55 feature {COMPILER_EXPORTER} -- Implementation
56
57 convert_to (a_context_class: CLASS_C; a_target_type: TYPE_A): BOOLEAN
58 -- Does current convert to `a_target_type' in `a_context_class'?
59 -- Update `last_conversion_info' of AST_CONTEXT.
60 local
61 l_int: INTEGER_A
62 l_nat: NATURAL_A
63 l_info: CONVERSION_INFO
64 l_feat: FEATURE_I
65 do
66 if a_target_type.is_integer then
67 l_int ?= a_target_type
68 if is_convertible_to_integer_64 and then l_int.size >= 64 then
69 l_feat := base_class.feature_table.
70 item ("to_integer_" + l_int.size.out)
71 -- We protect ourself in case the `to_integer_xx' routines
72 -- would have been removed from the NATURAL_XX classes
73 if l_feat /= Void then
74 create {FEATURE_CONVERSION_INFO} l_info.make_to (Current, l_int, base_class, l_feat)
75 Result := True
76 end
77 end
78 context.set_last_conversion_info (l_info)
79 elseif a_target_type.is_natural then
80 l_nat ?= a_target_type
81 if l_nat.size >= 64 then
82 l_feat := base_class.feature_table.
83 item ("to_natural_" + l_nat.size.out)
84 -- We protect ourself in case the `to_natural_xx' routines
85 -- would have been removed from the NATURAL_XX classes
86 if l_feat /= Void then
87 create {FEATURE_CONVERSION_INFO} l_info.make_to (Current, l_nat, base_class, l_feat)
88 Result := True
89 end
90 end
91 context.set_last_conversion_info (l_info)
92 else
93 Result := Precursor (a_context_class, a_target_type)
94 end
95 end
96
97 invariant
98 correct_size: size = 64
99
100 note
101 copyright: "Copyright (c) 1984-2006, Eiffel Software"
102 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
103 licensing_options: "http://www.eiffel.com/licensing"
104 copying: "[
105 This file is part of Eiffel Software's Eiffel Development Environment.
106
107 Eiffel Software's Eiffel Development Environment is free
108 software; you can redistribute it and/or modify it under
109 the terms of the GNU General Public License as published
110 by the Free Software Foundation, version 2 of the License
111 (available at the URL listed under "license" above).
112
113 Eiffel Software's Eiffel Development Environment is
114 distributed in the hope that it will be useful, but
115 WITHOUT ANY WARRANTY; without even the implied warranty
116 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
117 See the GNU General Public License for more details.
118
119 You should have received a copy of the GNU General Public
120 License along with Eiffel Software's Eiffel Development
121 Environment; if not, write to the Free Software Foundation,
122 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
123 ]"
124 source: "[
125 Eiffel Software
126 356 Storke Road, Goleta, CA 93117 USA
127 Telephone 805-685-1006, Fax 805-685-6869
128 Website http://www.eiffel.com
129 Customer support http://support.eiffel.com
130 ]"
131
132 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23