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
};
6 struct WBT_
**closurevariable
= NULL
;
7 trace
.prev
= tracehead
; tracehead
= &trace
;
8 trace
.file
= LOCATE_range
;
9 /* Register variable[0]: Local variable */
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];
16 return_label0
: while(false);
17 tracehead
= trace
.prev
;
20 val_t
range___Range___is_empty(val_t self
) {
21 struct trace_t trace
= {NULL
, NULL
, 55, LOCATE_range___Range___is_empty
};
23 struct WBT_
**closurevariable
= NULL
;
24 trace
.prev
= tracehead
; tracehead
= &trace
;
25 trace
.file
= LOCATE_range
;
26 /* Register variable[0]: Local variable */
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];
37 return_label1
: while(false);
38 tracehead
= trace
.prev
;
41 val_t
range___Range___length(val_t self
) {
42 struct trace_t trace
= {NULL
, NULL
, 45, LOCATE_range___Range___length
};
44 struct WBT_
**closurevariable
= NULL
;
45 trace
.prev
= tracehead
; tracehead
= &trace
;
46 trace
.file
= LOCATE_range
;
47 /* Register variable[0]: Local variable */
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*/;
64 variable
[1] = TAG_Int(0);
67 return_label2
: while(false);
68 tracehead
= trace
.prev
;
71 val_t
range___Range___has(val_t self
, val_t param0
) {
72 struct trace_t trace
= {NULL
, NULL
, 30, LOCATE_range___Range___has
};
74 struct WBT_
**closurevariable
= NULL
;
75 trace
.prev
= tracehead
; tracehead
= &trace
;
76 trace
.file
= LOCATE_range
;
77 /* Register variable[0]: Local variable */
79 /* Register variable[1]: Local variable */
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::<=*/;
93 /* Register variable[3]: Result */
94 variable
[2] = variable
[3];
96 return_label3
: while(false);
97 tracehead
= trace
.prev
;
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
};
103 struct WBT_
**closurevariable
= NULL
;
104 trace
.prev
= tracehead
; tracehead
= &trace
;
105 trace
.file
= LOCATE_range
;
106 /* Register variable[0]: Local variable */
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::==*/)))));
122 /* Register variable[3]: Result */
123 variable
[2] = variable
[3];
125 return_label4
: while(false);
126 tracehead
= trace
.prev
;
129 val_t
range___Range___count(val_t self
, val_t param0
) {
130 struct trace_t trace
= {NULL
, NULL
, 34, LOCATE_range___Range___count
};
132 struct WBT_
**closurevariable
= NULL
;
133 trace
.prev
= tracehead
; tracehead
= &trace
;
134 trace
.file
= LOCATE_range
;
135 /* Register variable[0]: Local variable */
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);
146 variable
[2] = TAG_Int(0);
149 return_label5
: while(false);
150 tracehead
= trace
.prev
;
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*/;
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*/;
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*/;
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
};
183 struct WBT_
**closurevariable
= NULL
;
184 trace
.prev
= tracehead
; tracehead
= &trace
;
185 trace
.file
= LOCATE_range
;
186 /* Register variable[0]: Local variable */
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
;
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
};
207 struct WBT_
**closurevariable
= NULL
;
208 trace
.prev
= tracehead
; tracehead
= &trace
;
209 trace
.file
= LOCATE_range
;
210 /* Register variable[0]: Local variable */
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
;
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*/;
237 void range___IteratorRange___next(val_t self
) {
238 struct trace_t trace
= {NULL
, NULL
, 84, LOCATE_range___IteratorRange___next
};
240 struct WBT_
**closurevariable
= NULL
;
241 trace
.prev
= tracehead
; tracehead
= &trace
;
242 trace
.file
= LOCATE_range
;
243 /* Register variable[0]: Local variable */
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
;
255 val_t
range___IteratorRange___is_ok(val_t self
) {
256 struct trace_t trace
= {NULL
, NULL
, 82, LOCATE_range___IteratorRange___is_ok
};
258 struct WBT_
**closurevariable
= NULL
;
259 trace
.prev
= tracehead
; tracehead
= &trace
;
260 trace
.file
= LOCATE_range
;
261 /* Register variable[0]: Local variable */
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];
274 return_label9
: while(false);
275 tracehead
= trace
.prev
;
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
};
281 struct WBT_
**closurevariable
= NULL
;
282 trace
.prev
= tracehead
; tracehead
= &trace
;
283 trace
.file
= LOCATE_range
;
284 /* Register variable[0]: Local variable */
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
;