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