Update c_src with new default constructor rules.
[nit.git] / c_src / mmloader._sep.c
1 /* This C file is generated by NIT to compile module mmloader. */
2 #include "mmloader._sep.h"
3 val_t mmloader___ToolContext___error_count(val_t self) {
4 struct trace_t trace = {NULL, NULL, 27, LOCATE_mmloader___ToolContext___error_count};
5 trace.prev = tracehead; tracehead = &trace;
6 trace.file = LOCATE_mmloader;
7 tracehead = trace.prev;
8 return ATTR_mmloader___ToolContext____error_count( self) /*ToolContext::_error_count*/;
9 }
10 val_t mmloader___ToolContext___warning_count(val_t self) {
11 struct trace_t trace = {NULL, NULL, 30, LOCATE_mmloader___ToolContext___warning_count};
12 trace.prev = tracehead; tracehead = &trace;
13 trace.file = LOCATE_mmloader;
14 tracehead = trace.prev;
15 return ATTR_mmloader___ToolContext____warning_count( self) /*ToolContext::_warning_count*/;
16 }
17 void mmloader___ToolContext___error(val_t self, val_t param0) {
18 struct trace_t trace = {NULL, NULL, 33, LOCATE_mmloader___ToolContext___error};
19 val_t variable0;
20 val_t variable1;
21 val_t variable2;
22 val_t variable3;
23 val_t variable4;
24 val_t variable5;
25 val_t variable6;
26 val_t variable7;
27 trace.prev = tracehead; tracehead = &trace;
28 trace.file = LOCATE_mmloader;
29 variable0 = param0;
30 variable1 = ((file___Object___stderr_t)CALL( self,COLOR_file___Object___stderr))( self) /*Object::stderr*/;
31 variable2 = NEW_String_string___String___init(); /*new String*/
32 variable3 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
33 variable4 = variable3;
34 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable4) /*String::append*/;
35 variable5 = variable0 /*s*/;
36 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable5) /*String::append*/;
37 variable6 = NEW_String_string___String___with_native(BOX_NativeString("\n"), TAG_Int(1)); /*new String*/
38 variable7 = variable6;
39 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable7) /*String::append*/;
40 ((file___OFStream___write_t)CALL(variable1,COLOR_stream___OStream___write))(variable1, variable2) /*OFStream::write*/;
41 variable1 = ATTR_mmloader___ToolContext____error_count( self) /*ToolContext::_error_count*/;
42 variable1 = TAG_Int(UNTAG_Int(variable1)+UNTAG_Int( TAG_Int(1)));
43 ATTR_mmloader___ToolContext____error_count( self) /*ToolContext::_error_count*/ = variable1;
44 tracehead = trace.prev;
45 return;
46 }
47 void mmloader___ToolContext___warning(val_t self, val_t param0) {
48 struct trace_t trace = {NULL, NULL, 40, LOCATE_mmloader___ToolContext___warning};
49 val_t variable0;
50 val_t variable1;
51 val_t variable2;
52 val_t variable3;
53 val_t variable4;
54 val_t variable5;
55 val_t variable6;
56 val_t variable7;
57 trace.prev = tracehead; tracehead = &trace;
58 trace.file = LOCATE_mmloader;
59 variable0 = param0;
60 variable1 = ATTR_mmloader___ToolContext____opt_warn( self) /*ToolContext::_opt_warn*/;
61 variable1 = ((opts___Option___value_t)CALL(variable1,COLOR_opts___Option___value))(variable1) /*Option::value*/;
62 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable1)))) { /*if*/
63 goto return_label1;
64 }
65 variable1 = ((file___Object___stderr_t)CALL( self,COLOR_file___Object___stderr))( self) /*Object::stderr*/;
66 variable2 = NEW_String_string___String___init(); /*new String*/
67 variable3 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
68 variable4 = variable3;
69 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable4) /*String::append*/;
70 variable5 = variable0 /*s*/;
71 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable5) /*String::append*/;
72 variable6 = NEW_String_string___String___with_native(BOX_NativeString("\n"), TAG_Int(1)); /*new String*/
73 variable7 = variable6;
74 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable7) /*String::append*/;
75 ((file___OFStream___write_t)CALL(variable1,COLOR_stream___OStream___write))(variable1, variable2) /*OFStream::write*/;
76 variable1 = ATTR_mmloader___ToolContext____warning_count( self) /*ToolContext::_warning_count*/;
77 variable1 = TAG_Int(UNTAG_Int(variable1)+UNTAG_Int( TAG_Int(1)));
78 ATTR_mmloader___ToolContext____warning_count( self) /*ToolContext::_warning_count*/ = variable1;
79 return_label1: while(false);
80 tracehead = trace.prev;
81 return;
82 }
83 val_t mmloader___ToolContext___paths(val_t self) {
84 struct trace_t trace = {NULL, NULL, 48, LOCATE_mmloader___ToolContext___paths};
85 trace.prev = tracehead; tracehead = &trace;
86 trace.file = LOCATE_mmloader;
87 tracehead = trace.prev;
88 return ATTR_mmloader___ToolContext____paths( self) /*ToolContext::_paths*/;
89 }
90 val_t mmloader___ToolContext___option_context(val_t self) {
91 struct trace_t trace = {NULL, NULL, 54, LOCATE_mmloader___ToolContext___option_context};
92 trace.prev = tracehead; tracehead = &trace;
93 trace.file = LOCATE_mmloader;
94 tracehead = trace.prev;
95 return ATTR_mmloader___ToolContext____option_context( self) /*ToolContext::_option_context*/;
96 }
97 val_t mmloader___ToolContext___opt_warn(val_t self) {
98 struct trace_t trace = {NULL, NULL, 57, LOCATE_mmloader___ToolContext___opt_warn};
99 trace.prev = tracehead; tracehead = &trace;
100 trace.file = LOCATE_mmloader;
101 tracehead = trace.prev;
102 return ATTR_mmloader___ToolContext____opt_warn( self) /*ToolContext::_opt_warn*/;
103 }
104 val_t mmloader___ToolContext___opt_path(val_t self) {
105 struct trace_t trace = {NULL, NULL, 60, LOCATE_mmloader___ToolContext___opt_path};
106 trace.prev = tracehead; tracehead = &trace;
107 trace.file = LOCATE_mmloader;
108 tracehead = trace.prev;
109 return ATTR_mmloader___ToolContext____opt_path( self) /*ToolContext::_opt_path*/;
110 }
111 val_t mmloader___ToolContext___opt_log(val_t self) {
112 struct trace_t trace = {NULL, NULL, 63, LOCATE_mmloader___ToolContext___opt_log};
113 trace.prev = tracehead; tracehead = &trace;
114 trace.file = LOCATE_mmloader;
115 tracehead = trace.prev;
116 return ATTR_mmloader___ToolContext____opt_log( self) /*ToolContext::_opt_log*/;
117 }
118 val_t mmloader___ToolContext___opt_only_metamodel(val_t self) {
119 struct trace_t trace = {NULL, NULL, 66, LOCATE_mmloader___ToolContext___opt_only_metamodel};
120 trace.prev = tracehead; tracehead = &trace;
121 trace.file = LOCATE_mmloader;
122 tracehead = trace.prev;
123 return ATTR_mmloader___ToolContext____opt_only_metamodel( self) /*ToolContext::_opt_only_metamodel*/;
124 }
125 val_t mmloader___ToolContext___opt_only_parse(val_t self) {
126 struct trace_t trace = {NULL, NULL, 69, LOCATE_mmloader___ToolContext___opt_only_parse};
127 trace.prev = tracehead; tracehead = &trace;
128 trace.file = LOCATE_mmloader;
129 tracehead = trace.prev;
130 return ATTR_mmloader___ToolContext____opt_only_parse( self) /*ToolContext::_opt_only_parse*/;
131 }
132 val_t mmloader___ToolContext___opt_help(val_t self) {
133 struct trace_t trace = {NULL, NULL, 72, LOCATE_mmloader___ToolContext___opt_help};
134 trace.prev = tracehead; tracehead = &trace;
135 trace.file = LOCATE_mmloader;
136 tracehead = trace.prev;
137 return ATTR_mmloader___ToolContext____opt_help( self) /*ToolContext::_opt_help*/;
138 }
139 void mmloader___ToolContext___init(val_t self, int* init_table) {
140 struct trace_t trace = {NULL, NULL, 75, LOCATE_mmloader___ToolContext___init};
141 val_t variable0;
142 val_t variable1;
143 val_t variable2;
144 val_t variable3;
145 val_t variable4;
146 val_t variable5;
147 val_t variable6;
148 val_t variable7;
149 trace.prev = tracehead; tracehead = &trace;
150 trace.file = LOCATE_mmloader;
151 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_ToolContext].i]) return;
152 ((abstractmetamodel___MMContext___init_t)CALL( self,COLOR_abstractmetamodel___MMContext___init))( self, init_table /*YYY*/) /*MMContext::init*/;
153 variable0 = ((mmloader___ToolContext___option_context_t)CALL( self,COLOR_mmloader___ToolContext___option_context))( self) /*ToolContext::option_context*/;
154 variable1 = NEW_Array_array___Array___with_capacity(TAG_Int(6)); /*new Array[Option]*/
155 variable2 = ((mmloader___ToolContext___opt_warn_t)CALL( self,COLOR_mmloader___ToolContext___opt_warn))( self) /*ToolContext::opt_warn*/;
156 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable2) /*AbstractArray::add*/;
157 variable3 = ((mmloader___ToolContext___opt_path_t)CALL( self,COLOR_mmloader___ToolContext___opt_path))( self) /*ToolContext::opt_path*/;
158 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable3) /*AbstractArray::add*/;
159 variable4 = ((mmloader___ToolContext___opt_log_t)CALL( self,COLOR_mmloader___ToolContext___opt_log))( self) /*ToolContext::opt_log*/;
160 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable4) /*AbstractArray::add*/;
161 variable5 = ((mmloader___ToolContext___opt_only_parse_t)CALL( self,COLOR_mmloader___ToolContext___opt_only_parse))( self) /*ToolContext::opt_only_parse*/;
162 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable5) /*AbstractArray::add*/;
163 variable6 = ((mmloader___ToolContext___opt_only_metamodel_t)CALL( self,COLOR_mmloader___ToolContext___opt_only_metamodel))( self) /*ToolContext::opt_only_metamodel*/;
164 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable6) /*AbstractArray::add*/;
165 variable7 = ((mmloader___ToolContext___opt_help_t)CALL( self,COLOR_mmloader___ToolContext___opt_help))( self) /*ToolContext::opt_help*/;
166 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable7) /*AbstractArray::add*/;
167 ((opts___OptionContext___add_option_t)CALL(variable0,COLOR_opts___OptionContext___add_option))(variable0, variable1) /*OptionContext::add_option*/;
168 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_ToolContext].i] = 1;
169 tracehead = trace.prev;
170 return;
171 }
172 void mmloader___ToolContext___process_options(val_t self) {
173 struct trace_t trace = {NULL, NULL, 81, LOCATE_mmloader___ToolContext___process_options};
174 val_t variable0;
175 val_t variable1;
176 static val_t once_value_variable1_4; static int once_bool_variable1_4;
177 val_t variable2;
178 static val_t once_value_variable1_5; static int once_bool_variable1_5;
179 val_t variable3;
180 val_t variable4;
181 val_t variable5;
182 val_t variable6;
183 val_t variable7;
184 val_t variable8;
185 trace.prev = tracehead; tracehead = &trace;
186 trace.file = LOCATE_mmloader;
187 variable0 = ((mmloader___ToolContext___option_context_t)CALL( self,COLOR_mmloader___ToolContext___option_context))( self) /*ToolContext::option_context*/;
188 variable1 = ((string___Object___args_t)CALL( self,COLOR_string___Object___args))( self) /*Object::args*/;
189 ((opts___OptionContext___parse_t)CALL(variable0,COLOR_opts___OptionContext___parse))(variable0, variable1) /*OptionContext::parse*/;
190 variable0 = NEW_Array_array___Array___init(); /*new Array[String]*/
191 ATTR_mmloader___ToolContext____paths( self) /*ToolContext::_paths*/ = variable0;
192 variable0 = ((mmloader___ToolContext___paths_t)CALL( self,COLOR_mmloader___ToolContext___paths))( self) /*ToolContext::paths*/;
193 variable1 = ((mmloader___ToolContext___opt_path_t)CALL( self,COLOR_mmloader___ToolContext___opt_path))( self) /*ToolContext::opt_path*/;
194 variable1 = ((opts___Option___value_t)CALL(variable1,COLOR_opts___Option___value))(variable1) /*Option::value*/;
195 ((abstract_collection___IndexedCollection___append_t)CALL(variable0,COLOR_abstract_collection___IndexedCollection___append))(variable0, variable1) /*IndexedCollection::append*/;
196 if (once_bool_variable1_4) variable1 = once_value_variable1_4;
197 else {
198 variable1 = NEW_String_string___String___with_native(BOX_NativeString("NIT_PATH"), TAG_Int(8)); /*new String*/
199 variable1 = ((symbol___String___to_symbol_t)CALL(variable1,COLOR_symbol___String___to_symbol))(variable1) /*String::to_symbol*/;
200 variable1 = ((environ___Symbol___environ_t)CALL(variable1,COLOR_environ___Symbol___environ))(variable1) /*Symbol::environ*/;
201 once_value_variable1_4 = variable1;
202 once_bool_variable1_4 = true;
203 }
204 variable0 = variable1;
205 variable1 = ((array___AbstractArray___is_empty_t)CALL( variable0 /*path_env*/,COLOR_abstract_collection___Collection___is_empty))( variable0 /*path_env*/) /*AbstractArray::is_empty*/;
206 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable1)))) { /*if*/
207 variable1 = ((mmloader___ToolContext___paths_t)CALL( self,COLOR_mmloader___ToolContext___paths))( self) /*ToolContext::paths*/;
208 variable2 = ((string_search___String___split_with_t)CALL( variable0 /*path_env*/,COLOR_string_search___String___split_with))( variable0 /*path_env*/, TAG_Char(':')) /*String::split_with*/;
209 ((abstract_collection___IndexedCollection___append_t)CALL(variable1,COLOR_abstract_collection___IndexedCollection___append))(variable1, variable2) /*IndexedCollection::append*/;
210 }
211 if (once_bool_variable1_5) variable1 = once_value_variable1_5;
212 else {
213 variable1 = NEW_String_string___String___with_native(BOX_NativeString("NIT_DIR"), TAG_Int(7)); /*new String*/
214 variable1 = ((symbol___String___to_symbol_t)CALL(variable1,COLOR_symbol___String___to_symbol))(variable1) /*String::to_symbol*/;
215 variable1 = ((environ___Symbol___environ_t)CALL(variable1,COLOR_environ___Symbol___environ))(variable1) /*Symbol::environ*/;
216 once_value_variable1_5 = variable1;
217 once_bool_variable1_5 = true;
218 }
219 variable0 = variable1 /*path_env=*/;
220 variable1 = ((array___AbstractArray___is_empty_t)CALL( variable0 /*path_env*/,COLOR_abstract_collection___Collection___is_empty))( variable0 /*path_env*/) /*AbstractArray::is_empty*/;
221 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable1)))) { /*if*/
222 variable2 = NEW_String_string___String___init(); /*new String*/
223 variable3 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
224 variable4 = variable3;
225 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable4) /*String::append*/;
226 variable5 = variable0 /*path_env*/;
227 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable5) /*String::append*/;
228 variable6 = NEW_String_string___String___with_native(BOX_NativeString("/lib"), TAG_Int(4)); /*new String*/
229 variable7 = variable6;
230 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable7) /*String::append*/;
231 variable1 = variable2;
232 variable2 = ((file___String___file_exists_t)CALL( variable1 /*libname*/,COLOR_file___String___file_exists))( variable1 /*libname*/) /*String::file_exists*/;
233 if (UNTAG_Bool(variable2)) { /*if*/
234 variable2 = ((mmloader___ToolContext___paths_t)CALL( self,COLOR_mmloader___ToolContext___paths))( self) /*ToolContext::paths*/;
235 ((array___AbstractArray___add_t)CALL(variable2,COLOR_abstract_collection___SimpleCollection___add))(variable2, variable1 /*libname*/) /*AbstractArray::add*/;
236 }
237 }
238 variable2 = NEW_String_string___String___init(); /*new String*/
239 variable3 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
240 variable4 = variable3;
241 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable4) /*String::append*/;
242 variable5 = (G_sys);
243 variable5 = ((string___Sys___program_name_t)CALL(variable5,COLOR_string___Sys___program_name))(variable5) /*Sys::program_name*/;
244 variable5 = ((file___String___dirname_t)CALL(variable5,COLOR_file___String___dirname))(variable5) /*String::dirname*/;
245 variable6 = variable5;
246 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable6) /*String::append*/;
247 variable7 = NEW_String_string___String___with_native(BOX_NativeString("/../lib"), TAG_Int(7)); /*new String*/
248 variable8 = variable7;
249 ((string___String___append_t)CALL(variable2,COLOR_abstract_collection___IndexedCollection___append))(variable2, variable8) /*String::append*/;
250 variable1 = variable2;
251 variable2 = ((file___String___file_exists_t)CALL( variable1 /*libname*/,COLOR_file___String___file_exists))( variable1 /*libname*/) /*String::file_exists*/;
252 if (UNTAG_Bool(variable2)) { /*if*/
253 variable2 = ((mmloader___ToolContext___paths_t)CALL( self,COLOR_mmloader___ToolContext___paths))( self) /*ToolContext::paths*/;
254 ((array___AbstractArray___add_t)CALL(variable2,COLOR_abstract_collection___SimpleCollection___add))(variable2, variable1 /*libname*/) /*AbstractArray::add*/;
255 }
256 tracehead = trace.prev;
257 return;
258 }
259 val_t mmloader___ToolContext___try_to_load(val_t self, val_t param0, val_t param1) {
260 struct trace_t trace = {NULL, NULL, 106, LOCATE_mmloader___ToolContext___try_to_load};
261 val_t variable0;
262 val_t variable1;
263 val_t variable2;
264 val_t variable3;
265 val_t variable4;
266 val_t variable5;
267 val_t variable6;
268 val_t variable7;
269 val_t variable8;
270 val_t variable9;
271 val_t variable10;
272 val_t variable11;
273 trace.prev = tracehead; tracehead = &trace;
274 trace.file = LOCATE_mmloader;
275 variable0 = param0;
276 variable1 = param1;
277 variable2 = ((abstractmetamodel___MMDirectory___modules_t)CALL( variable1 /*dir*/,COLOR_abstractmetamodel___MMDirectory___modules))( variable1 /*dir*/) /*MMDirectory::modules*/;
278 variable2 = ((abstract_collection___Map___iterator_t)CALL(variable2,COLOR_abstract_collection___Collection___iterator))(variable2) /*Map::iterator*/;
279 while (true) { /*for*/
280 variable3 = ((abstract_collection___Iterator___is_ok_t)CALL(variable2,COLOR_abstract_collection___Iterator___is_ok))(variable2) /*Iterator::is_ok*/;
281 if (!UNTAG_Bool(variable3)) break; /*for*/
282 variable3 = ((abstract_collection___Iterator___item_t)CALL(variable2,COLOR_abstract_collection___Iterator___item))(variable2) /*Iterator::item*/;
283 variable4 = ((abstractmetamodel___MMModule___name_t)CALL( variable3 /*m*/,COLOR_abstractmetamodel___MMModule___name))( variable3 /*m*/) /*MMModule::name*/;
284 variable4 = TAG_Bool((variable4 == variable0 /*module_name*/) || ((variable4 != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL(variable4,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN(variable4, variable0 /*module_name*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL(variable4,COLOR_kernel___Object_____eqeq))(variable4, variable0 /*module_name*/) /*Object::==*/)))));
285 if (UNTAG_Bool(variable4)) { /*if*/
286 variable2 = variable3 /*m*/;
287 goto return_label6;
288 }
289 continue_7: while(0);
290 ((abstract_collection___Iterator___next_t)CALL(variable2,COLOR_abstract_collection___Iterator___next))(variable2) /*Iterator::next*/;
291 }
292 break_7: while(0);
293 variable2 = ATTR_mmloader___ToolContext____loaders( self) /*ToolContext::_loaders*/;
294 variable2 = ((array___AbstractArray___iterator_t)CALL(variable2,COLOR_abstract_collection___Collection___iterator))(variable2) /*AbstractArray::iterator*/;
295 while (true) { /*for*/
296 variable3 = ((array___ArrayIterator___is_ok_t)CALL(variable2,COLOR_abstract_collection___Iterator___is_ok))(variable2) /*ArrayIterator::is_ok*/;
297 if (!UNTAG_Bool(variable3)) break; /*for*/
298 variable3 = ((array___ArrayIterator___item_t)CALL(variable2,COLOR_abstract_collection___Iterator___item))(variable2) /*ArrayIterator::item*/;
299 variable5 = ((mmloader___ModuleLoader___try_to_load_dir_t)CALL( variable3 /*l*/,COLOR_mmloader___ModuleLoader___try_to_load_dir))( variable3 /*l*/, variable0 /*module_name*/, variable1 /*dir*/) /*ModuleLoader::try_to_load_dir*/;
300 variable4 = variable5;
301 variable5 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable4 /*dir2*/ == NIT_NULL /*null*/) || (( variable4 /*dir2*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable4 /*dir2*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable4 /*dir2*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable4 /*dir2*/,COLOR_kernel___Object_____eqeq))( variable4 /*dir2*/, NIT_NULL /*null*/) /*Object::==*/)))))));
302 if (UNTAG_Bool(variable5)) { /*if*/
303 variable6 = ((mmloader___ToolContext___try_to_load_t)CALL( self,COLOR_mmloader___ToolContext___try_to_load))( self, variable0 /*module_name*/, variable4 /*dir2*/) /*ToolContext::try_to_load*/;
304 variable5 = variable6;
305 variable6 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable5 /*m*/ == NIT_NULL /*null*/) || (( variable5 /*m*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable5 /*m*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable5 /*m*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable5 /*m*/,COLOR_kernel___Object_____eqeq))( variable5 /*m*/, NIT_NULL /*null*/) /*Object::==*/)))))));
306 if (UNTAG_Bool(variable6)) { /*if*/
307 ((abstractmetamodel___MMDirectory___owner__eq_t)CALL( variable4 /*dir2*/,COLOR_abstractmetamodel___MMDirectory___owner__eq))( variable4 /*dir2*/, variable5 /*m*/) /*MMDirectory::owner=*/;
308 ((abstractmetamodel___MMDirectory___add_module_t)CALL( variable1 /*dir*/,COLOR_abstractmetamodel___MMDirectory___add_module))( variable1 /*dir*/, variable5 /*m*/) /*MMDirectory::add_module*/;
309 variable2 = variable5 /*m*/;
310 goto return_label6;
311 }
312 }
313 variable5 = ((mmloader___ModuleLoader___can_handle_t)CALL( variable3 /*l*/,COLOR_mmloader___ModuleLoader___can_handle))( variable3 /*l*/, variable0 /*module_name*/, variable1 /*dir*/) /*ModuleLoader::can_handle*/;
314 if (UNTAG_Bool(variable5)) { /*if*/
315 variable6 = ((abstractmetamodel___MMDirectory___full_name_for_t)CALL( variable1 /*dir*/,COLOR_abstractmetamodel___MMDirectory___full_name_for))( variable1 /*dir*/, variable0 /*module_name*/) /*MMDirectory::full_name_for*/;
316 variable5 = variable6;
317 variable6 = ATTR_mmloader___ToolContext____processing_modules( self) /*ToolContext::_processing_modules*/;
318 variable6 = ((hash___HashSet___has_t)CALL(variable6,COLOR_abstract_collection___Collection___has))(variable6, variable5 /*full_name*/) /*HashSet::has*/;
319 if (UNTAG_Bool(variable6)) { /*if*/
320 variable6 = NEW_String_string___String___init(); /*new String*/
321 variable7 = NEW_String_string___String___with_native(BOX_NativeString("Error: Dependency loop for module "), TAG_Int(34)); /*new String*/
322 variable8 = variable7;
323 ((string___String___append_t)CALL(variable6,COLOR_abstract_collection___IndexedCollection___append))(variable6, variable8) /*String::append*/;
324 variable9 = variable5 /*full_name*/;
325 variable9 = ((string___String___to_s_t)CALL(variable9,COLOR_string___Object___to_s))(variable9) /*String::to_s*/;
326 ((string___String___append_t)CALL(variable6,COLOR_abstract_collection___IndexedCollection___append))(variable6, variable9) /*String::append*/;
327 variable10 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
328 variable11 = variable10;
329 ((string___String___append_t)CALL(variable6,COLOR_abstract_collection___IndexedCollection___append))(variable6, variable11) /*String::append*/;
330 ((mmloader___ToolContext___error_t)CALL( self,COLOR_mmloader___ToolContext___error))( self, variable6) /*ToolContext::error*/;
331 exit(UNTAG_Int( TAG_Int(1)));
332 fprintf(stderr, "Aborted"); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ToolContext___try_to_load, LOCATE_mmloader, 135); nit_exit(1);
333 }
334 variable6 = ATTR_mmloader___ToolContext____processing_modules( self) /*ToolContext::_processing_modules*/;
335 ((hash___HashSet___add_t)CALL(variable6,COLOR_abstract_collection___SimpleCollection___add))(variable6, variable5 /*full_name*/) /*HashSet::add*/;
336 variable7 = ((mmloader___ModuleLoader___load_and_process_module_t)CALL( variable3 /*l*/,COLOR_mmloader___ModuleLoader___load_and_process_module))( variable3 /*l*/, self, variable0 /*module_name*/, variable1 /*dir*/) /*ModuleLoader::load_and_process_module*/;
337 variable6 = variable7;
338 variable7 = ATTR_mmloader___ToolContext____processing_modules( self) /*ToolContext::_processing_modules*/;
339 ((hash___HashSet___remove_t)CALL(variable7,COLOR_abstract_collection___RemovableCollection___remove))(variable7, variable5 /*full_name*/) /*HashSet::remove*/;
340 ((abstractmetamodel___MMDirectory___add_module_t)CALL( variable1 /*dir*/,COLOR_abstractmetamodel___MMDirectory___add_module))( variable1 /*dir*/, variable6 /*m*/) /*MMDirectory::add_module*/;
341 variable2 = variable6 /*m*/;
342 goto return_label6;
343 }
344 continue_8: while(0);
345 ((array___ArrayIterator___next_t)CALL(variable2,COLOR_abstract_collection___Iterator___next))(variable2) /*ArrayIterator::next*/;
346 }
347 break_8: while(0);
348 variable2 = NIT_NULL /*null*/;
349 goto return_label6;
350 return_label6: while(false);
351 tracehead = trace.prev;
352 return variable2;
353 }
354 val_t mmloader___ToolContext___get_module_from_filename(val_t self, val_t param0) {
355 struct trace_t trace = {NULL, NULL, 152, LOCATE_mmloader___ToolContext___get_module_from_filename};
356 val_t variable0;
357 val_t variable1;
358 val_t variable2;
359 val_t variable3;
360 val_t variable4;
361 val_t variable5;
362 val_t variable6;
363 val_t variable7;
364 val_t variable8;
365 val_t variable9;
366 val_t variable10;
367 trace.prev = tracehead; tracehead = &trace;
368 trace.file = LOCATE_mmloader;
369 variable0 = param0;
370 variable2 = ((file___String___dirname_t)CALL( variable0 /*filename*/,COLOR_file___String___dirname))( variable0 /*filename*/) /*String::dirname*/;
371 variable1 = variable2;
372 variable3 = NEW_String_string___String___with_native(BOX_NativeString(".nit"), TAG_Int(4)); /*new String*/
373 variable3 = ((file___String___basename_t)CALL( variable0 /*filename*/,COLOR_file___String___basename))( variable0 /*filename*/, variable3) /*String::basename*/;
374 variable3 = ((symbol___String___to_symbol_t)CALL(variable3,COLOR_symbol___String___to_symbol))(variable3) /*String::to_symbol*/;
375 variable2 = variable3;
376 variable4 = ((mmloader___ToolContext___directory_for_t)CALL( self,COLOR_mmloader___ToolContext___directory_for))( self, variable1 /*path*/) /*ToolContext::directory_for*/;
377 variable3 = variable4;
378 variable4 = ((symbol___Symbol___to_s_t)CALL( variable2 /*module_name*/,COLOR_string___Object___to_s))( variable2 /*module_name*/) /*Symbol::to_s*/;
379 variable4 = TAG_Bool((variable4 == variable0 /*filename*/) || ((variable4 != NIT_NULL) && UNTAG_Bool(((string___String_____eqeq_t)CALL(variable4,COLOR_kernel___Object_____eqeq))(variable4, variable0 /*filename*/) /*String::==*/)));
380 if (UNTAG_Bool(variable4)) { /*if*/
381 variable5 = ((mmloader___ToolContext___try_to_load_t)CALL( self,COLOR_mmloader___ToolContext___try_to_load))( self, variable2 /*module_name*/, variable3 /*dir*/) /*ToolContext::try_to_load*/;
382 variable4 = variable5;
383 variable5 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable4 /*m*/ == NIT_NULL /*null*/) || (( variable4 /*m*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable4 /*m*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable4 /*m*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable4 /*m*/,COLOR_kernel___Object_____eqeq))( variable4 /*m*/, NIT_NULL /*null*/) /*Object::==*/)))))));
384 if (UNTAG_Bool(variable5)) { /*if*/
385 variable1 = variable4 /*m*/;
386 goto return_label9;
387 }
388 variable5 = ((mmloader___ToolContext___get_module_t)CALL( self,COLOR_mmloader___ToolContext___get_module))( self, variable2 /*module_name*/, NIT_NULL /*null*/) /*ToolContext::get_module*/;
389 variable1 = variable5;
390 goto return_label9;
391 }
392 variable4 = ((file___String___file_exists_t)CALL( variable0 /*filename*/,COLOR_file___String___file_exists))( variable0 /*filename*/) /*String::file_exists*/;
393 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable4)))) { /*if*/
394 variable4 = NEW_String_string___String___init(); /*new String*/
395 variable5 = NEW_String_string___String___with_native(BOX_NativeString("Error: File "), TAG_Int(12)); /*new String*/
396 variable6 = variable5;
397 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable6) /*String::append*/;
398 variable7 = variable0 /*filename*/;
399 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable7) /*String::append*/;
400 variable8 = NEW_String_string___String___with_native(BOX_NativeString(" not found."), TAG_Int(11)); /*new String*/
401 variable9 = variable8;
402 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable9) /*String::append*/;
403 ((mmloader___ToolContext___error_t)CALL( self,COLOR_mmloader___ToolContext___error))( self, variable4) /*ToolContext::error*/;
404 exit(UNTAG_Int( TAG_Int(1)));
405 fprintf(stderr, "Aborted"); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ToolContext___get_module_from_filename, LOCATE_mmloader, 175); nit_exit(1);
406 }
407 variable5 = ((mmloader___ToolContext___try_to_load_t)CALL( self,COLOR_mmloader___ToolContext___try_to_load))( self, variable2 /*module_name*/, variable3 /*dir*/) /*ToolContext::try_to_load*/;
408 variable4 = variable5;
409 variable5 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable4 /*m*/ == NIT_NULL /*null*/) || (( variable4 /*m*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable4 /*m*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable4 /*m*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable4 /*m*/,COLOR_kernel___Object_____eqeq))( variable4 /*m*/, NIT_NULL /*null*/) /*Object::==*/)))))));
410 if (UNTAG_Bool(variable5)) { /*if*/
411 variable1 = variable4 /*m*/;
412 goto return_label9;
413 }
414 variable5 = NEW_String_string___String___init(); /*new String*/
415 variable6 = NEW_String_string___String___with_native(BOX_NativeString("Error: "), TAG_Int(7)); /*new String*/
416 variable7 = variable6;
417 ((string___String___append_t)CALL(variable5,COLOR_abstract_collection___IndexedCollection___append))(variable5, variable7) /*String::append*/;
418 variable8 = variable0 /*filename*/;
419 ((string___String___append_t)CALL(variable5,COLOR_abstract_collection___IndexedCollection___append))(variable5, variable8) /*String::append*/;
420 variable9 = NEW_String_string___String___with_native(BOX_NativeString(" is not a NIT source module."), TAG_Int(28)); /*new String*/
421 variable10 = variable9;
422 ((string___String___append_t)CALL(variable5,COLOR_abstract_collection___IndexedCollection___append))(variable5, variable10) /*String::append*/;
423 ((mmloader___ToolContext___error_t)CALL( self,COLOR_mmloader___ToolContext___error))( self, variable5) /*ToolContext::error*/;
424 exit(UNTAG_Int( TAG_Int(1)));
425 fprintf(stderr, "Aborted"); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ToolContext___get_module_from_filename, LOCATE_mmloader, 184); nit_exit(1);
426 return_label9: while(false);
427 tracehead = trace.prev;
428 return variable1;
429 }
430 val_t mmloader___ToolContext___get_module(val_t self, val_t param0, val_t param1) {
431 struct trace_t trace = {NULL, NULL, 187, LOCATE_mmloader___ToolContext___get_module};
432 val_t variable0;
433 val_t variable1;
434 val_t variable2;
435 val_t variable3;
436 val_t variable4;
437 val_t variable5;
438 val_t variable6;
439 val_t variable7;
440 val_t variable8;
441 trace.prev = tracehead; tracehead = &trace;
442 trace.file = LOCATE_mmloader;
443 variable0 = param0;
444 variable1 = param1;
445 variable2 = NIT_NULL /*decl variable m*/;
446 variable3 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable1 /*from*/ == NIT_NULL /*null*/) || (( variable1 /*from*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable1 /*from*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable1 /*from*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable1 /*from*/,COLOR_kernel___Object_____eqeq))( variable1 /*from*/, NIT_NULL /*null*/) /*Object::==*/)))))));
447 if (UNTAG_Bool(variable3)) { /*if*/
448 variable4 = ((abstractmetamodel___MMModule___directory_t)CALL( variable1 /*from*/,COLOR_abstractmetamodel___MMModule___directory))( variable1 /*from*/) /*MMModule::directory*/;
449 variable3 = variable4;
450 while (true) { /*while*/
451 variable4 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable3 /*dir*/ == NIT_NULL /*null*/) || (( variable3 /*dir*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable3 /*dir*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable3 /*dir*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable3 /*dir*/,COLOR_kernel___Object_____eqeq))( variable3 /*dir*/, NIT_NULL /*null*/) /*Object::==*/)))))));
452 if (!UNTAG_Bool(variable4)) break; /* while*/
453 variable5 = ((mmloader___ToolContext___try_to_load_t)CALL( self,COLOR_mmloader___ToolContext___try_to_load))( self, variable0 /*module_name*/, variable3 /*dir*/) /*ToolContext::try_to_load*/;
454 variable4 = variable5;
455 variable5 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable4 /*m*/ == NIT_NULL /*null*/) || (( variable4 /*m*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable4 /*m*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable4 /*m*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable4 /*m*/,COLOR_kernel___Object_____eqeq))( variable4 /*m*/, NIT_NULL /*null*/) /*Object::==*/)))))));
456 if (UNTAG_Bool(variable5)) { /*if*/
457 variable2 = variable4 /*m*/;
458 goto return_label10;
459 }
460 variable5 = ((abstractmetamodel___MMDirectory___parent_t)CALL( variable3 /*dir*/,COLOR_abstractmetamodel___MMDirectory___parent))( variable3 /*dir*/) /*MMDirectory::parent*/;
461 variable3 = variable5 /*dir=*/;
462 continue_11: while(0);
463 }
464 break_11: while(0);
465 }
466 variable3 = ((mmloader___ToolContext___paths_t)CALL( self,COLOR_mmloader___ToolContext___paths))( self) /*ToolContext::paths*/;
467 variable3 = ((array___AbstractArray___iterator_t)CALL(variable3,COLOR_abstract_collection___Collection___iterator))(variable3) /*AbstractArray::iterator*/;
468 while (true) { /*for*/
469 variable4 = ((array___ArrayIterator___is_ok_t)CALL(variable3,COLOR_abstract_collection___Iterator___is_ok))(variable3) /*ArrayIterator::is_ok*/;
470 if (!UNTAG_Bool(variable4)) break; /*for*/
471 variable4 = ((array___ArrayIterator___item_t)CALL(variable3,COLOR_abstract_collection___Iterator___item))(variable3) /*ArrayIterator::item*/;
472 variable6 = ((mmloader___ToolContext___directory_for_t)CALL( self,COLOR_mmloader___ToolContext___directory_for))( self, variable4 /*p*/) /*ToolContext::directory_for*/;
473 variable6 = ((mmloader___ToolContext___try_to_load_t)CALL( self,COLOR_mmloader___ToolContext___try_to_load))( self, variable0 /*module_name*/, variable6) /*ToolContext::try_to_load*/;
474 variable5 = variable6;
475 variable6 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable5 /*m*/ == NIT_NULL /*null*/) || (( variable5 /*m*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable5 /*m*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable5 /*m*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable5 /*m*/,COLOR_kernel___Object_____eqeq))( variable5 /*m*/, NIT_NULL /*null*/) /*Object::==*/)))))));
476 if (UNTAG_Bool(variable6)) { /*if*/
477 variable2 = variable5 /*m*/;
478 goto return_label10;
479 }
480 continue_12: while(0);
481 ((array___ArrayIterator___next_t)CALL(variable3,COLOR_abstract_collection___Iterator___next))(variable3) /*ArrayIterator::next*/;
482 }
483 break_12: while(0);
484 variable3 = NEW_String_string___String___init(); /*new String*/
485 variable4 = NEW_String_string___String___with_native(BOX_NativeString("Error: No ressource found for module "), TAG_Int(37)); /*new String*/
486 variable5 = variable4;
487 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable5) /*String::append*/;
488 variable6 = variable0 /*module_name*/;
489 variable6 = ((string___String___to_s_t)CALL(variable6,COLOR_string___Object___to_s))(variable6) /*String::to_s*/;
490 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable6) /*String::append*/;
491 variable7 = NEW_String_string___String___with_native(BOX_NativeString("."), TAG_Int(1)); /*new String*/
492 variable8 = variable7;
493 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable8) /*String::append*/;
494 ((mmloader___ToolContext___error_t)CALL( self,COLOR_mmloader___ToolContext___error))( self, variable3) /*ToolContext::error*/;
495 exit(UNTAG_Int( TAG_Int(1)));
496 fprintf(stderr, "Aborted"); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ToolContext___get_module, LOCATE_mmloader, 208); nit_exit(1);
497 return_label10: while(false);
498 tracehead = trace.prev;
499 return variable2;
500 }
501 val_t mmloader___ToolContext___directory_for(val_t self, val_t param0) {
502 struct trace_t trace = {NULL, NULL, 211, LOCATE_mmloader___ToolContext___directory_for};
503 val_t variable0;
504 val_t variable1;
505 val_t variable2;
506 val_t variable3;
507 trace.prev = tracehead; tracehead = &trace;
508 trace.file = LOCATE_mmloader;
509 variable0 = param0;
510 variable1 = ATTR_mmloader___ToolContext____path_dirs( self) /*ToolContext::_path_dirs*/;
511 variable1 = ((abstract_collection___Map___has_key_t)CALL(variable1,COLOR_abstract_collection___Map___has_key))(variable1, variable0 /*path*/) /*Map::has_key*/;
512 if (UNTAG_Bool(variable1)) { /*if*/
513 variable1 = ATTR_mmloader___ToolContext____path_dirs( self) /*ToolContext::_path_dirs*/;
514 variable1 = ((abstract_collection___Map_____bra_t)CALL(variable1,COLOR_abstract_collection___Map_____bra))(variable1, variable0 /*path*/) /*Map::[]*/;
515 goto return_label13;
516 }
517 variable2 = ((symbol___String___to_symbol_t)CALL( variable0 /*path*/,COLOR_symbol___String___to_symbol))( variable0 /*path*/) /*String::to_symbol*/;
518 variable3 = NEW_MMDirectory_abstractmetamodel___MMDirectory___init(variable2, variable0 /*path*/, NIT_NULL /*null*/); /*new MMDirectory*/
519 variable2 = variable3;
520 variable1 = variable2;
521 variable2 = ATTR_mmloader___ToolContext____path_dirs( self) /*ToolContext::_path_dirs*/;
522 ((abstract_collection___Map_____braeq_t)CALL(variable2,COLOR_abstract_collection___Map_____braeq))(variable2, variable0 /*path*/, variable1 /*dir*/) /*Map::[]=*/;
523 variable1 = variable1 /*dir*/;
524 goto return_label13;
525 return_label13: while(false);
526 tracehead = trace.prev;
527 return variable1;
528 }
529 void mmloader___ToolContext___register_loader(val_t self, val_t param0) {
530 struct trace_t trace = {NULL, NULL, 223, LOCATE_mmloader___ToolContext___register_loader};
531 val_t variable0;
532 val_t variable1;
533 trace.prev = tracehead; tracehead = &trace;
534 trace.file = LOCATE_mmloader;
535 variable0 = param0;
536 variable1 = ATTR_mmloader___ToolContext____loaders( self) /*ToolContext::_loaders*/;
537 ((array___AbstractArray___add_t)CALL(variable1,COLOR_abstract_collection___SimpleCollection___add))(variable1, variable0 /*ml*/) /*AbstractArray::add*/;
538 tracehead = trace.prev;
539 return;
540 }
541 val_t mmloader___ModuleLoader___file_type(val_t self) {
542 struct trace_t trace = {NULL, NULL, 232, LOCATE_mmloader___ModuleLoader___file_type};
543 trace.prev = tracehead; tracehead = &trace;
544 trace.file = LOCATE_mmloader;
545 fprintf(stderr, "Deferred method %s called");
546 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ToolContext___register_loader, LOCATE_mmloader, 232);
547 nit_exit(1);
548 tracehead = trace.prev;
549 return NIT_NULL;
550 }
551 val_t mmloader___ModuleLoader___try_to_load_dir(val_t self, val_t param0, val_t param1) {
552 struct trace_t trace = {NULL, NULL, 235, LOCATE_mmloader___ModuleLoader___try_to_load_dir};
553 val_t variable0;
554 val_t variable1;
555 val_t variable2;
556 val_t variable3;
557 val_t variable4;
558 val_t variable5;
559 val_t variable6;
560 val_t variable7;
561 val_t variable8;
562 val_t variable9;
563 val_t variable10;
564 val_t variable11;
565 val_t variable12;
566 trace.prev = tracehead; tracehead = &trace;
567 trace.file = LOCATE_mmloader;
568 variable0 = param0;
569 variable1 = param1;
570 variable3 = NEW_String_string___String___init(); /*new String*/
571 variable4 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
572 variable5 = variable4;
573 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable5) /*String::append*/;
574 variable6 = ((abstractmetamodel___MMDirectory___path_t)CALL( variable1 /*parent_dir*/,COLOR_abstractmetamodel___MMDirectory___path))( variable1 /*parent_dir*/) /*MMDirectory::path*/;
575 variable7 = variable6;
576 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable7) /*String::append*/;
577 variable8 = NEW_String_string___String___with_native(BOX_NativeString("/"), TAG_Int(1)); /*new String*/
578 variable9 = variable8;
579 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable9) /*String::append*/;
580 variable10 = variable0 /*dirname*/;
581 variable10 = ((string___String___to_s_t)CALL(variable10,COLOR_string___Object___to_s))(variable10) /*String::to_s*/;
582 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable10) /*String::append*/;
583 variable11 = NEW_String_string___String___with_native(BOX_NativeString("/"), TAG_Int(1)); /*new String*/
584 variable12 = variable11;
585 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable12) /*String::append*/;
586 variable2 = variable3;
587 variable3 = ((file___String___file_exists_t)CALL( variable2 /*fname*/,COLOR_file___String___file_exists))( variable2 /*fname*/) /*String::file_exists*/;
588 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable3)))) { /*if*/
589 variable2 = NIT_NULL /*null*/;
590 goto return_label15;
591 }
592 variable4 = ((abstractmetamodel___MMDirectory___full_name_for_t)CALL( variable1 /*parent_dir*/,COLOR_abstractmetamodel___MMDirectory___full_name_for))( variable1 /*parent_dir*/, variable0 /*dirname*/) /*MMDirectory::full_name_for*/;
593 variable5 = NEW_MMDirectory_abstractmetamodel___MMDirectory___init(variable4, variable2 /*fname*/, variable1 /*parent_dir*/); /*new MMDirectory*/
594 variable4 = variable5;
595 variable3 = variable4;
596 variable2 = variable3 /*dir*/;
597 goto return_label15;
598 return_label15: while(false);
599 tracehead = trace.prev;
600 return variable2;
601 }
602 val_t mmloader___ModuleLoader___can_handle(val_t self, val_t param0, val_t param1) {
603 struct trace_t trace = {NULL, NULL, 245, LOCATE_mmloader___ModuleLoader___can_handle};
604 val_t variable0;
605 val_t variable1;
606 val_t variable2;
607 val_t variable3;
608 val_t variable4;
609 val_t variable5;
610 val_t variable6;
611 val_t variable7;
612 val_t variable8;
613 val_t variable9;
614 val_t variable10;
615 val_t variable11;
616 val_t variable12;
617 val_t variable13;
618 val_t variable14;
619 val_t variable15;
620 val_t variable16;
621 trace.prev = tracehead; tracehead = &trace;
622 trace.file = LOCATE_mmloader;
623 variable0 = param0;
624 variable1 = param1;
625 variable3 = NEW_String_string___String___init(); /*new String*/
626 variable4 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
627 variable5 = variable4;
628 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable5) /*String::append*/;
629 variable6 = ((abstractmetamodel___MMDirectory___path_t)CALL( variable1 /*dir*/,COLOR_abstractmetamodel___MMDirectory___path))( variable1 /*dir*/) /*MMDirectory::path*/;
630 variable7 = variable6;
631 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable7) /*String::append*/;
632 variable8 = NEW_String_string___String___with_native(BOX_NativeString("/"), TAG_Int(1)); /*new String*/
633 variable9 = variable8;
634 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable9) /*String::append*/;
635 variable10 = variable0 /*module_name*/;
636 variable10 = ((string___String___to_s_t)CALL(variable10,COLOR_string___Object___to_s))(variable10) /*String::to_s*/;
637 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable10) /*String::append*/;
638 variable11 = NEW_String_string___String___with_native(BOX_NativeString("."), TAG_Int(1)); /*new String*/
639 variable12 = variable11;
640 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable12) /*String::append*/;
641 variable13 = ((mmloader___ModuleLoader___file_type_t)CALL( self,COLOR_mmloader___ModuleLoader___file_type))( self) /*ModuleLoader::file_type*/;
642 variable14 = variable13;
643 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable14) /*String::append*/;
644 variable15 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
645 variable16 = variable15;
646 ((string___String___append_t)CALL(variable3,COLOR_abstract_collection___IndexedCollection___append))(variable3, variable16) /*String::append*/;
647 variable2 = variable3;
648 variable3 = ((file___String___file_exists_t)CALL( variable2 /*fname*/,COLOR_file___String___file_exists))( variable2 /*fname*/) /*String::file_exists*/;
649 if (UNTAG_Bool(variable3)) { /*if*/
650 variable2 = TAG_Bool(true);
651 goto return_label16;
652 }
653 variable2 = TAG_Bool(false);
654 goto return_label16;
655 return_label16: while(false);
656 tracehead = trace.prev;
657 return variable2;
658 }
659 val_t mmloader___ModuleLoader___load_and_process_module(val_t self, val_t param0, val_t param1, val_t param2) {
660 struct trace_t trace = {NULL, NULL, 254, LOCATE_mmloader___ModuleLoader___load_and_process_module};
661 val_t variable0;
662 val_t variable1;
663 val_t variable2;
664 val_t variable3;
665 val_t variable4;
666 val_t variable5;
667 val_t variable6;
668 val_t variable7;
669 val_t variable8;
670 val_t variable9;
671 val_t variable10;
672 val_t variable11;
673 val_t variable12;
674 val_t variable13;
675 val_t variable14;
676 val_t variable15;
677 val_t variable16;
678 val_t variable17;
679 trace.prev = tracehead; tracehead = &trace;
680 trace.file = LOCATE_mmloader;
681 variable0 = param0;
682 variable1 = param1;
683 variable2 = param2;
684 variable4 = NEW_String_string___String___init(); /*new String*/
685 variable5 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
686 variable6 = variable5;
687 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable6) /*String::append*/;
688 variable7 = ((abstractmetamodel___MMDirectory___path_t)CALL( variable2 /*dir*/,COLOR_abstractmetamodel___MMDirectory___path))( variable2 /*dir*/) /*MMDirectory::path*/;
689 variable8 = variable7;
690 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable8) /*String::append*/;
691 variable9 = NEW_String_string___String___with_native(BOX_NativeString("/"), TAG_Int(1)); /*new String*/
692 variable10 = variable9;
693 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable10) /*String::append*/;
694 variable11 = variable1 /*module_name*/;
695 variable11 = ((string___String___to_s_t)CALL(variable11,COLOR_string___Object___to_s))(variable11) /*String::to_s*/;
696 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable11) /*String::append*/;
697 variable12 = NEW_String_string___String___with_native(BOX_NativeString("."), TAG_Int(1)); /*new String*/
698 variable13 = variable12;
699 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable13) /*String::append*/;
700 variable14 = ((mmloader___ModuleLoader___file_type_t)CALL( self,COLOR_mmloader___ModuleLoader___file_type))( self) /*ModuleLoader::file_type*/;
701 variable15 = variable14;
702 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable15) /*String::append*/;
703 variable16 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
704 variable17 = variable16;
705 ((string___String___append_t)CALL(variable4,COLOR_abstract_collection___IndexedCollection___append))(variable4, variable17) /*String::append*/;
706 variable3 = variable4;
707 variable5 = ((mmloader___ModuleLoader___load_module_t)CALL( self,COLOR_mmloader___ModuleLoader___load_module))( self, variable0 /*context*/, variable1 /*module_name*/, variable2 /*dir*/, variable3 /*filename*/) /*ModuleLoader::load_module*/;
708 variable4 = variable5;
709 variable5 = ((mmloader___ToolContext___opt_only_parse_t)CALL( variable0 /*context*/,COLOR_mmloader___ToolContext___opt_only_parse))( variable0 /*context*/) /*ToolContext::opt_only_parse*/;
710 variable5 = ((opts___Option___value_t)CALL(variable5,COLOR_opts___Option___value))(variable5) /*Option::value*/;
711 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable5)))) { /*if*/
712 ((mmloader___ModuleLoader___process_metamodel_t)CALL( self,COLOR_mmloader___ModuleLoader___process_metamodel))( self, variable0 /*context*/, variable4 /*m*/) /*ModuleLoader::process_metamodel*/;
713 }
714 variable3 = variable4 /*m*/;
715 goto return_label17;
716 return_label17: while(false);
717 tracehead = trace.prev;
718 return variable3;
719 }
720 val_t mmloader___ModuleLoader___load_module(val_t self, val_t param0, val_t param1, val_t param2, val_t param3) {
721 struct trace_t trace = {NULL, NULL, 264, LOCATE_mmloader___ModuleLoader___load_module};
722 val_t variable0;
723 val_t variable1;
724 val_t variable2;
725 val_t variable3;
726 val_t variable4;
727 val_t variable5;
728 val_t variable6;
729 val_t variable7;
730 val_t variable8;
731 val_t variable9;
732 val_t variable10;
733 trace.prev = tracehead; tracehead = &trace;
734 trace.file = LOCATE_mmloader;
735 variable0 = param0;
736 variable1 = param1;
737 variable2 = param2;
738 variable3 = param3;
739 variable4 = NIT_NULL /*decl variable file*/;
740 variable5 = NEW_String_string___String___with_native(BOX_NativeString("-"), TAG_Int(1)); /*new String*/
741 variable5 = TAG_Bool(( variable3 /*filename*/ == variable5) || (( variable3 /*filename*/ != NIT_NULL) && UNTAG_Bool(((string___String_____eqeq_t)CALL( variable3 /*filename*/,COLOR_kernel___Object_____eqeq))( variable3 /*filename*/, variable5) /*String::==*/)));
742 if (UNTAG_Bool(variable5)) { /*if*/
743 variable5 = ((file___Object___stdin_t)CALL( self,COLOR_file___Object___stdin))( self) /*Object::stdin*/;
744 variable4 = variable5 /*file=*/;
745 } else { /*if*/
746 variable5 = ((string___String___to_s_t)CALL( variable3 /*filename*/,COLOR_string___Object___to_s))( variable3 /*filename*/) /*String::to_s*/;
747 variable6 = NEW_IFStream_file___IFStream___open(variable5); /*new IFStream*/
748 variable5 = variable6;
749 variable4 = variable5 /*file=*/;
750 }
751 variable5 = ((stream___BufferedIStream___eof_t)CALL( variable4 /*file*/,COLOR_stream___IStream___eof))( variable4 /*file*/) /*BufferedIStream::eof*/;
752 if (UNTAG_Bool(variable5)) { /*if*/
753 variable5 = NEW_String_string___String___init(); /*new String*/
754 variable6 = NEW_String_string___String___with_native(BOX_NativeString("Error: Problem in opening file "), TAG_Int(31)); /*new String*/
755 variable7 = variable6;
756 ((string___String___append_t)CALL(variable5,COLOR_abstract_collection___IndexedCollection___append))(variable5, variable7) /*String::append*/;
757 variable8 = variable3 /*filename*/;
758 ((string___String___append_t)CALL(variable5,COLOR_abstract_collection___IndexedCollection___append))(variable5, variable8) /*String::append*/;
759 variable9 = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
760 variable10 = variable9;
761 ((string___String___append_t)CALL(variable5,COLOR_abstract_collection___IndexedCollection___append))(variable5, variable10) /*String::append*/;
762 ((mmloader___ToolContext___error_t)CALL( variable0 /*context*/,COLOR_mmloader___ToolContext___error))( variable0 /*context*/, variable5) /*ToolContext::error*/;
763 exit(UNTAG_Int( TAG_Int(1)));
764 fprintf(stderr, "Aborted"); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ModuleLoader___load_module, LOCATE_mmloader, 277); nit_exit(1);
765 }
766 variable6 = ((mmloader___ModuleLoader___parse_file_t)CALL( self,COLOR_mmloader___ModuleLoader___parse_file))( self, variable0 /*context*/, variable4 /*file*/, variable3 /*filename*/, variable1 /*module_name*/, variable2 /*dir*/) /*ModuleLoader::parse_file*/;
767 variable5 = variable6;
768 ((mmloader___MMModule___filename__eq_t)CALL( variable5 /*m*/,COLOR_mmloader___MMModule___filename__eq))( variable5 /*m*/, variable3 /*filename*/) /*MMModule::filename=*/;
769 variable6 = ((file___Object___stdin_t)CALL( self,COLOR_file___Object___stdin))( self) /*Object::stdin*/;
770 variable6 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable4 /*file*/ == variable6) || (( variable4 /*file*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable4 /*file*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable4 /*file*/,variable6)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable4 /*file*/,COLOR_kernel___Object_____eqeq))( variable4 /*file*/, variable6) /*Object::==*/)))))));
771 if (UNTAG_Bool(variable6)) { /*if*/
772 ((file___IFStream___close_t)CALL( variable4 /*file*/,COLOR_stream___IOS___close))( variable4 /*file*/) /*IFStream::close*/;
773 }
774 variable4 = variable5 /*m*/;
775 goto return_label18;
776 return_label18: while(false);
777 tracehead = trace.prev;
778 return variable4;
779 }
780 val_t mmloader___ModuleLoader___parse_file(val_t self, val_t param0, val_t param1, val_t param2, val_t param3, val_t param4) {
781 struct trace_t trace = {NULL, NULL, 285, LOCATE_mmloader___ModuleLoader___parse_file};
782 trace.prev = tracehead; tracehead = &trace;
783 trace.file = LOCATE_mmloader;
784 fprintf(stderr, "Deferred method %s called");
785 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ModuleLoader___load_module, LOCATE_mmloader, 285);
786 nit_exit(1);
787 tracehead = trace.prev;
788 return NIT_NULL;
789 }
790 void mmloader___ModuleLoader___process_metamodel(val_t self, val_t param0, val_t param1) {
791 struct trace_t trace = {NULL, NULL, 288, LOCATE_mmloader___ModuleLoader___process_metamodel};
792 trace.prev = tracehead; tracehead = &trace;
793 trace.file = LOCATE_mmloader;
794 fprintf(stderr, "Deferred method %s called");
795 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___ModuleLoader___load_module, LOCATE_mmloader, 288);
796 nit_exit(1);
797 tracehead = trace.prev;
798 return;
799 }
800 void mmloader___ModuleLoader___init(val_t self, int* init_table) {
801 struct trace_t trace = {NULL, NULL, 0, LOCATE_mmloader___ModuleLoader___init};
802 trace.prev = tracehead; tracehead = &trace;
803 trace.file = LOCATE_mmloader;
804 tracehead = trace.prev;
805 return;
806 }
807 val_t mmloader___MMModule___filename(val_t self) {
808 struct trace_t trace = {NULL, NULL, 293, LOCATE_mmloader___MMModule___filename};
809 trace.prev = tracehead; tracehead = &trace;
810 trace.file = LOCATE_mmloader;
811 tracehead = trace.prev;
812 return ATTR_mmloader___MMModule____filename( self) /*MMModule::_filename*/;
813 }
814 void mmloader___MMModule___filename__eq(val_t self, val_t param0) {
815 struct trace_t trace = {NULL, NULL, 293, LOCATE_mmloader___MMModule___filename__eq};
816 trace.prev = tracehead; tracehead = &trace;
817 trace.file = LOCATE_mmloader;
818 ATTR_mmloader___MMModule____filename( self) /*MMModule::_filename*/ = param0;
819 tracehead = trace.prev;
820 return;
821 }
822 val_t mmloader___MMModule___mtime(val_t self) {
823 struct trace_t trace = {NULL, NULL, 296, LOCATE_mmloader___MMModule___mtime};
824 trace.prev = tracehead; tracehead = &trace;
825 trace.file = LOCATE_mmloader;
826 tracehead = trace.prev;
827 return ATTR_mmloader___MMModule____mtime( self) /*MMModule::_mtime*/;
828 }
829 void mmloader___MMModule___mtime__eq(val_t self, val_t param0) {
830 struct trace_t trace = {NULL, NULL, 296, LOCATE_mmloader___MMModule___mtime__eq};
831 trace.prev = tracehead; tracehead = &trace;
832 trace.file = LOCATE_mmloader;
833 ATTR_mmloader___MMModule____mtime( self) /*MMModule::_mtime*/ = param0;
834 tracehead = trace.prev;
835 return;
836 }
837 void mmloader___MMModule___import_supers_modules(val_t self, val_t param0) {
838 struct trace_t trace = {NULL, NULL, 299, LOCATE_mmloader___MMModule___import_supers_modules};
839 val_t variable0;
840 val_t variable1;
841 val_t variable2;
842 val_t variable3;
843 val_t variable4;
844 val_t variable5;
845 val_t variable6;
846 trace.prev = tracehead; tracehead = &trace;
847 trace.file = LOCATE_mmloader;
848 variable0 = param0;
849 variable2 = ((abstractmetamodel___MMModule___context_t)CALL( self,COLOR_abstractmetamodel___MMModule___context))( self) /*MMModule::context*/;
850 variable1 = variable2;
851 variable2 = TAG_Bool(( variable1 /*c*/==NIT_NULL) || VAL_ISA( variable1 /*c*/, COLOR_ToolContext, ID_ToolContext)) /*cast ToolContext*/;
852 if (!UNTAG_Bool(variable2)) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_mmloader___MMModule___import_supers_modules, LOCATE_mmloader, 303); nit_exit(1);}
853 variable3 = NEW_Array_array___Array___init(); /*new Array[MMModule]*/
854 variable2 = variable3;
855 variable3 = ((abstract_collection___Collection___iterator_t)CALL( variable0 /*names*/,COLOR_abstract_collection___Collection___iterator))( variable0 /*names*/) /*Collection::iterator*/;
856 while (true) { /*for*/
857 variable4 = ((abstract_collection___Iterator___is_ok_t)CALL(variable3,COLOR_abstract_collection___Iterator___is_ok))(variable3) /*Iterator::is_ok*/;
858 if (!UNTAG_Bool(variable4)) break; /*for*/
859 variable4 = ((abstract_collection___Iterator___item_t)CALL(variable3,COLOR_abstract_collection___Iterator___item))(variable3) /*Iterator::item*/;
860 variable6 = ((mmloader___ToolContext___get_module_t)CALL( variable1 /*c*/,COLOR_mmloader___ToolContext___get_module))( variable1 /*c*/, variable4 /*n*/, self) /*ToolContext::get_module*/;
861 variable5 = variable6;
862 ((array___AbstractArray___add_t)CALL( variable2 /*supers*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*supers*/, variable5 /*m*/) /*AbstractArray::add*/;
863 continue_20: while(0);
864 ((abstract_collection___Iterator___next_t)CALL(variable3,COLOR_abstract_collection___Iterator___next))(variable3) /*Iterator::next*/;
865 }
866 break_20: while(0);
867 ((abstractmetamodel___MMContext___add_module_t)CALL( variable1 /*c*/,COLOR_abstractmetamodel___MMContext___add_module))( variable1 /*c*/, self, variable2 /*supers*/) /*MMContext::add_module*/;
868 tracehead = trace.prev;
869 return;
870 }