/[eiffelstudio]/branches/CAT_mono/Src/Eiffel/eiffel/interface/array_class_b.e
ViewVC logotype

Contents of /branches/CAT_mono/Src/Eiffel/eiffel/interface/array_class_b.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69868 - (show annotations)
Fri Aug 3 22:28:26 2007 UTC (12 years, 4 months ago) by martins
File size: 3925 byte(s)
enabled more types to store monomorph information
1 indexing
2 legal: "See notice at end of class."
3 status: "See notice at end of class."
4 --- Compiled class ARRAY
5
6 class
7 ARRAY_CLASS_B
8
9 inherit
10 EIFFEL_CLASS_C
11 redefine
12 check_validity
13 end
14
15 SPECIAL_CONST
16
17 create
18 make
19
20 feature
21
22 check_validity is
23 -- Check validity of class ARRAY
24 local
25 error: BOOLEAN;
26 special_error: SPECIAL_ERROR;
27 creat_feat: FEATURE_I;
28 area_feature: ATTRIBUTE_I
29 done: BOOLEAN
30 do
31 -- First check if current class has one formal generic parameter
32 if (generics = Void) or else generics.count /= 1 then
33 create special_error.make (array_case_1, Current);
34 Error_handler.insert_error (special_error);
35 end;
36
37 -- Check if class has an attribute `area' of type SPECIAL [T].
38 area_feature ?= feature_table.item_id (names_heap.area_name_id)
39 if
40 (area_feature = Void)
41 or else not area_type.same_as (area_feature.type)
42 then
43 create special_error.make (array_case_2, Current)
44 Error_handler.insert_error (special_error)
45 end
46
47 -- Third check if class has only one reference attribute
48 -- only (which is necessary `area' then).
49 if
50 types.first.skeleton.nb_reference /= 1
51 then
52 create special_error.make (array_case_3, Current);
53 Error_handler.insert_error (special_error);
54 end;
55
56 -- Fouth, check if there is only one creation procedure
57 -- having only two integer arguments
58 error := creators = Void
59 if not error then
60 from
61 creators.start
62 until
63 done or else creators.after
64 loop
65 creat_feat := feature_table.item (creators.key_for_iteration);
66 if
67 creat_feat.feature_name_id = names_heap.make_name_id and then
68 creat_feat.same_signature (make_signature)
69 then
70 done := True
71 else
72 creators.forth
73 end
74 end
75 error := not done
76 end;
77 if error then
78 create special_error.make (array_case_4, Current);
79 Error_handler.insert_error (special_error);
80 end;
81
82 end; -- check_validity
83
84 feature {NONE}
85
86 make_signature: DYN_PROC_I is
87 -- Required signature for feature `make' of class STRING
88 local
89 args: FEAT_ARG;
90 do
91 create args.make (2);
92 args.put_i_th (Integer_type, 1);
93 args.put_i_th (Integer_type, 2);
94 create Result;
95 Result.set_arguments (args);
96 Result.set_feature_name_id (names_heap.make_name_id, 0)
97 end;
98
99 area_type: GEN_TYPE_A is
100 -- Type SPECIAL [T]
101 local
102 f: FORMAL_A
103 gen: ARRAY [TYPE_A]
104 do
105 -- TODO: is polymorph ok? (3rd False)
106 create f.make (False, False, False, 1)
107 create gen.make (1, 1)
108 gen.put (f, 1)
109 create Result.make (System.special_id, gen)
110 end
111
112 indexing
113 copyright: "Copyright (c) 1984-2006, Eiffel Software"
114 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
115 licensing_options: "http://www.eiffel.com/licensing"
116 copying: "[
117 This file is part of Eiffel Software's Eiffel Development Environment.
118
119 Eiffel Software's Eiffel Development Environment is free
120 software; you can redistribute it and/or modify it under
121 the terms of the GNU General Public License as published
122 by the Free Software Foundation, version 2 of the License
123 (available at the URL listed under "license" above).
124
125 Eiffel Software's Eiffel Development Environment is
126 distributed in the hope that it will be useful, but
127 WITHOUT ANY WARRANTY; without even the implied warranty
128 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
129 See the GNU General Public License for more details.
130
131 You should have received a copy of the GNU General Public
132 License along with Eiffel Software's Eiffel Development
133 Environment; if not, write to the Free Software Foundation,
134 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
135 ]"
136 source: "[
137 Eiffel Software
138 356 Storke Road, Goleta, CA 93117 USA
139 Telephone 805-685-1006, Fax 805-685-6869
140 Website http://www.eiffel.com
141 Customer support http://support.eiffel.com
142 ]"
143
144 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23