1 /* C file produced by GAC */
2 #include "compiled.h"
3 #define FILE_CRC "127577812"
4
5 /* global variables used in handlers */
6 static GVar G_PushOptions;
7 static Obj GF_PushOptions;
8 static GVar G_PopOptions;
9 static Obj GF_PopOptions;
10 static GVar G_Print;
11 static Obj GF_Print;
12 static GVar G_test__int__constants;
13 static Obj GF_test__int__constants;
14 static GVar G_test__func__calls;
15 static Obj GF_test__func__calls;
16 static GVar G_Display;
17 static Obj GF_Display;
18 static GVar G_test__cmp__ops;
19 static Obj GF_test__cmp__ops;
20 static GVar G_test__arith;
21 static Obj GF_test__arith;
22 static GVar G_test__tilde;
23 static Obj GF_test__tilde;
24 static GVar G_test__list__rec__exprs;
25 static Obj GF_test__list__rec__exprs;
26 static GVar G_myglobal;
27 static Obj GC_myglobal;
28 static GVar G_test__IsBound__Unbind;
29 static Obj GF_test__IsBound__Unbind;
30 static GVar G_test__loops;
31 static Obj GF_test__loops;
32 static GVar G_runtest;
33
34 /* record names used in handlers */
35 static RNam R_myopt;
36 static RNam R_x;
37 static RNam R_a;
38 static RNam R_b;
39 static RNam R_d;
40
41 /* information for the functions */
42 static Obj NameFunc[13];
43 static Obj FileName;
44
45 /* handler for function 2 */
HdlrFunc2(Obj self)46 static Obj HdlrFunc2 (
47 Obj self )
48 {
49 Obj l_x = 0;
50 Obj l_y = 0;
51 Obj t_1 = 0;
52 Obj t_2 = 0;
53 Obj t_3 = 0;
54 (void)l_x;
55 (void)l_y;
56 Bag oldFrame;
57
58 /* allocate new stack frame */
59 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
60
61 /* x := 10 ^ 5; */
62 t_1 = POW( INTOBJ_INT(10), INTOBJ_INT(5) );
63 l_x = t_1;
64
65 /* Print( x, "\n" ); */
66 t_1 = GF_Print;
67 t_2 = MakeString( "\n" );
68 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
69 CALL_2ARGS( t_1, l_x, t_2 );
70 }
71 else {
72 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_x, t_2 ) );
73 }
74
75 /* y := 100000; */
76 l_y = INTOBJ_INT(100000);
77
78 /* Print( y, "\n" ); */
79 t_1 = GF_Print;
80 t_2 = MakeString( "\n" );
81 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
82 CALL_2ARGS( t_1, l_y, t_2 );
83 }
84 else {
85 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_y, t_2 ) );
86 }
87
88 /* Print( x = y, "\n" ); */
89 t_1 = GF_Print;
90 t_2 = (EQ( l_x, l_y ) ? True : False);
91 t_3 = MakeString( "\n" );
92 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
93 CALL_2ARGS( t_1, t_2, t_3 );
94 }
95 else {
96 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
97 }
98
99 /* x := 10 ^ 10; */
100 t_1 = POW( INTOBJ_INT(10), INTOBJ_INT(10) );
101 l_x = t_1;
102
103 /* Print( x, "\n" ); */
104 t_1 = GF_Print;
105 t_2 = MakeString( "\n" );
106 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
107 CALL_2ARGS( t_1, l_x, t_2 );
108 }
109 else {
110 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_x, t_2 ) );
111 }
112
113 /* y := 10000000000; */
114 l_y = ObjInt_Int8(10000000000);
115
116 /* Print( y, "\n" ); */
117 t_1 = GF_Print;
118 t_2 = MakeString( "\n" );
119 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
120 CALL_2ARGS( t_1, l_y, t_2 );
121 }
122 else {
123 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_y, t_2 ) );
124 }
125
126 /* Print( x = y, "\n" ); */
127 t_1 = GF_Print;
128 t_2 = (EQ( l_x, l_y ) ? True : False);
129 t_3 = MakeString( "\n" );
130 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
131 CALL_2ARGS( t_1, t_2, t_3 );
132 }
133 else {
134 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
135 }
136
137 /* x := 10 ^ 20; */
138 t_1 = POW( INTOBJ_INT(10), INTOBJ_INT(20) );
139 l_x = t_1;
140
141 /* Print( x, "\n" ); */
142 t_1 = GF_Print;
143 t_2 = MakeString( "\n" );
144 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
145 CALL_2ARGS( t_1, l_x, t_2 );
146 }
147 else {
148 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_x, t_2 ) );
149 }
150
151 /* y := 100000000000000000000; */
152 t_1 = NewWordSizedBag(T_INTPOS, 16);
153 C_SET_LIMB8( t_1, 0, 7766279631452241920LL);
154 C_SET_LIMB8( t_1, 1, 5LL);
155 l_y = t_1;
156
157 /* Print( y, "\n" ); */
158 t_1 = GF_Print;
159 t_2 = MakeString( "\n" );
160 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
161 CALL_2ARGS( t_1, l_y, t_2 );
162 }
163 else {
164 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_y, t_2 ) );
165 }
166
167 /* Print( x = y, "\n" ); */
168 t_1 = GF_Print;
169 t_2 = (EQ( l_x, l_y ) ? True : False);
170 t_3 = MakeString( "\n" );
171 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
172 CALL_2ARGS( t_1, t_2, t_3 );
173 }
174 else {
175 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
176 }
177
178 /* return; */
179 SWITCH_TO_OLD_FRAME(oldFrame);
180 return 0;
181
182 /* return; */
183 SWITCH_TO_OLD_FRAME(oldFrame);
184 return 0;
185 }
186
187 /* handler for function 4 */
HdlrFunc4(Obj self,Obj a_args)188 static Obj HdlrFunc4 (
189 Obj self,
190 Obj a_args )
191 {
192 Obj t_1 = 0;
193 Bag oldFrame;
194
195 /* allocate new stack frame */
196 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
197
198 /* return Length( args ); */
199 C_LEN_LIST_FPL( t_1, a_args )
200 SWITCH_TO_OLD_FRAME(oldFrame);
201 return t_1;
202
203 /* return; */
204 SWITCH_TO_OLD_FRAME(oldFrame);
205 return 0;
206 }
207
208 /* handler for function 5 */
HdlrFunc5(Obj self,Obj a_args)209 static Obj HdlrFunc5 (
210 Obj self,
211 Obj a_args )
212 {
213 Obj t_1 = 0;
214 Obj t_2 = 0;
215 Bag oldFrame;
216
217 /* allocate new stack frame */
218 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
219
220 /* Display( Length( args ) ); */
221 t_1 = GF_Display;
222 C_LEN_LIST_FPL( t_2, a_args )
223 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
224 CALL_1ARGS( t_1, t_2 );
225 }
226 else {
227 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
228 }
229
230 /* return; */
231 SWITCH_TO_OLD_FRAME(oldFrame);
232 return 0;
233
234 /* return; */
235 SWITCH_TO_OLD_FRAME(oldFrame);
236 return 0;
237 }
238
239 /* handler for function 3 */
HdlrFunc3(Obj self)240 static Obj HdlrFunc3 (
241 Obj self )
242 {
243 Obj l_vararg__fun = 0;
244 Obj t_1 = 0;
245 Obj t_2 = 0;
246 Obj t_3 = 0;
247 Obj t_4 = 0;
248 (void)l_vararg__fun;
249 Bag oldFrame;
250
251 /* allocate new stack frame */
252 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
253
254 /* vararg_fun := function ( args... )
255 return Length( args );
256 end; */
257 t_1 = NewFunction( NameFunc[4], -1, ArgStringToList("args"), HdlrFunc4 );
258 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
259 t_2 = NewFunctionBody();
260 SET_STARTLINE_BODY(t_2, 40);
261 SET_ENDLINE_BODY(t_2, 42);
262 SET_FILENAME_BODY(t_2, FileName);
263 SET_BODY_FUNC(t_1, t_2);
264 l_vararg__fun = t_1;
265
266 /* Print( vararg_fun( ), "\n" ); */
267 t_1 = GF_Print;
268 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
269 t_2 = CALL_0ARGS( l_vararg__fun );
270 }
271 else {
272 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( ) );
273 }
274 CHECK_FUNC_RESULT( t_2 );
275 t_3 = MakeString( "\n" );
276 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
277 CALL_2ARGS( t_1, t_2, t_3 );
278 }
279 else {
280 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
281 }
282
283 /* Print( vararg_fun( 1 ), "\n" ); */
284 t_1 = GF_Print;
285 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
286 t_2 = CALL_1ARGS( l_vararg__fun, INTOBJ_INT(1) );
287 }
288 else {
289 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1) ) );
290 }
291 CHECK_FUNC_RESULT( t_2 );
292 t_3 = MakeString( "\n" );
293 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
294 CALL_2ARGS( t_1, t_2, t_3 );
295 }
296 else {
297 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
298 }
299
300 /* Print( vararg_fun( 1, 2 ), "\n" ); */
301 t_1 = GF_Print;
302 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
303 t_2 = CALL_2ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2) );
304 }
305 else {
306 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2) ) );
307 }
308 CHECK_FUNC_RESULT( t_2 );
309 t_3 = MakeString( "\n" );
310 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
311 CALL_2ARGS( t_1, t_2, t_3 );
312 }
313 else {
314 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
315 }
316
317 /* Print( vararg_fun( 1, 2, 3 ), "\n" ); */
318 t_1 = GF_Print;
319 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
320 t_2 = CALL_3ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3) );
321 }
322 else {
323 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3) ) );
324 }
325 CHECK_FUNC_RESULT( t_2 );
326 t_3 = MakeString( "\n" );
327 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
328 CALL_2ARGS( t_1, t_2, t_3 );
329 }
330 else {
331 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
332 }
333
334 /* Print( vararg_fun( 1, 2, 3, 4 ), "\n" ); */
335 t_1 = GF_Print;
336 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
337 t_2 = CALL_4ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4) );
338 }
339 else {
340 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4) ) );
341 }
342 CHECK_FUNC_RESULT( t_2 );
343 t_3 = MakeString( "\n" );
344 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
345 CALL_2ARGS( t_1, t_2, t_3 );
346 }
347 else {
348 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
349 }
350
351 /* Print( vararg_fun( 1, 2, 3, 4, 5 ), "\n" ); */
352 t_1 = GF_Print;
353 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
354 t_2 = CALL_5ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5) );
355 }
356 else {
357 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5) ) );
358 }
359 CHECK_FUNC_RESULT( t_2 );
360 t_3 = MakeString( "\n" );
361 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
362 CALL_2ARGS( t_1, t_2, t_3 );
363 }
364 else {
365 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
366 }
367
368 /* Print( vararg_fun( 1, 2, 3, 4, 5, 6 ), "\n" ); */
369 t_1 = GF_Print;
370 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
371 t_2 = CALL_6ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5), INTOBJ_INT(6) );
372 }
373 else {
374 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5), INTOBJ_INT(6) ) );
375 }
376 CHECK_FUNC_RESULT( t_2 );
377 t_3 = MakeString( "\n" );
378 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
379 CALL_2ARGS( t_1, t_2, t_3 );
380 }
381 else {
382 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
383 }
384
385 /* Print( vararg_fun( 1, 2, 3, 4, 5, 6, 7 ), "\n" ); */
386 t_1 = GF_Print;
387 t_3 = NEW_PLIST( T_PLIST, 7 );
388 SET_LEN_PLIST( t_3, 7 );
389 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(1) );
390 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(2) );
391 SET_ELM_PLIST( t_3, 3, INTOBJ_INT(3) );
392 SET_ELM_PLIST( t_3, 4, INTOBJ_INT(4) );
393 SET_ELM_PLIST( t_3, 5, INTOBJ_INT(5) );
394 SET_ELM_PLIST( t_3, 6, INTOBJ_INT(6) );
395 SET_ELM_PLIST( t_3, 7, INTOBJ_INT(7) );
396 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
397 t_2 = CALL_XARGS( l_vararg__fun, t_3 );
398 }
399 else {
400 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, t_3 );
401 }
402 CHECK_FUNC_RESULT( t_2 );
403 t_3 = MakeString( "\n" );
404 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
405 CALL_2ARGS( t_1, t_2, t_3 );
406 }
407 else {
408 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
409 }
410
411 /* Print( vararg_fun( "x", true, vararg_fun, 4, 5, 6, 7 ), "\n" ); */
412 t_1 = GF_Print;
413 t_3 = NEW_PLIST( T_PLIST, 7 );
414 SET_LEN_PLIST( t_3, 7 );
415 t_4 = MakeString( "x" );
416 SET_ELM_PLIST( t_3, 1, t_4 );
417 CHANGED_BAG( t_3 );
418 t_4 = True;
419 SET_ELM_PLIST( t_3, 2, t_4 );
420 CHANGED_BAG( t_3 );
421 SET_ELM_PLIST( t_3, 3, l_vararg__fun );
422 CHANGED_BAG( t_3 );
423 SET_ELM_PLIST( t_3, 4, INTOBJ_INT(4) );
424 SET_ELM_PLIST( t_3, 5, INTOBJ_INT(5) );
425 SET_ELM_PLIST( t_3, 6, INTOBJ_INT(6) );
426 SET_ELM_PLIST( t_3, 7, INTOBJ_INT(7) );
427 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
428 t_2 = CALL_XARGS( l_vararg__fun, t_3 );
429 }
430 else {
431 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, t_3 );
432 }
433 CHECK_FUNC_RESULT( t_2 );
434 t_3 = MakeString( "\n" );
435 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
436 CALL_2ARGS( t_1, t_2, t_3 );
437 }
438 else {
439 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
440 }
441
442 /* Print( vararg_fun( : myopt := true ), "\n" ); */
443 t_1 = GF_Print;
444 t_2 = NEW_PREC( 1 );
445 t_3 = (Obj)R_myopt;
446 t_4 = True;
447 AssPRec( t_2, (UInt)t_3, t_4 );
448 SortPRecRNam( t_2, 0 );
449 CALL_1ARGS( GF_PushOptions, t_2 );
450 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
451 t_2 = CALL_0ARGS( l_vararg__fun );
452 }
453 else {
454 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( ) );
455 }
456 CHECK_FUNC_RESULT( t_2 );
457 CALL_0ARGS( GF_PopOptions );
458 t_3 = MakeString( "\n" );
459 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
460 CALL_2ARGS( t_1, t_2, t_3 );
461 }
462 else {
463 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
464 }
465
466 /* Print( vararg_fun( : myopt := "value" ), "\n" ); */
467 t_1 = GF_Print;
468 t_2 = NEW_PREC( 1 );
469 t_3 = (Obj)R_myopt;
470 t_4 = MakeString( "value" );
471 AssPRec( t_2, (UInt)t_3, t_4 );
472 SortPRecRNam( t_2, 0 );
473 CALL_1ARGS( GF_PushOptions, t_2 );
474 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
475 t_2 = CALL_0ARGS( l_vararg__fun );
476 }
477 else {
478 t_2 = DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( ) );
479 }
480 CHECK_FUNC_RESULT( t_2 );
481 CALL_0ARGS( GF_PopOptions );
482 t_3 = MakeString( "\n" );
483 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
484 CALL_2ARGS( t_1, t_2, t_3 );
485 }
486 else {
487 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3 ) );
488 }
489
490 /* vararg_fun := function ( args... )
491 Display( Length( args ) );
492 return;
493 end; */
494 t_1 = NewFunction( NameFunc[5], -1, ArgStringToList("args"), HdlrFunc5 );
495 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
496 t_2 = NewFunctionBody();
497 SET_STARTLINE_BODY(t_2, 71);
498 SET_ENDLINE_BODY(t_2, 73);
499 SET_FILENAME_BODY(t_2, FileName);
500 SET_BODY_FUNC(t_1, t_2);
501 l_vararg__fun = t_1;
502
503 /* vararg_fun( ); */
504 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
505 CALL_0ARGS( l_vararg__fun );
506 }
507 else {
508 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( ) );
509 }
510
511 /* vararg_fun( 1 ); */
512 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
513 CALL_1ARGS( l_vararg__fun, INTOBJ_INT(1) );
514 }
515 else {
516 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1) ) );
517 }
518
519 /* vararg_fun( 1, 2 ); */
520 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
521 CALL_2ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2) );
522 }
523 else {
524 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2) ) );
525 }
526
527 /* vararg_fun( 1, 2, 3 ); */
528 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
529 CALL_3ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3) );
530 }
531 else {
532 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3) ) );
533 }
534
535 /* vararg_fun( 1, 2, 3, 4 ); */
536 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
537 CALL_4ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4) );
538 }
539 else {
540 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4) ) );
541 }
542
543 /* vararg_fun( 1, 2, 3, 4, 5 ); */
544 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
545 CALL_5ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5) );
546 }
547 else {
548 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5) ) );
549 }
550
551 /* vararg_fun( 1, 2, 3, 4, 5, 6 ); */
552 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
553 CALL_6ARGS( l_vararg__fun, INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5), INTOBJ_INT(6) );
554 }
555 else {
556 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( INTOBJ_INT(1), INTOBJ_INT(2), INTOBJ_INT(3), INTOBJ_INT(4), INTOBJ_INT(5), INTOBJ_INT(6) ) );
557 }
558
559 /* vararg_fun( 1, 2, 3, 4, 5, 6, 7 ); */
560 t_1 = NEW_PLIST( T_PLIST, 7 );
561 SET_LEN_PLIST( t_1, 7 );
562 SET_ELM_PLIST( t_1, 1, INTOBJ_INT(1) );
563 SET_ELM_PLIST( t_1, 2, INTOBJ_INT(2) );
564 SET_ELM_PLIST( t_1, 3, INTOBJ_INT(3) );
565 SET_ELM_PLIST( t_1, 4, INTOBJ_INT(4) );
566 SET_ELM_PLIST( t_1, 5, INTOBJ_INT(5) );
567 SET_ELM_PLIST( t_1, 6, INTOBJ_INT(6) );
568 SET_ELM_PLIST( t_1, 7, INTOBJ_INT(7) );
569 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
570 CALL_XARGS( l_vararg__fun, t_1 );
571 }
572 else {
573 DoOperation2Args( CallFuncListOper, l_vararg__fun, t_1 );
574 }
575
576 /* vararg_fun( "x", true, vararg_fun, 4, 5, 6, 7 ); */
577 t_1 = NEW_PLIST( T_PLIST, 7 );
578 SET_LEN_PLIST( t_1, 7 );
579 t_2 = MakeString( "x" );
580 SET_ELM_PLIST( t_1, 1, t_2 );
581 CHANGED_BAG( t_1 );
582 t_2 = True;
583 SET_ELM_PLIST( t_1, 2, t_2 );
584 CHANGED_BAG( t_1 );
585 SET_ELM_PLIST( t_1, 3, l_vararg__fun );
586 CHANGED_BAG( t_1 );
587 SET_ELM_PLIST( t_1, 4, INTOBJ_INT(4) );
588 SET_ELM_PLIST( t_1, 5, INTOBJ_INT(5) );
589 SET_ELM_PLIST( t_1, 6, INTOBJ_INT(6) );
590 SET_ELM_PLIST( t_1, 7, INTOBJ_INT(7) );
591 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
592 CALL_XARGS( l_vararg__fun, t_1 );
593 }
594 else {
595 DoOperation2Args( CallFuncListOper, l_vararg__fun, t_1 );
596 }
597 t_1 = NEW_PREC( 1 );
598 t_2 = (Obj)R_myopt;
599 t_3 = True;
600 AssPRec( t_1, (UInt)t_2, t_3 );
601 SortPRecRNam( t_1, 0 );
602 CALL_1ARGS( GF_PushOptions, t_1 );
603
604 /* vararg_fun( ); */
605 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
606 CALL_0ARGS( l_vararg__fun );
607 }
608 else {
609 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( ) );
610 }
611 CALL_0ARGS( GF_PopOptions );
612 t_1 = NEW_PREC( 1 );
613 t_2 = (Obj)R_myopt;
614 t_3 = MakeString( "value" );
615 AssPRec( t_1, (UInt)t_2, t_3 );
616 SortPRecRNam( t_1, 0 );
617 CALL_1ARGS( GF_PushOptions, t_1 );
618
619 /* vararg_fun( ); */
620 if ( TNUM_OBJ( l_vararg__fun ) == T_FUNCTION ) {
621 CALL_0ARGS( l_vararg__fun );
622 }
623 else {
624 DoOperation2Args( CallFuncListOper, l_vararg__fun, NewPlistFromArgs( ) );
625 }
626 CALL_0ARGS( GF_PopOptions );
627
628 /* return; */
629 SWITCH_TO_OLD_FRAME(oldFrame);
630 return 0;
631
632 /* return; */
633 SWITCH_TO_OLD_FRAME(oldFrame);
634 return 0;
635 }
636
637 /* handler for function 6 */
HdlrFunc6(Obj self)638 static Obj HdlrFunc6 (
639 Obj self )
640 {
641 Obj l_x = 0;
642 Obj t_1 = 0;
643 Obj t_2 = 0;
644 Obj t_3 = 0;
645 Obj t_4 = 0;
646 (void)l_x;
647 Bag oldFrame;
648
649 /* allocate new stack frame */
650 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
651
652 /* Print( "setting x to 2 ...\n" ); */
653 t_1 = GF_Print;
654 t_2 = MakeString( "setting x to 2 ...\n" );
655 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
656 CALL_1ARGS( t_1, t_2 );
657 }
658 else {
659 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
660 }
661
662 /* x := 2; */
663 l_x = INTOBJ_INT(2);
664
665 /* Print( "1 = 2 is ", 1 = 2, "\n" ); */
666 t_1 = GF_Print;
667 t_2 = MakeString( "1 = 2 is " );
668 t_3 = ((((Int)INTOBJ_INT(1)) == ((Int)INTOBJ_INT(2))) ? True : False);
669 t_4 = MakeString( "\n" );
670 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
671 CALL_3ARGS( t_1, t_2, t_3, t_4 );
672 }
673 else {
674 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
675 }
676
677 /* Print( "1 = x is ", 1 = x, "\n" ); */
678 t_1 = GF_Print;
679 t_2 = MakeString( "1 = x is " );
680 t_3 = ((((Int)INTOBJ_INT(1)) == ((Int)l_x)) ? True : False);
681 t_4 = MakeString( "\n" );
682 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
683 CALL_3ARGS( t_1, t_2, t_3, t_4 );
684 }
685 else {
686 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
687 }
688
689 /* Print( "1 = 2 via if is " ); */
690 t_1 = GF_Print;
691 t_2 = MakeString( "1 = 2 via if is " );
692 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
693 CALL_1ARGS( t_1, t_2 );
694 }
695 else {
696 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
697 }
698
699 /* if 1 = 2 then */
700 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) == ((Int)INTOBJ_INT(2)));
701 if ( t_1 ) {
702
703 /* Print( "true\n" ); */
704 t_1 = GF_Print;
705 t_2 = MakeString( "true\n" );
706 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
707 CALL_1ARGS( t_1, t_2 );
708 }
709 else {
710 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
711 }
712
713 }
714
715 /* else */
716 else {
717
718 /* Print( "false\n" ); */
719 t_1 = GF_Print;
720 t_2 = MakeString( "false\n" );
721 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
722 CALL_1ARGS( t_1, t_2 );
723 }
724 else {
725 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
726 }
727
728 }
729 /* fi */
730
731 /* Print( "1 = x via if is " ); */
732 t_1 = GF_Print;
733 t_2 = MakeString( "1 = x via if is " );
734 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
735 CALL_1ARGS( t_1, t_2 );
736 }
737 else {
738 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
739 }
740
741 /* if 1 = x then */
742 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) == ((Int)l_x));
743 if ( t_1 ) {
744
745 /* Print( "true\n" ); */
746 t_1 = GF_Print;
747 t_2 = MakeString( "true\n" );
748 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
749 CALL_1ARGS( t_1, t_2 );
750 }
751 else {
752 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
753 }
754
755 }
756
757 /* else */
758 else {
759
760 /* Print( "false\n" ); */
761 t_1 = GF_Print;
762 t_2 = MakeString( "false\n" );
763 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
764 CALL_1ARGS( t_1, t_2 );
765 }
766 else {
767 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
768 }
769
770 }
771 /* fi */
772
773 /* Print( "1 <> 2 is ", 1 <> 2, "\n" ); */
774 t_1 = GF_Print;
775 t_2 = MakeString( "1 <> 2 is " );
776 t_3 = ((((Int)INTOBJ_INT(1)) == ((Int)INTOBJ_INT(2))) ? False : True);
777 t_4 = MakeString( "\n" );
778 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
779 CALL_3ARGS( t_1, t_2, t_3, t_4 );
780 }
781 else {
782 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
783 }
784
785 /* Print( "1 <> x is ", 1 <> x, "\n" ); */
786 t_1 = GF_Print;
787 t_2 = MakeString( "1 <> x is " );
788 t_3 = ((((Int)INTOBJ_INT(1)) == ((Int)l_x)) ? False : True);
789 t_4 = MakeString( "\n" );
790 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
791 CALL_3ARGS( t_1, t_2, t_3, t_4 );
792 }
793 else {
794 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
795 }
796
797 /* Print( "1 <> 2 via if is " ); */
798 t_1 = GF_Print;
799 t_2 = MakeString( "1 <> 2 via if is " );
800 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
801 CALL_1ARGS( t_1, t_2 );
802 }
803 else {
804 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
805 }
806
807 /* if 1 <> 2 then */
808 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) != ((Int)INTOBJ_INT(2)));
809 if ( t_1 ) {
810
811 /* Print( "true\n" ); */
812 t_1 = GF_Print;
813 t_2 = MakeString( "true\n" );
814 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
815 CALL_1ARGS( t_1, t_2 );
816 }
817 else {
818 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
819 }
820
821 }
822
823 /* else */
824 else {
825
826 /* Print( "false\n" ); */
827 t_1 = GF_Print;
828 t_2 = MakeString( "false\n" );
829 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
830 CALL_1ARGS( t_1, t_2 );
831 }
832 else {
833 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
834 }
835
836 }
837 /* fi */
838
839 /* Print( "1 <> x via if is " ); */
840 t_1 = GF_Print;
841 t_2 = MakeString( "1 <> x via if is " );
842 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
843 CALL_1ARGS( t_1, t_2 );
844 }
845 else {
846 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
847 }
848
849 /* if 1 <> x then */
850 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) != ((Int)l_x));
851 if ( t_1 ) {
852
853 /* Print( "true\n" ); */
854 t_1 = GF_Print;
855 t_2 = MakeString( "true\n" );
856 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
857 CALL_1ARGS( t_1, t_2 );
858 }
859 else {
860 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
861 }
862
863 }
864
865 /* else */
866 else {
867
868 /* Print( "false\n" ); */
869 t_1 = GF_Print;
870 t_2 = MakeString( "false\n" );
871 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
872 CALL_1ARGS( t_1, t_2 );
873 }
874 else {
875 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
876 }
877
878 }
879 /* fi */
880
881 /* Print( "1 < 2 is ", 1 < 2, "\n" ); */
882 t_1 = GF_Print;
883 t_2 = MakeString( "1 < 2 is " );
884 t_3 = ((((Int)INTOBJ_INT(1)) < ((Int)INTOBJ_INT(2))) ? True : False);
885 t_4 = MakeString( "\n" );
886 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
887 CALL_3ARGS( t_1, t_2, t_3, t_4 );
888 }
889 else {
890 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
891 }
892
893 /* Print( "1 < x is ", 1 < x, "\n" ); */
894 t_1 = GF_Print;
895 t_2 = MakeString( "1 < x is " );
896 t_3 = ((((Int)INTOBJ_INT(1)) < ((Int)l_x)) ? True : False);
897 t_4 = MakeString( "\n" );
898 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
899 CALL_3ARGS( t_1, t_2, t_3, t_4 );
900 }
901 else {
902 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
903 }
904
905 /* Print( "1 < 2 via if is " ); */
906 t_1 = GF_Print;
907 t_2 = MakeString( "1 < 2 via if is " );
908 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
909 CALL_1ARGS( t_1, t_2 );
910 }
911 else {
912 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
913 }
914
915 /* if 1 < 2 then */
916 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) < ((Int)INTOBJ_INT(2)));
917 if ( t_1 ) {
918
919 /* Print( "true\n" ); */
920 t_1 = GF_Print;
921 t_2 = MakeString( "true\n" );
922 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
923 CALL_1ARGS( t_1, t_2 );
924 }
925 else {
926 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
927 }
928
929 }
930
931 /* else */
932 else {
933
934 /* Print( "false\n" ); */
935 t_1 = GF_Print;
936 t_2 = MakeString( "false\n" );
937 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
938 CALL_1ARGS( t_1, t_2 );
939 }
940 else {
941 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
942 }
943
944 }
945 /* fi */
946
947 /* Print( "1 < x via if is " ); */
948 t_1 = GF_Print;
949 t_2 = MakeString( "1 < x via if is " );
950 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
951 CALL_1ARGS( t_1, t_2 );
952 }
953 else {
954 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
955 }
956
957 /* if 1 < x then */
958 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) < ((Int)l_x));
959 if ( t_1 ) {
960
961 /* Print( "true\n" ); */
962 t_1 = GF_Print;
963 t_2 = MakeString( "true\n" );
964 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
965 CALL_1ARGS( t_1, t_2 );
966 }
967 else {
968 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
969 }
970
971 }
972
973 /* else */
974 else {
975
976 /* Print( "false\n" ); */
977 t_1 = GF_Print;
978 t_2 = MakeString( "false\n" );
979 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
980 CALL_1ARGS( t_1, t_2 );
981 }
982 else {
983 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
984 }
985
986 }
987 /* fi */
988
989 /* Print( "1 <= 2 is ", 1 <= 2, "\n" ); */
990 t_1 = GF_Print;
991 t_2 = MakeString( "1 <= 2 is " );
992 t_3 = ((((Int)INTOBJ_INT(2)) < ((Int)INTOBJ_INT(1))) ? False : True);
993 t_4 = MakeString( "\n" );
994 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
995 CALL_3ARGS( t_1, t_2, t_3, t_4 );
996 }
997 else {
998 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
999 }
1000
1001 /* Print( "1 <= x is ", 1 <= x, "\n" ); */
1002 t_1 = GF_Print;
1003 t_2 = MakeString( "1 <= x is " );
1004 t_3 = ((((Int)l_x) < ((Int)INTOBJ_INT(1))) ? False : True);
1005 t_4 = MakeString( "\n" );
1006 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1007 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1008 }
1009 else {
1010 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1011 }
1012
1013 /* Print( "1 <= 2 via if is " ); */
1014 t_1 = GF_Print;
1015 t_2 = MakeString( "1 <= 2 via if is " );
1016 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1017 CALL_1ARGS( t_1, t_2 );
1018 }
1019 else {
1020 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1021 }
1022
1023 /* if 1 <= 2 then */
1024 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(2)) >= ((Int)INTOBJ_INT(1)));
1025 if ( t_1 ) {
1026
1027 /* Print( "true\n" ); */
1028 t_1 = GF_Print;
1029 t_2 = MakeString( "true\n" );
1030 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1031 CALL_1ARGS( t_1, t_2 );
1032 }
1033 else {
1034 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1035 }
1036
1037 }
1038
1039 /* else */
1040 else {
1041
1042 /* Print( "false\n" ); */
1043 t_1 = GF_Print;
1044 t_2 = MakeString( "false\n" );
1045 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1046 CALL_1ARGS( t_1, t_2 );
1047 }
1048 else {
1049 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1050 }
1051
1052 }
1053 /* fi */
1054
1055 /* Print( "1 <= x via if is " ); */
1056 t_1 = GF_Print;
1057 t_2 = MakeString( "1 <= x via if is " );
1058 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1059 CALL_1ARGS( t_1, t_2 );
1060 }
1061 else {
1062 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1063 }
1064
1065 /* if 1 <= x then */
1066 t_1 = (Obj)(UInt)(((Int)l_x) >= ((Int)INTOBJ_INT(1)));
1067 if ( t_1 ) {
1068
1069 /* Print( "true\n" ); */
1070 t_1 = GF_Print;
1071 t_2 = MakeString( "true\n" );
1072 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1073 CALL_1ARGS( t_1, t_2 );
1074 }
1075 else {
1076 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1077 }
1078
1079 }
1080
1081 /* else */
1082 else {
1083
1084 /* Print( "false\n" ); */
1085 t_1 = GF_Print;
1086 t_2 = MakeString( "false\n" );
1087 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1088 CALL_1ARGS( t_1, t_2 );
1089 }
1090 else {
1091 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1092 }
1093
1094 }
1095 /* fi */
1096
1097 /* Print( "1 > 2 is ", 1 > 2, "\n" ); */
1098 t_1 = GF_Print;
1099 t_2 = MakeString( "1 > 2 is " );
1100 t_3 = ((((Int)INTOBJ_INT(2)) < ((Int)INTOBJ_INT(1))) ? True : False);
1101 t_4 = MakeString( "\n" );
1102 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1103 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1104 }
1105 else {
1106 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1107 }
1108
1109 /* Print( "1 > x is ", 1 > x, "\n" ); */
1110 t_1 = GF_Print;
1111 t_2 = MakeString( "1 > x is " );
1112 t_3 = ((((Int)l_x) < ((Int)INTOBJ_INT(1))) ? True : False);
1113 t_4 = MakeString( "\n" );
1114 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1115 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1116 }
1117 else {
1118 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1119 }
1120
1121 /* Print( "1 > 2 via if is " ); */
1122 t_1 = GF_Print;
1123 t_2 = MakeString( "1 > 2 via if is " );
1124 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1125 CALL_1ARGS( t_1, t_2 );
1126 }
1127 else {
1128 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1129 }
1130
1131 /* if 1 > 2 then */
1132 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(2)) < ((Int)INTOBJ_INT(1)));
1133 if ( t_1 ) {
1134
1135 /* Print( "true\n" ); */
1136 t_1 = GF_Print;
1137 t_2 = MakeString( "true\n" );
1138 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1139 CALL_1ARGS( t_1, t_2 );
1140 }
1141 else {
1142 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1143 }
1144
1145 }
1146
1147 /* else */
1148 else {
1149
1150 /* Print( "false\n" ); */
1151 t_1 = GF_Print;
1152 t_2 = MakeString( "false\n" );
1153 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1154 CALL_1ARGS( t_1, t_2 );
1155 }
1156 else {
1157 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1158 }
1159
1160 }
1161 /* fi */
1162
1163 /* Print( "1 > x via if is " ); */
1164 t_1 = GF_Print;
1165 t_2 = MakeString( "1 > x via if is " );
1166 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1167 CALL_1ARGS( t_1, t_2 );
1168 }
1169 else {
1170 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1171 }
1172
1173 /* if 1 > x then */
1174 t_1 = (Obj)(UInt)(((Int)l_x) < ((Int)INTOBJ_INT(1)));
1175 if ( t_1 ) {
1176
1177 /* Print( "true\n" ); */
1178 t_1 = GF_Print;
1179 t_2 = MakeString( "true\n" );
1180 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1181 CALL_1ARGS( t_1, t_2 );
1182 }
1183 else {
1184 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1185 }
1186
1187 }
1188
1189 /* else */
1190 else {
1191
1192 /* Print( "false\n" ); */
1193 t_1 = GF_Print;
1194 t_2 = MakeString( "false\n" );
1195 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1196 CALL_1ARGS( t_1, t_2 );
1197 }
1198 else {
1199 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1200 }
1201
1202 }
1203 /* fi */
1204
1205 /* Print( "1 >= 2 is ", 1 >= 2, "\n" ); */
1206 t_1 = GF_Print;
1207 t_2 = MakeString( "1 >= 2 is " );
1208 t_3 = ((((Int)INTOBJ_INT(1)) < ((Int)INTOBJ_INT(2))) ? False : True);
1209 t_4 = MakeString( "\n" );
1210 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1211 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1212 }
1213 else {
1214 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1215 }
1216
1217 /* Print( "1 >= x is ", 1 >= x, "\n" ); */
1218 t_1 = GF_Print;
1219 t_2 = MakeString( "1 >= x is " );
1220 t_3 = ((((Int)INTOBJ_INT(1)) < ((Int)l_x)) ? False : True);
1221 t_4 = MakeString( "\n" );
1222 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1223 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1224 }
1225 else {
1226 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1227 }
1228
1229 /* Print( "1 >= 2 via if is " ); */
1230 t_1 = GF_Print;
1231 t_2 = MakeString( "1 >= 2 via if is " );
1232 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1233 CALL_1ARGS( t_1, t_2 );
1234 }
1235 else {
1236 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1237 }
1238
1239 /* if 1 >= 2 then */
1240 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) >= ((Int)INTOBJ_INT(2)));
1241 if ( t_1 ) {
1242
1243 /* Print( "true\n" ); */
1244 t_1 = GF_Print;
1245 t_2 = MakeString( "true\n" );
1246 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1247 CALL_1ARGS( t_1, t_2 );
1248 }
1249 else {
1250 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1251 }
1252
1253 }
1254
1255 /* else */
1256 else {
1257
1258 /* Print( "false\n" ); */
1259 t_1 = GF_Print;
1260 t_2 = MakeString( "false\n" );
1261 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1262 CALL_1ARGS( t_1, t_2 );
1263 }
1264 else {
1265 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1266 }
1267
1268 }
1269 /* fi */
1270
1271 /* Print( "1 >= x via if is " ); */
1272 t_1 = GF_Print;
1273 t_2 = MakeString( "1 >= x via if is " );
1274 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1275 CALL_1ARGS( t_1, t_2 );
1276 }
1277 else {
1278 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1279 }
1280
1281 /* if 1 >= x then */
1282 t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(1)) >= ((Int)l_x));
1283 if ( t_1 ) {
1284
1285 /* Print( "true\n" ); */
1286 t_1 = GF_Print;
1287 t_2 = MakeString( "true\n" );
1288 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1289 CALL_1ARGS( t_1, t_2 );
1290 }
1291 else {
1292 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1293 }
1294
1295 }
1296
1297 /* else */
1298 else {
1299
1300 /* Print( "false\n" ); */
1301 t_1 = GF_Print;
1302 t_2 = MakeString( "false\n" );
1303 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1304 CALL_1ARGS( t_1, t_2 );
1305 }
1306 else {
1307 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1308 }
1309
1310 }
1311 /* fi */
1312
1313 /* return; */
1314 SWITCH_TO_OLD_FRAME(oldFrame);
1315 return 0;
1316
1317 /* return; */
1318 SWITCH_TO_OLD_FRAME(oldFrame);
1319 return 0;
1320 }
1321
1322 /* handler for function 7 */
HdlrFunc7(Obj self)1323 static Obj HdlrFunc7 (
1324 Obj self )
1325 {
1326 Obj l_x = 0;
1327 Obj t_1 = 0;
1328 (void)l_x;
1329 Bag oldFrame;
1330
1331 /* allocate new stack frame */
1332 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
1333
1334 /* x := 5; */
1335 l_x = INTOBJ_INT(5);
1336
1337 /* x := - x; */
1338 C_AINV_INTOBJS( t_1, l_x )
1339 l_x = t_1;
1340
1341 /* x := 1 / 2; */
1342 t_1 = QUO( INTOBJ_INT(1), INTOBJ_INT(2) );
1343 l_x = t_1;
1344
1345 /* x := - x; */
1346 C_AINV_FIA( t_1, l_x )
1347 l_x = t_1;
1348
1349 /* return; */
1350 SWITCH_TO_OLD_FRAME(oldFrame);
1351 return 0;
1352
1353 /* return; */
1354 SWITCH_TO_OLD_FRAME(oldFrame);
1355 return 0;
1356 }
1357
1358 /* handler for function 8 */
HdlrFunc8(Obj self)1359 static Obj HdlrFunc8 (
1360 Obj self )
1361 {
1362 Obj l_x = 0;
1363 (void)l_x;
1364 Bag oldFrame;
1365
1366 /* allocate new stack frame */
1367 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
1368
1369 /* return; */
1370 SWITCH_TO_OLD_FRAME(oldFrame);
1371 return 0;
1372
1373 /* return; */
1374 SWITCH_TO_OLD_FRAME(oldFrame);
1375 return 0;
1376 }
1377
1378 /* handler for function 9 */
HdlrFunc9(Obj self)1379 static Obj HdlrFunc9 (
1380 Obj self )
1381 {
1382 Obj l_l = 0;
1383 Obj l_x = 0;
1384 Obj t_1 = 0;
1385 Obj t_2 = 0;
1386 Obj t_3 = 0;
1387 Obj t_4 = 0;
1388 Obj t_5 = 0;
1389 Obj t_6 = 0;
1390 (void)l_l;
1391 (void)l_x;
1392 Bag oldFrame;
1393
1394 /* allocate new stack frame */
1395 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
1396
1397 /* Display( [ ] ); */
1398 t_1 = GF_Display;
1399 t_2 = NEW_PLIST( T_PLIST, 0 );
1400 SET_LEN_PLIST( t_2, 0 );
1401 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1402 CALL_1ARGS( t_1, t_2 );
1403 }
1404 else {
1405 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1406 }
1407
1408 /* Display( [ 1, 2, 3 ] ); */
1409 t_1 = GF_Display;
1410 t_2 = NEW_PLIST( T_PLIST, 3 );
1411 SET_LEN_PLIST( t_2, 3 );
1412 SET_ELM_PLIST( t_2, 1, INTOBJ_INT(1) );
1413 SET_ELM_PLIST( t_2, 2, INTOBJ_INT(2) );
1414 SET_ELM_PLIST( t_2, 3, INTOBJ_INT(3) );
1415 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1416 CALL_1ARGS( t_1, t_2 );
1417 }
1418 else {
1419 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1420 }
1421
1422 /* Display( [ 1,, 3, [ 4, 5 ], rec(
1423 x := [ 6, rec(
1424 ) ] ) ] ); */
1425 t_1 = GF_Display;
1426 t_2 = NEW_PLIST( T_PLIST, 5 );
1427 SET_LEN_PLIST( t_2, 5 );
1428 SET_ELM_PLIST( t_2, 1, INTOBJ_INT(1) );
1429 SET_ELM_PLIST( t_2, 3, INTOBJ_INT(3) );
1430 t_3 = NEW_PLIST( T_PLIST, 2 );
1431 SET_LEN_PLIST( t_3, 2 );
1432 SET_ELM_PLIST( t_2, 4, t_3 );
1433 CHANGED_BAG( t_2 );
1434 SET_ELM_PLIST( t_3, 1, INTOBJ_INT(4) );
1435 SET_ELM_PLIST( t_3, 2, INTOBJ_INT(5) );
1436 t_3 = NEW_PREC( 1 );
1437 SET_ELM_PLIST( t_2, 5, t_3 );
1438 CHANGED_BAG( t_2 );
1439 t_4 = (Obj)R_x;
1440 t_5 = NEW_PLIST( T_PLIST, 2 );
1441 SET_LEN_PLIST( t_5, 2 );
1442 AssPRec( t_3, (UInt)t_4, t_5 );
1443 SET_ELM_PLIST( t_5, 1, INTOBJ_INT(6) );
1444 t_6 = NEW_PREC( 0 );
1445 SET_ELM_PLIST( t_5, 2, t_6 );
1446 CHANGED_BAG( t_5 );
1447 SortPRecRNam( t_6, 0 );
1448 SortPRecRNam( t_3, 0 );
1449 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1450 CALL_1ARGS( t_1, t_2 );
1451 }
1452 else {
1453 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1454 }
1455
1456 /* l := [ ]; */
1457 t_1 = NEW_PLIST( T_PLIST, 0 );
1458 SET_LEN_PLIST( t_1, 0 );
1459 l_l = t_1;
1460
1461 /* l[1] := 1; */
1462 C_ASS_LIST_FPL_INTOBJ( l_l, INTOBJ_INT(1), INTOBJ_INT(1) )
1463
1464 /* l[1 + 1] := 2; */
1465 C_SUM_INTOBJS( t_1, INTOBJ_INT(1), INTOBJ_INT(1) )
1466 CHECK_INT_POS( t_1 );
1467 C_ASS_LIST_FPL_INTOBJ( l_l, t_1, INTOBJ_INT(2) )
1468
1469 /* l![3] := 3; */
1470 AssPosObj( l_l, 3, INTOBJ_INT(3) );
1471
1472 /* l![2 + 2] := 4; */
1473 C_SUM_INTOBJS( t_1, INTOBJ_INT(2), INTOBJ_INT(2) )
1474 CHECK_INT_SMALL_POS( t_1 );
1475 AssPosObj( l_l, INT_INTOBJ(t_1), INTOBJ_INT(4) );
1476
1477 /* Display( l ); */
1478 t_1 = GF_Display;
1479 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1480 CALL_1ARGS( t_1, l_l );
1481 }
1482 else {
1483 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_l ) );
1484 }
1485
1486 /* Print( "l[1] = ", l[1], "\n" ); */
1487 t_1 = GF_Print;
1488 t_2 = MakeString( "l[1] = " );
1489 C_ELM_LIST_FPL( t_3, l_l, INTOBJ_INT(1) )
1490 t_4 = MakeString( "\n" );
1491 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1492 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1493 }
1494 else {
1495 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1496 }
1497
1498 /* Print( "l[2] = ", l[1 + 1], "\n" ); */
1499 t_1 = GF_Print;
1500 t_2 = MakeString( "l[2] = " );
1501 C_SUM_INTOBJS( t_4, INTOBJ_INT(1), INTOBJ_INT(1) )
1502 CHECK_INT_POS( t_4 );
1503 C_ELM_LIST_FPL( t_3, l_l, t_4 )
1504 t_4 = MakeString( "\n" );
1505 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1506 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1507 }
1508 else {
1509 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1510 }
1511
1512 /* Print( "l[3] = ", l![3], "\n" ); */
1513 t_1 = GF_Print;
1514 t_2 = MakeString( "l[3] = " );
1515 t_3 = ElmPosObj( l_l, 3 );
1516 t_4 = MakeString( "\n" );
1517 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1518 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1519 }
1520 else {
1521 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1522 }
1523
1524 /* Print( "l[4] = ", l![2 + 2], "\n" ); */
1525 t_1 = GF_Print;
1526 t_2 = MakeString( "l[4] = " );
1527 C_SUM_INTOBJS( t_4, INTOBJ_INT(2), INTOBJ_INT(2) )
1528 CHECK_INT_SMALL_POS( t_4 );
1529 t_3 = ElmPosObj( l_l, INT_INTOBJ(t_4) );
1530 t_4 = MakeString( "\n" );
1531 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1532 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1533 }
1534 else {
1535 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1536 }
1537
1538 /* x := rec(
1539 a := 1 ); */
1540 t_1 = NEW_PREC( 1 );
1541 t_2 = (Obj)R_a;
1542 AssPRec( t_1, (UInt)t_2, INTOBJ_INT(1) );
1543 SortPRecRNam( t_1, 0 );
1544 l_x = t_1;
1545
1546 /* x.b := 2; */
1547 ASS_REC( l_x, R_b, INTOBJ_INT(2) );
1548
1549 /* x.("c") := x.a + x.("b"); */
1550 t_1 = MakeString( "c" );
1551 t_3 = ELM_REC( l_x, R_a );
1552 t_5 = MakeString( "b" );
1553 t_4 = ELM_REC( l_x, RNamObj(t_5) );
1554 C_SUM_FIA( t_2, t_3, t_4 )
1555 ASS_REC( l_x, RNamObj(t_1), t_2 );
1556
1557 /* x!.d := 42; */
1558 AssComObj( l_x, R_d, INTOBJ_INT(42) );
1559
1560 /* x!.("e") := 23; */
1561 t_1 = MakeString( "e" );
1562 AssComObj( l_x, RNamObj(t_1), INTOBJ_INT(23) );
1563
1564 /* Display( x ); */
1565 t_1 = GF_Display;
1566 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1567 CALL_1ARGS( t_1, l_x );
1568 }
1569 else {
1570 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_x ) );
1571 }
1572
1573 /* Print( "x.a = ", x.a, "\n" ); */
1574 t_1 = GF_Print;
1575 t_2 = MakeString( "x.a = " );
1576 t_3 = ELM_REC( l_x, R_a );
1577 t_4 = MakeString( "\n" );
1578 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1579 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1580 }
1581 else {
1582 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1583 }
1584
1585 /* Print( "x.b = ", x.("b"), "\n" ); */
1586 t_1 = GF_Print;
1587 t_2 = MakeString( "x.b = " );
1588 t_4 = MakeString( "b" );
1589 t_3 = ELM_REC( l_x, RNamObj(t_4) );
1590 t_4 = MakeString( "\n" );
1591 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1592 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1593 }
1594 else {
1595 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1596 }
1597
1598 /* Print( "x.d = ", x!.d, "\n" ); */
1599 t_1 = GF_Print;
1600 t_2 = MakeString( "x.d = " );
1601 t_3 = ElmComObj( l_x, R_d );
1602 t_4 = MakeString( "\n" );
1603 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1604 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1605 }
1606 else {
1607 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1608 }
1609
1610 /* Print( "x.e = ", x!.("e"), "\n" ); */
1611 t_1 = GF_Print;
1612 t_2 = MakeString( "x.e = " );
1613 t_4 = MakeString( "e" );
1614 t_3 = ElmComObj( l_x, RNamObj(t_4) );
1615 t_4 = MakeString( "\n" );
1616 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1617 CALL_3ARGS( t_1, t_2, t_3, t_4 );
1618 }
1619 else {
1620 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2, t_3, t_4 ) );
1621 }
1622
1623 /* return; */
1624 SWITCH_TO_OLD_FRAME(oldFrame);
1625 return 0;
1626
1627 /* return; */
1628 SWITCH_TO_OLD_FRAME(oldFrame);
1629 return 0;
1630 }
1631
1632 /* handler for function 10 */
HdlrFunc10(Obj self)1633 static Obj HdlrFunc10 (
1634 Obj self )
1635 {
1636 Obj l_x = 0;
1637 Obj t_1 = 0;
1638 Obj t_2 = 0;
1639 Obj t_3 = 0;
1640 (void)l_x;
1641 Bag oldFrame;
1642
1643 /* allocate new stack frame */
1644 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
1645
1646 /* Print( "Testing IsBound and Unbind for lvar\n" ); */
1647 t_1 = GF_Print;
1648 t_2 = MakeString( "Testing IsBound and Unbind for lvar\n" );
1649 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1650 CALL_1ARGS( t_1, t_2 );
1651 }
1652 else {
1653 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1654 }
1655
1656 /* x := 42; */
1657 l_x = INTOBJ_INT(42);
1658
1659 /* Display( IsBound( x ) ); */
1660 t_1 = GF_Display;
1661 t_2 = ((l_x != 0) ? True : False);
1662 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1663 CALL_1ARGS( t_1, t_2 );
1664 }
1665 else {
1666 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1667 }
1668
1669 /* Unbind( x ); */
1670 l_x = 0;
1671
1672 /* Display( IsBound( x ) ); */
1673 t_1 = GF_Display;
1674 t_2 = ((l_x != 0) ? True : False);
1675 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1676 CALL_1ARGS( t_1, t_2 );
1677 }
1678 else {
1679 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1680 }
1681
1682 /* Print( "Testing IsBound and Unbind for gvar\n" ); */
1683 t_1 = GF_Print;
1684 t_2 = MakeString( "Testing IsBound and Unbind for gvar\n" );
1685 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1686 CALL_1ARGS( t_1, t_2 );
1687 }
1688 else {
1689 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1690 }
1691
1692 /* myglobal := 42; */
1693 AssGVar( G_myglobal, INTOBJ_INT(42) );
1694
1695 /* Display( IsBound( myglobal ) ); */
1696 t_1 = GF_Display;
1697 t_3 = GC_myglobal;
1698 t_2 = ((t_3 != 0) ? True : False);
1699 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1700 CALL_1ARGS( t_1, t_2 );
1701 }
1702 else {
1703 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1704 }
1705
1706 /* Unbind( myglobal ); */
1707 AssGVar( G_myglobal, 0 );
1708
1709 /* Display( IsBound( myglobal ) ); */
1710 t_1 = GF_Display;
1711 t_3 = GC_myglobal;
1712 t_2 = ((t_3 != 0) ? True : False);
1713 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1714 CALL_1ARGS( t_1, t_2 );
1715 }
1716 else {
1717 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1718 }
1719
1720 /* Print( "Testing IsBound and Unbind for list\n" ); */
1721 t_1 = GF_Print;
1722 t_2 = MakeString( "Testing IsBound and Unbind for list\n" );
1723 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1724 CALL_1ARGS( t_1, t_2 );
1725 }
1726 else {
1727 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1728 }
1729
1730 /* x := [ 1, 2, 3 ]; */
1731 t_1 = NEW_PLIST( T_PLIST, 3 );
1732 SET_LEN_PLIST( t_1, 3 );
1733 SET_ELM_PLIST( t_1, 1, INTOBJ_INT(1) );
1734 SET_ELM_PLIST( t_1, 2, INTOBJ_INT(2) );
1735 SET_ELM_PLIST( t_1, 3, INTOBJ_INT(3) );
1736 l_x = t_1;
1737
1738 /* Display( IsBound( x[2] ) ); */
1739 t_1 = GF_Display;
1740 t_2 = C_ISB_LIST( l_x, INTOBJ_INT(2) );
1741 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1742 CALL_1ARGS( t_1, t_2 );
1743 }
1744 else {
1745 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1746 }
1747
1748 /* Unbind( x[2] ); */
1749 C_UNB_LIST( l_x, INTOBJ_INT(2) );
1750
1751 /* Display( IsBound( x[2] ) ); */
1752 t_1 = GF_Display;
1753 t_2 = C_ISB_LIST( l_x, INTOBJ_INT(2) );
1754 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1755 CALL_1ARGS( t_1, t_2 );
1756 }
1757 else {
1758 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1759 }
1760
1761 /* Print( "Testing IsBound and Unbind for list with bang\n" ); */
1762 t_1 = GF_Print;
1763 t_2 = MakeString( "Testing IsBound and Unbind for list with bang\n" );
1764 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1765 CALL_1ARGS( t_1, t_2 );
1766 }
1767 else {
1768 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1769 }
1770
1771 /* x := [ 1, 2, 3 ]; */
1772 t_1 = NEW_PLIST( T_PLIST, 3 );
1773 SET_LEN_PLIST( t_1, 3 );
1774 SET_ELM_PLIST( t_1, 1, INTOBJ_INT(1) );
1775 SET_ELM_PLIST( t_1, 2, INTOBJ_INT(2) );
1776 SET_ELM_PLIST( t_1, 3, INTOBJ_INT(3) );
1777 l_x = t_1;
1778
1779 /* Display( IsBound( x![2] ) ); */
1780 t_1 = GF_Display;
1781 t_2 = IsbPosObj( l_x, 2 ) ? True : False;
1782 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1783 CALL_1ARGS( t_1, t_2 );
1784 }
1785 else {
1786 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1787 }
1788
1789 /* Unbind( x![2] ); */
1790 UnbPosObj( l_x, 2 );
1791
1792 /* Display( IsBound( x![2] ) ); */
1793 t_1 = GF_Display;
1794 t_2 = IsbPosObj( l_x, 2 ) ? True : False;
1795 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1796 CALL_1ARGS( t_1, t_2 );
1797 }
1798 else {
1799 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1800 }
1801
1802 /* Print( "Testing IsBound and Unbind for record\n" ); */
1803 t_1 = GF_Print;
1804 t_2 = MakeString( "Testing IsBound and Unbind for record\n" );
1805 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1806 CALL_1ARGS( t_1, t_2 );
1807 }
1808 else {
1809 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1810 }
1811
1812 /* x := rec(
1813 a := 1 ); */
1814 t_1 = NEW_PREC( 1 );
1815 t_2 = (Obj)R_a;
1816 AssPRec( t_1, (UInt)t_2, INTOBJ_INT(1) );
1817 SortPRecRNam( t_1, 0 );
1818 l_x = t_1;
1819
1820 /* Display( IsBound( x.a ) ); */
1821 t_1 = GF_Display;
1822 t_2 = (ISB_REC( l_x, R_a ) ? True : False);
1823 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1824 CALL_1ARGS( t_1, t_2 );
1825 }
1826 else {
1827 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1828 }
1829
1830 /* Unbind( x.a ); */
1831 UNB_REC( l_x, R_a );
1832
1833 /* Display( IsBound( x.a ) ); */
1834 t_1 = GF_Display;
1835 t_2 = (ISB_REC( l_x, R_a ) ? True : False);
1836 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1837 CALL_1ARGS( t_1, t_2 );
1838 }
1839 else {
1840 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1841 }
1842
1843 /* Print( "Testing IsBound and Unbind for record with expr\n" ); */
1844 t_1 = GF_Print;
1845 t_2 = MakeString( "Testing IsBound and Unbind for record with expr\n" );
1846 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1847 CALL_1ARGS( t_1, t_2 );
1848 }
1849 else {
1850 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1851 }
1852
1853 /* x := rec(
1854 a := 1 ); */
1855 t_1 = NEW_PREC( 1 );
1856 t_2 = (Obj)R_a;
1857 AssPRec( t_1, (UInt)t_2, INTOBJ_INT(1) );
1858 SortPRecRNam( t_1, 0 );
1859 l_x = t_1;
1860
1861 /* Display( IsBound( x.("a") ) ); */
1862 t_1 = GF_Display;
1863 t_3 = MakeString( "a" );
1864 t_2 = (ISB_REC( l_x, RNamObj(t_3) ) ? True : False);
1865 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1866 CALL_1ARGS( t_1, t_2 );
1867 }
1868 else {
1869 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1870 }
1871
1872 /* Unbind( x.("a") ); */
1873 t_1 = MakeString( "a" );
1874 UNB_REC( l_x, RNamObj(t_1) );
1875
1876 /* Display( IsBound( x.("a") ) ); */
1877 t_1 = GF_Display;
1878 t_3 = MakeString( "a" );
1879 t_2 = (ISB_REC( l_x, RNamObj(t_3) ) ? True : False);
1880 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1881 CALL_1ARGS( t_1, t_2 );
1882 }
1883 else {
1884 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1885 }
1886
1887 /* Print( "Testing IsBound and Unbind for record with bang\n" ); */
1888 t_1 = GF_Print;
1889 t_2 = MakeString( "Testing IsBound and Unbind for record with bang\n" );
1890 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1891 CALL_1ARGS( t_1, t_2 );
1892 }
1893 else {
1894 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1895 }
1896
1897 /* x := rec(
1898 a := 1 ); */
1899 t_1 = NEW_PREC( 1 );
1900 t_2 = (Obj)R_a;
1901 AssPRec( t_1, (UInt)t_2, INTOBJ_INT(1) );
1902 SortPRecRNam( t_1, 0 );
1903 l_x = t_1;
1904
1905 /* Display( IsBound( x!.a ) ); */
1906 t_1 = GF_Display;
1907 t_2 = IsbComObj( l_x, R_a ) ? True : False;
1908 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1909 CALL_1ARGS( t_1, t_2 );
1910 }
1911 else {
1912 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1913 }
1914
1915 /* Unbind( x!.a ); */
1916 UnbComObj( l_x, R_a );
1917
1918 /* Display( IsBound( x!.a ) ); */
1919 t_1 = GF_Display;
1920 t_2 = IsbComObj( l_x, R_a ) ? True : False;
1921 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1922 CALL_1ARGS( t_1, t_2 );
1923 }
1924 else {
1925 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1926 }
1927
1928 /* Print( "Testing IsBound and Unbind for record with bang and expr\n" ); */
1929 t_1 = GF_Print;
1930 t_2 = MakeString( "Testing IsBound and Unbind for record with bang and expr\n" );
1931 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1932 CALL_1ARGS( t_1, t_2 );
1933 }
1934 else {
1935 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1936 }
1937
1938 /* x := rec(
1939 a := 1 ); */
1940 t_1 = NEW_PREC( 1 );
1941 t_2 = (Obj)R_a;
1942 AssPRec( t_1, (UInt)t_2, INTOBJ_INT(1) );
1943 SortPRecRNam( t_1, 0 );
1944 l_x = t_1;
1945
1946 /* Display( IsBound( x!.("a") ) ); */
1947 t_1 = GF_Display;
1948 t_3 = MakeString( "a" );
1949 t_2 = IsbComObj( l_x, RNamObj(t_3) ) ? True : False;
1950 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1951 CALL_1ARGS( t_1, t_2 );
1952 }
1953 else {
1954 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1955 }
1956
1957 /* Unbind( x!.("a") ); */
1958 t_1 = MakeString( "a" );
1959 UnbComObj( l_x, RNamObj(t_1) );
1960
1961 /* Display( IsBound( x!.("a") ) ); */
1962 t_1 = GF_Display;
1963 t_3 = MakeString( "a" );
1964 t_2 = IsbComObj( l_x, RNamObj(t_3) ) ? True : False;
1965 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1966 CALL_1ARGS( t_1, t_2 );
1967 }
1968 else {
1969 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
1970 }
1971
1972 /* return; */
1973 SWITCH_TO_OLD_FRAME(oldFrame);
1974 return 0;
1975
1976 /* return; */
1977 SWITCH_TO_OLD_FRAME(oldFrame);
1978 return 0;
1979 }
1980
1981 /* handler for function 11 */
HdlrFunc11(Obj self)1982 static Obj HdlrFunc11 (
1983 Obj self )
1984 {
1985 Obj l_x = 0;
1986 Obj t_1 = 0;
1987 Obj t_2 = 0;
1988 (void)l_x;
1989 Bag oldFrame;
1990
1991 /* allocate new stack frame */
1992 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
1993
1994 /* Display( "testing repeat loop" ); */
1995 t_1 = GF_Display;
1996 t_2 = MakeString( "testing repeat loop" );
1997 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
1998 CALL_1ARGS( t_1, t_2 );
1999 }
2000 else {
2001 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
2002 }
2003
2004 /* x := 0; */
2005 l_x = INTOBJ_INT(0);
2006
2007 /* repeat */
2008 do {
2009
2010 /* x := x + 1; */
2011 C_SUM_FIA( t_1, l_x, INTOBJ_INT(1) )
2012 l_x = t_1;
2013
2014 /* if x = 1 then */
2015 t_1 = (Obj)(UInt)(EQ( l_x, INTOBJ_INT(1) ));
2016 if ( t_1 ) {
2017
2018 /* continue; */
2019 continue;
2020
2021 }
2022
2023 /* elif x = 4 then */
2024 else {
2025 t_1 = (Obj)(UInt)(EQ( l_x, INTOBJ_INT(4) ));
2026 if ( t_1 ) {
2027
2028 /* break; */
2029 break;
2030
2031 }
2032
2033 /* else */
2034 else {
2035
2036 /* Display( x ); */
2037 t_1 = GF_Display;
2038 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2039 CALL_1ARGS( t_1, l_x );
2040 }
2041 else {
2042 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_x ) );
2043 }
2044
2045 }
2046 }
2047 /* fi */
2048
2049 /* until x >= 100 */
2050 t_1 = (Obj)(UInt)(! LT( l_x, INTOBJ_INT(100) ));
2051 if ( t_1 ) break;
2052 } while ( 1 );
2053
2054 /* Display( "testing while loop" ); */
2055 t_1 = GF_Display;
2056 t_2 = MakeString( "testing while loop" );
2057 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2058 CALL_1ARGS( t_1, t_2 );
2059 }
2060 else {
2061 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
2062 }
2063
2064 /* x := 0; */
2065 l_x = INTOBJ_INT(0);
2066
2067 /* while x < 100 do */
2068 while ( 1 ) {
2069 t_1 = (Obj)(UInt)(LT( l_x, INTOBJ_INT(100) ));
2070 if ( ! t_1 ) break;
2071
2072 /* x := x + 1; */
2073 C_SUM_FIA( t_1, l_x, INTOBJ_INT(1) )
2074 l_x = t_1;
2075
2076 /* if x = 1 then */
2077 t_1 = (Obj)(UInt)(EQ( l_x, INTOBJ_INT(1) ));
2078 if ( t_1 ) {
2079
2080 /* continue; */
2081 continue;
2082
2083 }
2084
2085 /* elif x = 4 then */
2086 else {
2087 t_1 = (Obj)(UInt)(EQ( l_x, INTOBJ_INT(4) ));
2088 if ( t_1 ) {
2089
2090 /* break; */
2091 break;
2092
2093 }
2094
2095 /* else */
2096 else {
2097
2098 /* Display( x ); */
2099 t_1 = GF_Display;
2100 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2101 CALL_1ARGS( t_1, l_x );
2102 }
2103 else {
2104 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( l_x ) );
2105 }
2106
2107 }
2108 }
2109 /* fi */
2110
2111 }
2112 /* od */
2113
2114 /* Display( "testing for loop" ); */
2115 t_1 = GF_Display;
2116 t_2 = MakeString( "testing for loop" );
2117 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2118 CALL_1ARGS( t_1, t_2 );
2119 }
2120 else {
2121 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
2122 }
2123
2124 /* for x in [ 1 .. 100 ] do */
2125 for ( t_1 = INTOBJ_INT(1);
2126 ((Int)t_1) <= ((Int)INTOBJ_INT(100));
2127 t_1 = (Obj)(((UInt)t_1)+4) ) {
2128 l_x = t_1;
2129
2130 /* if x = 1 then */
2131 t_2 = (Obj)(UInt)(((Int)l_x) == ((Int)INTOBJ_INT(1)));
2132 if ( t_2 ) {
2133
2134 /* continue; */
2135 continue;
2136
2137 }
2138
2139 /* elif x = 4 then */
2140 else {
2141 t_2 = (Obj)(UInt)(((Int)l_x) == ((Int)INTOBJ_INT(4)));
2142 if ( t_2 ) {
2143
2144 /* break; */
2145 break;
2146
2147 }
2148
2149 /* else */
2150 else {
2151
2152 /* Display( x ); */
2153 t_2 = GF_Display;
2154 if ( TNUM_OBJ( t_2 ) == T_FUNCTION ) {
2155 CALL_1ARGS( t_2, l_x );
2156 }
2157 else {
2158 DoOperation2Args( CallFuncListOper, t_2, NewPlistFromArgs( l_x ) );
2159 }
2160
2161 }
2162 }
2163 /* fi */
2164
2165 }
2166 /* od */
2167
2168 /* return; */
2169 SWITCH_TO_OLD_FRAME(oldFrame);
2170 return 0;
2171
2172 /* return; */
2173 SWITCH_TO_OLD_FRAME(oldFrame);
2174 return 0;
2175 }
2176
2177 /* handler for function 12 */
HdlrFunc12(Obj self)2178 static Obj HdlrFunc12 (
2179 Obj self )
2180 {
2181 Obj t_1 = 0;
2182 Obj t_2 = 0;
2183 Bag oldFrame;
2184
2185 /* allocate new stack frame */
2186 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
2187
2188 /* test_int_constants( ); */
2189 t_1 = GF_test__int__constants;
2190 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2191 CALL_0ARGS( t_1 );
2192 }
2193 else {
2194 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2195 }
2196
2197 /* test_func_calls( ); */
2198 t_1 = GF_test__func__calls;
2199 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2200 CALL_0ARGS( t_1 );
2201 }
2202 else {
2203 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2204 }
2205
2206 /* test_cmp_ops( ); */
2207 t_1 = GF_test__cmp__ops;
2208 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2209 CALL_0ARGS( t_1 );
2210 }
2211 else {
2212 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2213 }
2214
2215 /* test_arith( ); */
2216 t_1 = GF_test__arith;
2217 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2218 CALL_0ARGS( t_1 );
2219 }
2220 else {
2221 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2222 }
2223
2224 /* test_tilde( ); */
2225 t_1 = GF_test__tilde;
2226 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2227 CALL_0ARGS( t_1 );
2228 }
2229 else {
2230 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2231 }
2232
2233 /* test_list_rec_exprs( ); */
2234 t_1 = GF_test__list__rec__exprs;
2235 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2236 CALL_0ARGS( t_1 );
2237 }
2238 else {
2239 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2240 }
2241
2242 /* test_IsBound_Unbind( ); */
2243 t_1 = GF_test__IsBound__Unbind;
2244 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2245 CALL_0ARGS( t_1 );
2246 }
2247 else {
2248 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2249 }
2250
2251 /* test_loops( ); */
2252 t_1 = GF_test__loops;
2253 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2254 CALL_0ARGS( t_1 );
2255 }
2256 else {
2257 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( ) );
2258 }
2259
2260 /* Display( () ); */
2261 t_1 = GF_Display;
2262 t_2 = IdentityPerm;
2263 if ( TNUM_OBJ( t_1 ) == T_FUNCTION ) {
2264 CALL_1ARGS( t_1, t_2 );
2265 }
2266 else {
2267 DoOperation2Args( CallFuncListOper, t_1, NewPlistFromArgs( t_2 ) );
2268 }
2269
2270 /* return; */
2271 SWITCH_TO_OLD_FRAME(oldFrame);
2272 return 0;
2273
2274 /* return; */
2275 SWITCH_TO_OLD_FRAME(oldFrame);
2276 return 0;
2277 }
2278
2279 /* handler for function 1 */
HdlrFunc1(Obj self)2280 static Obj HdlrFunc1 (
2281 Obj self )
2282 {
2283 Obj t_1 = 0;
2284 Obj t_2 = 0;
2285 Bag oldFrame;
2286
2287 /* allocate new stack frame */
2288 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
2289
2290 /* test_int_constants := function ( )
2291 local x, y;
2292 x := 10 ^ 5;
2293 Print( x, "\n" );
2294 y := 100000;
2295 Print( y, "\n" );
2296 Print( x = y, "\n" );
2297 x := 10 ^ 10;
2298 Print( x, "\n" );
2299 y := 10000000000;
2300 Print( y, "\n" );
2301 Print( x = y, "\n" );
2302 x := 10 ^ 20;
2303 Print( x, "\n" );
2304 y := 100000000000000000000;
2305 Print( y, "\n" );
2306 Print( x = y, "\n" );
2307 return;
2308 end; */
2309 t_1 = NewFunction( NameFunc[2], 0, 0, HdlrFunc2 );
2310 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2311 t_2 = NewFunctionBody();
2312 SET_STARTLINE_BODY(t_2, 7);
2313 SET_ENDLINE_BODY(t_2, 30);
2314 SET_FILENAME_BODY(t_2, FileName);
2315 SET_BODY_FUNC(t_1, t_2);
2316 AssGVar( G_test__int__constants, t_1 );
2317
2318 /* test_func_calls := function ( )
2319 local vararg_fun;
2320 vararg_fun := function ( args... )
2321 return Length( args );
2322 end;
2323 Print( vararg_fun( ), "\n" );
2324 Print( vararg_fun( 1 ), "\n" );
2325 Print( vararg_fun( 1, 2 ), "\n" );
2326 Print( vararg_fun( 1, 2, 3 ), "\n" );
2327 Print( vararg_fun( 1, 2, 3, 4 ), "\n" );
2328 Print( vararg_fun( 1, 2, 3, 4, 5 ), "\n" );
2329 Print( vararg_fun( 1, 2, 3, 4, 5, 6 ), "\n" );
2330 Print( vararg_fun( 1, 2, 3, 4, 5, 6, 7 ), "\n" );
2331 Print( vararg_fun( "x", true, vararg_fun, 4, 5, 6, 7 ), "\n" );
2332 Print( vararg_fun( : myopt := true ), "\n" );
2333 Print( vararg_fun( : myopt := "value" ), "\n" );
2334 vararg_fun := function ( args... )
2335 Display( Length( args ) );
2336 return;
2337 end;
2338 vararg_fun( );
2339 vararg_fun( 1 );
2340 vararg_fun( 1, 2 );
2341 vararg_fun( 1, 2, 3 );
2342 vararg_fun( 1, 2, 3, 4 );
2343 vararg_fun( 1, 2, 3, 4, 5 );
2344 vararg_fun( 1, 2, 3, 4, 5, 6 );
2345 vararg_fun( 1, 2, 3, 4, 5, 6, 7 );
2346 vararg_fun( "x", true, vararg_fun, 4, 5, 6, 7 );
2347 vararg_fun( : myopt := true );
2348 vararg_fun( : myopt := "value" );
2349 return;
2350 end; */
2351 t_1 = NewFunction( NameFunc[3], 0, 0, HdlrFunc3 );
2352 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2353 t_2 = NewFunctionBody();
2354 SET_STARTLINE_BODY(t_2, 36);
2355 SET_ENDLINE_BODY(t_2, 94);
2356 SET_FILENAME_BODY(t_2, FileName);
2357 SET_BODY_FUNC(t_1, t_2);
2358 AssGVar( G_test__func__calls, t_1 );
2359
2360 /* test_cmp_ops := function ( )
2361 local x;
2362 Print( "setting x to 2 ...\n" );
2363 x := 2;
2364 Print( "1 = 2 is ", 1 = 2, "\n" );
2365 Print( "1 = x is ", 1 = x, "\n" );
2366 Print( "1 = 2 via if is " );
2367 if 1 = 2 then
2368 Print( "true\n" );
2369 else
2370 Print( "false\n" );
2371 fi;
2372 Print( "1 = x via if is " );
2373 if 1 = x then
2374 Print( "true\n" );
2375 else
2376 Print( "false\n" );
2377 fi;
2378 Print( "1 <> 2 is ", 1 <> 2, "\n" );
2379 Print( "1 <> x is ", 1 <> x, "\n" );
2380 Print( "1 <> 2 via if is " );
2381 if 1 <> 2 then
2382 Print( "true\n" );
2383 else
2384 Print( "false\n" );
2385 fi;
2386 Print( "1 <> x via if is " );
2387 if 1 <> x then
2388 Print( "true\n" );
2389 else
2390 Print( "false\n" );
2391 fi;
2392 Print( "1 < 2 is ", 1 < 2, "\n" );
2393 Print( "1 < x is ", 1 < x, "\n" );
2394 Print( "1 < 2 via if is " );
2395 if 1 < 2 then
2396 Print( "true\n" );
2397 else
2398 Print( "false\n" );
2399 fi;
2400 Print( "1 < x via if is " );
2401 if 1 < x then
2402 Print( "true\n" );
2403 else
2404 Print( "false\n" );
2405 fi;
2406 Print( "1 <= 2 is ", 1 <= 2, "\n" );
2407 Print( "1 <= x is ", 1 <= x, "\n" );
2408 Print( "1 <= 2 via if is " );
2409 if 1 <= 2 then
2410 Print( "true\n" );
2411 else
2412 Print( "false\n" );
2413 fi;
2414 Print( "1 <= x via if is " );
2415 if 1 <= x then
2416 Print( "true\n" );
2417 else
2418 Print( "false\n" );
2419 fi;
2420 Print( "1 > 2 is ", 1 > 2, "\n" );
2421 Print( "1 > x is ", 1 > x, "\n" );
2422 Print( "1 > 2 via if is " );
2423 if 1 > 2 then
2424 Print( "true\n" );
2425 else
2426 Print( "false\n" );
2427 fi;
2428 Print( "1 > x via if is " );
2429 if 1 > x then
2430 Print( "true\n" );
2431 else
2432 Print( "false\n" );
2433 fi;
2434 Print( "1 >= 2 is ", 1 >= 2, "\n" );
2435 Print( "1 >= x is ", 1 >= x, "\n" );
2436 Print( "1 >= 2 via if is " );
2437 if 1 >= 2 then
2438 Print( "true\n" );
2439 else
2440 Print( "false\n" );
2441 fi;
2442 Print( "1 >= x via if is " );
2443 if 1 >= x then
2444 Print( "true\n" );
2445 else
2446 Print( "false\n" );
2447 fi;
2448 return;
2449 end; */
2450 t_1 = NewFunction( NameFunc[6], 0, 0, HdlrFunc6 );
2451 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2452 t_2 = NewFunctionBody();
2453 SET_STARTLINE_BODY(t_2, 104);
2454 SET_ENDLINE_BODY(t_2, 145);
2455 SET_FILENAME_BODY(t_2, FileName);
2456 SET_BODY_FUNC(t_1, t_2);
2457 AssGVar( G_test__cmp__ops, t_1 );
2458
2459 /* test_arith := function ( )
2460 local x;
2461 x := 5;
2462 x := - x;
2463 x := 1 / 2;
2464 x := - x;
2465 return;
2466 end; */
2467 t_1 = NewFunction( NameFunc[7], 0, 0, HdlrFunc7 );
2468 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2469 t_2 = NewFunctionBody();
2470 SET_STARTLINE_BODY(t_2, 151);
2471 SET_ENDLINE_BODY(t_2, 159);
2472 SET_FILENAME_BODY(t_2, FileName);
2473 SET_BODY_FUNC(t_1, t_2);
2474 AssGVar( G_test__arith, t_1 );
2475
2476 /* test_tilde := function ( )
2477 local x;
2478 return;
2479 end; */
2480 t_1 = NewFunction( NameFunc[8], 0, 0, HdlrFunc8 );
2481 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2482 t_2 = NewFunctionBody();
2483 SET_STARTLINE_BODY(t_2, 165);
2484 SET_ENDLINE_BODY(t_2, 181);
2485 SET_FILENAME_BODY(t_2, FileName);
2486 SET_BODY_FUNC(t_1, t_2);
2487 AssGVar( G_test__tilde, t_1 );
2488
2489 /* test_list_rec_exprs := function ( )
2490 local l, x;
2491 Display( [ ] );
2492 Display( [ 1, 2, 3 ] );
2493 Display( [ 1,, 3, [ 4, 5 ], rec(
2494 x := [ 6, rec(
2495 ) ] ) ] );
2496 l := [ ];
2497 l[1] := 1;
2498 l[1 + 1] := 2;
2499 l![3] := 3;
2500 l![2 + 2] := 4;
2501 Display( l );
2502 Print( "l[1] = ", l[1], "\n" );
2503 Print( "l[2] = ", l[1 + 1], "\n" );
2504 Print( "l[3] = ", l![3], "\n" );
2505 Print( "l[4] = ", l![2 + 2], "\n" );
2506 x := rec(
2507 a := 1 );
2508 x.b := 2;
2509 x.("c") := x.a + x.("b");
2510 x!.d := 42;
2511 x!.("e") := 23;
2512 Display( x );
2513 Print( "x.a = ", x.a, "\n" );
2514 Print( "x.b = ", x.("b"), "\n" );
2515 Print( "x.d = ", x!.d, "\n" );
2516 Print( "x.e = ", x!.("e"), "\n" );
2517 return;
2518 end; */
2519 t_1 = NewFunction( NameFunc[9], 0, 0, HdlrFunc9 );
2520 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2521 t_2 = NewFunctionBody();
2522 SET_STARTLINE_BODY(t_2, 187);
2523 SET_ENDLINE_BODY(t_2, 215);
2524 SET_FILENAME_BODY(t_2, FileName);
2525 SET_BODY_FUNC(t_1, t_2);
2526 AssGVar( G_test__list__rec__exprs, t_1 );
2527
2528 /* myglobal := 1; */
2529 AssGVar( G_myglobal, INTOBJ_INT(1) );
2530
2531 /* test_IsBound_Unbind := function ( )
2532 local x;
2533 Print( "Testing IsBound and Unbind for lvar\n" );
2534 x := 42;
2535 Display( IsBound( x ) );
2536 Unbind( x );
2537 Display( IsBound( x ) );
2538 Print( "Testing IsBound and Unbind for gvar\n" );
2539 myglobal := 42;
2540 Display( IsBound( myglobal ) );
2541 Unbind( myglobal );
2542 Display( IsBound( myglobal ) );
2543 Print( "Testing IsBound and Unbind for list\n" );
2544 x := [ 1, 2, 3 ];
2545 Display( IsBound( x[2] ) );
2546 Unbind( x[2] );
2547 Display( IsBound( x[2] ) );
2548 Print( "Testing IsBound and Unbind for list with bang\n" );
2549 x := [ 1, 2, 3 ];
2550 Display( IsBound( x![2] ) );
2551 Unbind( x![2] );
2552 Display( IsBound( x![2] ) );
2553 Print( "Testing IsBound and Unbind for record\n" );
2554 x := rec(
2555 a := 1 );
2556 Display( IsBound( x.a ) );
2557 Unbind( x.a );
2558 Display( IsBound( x.a ) );
2559 Print( "Testing IsBound and Unbind for record with expr\n" );
2560 x := rec(
2561 a := 1 );
2562 Display( IsBound( x.("a") ) );
2563 Unbind( x.("a") );
2564 Display( IsBound( x.("a") ) );
2565 Print( "Testing IsBound and Unbind for record with bang\n" );
2566 x := rec(
2567 a := 1 );
2568 Display( IsBound( x!.a ) );
2569 Unbind( x!.a );
2570 Display( IsBound( x!.a ) );
2571 Print( "Testing IsBound and Unbind for record with bang and expr\n" );
2572 x := rec(
2573 a := 1 );
2574 Display( IsBound( x!.("a") ) );
2575 Unbind( x!.("a") );
2576 Display( IsBound( x!.("a") ) );
2577 return;
2578 end; */
2579 t_1 = NewFunction( NameFunc[10], 0, 0, HdlrFunc10 );
2580 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2581 t_2 = NewFunctionBody();
2582 SET_STARTLINE_BODY(t_2, 222);
2583 SET_ENDLINE_BODY(t_2, 281);
2584 SET_FILENAME_BODY(t_2, FileName);
2585 SET_BODY_FUNC(t_1, t_2);
2586 AssGVar( G_test__IsBound__Unbind, t_1 );
2587
2588 /* test_loops := function ( )
2589 local x;
2590 Display( "testing repeat loop" );
2591 x := 0;
2592 repeat
2593 x := x + 1;
2594 if x = 1 then
2595 continue;
2596 elif x = 4 then
2597 break;
2598 else
2599 Display( x );
2600 fi;
2601 until x >= 100;
2602 Display( "testing while loop" );
2603 x := 0;
2604 while x < 100 do
2605 x := x + 1;
2606 if x = 1 then
2607 continue;
2608 elif x = 4 then
2609 break;
2610 else
2611 Display( x );
2612 fi;
2613 od;
2614 Display( "testing for loop" );
2615 for x in [ 1 .. 100 ] do
2616 if x = 1 then
2617 continue;
2618 elif x = 4 then
2619 break;
2620 else
2621 Display( x );
2622 fi;
2623 od;
2624 return;
2625 end; */
2626 t_1 = NewFunction( NameFunc[11], 0, 0, HdlrFunc11 );
2627 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2628 t_2 = NewFunctionBody();
2629 SET_STARTLINE_BODY(t_2, 287);
2630 SET_ENDLINE_BODY(t_2, 328);
2631 SET_FILENAME_BODY(t_2, FileName);
2632 SET_BODY_FUNC(t_1, t_2);
2633 AssGVar( G_test__loops, t_1 );
2634
2635 /* runtest := function ( )
2636 test_int_constants( );
2637 test_func_calls( );
2638 test_cmp_ops( );
2639 test_arith( );
2640 test_tilde( );
2641 test_list_rec_exprs( );
2642 test_IsBound_Unbind( );
2643 test_loops( );
2644 Display( () );
2645 return;
2646 end; */
2647 t_1 = NewFunction( NameFunc[12], 0, 0, HdlrFunc12 );
2648 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
2649 t_2 = NewFunctionBody();
2650 SET_STARTLINE_BODY(t_2, 334);
2651 SET_ENDLINE_BODY(t_2, 346);
2652 SET_FILENAME_BODY(t_2, FileName);
2653 SET_BODY_FUNC(t_1, t_2);
2654 AssGVar( G_runtest, t_1 );
2655
2656 /* return; */
2657 SWITCH_TO_OLD_FRAME(oldFrame);
2658 return 0;
2659
2660 /* return; */
2661 SWITCH_TO_OLD_FRAME(oldFrame);
2662 return 0;
2663 }
2664
2665 /* 'PostRestore' restore gvars, rnams, functions */
PostRestore(StructInitInfo * module)2666 static Int PostRestore ( StructInitInfo * module )
2667 {
2668
2669 /* global variables used in handlers */
2670 G_PushOptions = GVarName( "PushOptions" );
2671 G_PopOptions = GVarName( "PopOptions" );
2672 G_Print = GVarName( "Print" );
2673 G_test__int__constants = GVarName( "test_int_constants" );
2674 G_test__func__calls = GVarName( "test_func_calls" );
2675 G_Display = GVarName( "Display" );
2676 G_test__cmp__ops = GVarName( "test_cmp_ops" );
2677 G_test__arith = GVarName( "test_arith" );
2678 G_test__tilde = GVarName( "test_tilde" );
2679 G_test__list__rec__exprs = GVarName( "test_list_rec_exprs" );
2680 G_myglobal = GVarName( "myglobal" );
2681 G_test__IsBound__Unbind = GVarName( "test_IsBound_Unbind" );
2682 G_test__loops = GVarName( "test_loops" );
2683 G_runtest = GVarName( "runtest" );
2684
2685 /* record names used in handlers */
2686 R_myopt = RNamName( "myopt" );
2687 R_x = RNamName( "x" );
2688 R_a = RNamName( "a" );
2689 R_b = RNamName( "b" );
2690 R_d = RNamName( "d" );
2691
2692 /* information for the functions */
2693 NameFunc[1] = 0;
2694 NameFunc[2] = 0;
2695 NameFunc[3] = 0;
2696 NameFunc[4] = 0;
2697 NameFunc[5] = 0;
2698 NameFunc[6] = 0;
2699 NameFunc[7] = 0;
2700 NameFunc[8] = 0;
2701 NameFunc[9] = 0;
2702 NameFunc[10] = 0;
2703 NameFunc[11] = 0;
2704 NameFunc[12] = 0;
2705
2706 /* return success */
2707 return 0;
2708
2709 }
2710
2711
2712 /* 'InitKernel' sets up data structures, fopies, copies, handlers */
InitKernel(StructInitInfo * module)2713 static Int InitKernel ( StructInitInfo * module )
2714 {
2715
2716 /* global variables used in handlers */
2717 InitFopyGVar( "PushOptions", &GF_PushOptions );
2718 InitFopyGVar( "PopOptions", &GF_PopOptions );
2719 InitFopyGVar( "Print", &GF_Print );
2720 InitFopyGVar( "test_int_constants", &GF_test__int__constants );
2721 InitFopyGVar( "test_func_calls", &GF_test__func__calls );
2722 InitFopyGVar( "Display", &GF_Display );
2723 InitFopyGVar( "test_cmp_ops", &GF_test__cmp__ops );
2724 InitFopyGVar( "test_arith", &GF_test__arith );
2725 InitFopyGVar( "test_tilde", &GF_test__tilde );
2726 InitFopyGVar( "test_list_rec_exprs", &GF_test__list__rec__exprs );
2727 InitCopyGVar( "myglobal", &GC_myglobal );
2728 InitFopyGVar( "test_IsBound_Unbind", &GF_test__IsBound__Unbind );
2729 InitFopyGVar( "test_loops", &GF_test__loops );
2730
2731 /* information for the functions */
2732 InitGlobalBag( &FileName, "basics.g:FileName("FILE_CRC")" );
2733 InitHandlerFunc( HdlrFunc1, "basics.g:HdlrFunc1("FILE_CRC")" );
2734 InitGlobalBag( &(NameFunc[1]), "basics.g:NameFunc[1]("FILE_CRC")" );
2735 InitHandlerFunc( HdlrFunc2, "basics.g:HdlrFunc2("FILE_CRC")" );
2736 InitGlobalBag( &(NameFunc[2]), "basics.g:NameFunc[2]("FILE_CRC")" );
2737 InitHandlerFunc( HdlrFunc3, "basics.g:HdlrFunc3("FILE_CRC")" );
2738 InitGlobalBag( &(NameFunc[3]), "basics.g:NameFunc[3]("FILE_CRC")" );
2739 InitHandlerFunc( HdlrFunc4, "basics.g:HdlrFunc4("FILE_CRC")" );
2740 InitGlobalBag( &(NameFunc[4]), "basics.g:NameFunc[4]("FILE_CRC")" );
2741 InitHandlerFunc( HdlrFunc5, "basics.g:HdlrFunc5("FILE_CRC")" );
2742 InitGlobalBag( &(NameFunc[5]), "basics.g:NameFunc[5]("FILE_CRC")" );
2743 InitHandlerFunc( HdlrFunc6, "basics.g:HdlrFunc6("FILE_CRC")" );
2744 InitGlobalBag( &(NameFunc[6]), "basics.g:NameFunc[6]("FILE_CRC")" );
2745 InitHandlerFunc( HdlrFunc7, "basics.g:HdlrFunc7("FILE_CRC")" );
2746 InitGlobalBag( &(NameFunc[7]), "basics.g:NameFunc[7]("FILE_CRC")" );
2747 InitHandlerFunc( HdlrFunc8, "basics.g:HdlrFunc8("FILE_CRC")" );
2748 InitGlobalBag( &(NameFunc[8]), "basics.g:NameFunc[8]("FILE_CRC")" );
2749 InitHandlerFunc( HdlrFunc9, "basics.g:HdlrFunc9("FILE_CRC")" );
2750 InitGlobalBag( &(NameFunc[9]), "basics.g:NameFunc[9]("FILE_CRC")" );
2751 InitHandlerFunc( HdlrFunc10, "basics.g:HdlrFunc10("FILE_CRC")" );
2752 InitGlobalBag( &(NameFunc[10]), "basics.g:NameFunc[10]("FILE_CRC")" );
2753 InitHandlerFunc( HdlrFunc11, "basics.g:HdlrFunc11("FILE_CRC")" );
2754 InitGlobalBag( &(NameFunc[11]), "basics.g:NameFunc[11]("FILE_CRC")" );
2755 InitHandlerFunc( HdlrFunc12, "basics.g:HdlrFunc12("FILE_CRC")" );
2756 InitGlobalBag( &(NameFunc[12]), "basics.g:NameFunc[12]("FILE_CRC")" );
2757
2758 /* return success */
2759 return 0;
2760
2761 }
2762
2763 /* 'InitLibrary' sets up gvars, rnams, functions */
InitLibrary(StructInitInfo * module)2764 static Int InitLibrary ( StructInitInfo * module )
2765 {
2766 Obj func1;
2767 Obj body1;
2768
2769 /* Complete Copy/Fopy registration */
2770 UpdateCopyFopyInfo();
2771 FileName = MakeImmString( "basics.g" );
2772 PostRestore(module);
2773
2774 /* create all the functions defined in this module */
2775 func1 = NewFunction(NameFunc[1],0,0,HdlrFunc1);
2776 SET_ENVI_FUNC( func1, STATE(CurrLVars) );
2777 body1 = NewFunctionBody();
2778 SET_BODY_FUNC( func1, body1 );
2779 CHANGED_BAG( func1 );
2780 CALL_0ARGS( func1 );
2781
2782 /* return success */
2783 return 0;
2784
2785 }
2786
2787 /* <name> returns the description of this module */
2788 static StructInitInfo module = {
2789 .type = MODULE_STATIC,
2790 .name = "basics.g",
2791 .crc = 127577812,
2792 .initKernel = InitKernel,
2793 .initLibrary = InitLibrary,
2794 .postRestore = PostRestore,
2795 };
2796
Init__basics(void)2797 StructInitInfo * Init__basics ( void )
2798 {
2799 return &module;
2800 }
2801
2802 /* compiled code ends here */
2803