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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 84108 - (show annotations)
Wed Aug 4 09:40:49 2010 UTC (9 years, 4 months ago) by wests
File size: 5118 byte(s)
This commit merges SCOOP from the old EVE branch.

It also contains the scoopli and scoop2scoopli libraries, as well as 
scoop examples.


1 note
2 description: "The type model of a processor tag, including some ordering on the instances."
3
4 class PROCESSOR_TAG_TYPE
5
6 inherit
7 ANY
8 redefine
9 default_create,
10 is_equal
11 end
12
13 PART_COMPARABLE
14 undefine
15 default_create
16 redefine
17 is_equal,
18 is_less
19 end
20
21 create
22 make,
23 make_top,
24 make_bottom,
25 make_current,
26 default_create
27
28 feature --Creation
29 default_create
30 do
31 make_current
32 end
33
34 make (is_separate : BOOLEAN; proc_name : attached STRING ; a_handled : BOOLEAN)
35 require
36 handled_has_name: a_handled implies not proc_name.is_empty
37 do
38 make_empty
39
40 set_tag_name (proc_name)
41 is_sep := is_separate
42 is_handled := a_handled
43
44 if is_separate then
45 if is_handled and proc_name.is_equal ("Current") then
46 make_current
47 elseif proc_name.is_empty then
48 make_top
49 end
50 else
51 make_current
52 end
53 end
54
55 make_current
56 do
57 make_empty
58 current_proc := True
59 end
60
61 make_top
62 do
63 make_empty
64 top := True
65 end
66 make_bottom
67 do
68 make_empty
69 bottom := True
70 end
71
72 feature --Copy
73 duplicate : attached PROCESSOR_TAG_TYPE
74 -- Duplicate the current processor tag.
75 do
76 create Result.make (is_sep, tag_name, is_handled)
77 Result.set_controlled (is_controlled)
78 end
79
80 feature --Compare
81 is_less alias "<" (other : like Current) : BOOLEAN
82 do
83 Result := (other.top and not top) or else
84 (bottom and not other.bottom)
85 end
86
87 is_equal (other : like Current) : BOOLEAN
88 do
89 Result := (other.top and top) or else
90 (other.bottom and bottom) or else
91 (other.is_current and is_current) or else
92 (not other.is_current and not is_current and
93 other.tag_name.is_equal (tag_name))
94 end
95
96 feature --Access
97
98 parsed_processor_name:STRING
99 --returns the name of the processor
100
101 Require
102 has_empty: not tag_name.is_empty
103 not_void: tag_name /= Void
104 local
105 p_open, p_close, dot : INTEGER
106 p_name: STRING
107 do
108 p_name := tag_name
109
110 if p_name.has ('<') then
111 p_open := p_name.index_of ('<', 0)
112 p_close := p_name.index_of ('>', 0)
113
114 p_name := p_name.substring (p_open, p_close)
115 end
116 if p_name.has ('.') then
117 dot := p_name.index_of ('.', 0)
118 p_name := p_name.substring (0, dot)
119 end
120
121 Result := p_name
122
123 end
124
125
126 is_current : BOOLEAN
127 -- Determines whether this tag represents the same
128 -- processor where the type was declared.
129 do
130 Result := current_proc
131 end
132
133 is_controlled : BOOLEAN
134 -- Report whether this type is controlled
135 do
136 Result := controlled
137 end
138
139 set_controlled (contr : BOOLEAN)
140 -- Set whether this type is controlled
141 do
142 controlled := contr
143 end
144
145 has_explicit_tag : BOOLEAN
146 do
147 Result := not tag_name.is_empty or is_handled
148 end
149
150 has_handler: BOOLEAN
151 -- Returns if type has handler
152 -- Added by `damienm' 13.11.09
153 do
154 Result := is_handled
155 end
156
157 tag_name : attached STRING
158 bottom : BOOLEAN
159 top : BOOLEAN
160
161 feature --Debug
162 dump_info
163 do
164 io.put_string ("Separate tag with: is_sep: " + is_sep.out)
165 io.put_string (" process name: " + tag_name)
166 io.put_string (" controlled " + controlled.out)
167 io.put_string (" handled: " + is_handled.out)
168 io.put_string (" current: " + current_proc.out)
169 io.new_line
170 end
171
172 feature {NONE} -- Implementation
173 set_tag_name (name : attached STRING)
174 -- Sets the name of the tag to `name'
175 do
176 tag_name := name.twin
177 end
178
179
180
181 make_empty
182 do
183 tag_name := ""
184 controlled := False
185 current_proc := False
186 top := False
187 bottom := False
188 end
189
190 controlled : BOOLEAN
191 current_proc : BOOLEAN
192 is_sep : BOOLEAN
193 is_handled : BOOLEAN
194
195 invariant
196 top_bottom_exclusive: (bottom implies not top)
197 tag_exclusive: not tag_name.is_empty implies (not top and not bottom)
198
199 note
200 copyright: "Copyright (c) 1984-2010, Eiffel Software"
201 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
202 licensing_options: "http://www.eiffel.com/licensing"
203 copying: "[
204 This file is part of Eiffel Software's Eiffel Development Environment.
205
206 Eiffel Software's Eiffel Development Environment is free
207 software; you can redistribute it and/or modify it under
208 the terms of the GNU General Public License as published
209 by the Free Software Foundation, version 2 of the License
210 (available at the URL listed under "license" above).
211
212 Eiffel Software's Eiffel Development Environment is
213 distributed in the hope that it will be useful, but
214 WITHOUT ANY WARRANTY; without even the implied warranty
215 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
216 See the GNU General Public License for more details.
217
218 You should have received a copy of the GNU General Public
219 License along with Eiffel Software's Eiffel Development
220 Environment; if not, write to the Free Software Foundation,
221 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
222 ]"
223 source: "[
224 Eiffel Software
225 5949 Hollister Ave., Goleta, CA 93117 USA
226 Telephone 805-685-1006, Fax 805-685-6869
227 Website http://www.eiffel.com
228 Customer support http://support.eiffel.com
229 ]"
230 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23