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