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