lib: remove exec::kill and exec::term
[nit.git] / c_src / stream._sep.c
1 /* This C file is generated by NIT to compile module stream. */
2 #include "stream._sep.h"
3 void stream___IOS___close(val_t self) {
4 struct trace_t trace = {NULL, NULL, 20, LOCATE_stream___IOS___close};
5 val_t *variable = NULL;
6 struct WBT_ **closurevariable = NULL;
7 trace.prev = tracehead; tracehead = &trace;
8 trace.file = LOCATE_stream;
9 fprintf(stderr, "Deferred method called");
10 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 20);
11 nit_exit(1);
12 tracehead = trace.prev;
13 return;
14 }
15 void stream___IOS___init(val_t self, int* init_table) {
16 struct trace_t trace = {NULL, NULL, 0, LOCATE_stream___IOS___init};
17 val_t *variable = NULL;
18 struct WBT_ **closurevariable = NULL;
19 trace.prev = tracehead; tracehead = &trace;
20 trace.file = LOCATE_stream;
21 tracehead = trace.prev;
22 return;
23 }
24 val_t stream___IStream___read_char(val_t self) {
25 struct trace_t trace = {NULL, NULL, 27, LOCATE_stream___IStream___read_char};
26 val_t *variable = NULL;
27 struct WBT_ **closurevariable = NULL;
28 trace.prev = tracehead; tracehead = &trace;
29 trace.file = LOCATE_stream;
30 fprintf(stderr, "Deferred method called");
31 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 27);
32 nit_exit(1);
33 tracehead = trace.prev;
34 return NIT_NULL;
35 }
36 val_t stream___IStream___read(val_t self, val_t param0) {
37 struct trace_t trace = {NULL, NULL, 30, LOCATE_stream___IStream___read};
38 val_t variable[6];
39 struct WBT_ **closurevariable = NULL;
40 trace.prev = tracehead; tracehead = &trace;
41 trace.file = LOCATE_stream;
42 /* Register variable[0]: Local variable */
43 variable[0] = self;
44 /* Register variable[1]: Local variable */
45 variable[1] = param0;
46 /* Register variable[2]: Method return value and escape marker */
47 /* Register variable[3]: Local variable */
48 /* Register variable[4]: Result */
49 variable[4] = NEW_Buffer_string___Buffer___with_capacity( variable[1] /*i*/) /*new Buffer*/;
50 variable[3] = variable[4];
51 while (true) { /*while*/
52 /* Register variable[4]: Result */
53 variable[4] = TAG_Bool(UNTAG_Int( variable[1] /*i*/)>UNTAG_Int( TAG_Int(0)));
54 /* Ensure var variable[4]: Left 'and' operand*/
55 if (UNTAG_Bool(variable[4])) { /* and */
56 /* Register variable[4]: Result */
57 variable[4] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*IStream::eof*/;
58 variable[4] = TAG_Bool(!UNTAG_Bool(variable[4]));
59 }
60 /* Register variable[4]: Result */
61 if (!UNTAG_Bool(variable[4])) break; /* while*/
62 /* Register variable[4]: Local variable */
63 /* Register variable[5]: Result */
64 variable[5] = CALL_stream___IStream___read_char(variable[0])(variable[0]) /*IStream::read_char*/;
65 variable[4] = variable[5];
66 /* Register variable[5]: Result */
67 variable[5] = TAG_Bool(UNTAG_Int( variable[4] /*c*/)>=UNTAG_Int( TAG_Int(0)));
68 if (UNTAG_Bool(variable[5])) { /*if*/
69 /* Register variable[5]: Result */
70 variable[5] = TAG_Char(UNTAG_Int( variable[4] /*c*/));
71 CALL_abstract_collection___SimpleCollection___add( variable[3] /*s*/)( variable[3] /*s*/, variable[5]) /*Buffer::add*/;
72 variable[1] = TAG_Int(UNTAG_Int(variable[1])-UNTAG_Int( TAG_Int(1))) /*i*/;
73 }
74 continue_1: while(0);
75 }
76 break_1: while(0);
77 /* Register variable[4]: Result */
78 variable[4] = CALL_string___Object___to_s( variable[3] /*s*/)( variable[3] /*s*/) /*Buffer::to_s*/;
79 variable[2] = variable[4];
80 goto return_label0;
81 return_label0: while(false);
82 tracehead = trace.prev;
83 return variable[2];
84 }
85 val_t stream___IStream___read_line(val_t self) {
86 struct trace_t trace = {NULL, NULL, 44, LOCATE_stream___IStream___read_line};
87 val_t variable[4];
88 struct WBT_ **closurevariable = NULL;
89 trace.prev = tracehead; tracehead = &trace;
90 trace.file = LOCATE_stream;
91 /* Register variable[0]: Local variable */
92 variable[0] = self;
93 /* Register variable[1]: Method return value and escape marker */
94 /* Register variable[2]: Result */
95 variable[2] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*IStream::eof*/;
96 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable[2])))) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___IStream___read_line, LOCATE_stream, 47); nit_exit(1);}
97 /* Register variable[2]: Local variable */
98 /* Register variable[3]: Result */
99 variable[3] = NEW_Buffer_string___Buffer___init() /*new Buffer*/;
100 variable[2] = variable[3];
101 CALL_stream___IStream___append_line_to(variable[0])(variable[0], variable[2] /*s*/) /*IStream::append_line_to*/;
102 /* Register variable[3]: Result */
103 variable[3] = CALL_string___Object___to_s( variable[2] /*s*/)( variable[2] /*s*/) /*Buffer::to_s*/;
104 variable[1] = variable[3];
105 goto return_label2;
106 return_label2: while(false);
107 tracehead = trace.prev;
108 return variable[1];
109 }
110 val_t stream___IStream___read_all(val_t self) {
111 struct trace_t trace = {NULL, NULL, 53, LOCATE_stream___IStream___read_all};
112 val_t variable[5];
113 struct WBT_ **closurevariable = NULL;
114 trace.prev = tracehead; tracehead = &trace;
115 trace.file = LOCATE_stream;
116 /* Register variable[0]: Local variable */
117 variable[0] = self;
118 /* Register variable[1]: Method return value and escape marker */
119 /* Register variable[2]: Local variable */
120 /* Register variable[3]: Result */
121 variable[3] = NEW_Buffer_string___Buffer___init() /*new Buffer*/;
122 variable[2] = variable[3];
123 while (true) { /*while*/
124 /* Register variable[3]: Result */
125 variable[3] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*IStream::eof*/;
126 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable[3])))) break; /* while*/
127 /* Register variable[3]: Local variable */
128 /* Register variable[4]: Result */
129 variable[4] = CALL_stream___IStream___read_char(variable[0])(variable[0]) /*IStream::read_char*/;
130 variable[3] = variable[4];
131 /* Register variable[4]: Result */
132 variable[4] = TAG_Bool(UNTAG_Int( variable[3] /*c*/)>=UNTAG_Int( TAG_Int(0)));
133 if (UNTAG_Bool(variable[4])) { /*if*/
134 /* Register variable[4]: Result */
135 variable[4] = TAG_Char(UNTAG_Int( variable[3] /*c*/));
136 CALL_abstract_collection___SimpleCollection___add( variable[2] /*s*/)( variable[2] /*s*/, variable[4]) /*Buffer::add*/;
137 }
138 continue_4: while(0);
139 }
140 break_4: while(0);
141 /* Register variable[3]: Result */
142 variable[3] = CALL_string___Object___to_s( variable[2] /*s*/)( variable[2] /*s*/) /*Buffer::to_s*/;
143 variable[1] = variable[3];
144 goto return_label3;
145 return_label3: while(false);
146 tracehead = trace.prev;
147 return variable[1];
148 }
149 void stream___IStream___append_line_to(val_t self, val_t param0) {
150 struct trace_t trace = {NULL, NULL, 64, LOCATE_stream___IStream___append_line_to};
151 val_t variable[6];
152 struct WBT_ **closurevariable = NULL;
153 trace.prev = tracehead; tracehead = &trace;
154 trace.file = LOCATE_stream;
155 /* Register variable[0]: Local variable */
156 variable[0] = self;
157 /* Register variable[1]: Local variable */
158 variable[1] = param0;
159 /* Register variable[2]: Method return value and escape marker */
160 while (true) { /*while*/
161 if (!UNTAG_Bool( TAG_Bool(true))) break; /* while*/
162 /* Register variable[3]: Local variable */
163 /* Register variable[4]: Result */
164 variable[4] = CALL_stream___IStream___read_char(variable[0])(variable[0]) /*IStream::read_char*/;
165 variable[3] = variable[4];
166 /* Register variable[4]: Result */
167 variable[4] = TAG_Int(-UNTAG_Int( TAG_Int(1)));
168 /* Register variable[4]: Result */
169 variable[4] = TAG_Bool(( variable[3] /*x*/)==(variable[4]));
170 if (UNTAG_Bool(variable[4])) { /*if*/
171 /* Register variable[4]: Result */
172 variable[4] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*IStream::eof*/;
173 if (UNTAG_Bool(variable[4])) { /*if*/
174 goto return_label5;
175 }
176 } else { /*if*/
177 /* Register variable[4]: Local variable */
178 /* Register variable[5]: Result */
179 variable[5] = TAG_Char(UNTAG_Int( variable[3] /*x*/));
180 variable[4] = variable[5];
181 CALL_abstract_collection___IndexedCollection___push( variable[1] /*s*/)( variable[1] /*s*/, variable[4] /*c*/) /*AbstractArray::push*/;
182 /* Register variable[5]: Result */
183 variable[5] = TAG_Bool(( variable[4] /*c*/)==( TAG_Char('\n')));
184 if (UNTAG_Bool(variable[5])) { /*if*/
185 goto return_label5;
186 }
187 }
188 continue_6: while(0);
189 }
190 break_6: while(0);
191 return_label5: while(false);
192 tracehead = trace.prev;
193 return;
194 }
195 val_t stream___IStream___eof(val_t self) {
196 struct trace_t trace = {NULL, NULL, 79, LOCATE_stream___IStream___eof};
197 val_t *variable = NULL;
198 struct WBT_ **closurevariable = NULL;
199 trace.prev = tracehead; tracehead = &trace;
200 trace.file = LOCATE_stream;
201 fprintf(stderr, "Deferred method called");
202 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 79);
203 nit_exit(1);
204 tracehead = trace.prev;
205 return NIT_NULL;
206 }
207 void stream___OStream___write(val_t self, val_t param0) {
208 struct trace_t trace = {NULL, NULL, 86, LOCATE_stream___OStream___write};
209 val_t *variable = NULL;
210 struct WBT_ **closurevariable = NULL;
211 trace.prev = tracehead; tracehead = &trace;
212 trace.file = LOCATE_stream;
213 fprintf(stderr, "Deferred method called");
214 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 86);
215 nit_exit(1);
216 tracehead = trace.prev;
217 return;
218 }
219 val_t stream___OStream___is_writable(val_t self) {
220 struct trace_t trace = {NULL, NULL, 89, LOCATE_stream___OStream___is_writable};
221 val_t *variable = NULL;
222 struct WBT_ **closurevariable = NULL;
223 trace.prev = tracehead; tracehead = &trace;
224 trace.file = LOCATE_stream;
225 fprintf(stderr, "Deferred method called");
226 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 89);
227 nit_exit(1);
228 tracehead = trace.prev;
229 return NIT_NULL;
230 }
231 val_t stream___BufferedIStream___read_char(val_t self) {
232 struct trace_t trace = {NULL, NULL, 96, LOCATE_stream___BufferedIStream___read_char};
233 val_t variable[5];
234 struct WBT_ **closurevariable = NULL;
235 trace.prev = tracehead; tracehead = &trace;
236 trace.file = LOCATE_stream;
237 /* Register variable[0]: Local variable */
238 variable[0] = self;
239 /* Register variable[1]: Method return value and escape marker */
240 /* Register variable[2]: Result */
241 variable[2] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*BufferedIStream::eof*/;
242 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable[2])))) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___BufferedIStream___read_char, LOCATE_stream, 98); nit_exit(1);}
243 /* Register variable[2]: Result */
244 variable[2] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
245 /* Register variable[3]: Result */
246 variable[3] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
247 /* Register variable[3]: Result */
248 variable[3] = CALL_abstract_collection___Collection___length(variable[3])(variable[3]) /*AbstractArrayRead::length*/;
249 /* Register variable[2]: Result */
250 variable[2] = TAG_Bool(UNTAG_Int(variable[2])>=UNTAG_Int(variable[3]));
251 if (UNTAG_Bool(variable[2])) { /*if*/
252 CALL_stream___BufferedIStream___fill_buffer(variable[0])(variable[0]) /*BufferedIStream::fill_buffer*/;
253 }
254 /* Register variable[2]: Result */
255 variable[2] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
256 /* Register variable[3]: Result */
257 variable[3] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
258 /* Register variable[3]: Result */
259 variable[3] = CALL_abstract_collection___Collection___length(variable[3])(variable[3]) /*AbstractArrayRead::length*/;
260 /* Register variable[2]: Result */
261 variable[2] = TAG_Bool(UNTAG_Int(variable[2])>=UNTAG_Int(variable[3]));
262 if (UNTAG_Bool(variable[2])) { /*if*/
263 /* Register variable[2]: Result */
264 variable[2] = TAG_Int(-UNTAG_Int( TAG_Int(1)));
265 variable[1] = variable[2];
266 goto return_label7;
267 }
268 /* Register variable[2]: Local variable */
269 /* Register variable[3]: Result */
270 variable[3] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
271 /* Register variable[4]: Result */
272 variable[4] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
273 /* Register variable[3]: Result */
274 variable[3] = CALL_abstract_collection___MapRead_____bra(variable[3])(variable[3], variable[4]) /*AbstractString::[]*/;
275 variable[2] = variable[3];
276 ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/ = TAG_Int(UNTAG_Int(ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/)+UNTAG_Int( TAG_Int(1)));
277 /* Register variable[3]: Result */
278 variable[3] = TAG_Int((unsigned char)UNTAG_Char( variable[2] /*c*/));
279 variable[1] = variable[3];
280 goto return_label7;
281 return_label7: while(false);
282 tracehead = trace.prev;
283 return variable[1];
284 }
285 val_t stream___BufferedIStream___read(val_t self, val_t param0) {
286 struct trace_t trace = {NULL, NULL, 110, LOCATE_stream___BufferedIStream___read};
287 val_t variable[7];
288 struct WBT_ **closurevariable = NULL;
289 trace.prev = tracehead; tracehead = &trace;
290 trace.file = LOCATE_stream;
291 /* Register variable[0]: Local variable */
292 variable[0] = self;
293 /* Register variable[1]: Local variable */
294 variable[1] = param0;
295 /* Register variable[2]: Method return value and escape marker */
296 /* Register variable[3]: Local variable */
297 /* Register variable[4]: Result */
298 variable[4] = NEW_Buffer_string___Buffer___with_capacity( variable[1] /*i*/) /*new Buffer*/;
299 variable[3] = variable[4];
300 /* Register variable[4]: Local variable */
301 /* Register variable[5]: Result */
302 variable[5] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
303 variable[4] = variable[5];
304 /* Register variable[5]: Local variable */
305 /* Register variable[6]: Result */
306 variable[6] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
307 /* Register variable[6]: Result */
308 variable[6] = CALL_abstract_collection___Collection___length(variable[6])(variable[6]) /*AbstractArrayRead::length*/;
309 variable[5] = variable[6];
310 while (true) { /*while*/
311 /* Register variable[6]: Result */
312 variable[6] = TAG_Bool(UNTAG_Int( variable[1] /*i*/)>UNTAG_Int( TAG_Int(0)));
313 if (!UNTAG_Bool(variable[6])) break; /* while*/
314 /* Register variable[6]: Result */
315 variable[6] = TAG_Bool(UNTAG_Int( variable[4] /*j*/)>=UNTAG_Int( variable[5] /*k*/));
316 if (UNTAG_Bool(variable[6])) { /*if*/
317 CALL_stream___BufferedIStream___fill_buffer(variable[0])(variable[0]) /*BufferedIStream::fill_buffer*/;
318 /* Register variable[6]: Result */
319 variable[6] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*BufferedIStream::eof*/;
320 if (UNTAG_Bool(variable[6])) { /*if*/
321 /* Register variable[6]: Result */
322 variable[6] = CALL_string___Object___to_s( variable[3] /*s*/)( variable[3] /*s*/) /*Buffer::to_s*/;
323 variable[2] = variable[6];
324 goto return_label8;
325 }
326 /* Register variable[6]: Result */
327 variable[6] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
328 variable[4] = variable[6] /*j=*/;
329 /* Register variable[6]: Result */
330 variable[6] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
331 /* Register variable[6]: Result */
332 variable[6] = CALL_abstract_collection___Collection___length(variable[6])(variable[6]) /*AbstractArrayRead::length*/;
333 variable[5] = variable[6] /*k=*/;
334 }
335 while (true) { /*while*/
336 /* Register variable[6]: Result */
337 variable[6] = TAG_Bool(UNTAG_Int( variable[4] /*j*/)<UNTAG_Int( variable[5] /*k*/));
338 /* Ensure var variable[6]: Left 'and' operand*/
339 if (UNTAG_Bool(variable[6])) { /* and */
340 /* Register variable[6]: Result */
341 variable[6] = TAG_Bool(UNTAG_Int( variable[1] /*i*/)>UNTAG_Int( TAG_Int(0)));
342 }
343 /* Register variable[6]: Result */
344 if (!UNTAG_Bool(variable[6])) break; /* while*/
345 /* Register variable[6]: Result */
346 variable[6] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
347 /* Register variable[6]: Result */
348 variable[6] = CALL_abstract_collection___MapRead_____bra(variable[6])(variable[6], variable[4] /*j*/) /*AbstractString::[]*/;
349 CALL_abstract_collection___SimpleCollection___add( variable[3] /*s*/)( variable[3] /*s*/, variable[6]) /*Buffer::add*/;
350 variable[4] = TAG_Int(UNTAG_Int(variable[4])+UNTAG_Int( TAG_Int(1))) /*j*/;
351 variable[1] = TAG_Int(UNTAG_Int(variable[1])-UNTAG_Int( TAG_Int(1))) /*i*/;
352 continue_10: while(0);
353 }
354 break_10: while(0);
355 continue_9: while(0);
356 }
357 break_9: while(0);
358 ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/ = variable[4] /*j*/;
359 /* Register variable[6]: Result */
360 variable[6] = CALL_string___Object___to_s( variable[3] /*s*/)( variable[3] /*s*/) /*Buffer::to_s*/;
361 variable[2] = variable[6];
362 goto return_label8;
363 return_label8: while(false);
364 tracehead = trace.prev;
365 return variable[2];
366 }
367 val_t stream___BufferedIStream___read_all(val_t self) {
368 struct trace_t trace = {NULL, NULL, 132, LOCATE_stream___BufferedIStream___read_all};
369 val_t variable[6];
370 struct WBT_ **closurevariable = NULL;
371 trace.prev = tracehead; tracehead = &trace;
372 trace.file = LOCATE_stream;
373 /* Register variable[0]: Local variable */
374 variable[0] = self;
375 /* Register variable[1]: Method return value and escape marker */
376 /* Register variable[2]: Local variable */
377 /* Register variable[3]: Result */
378 variable[3] = NEW_Buffer_string___Buffer___init() /*new Buffer*/;
379 variable[2] = variable[3];
380 while (true) { /*while*/
381 /* Register variable[3]: Result */
382 variable[3] = CALL_stream___IStream___eof(variable[0])(variable[0]) /*BufferedIStream::eof*/;
383 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable[3])))) break; /* while*/
384 /* Register variable[3]: Local variable */
385 /* Register variable[4]: Result */
386 variable[4] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
387 variable[3] = variable[4];
388 /* Register variable[4]: Local variable */
389 /* Register variable[5]: Result */
390 variable[5] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
391 /* Register variable[5]: Result */
392 variable[5] = CALL_abstract_collection___Collection___length(variable[5])(variable[5]) /*AbstractArrayRead::length*/;
393 variable[4] = variable[5];
394 while (true) { /*while*/
395 /* Register variable[5]: Result */
396 variable[5] = TAG_Bool(UNTAG_Int( variable[3] /*j*/)<UNTAG_Int( variable[4] /*k*/));
397 if (!UNTAG_Bool(variable[5])) break; /* while*/
398 /* Register variable[5]: Result */
399 variable[5] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
400 /* Register variable[5]: Result */
401 variable[5] = CALL_abstract_collection___MapRead_____bra(variable[5])(variable[5], variable[3] /*j*/) /*AbstractString::[]*/;
402 CALL_abstract_collection___SimpleCollection___add( variable[2] /*s*/)( variable[2] /*s*/, variable[5]) /*Buffer::add*/;
403 variable[3] = TAG_Int(UNTAG_Int(variable[3])+UNTAG_Int( TAG_Int(1))) /*j*/;
404 continue_13: while(0);
405 }
406 break_13: while(0);
407 ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/ = variable[3] /*j*/;
408 CALL_stream___BufferedIStream___fill_buffer(variable[0])(variable[0]) /*BufferedIStream::fill_buffer*/;
409 continue_12: while(0);
410 }
411 break_12: while(0);
412 /* Register variable[3]: Result */
413 variable[3] = CALL_string___Object___to_s( variable[2] /*s*/)( variable[2] /*s*/) /*Buffer::to_s*/;
414 variable[1] = variable[3];
415 goto return_label11;
416 return_label11: while(false);
417 tracehead = trace.prev;
418 return variable[1];
419 }
420 void stream___BufferedIStream___append_line_to(val_t self, val_t param0) {
421 struct trace_t trace = {NULL, NULL, 148, LOCATE_stream___BufferedIStream___append_line_to};
422 val_t variable[6];
423 struct WBT_ **closurevariable = NULL;
424 trace.prev = tracehead; tracehead = &trace;
425 trace.file = LOCATE_stream;
426 /* Register variable[0]: Local variable */
427 variable[0] = self;
428 /* Register variable[1]: Local variable */
429 variable[1] = param0;
430 /* Register variable[2]: Method return value and escape marker */
431 while (true) { /*while*/
432 if (!UNTAG_Bool( TAG_Bool(true))) break; /* while*/
433 /* Register variable[3]: Local variable */
434 /* Register variable[4]: Result */
435 variable[4] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
436 variable[3] = variable[4];
437 while (true) { /*while*/
438 /* Register variable[4]: Result */
439 variable[4] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
440 /* Register variable[4]: Result */
441 variable[4] = CALL_abstract_collection___Collection___length(variable[4])(variable[4]) /*AbstractArrayRead::length*/;
442 /* Register variable[4]: Result */
443 variable[4] = TAG_Bool(UNTAG_Int( variable[3] /*i*/)<UNTAG_Int(variable[4]));
444 /* Ensure var variable[4]: Left 'and' operand*/
445 if (UNTAG_Bool(variable[4])) { /* and */
446 /* Register variable[4]: Result */
447 variable[4] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
448 /* Register variable[4]: Result */
449 variable[4] = CALL_abstract_collection___MapRead_____bra(variable[4])(variable[4], variable[3] /*i*/) /*AbstractString::[]*/;
450 /* Register variable[4]: Result */
451 variable[4] = TAG_Bool((variable[4])!=( TAG_Char('\n')));
452 }
453 /* Register variable[4]: Result */
454 if (!UNTAG_Bool(variable[4])) break; /* while*/
455 variable[3] = TAG_Int(UNTAG_Int(variable[3])+UNTAG_Int( TAG_Int(1))) /*i*/;
456 continue_16: while(0);
457 }
458 break_16: while(0);
459 /* Register variable[4]: Result */
460 variable[4] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
461 /* Register variable[4]: Result */
462 variable[4] = TAG_Bool(UNTAG_Int( variable[3] /*i*/)>UNTAG_Int(variable[4]));
463 if (UNTAG_Bool(variable[4])) { /*if*/
464 /* Register variable[4]: Result */
465 variable[4] = CALL_abstract_collection___Collection___length( variable[1] /*s*/)( variable[1] /*s*/) /*AbstractArrayRead::length*/;
466 /* Register variable[4]: Result */
467 variable[4] = TAG_Int(UNTAG_Int(variable[4])+UNTAG_Int( variable[3] /*i*/));
468 /* Register variable[5]: Result */
469 variable[5] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
470 /* Register variable[4]: Result */
471 variable[4] = TAG_Int(UNTAG_Int(variable[4])-UNTAG_Int(variable[5]));
472 CALL_array___AbstractArray___enlarge( variable[1] /*s*/)( variable[1] /*s*/, variable[4]) /*Buffer::enlarge*/;
473 /* Register variable[4]: Local variable */
474 /* Register variable[5]: Result */
475 variable[5] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
476 variable[4] = variable[5];
477 while (true) { /*while*/
478 /* Register variable[5]: Result */
479 variable[5] = TAG_Bool(UNTAG_Int( variable[4] /*j*/)<UNTAG_Int( variable[3] /*i*/));
480 if (!UNTAG_Bool(variable[5])) break; /* while*/
481 /* Register variable[5]: Result */
482 variable[5] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
483 /* Register variable[5]: Result */
484 variable[5] = CALL_abstract_collection___MapRead_____bra(variable[5])(variable[5], variable[4] /*j*/) /*AbstractString::[]*/;
485 CALL_abstract_collection___SimpleCollection___add( variable[1] /*s*/)( variable[1] /*s*/, variable[5]) /*Buffer::add*/;
486 variable[4] = TAG_Int(UNTAG_Int(variable[4])+UNTAG_Int( TAG_Int(1))) /*j*/;
487 continue_17: while(0);
488 }
489 break_17: while(0);
490 }
491 /* Register variable[4]: Result */
492 variable[4] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
493 /* Register variable[4]: Result */
494 variable[4] = CALL_abstract_collection___Collection___length(variable[4])(variable[4]) /*AbstractArrayRead::length*/;
495 /* Register variable[4]: Result */
496 variable[4] = TAG_Bool(UNTAG_Int( variable[3] /*i*/)<UNTAG_Int(variable[4]));
497 if (UNTAG_Bool(variable[4])) { /*if*/
498 /* Register variable[4]: Result */
499 variable[4] = TAG_Int(UNTAG_Int( variable[3] /*i*/)+UNTAG_Int( TAG_Int(1)));
500 ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/ = variable[4];
501 goto return_label14;
502 } else { /*if*/
503 ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/ = variable[3] /*i*/;
504 /* Register variable[4]: Result */
505 variable[4] = CALL_stream___BufferedIStream___end_reached(variable[0])(variable[0]) /*BufferedIStream::end_reached*/;
506 if (UNTAG_Bool(variable[4])) { /*if*/
507 goto return_label14;
508 } else { /*if*/
509 CALL_stream___BufferedIStream___fill_buffer(variable[0])(variable[0]) /*BufferedIStream::fill_buffer*/;
510 }
511 }
512 continue_15: while(0);
513 }
514 break_15: while(0);
515 return_label14: while(false);
516 tracehead = trace.prev;
517 return;
518 }
519 val_t stream___BufferedIStream___eof(val_t self) {
520 struct trace_t trace = {NULL, NULL, 184, LOCATE_stream___BufferedIStream___eof};
521 val_t variable[4];
522 struct WBT_ **closurevariable = NULL;
523 trace.prev = tracehead; tracehead = &trace;
524 trace.file = LOCATE_stream;
525 /* Register variable[0]: Local variable */
526 variable[0] = self;
527 /* Register variable[1]: Method return value and escape marker */
528 /* Register variable[2]: Result */
529 variable[2] = ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/;
530 /* Register variable[3]: Result */
531 variable[3] = ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/;
532 /* Register variable[3]: Result */
533 variable[3] = CALL_abstract_collection___Collection___length(variable[3])(variable[3]) /*AbstractArrayRead::length*/;
534 /* Register variable[2]: Result */
535 variable[2] = TAG_Bool(UNTAG_Int(variable[2])>=UNTAG_Int(variable[3]));
536 /* Ensure var variable[2]: Left 'and' operand*/
537 if (UNTAG_Bool(variable[2])) { /* and */
538 /* Register variable[2]: Result */
539 variable[2] = CALL_stream___BufferedIStream___end_reached(variable[0])(variable[0]) /*BufferedIStream::end_reached*/;
540 }
541 /* Register variable[2]: Result */
542 variable[1] = variable[2];
543 goto return_label18;
544 return_label18: while(false);
545 tracehead = trace.prev;
546 return variable[1];
547 }
548 void stream___BufferedIStream___fill_buffer(val_t self) {
549 struct trace_t trace = {NULL, NULL, 192, LOCATE_stream___BufferedIStream___fill_buffer};
550 val_t *variable = NULL;
551 struct WBT_ **closurevariable = NULL;
552 trace.prev = tracehead; tracehead = &trace;
553 trace.file = LOCATE_stream;
554 fprintf(stderr, "Deferred method called");
555 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 192);
556 nit_exit(1);
557 tracehead = trace.prev;
558 return;
559 }
560 val_t stream___BufferedIStream___end_reached(val_t self) {
561 struct trace_t trace = {NULL, NULL, 195, LOCATE_stream___BufferedIStream___end_reached};
562 val_t *variable = NULL;
563 struct WBT_ **closurevariable = NULL;
564 trace.prev = tracehead; tracehead = &trace;
565 trace.file = LOCATE_stream;
566 fprintf(stderr, "Deferred method called");
567 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 195);
568 nit_exit(1);
569 tracehead = trace.prev;
570 return NIT_NULL;
571 }
572 void stream___BufferedIStream___prepare_buffer(val_t self, val_t param0) {
573 struct trace_t trace = {NULL, NULL, 198, LOCATE_stream___BufferedIStream___prepare_buffer};
574 val_t variable[4];
575 struct WBT_ **closurevariable = NULL;
576 trace.prev = tracehead; tracehead = &trace;
577 trace.file = LOCATE_stream;
578 /* Register variable[0]: Local variable */
579 variable[0] = self;
580 /* Register variable[1]: Local variable */
581 variable[1] = param0;
582 /* Register variable[2]: Method return value and escape marker */
583 /* Register variable[3]: Result */
584 variable[3] = NEW_Buffer_string___Buffer___with_capacity( variable[1] /*capacity*/) /*new Buffer*/;
585 ATTR_stream___BufferedIStream____buffer(variable[0]) /*BufferedIStream::_buffer*/ = variable[3];
586 ATTR_stream___BufferedIStream____buffer_pos(variable[0]) /*BufferedIStream::_buffer_pos*/ = TAG_Int(0);
587 return_label19: while(false);
588 tracehead = trace.prev;
589 return;
590 }
591 void stream___FDStream___close(val_t self) {
592 struct trace_t trace = {NULL, NULL, 218, LOCATE_stream___FDStream___close};
593 val_t variable[3];
594 struct WBT_ **closurevariable = NULL;
595 trace.prev = tracehead; tracehead = &trace;
596 trace.file = LOCATE_stream;
597 /* Register variable[0]: Local variable */
598 variable[0] = self;
599 /* Register variable[1]: Method return value and escape marker */
600 /* Register variable[2]: Result */
601 variable[2] = ATTR_stream___FDStream____fd(variable[0]) /*FDStream::_fd*/;
602 CALL_stream___FDStream___native_close(variable[0])(variable[0], variable[2]) /*FDStream::native_close*/;
603 return_label20: while(false);
604 tracehead = trace.prev;
605 return;
606 }
607 val_t stream___FDStream___native_close(val_t self, val_t param0) {
608 struct trace_t trace = {NULL, NULL, 220, LOCATE_stream___FDStream___native_close};
609 val_t *variable = NULL;
610 struct WBT_ **closurevariable = NULL;
611 trace.prev = tracehead; tracehead = &trace;
612 trace.file = LOCATE_stream;
613 tracehead = trace.prev;
614 return TAG_Int(stream_FDStream_FDStream_native_close_1( self, UNTAG_Int( param0)));
615 }
616 val_t stream___FDStream___native_read_char(val_t self, val_t param0) {
617 struct trace_t trace = {NULL, NULL, 221, LOCATE_stream___FDStream___native_read_char};
618 val_t *variable = NULL;
619 struct WBT_ **closurevariable = NULL;
620 trace.prev = tracehead; tracehead = &trace;
621 trace.file = LOCATE_stream;
622 tracehead = trace.prev;
623 return TAG_Int(stream_FDStream_FDStream_native_read_char_1( self, UNTAG_Int( param0)));
624 }
625 val_t stream___FDStream___native_read(val_t self, val_t param0, val_t param1, val_t param2) {
626 struct trace_t trace = {NULL, NULL, 222, LOCATE_stream___FDStream___native_read};
627 val_t *variable = NULL;
628 struct WBT_ **closurevariable = NULL;
629 trace.prev = tracehead; tracehead = &trace;
630 trace.file = LOCATE_stream;
631 tracehead = trace.prev;
632 return TAG_Int(stream_FDStream_FDStream_native_read_3( self, UNTAG_Int( param0), UNBOX_NativeString( param1), UNTAG_Int( param2)));
633 }
634 val_t stream___FDStream___native_write(val_t self, val_t param0, val_t param1, val_t param2) {
635 struct trace_t trace = {NULL, NULL, 223, LOCATE_stream___FDStream___native_write};
636 val_t *variable = NULL;
637 struct WBT_ **closurevariable = NULL;
638 trace.prev = tracehead; tracehead = &trace;
639 trace.file = LOCATE_stream;
640 tracehead = trace.prev;
641 return TAG_Int(stream_FDStream_FDStream_native_write_3( self, UNTAG_Int( param0), UNBOX_NativeString( param1), UNTAG_Int( param2)));
642 }
643 void stream___FDStream___init(val_t self, val_t param0, int* init_table) {
644 struct trace_t trace = {NULL, NULL, 225, LOCATE_stream___FDStream___init};
645 val_t variable[3];
646 struct WBT_ **closurevariable = NULL;
647 trace.prev = tracehead; tracehead = &trace;
648 trace.file = LOCATE_stream;
649 /* Register variable[0]: Local variable */
650 variable[0] = self;
651 /* Register variable[1]: Local variable */
652 variable[1] = param0;
653 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDStream].i]) return;
654 /* Register variable[2]: Method return value and escape marker */
655 ATTR_stream___FDStream____fd(variable[0]) /*FDStream::_fd*/ = variable[1] /*fd*/;
656 return_label21: while(false);
657 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDStream].i] = 1;
658 tracehead = trace.prev;
659 return;
660 }
661 val_t stream___FDIStream___read_char(val_t self) {
662 struct trace_t trace = {NULL, NULL, 233, LOCATE_stream___FDIStream___read_char};
663 val_t variable[4];
664 struct WBT_ **closurevariable = NULL;
665 trace.prev = tracehead; tracehead = &trace;
666 trace.file = LOCATE_stream;
667 /* Register variable[0]: Local variable */
668 variable[0] = self;
669 /* Register variable[1]: Method return value and escape marker */
670 /* Register variable[2]: Local variable */
671 /* Register variable[3]: Result */
672 variable[3] = ATTR_stream___FDStream____fd(variable[0]) /*FDStream::_fd*/;
673 /* Register variable[3]: Result */
674 variable[3] = CALL_stream___FDStream___native_read_char(variable[0])(variable[0], variable[3]) /*FDStream::native_read_char*/;
675 variable[2] = variable[3];
676 /* Register variable[3]: Result */
677 variable[3] = TAG_Int(-UNTAG_Int( TAG_Int(1)));
678 /* Register variable[3]: Result */
679 variable[3] = TAG_Bool(( variable[2] /*nb*/)==(variable[3]));
680 if (UNTAG_Bool(variable[3])) { /*if*/
681 ATTR_stream___FDIStream____eof(variable[0]) /*FDIStream::_eof*/ = TAG_Bool(true);
682 }
683 variable[1] = variable[2] /*nb*/;
684 goto return_label22;
685 return_label22: while(false);
686 tracehead = trace.prev;
687 return variable[1];
688 }
689 val_t stream___FDIStream___eof(val_t self) {
690 struct trace_t trace = {NULL, NULL, 231, LOCATE_stream___FDIStream___eof};
691 val_t *variable = NULL;
692 struct WBT_ **closurevariable = NULL;
693 trace.prev = tracehead; tracehead = &trace;
694 trace.file = LOCATE_stream;
695 tracehead = trace.prev;
696 return ATTR_stream___FDIStream____eof( self) /*FDIStream::_eof*/;
697 }
698 void stream___FDIStream___init(val_t self, val_t param0, int* init_table) {
699 struct trace_t trace = {NULL, NULL, 240, LOCATE_stream___FDIStream___init};
700 val_t variable[3];
701 struct WBT_ **closurevariable = NULL;
702 trace.prev = tracehead; tracehead = &trace;
703 trace.file = LOCATE_stream;
704 /* Register variable[0]: Local variable */
705 variable[0] = self;
706 /* Register variable[1]: Local variable */
707 variable[1] = param0;
708 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDIStream].i]) return;
709 /* Register variable[2]: Method return value and escape marker */
710 CALL_stream___FDStream___init(variable[0])(variable[0], variable[1], init_table /*YYY*/) /*FDStream::init*/;
711 return_label23: while(false);
712 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDIStream].i] = 1;
713 tracehead = trace.prev;
714 return;
715 }
716 void stream___FDOStream___write(val_t self, val_t param0) {
717 struct trace_t trace = {NULL, NULL, 248, LOCATE_stream___FDOStream___write};
718 val_t variable[7];
719 struct WBT_ **closurevariable = NULL;
720 trace.prev = tracehead; tracehead = &trace;
721 trace.file = LOCATE_stream;
722 /* Register variable[0]: Local variable */
723 variable[0] = self;
724 /* Register variable[1]: Local variable */
725 variable[1] = param0;
726 /* Register variable[2]: Method return value and escape marker */
727 /* Register variable[3]: Local variable */
728 /* Register variable[4]: Result */
729 variable[4] = ATTR_stream___FDStream____fd(variable[0]) /*FDStream::_fd*/;
730 /* Register variable[5]: Result */
731 variable[5] = CALL_string___String___to_cstring( variable[1] /*s*/)( variable[1] /*s*/) /*String::to_cstring*/;
732 /* Register variable[6]: Result */
733 variable[6] = CALL_abstract_collection___Collection___length( variable[1] /*s*/)( variable[1] /*s*/) /*AbstractArrayRead::length*/;
734 /* Register variable[4]: Result */
735 variable[4] = CALL_stream___FDStream___native_write(variable[0])(variable[0], variable[4], variable[5], variable[6]) /*FDStream::native_write*/;
736 variable[3] = variable[4];
737 /* Register variable[4]: Result */
738 variable[4] = CALL_abstract_collection___Collection___length( variable[1] /*s*/)( variable[1] /*s*/) /*AbstractArrayRead::length*/;
739 /* Register variable[4]: Result */
740 variable[4] = TAG_Bool(UNTAG_Int( variable[3] /*nb*/)<UNTAG_Int(variable[4]));
741 if (UNTAG_Bool(variable[4])) { /*if*/
742 ATTR_stream___FDOStream____is_writable(variable[0]) /*FDOStream::_is_writable*/ = TAG_Bool(false);
743 }
744 return_label24: while(false);
745 tracehead = trace.prev;
746 return;
747 }
748 val_t stream___FDOStream___is_writable(val_t self) {
749 struct trace_t trace = {NULL, NULL, 246, LOCATE_stream___FDOStream___is_writable};
750 val_t *variable = NULL;
751 struct WBT_ **closurevariable = NULL;
752 trace.prev = tracehead; tracehead = &trace;
753 trace.file = LOCATE_stream;
754 tracehead = trace.prev;
755 return ATTR_stream___FDOStream____is_writable( self) /*FDOStream::_is_writable*/;
756 }
757 void stream___FDOStream___init(val_t self, val_t param0, int* init_table) {
758 struct trace_t trace = {NULL, NULL, 254, LOCATE_stream___FDOStream___init};
759 val_t variable[3];
760 struct WBT_ **closurevariable = NULL;
761 trace.prev = tracehead; tracehead = &trace;
762 trace.file = LOCATE_stream;
763 /* Register variable[0]: Local variable */
764 variable[0] = self;
765 /* Register variable[1]: Local variable */
766 variable[1] = param0;
767 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDOStream].i]) return;
768 /* Register variable[2]: Method return value and escape marker */
769 CALL_stream___FDStream___init(variable[0])(variable[0], variable[1], init_table /*YYY*/) /*FDStream::init*/;
770 ATTR_stream___FDOStream____is_writable(variable[0]) /*FDOStream::_is_writable*/ = TAG_Bool(true);
771 return_label25: while(false);
772 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDOStream].i] = 1;
773 tracehead = trace.prev;
774 return;
775 }
776 void stream___FDIOStream___init(val_t self, val_t param0, int* init_table) {
777 struct trace_t trace = {NULL, NULL, 264, LOCATE_stream___FDIOStream___init};
778 val_t variable[3];
779 struct WBT_ **closurevariable = NULL;
780 trace.prev = tracehead; tracehead = &trace;
781 trace.file = LOCATE_stream;
782 /* Register variable[0]: Local variable */
783 variable[0] = self;
784 /* Register variable[1]: Local variable */
785 variable[1] = param0;
786 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDIOStream].i]) return;
787 /* Register variable[2]: Method return value and escape marker */
788 CALL_stream___FDIStream___init(variable[0])(variable[0], variable[1], init_table /*YYY*/) /*FDIStream::init*/;
789 CALL_stream___FDOStream___init(variable[0])(variable[0], variable[1], init_table /*YYY*/) /*FDOStream::init*/;
790 ATTR_stream___FDStream____fd(variable[0]) /*FDStream::_fd*/ = variable[1] /*fd*/;
791 ATTR_stream___FDOStream____is_writable(variable[0]) /*FDOStream::_is_writable*/ = TAG_Bool(true);
792 return_label26: while(false);
793 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_FDIOStream].i] = 1;
794 tracehead = trace.prev;
795 return;
796 }