README: add system configuration for OS X
[nit.git] / c_src / nitc__c_tools.sep.1.c
1 #include "nitc__c_tools.sep.0.h"
2 /* method c_tools#CCompilationUnit#header_c_base for (self: CCompilationUnit): Template */
3 val* nitc___nitc__CCompilationUnit___header_c_base(val* self) {
4 val* var /* : Template */;
5 val* var1 /* : Template */;
6 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_c_base].val; /* _header_c_base on <self:CCompilationUnit> */
7 if (unlikely(var1 == NULL)) {
8 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_c_base");
9 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 24);
10 fatal_exit(1);
11 }
12 var = var1;
13 RET_LABEL:;
14 return var;
15 }
16 /* method c_tools#CCompilationUnit#header_custom for (self: CCompilationUnit): Template */
17 val* nitc___nitc__CCompilationUnit___header_custom(val* self) {
18 val* var /* : Template */;
19 val* var1 /* : Template */;
20 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_custom].val; /* _header_custom on <self:CCompilationUnit> */
21 if (unlikely(var1 == NULL)) {
22 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_custom");
23 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 28);
24 fatal_exit(1);
25 }
26 var = var1;
27 RET_LABEL:;
28 return var;
29 }
30 /* method c_tools#CCompilationUnit#header_c_types for (self: CCompilationUnit): Template */
31 val* nitc___nitc__CCompilationUnit___header_c_types(val* self) {
32 val* var /* : Template */;
33 val* var1 /* : Template */;
34 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_c_types].val; /* _header_c_types on <self:CCompilationUnit> */
35 if (unlikely(var1 == NULL)) {
36 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_c_types");
37 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 31);
38 fatal_exit(1);
39 }
40 var = var1;
41 RET_LABEL:;
42 return var;
43 }
44 /* method c_tools#CCompilationUnit#header_decl for (self: CCompilationUnit): Template */
45 val* nitc___nitc__CCompilationUnit___header_decl(val* self) {
46 val* var /* : Template */;
47 val* var1 /* : Template */;
48 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_decl].val; /* _header_decl on <self:CCompilationUnit> */
49 if (unlikely(var1 == NULL)) {
50 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_decl");
51 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 34);
52 fatal_exit(1);
53 }
54 var = var1;
55 RET_LABEL:;
56 return var;
57 }
58 /* method c_tools#CCompilationUnit#body_decl for (self: CCompilationUnit): Template */
59 val* nitc___nitc__CCompilationUnit___body_decl(val* self) {
60 val* var /* : Template */;
61 val* var1 /* : Template */;
62 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___body_decl].val; /* _body_decl on <self:CCompilationUnit> */
63 if (unlikely(var1 == NULL)) {
64 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _body_decl");
65 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 37);
66 fatal_exit(1);
67 }
68 var = var1;
69 RET_LABEL:;
70 return var;
71 }
72 /* method c_tools#CCompilationUnit#body_custom for (self: CCompilationUnit): Template */
73 val* nitc___nitc__CCompilationUnit___body_custom(val* self) {
74 val* var /* : Template */;
75 val* var1 /* : Template */;
76 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___body_custom].val; /* _body_custom on <self:CCompilationUnit> */
77 if (unlikely(var1 == NULL)) {
78 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _body_custom");
79 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 41);
80 fatal_exit(1);
81 }
82 var = var1;
83 RET_LABEL:;
84 return var;
85 }
86 /* method c_tools#CCompilationUnit#body_impl for (self: CCompilationUnit): Template */
87 val* nitc___nitc__CCompilationUnit___body_impl(val* self) {
88 val* var /* : Template */;
89 val* var1 /* : Template */;
90 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___body_impl].val; /* _body_impl on <self:CCompilationUnit> */
91 if (unlikely(var1 == NULL)) {
92 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _body_impl");
93 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 44);
94 fatal_exit(1);
95 }
96 var = var1;
97 RET_LABEL:;
98 return var;
99 }
100 /* method c_tools#CCompilationUnit#files for (self: CCompilationUnit): Array[String] */
101 val* nitc___nitc__CCompilationUnit___files(val* self) {
102 val* var /* : Array[String] */;
103 val* var1 /* : Array[String] */;
104 var1 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___files].val; /* _files on <self:CCompilationUnit> */
105 if (unlikely(var1 == NULL)) {
106 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _files");
107 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 47);
108 fatal_exit(1);
109 }
110 var = var1;
111 RET_LABEL:;
112 return var;
113 }
114 /* method c_tools#CCompilationUnit#compile_header_core for (self: CCompilationUnit, Writer) */
115 void nitc___nitc__CCompilationUnit___compile_header_core(val* self, val* p0) {
116 val* var_stream /* var stream: Writer */;
117 val* var /* : Template */;
118 val* var2 /* : Template */;
119 val* var3 /* : Template */;
120 val* var5 /* : Template */;
121 val* var6 /* : Template */;
122 val* var8 /* : Template */;
123 val* var9 /* : Template */;
124 val* var11 /* : Template */;
125 var_stream = p0;
126 {
127 { /* Inline c_tools#CCompilationUnit#header_c_base (self) on <self:CCompilationUnit> */
128 var2 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_c_base].val; /* _header_c_base on <self:CCompilationUnit> */
129 if (unlikely(var2 == NULL)) {
130 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_c_base");
131 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 24);
132 fatal_exit(1);
133 }
134 var = var2;
135 RET_LABEL1:(void)0;
136 }
137 }
138 {
139 template___template__Template___core__stream__Writable__write_to(var, var_stream); /* Direct call template#Template#write_to on <var:Template>*/
140 }
141 {
142 { /* Inline c_tools#CCompilationUnit#header_custom (self) on <self:CCompilationUnit> */
143 var5 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_custom].val; /* _header_custom on <self:CCompilationUnit> */
144 if (unlikely(var5 == NULL)) {
145 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_custom");
146 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 28);
147 fatal_exit(1);
148 }
149 var3 = var5;
150 RET_LABEL4:(void)0;
151 }
152 }
153 {
154 template___template__Template___core__stream__Writable__write_to(var3, var_stream); /* Direct call template#Template#write_to on <var3:Template>*/
155 }
156 {
157 { /* Inline c_tools#CCompilationUnit#header_c_types (self) on <self:CCompilationUnit> */
158 var8 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_c_types].val; /* _header_c_types on <self:CCompilationUnit> */
159 if (unlikely(var8 == NULL)) {
160 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_c_types");
161 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 31);
162 fatal_exit(1);
163 }
164 var6 = var8;
165 RET_LABEL7:(void)0;
166 }
167 }
168 {
169 template___template__Template___core__stream__Writable__write_to(var6, var_stream); /* Direct call template#Template#write_to on <var6:Template>*/
170 }
171 {
172 { /* Inline c_tools#CCompilationUnit#header_decl (self) on <self:CCompilationUnit> */
173 var11 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___header_decl].val; /* _header_decl on <self:CCompilationUnit> */
174 if (unlikely(var11 == NULL)) {
175 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _header_decl");
176 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 34);
177 fatal_exit(1);
178 }
179 var9 = var11;
180 RET_LABEL10:(void)0;
181 }
182 }
183 {
184 template___template__Template___core__stream__Writable__write_to(var9, var_stream); /* Direct call template#Template#write_to on <var9:Template>*/
185 }
186 RET_LABEL:;
187 }
188 /* method c_tools#CCompilationUnit#compile_body_core for (self: CCompilationUnit, Writer) */
189 void nitc___nitc__CCompilationUnit___compile_body_core(val* self, val* p0) {
190 val* var_stream /* var stream: Writer */;
191 val* var /* : Template */;
192 val* var2 /* : Template */;
193 val* var3 /* : Template */;
194 val* var5 /* : Template */;
195 val* var6 /* : Template */;
196 val* var8 /* : Template */;
197 var_stream = p0;
198 {
199 { /* Inline c_tools#CCompilationUnit#body_decl (self) on <self:CCompilationUnit> */
200 var2 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___body_decl].val; /* _body_decl on <self:CCompilationUnit> */
201 if (unlikely(var2 == NULL)) {
202 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _body_decl");
203 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 37);
204 fatal_exit(1);
205 }
206 var = var2;
207 RET_LABEL1:(void)0;
208 }
209 }
210 {
211 template___template__Template___core__stream__Writable__write_to(var, var_stream); /* Direct call template#Template#write_to on <var:Template>*/
212 }
213 {
214 { /* Inline c_tools#CCompilationUnit#body_custom (self) on <self:CCompilationUnit> */
215 var5 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___body_custom].val; /* _body_custom on <self:CCompilationUnit> */
216 if (unlikely(var5 == NULL)) {
217 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _body_custom");
218 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 41);
219 fatal_exit(1);
220 }
221 var3 = var5;
222 RET_LABEL4:(void)0;
223 }
224 }
225 {
226 template___template__Template___core__stream__Writable__write_to(var3, var_stream); /* Direct call template#Template#write_to on <var3:Template>*/
227 }
228 {
229 { /* Inline c_tools#CCompilationUnit#body_impl (self) on <self:CCompilationUnit> */
230 var8 = self->attrs[COLOR_nitc__c_tools__CCompilationUnit___body_impl].val; /* _body_impl on <self:CCompilationUnit> */
231 if (unlikely(var8 == NULL)) {
232 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _body_impl");
233 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 44);
234 fatal_exit(1);
235 }
236 var6 = var8;
237 RET_LABEL7:(void)0;
238 }
239 }
240 {
241 template___template__Template___core__stream__Writable__write_to(var6, var_stream); /* Direct call template#Template#write_to on <var6:Template>*/
242 }
243 RET_LABEL:;
244 }
245 /* method c_tools#CFunction#signature for (self: CFunction): String */
246 val* nitc___nitc__CFunction___signature(val* self) {
247 val* var /* : String */;
248 val* var1 /* : String */;
249 var1 = self->attrs[COLOR_nitc__c_tools__CFunction___signature].val; /* _signature on <self:CFunction> */
250 if (unlikely(var1 == NULL)) {
251 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _signature");
252 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 86);
253 fatal_exit(1);
254 }
255 var = var1;
256 RET_LABEL:;
257 return var;
258 }
259 /* method c_tools#CFunction#signature= for (self: CFunction, String) */
260 void nitc___nitc__CFunction___signature_61d(val* self, val* p0) {
261 self->attrs[COLOR_nitc__c_tools__CFunction___signature].val = p0; /* _signature on <self:CFunction> */
262 RET_LABEL:;
263 }
264 /* method c_tools#CFunction#decls for (self: CFunction): Template */
265 val* nitc___nitc__CFunction___decls(val* self) {
266 val* var /* : Template */;
267 val* var1 /* : Template */;
268 var1 = self->attrs[COLOR_nitc__c_tools__CFunction___decls].val; /* _decls on <self:CFunction> */
269 if (unlikely(var1 == NULL)) {
270 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _decls");
271 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 88);
272 fatal_exit(1);
273 }
274 var = var1;
275 RET_LABEL:;
276 return var;
277 }
278 /* method c_tools#CFunction#exprs for (self: CFunction): Template */
279 val* nitc___nitc__CFunction___exprs(val* self) {
280 val* var /* : Template */;
281 val* var1 /* : Template */;
282 var1 = self->attrs[COLOR_nitc__c_tools__CFunction___exprs].val; /* _exprs on <self:CFunction> */
283 if (unlikely(var1 == NULL)) {
284 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _exprs");
285 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 89);
286 fatal_exit(1);
287 }
288 var = var1;
289 RET_LABEL:;
290 return var;
291 }
292 /* method c_tools#CFunction#to_writer for (self: CFunction): Template */
293 val* nitc___nitc__CFunction___to_writer(val* self) {
294 val* var /* : Template */;
295 val* var1 /* : Template */;
296 val* var_w /* var w: Template */;
297 val* var2 /* : String */;
298 val* var4 /* : String */;
299 static val* varonce;
300 val* var5 /* : String */;
301 char* var6 /* : NativeString */;
302 val* var7 /* : String */;
303 val* var8 /* : Template */;
304 val* var10 /* : Template */;
305 static val* varonce11;
306 val* var12 /* : String */;
307 char* var13 /* : NativeString */;
308 val* var14 /* : String */;
309 val* var15 /* : Template */;
310 val* var17 /* : Template */;
311 static val* varonce18;
312 val* var19 /* : String */;
313 char* var20 /* : NativeString */;
314 val* var21 /* : String */;
315 var1 = NEW_template__Template(&type_template__Template);
316 {
317 ((void(*)(val* self))(var1->class->vft[COLOR_core__kernel__Object__init]))(var1); /* init on <var1:Template>*/
318 }
319 var_w = var1;
320 {
321 { /* Inline c_tools#CFunction#signature (self) on <self:CFunction> */
322 var4 = self->attrs[COLOR_nitc__c_tools__CFunction___signature].val; /* _signature on <self:CFunction> */
323 if (unlikely(var4 == NULL)) {
324 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _signature");
325 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 86);
326 fatal_exit(1);
327 }
328 var2 = var4;
329 RET_LABEL3:(void)0;
330 }
331 }
332 {
333 template___template__Template___add(var_w, var2); /* Direct call template#Template#add on <var_w:Template>*/
334 }
335 if (likely(varonce!=NULL)) {
336 var5 = varonce;
337 } else {
338 var6 = "\n{\n";
339 var7 = core__flat___NativeString___to_s_full(var6, 3l, 3l);
340 var5 = var7;
341 varonce = var5;
342 }
343 {
344 template___template__Template___add(var_w, var5); /* Direct call template#Template#add on <var_w:Template>*/
345 }
346 {
347 { /* Inline c_tools#CFunction#decls (self) on <self:CFunction> */
348 var10 = self->attrs[COLOR_nitc__c_tools__CFunction___decls].val; /* _decls on <self:CFunction> */
349 if (unlikely(var10 == NULL)) {
350 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _decls");
351 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 88);
352 fatal_exit(1);
353 }
354 var8 = var10;
355 RET_LABEL9:(void)0;
356 }
357 }
358 {
359 template___template__Template___add(var_w, var8); /* Direct call template#Template#add on <var_w:Template>*/
360 }
361 if (likely(varonce11!=NULL)) {
362 var12 = varonce11;
363 } else {
364 var13 = "\n";
365 var14 = core__flat___NativeString___to_s_full(var13, 1l, 1l);
366 var12 = var14;
367 varonce11 = var12;
368 }
369 {
370 template___template__Template___add(var_w, var12); /* Direct call template#Template#add on <var_w:Template>*/
371 }
372 {
373 { /* Inline c_tools#CFunction#exprs (self) on <self:CFunction> */
374 var17 = self->attrs[COLOR_nitc__c_tools__CFunction___exprs].val; /* _exprs on <self:CFunction> */
375 if (unlikely(var17 == NULL)) {
376 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _exprs");
377 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 89);
378 fatal_exit(1);
379 }
380 var15 = var17;
381 RET_LABEL16:(void)0;
382 }
383 }
384 {
385 template___template__Template___add(var_w, var15); /* Direct call template#Template#add on <var_w:Template>*/
386 }
387 if (likely(varonce18!=NULL)) {
388 var19 = varonce18;
389 } else {
390 var20 = "}\n";
391 var21 = core__flat___NativeString___to_s_full(var20, 2l, 2l);
392 var19 = var21;
393 varonce18 = var19;
394 }
395 {
396 template___template__Template___add(var_w, var19); /* Direct call template#Template#add on <var_w:Template>*/
397 }
398 var = var_w;
399 goto RET_LABEL;
400 RET_LABEL:;
401 return var;
402 }
403 /* method c_tools#CFunction#init for (self: CFunction) */
404 void nitc___nitc__CFunction___core__kernel__Object__init(val* self) {
405 {
406 ((void(*)(val* self))(self->class->vft[COLOR_nitc___nitc__CFunction___core__kernel__Object__init]))(self); /* init on <self:CFunction>*/
407 }
408 RET_LABEL:;
409 }
410 /* method c_tools#ExternFile#filename for (self: ExternFile): String */
411 val* nitc___nitc__ExternFile___filename(val* self) {
412 val* var /* : String */;
413 val* var1 /* : String */;
414 var1 = self->attrs[COLOR_nitc__c_tools__ExternFile___filename].val; /* _filename on <self:ExternFile> */
415 if (unlikely(var1 == NULL)) {
416 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _filename");
417 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 108);
418 fatal_exit(1);
419 }
420 var = var1;
421 RET_LABEL:;
422 return var;
423 }
424 /* method c_tools#ExternFile#filename= for (self: ExternFile, String) */
425 void nitc___nitc__ExternFile___filename_61d(val* self, val* p0) {
426 self->attrs[COLOR_nitc__c_tools__ExternFile___filename].val = p0; /* _filename on <self:ExternFile> */
427 RET_LABEL:;
428 }
429 /* method c_tools#ExternFile#add_to_jar for (self: ExternFile): Bool */
430 short int nitc___nitc__ExternFile___add_to_jar(val* self) {
431 short int var /* : Bool */;
432 var = 0;
433 goto RET_LABEL;
434 RET_LABEL:;
435 return var;
436 }
437 /* method c_tools#ExternFile#pkgconfigs for (self: ExternFile): Array[String] */
438 val* nitc___nitc__ExternFile___pkgconfigs(val* self) {
439 val* var /* : Array[String] */;
440 val* var1 /* : Array[String] */;
441 var1 = self->attrs[COLOR_nitc__c_tools__ExternFile___pkgconfigs].val; /* _pkgconfigs on <self:ExternFile> */
442 if (unlikely(var1 == NULL)) {
443 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _pkgconfigs");
444 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 123);
445 fatal_exit(1);
446 }
447 var = var1;
448 RET_LABEL:;
449 return var;
450 }
451 /* method c_tools#ExternFile#init for (self: ExternFile) */
452 void nitc___nitc__ExternFile___core__kernel__Object__init(val* self) {
453 {
454 ((void(*)(val* self))(self->class->vft[COLOR_nitc___nitc__ExternFile___core__kernel__Object__init]))(self); /* init on <self:ExternFile>*/
455 }
456 RET_LABEL:;
457 }
458 /* method c_tools#ExternCFile#cflags for (self: ExternCFile): String */
459 val* nitc___nitc__ExternCFile___cflags(val* self) {
460 val* var /* : String */;
461 val* var1 /* : String */;
462 var1 = self->attrs[COLOR_nitc__c_tools__ExternCFile___cflags].val; /* _cflags on <self:ExternCFile> */
463 if (unlikely(var1 == NULL)) {
464 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _cflags");
465 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 132);
466 fatal_exit(1);
467 }
468 var = var1;
469 RET_LABEL:;
470 return var;
471 }
472 /* method c_tools#ExternCFile#cflags= for (self: ExternCFile, String) */
473 void nitc___nitc__ExternCFile___cflags_61d(val* self, val* p0) {
474 self->attrs[COLOR_nitc__c_tools__ExternCFile___cflags].val = p0; /* _cflags on <self:ExternCFile> */
475 RET_LABEL:;
476 }
477 /* method c_tools#ExternCFile#hash for (self: ExternCFile): Int */
478 long nitc___nitc__ExternCFile___core__kernel__Object__hash(val* self) {
479 long var /* : Int */;
480 val* var1 /* : String */;
481 val* var3 /* : String */;
482 long var4 /* : Int */;
483 {
484 { /* Inline c_tools#ExternFile#filename (self) on <self:ExternCFile> */
485 var3 = self->attrs[COLOR_nitc__c_tools__ExternFile___filename].val; /* _filename on <self:ExternCFile> */
486 if (unlikely(var3 == NULL)) {
487 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _filename");
488 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 108);
489 fatal_exit(1);
490 }
491 var1 = var3;
492 RET_LABEL2:(void)0;
493 }
494 }
495 {
496 var4 = ((long(*)(val* self))(var1->class->vft[COLOR_core__kernel__Object__hash]))(var1); /* hash on <var1:String>*/
497 }
498 var = var4;
499 goto RET_LABEL;
500 RET_LABEL:;
501 return var;
502 }
503 /* method c_tools#ExternCFile#== for (self: ExternCFile, nullable Object): Bool */
504 short int nitc___nitc__ExternCFile___core__kernel__Object___61d_61d(val* self, val* p0) {
505 short int var /* : Bool */;
506 val* var_o /* var o: nullable Object */;
507 short int var1 /* : Bool */;
508 short int var2 /* : Bool */;
509 int cltype;
510 int idtype;
511 short int var_ /* var : Bool */;
512 val* var3 /* : String */;
513 val* var5 /* : String */;
514 val* var6 /* : String */;
515 val* var8 /* : String */;
516 short int var9 /* : Bool */;
517 var_o = p0;
518 /* <var_o:nullable Object> isa ExternCFile */
519 cltype = type_nitc__ExternCFile.color;
520 idtype = type_nitc__ExternCFile.id;
521 if(var_o == NULL) {
522 var2 = 0;
523 } else {
524 if(cltype >= (((long)var_o&3)?type_info[((long)var_o&3)]:var_o->type)->table_size) {
525 var2 = 0;
526 } else {
527 var2 = (((long)var_o&3)?type_info[((long)var_o&3)]:var_o->type)->type_table[cltype] == idtype;
528 }
529 }
530 var_ = var2;
531 if (var2){
532 {
533 { /* Inline c_tools#ExternFile#filename (self) on <self:ExternCFile> */
534 var5 = self->attrs[COLOR_nitc__c_tools__ExternFile___filename].val; /* _filename on <self:ExternCFile> */
535 if (unlikely(var5 == NULL)) {
536 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _filename");
537 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 108);
538 fatal_exit(1);
539 }
540 var3 = var5;
541 RET_LABEL4:(void)0;
542 }
543 }
544 {
545 { /* Inline c_tools#ExternFile#filename (var_o) on <var_o:nullable Object(ExternCFile)> */
546 var8 = var_o->attrs[COLOR_nitc__c_tools__ExternFile___filename].val; /* _filename on <var_o:nullable Object(ExternCFile)> */
547 if (unlikely(var8 == NULL)) {
548 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _filename");
549 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 108);
550 fatal_exit(1);
551 }
552 var6 = var8;
553 RET_LABEL7:(void)0;
554 }
555 }
556 {
557 var9 = ((short int(*)(val* self, val* p0))(var3->class->vft[COLOR_core__kernel__Object___61d_61d]))(var3, var6); /* == on <var3:String>*/
558 }
559 var1 = var9;
560 } else {
561 var1 = var_;
562 }
563 var = var1;
564 goto RET_LABEL;
565 RET_LABEL:;
566 return var;
567 }
568 /* method c_tools#ExternCFile#makefile_rule_name for (self: ExternCFile): String */
569 val* nitc___nitc__ExternCFile___ExternFile__makefile_rule_name(val* self) {
570 val* var /* : String */;
571 val* var1 /* : String */;
572 val* var3 /* : String */;
573 static val* varonce;
574 val* var4 /* : String */;
575 char* var5 /* : NativeString */;
576 val* var6 /* : String */;
577 val* var7 /* : String */;
578 val* var_basename /* var basename: String */;
579 val* var9 /* : NativeArray[String] */;
580 static val* varonce8;
581 static val* varonce10;
582 val* var11 /* : String */;
583 char* var12 /* : NativeString */;
584 val* var13 /* : String */;
585 val* var14 /* : String */;
586 val* var_res /* var res: String */;
587 {
588 { /* Inline c_tools#ExternFile#filename (self) on <self:ExternCFile> */
589 var3 = self->attrs[COLOR_nitc__c_tools__ExternFile___filename].val; /* _filename on <self:ExternCFile> */
590 if (unlikely(var3 == NULL)) {
591 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _filename");
592 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 108);
593 fatal_exit(1);
594 }
595 var1 = var3;
596 RET_LABEL2:(void)0;
597 }
598 }
599 if (likely(varonce!=NULL)) {
600 var4 = varonce;
601 } else {
602 var5 = ".c";
603 var6 = core__flat___NativeString___to_s_full(var5, 2l, 2l);
604 var4 = var6;
605 varonce = var4;
606 }
607 {
608 var7 = ((val*(*)(val* self, val* p0))(var1->class->vft[COLOR_core__file__String__basename]))(var1, var4); /* basename on <var1:String>*/
609 }
610 var_basename = var7;
611 if (unlikely(varonce8==NULL)) {
612 var9 = NEW_core__NativeArray(2l, &type_core__NativeArray__core__String);
613 if (likely(varonce10!=NULL)) {
614 var11 = varonce10;
615 } else {
616 var12 = ".extern.o";
617 var13 = core__flat___NativeString___to_s_full(var12, 9l, 9l);
618 var11 = var13;
619 varonce10 = var11;
620 }
621 ((struct instance_core__NativeArray*)var9)->values[1]=var11;
622 } else {
623 var9 = varonce8;
624 varonce8 = NULL;
625 }
626 ((struct instance_core__NativeArray*)var9)->values[0]=var_basename;
627 {
628 var14 = ((val*(*)(val* self))(var9->class->vft[COLOR_core__abstract_text__NativeArray__native_to_s]))(var9); /* native_to_s on <var9:NativeArray[String]>*/
629 }
630 varonce8 = var9;
631 var_res = var14;
632 var = var_res;
633 goto RET_LABEL;
634 RET_LABEL:;
635 return var;
636 }
637 /* method c_tools#ExternCFile#makefile_rule_content for (self: ExternCFile): String */
638 val* nitc___nitc__ExternCFile___ExternFile__makefile_rule_content(val* self) {
639 val* var /* : String */;
640 val* var1 /* : String */;
641 val* var3 /* : String */;
642 val* var4 /* : String */;
643 val* var_ff /* var ff: String */;
644 val* var5 /* : String */;
645 val* var_o /* var o: String */;
646 static val* varonce;
647 val* var6 /* : String */;
648 char* var7 /* : NativeString */;
649 val* var8 /* : String */;
650 val* var_pkg /* var pkg: String */;
651 val* var9 /* : Array[String] */;
652 val* var11 /* : Array[String] */;
653 short int var12 /* : Bool */;
654 short int var13 /* : Bool */;
655 val* var15 /* : NativeArray[String] */;
656 static val* varonce14;
657 static val* varonce16;
658 val* var17 /* : String */;
659 char* var18 /* : NativeString */;
660 val* var19 /* : String */;
661 static val* varonce20;
662 val* var21 /* : String */;
663 char* var22 /* : NativeString */;
664 val* var23 /* : String */;
665 val* var24 /* : Array[String] */;
666 val* var26 /* : Array[String] */;
667 static val* varonce27;
668 val* var28 /* : String */;
669 char* var29 /* : NativeString */;
670 val* var30 /* : String */;
671 val* var31 /* : String */;
672 val* var32 /* : String */;
673 val* var34 /* : NativeArray[String] */;
674 static val* varonce33;
675 static val* varonce35;
676 val* var36 /* : String */;
677 char* var37 /* : NativeString */;
678 val* var38 /* : String */;
679 static val* varonce39;
680 val* var40 /* : String */;
681 char* var41 /* : NativeString */;
682 val* var42 /* : String */;
683 static val* varonce43;
684 val* var44 /* : String */;
685 char* var45 /* : NativeString */;
686 val* var46 /* : String */;
687 static val* varonce47;
688 val* var48 /* : String */;
689 char* var49 /* : NativeString */;
690 val* var50 /* : String */;
691 val* var51 /* : String */;
692 val* var53 /* : String */;
693 val* var54 /* : String */;
694 {
695 { /* Inline c_tools#ExternFile#filename (self) on <self:ExternCFile> */
696 var3 = self->attrs[COLOR_nitc__c_tools__ExternFile___filename].val; /* _filename on <self:ExternCFile> */
697 if (unlikely(var3 == NULL)) {
698 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _filename");
699 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 108);
700 fatal_exit(1);
701 }
702 var1 = var3;
703 RET_LABEL2:(void)0;
704 }
705 }
706 {
707 var4 = ((val*(*)(val* self, val* p0))(var1->class->vft[COLOR_core__file__String__basename]))(var1, ((val*)NULL)); /* basename on <var1:String>*/
708 }
709 var_ff = var4;
710 {
711 var5 = nitc___nitc__ExternCFile___ExternFile__makefile_rule_name(self);
712 }
713 var_o = var5;
714 if (likely(varonce!=NULL)) {
715 var6 = varonce;
716 } else {
717 var7 = "";
718 var8 = core__flat___NativeString___to_s_full(var7, 0l, 0l);
719 var6 = var8;
720 varonce = var6;
721 }
722 var_pkg = var6;
723 {
724 { /* Inline c_tools#ExternFile#pkgconfigs (self) on <self:ExternCFile> */
725 var11 = self->attrs[COLOR_nitc__c_tools__ExternFile___pkgconfigs].val; /* _pkgconfigs on <self:ExternCFile> */
726 if (unlikely(var11 == NULL)) {
727 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _pkgconfigs");
728 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 123);
729 fatal_exit(1);
730 }
731 var9 = var11;
732 RET_LABEL10:(void)0;
733 }
734 }
735 {
736 var12 = core___core__AbstractArrayRead___core__abstract_collection__Collection__is_empty(var9);
737 }
738 var13 = !var12;
739 if (var13){
740 if (unlikely(varonce14==NULL)) {
741 var15 = NEW_core__NativeArray(3l, &type_core__NativeArray__core__String);
742 if (likely(varonce16!=NULL)) {
743 var17 = varonce16;
744 } else {
745 var18 = "`pkg-config --cflags ";
746 var19 = core__flat___NativeString___to_s_full(var18, 21l, 21l);
747 var17 = var19;
748 varonce16 = var17;
749 }
750 ((struct instance_core__NativeArray*)var15)->values[0]=var17;
751 if (likely(varonce20!=NULL)) {
752 var21 = varonce20;
753 } else {
754 var22 = "`";
755 var23 = core__flat___NativeString___to_s_full(var22, 1l, 1l);
756 var21 = var23;
757 varonce20 = var21;
758 }
759 ((struct instance_core__NativeArray*)var15)->values[2]=var21;
760 } else {
761 var15 = varonce14;
762 varonce14 = NULL;
763 }
764 {
765 { /* Inline c_tools#ExternFile#pkgconfigs (self) on <self:ExternCFile> */
766 var26 = self->attrs[COLOR_nitc__c_tools__ExternFile___pkgconfigs].val; /* _pkgconfigs on <self:ExternCFile> */
767 if (unlikely(var26 == NULL)) {
768 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _pkgconfigs");
769 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 123);
770 fatal_exit(1);
771 }
772 var24 = var26;
773 RET_LABEL25:(void)0;
774 }
775 }
776 if (likely(varonce27!=NULL)) {
777 var28 = varonce27;
778 } else {
779 var29 = " ";
780 var30 = core__flat___NativeString___to_s_full(var29, 1l, 1l);
781 var28 = var30;
782 varonce27 = var28;
783 }
784 {
785 var31 = core__abstract_text___Collection___join(var24, var28);
786 }
787 ((struct instance_core__NativeArray*)var15)->values[1]=var31;
788 {
789 var32 = ((val*(*)(val* self))(var15->class->vft[COLOR_core__abstract_text__NativeArray__native_to_s]))(var15); /* native_to_s on <var15:NativeArray[String]>*/
790 }
791 varonce14 = var15;
792 var_pkg = var32;
793 } else {
794 }
795 if (unlikely(varonce33==NULL)) {
796 var34 = NEW_core__NativeArray(8l, &type_core__NativeArray__core__String);
797 if (likely(varonce35!=NULL)) {
798 var36 = varonce35;
799 } else {
800 var37 = "$(CC) $(CFLAGS) -Wall -Wno-unused-function ";
801 var38 = core__flat___NativeString___to_s_full(var37, 43l, 43l);
802 var36 = var38;
803 varonce35 = var36;
804 }
805 ((struct instance_core__NativeArray*)var34)->values[0]=var36;
806 if (likely(varonce39!=NULL)) {
807 var40 = varonce39;
808 } else {
809 var41 = " ";
810 var42 = core__flat___NativeString___to_s_full(var41, 1l, 1l);
811 var40 = var42;
812 varonce39 = var40;
813 }
814 ((struct instance_core__NativeArray*)var34)->values[2]=var40;
815 if (likely(varonce43!=NULL)) {
816 var44 = varonce43;
817 } else {
818 var45 = " -c -o ";
819 var46 = core__flat___NativeString___to_s_full(var45, 7l, 7l);
820 var44 = var46;
821 varonce43 = var44;
822 }
823 ((struct instance_core__NativeArray*)var34)->values[4]=var44;
824 if (likely(varonce47!=NULL)) {
825 var48 = varonce47;
826 } else {
827 var49 = " ";
828 var50 = core__flat___NativeString___to_s_full(var49, 1l, 1l);
829 var48 = var50;
830 varonce47 = var48;
831 }
832 ((struct instance_core__NativeArray*)var34)->values[6]=var48;
833 } else {
834 var34 = varonce33;
835 varonce33 = NULL;
836 }
837 {
838 { /* Inline c_tools#ExternCFile#cflags (self) on <self:ExternCFile> */
839 var53 = self->attrs[COLOR_nitc__c_tools__ExternCFile___cflags].val; /* _cflags on <self:ExternCFile> */
840 if (unlikely(var53 == NULL)) {
841 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _cflags");
842 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__c_tools, 132);
843 fatal_exit(1);
844 }
845 var51 = var53;
846 RET_LABEL52:(void)0;
847 }
848 }
849 ((struct instance_core__NativeArray*)var34)->values[1]=var51;
850 ((struct instance_core__NativeArray*)var34)->values[3]=var_pkg;
851 ((struct instance_core__NativeArray*)var34)->values[5]=var_o;
852 ((struct instance_core__NativeArray*)var34)->values[7]=var_ff;
853 {
854 var54 = ((val*(*)(val* self))(var34->class->vft[COLOR_core__abstract_text__NativeArray__native_to_s]))(var34); /* native_to_s on <var34:NativeArray[String]>*/
855 }
856 varonce33 = var34;
857 var = var54;
858 goto RET_LABEL;
859 RET_LABEL:;
860 return var;
861 }
862 /* method c_tools#ExternCFile#compiles_to_o_file for (self: ExternCFile): Bool */
863 short int nitc___nitc__ExternCFile___ExternFile__compiles_to_o_file(val* self) {
864 short int var /* : Bool */;
865 var = 1;
866 goto RET_LABEL;
867 RET_LABEL:;
868 return var;
869 }
870 /* method c_tools#ExternCFile#init for (self: ExternCFile) */
871 void nitc___nitc__ExternCFile___core__kernel__Object__init(val* self) {
872 {
873 ((void(*)(val* self))(self->class->vft[COLOR_nitc___nitc__ExternCFile___core__kernel__Object__init]))(self); /* init on <self:ExternCFile>*/
874 }
875 RET_LABEL:;
876 }