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);
12 tracehead
= trace
.prev
;
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
;
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);
33 tracehead
= trace
.prev
;
36 val_t
stream___IStream___read(val_t self
, val_t param0
) {
37 struct trace_t trace
= {NULL
, NULL
, 30, LOCATE_stream___IStream___read
};
39 struct WBT_
**closurevariable
= NULL
;
40 trace
.prev
= tracehead
; tracehead
= &trace
;
41 trace
.file
= LOCATE_stream
;
42 /* Register variable[0]: Local variable */
44 /* Register variable[1]: Local variable */
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]));
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*/;
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];
81 return_label0
: while(false);
82 tracehead
= trace
.prev
;
85 val_t
stream___IStream___read_line(val_t self
) {
86 struct trace_t trace
= {NULL
, NULL
, 44, LOCATE_stream___IStream___read_line
};
88 struct WBT_
**closurevariable
= NULL
;
89 trace
.prev
= tracehead
; tracehead
= &trace
;
90 trace
.file
= LOCATE_stream
;
91 /* Register variable[0]: Local variable */
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];
106 return_label2
: while(false);
107 tracehead
= trace
.prev
;
110 val_t
stream___IStream___read_all(val_t self
) {
111 struct trace_t trace
= {NULL
, NULL
, 53, LOCATE_stream___IStream___read_all
};
113 struct WBT_
**closurevariable
= NULL
;
114 trace
.prev
= tracehead
; tracehead
= &trace
;
115 trace
.file
= LOCATE_stream
;
116 /* Register variable[0]: Local variable */
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*/;
138 continue_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];
145 return_label3
: while(false);
146 tracehead
= trace
.prev
;
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
};
152 struct WBT_
**closurevariable
= NULL
;
153 trace
.prev
= tracehead
; tracehead
= &trace
;
154 trace
.file
= LOCATE_stream
;
155 /* Register variable[0]: Local variable */
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*/
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*/
188 continue_6
: while(0);
191 return_label5
: while(false);
192 tracehead
= trace
.prev
;
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);
204 tracehead
= trace
.prev
;
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);
216 tracehead
= trace
.prev
;
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);
228 tracehead
= trace
.prev
;
231 val_t
stream___BufferedIStream___read_char(val_t self
) {
232 struct trace_t trace
= {NULL
, NULL
, 96, LOCATE_stream___BufferedIStream___read_char
};
234 struct WBT_
**closurevariable
= NULL
;
235 trace
.prev
= tracehead
; tracehead
= &trace
;
236 trace
.file
= LOCATE_stream
;
237 /* Register variable[0]: Local variable */
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*/;
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];
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];
281 return_label7
: while(false);
282 tracehead
= trace
.prev
;
285 val_t
stream___BufferedIStream___read(val_t self
, val_t param0
) {
286 struct trace_t trace
= {NULL
, NULL
, 110, LOCATE_stream___BufferedIStream___read
};
288 struct WBT_
**closurevariable
= NULL
;
289 trace
.prev
= tracehead
; tracehead
= &trace
;
290 trace
.file
= LOCATE_stream
;
291 /* Register variable[0]: Local variable */
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];
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=*/;
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)));
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);
355 continue_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];
363 return_label8
: while(false);
364 tracehead
= trace
.prev
;
367 val_t
stream___BufferedIStream___read_all(val_t self
) {
368 struct trace_t trace
= {NULL
, NULL
, 132, LOCATE_stream___BufferedIStream___read_all
};
370 struct WBT_
**closurevariable
= NULL
;
371 trace
.prev
= tracehead
; tracehead
= &trace
;
372 trace
.file
= LOCATE_stream
;
373 /* Register variable[0]: Local variable */
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);
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);
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];
416 return_label11
: while(false);
417 tracehead
= trace
.prev
;
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
};
423 struct WBT_
**closurevariable
= NULL
;
424 trace
.prev
= tracehead
; tracehead
= &trace
;
425 trace
.file
= LOCATE_stream
;
426 /* Register variable[0]: Local variable */
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')));
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);
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);
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];
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*/
509 CALL_stream___BufferedIStream___fill_buffer(variable
[0])(variable
[0]) /*BufferedIStream::fill_buffer*/;
512 continue_15
: while(0);
515 return_label14
: while(false);
516 tracehead
= trace
.prev
;
519 val_t
stream___BufferedIStream___eof(val_t self
) {
520 struct trace_t trace
= {NULL
, NULL
, 184, LOCATE_stream___BufferedIStream___eof
};
522 struct WBT_
**closurevariable
= NULL
;
523 trace
.prev
= tracehead
; tracehead
= &trace
;
524 trace
.file
= LOCATE_stream
;
525 /* Register variable[0]: Local variable */
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*/;
541 /* Register variable[2]: Result */
542 variable
[1] = variable
[2];
544 return_label18
: while(false);
545 tracehead
= trace
.prev
;
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);
557 tracehead
= trace
.prev
;
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);
569 tracehead
= trace
.prev
;
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
};
575 struct WBT_
**closurevariable
= NULL
;
576 trace
.prev
= tracehead
; tracehead
= &trace
;
577 trace
.file
= LOCATE_stream
;
578 /* Register variable[0]: Local variable */
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
;
591 void stream___FDStream___close(val_t self
) {
592 struct trace_t trace
= {NULL
, NULL
, 218, LOCATE_stream___FDStream___close
};
594 struct WBT_
**closurevariable
= NULL
;
595 trace
.prev
= tracehead
; tracehead
= &trace
;
596 trace
.file
= LOCATE_stream
;
597 /* Register variable[0]: Local variable */
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
;
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
)));
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
)));
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
)));
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
)));
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
};
646 struct WBT_
**closurevariable
= NULL
;
647 trace
.prev
= tracehead
; tracehead
= &trace
;
648 trace
.file
= LOCATE_stream
;
649 /* Register variable[0]: Local variable */
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
;
661 val_t
stream___FDIStream___read_char(val_t self
) {
662 struct trace_t trace
= {NULL
, NULL
, 233, LOCATE_stream___FDIStream___read_char
};
664 struct WBT_
**closurevariable
= NULL
;
665 trace
.prev
= tracehead
; tracehead
= &trace
;
666 trace
.file
= LOCATE_stream
;
667 /* Register variable[0]: Local variable */
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);
683 variable
[1] = variable
[2] /*nb*/;
685 return_label22
: while(false);
686 tracehead
= trace
.prev
;
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*/;
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
};
701 struct WBT_
**closurevariable
= NULL
;
702 trace
.prev
= tracehead
; tracehead
= &trace
;
703 trace
.file
= LOCATE_stream
;
704 /* Register variable[0]: Local variable */
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
;
716 void stream___FDOStream___write(val_t self
, val_t param0
) {
717 struct trace_t trace
= {NULL
, NULL
, 248, LOCATE_stream___FDOStream___write
};
719 struct WBT_
**closurevariable
= NULL
;
720 trace
.prev
= tracehead
; tracehead
= &trace
;
721 trace
.file
= LOCATE_stream
;
722 /* Register variable[0]: Local variable */
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);
744 return_label24
: while(false);
745 tracehead
= trace
.prev
;
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*/;
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
};
760 struct WBT_
**closurevariable
= NULL
;
761 trace
.prev
= tracehead
; tracehead
= &trace
;
762 trace
.file
= LOCATE_stream
;
763 /* Register variable[0]: Local variable */
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
;
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
};
779 struct WBT_
**closurevariable
= NULL
;
780 trace
.prev
= tracehead
; tracehead
= &trace
;
781 trace
.file
= LOCATE_stream
;
782 /* Register variable[0]: Local variable */
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
;