Update c_src
[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, LOCATE_stream, 20, LOCATE_stream___IOS___close};
5 trace.prev = tracehead; tracehead = &trace;
6 fprintf(stderr, "Deferred method %s called");
7 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 20);
8 nit_exit(1);
9 tracehead = trace.prev;
10 return;
11 }
12 val_t stream___IStream___read_char(val_t self) {
13 struct trace_t trace = {NULL, LOCATE_stream, 27, LOCATE_stream___IStream___read_char};
14 trace.prev = tracehead; tracehead = &trace;
15 fprintf(stderr, "Deferred method %s called");
16 fprintf(stderr, " (%s:%d)\n", LOCATE_stream, 27);
17 nit_exit(1);
18 tracehead = trace.prev;
19 return NIT_NULL;
20 }
21 val_t stream___IStream___read(val_t self, val_t param0) {
22 struct trace_t trace = {NULL, LOCATE_stream, 30, LOCATE_stream___IStream___read};
23 val_t variable0;
24 val_t variable1;
25 val_t variable2;
26 val_t variable3;
27 trace.prev = tracehead; tracehead = &trace;
28 variable0 = param0;
29 variable2 = NEW_string___String___with_capacity( variable0 /*i*/); /*new String*/
30 variable1 = variable2;
31 while (true) { /*while*/
32 variable2 = TAG_Bool(UNTAG_Int( variable0 /*i*/)>UNTAG_Int( TAG_Int(0)));
33 variable3 = variable2;
34 if (UNTAG_Bool(variable3)) { /* and */
35 variable3 = ((stream___IStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*IStream::eof*/;
36 variable3 = TAG_Bool(!UNTAG_Bool(variable3));
37 }
38 variable2 = variable3;
39 if (!UNTAG_Bool(variable2)) break; /* while*/
40 variable3 = ((stream___IStream___read_char_t)CALL( self,COLOR_stream___IStream___read_char))( self) /*IStream::read_char*/;
41 variable2 = variable3;
42 variable3 = TAG_Bool(UNTAG_Int( variable2 /*c*/)>=UNTAG_Int( TAG_Int(0)));
43 if (UNTAG_Bool(variable3)) { /*if*/
44 variable3 = TAG_Char(UNTAG_Int( variable2 /*c*/));
45 ((string___String___add_t)CALL( variable1 /*s*/,COLOR_abstract_collection___SimpleCollection___add))( variable1 /*s*/, variable3) /*String::add*/;
46 variable0 = TAG_Int(UNTAG_Int(variable0)-UNTAG_Int( TAG_Int(1))) /*i*/;
47 }
48 continue_1: while(0);
49 }
50 break_1: while(0);
51 variable1 = variable1 /*s*/;
52 goto return_label0;
53 return_label0: while(false);
54 tracehead = trace.prev;
55 return variable1;
56 }
57 val_t stream___IStream___read_line(val_t self) {
58 struct trace_t trace = {NULL, LOCATE_stream, 44, LOCATE_stream___IStream___read_line};
59 val_t variable0;
60 val_t variable1;
61 trace.prev = tracehead; tracehead = &trace;
62 variable0 = ((stream___IStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*IStream::eof*/;
63 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable0)))) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___IStream___read_line, LOCATE_stream, 47); nit_exit(1);}
64 variable1 = NEW_string___String___init(); /*new String*/
65 variable0 = variable1;
66 ((stream___IStream___append_line_to_t)CALL( self,COLOR_stream___IStream___append_line_to))( self, variable0 /*s*/) /*IStream::append_line_to*/;
67 variable0 = variable0 /*s*/;
68 goto return_label2;
69 return_label2: while(false);
70 tracehead = trace.prev;
71 return variable0;
72 }
73 val_t stream___IStream___read_all(val_t self) {
74 struct trace_t trace = {NULL, LOCATE_stream, 53, LOCATE_stream___IStream___read_all};
75 val_t variable0;
76 val_t variable1;
77 val_t variable2;
78 trace.prev = tracehead; tracehead = &trace;
79 variable1 = NEW_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
80 variable0 = variable1;
81 while (true) { /*while*/
82 variable1 = ((stream___IStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*IStream::eof*/;
83 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable1)))) break; /* while*/
84 variable2 = ((stream___IStream___read_char_t)CALL( self,COLOR_stream___IStream___read_char))( self) /*IStream::read_char*/;
85 variable1 = variable2;
86 variable2 = TAG_Bool(UNTAG_Int( variable1 /*c*/)>=UNTAG_Int( TAG_Int(0)));
87 if (UNTAG_Bool(variable2)) { /*if*/
88 variable2 = TAG_Char(UNTAG_Int( variable1 /*c*/));
89 ((string___String___add_t)CALL( variable0 /*s*/,COLOR_abstract_collection___SimpleCollection___add))( variable0 /*s*/, variable2) /*String::add*/;
90 }
91 continue_4: while(0);
92 }
93 break_4: while(0);
94 variable0 = variable0 /*s*/;
95 goto return_label3;
96 return_label3: while(false);
97 tracehead = trace.prev;
98 return variable0;
99 }
100 void stream___IStream___append_line_to(val_t self, val_t param0) {
101 struct trace_t trace = {NULL, LOCATE_stream, 64, LOCATE_stream___IStream___append_line_to};
102 val_t variable0;
103 val_t variable1;
104 val_t variable2;
105 val_t variable3;
106 trace.prev = tracehead; tracehead = &trace;
107 variable0 = param0;
108 while (true) { /*while*/
109 if (!UNTAG_Bool( TAG_Bool(true))) break; /* while*/
110 variable2 = ((stream___IStream___read_char_t)CALL( self,COLOR_stream___IStream___read_char))( self) /*IStream::read_char*/;
111 variable1 = variable2;
112 variable2 = TAG_Int(-UNTAG_Int( TAG_Int(1)));
113 variable2 = TAG_Bool(( variable1 /*x*/)==(variable2));
114 if (UNTAG_Bool(variable2)) { /*if*/
115 variable2 = ((stream___IStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*IStream::eof*/;
116 if (UNTAG_Bool(variable2)) { /*if*/
117 goto return_label5;
118 }
119 } else { /*if*/
120 variable3 = TAG_Char(UNTAG_Int( variable1 /*x*/));
121 variable2 = variable3;
122 ((array___AbstractArray___push_t)CALL( variable0 /*s*/,COLOR_abstract_collection___IndexedCollection___push))( variable0 /*s*/, variable2 /*c*/) /*AbstractArray::push*/;
123 variable3 = TAG_Bool(( variable2 /*c*/)==( TAG_Char('\n')));
124 if (UNTAG_Bool(variable3)) { /*if*/
125 goto return_label5;
126 }
127 }
128 continue_6: while(0);
129 }
130 break_6: while(0);
131 return_label5: while(false);
132 tracehead = trace.prev;
133 return;
134 }
135 val_t stream___IStream___eof(val_t self) {
136 struct trace_t trace = {NULL, LOCATE_stream, 79, LOCATE_stream___IStream___eof};
137 trace.prev = tracehead; tracehead = &trace;
138 fprintf(stderr, "Deferred method %s called");
139 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___IStream___append_line_to, LOCATE_stream, 79);
140 nit_exit(1);
141 tracehead = trace.prev;
142 return NIT_NULL;
143 }
144 void stream___OStream___write(val_t self, val_t param0) {
145 struct trace_t trace = {NULL, LOCATE_stream, 86, LOCATE_stream___OStream___write};
146 trace.prev = tracehead; tracehead = &trace;
147 fprintf(stderr, "Deferred method %s called");
148 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___IStream___append_line_to, LOCATE_stream, 86);
149 nit_exit(1);
150 tracehead = trace.prev;
151 return;
152 }
153 val_t stream___OStream___is_writable(val_t self) {
154 struct trace_t trace = {NULL, LOCATE_stream, 89, LOCATE_stream___OStream___is_writable};
155 trace.prev = tracehead; tracehead = &trace;
156 fprintf(stderr, "Deferred method %s called");
157 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___IStream___append_line_to, LOCATE_stream, 89);
158 nit_exit(1);
159 tracehead = trace.prev;
160 return NIT_NULL;
161 }
162 val_t stream___BufferedIStream___read_char(val_t self) {
163 struct trace_t trace = {NULL, LOCATE_stream, 96, LOCATE_stream___BufferedIStream___read_char};
164 val_t variable0;
165 val_t variable1;
166 val_t variable2;
167 trace.prev = tracehead; tracehead = &trace;
168 variable0 = ((stream___BufferedIStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*BufferedIStream::eof*/;
169 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable0)))) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___BufferedIStream___read_char, LOCATE_stream, 98); nit_exit(1);}
170 variable0 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
171 variable1 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
172 variable1 = ((array___AbstractArray___length_t)CALL(variable1,COLOR_abstract_collection___Collection___length))(variable1) /*AbstractArray::length*/;
173 variable0 = TAG_Bool(UNTAG_Int(variable0)>=UNTAG_Int(variable1));
174 if (UNTAG_Bool(variable0)) { /*if*/
175 ((stream___BufferedIStream___fill_buffer_t)CALL( self,COLOR_stream___BufferedIStream___fill_buffer))( self) /*BufferedIStream::fill_buffer*/;
176 }
177 variable0 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
178 variable1 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
179 variable1 = ((array___AbstractArray___length_t)CALL(variable1,COLOR_abstract_collection___Collection___length))(variable1) /*AbstractArray::length*/;
180 variable0 = TAG_Bool(UNTAG_Int(variable0)>=UNTAG_Int(variable1));
181 if (UNTAG_Bool(variable0)) { /*if*/
182 variable0 = TAG_Int(-UNTAG_Int( TAG_Int(1)));
183 goto return_label7;
184 }
185 variable1 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
186 variable2 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
187 variable1 = ((string___String_____bra_t)CALL(variable1,COLOR_abstract_collection___Map_____bra))(variable1, variable2) /*String::[]*/;
188 variable0 = variable1;
189 ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/ = TAG_Int(UNTAG_Int(ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/)+UNTAG_Int( TAG_Int(1)));
190 variable1 = TAG_Int((unsigned char)UNTAG_Char( variable0 /*c*/));
191 variable0 = variable1;
192 goto return_label7;
193 return_label7: while(false);
194 tracehead = trace.prev;
195 return variable0;
196 }
197 val_t stream___BufferedIStream___read(val_t self, val_t param0) {
198 struct trace_t trace = {NULL, LOCATE_stream, 110, LOCATE_stream___BufferedIStream___read};
199 val_t variable0;
200 val_t variable1;
201 val_t variable2;
202 val_t variable3;
203 val_t variable4;
204 val_t variable5;
205 trace.prev = tracehead; tracehead = &trace;
206 variable0 = param0;
207 variable2 = NEW_string___String___with_capacity( variable0 /*i*/); /*new String*/
208 variable1 = variable2;
209 variable3 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
210 variable2 = variable3;
211 variable4 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
212 variable4 = ((array___AbstractArray___length_t)CALL(variable4,COLOR_abstract_collection___Collection___length))(variable4) /*AbstractArray::length*/;
213 variable3 = variable4;
214 while (true) { /*while*/
215 variable4 = TAG_Bool(UNTAG_Int( variable0 /*i*/)>UNTAG_Int( TAG_Int(0)));
216 if (!UNTAG_Bool(variable4)) break; /* while*/
217 variable4 = TAG_Bool(UNTAG_Int( variable2 /*j*/)>=UNTAG_Int( variable3 /*k*/));
218 if (UNTAG_Bool(variable4)) { /*if*/
219 ((stream___BufferedIStream___fill_buffer_t)CALL( self,COLOR_stream___BufferedIStream___fill_buffer))( self) /*BufferedIStream::fill_buffer*/;
220 variable4 = ((stream___BufferedIStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*BufferedIStream::eof*/;
221 if (UNTAG_Bool(variable4)) { /*if*/
222 variable1 = variable1 /*s*/;
223 goto return_label8;
224 }
225 variable4 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
226 variable2 = variable4 /*j=*/;
227 variable4 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
228 variable4 = ((array___AbstractArray___length_t)CALL(variable4,COLOR_abstract_collection___Collection___length))(variable4) /*AbstractArray::length*/;
229 variable3 = variable4 /*k=*/;
230 }
231 while (true) { /*while*/
232 variable4 = TAG_Bool(UNTAG_Int( variable2 /*j*/)<UNTAG_Int( variable3 /*k*/));
233 variable5 = variable4;
234 if (UNTAG_Bool(variable5)) { /* and */
235 variable5 = TAG_Bool(UNTAG_Int( variable0 /*i*/)>UNTAG_Int( TAG_Int(0)));
236 }
237 variable4 = variable5;
238 if (!UNTAG_Bool(variable4)) break; /* while*/
239 variable4 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
240 variable4 = ((string___String_____bra_t)CALL(variable4,COLOR_abstract_collection___Map_____bra))(variable4, variable2 /*j*/) /*String::[]*/;
241 ((string___String___add_t)CALL( variable1 /*s*/,COLOR_abstract_collection___SimpleCollection___add))( variable1 /*s*/, variable4) /*String::add*/;
242 variable2 = TAG_Int(UNTAG_Int(variable2)+UNTAG_Int( TAG_Int(1))) /*j*/;
243 variable0 = TAG_Int(UNTAG_Int(variable0)-UNTAG_Int( TAG_Int(1))) /*i*/;
244 continue_10: while(0);
245 }
246 break_10: while(0);
247 continue_9: while(0);
248 }
249 break_9: while(0);
250 ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/ = variable2 /*j*/;
251 variable1 = variable1 /*s*/;
252 goto return_label8;
253 return_label8: while(false);
254 tracehead = trace.prev;
255 return variable1;
256 }
257 val_t stream___BufferedIStream___read_all(val_t self) {
258 struct trace_t trace = {NULL, LOCATE_stream, 132, LOCATE_stream___BufferedIStream___read_all};
259 val_t variable0;
260 val_t variable1;
261 val_t variable2;
262 val_t variable3;
263 trace.prev = tracehead; tracehead = &trace;
264 variable1 = NEW_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
265 variable0 = variable1;
266 while (true) { /*while*/
267 variable1 = ((stream___BufferedIStream___eof_t)CALL( self,COLOR_stream___IStream___eof))( self) /*BufferedIStream::eof*/;
268 if (!UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable1)))) break; /* while*/
269 variable2 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
270 variable1 = variable2;
271 variable3 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
272 variable3 = ((array___AbstractArray___length_t)CALL(variable3,COLOR_abstract_collection___Collection___length))(variable3) /*AbstractArray::length*/;
273 variable2 = variable3;
274 while (true) { /*while*/
275 variable3 = TAG_Bool(UNTAG_Int( variable1 /*j*/)<UNTAG_Int( variable2 /*k*/));
276 if (!UNTAG_Bool(variable3)) break; /* while*/
277 variable3 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
278 variable3 = ((string___String_____bra_t)CALL(variable3,COLOR_abstract_collection___Map_____bra))(variable3, variable1 /*j*/) /*String::[]*/;
279 ((string___String___add_t)CALL( variable0 /*s*/,COLOR_abstract_collection___SimpleCollection___add))( variable0 /*s*/, variable3) /*String::add*/;
280 variable1 = TAG_Int(UNTAG_Int(variable1)+UNTAG_Int( TAG_Int(1))) /*j*/;
281 continue_13: while(0);
282 }
283 break_13: while(0);
284 ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/ = variable1 /*j*/;
285 ((stream___BufferedIStream___fill_buffer_t)CALL( self,COLOR_stream___BufferedIStream___fill_buffer))( self) /*BufferedIStream::fill_buffer*/;
286 continue_12: while(0);
287 }
288 break_12: while(0);
289 variable0 = variable0 /*s*/;
290 goto return_label11;
291 return_label11: while(false);
292 tracehead = trace.prev;
293 return variable0;
294 }
295 void stream___BufferedIStream___append_line_to(val_t self, val_t param0) {
296 struct trace_t trace = {NULL, LOCATE_stream, 148, LOCATE_stream___BufferedIStream___append_line_to};
297 val_t variable0;
298 val_t variable1;
299 val_t variable2;
300 val_t variable3;
301 trace.prev = tracehead; tracehead = &trace;
302 variable0 = param0;
303 while (true) { /*while*/
304 if (!UNTAG_Bool( TAG_Bool(true))) break; /* while*/
305 variable2 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
306 variable1 = variable2;
307 while (true) { /*while*/
308 variable2 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
309 variable2 = ((array___AbstractArray___length_t)CALL(variable2,COLOR_abstract_collection___Collection___length))(variable2) /*AbstractArray::length*/;
310 variable2 = TAG_Bool(UNTAG_Int( variable1 /*i*/)<UNTAG_Int(variable2));
311 variable3 = variable2;
312 if (UNTAG_Bool(variable3)) { /* and */
313 variable3 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
314 variable3 = ((string___String_____bra_t)CALL(variable3,COLOR_abstract_collection___Map_____bra))(variable3, variable1 /*i*/) /*String::[]*/;
315 variable3 = TAG_Bool((variable3)!=( TAG_Char('\n')));
316 }
317 variable2 = variable3;
318 if (!UNTAG_Bool(variable2)) break; /* while*/
319 variable1 = TAG_Int(UNTAG_Int(variable1)+UNTAG_Int( TAG_Int(1))) /*i*/;
320 continue_16: while(0);
321 }
322 break_16: while(0);
323 variable2 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
324 variable2 = TAG_Bool(UNTAG_Int( variable1 /*i*/)>UNTAG_Int(variable2));
325 if (UNTAG_Bool(variable2)) { /*if*/
326 variable2 = ((array___AbstractArray___length_t)CALL( variable0 /*s*/,COLOR_abstract_collection___Collection___length))( variable0 /*s*/) /*AbstractArray::length*/;
327 variable2 = TAG_Int(UNTAG_Int(variable2)+UNTAG_Int( variable1 /*i*/));
328 variable3 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
329 variable2 = TAG_Int(UNTAG_Int(variable2)-UNTAG_Int(variable3));
330 ((string___String___enlarge_t)CALL( variable0 /*s*/,COLOR_array___AbstractArray___enlarge))( variable0 /*s*/, variable2) /*String::enlarge*/;
331 variable3 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
332 variable2 = variable3;
333 while (true) { /*while*/
334 variable3 = TAG_Bool(UNTAG_Int( variable2 /*j*/)<UNTAG_Int( variable1 /*i*/));
335 if (!UNTAG_Bool(variable3)) break; /* while*/
336 variable3 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
337 variable3 = ((string___String_____bra_t)CALL(variable3,COLOR_abstract_collection___Map_____bra))(variable3, variable2 /*j*/) /*String::[]*/;
338 ((string___String___add_t)CALL( variable0 /*s*/,COLOR_abstract_collection___SimpleCollection___add))( variable0 /*s*/, variable3) /*String::add*/;
339 variable2 = TAG_Int(UNTAG_Int(variable2)+UNTAG_Int( TAG_Int(1))) /*j*/;
340 continue_17: while(0);
341 }
342 break_17: while(0);
343 }
344 variable2 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
345 variable2 = ((array___AbstractArray___length_t)CALL(variable2,COLOR_abstract_collection___Collection___length))(variable2) /*AbstractArray::length*/;
346 variable2 = TAG_Bool(UNTAG_Int( variable1 /*i*/)<UNTAG_Int(variable2));
347 if (UNTAG_Bool(variable2)) { /*if*/
348 variable2 = TAG_Int(UNTAG_Int( variable1 /*i*/)+UNTAG_Int( TAG_Int(1)));
349 ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/ = variable2;
350 goto return_label14;
351 } else { /*if*/
352 ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/ = variable1 /*i*/;
353 variable2 = ((stream___BufferedIStream___end_reached_t)CALL( self,COLOR_stream___BufferedIStream___end_reached))( self) /*BufferedIStream::end_reached*/;
354 if (UNTAG_Bool(variable2)) { /*if*/
355 goto return_label14;
356 } else { /*if*/
357 ((stream___BufferedIStream___fill_buffer_t)CALL( self,COLOR_stream___BufferedIStream___fill_buffer))( self) /*BufferedIStream::fill_buffer*/;
358 }
359 }
360 continue_15: while(0);
361 }
362 break_15: while(0);
363 return_label14: while(false);
364 tracehead = trace.prev;
365 return;
366 }
367 val_t stream___BufferedIStream___eof(val_t self) {
368 struct trace_t trace = {NULL, LOCATE_stream, 184, LOCATE_stream___BufferedIStream___eof};
369 val_t variable0;
370 val_t variable1;
371 trace.prev = tracehead; tracehead = &trace;
372 variable0 = ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/;
373 variable1 = ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/;
374 variable1 = ((array___AbstractArray___length_t)CALL(variable1,COLOR_abstract_collection___Collection___length))(variable1) /*AbstractArray::length*/;
375 variable0 = TAG_Bool(UNTAG_Int(variable0)>=UNTAG_Int(variable1));
376 variable1 = variable0;
377 if (UNTAG_Bool(variable1)) { /* and */
378 variable1 = ((stream___BufferedIStream___end_reached_t)CALL( self,COLOR_stream___BufferedIStream___end_reached))( self) /*BufferedIStream::end_reached*/;
379 }
380 variable0 = variable1;
381 goto return_label18;
382 return_label18: while(false);
383 tracehead = trace.prev;
384 return variable0;
385 }
386 void stream___BufferedIStream___fill_buffer(val_t self) {
387 struct trace_t trace = {NULL, LOCATE_stream, 192, LOCATE_stream___BufferedIStream___fill_buffer};
388 trace.prev = tracehead; tracehead = &trace;
389 fprintf(stderr, "Deferred method %s called");
390 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___BufferedIStream___eof, LOCATE_stream, 192);
391 nit_exit(1);
392 tracehead = trace.prev;
393 return;
394 }
395 val_t stream___BufferedIStream___end_reached(val_t self) {
396 struct trace_t trace = {NULL, LOCATE_stream, 195, LOCATE_stream___BufferedIStream___end_reached};
397 trace.prev = tracehead; tracehead = &trace;
398 fprintf(stderr, "Deferred method %s called");
399 fprintf(stderr, " in %s (%s:%d)\n", LOCATE_stream___BufferedIStream___eof, LOCATE_stream, 195);
400 nit_exit(1);
401 tracehead = trace.prev;
402 return NIT_NULL;
403 }
404 void stream___BufferedIStream___prepare_buffer(val_t self, val_t param0) {
405 struct trace_t trace = {NULL, LOCATE_stream, 198, LOCATE_stream___BufferedIStream___prepare_buffer};
406 val_t variable0;
407 val_t variable1;
408 trace.prev = tracehead; tracehead = &trace;
409 variable0 = param0;
410 variable1 = NEW_string___String___with_capacity( variable0 /*capacity*/); /*new String*/
411 ATTR_stream___BufferedIStream____buffer( self) /*BufferedIStream::_buffer*/ = variable1;
412 ATTR_stream___BufferedIStream____buffer_pos( self) /*BufferedIStream::_buffer_pos*/ = TAG_Int(0);
413 tracehead = trace.prev;
414 return;
415 }
416 void stream___FDStream___close(val_t self) {
417 struct trace_t trace = {NULL, LOCATE_stream, 218, LOCATE_stream___FDStream___close};
418 val_t variable0;
419 trace.prev = tracehead; tracehead = &trace;
420 variable0 = ATTR_stream___FDStream____fd( self) /*FDStream::_fd*/;
421 ((stream___FDStream___native_close_t)CALL( self,COLOR_stream___FDStream___native_close))( self, variable0) /*FDStream::native_close*/;
422 tracehead = trace.prev;
423 return;
424 }
425 val_t stream___FDStream___native_close(val_t self, val_t param0) {
426 struct trace_t trace = {NULL, LOCATE_stream, 220, LOCATE_stream___FDStream___native_close};
427 trace.prev = tracehead; tracehead = &trace;
428 tracehead = trace.prev;
429 return TAG_Int(stream_FDStream_FDStream_native_close_1( self, UNTAG_Int( param0)));
430 }
431 val_t stream___FDStream___native_read_char(val_t self, val_t param0) {
432 struct trace_t trace = {NULL, LOCATE_stream, 221, LOCATE_stream___FDStream___native_read_char};
433 trace.prev = tracehead; tracehead = &trace;
434 tracehead = trace.prev;
435 return TAG_Int(stream_FDStream_FDStream_native_read_char_1( self, UNTAG_Int( param0)));
436 }
437 val_t stream___FDStream___native_read(val_t self, val_t param0, val_t param1, val_t param2) {
438 struct trace_t trace = {NULL, LOCATE_stream, 222, LOCATE_stream___FDStream___native_read};
439 trace.prev = tracehead; tracehead = &trace;
440 tracehead = trace.prev;
441 return TAG_Int(stream_FDStream_FDStream_native_read_3( self, UNTAG_Int( param0), UNBOX_NativeString( param1), UNTAG_Int( param2)));
442 }
443 val_t stream___FDStream___native_write(val_t self, val_t param0, val_t param1, val_t param2) {
444 struct trace_t trace = {NULL, LOCATE_stream, 223, LOCATE_stream___FDStream___native_write};
445 trace.prev = tracehead; tracehead = &trace;
446 tracehead = trace.prev;
447 return TAG_Int(stream_FDStream_FDStream_native_write_3( self, UNTAG_Int( param0), UNBOX_NativeString( param1), UNTAG_Int( param2)));
448 }
449 void stream___FDStream___init(val_t self, val_t param0, int* init_table) {
450 struct trace_t trace = {NULL, LOCATE_stream, 225, LOCATE_stream___FDStream___init};
451 val_t variable0;
452 trace.prev = tracehead; tracehead = &trace;
453 variable0 = param0;
454 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDStream].i]) return;
455 ATTR_stream___FDStream____fd( self) /*FDStream::_fd*/ = variable0 /*fd*/;
456 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDStream].i] = 1;
457 tracehead = trace.prev;
458 return;
459 }
460 val_t stream___FDIStream___eof(val_t self) {
461 struct trace_t trace = {NULL, LOCATE_stream, 231, LOCATE_stream___FDIStream___eof};
462 trace.prev = tracehead; tracehead = &trace;
463 tracehead = trace.prev;
464 return ATTR_stream___FDIStream____eof( self) /*FDIStream::_eof*/;
465 }
466 val_t stream___FDIStream___read_char(val_t self) {
467 struct trace_t trace = {NULL, LOCATE_stream, 233, LOCATE_stream___FDIStream___read_char};
468 val_t variable0;
469 val_t variable1;
470 trace.prev = tracehead; tracehead = &trace;
471 variable1 = ATTR_stream___FDStream____fd( self) /*FDStream::_fd*/;
472 variable1 = ((stream___FDStream___native_read_char_t)CALL( self,COLOR_stream___FDStream___native_read_char))( self, variable1) /*FDStream::native_read_char*/;
473 variable0 = variable1;
474 variable1 = TAG_Int(-UNTAG_Int( TAG_Int(1)));
475 variable1 = TAG_Bool(( variable0 /*nb*/)==(variable1));
476 if (UNTAG_Bool(variable1)) { /*if*/
477 ATTR_stream___FDIStream____eof( self) /*FDIStream::_eof*/ = TAG_Bool(true);
478 }
479 variable0 = variable0 /*nb*/;
480 goto return_label22;
481 return_label22: while(false);
482 tracehead = trace.prev;
483 return variable0;
484 }
485 void stream___FDIStream___init(val_t self, val_t param0, int* init_table) {
486 struct trace_t trace = {NULL, LOCATE_stream, 240, LOCATE_stream___FDIStream___init};
487 val_t variable0;
488 trace.prev = tracehead; tracehead = &trace;
489 variable0 = param0;
490 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDIStream].i]) return;
491 ((stream___FDStream___init_t)CALL( self,COLOR_stream___FDStream___init))( self, param0, init_table /*YYY*/) /*FDStream::init*/;
492 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDIStream].i] = 1;
493 tracehead = trace.prev;
494 return;
495 }
496 val_t stream___FDOStream___is_writable(val_t self) {
497 struct trace_t trace = {NULL, LOCATE_stream, 246, LOCATE_stream___FDOStream___is_writable};
498 trace.prev = tracehead; tracehead = &trace;
499 tracehead = trace.prev;
500 return ATTR_stream___FDOStream____is_writable( self) /*FDOStream::_is_writable*/;
501 }
502 void stream___FDOStream___write(val_t self, val_t param0) {
503 struct trace_t trace = {NULL, LOCATE_stream, 248, LOCATE_stream___FDOStream___write};
504 val_t variable0;
505 val_t variable1;
506 val_t variable2;
507 val_t variable3;
508 val_t variable4;
509 trace.prev = tracehead; tracehead = &trace;
510 variable0 = param0;
511 variable2 = ATTR_stream___FDStream____fd( self) /*FDStream::_fd*/;
512 variable3 = ((string___String___to_cstring_t)CALL( variable0 /*s*/,COLOR_string___String___to_cstring))( variable0 /*s*/) /*String::to_cstring*/;
513 variable4 = ((array___AbstractArray___length_t)CALL( variable0 /*s*/,COLOR_abstract_collection___Collection___length))( variable0 /*s*/) /*AbstractArray::length*/;
514 variable2 = ((stream___FDStream___native_write_t)CALL( self,COLOR_stream___FDStream___native_write))( self, variable2, variable3, variable4) /*FDStream::native_write*/;
515 variable1 = variable2;
516 variable2 = ((array___AbstractArray___length_t)CALL( variable0 /*s*/,COLOR_abstract_collection___Collection___length))( variable0 /*s*/) /*AbstractArray::length*/;
517 variable2 = TAG_Bool(UNTAG_Int( variable1 /*nb*/)<UNTAG_Int(variable2));
518 if (UNTAG_Bool(variable2)) { /*if*/
519 ATTR_stream___FDOStream____is_writable( self) /*FDOStream::_is_writable*/ = TAG_Bool(false);
520 }
521 tracehead = trace.prev;
522 return;
523 }
524 void stream___FDOStream___init(val_t self, val_t param0, int* init_table) {
525 struct trace_t trace = {NULL, LOCATE_stream, 254, LOCATE_stream___FDOStream___init};
526 val_t variable0;
527 trace.prev = tracehead; tracehead = &trace;
528 variable0 = param0;
529 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDOStream].i]) return;
530 ((stream___FDStream___init_t)CALL( self,COLOR_stream___FDStream___init))( self, param0, init_table /*YYY*/) /*FDStream::init*/;
531 ATTR_stream___FDOStream____is_writable( self) /*FDOStream::_is_writable*/ = TAG_Bool(true);
532 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDOStream].i] = 1;
533 tracehead = trace.prev;
534 return;
535 }
536 void stream___FDIOStream___init(val_t self, val_t param0, int* init_table) {
537 struct trace_t trace = {NULL, LOCATE_stream, 265, LOCATE_stream___FDIOStream___init};
538 val_t variable0;
539 trace.prev = tracehead; tracehead = &trace;
540 variable0 = param0;
541 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDIOStream].i]) return;
542 ((stream___FDIStream___init_t)CALL( self,COLOR_stream___FDIStream___init))( self, param0, init_table /*YYY*/) /*FDIStream::init*/;
543 ((stream___FDOStream___init_t)CALL( self,COLOR_stream___FDOStream___init))( self, param0, init_table /*YYY*/) /*FDOStream::init*/;
544 ATTR_stream___FDStream____fd( self) /*FDStream::_fd*/ = variable0 /*fd*/;
545 ATTR_stream___FDOStream____is_writable( self) /*FDOStream::_is_writable*/ = TAG_Bool(true);
546 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_FDIOStream].i] = 1;
547 tracehead = trace.prev;
548 return;
549 }