mkcsrc: copy .c and .h file to avoid the break of the bootstrap
[nit.git] / c_src / ffi___c._sep.c
1 /* This C file is generated by NIT to compile module ffi___c. */
2 #include "ffi___c._sep.h"
3 static const char LOCATE_ffi___c___ExternCode___is_c[] = "c::ExternCode::is_c";
4 val_t ffi___c___ExternCode___is_c(val_t p0){
5 struct {struct stack_frame_t me; val_t MORE_REG[2];} fra;
6 val_t REGB0;
7 val_t REGB1;
8 val_t REGB2;
9 val_t tmp;
10 static val_t once_value_1; /* Once value */
11 static val_t once_value_2; /* Once value */
12 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
13 fra.me.file = LOCATE_ffi___c;
14 fra.me.line = 24;
15 fra.me.meth = LOCATE_ffi___c___ExternCode___is_c;
16 fra.me.has_broke = 0;
17 fra.me.REG_size = 3;
18 fra.me.nitni_local_ref_head = NULL;
19 fra.me.REG[0] = NIT_NULL;
20 fra.me.REG[1] = NIT_NULL;
21 fra.me.REG[2] = NIT_NULL;
22 fra.me.REG[0] = p0;
23 /* ffi/c.nit:24 */
24 fra.me.REG[1] = CALL_syntax___extern_inline___ExternCode___language(fra.me.REG[0])(fra.me.REG[0]);
25 REGB0 = TAG_Bool(fra.me.REG[1]==NIT_NULL);
26 if (UNTAG_Bool(REGB0)) {
27 } else {
28 REGB1 = TAG_Bool(fra.me.REG[1]==NIT_NULL);
29 if (UNTAG_Bool(REGB1)) {
30 REGB1 = TAG_Bool(0);
31 REGB0 = REGB1;
32 } else {
33 REGB1 = CALL_standard___kernel___Object_____eqeq(fra.me.REG[1])(fra.me.REG[1], NIT_NULL);
34 REGB0 = REGB1;
35 }
36 }
37 if (UNTAG_Bool(REGB0)) {
38 REGB0 = TAG_Bool(1);
39 } else {
40 /* ffi/c.nit:25 */
41 fra.me.REG[1] = CALL_ffi___ffi_base___ExternCode___language_lowered(fra.me.REG[0])(fra.me.REG[0]);
42 if (!once_value_1) {
43 fra.me.REG[2] = BOX_NativeString("c");
44 REGB1 = TAG_Int(1);
45 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB1);
46 once_value_1 = fra.me.REG[2];
47 register_static_object(&once_value_1);
48 } else fra.me.REG[2] = once_value_1;
49 fra.me.REG[2] = fra.me.REG[2];
50 REGB1 = TAG_Bool(IS_EQUAL_ON(fra.me.REG[2],fra.me.REG[1]));
51 if (UNTAG_Bool(REGB1)) {
52 } else {
53 REGB2 = TAG_Bool(fra.me.REG[1]==NIT_NULL);
54 if (UNTAG_Bool(REGB2)) {
55 REGB2 = TAG_Bool(0);
56 REGB1 = REGB2;
57 } else {
58 REGB2 = CALL_standard___kernel___Object_____eqeq(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[2]);
59 REGB1 = REGB2;
60 }
61 }
62 /* ffi/c.nit:24 */
63 REGB0 = REGB1;
64 }
65 if (UNTAG_Bool(REGB0)) {
66 REGB0 = TAG_Bool(1);
67 } else {
68 /* ffi/c.nit:25 */
69 fra.me.REG[0] = CALL_ffi___ffi_base___ExternCode___language_lowered(fra.me.REG[0])(fra.me.REG[0]);
70 if (!once_value_2) {
71 fra.me.REG[2] = BOX_NativeString("c ");
72 REGB1 = TAG_Int(2);
73 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB1);
74 once_value_2 = fra.me.REG[2];
75 register_static_object(&once_value_2);
76 } else fra.me.REG[2] = once_value_2;
77 fra.me.REG[2] = fra.me.REG[2];
78 REGB1 = TAG_Bool(fra.me.REG[0]==NIT_NULL);
79 if (UNTAG_Bool(REGB1)) {
80 nit_abort("Reciever is null", NULL, LOCATE_ffi___c, 25);
81 }
82 REGB1 = CALL_standard___string___AbstractString___has_prefix(fra.me.REG[0])(fra.me.REG[0], fra.me.REG[2]);
83 /* ffi/c.nit:24 */
84 REGB0 = REGB1;
85 }
86 goto label3;
87 label3: while(0);
88 stack_frame_head = fra.me.prev;
89 return REGB0;
90 }
91 static const char LOCATE_ffi___c___ExternCode___is_c_body[] = "c::ExternCode::is_c_body";
92 val_t ffi___c___ExternCode___is_c_body(val_t p0){
93 struct {struct stack_frame_t me; val_t MORE_REG[2];} fra;
94 val_t REGB0;
95 val_t REGB1;
96 val_t REGB2;
97 val_t tmp;
98 static val_t once_value_1; /* Once value */
99 static val_t once_value_2; /* Once value */
100 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
101 fra.me.file = LOCATE_ffi___c;
102 fra.me.line = 27;
103 fra.me.meth = LOCATE_ffi___c___ExternCode___is_c_body;
104 fra.me.has_broke = 0;
105 fra.me.REG_size = 3;
106 fra.me.nitni_local_ref_head = NULL;
107 fra.me.REG[0] = NIT_NULL;
108 fra.me.REG[1] = NIT_NULL;
109 fra.me.REG[2] = NIT_NULL;
110 fra.me.REG[0] = p0;
111 /* ffi/c.nit:27 */
112 fra.me.REG[1] = CALL_syntax___extern_inline___ExternCode___language(fra.me.REG[0])(fra.me.REG[0]);
113 REGB0 = TAG_Bool(fra.me.REG[1]==NIT_NULL);
114 if (UNTAG_Bool(REGB0)) {
115 } else {
116 REGB1 = TAG_Bool(fra.me.REG[1]==NIT_NULL);
117 if (UNTAG_Bool(REGB1)) {
118 REGB1 = TAG_Bool(0);
119 REGB0 = REGB1;
120 } else {
121 REGB1 = CALL_standard___kernel___Object_____eqeq(fra.me.REG[1])(fra.me.REG[1], NIT_NULL);
122 REGB0 = REGB1;
123 }
124 }
125 if (UNTAG_Bool(REGB0)) {
126 REGB0 = TAG_Bool(1);
127 } else {
128 /* ffi/c.nit:28 */
129 fra.me.REG[1] = CALL_ffi___ffi_base___ExternCode___language_lowered(fra.me.REG[0])(fra.me.REG[0]);
130 if (!once_value_1) {
131 fra.me.REG[2] = BOX_NativeString("c");
132 REGB1 = TAG_Int(1);
133 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB1);
134 once_value_1 = fra.me.REG[2];
135 register_static_object(&once_value_1);
136 } else fra.me.REG[2] = once_value_1;
137 fra.me.REG[2] = fra.me.REG[2];
138 REGB1 = TAG_Bool(IS_EQUAL_ON(fra.me.REG[2],fra.me.REG[1]));
139 if (UNTAG_Bool(REGB1)) {
140 } else {
141 REGB2 = TAG_Bool(fra.me.REG[1]==NIT_NULL);
142 if (UNTAG_Bool(REGB2)) {
143 REGB2 = TAG_Bool(0);
144 REGB1 = REGB2;
145 } else {
146 REGB2 = CALL_standard___kernel___Object_____eqeq(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[2]);
147 REGB1 = REGB2;
148 }
149 }
150 /* ffi/c.nit:27 */
151 REGB0 = REGB1;
152 }
153 if (UNTAG_Bool(REGB0)) {
154 REGB0 = TAG_Bool(1);
155 } else {
156 /* ffi/c.nit:28 */
157 fra.me.REG[0] = CALL_ffi___ffi_base___ExternCode___language_lowered(fra.me.REG[0])(fra.me.REG[0]);
158 if (!once_value_2) {
159 fra.me.REG[2] = BOX_NativeString("c body");
160 REGB1 = TAG_Int(6);
161 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB1);
162 once_value_2 = fra.me.REG[2];
163 register_static_object(&once_value_2);
164 } else fra.me.REG[2] = once_value_2;
165 fra.me.REG[2] = fra.me.REG[2];
166 REGB1 = TAG_Bool(IS_EQUAL_ON(fra.me.REG[2],fra.me.REG[0]));
167 if (UNTAG_Bool(REGB1)) {
168 } else {
169 REGB2 = TAG_Bool(fra.me.REG[0]==NIT_NULL);
170 if (UNTAG_Bool(REGB2)) {
171 REGB2 = TAG_Bool(0);
172 REGB1 = REGB2;
173 } else {
174 REGB2 = CALL_standard___kernel___Object_____eqeq(fra.me.REG[0])(fra.me.REG[0], fra.me.REG[2]);
175 REGB1 = REGB2;
176 }
177 }
178 /* ffi/c.nit:27 */
179 REGB0 = REGB1;
180 }
181 goto label3;
182 label3: while(0);
183 stack_frame_head = fra.me.prev;
184 return REGB0;
185 }
186 static const char LOCATE_ffi___c___ExternCode___is_c_header[] = "c::ExternCode::is_c_header";
187 val_t ffi___c___ExternCode___is_c_header(val_t p0){
188 struct {struct stack_frame_t me; val_t MORE_REG[1];} fra;
189 val_t REGB0;
190 val_t REGB1;
191 val_t tmp;
192 static val_t once_value_1; /* Once value */
193 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
194 fra.me.file = LOCATE_ffi___c;
195 fra.me.line = 30;
196 fra.me.meth = LOCATE_ffi___c___ExternCode___is_c_header;
197 fra.me.has_broke = 0;
198 fra.me.REG_size = 2;
199 fra.me.nitni_local_ref_head = NULL;
200 fra.me.REG[0] = NIT_NULL;
201 fra.me.REG[1] = NIT_NULL;
202 fra.me.REG[0] = p0;
203 /* ffi/c.nit:30 */
204 fra.me.REG[0] = CALL_ffi___ffi_base___ExternCode___language_lowered(fra.me.REG[0])(fra.me.REG[0]);
205 if (!once_value_1) {
206 fra.me.REG[1] = BOX_NativeString("c header");
207 REGB0 = TAG_Int(8);
208 fra.me.REG[1] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[1])(fra.me.REG[1], REGB0);
209 once_value_1 = fra.me.REG[1];
210 register_static_object(&once_value_1);
211 } else fra.me.REG[1] = once_value_1;
212 fra.me.REG[1] = fra.me.REG[1];
213 REGB0 = TAG_Bool(IS_EQUAL_ON(fra.me.REG[1],fra.me.REG[0]));
214 if (UNTAG_Bool(REGB0)) {
215 } else {
216 REGB1 = TAG_Bool(fra.me.REG[0]==NIT_NULL);
217 if (UNTAG_Bool(REGB1)) {
218 REGB1 = TAG_Bool(0);
219 REGB0 = REGB1;
220 } else {
221 REGB1 = CALL_standard___kernel___Object_____eqeq(fra.me.REG[0])(fra.me.REG[0], fra.me.REG[1]);
222 REGB0 = REGB1;
223 }
224 }
225 goto label2;
226 label2: while(0);
227 stack_frame_head = fra.me.prev;
228 return REGB0;
229 }
230 static const char LOCATE_ffi___c___ExternCode___accept_ffi_visitor[] = "c::ExternCode::(ffi_base::FFIVisited::accept_ffi_visitor)";
231 void ffi___c___ExternCode___accept_ffi_visitor(val_t p0, val_t p1){
232 struct {struct stack_frame_t me; val_t MORE_REG[3];} fra;
233 val_t REGB0;
234 val_t tmp;
235 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
236 fra.me.file = LOCATE_ffi___c;
237 fra.me.line = 32;
238 fra.me.meth = LOCATE_ffi___c___ExternCode___accept_ffi_visitor;
239 fra.me.has_broke = 0;
240 fra.me.REG_size = 4;
241 fra.me.nitni_local_ref_head = NULL;
242 fra.me.REG[0] = NIT_NULL;
243 fra.me.REG[1] = NIT_NULL;
244 fra.me.REG[2] = NIT_NULL;
245 fra.me.REG[3] = NIT_NULL;
246 fra.me.REG[0] = p0;
247 fra.me.REG[1] = p1;
248 /* ffi/c.nit:34 */
249 REGB0 = CALL_ffi___c___ExternCode___is_c_header(fra.me.REG[0])(fra.me.REG[0]);
250 if (UNTAG_Bool(REGB0)) {
251 /* ffi/c.nit:35 */
252 fra.me.REG[2] = CALL_ffi___ffi_base___FFIVisitor___compilation_unit(fra.me.REG[1])(fra.me.REG[1]);
253 fra.me.REG[2] = CALL_c_tools___CCompilationUnit___header_custom(fra.me.REG[2])(fra.me.REG[2]);
254 fra.me.REG[3] = CALL_syntax___extern_inline___ExternCode___code(fra.me.REG[0])(fra.me.REG[0]);
255 CALL_compiling_writer___Writer___add(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[3]);
256 } else {
257 /* ffi/c.nit:36 */
258 REGB0 = CALL_ffi___c___ExternCode___is_c_body(fra.me.REG[0])(fra.me.REG[0]);
259 if (UNTAG_Bool(REGB0)) {
260 /* ffi/c.nit:37 */
261 fra.me.REG[1] = CALL_ffi___ffi_base___FFIVisitor___compilation_unit(fra.me.REG[1])(fra.me.REG[1]);
262 fra.me.REG[1] = CALL_c_tools___CCompilationUnit___body_custom(fra.me.REG[1])(fra.me.REG[1]);
263 fra.me.REG[0] = CALL_syntax___extern_inline___ExternCode___code(fra.me.REG[0])(fra.me.REG[0]);
264 CALL_compiling_writer___Writer___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[0]);
265 }
266 }
267 stack_frame_head = fra.me.prev;
268 return;
269 }
270 static const char LOCATE_ffi___c___MMMethod___accept_ffi_visitor[] = "c::MMMethod::(ffi_base::FFIVisited::accept_ffi_visitor)";
271 void ffi___c___MMMethod___accept_ffi_visitor(val_t p0, val_t p1){
272 struct {struct stack_frame_t me; val_t MORE_REG[6];} fra;
273 val_t REGB0;
274 val_t tmp;
275 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
276 fra.me.file = LOCATE_ffi___c;
277 fra.me.line = 43;
278 fra.me.meth = LOCATE_ffi___c___MMMethod___accept_ffi_visitor;
279 fra.me.has_broke = 0;
280 fra.me.REG_size = 7;
281 fra.me.nitni_local_ref_head = NULL;
282 fra.me.REG[0] = NIT_NULL;
283 fra.me.REG[1] = NIT_NULL;
284 fra.me.REG[2] = NIT_NULL;
285 fra.me.REG[3] = NIT_NULL;
286 fra.me.REG[4] = NIT_NULL;
287 fra.me.REG[5] = NIT_NULL;
288 fra.me.REG[6] = NIT_NULL;
289 fra.me.REG[0] = p0;
290 fra.me.REG[1] = p1;
291 /* ffi/c.nit:43 */
292 fra.me.REG[2] = fra.me.REG[0];
293 fra.me.REG[3] = fra.me.REG[1];
294 /* ffi/c.nit:45 */
295 fra.me.REG[4] = CALL_syntax___extern_inline___MMMethod___extern_implementation(fra.me.REG[2])(fra.me.REG[2]);
296 REGB0 = TAG_Bool(fra.me.REG[4]==NIT_NULL);
297 if (UNTAG_Bool(REGB0)) {
298 nit_abort("Reciever is null", NULL, LOCATE_ffi___c, 45);
299 }
300 REGB0 = CALL_ffi___c___ExternCode___is_c(fra.me.REG[4])(fra.me.REG[4]);
301 if (UNTAG_Bool(REGB0)) {
302 /* ffi/c.nit:46 */
303 fra.me.REG[4] = CALL_native_interface___ni_metamodel___MMMethod___impl_csignature(fra.me.REG[2])(fra.me.REG[2]);
304 fra.me.REG[4] = NEW_CFunction_c_tools___CFunction___init(fra.me.REG[4]);
305 /* ffi/c.nit:47 */
306 fra.me.REG[5] = CALL_c_tools___CFunction___decls(fra.me.REG[4])(fra.me.REG[4]);
307 fra.me.REG[6] = CALL_syntax___extern_inline___MMMethod___extern_implementation(fra.me.REG[2])(fra.me.REG[2]);
308 REGB0 = TAG_Bool(fra.me.REG[6]==NIT_NULL);
309 if (UNTAG_Bool(REGB0)) {
310 nit_abort("Reciever is null", NULL, LOCATE_ffi___c, 47);
311 }
312 fra.me.REG[6] = CALL_syntax___extern_inline___ExternCode___location(fra.me.REG[6])(fra.me.REG[6]);
313 REGB0 = TAG_Bool(fra.me.REG[6]==NIT_NULL);
314 if (UNTAG_Bool(REGB0)) {
315 nit_abort("Reciever is null", NULL, LOCATE_ffi___c, 47);
316 }
317 fra.me.REG[6] = CALL_ffi___c___Location___as_line_pragma(fra.me.REG[6])(fra.me.REG[6]);
318 CALL_compiling_writer___Writer___add(fra.me.REG[5])(fra.me.REG[5], fra.me.REG[6]);
319 /* ffi/c.nit:48 */
320 fra.me.REG[6] = CALL_c_tools___CFunction___exprs(fra.me.REG[4])(fra.me.REG[4]);
321 fra.me.REG[2] = CALL_syntax___extern_inline___MMMethod___extern_implementation(fra.me.REG[2])(fra.me.REG[2]);
322 REGB0 = TAG_Bool(fra.me.REG[2]==NIT_NULL);
323 if (UNTAG_Bool(REGB0)) {
324 nit_abort("Reciever is null", NULL, LOCATE_ffi___c, 48);
325 }
326 fra.me.REG[2] = CALL_syntax___extern_inline___ExternCode___code(fra.me.REG[2])(fra.me.REG[2]);
327 CALL_compiling_writer___Writer___add(fra.me.REG[6])(fra.me.REG[6], fra.me.REG[2]);
328 /* ffi/c.nit:49 */
329 fra.me.REG[3] = CALL_ffi___ffi_base___FFIVisitor___compilation_unit(fra.me.REG[3])(fra.me.REG[3]);
330 CALL_c_tools___CCompilationUnit___add_exported_function(fra.me.REG[3])(fra.me.REG[3], fra.me.REG[4]);
331 } else {
332 /* ffi/c.nit:51 */
333 CALL_SUPER_ffi___c___MMMethod___accept_ffi_visitor(fra.me.REG[0])(fra.me.REG[0], fra.me.REG[1]);
334 }
335 stack_frame_head = fra.me.prev;
336 return;
337 }
338 static const char LOCATE_ffi___c___Location___as_line_pragma[] = "c::Location::as_line_pragma";
339 val_t ffi___c___Location___as_line_pragma(val_t p0){
340 struct {struct stack_frame_t me; val_t MORE_REG[2];} fra;
341 val_t REGB0;
342 val_t tmp;
343 static val_t once_value_1; /* Once value */
344 static val_t once_value_2; /* Once value */
345 static val_t once_value_3; /* Once value */
346 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
347 fra.me.file = LOCATE_ffi___c;
348 fra.me.line = 57;
349 fra.me.meth = LOCATE_ffi___c___Location___as_line_pragma;
350 fra.me.has_broke = 0;
351 fra.me.REG_size = 3;
352 fra.me.nitni_local_ref_head = NULL;
353 fra.me.REG[0] = NIT_NULL;
354 fra.me.REG[1] = NIT_NULL;
355 fra.me.REG[2] = NIT_NULL;
356 fra.me.REG[0] = p0;
357 /* ffi/c.nit:59 */
358 REGB0 = TAG_Int(5);
359 fra.me.REG[1] = NEW_Array_standard___collection___array___Array___with_capacity(REGB0);
360 if (!once_value_1) {
361 fra.me.REG[2] = BOX_NativeString("#line ");
362 REGB0 = TAG_Int(6);
363 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB0);
364 once_value_1 = fra.me.REG[2];
365 register_static_object(&once_value_1);
366 } else fra.me.REG[2] = once_value_1;
367 fra.me.REG[2] = fra.me.REG[2];
368 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[2]);
369 REGB0 = CALL_location___Location___line_start(fra.me.REG[0])(fra.me.REG[0]);
370 fra.me.REG[2] = CALL_standard___string___Object___to_s(REGB0)(REGB0);
371 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[2]);
372 if (!once_value_2) {
373 fra.me.REG[2] = BOX_NativeString(" \"");
374 REGB0 = TAG_Int(2);
375 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB0);
376 once_value_2 = fra.me.REG[2];
377 register_static_object(&once_value_2);
378 } else fra.me.REG[2] = once_value_2;
379 fra.me.REG[2] = fra.me.REG[2];
380 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[2]);
381 fra.me.REG[0] = CALL_location___Location___file(fra.me.REG[0])(fra.me.REG[0]);
382 REGB0 = TAG_Bool(fra.me.REG[0]==NIT_NULL);
383 if (UNTAG_Bool(REGB0)) {
384 nit_abort("Reciever is null", NULL, LOCATE_ffi___c, 59);
385 }
386 fra.me.REG[0] = CALL_location___SourceFile___filename(fra.me.REG[0])(fra.me.REG[0]);
387 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[0]);
388 if (!once_value_3) {
389 fra.me.REG[0] = BOX_NativeString("\"\n");
390 REGB0 = TAG_Int(2);
391 fra.me.REG[0] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[0])(fra.me.REG[0], REGB0);
392 once_value_3 = fra.me.REG[0];
393 register_static_object(&once_value_3);
394 } else fra.me.REG[0] = once_value_3;
395 fra.me.REG[0] = fra.me.REG[0];
396 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[0]);
397 fra.me.REG[1] = CALL_standard___string___Object___to_s(fra.me.REG[1])(fra.me.REG[1]);
398 goto label4;
399 label4: while(0);
400 stack_frame_head = fra.me.prev;
401 return fra.me.REG[1];
402 }