misc: update Changelog and NOTICE; remove BUGS and TODO
[nit.git] / c_src / range._sep.c
1 /* This C file is generated by NIT to compile module range. */
2 #include "range._sep.h"
3 val_t range___Range___iterator(val_t self) {
4 struct trace_t trace = {NULL, NULL, 43, LOCATE_range___Range___iterator};
5 val_t variable[3];
6 struct WBT_ **closurevariable = NULL;
7 trace.prev = tracehead; tracehead = &trace;
8 trace.file = LOCATE_range;
9 /* Register variable[0]: Local variable */
10 variable[0] = self;
11 /* Register variable[1]: Method return value and escape marker */
12 /* Register variable[2]: Result */
13 variable[2] = NEW_IteratorRange_range___IteratorRange___init(variable[0]) /*new IteratorRange[E]*/;
14 variable[1] = variable[2];
15 goto return_label0;
16 return_label0: while(false);
17 tracehead = trace.prev;
18 return variable[1];
19 }
20 val_t range___Range___is_empty(val_t self) {
21 struct trace_t trace = {NULL, NULL, 55, LOCATE_range___Range___is_empty};
22 val_t variable[4];
23 struct WBT_ **closurevariable = NULL;
24 trace.prev = tracehead; tracehead = &trace;
25 trace.file = LOCATE_range;
26 /* Register variable[0]: Local variable */
27 variable[0] = self;
28 /* Register variable[1]: Method return value and escape marker */
29 /* Register variable[2]: Result */
30 variable[2] = ATTR_range___Range____first(variable[0]) /*Range::_first*/;
31 /* Register variable[3]: Result */
32 variable[3] = ATTR_range___Range____after(variable[0]) /*Range::_after*/;
33 /* Register variable[2]: Result */
34 variable[2] = CALL_kernel___Comparable_____geq(variable[2])(variable[2], variable[3]) /*Comparable::>=*/;
35 variable[1] = variable[2];
36 goto return_label1;
37 return_label1: while(false);
38 tracehead = trace.prev;
39 return variable[1];
40 }
41 val_t range___Range___length(val_t self) {
42 struct trace_t trace = {NULL, NULL, 45, LOCATE_range___Range___length};
43 val_t variable[5];
44 struct WBT_ **closurevariable = NULL;
45 trace.prev = tracehead; tracehead = &trace;
46 trace.file = LOCATE_range;
47 /* Register variable[0]: Local variable */
48 variable[0] = self;
49 /* Register variable[1]: Method return value and escape marker */
50 /* Register variable[2]: Local variable */
51 /* Register variable[3]: Result */
52 variable[3] = ATTR_range___Range____first(variable[0]) /*Range::_first*/;
53 /* Register variable[4]: Result */
54 variable[4] = ATTR_range___Range____after(variable[0]) /*Range::_after*/;
55 /* Register variable[3]: Result */
56 variable[3] = CALL_kernel___Discrete___distance(variable[3])(variable[3], variable[4]) /*Discrete::distance*/;
57 variable[2] = variable[3];
58 /* Register variable[3]: Result */
59 variable[3] = TAG_Bool(UNTAG_Int( variable[2] /*nb*/)>UNTAG_Int( TAG_Int(0)));
60 if (UNTAG_Bool(variable[3])) { /*if*/
61 variable[1] = variable[2] /*nb*/;
62 goto return_label2;
63 } else { /*if*/
64 variable[1] = TAG_Int(0);
65 goto return_label2;
66 }
67 return_label2: while(false);
68 tracehead = trace.prev;
69 return variable[1];
70 }
71 val_t range___Range___has(val_t self, val_t param0) {
72 struct trace_t trace = {NULL, NULL, 30, LOCATE_range___Range___has};
73 val_t variable[4];
74 struct WBT_ **closurevariable = NULL;
75 trace.prev = tracehead; tracehead = &trace;
76 trace.file = LOCATE_range;
77 /* Register variable[0]: Local variable */
78 variable[0] = self;
79 /* Register variable[1]: Local variable */
80 variable[1] = param0;
81 /* Register variable[2]: Method return value and escape marker */
82 /* Register variable[3]: Result */
83 variable[3] = ATTR_range___Range____first(variable[0]) /*Range::_first*/;
84 /* Register variable[3]: Result */
85 variable[3] = CALL_kernel___Comparable_____geq( variable[1] /*item*/)( variable[1] /*item*/, variable[3]) /*Comparable::>=*/;
86 /* Ensure var variable[3]: Left 'and' operand*/
87 if (UNTAG_Bool(variable[3])) { /* and */
88 /* Register variable[3]: Result */
89 variable[3] = ATTR_range___Range____last(variable[0]) /*Range::_last*/;
90 /* Register variable[3]: Result */
91 variable[3] = CALL_kernel___Comparable_____leq( variable[1] /*item*/)( variable[1] /*item*/, variable[3]) /*Comparable::<=*/;
92 }
93 /* Register variable[3]: Result */
94 variable[2] = variable[3];
95 goto return_label3;
96 return_label3: while(false);
97 tracehead = trace.prev;
98 return variable[2];
99 }
100 val_t range___Range___has_only(val_t self, val_t param0) {
101 struct trace_t trace = {NULL, NULL, 32, LOCATE_range___Range___has_only};
102 val_t variable[4];
103 struct WBT_ **closurevariable = NULL;
104 trace.prev = tracehead; tracehead = &trace;
105 trace.file = LOCATE_range;
106 /* Register variable[0]: Local variable */
107 variable[0] = self;
108 /* Register variable[1]: Local variable */
109 variable[1] = param0;
110 /* Register variable[2]: Method return value and escape marker */
111 /* Register variable[3]: Result */
112 variable[3] = ATTR_range___Range____first(variable[0]) /*Range::_first*/;
113 /* Register variable[3]: Result */
114 variable[3] = TAG_Bool((variable[3] == variable[1] /*item*/) || ((variable[3] != NIT_NULL) && ((CALL_kernel___Object_____eqeq(variable[3])==kernel___Object_____eqeq)?(IS_EQUAL_NN(variable[3], variable[1] /*item*/)):(UNTAG_Bool(CALL_kernel___Object_____eqeq(variable[3])(variable[3], variable[1] /*item*/) /*Object::==*/)))));
115 /* Ensure var variable[3]: Left 'and' operand*/
116 if (UNTAG_Bool(variable[3])) { /* and */
117 /* Register variable[3]: Result */
118 variable[3] = ATTR_range___Range____last(variable[0]) /*Range::_last*/;
119 /* Register variable[3]: Result */
120 variable[3] = TAG_Bool(( variable[1] /*item*/ == variable[3]) || (( variable[1] /*item*/ != NIT_NULL) && ((CALL_kernel___Object_____eqeq( variable[1] /*item*/)==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable[1] /*item*/,variable[3])):(UNTAG_Bool(CALL_kernel___Object_____eqeq( variable[1] /*item*/)( variable[1] /*item*/, variable[3]) /*Object::==*/)))));
121 }
122 /* Register variable[3]: Result */
123 variable[2] = variable[3];
124 goto return_label4;
125 return_label4: while(false);
126 tracehead = trace.prev;
127 return variable[2];
128 }
129 val_t range___Range___count(val_t self, val_t param0) {
130 struct trace_t trace = {NULL, NULL, 34, LOCATE_range___Range___count};
131 val_t variable[4];
132 struct WBT_ **closurevariable = NULL;
133 trace.prev = tracehead; tracehead = &trace;
134 trace.file = LOCATE_range;
135 /* Register variable[0]: Local variable */
136 variable[0] = self;
137 /* Register variable[1]: Local variable */
138 variable[1] = param0;
139 /* Register variable[2]: Method return value and escape marker */
140 /* Register variable[3]: Result */
141 variable[3] = CALL_abstract_collection___Collection___has(variable[0])(variable[0], variable[1] /*item*/) /*Range::has*/;
142 if (UNTAG_Bool(variable[3])) { /*if*/
143 variable[2] = TAG_Int(1);
144 goto return_label5;
145 } else { /*if*/
146 variable[2] = TAG_Int(0);
147 goto return_label5;
148 }
149 return_label5: while(false);
150 tracehead = trace.prev;
151 return variable[2];
152 }
153 val_t range___Range___first(val_t self) {
154 struct trace_t trace = {NULL, NULL, 22, LOCATE_range___Range___first};
155 val_t *variable = NULL;
156 struct WBT_ **closurevariable = NULL;
157 trace.prev = tracehead; tracehead = &trace;
158 trace.file = LOCATE_range;
159 tracehead = trace.prev;
160 return ATTR_range___Range____first( self) /*Range::_first*/;
161 }
162 val_t range___Range___last(val_t self) {
163 struct trace_t trace = {NULL, NULL, 24, LOCATE_range___Range___last};
164 val_t *variable = NULL;
165 struct WBT_ **closurevariable = NULL;
166 trace.prev = tracehead; tracehead = &trace;
167 trace.file = LOCATE_range;
168 tracehead = trace.prev;
169 return ATTR_range___Range____last( self) /*Range::_last*/;
170 }
171 val_t range___Range___after(val_t self) {
172 struct trace_t trace = {NULL, NULL, 27, LOCATE_range___Range___after};
173 val_t *variable = NULL;
174 struct WBT_ **closurevariable = NULL;
175 trace.prev = tracehead; tracehead = &trace;
176 trace.file = LOCATE_range;
177 tracehead = trace.prev;
178 return ATTR_range___Range____after( self) /*Range::_after*/;
179 }
180 void range___Range___init(val_t self, val_t param0, val_t param1, int* init_table) {
181 struct trace_t trace = {NULL, NULL, 57, LOCATE_range___Range___init};
182 val_t variable[5];
183 struct WBT_ **closurevariable = NULL;
184 trace.prev = tracehead; tracehead = &trace;
185 trace.file = LOCATE_range;
186 /* Register variable[0]: Local variable */
187 variable[0] = self;
188 /* Register variable[1]: Local variable */
189 variable[1] = param0;
190 /* Register variable[2]: Local variable */
191 variable[2] = param1;
192 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_Range].i]) return;
193 /* Register variable[3]: Method return value and escape marker */
194 ATTR_range___Range____first(variable[0]) /*Range::_first*/ = variable[1] /*from*/;
195 ATTR_range___Range____last(variable[0]) /*Range::_last*/ = variable[2] /*to*/;
196 /* Register variable[4]: Result */
197 variable[4] = CALL_kernel___Discrete___succ( variable[2] /*to*/)( variable[2] /*to*/) /*Discrete::succ*/;
198 ATTR_range___Range____after(variable[0]) /*Range::_after*/ = variable[4];
199 return_label6: while(false);
200 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_Range].i] = 1;
201 tracehead = trace.prev;
202 return;
203 }
204 void range___Range___without_last(val_t self, val_t param0, val_t param1, int* init_table) {
205 struct trace_t trace = {NULL, NULL, 66, LOCATE_range___Range___without_last};
206 val_t variable[5];
207 struct WBT_ **closurevariable = NULL;
208 trace.prev = tracehead; tracehead = &trace;
209 trace.file = LOCATE_range;
210 /* Register variable[0]: Local variable */
211 variable[0] = self;
212 /* Register variable[1]: Local variable */
213 variable[1] = param0;
214 /* Register variable[2]: Local variable */
215 variable[2] = param1;
216 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_Range].i]) return;
217 /* Register variable[3]: Method return value and escape marker */
218 ATTR_range___Range____first(variable[0]) /*Range::_first*/ = variable[1] /*from*/;
219 /* Register variable[4]: Result */
220 variable[4] = CALL_kernel___Discrete___prec( variable[2] /*to*/)( variable[2] /*to*/) /*Discrete::prec*/;
221 ATTR_range___Range____last(variable[0]) /*Range::_last*/ = variable[4];
222 ATTR_range___Range____after(variable[0]) /*Range::_after*/ = variable[2] /*to*/;
223 return_label7: while(false);
224 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_Range].i] = 1;
225 tracehead = trace.prev;
226 return;
227 }
228 val_t range___IteratorRange___item(val_t self) {
229 struct trace_t trace = {NULL, NULL, 80, LOCATE_range___IteratorRange___item};
230 val_t *variable = NULL;
231 struct WBT_ **closurevariable = NULL;
232 trace.prev = tracehead; tracehead = &trace;
233 trace.file = LOCATE_range;
234 tracehead = trace.prev;
235 return ATTR_range___IteratorRange____item( self) /*IteratorRange::_item*/;
236 }
237 void range___IteratorRange___next(val_t self) {
238 struct trace_t trace = {NULL, NULL, 84, LOCATE_range___IteratorRange___next};
239 val_t variable[3];
240 struct WBT_ **closurevariable = NULL;
241 trace.prev = tracehead; tracehead = &trace;
242 trace.file = LOCATE_range;
243 /* Register variable[0]: Local variable */
244 variable[0] = self;
245 /* Register variable[1]: Method return value and escape marker */
246 /* Register variable[2]: Result */
247 variable[2] = ATTR_range___IteratorRange____item(variable[0]) /*IteratorRange::_item*/;
248 /* Register variable[2]: Result */
249 variable[2] = CALL_kernel___Discrete___succ(variable[2])(variable[2]) /*Discrete::succ*/;
250 ATTR_range___IteratorRange____item(variable[0]) /*IteratorRange::_item*/ = variable[2];
251 return_label8: while(false);
252 tracehead = trace.prev;
253 return;
254 }
255 val_t range___IteratorRange___is_ok(val_t self) {
256 struct trace_t trace = {NULL, NULL, 82, LOCATE_range___IteratorRange___is_ok};
257 val_t variable[4];
258 struct WBT_ **closurevariable = NULL;
259 trace.prev = tracehead; tracehead = &trace;
260 trace.file = LOCATE_range;
261 /* Register variable[0]: Local variable */
262 variable[0] = self;
263 /* Register variable[1]: Method return value and escape marker */
264 /* Register variable[2]: Result */
265 variable[2] = ATTR_range___IteratorRange____item(variable[0]) /*IteratorRange::_item*/;
266 /* Register variable[3]: Result */
267 variable[3] = ATTR_range___IteratorRange____range(variable[0]) /*IteratorRange::_range*/;
268 /* Register variable[3]: Result */
269 variable[3] = CALL_range___Range___after(variable[3])(variable[3]) /*Range::after*/;
270 /* Register variable[2]: Result */
271 variable[2] = CALL_kernel___Comparable_____l(variable[2])(variable[2], variable[3]) /*Comparable::<*/;
272 variable[1] = variable[2];
273 goto return_label9;
274 return_label9: while(false);
275 tracehead = trace.prev;
276 return variable[1];
277 }
278 void range___IteratorRange___init(val_t self, val_t param0, int* init_table) {
279 struct trace_t trace = {NULL, NULL, 86, LOCATE_range___IteratorRange___init};
280 val_t variable[4];
281 struct WBT_ **closurevariable = NULL;
282 trace.prev = tracehead; tracehead = &trace;
283 trace.file = LOCATE_range;
284 /* Register variable[0]: Local variable */
285 variable[0] = self;
286 /* Register variable[1]: Local variable */
287 variable[1] = param0;
288 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_IteratorRange].i]) return;
289 /* Register variable[2]: Method return value and escape marker */
290 ATTR_range___IteratorRange____range(variable[0]) /*IteratorRange::_range*/ = variable[1] /*r*/;
291 /* Register variable[3]: Result */
292 variable[3] = CALL_abstract_collection___Collection___first( variable[1] /*r*/)( variable[1] /*r*/) /*Range::first*/;
293 ATTR_range___IteratorRange____item(variable[0]) /*IteratorRange::_item*/ = variable[3];
294 return_label10: while(false);
295 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_IteratorRange].i] = 1;
296 tracehead = trace.prev;
297 return;
298 }