Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Path: gap4r8 / src / code.h
Views: 415069
1
/****************************************************************************
2
**
3
*W code.h GAP source Martin Schönert
4
**
5
**
6
*Y Copyright (C) 1996, Lehrstuhl D für Mathematik, RWTH Aachen, Germany
7
*Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
8
*Y Copyright (C) 2002 The GAP Group
9
**
10
** This file declares the functions of the coder package.
11
**
12
** The coder package is the part of the interpreter that creates the
13
** expressions. Its functions are called from the reader.
14
*/
15
16
#ifndef GAP_CODE_H
17
#define GAP_CODE_H
18
19
20
/****************************************************************************
21
**
22
*T Stat . . . . . . . . . . . . . . . . . . . . . . . . type of statements
23
**
24
** 'Stat' is the type of statements.
25
**
26
** If 'Stat' is different from 'Expr', then a lot of things will probably
27
** break.
28
*/
29
#define Stat UInt8
30
31
32
/****************************************************************************
33
**
34
*V PtrBody . . . . . . . . . . . . . . . . . . . . . pointer to current body
35
**
36
** 'PtrBody' is a pointer to the current body.
37
*/
38
extern Stat * PtrBody;
39
40
41
/****************************************************************************
42
**
43
*V FIRST_STAT_CURR_FUNC . . . . . . . . index of first statement in a body
44
**
45
** 'FIRST_STAT_CURR_FUNC' is the index of the first statement in a body.
46
*/
47
48
49
#define FILENAME_BODY(body) (ADDR_OBJ(body)[0])
50
#define STARTLINE_BODY(body) (ADDR_OBJ(body)[1])
51
#define ENDLINE_BODY(body) (ADDR_OBJ(body)[2])
52
#define NUMBER_HEADER_ITEMS_BODY 3
53
54
#define FIRST_STAT_CURR_FUNC (sizeof(Stat)+NUMBER_HEADER_ITEMS_BODY*sizeof(Bag))
55
56
/****************************************************************************
57
**
58
*S T_<name> . . . . . . . . . . . . . . symbolic names for statement types
59
*S FIRST_STAT_TNUM . . . . . . . . . . . . . . . . . . first statement type
60
*S LAST_STAT_TNUM . . . . . . . . . . . . . . . . . . . last statement type
61
**
62
** For every type of statements there is a symbolic name defined for this
63
** type.
64
**
65
** As long as statements are represented by bags, these types must not
66
** overlap with the object types, lest Gasman becomes confused.
67
*/
68
#define FIRST_STAT_TNUM (0UL)
69
70
#define T_PROCCALL_0ARGS (FIRST_STAT_TNUM+ 0)
71
#define T_PROCCALL_1ARGS (FIRST_STAT_TNUM+ 1)
72
#define T_PROCCALL_2ARGS (FIRST_STAT_TNUM+ 2)
73
#define T_PROCCALL_3ARGS (FIRST_STAT_TNUM+ 3)
74
#define T_PROCCALL_4ARGS (FIRST_STAT_TNUM+ 4)
75
#define T_PROCCALL_5ARGS (FIRST_STAT_TNUM+ 5)
76
#define T_PROCCALL_6ARGS (FIRST_STAT_TNUM+ 6)
77
#define T_PROCCALL_XARGS (FIRST_STAT_TNUM+ 7)
78
79
#define T_SEQ_STAT (FIRST_STAT_TNUM+ 8)
80
#define T_SEQ_STAT2 (FIRST_STAT_TNUM+ 9)
81
#define T_SEQ_STAT3 (FIRST_STAT_TNUM+10)
82
#define T_SEQ_STAT4 (FIRST_STAT_TNUM+11)
83
#define T_SEQ_STAT5 (FIRST_STAT_TNUM+12)
84
#define T_SEQ_STAT6 (FIRST_STAT_TNUM+13)
85
#define T_SEQ_STAT7 (FIRST_STAT_TNUM+14)
86
#define T_IF (FIRST_STAT_TNUM+15)
87
#define T_IF_ELSE (FIRST_STAT_TNUM+16)
88
#define T_IF_ELIF (FIRST_STAT_TNUM+17)
89
#define T_IF_ELIF_ELSE (FIRST_STAT_TNUM+18)
90
#define T_FOR (FIRST_STAT_TNUM+19)
91
#define T_FOR2 (FIRST_STAT_TNUM+20)
92
#define T_FOR3 (FIRST_STAT_TNUM+21)
93
#define T_FOR_RANGE (FIRST_STAT_TNUM+22)
94
#define T_FOR_RANGE2 (FIRST_STAT_TNUM+23)
95
#define T_FOR_RANGE3 (FIRST_STAT_TNUM+24)
96
#define T_WHILE (FIRST_STAT_TNUM+25)
97
#define T_WHILE2 (FIRST_STAT_TNUM+26)
98
#define T_WHILE3 (FIRST_STAT_TNUM+27)
99
#define T_REPEAT (FIRST_STAT_TNUM+28)
100
#define T_REPEAT2 (FIRST_STAT_TNUM+29)
101
#define T_REPEAT3 (FIRST_STAT_TNUM+30)
102
#define T_BREAK (FIRST_STAT_TNUM+31)
103
#define T_CONTINUE (FIRST_STAT_TNUM+32)
104
#define T_RETURN_OBJ (FIRST_STAT_TNUM+33)
105
#define T_RETURN_VOID (FIRST_STAT_TNUM+34)
106
107
#define T_ASS_LVAR (FIRST_STAT_TNUM+35)
108
#define T_ASS_LVAR_01 (FIRST_STAT_TNUM+36)
109
#define T_ASS_LVAR_02 (FIRST_STAT_TNUM+37)
110
#define T_ASS_LVAR_03 (FIRST_STAT_TNUM+38)
111
#define T_ASS_LVAR_04 (FIRST_STAT_TNUM+39)
112
#define T_ASS_LVAR_05 (FIRST_STAT_TNUM+40)
113
#define T_ASS_LVAR_06 (FIRST_STAT_TNUM+41)
114
#define T_ASS_LVAR_07 (FIRST_STAT_TNUM+42)
115
#define T_ASS_LVAR_08 (FIRST_STAT_TNUM+43)
116
#define T_ASS_LVAR_09 (FIRST_STAT_TNUM+44)
117
#define T_ASS_LVAR_10 (FIRST_STAT_TNUM+45)
118
#define T_ASS_LVAR_11 (FIRST_STAT_TNUM+46)
119
#define T_ASS_LVAR_12 (FIRST_STAT_TNUM+47)
120
#define T_ASS_LVAR_13 (FIRST_STAT_TNUM+48)
121
#define T_ASS_LVAR_14 (FIRST_STAT_TNUM+49)
122
#define T_ASS_LVAR_15 (FIRST_STAT_TNUM+50)
123
#define T_ASS_LVAR_16 (FIRST_STAT_TNUM+51)
124
#define T_UNB_LVAR (FIRST_STAT_TNUM+52)
125
#define T_ASS_HVAR (FIRST_STAT_TNUM+53)
126
#define T_UNB_HVAR (FIRST_STAT_TNUM+54)
127
#define T_ASS_GVAR (FIRST_STAT_TNUM+55)
128
#define T_UNB_GVAR (FIRST_STAT_TNUM+56)
129
#define T_ASS_LIST (FIRST_STAT_TNUM+57)
130
#define T_ASSS_LIST (FIRST_STAT_TNUM+58)
131
#define T_ASS_LIST_LEV (FIRST_STAT_TNUM+59)
132
#define T_ASSS_LIST_LEV (FIRST_STAT_TNUM+60)
133
#define T_UNB_LIST (FIRST_STAT_TNUM+61)
134
#define T_ASS_REC_NAME (FIRST_STAT_TNUM+62)
135
#define T_ASS_REC_EXPR (FIRST_STAT_TNUM+63)
136
#define T_UNB_REC_NAME (FIRST_STAT_TNUM+64)
137
#define T_UNB_REC_EXPR (FIRST_STAT_TNUM+65)
138
#define T_ASS_POSOBJ (FIRST_STAT_TNUM+66)
139
#define T_ASSS_POSOBJ (FIRST_STAT_TNUM+67)
140
#define T_ASS_POSOBJ_LEV (FIRST_STAT_TNUM+68)
141
#define T_ASSS_POSOBJ_LEV (FIRST_STAT_TNUM+69)
142
#define T_UNB_POSOBJ (FIRST_STAT_TNUM+70)
143
#define T_ASS_COMOBJ_NAME (FIRST_STAT_TNUM+71)
144
#define T_ASS_COMOBJ_EXPR (FIRST_STAT_TNUM+72)
145
#define T_UNB_COMOBJ_NAME (FIRST_STAT_TNUM+73)
146
#define T_UNB_COMOBJ_EXPR (FIRST_STAT_TNUM+74)
147
148
#define T_INFO (FIRST_STAT_TNUM+75)
149
#define T_ASSERT_2ARGS (FIRST_STAT_TNUM+76)
150
#define T_ASSERT_3ARGS (FIRST_STAT_TNUM+77)
151
152
#define T_EMPTY (FIRST_STAT_TNUM+78)
153
154
#define T_PROCCALL_OPTS (FIRST_STAT_TNUM+ 79)
155
156
#define T_ATOMIC (FIRST_STAT_TNUM+80)
157
158
#define LAST_STAT_TNUM T_ATOMIC
159
160
#define T_NO_STAT (Stat)(-1)
161
162
163
/****************************************************************************
164
**
165
*F TNUM_STAT(<stat>) . . . . . . . . . . . . . . . . . . type of a statement
166
**
167
** 'TNUM_STAT' returns the type of the statement <stat>.
168
*/
169
#define TNUM_STAT(stat) ((Int)(ADDR_STAT(stat)[-1] & 0xFF))
170
171
172
/****************************************************************************
173
**
174
*F SIZE_STAT(<stat>) . . . . . . . . . . . . . . . . . . size of a statement
175
**
176
** 'SIZE_STAT' returns the size of the statement <stat>.
177
*/
178
#define SIZE_STAT(stat) ((Int)(ADDR_STAT(stat)[-1] >> 8 & 0xFFFFFF))
179
180
/****************************************************************************
181
**
182
*F LINE_STAT(<stat>) . . . . . . . . . . . . . . line number of a statement
183
**
184
** 'LINE_STAT' returns the line number of the statement <stat>.
185
*/
186
#define LINE_STAT(stat) ((Int)(ADDR_STAT(stat)[-1] >> 32 & 0xFFFF))
187
188
/****************************************************************************
189
**
190
*F FILENAMEID_STAT(<stat>) . . . . . . . . . . . . file name of a statement
191
**
192
** 'FILENAMEID_STAT' returns the file the statment <stat> was read from.
193
** This should be looked up in the FilenameCache variable
194
*/
195
#define FILENAMEID_STAT(stat) ((Int)(ADDR_STAT(stat)[-1] >> 48 & 0x7FFF))
196
197
/****************************************************************************
198
**
199
*F FILENAME_STAT(<stat>) . . . . . . . . . . . . file name of a statement
200
**
201
** 'FILENAME_STAT' returns a gap string containing the file where the statment
202
** <stat> was read from.
203
*/
204
Obj FILENAME_STAT(Stat stat);
205
206
/****************************************************************************
207
**
208
*F VISITED_STAT(<stat>) . . . . . . . . . . . . if statement has even been run
209
**
210
** 'VISITED_STAT' returns true if the statement has ever been executed
211
** while profiling is turned on.
212
*/
213
#define VISITED_STAT(stat) (ADDR_STAT(stat)[-1] >> 63 && 0x1)
214
215
216
217
/****************************************************************************
218
**
219
*F ADDR_STAT(<stat>) . . . . . . . . . . . . absolute address of a statement
220
**
221
** 'ADDR_STAT' returns the absolute address of the memory block of the
222
** statement <stat>.
223
*/
224
#define ADDR_STAT(stat) ((Stat*)(((char*)TLS(PtrBody))+(stat)))
225
226
227
/****************************************************************************
228
**
229
*T Expr . . . . . . . . . . . . . . . . . . . . . . . . type of expressions
230
**
231
** 'Expr' is the type of expressions.
232
**
233
** If 'Expr' is different from 'Stat', then a lot of things will probably
234
** break.
235
*/
236
#define Expr Stat
237
238
239
/****************************************************************************
240
**
241
*F IS_REFLVAR(<expr>). . . . test if an expression is a reference to a local
242
*F REFLVAR_LVAR(<lvar>) . . . . . convert a local to a reference to a local
243
*F LVAR_REFLVAR(<expr>) . . . . . convert a reference to a local to a local
244
**
245
** 'IS_REFLVAR' returns 1 if the expression <expr> is an (immediate)
246
** reference to a local variable, and 0 otherwise.
247
**
248
** 'REFLVAR_LVAR' returns a (immediate) reference to the local variable
249
** <lvar> (given by its index).
250
**
251
** 'LVAR_REFLVAR' returns the local variable (by its index) to which <expr>
252
** is a (immediate) reference.
253
*/
254
#define IS_REFLVAR(expr) \
255
(((Int)(expr) & 0x03) == 0x03)
256
257
#define REFLVAR_LVAR(lvar) \
258
((Expr)(((lvar) << 2) + 0x03))
259
260
#define LVAR_REFLVAR(expr) \
261
((Int)(expr) >> 2)
262
263
264
/****************************************************************************
265
**
266
*F IS_INTEXPR(<expr>). . . . test if an expression is an integer expression
267
*F INTEXPR_INT(<i>) . . . . . convert a C integer to an integer expression
268
*F INT_INTEXPR(<expr>) . . . . convert an integer expression to a C integer
269
**
270
** 'IS_INTEXPR' returns 1 if the expression <expr> is an (immediate) integer
271
** expression, and 0 otherwise.
272
**
273
** 'INTEXPR_INT' converts the C integer <i> to an (immediate) integer
274
** expression.
275
**
276
** 'INT_INTEXPR' converts the (immediate) integer expression <expr> to a C
277
** integer.
278
*/
279
#define IS_INTEXPR(expr) \
280
(((Int)(expr) & 0x03) == 0x01)
281
282
#define INTEXPR_INT(indx) \
283
((Expr)(((Int)(indx) << 2) + 0x01))
284
285
#define INT_INTEXPR(expr) \
286
(((Int)(expr)-0x01) >> 2)
287
288
289
/****************************************************************************
290
**
291
*S T_<name> . . . . . . . . . . . . . . symbolic names for expression types
292
*S FIRST_EXPR_TNUM . . . . . . . . . . . . . . . . . . first expression type
293
*S LAST_EXPR_TNUM . . . . . . . . . . . . . . . . . . last expression type
294
**
295
** For every type of expressions there is a symbolic name defined for this
296
** type.
297
**
298
** As long as expressions are represented by bags, these types must not
299
** overlap with the object types, lest Gasman becomes confused.
300
*/
301
#define FIRST_EXPR_TNUM ((UInt)128)
302
303
#define T_FUNCCALL_0ARGS (FIRST_EXPR_TNUM+ 0)
304
#define T_FUNCCALL_1ARGS (FIRST_EXPR_TNUM+ 1)
305
#define T_FUNCCALL_2ARGS (FIRST_EXPR_TNUM+ 2)
306
#define T_FUNCCALL_3ARGS (FIRST_EXPR_TNUM+ 3)
307
#define T_FUNCCALL_4ARGS (FIRST_EXPR_TNUM+ 4)
308
#define T_FUNCCALL_5ARGS (FIRST_EXPR_TNUM+ 5)
309
#define T_FUNCCALL_6ARGS (FIRST_EXPR_TNUM+ 6)
310
#define T_FUNCCALL_XARGS (FIRST_EXPR_TNUM+ 7)
311
#define T_FUNC_EXPR (FIRST_EXPR_TNUM+ 8)
312
313
#define T_OR (FIRST_EXPR_TNUM+ 9)
314
#define T_AND (FIRST_EXPR_TNUM+10)
315
#define T_NOT (FIRST_EXPR_TNUM+11)
316
#define T_EQ (FIRST_EXPR_TNUM+12)
317
#define T_NE (FIRST_EXPR_TNUM+13)
318
#define T_LT (FIRST_EXPR_TNUM+14)
319
#define T_GE (FIRST_EXPR_TNUM+15)
320
#define T_GT (FIRST_EXPR_TNUM+16)
321
#define T_LE (FIRST_EXPR_TNUM+17)
322
#define T_IN (FIRST_EXPR_TNUM+18)
323
#define T_SUM (FIRST_EXPR_TNUM+19)
324
#define T_AINV (FIRST_EXPR_TNUM+20)
325
#define T_DIFF (FIRST_EXPR_TNUM+21)
326
#define T_PROD (FIRST_EXPR_TNUM+22)
327
#define T_INV (FIRST_EXPR_TNUM+23)
328
#define T_QUO (FIRST_EXPR_TNUM+24)
329
#define T_MOD (FIRST_EXPR_TNUM+25)
330
#define T_POW (FIRST_EXPR_TNUM+26)
331
332
#define T_INTEXPR (FIRST_EXPR_TNUM+27)
333
#define T_INT_EXPR (FIRST_EXPR_TNUM+28)
334
#define T_TRUE_EXPR (FIRST_EXPR_TNUM+29)
335
#define T_FALSE_EXPR (FIRST_EXPR_TNUM+30)
336
#define T_CHAR_EXPR (FIRST_EXPR_TNUM+31)
337
#define T_PERM_EXPR (FIRST_EXPR_TNUM+32)
338
#define T_PERM_CYCLE (FIRST_EXPR_TNUM+33)
339
#define T_LIST_EXPR (FIRST_EXPR_TNUM+34)
340
#define T_LIST_TILD_EXPR (FIRST_EXPR_TNUM+35)
341
#define T_RANGE_EXPR (FIRST_EXPR_TNUM+36)
342
#define T_STRING_EXPR (FIRST_EXPR_TNUM+37)
343
#define T_REC_EXPR (FIRST_EXPR_TNUM+38)
344
#define T_REC_TILD_EXPR (FIRST_EXPR_TNUM+39)
345
346
#define T_REFLVAR (FIRST_EXPR_TNUM+40)
347
#define T_REF_LVAR (FIRST_EXPR_TNUM+41)
348
#define T_REF_LVAR_01 (FIRST_EXPR_TNUM+42)
349
#define T_REF_LVAR_02 (FIRST_EXPR_TNUM+43)
350
#define T_REF_LVAR_03 (FIRST_EXPR_TNUM+44)
351
#define T_REF_LVAR_04 (FIRST_EXPR_TNUM+45)
352
#define T_REF_LVAR_05 (FIRST_EXPR_TNUM+46)
353
#define T_REF_LVAR_06 (FIRST_EXPR_TNUM+47)
354
#define T_REF_LVAR_07 (FIRST_EXPR_TNUM+48)
355
#define T_REF_LVAR_08 (FIRST_EXPR_TNUM+49)
356
#define T_REF_LVAR_09 (FIRST_EXPR_TNUM+50)
357
#define T_REF_LVAR_10 (FIRST_EXPR_TNUM+51)
358
#define T_REF_LVAR_11 (FIRST_EXPR_TNUM+52)
359
#define T_REF_LVAR_12 (FIRST_EXPR_TNUM+53)
360
#define T_REF_LVAR_13 (FIRST_EXPR_TNUM+54)
361
#define T_REF_LVAR_14 (FIRST_EXPR_TNUM+55)
362
#define T_REF_LVAR_15 (FIRST_EXPR_TNUM+56)
363
#define T_REF_LVAR_16 (FIRST_EXPR_TNUM+57)
364
#define T_ISB_LVAR (FIRST_EXPR_TNUM+58)
365
#define T_REF_HVAR (FIRST_EXPR_TNUM+59)
366
#define T_ISB_HVAR (FIRST_EXPR_TNUM+60)
367
#define T_REF_GVAR (FIRST_EXPR_TNUM+61)
368
#define T_ISB_GVAR (FIRST_EXPR_TNUM+62)
369
#define T_ELM_LIST (FIRST_EXPR_TNUM+63)
370
#define T_ELMS_LIST (FIRST_EXPR_TNUM+64)
371
#define T_ELM_LIST_LEV (FIRST_EXPR_TNUM+65)
372
#define T_ELMS_LIST_LEV (FIRST_EXPR_TNUM+66)
373
#define T_ISB_LIST (FIRST_EXPR_TNUM+67)
374
#define T_ELM_REC_NAME (FIRST_EXPR_TNUM+68)
375
#define T_ELM_REC_EXPR (FIRST_EXPR_TNUM+69)
376
#define T_ISB_REC_NAME (FIRST_EXPR_TNUM+70)
377
#define T_ISB_REC_EXPR (FIRST_EXPR_TNUM+71)
378
#define T_ELM_POSOBJ (FIRST_EXPR_TNUM+72)
379
#define T_ELMS_POSOBJ (FIRST_EXPR_TNUM+73)
380
#define T_ELM_POSOBJ_LEV (FIRST_EXPR_TNUM+74)
381
#define T_ELMS_POSOBJ_LEV (FIRST_EXPR_TNUM+75)
382
#define T_ISB_POSOBJ (FIRST_EXPR_TNUM+76)
383
#define T_ELM_COMOBJ_NAME (FIRST_EXPR_TNUM+77)
384
#define T_ELM_COMOBJ_EXPR (FIRST_EXPR_TNUM+78)
385
#define T_ISB_COMOBJ_NAME (FIRST_EXPR_TNUM+79)
386
#define T_ISB_COMOBJ_EXPR (FIRST_EXPR_TNUM+80)
387
388
#define T_FUNCCALL_OPTS (FIRST_EXPR_TNUM+81)
389
#define T_FLOAT_EXPR_EAGER (FIRST_EXPR_TNUM+82)
390
#define T_FLOAT_EXPR_LAZY (FIRST_EXPR_TNUM+83)
391
392
#define T_ELM2_LIST (FIRST_EXPR_TNUM+84)
393
#define T_ELMX_LIST (FIRST_EXPR_TNUM+85)
394
#define T_ASS2_LIST (FIRST_EXPR_TNUM+86)
395
#define T_ASSX_LIST (FIRST_EXPR_TNUM+87)
396
397
#define LAST_EXPR_TNUM T_ASSX_LIST
398
399
400
/****************************************************************************
401
**
402
*F TNUM_EXPR(<expr>) . . . . . . . . . . . . . . . . . type of an expression
403
**
404
** 'TNUM_EXPR' returns the type of the expression <expr>.
405
*/
406
#define TNUM_EXPR(expr) \
407
(IS_REFLVAR( (expr) ) ? T_REFLVAR : \
408
(IS_INTEXPR( (expr) ) ? T_INTEXPR : \
409
TNUM_STAT(expr) ))
410
411
412
/****************************************************************************
413
**
414
*F SIZE_EXPR(<expr>) . . . . . . . . . . . . . . . . . size of an expression
415
**
416
** 'SIZE_EXPR' returns the size of the expression <expr>.
417
**
418
** Note that it is *fatal* to apply 'SIZE_EXPR' to expressions of type
419
** 'T_REFLVAR' or 'T_INTEXPR'.
420
*/
421
#define SIZE_EXPR(expr) SIZE_STAT(expr)
422
423
424
/****************************************************************************
425
**
426
*F ADDR_EXPR(<expr>) . . . . . . . . . . . absolute address of an expression
427
**
428
** 'ADDR_EXPR' returns the absolute address of the memory block of the
429
** expression <expr>.
430
**
431
** Note that it is *fatal* to apply 'ADDR_EXPR' to expressions of type
432
** 'T_REFLVAR' or 'T_INTEXPR'.
433
*/
434
#define ADDR_EXPR(expr) ADDR_STAT(expr)
435
436
437
/****************************************************************************
438
**
439
*F FUNC_CALL(<call>) . . . . . . . . . . . . . function for a function call
440
*F ARGI_CALL(<call>,<i>) . . . . <i>-th formal argument for a function call
441
*F NARG_SIZE_CALL(<size>) . . . . . number of arguments for a function call
442
*F SIZE_NARG_CALL(<narg>) . . . . . . . size of the bag for a function call
443
**
444
** 'FUNC_CALL' returns the expression that should evaluate to the function
445
** for the procedure or function call <call>. This is a legal left value,
446
** so it can be used to set the expression too.
447
**
448
** 'ARGI_CALL' returns the expression that evaluate to the <i>-th actual
449
** argument for the procedure or function call <call>. This is a legal left
450
** value, so it can be used to set the expression too.
451
**
452
** 'NARG_SIZE_CALL' returns the number of arguments in a function call from
453
** the size <size> of the function call bag (as returned by 'SIZE_EXPR').
454
**
455
** 'SIZE_NARG_CALL' returns the size a function call bag should have for a
456
** function call bag with <narg> arguments.
457
*/
458
#define FUNC_CALL(call) (* (ADDR_EXPR((call)) +0 ) )
459
#define ARGI_CALL(call,i) (* (ADDR_EXPR((call)) +0 +(i)) )
460
#define NARG_SIZE_CALL(size) (((size) / sizeof(Expr)) - 1)
461
#define SIZE_NARG_CALL(narg) (((narg) + 1) * sizeof(Expr))
462
463
464
/****************************************************************************
465
**
466
*F ARGI_INFO(<info>,<i>) . . . <i>-th formal argument for an Info statement
467
*F NARG_SIZE_INFO(<size>) . . . . number of arguments for an Info statement
468
*F SIZE_NARG_INFO(<narg>) . . . . . . size of the bag for an Info statement
469
**
470
** 'ARGI_INFO' returns the expression that evaluates to the <i>-th actual
471
** argument for the Info statement <info>. This is a legal left value, so
472
** it can be used to set the expression too.
473
**
474
** 'NARG_SIZE_INFO' returns the number of arguments in a function call from
475
** the size <size> of the function call bag (as returned by 'SIZE_STAT').
476
**
477
** 'SIZE_NARG_INFO' returns the size a function call bag should have for a
478
** function call bag with <narg> arguments.
479
*/
480
#define ARGI_INFO(info,i) (* (ADDR_STAT((info))+(i) -1) )
481
#define NARG_SIZE_INFO(size) ((size) / sizeof(Expr))
482
#define SIZE_NARG_INFO(narg) ((narg) * sizeof(Expr))
483
484
485
/****************************************************************************
486
**
487
*V CodeResult . . . . . . . . . . . . . . . . . . . . . . result of coding
488
**
489
** 'CodeResult' is the result of the coding, i.e., the function that was
490
** coded.
491
*/
492
extern Obj CodeResult;
493
494
495
/****************************************************************************
496
**
497
*F PushStat(<stat>) . . . . . . . . . . . . . push statement onto the stack
498
*F PopStat() . . . . . . . . . . . . . . . . . pop statement from the stack
499
**
500
** 'StackStat' is the stack of statements that have been coded.
501
**
502
** 'CountStat' is the number of statements currently on the statements
503
** stack.
504
**
505
** 'PushStat' pushes the statement <stat> onto the statements stack. The
506
** stack is automatically resized if necessary.
507
**
508
** 'PopStat' returns the top statement from the statements stack and pops
509
** it. It is an error if the stack is empty.
510
*/
511
extern void PushStat (
512
Stat stat );
513
514
extern Stat PopStat ( void );
515
516
517
/****************************************************************************
518
**
519
520
*F * * * * * * * * * * * * * coder functions * * * * * * * * * * * * * * * *
521
*/
522
523
/****************************************************************************
524
**
525
526
*F CodeBegin() . . . . . . . . . . . . . . . . . . . . . . . start the coder
527
*F CodeEnd(<error>) . . . . . . . . . . . . . . . . . . . . stop the coder
528
**
529
** 'CodeBegin' starts the coder. It is called from the immediate
530
** interpreter when he encounters a construct that it cannot immediately
531
** interpret.
532
**
533
** 'CodeEnd' stops the coder. It is called from the immediate interpreter
534
** when he is done with the construct that it cannot immediately interpret.
535
** If <error> is non-zero, a syntax error was detected by the reader, and
536
** the coder should only clean up.
537
**
538
** ...only function expressions inbetween...
539
*/
540
extern void CodeBegin ( void );
541
542
extern UInt CodeEnd (
543
UInt error );
544
545
546
/****************************************************************************
547
**
548
*F CodeFuncCallBegin() . . . . . . . . . . . . . . code function call, begin
549
*F CodeFuncCallEnd(<funccall>,<options>, <nr>) . code function call, end
550
**
551
** 'CodeFuncCallBegin' is an action to code a function call. It is called
552
** by the reader when it encounters the parenthesis '(', i.e., *after* the
553
** function expression is read.
554
**
555
** 'CodeFuncCallEnd' is an action to code a function call. It is called by
556
** the reader when it encounters the parenthesis ')', i.e., *after* the
557
** argument expressions are read. <funccall> is 1 if this is a function
558
** call, and 0 if this is a procedure call. <nr> is the number of
559
** arguments. <options> is 1 if options were present after the ':' in which
560
** case the options have been read already.
561
*/
562
extern void CodeFuncCallBegin ( void );
563
564
extern void CodeFuncCallEnd (
565
UInt funccall,
566
UInt options,
567
UInt nr );
568
569
570
/****************************************************************************
571
**
572
*F CodeFuncExprBegin(<narg>,<nloc>,<nams>,<startline>) . code function expression, begin
573
*F CodeFuncExprEnd(<nr>) . . . . . . . . . . . code function expression, end
574
**
575
** 'CodeFuncExprBegin' is an action to code a function expression. It is
576
** called when the reader encounters the beginning of a function expression.
577
** <narg> is the number of arguments (-1 if the function takes a variable
578
** number of arguments), <nloc> is the number of locals, <nams> is a list of
579
** local variable names.
580
**
581
** 'CodeFuncExprEnd' is an action to code a function expression. It is
582
** called when the reader encounters the end of a function expression. <nr>
583
** is the number of statements in the body of the function.
584
**
585
*/
586
extern void CodeFuncExprBegin (
587
Int narg,
588
Int nloc,
589
Obj nams,
590
Int startLine);
591
592
extern void CodeFuncExprEnd (
593
UInt nr,
594
UInt mapsto );
595
596
/****************************************************************************
597
**
598
*F CodeFuncCallOptionsBegin() . . . . . . . . . . . . . code options, begin
599
*F CodeFuncCallOptionsBeginElmName(<rnam>). . . code options, begin element
600
*F CodeFuncCallOptionsBeginElmExpr() . .. . . . .code options, begin element
601
*F CodeFuncCallOptionsEndElm() . . .. . . . . . . code options, end element
602
*F CodeFuncCallOptionsEndElmEmpty() .. . . . . . .code options, end element
603
*F CodeFuncCallOptionsEnd(<nr>) . . . . . . . . . . . . . code options, end
604
**
605
** The net effect of all of these is to leave a record expression on the stack
606
** containing the options record. It will be picked up by
607
** CodeFuncCallEnd()
608
**
609
*/
610
extern void CodeFuncCallOptionsBegin ( void );
611
612
613
extern void CodeFuncCallOptionsBeginElmName (
614
UInt rnam );
615
616
extern void CodeFuncCallOptionsBeginElmExpr ( void );
617
618
extern void CodeFuncCallOptionsEndElm ( void );
619
620
621
extern void CodeFuncCallOptionsEndElmEmpty ( void );
622
623
extern void CodeFuncCallOptionsEnd ( UInt nr );
624
625
626
/****************************************************************************
627
**
628
*F CodeIfBegin() . . . . . . . . . . . code if-statement, begin of statement
629
*F CodeIfElif() . . . . . . . . . . code if-statement, begin of elif-branch
630
*F CodeIfElse() . . . . . . . . . . code if-statement, begin of else-branch
631
*F CodeIfBeginBody() . . . . . . . . . . . code if-statement, begin of body
632
*F CodeIfEndBody(<nr>) . . . . . . . . . . . code if-statement, end of body
633
*F CodeIfEnd(<nr>) . . . . . . . . . . . code if-statement, end of statement
634
**
635
** 'CodeIfBegin' is an action to code an if-statement. It is called when
636
** the reader encounters the 'if', i.e., *before* the condition is read.
637
**
638
** 'CodeIfElif' is an action to code an if-statement. It is called when the
639
** reader encounters an 'elif', i.e., *before* the condition is read.
640
**
641
** 'CodeIfElse' is an action to code an if-statement. It is called when the
642
** reader encounters an 'else'.
643
**
644
** 'CodeIfBeginBody' is an action to code an if-statement. It is called
645
** when the reader encounters the beginning of the statement body of an
646
** 'if', 'elif', or 'else' branch, i.e., *after* the condition is read.
647
**
648
** 'CodeIfEndBody' is an action to code an if-statement. It is called when
649
** the reader encounters the end of the statements body of an 'if', 'elif',
650
** or 'else' branch. <nr> is the number of statements in the body.
651
**
652
** 'CodeIfEnd' is an action to code an if-statement. It is called when the
653
** reader encounters the end of the statement. <nr> is the number of 'if',
654
** 'elif', or 'else' branches.
655
*/
656
extern void CodeIfBegin ( void );
657
658
extern void CodeIfElif ( void );
659
660
extern void CodeIfElse ( void );
661
662
extern void CodeIfBeginBody ( void );
663
664
extern void CodeIfEndBody (
665
UInt nr );
666
667
extern void CodeIfEnd (
668
UInt nr );
669
670
671
/****************************************************************************
672
**
673
*F CodeForBegin() . . . . . . . . . code for-statement, begin of statement
674
*F CodeForIn() . . . . . . . . . . . . . . . . code for-statement, 'in' read
675
*F CodeForBeginBody() . . . . . . . . . . code for-statement, begin of body
676
*F CodeForEndBody(<nr>) . . . . . . . . . . code for-statement, end of body
677
*F CodeForEnd() . . . . . . . . . . . code for-statement, end of statement
678
**
679
** 'CodeForBegin' is an action to code a for-statement. It is called when
680
** the reader encounters the 'for', i.e., *before* the variable is read.
681
**
682
** 'CodeForIn' is an action to code a for-statement. It is called when the
683
** reader encounters the 'in', i.e., *after* the variable is read, but
684
** *before* the list expression is read.
685
**
686
** 'CodeForBeginBody' is an action to code a for-statement. It is called
687
** when the reader encounters the beginning of the statement body, i.e.,
688
** *after* the list expression is read.
689
**
690
** 'CodeForEndBody' is an action to code a for-statement. It is called when
691
** the reader encounters the end of the statement body. <nr> is the number
692
** of statements in the body.
693
**
694
** 'CodeForEnd' is an action to code a for-statement. It is called when the
695
** reader encounters the end of the statement, i.e., immediately after
696
** 'CodeForEndBody'.
697
*/
698
extern void CodeForBegin ( void );
699
700
extern void CodeForIn ( void );
701
702
extern void CodeForBeginBody ( void );
703
704
extern void CodeForEndBody (
705
UInt nr );
706
707
extern void CodeForEnd ( void );
708
709
/****************************************************************************
710
**
711
*F CodeAtomicBegin() . . . . . . . code atomic-statement, begin of statement
712
*F CodeAtomicBeginBody() . . . . . . . . code atomic-statement, begin of body
713
*F CodeAtomicEndBody( <nr> ) . . . . . . . code atomic-statement, end of body
714
*F CodeAtomicEnd() . . . . . . . . . code atomic-statement, end of statement
715
**
716
** 'CodeAtomicBegin' is an action to code a atomic-statement. It is called
717
** when the reader encounters the 'atomic', i.e., *before* the condition is
718
** read.
719
**
720
** 'CodeAtomicBeginBody' is an action to code a atomic-statement. It is
721
** called when the reader encounters the beginning of the statement body,
722
** i.e., *after* the condition is read.
723
**
724
** 'CodeAtomicEndBody' is an action to code a atomic-statement. It is called
725
** when the reader encounters the end of the statement body. <nr> is the
726
** number of statements in the body.
727
**
728
** 'CodeAtomicEnd' is an action to code a atomic-statement. It is called when
729
** the reader encounters the end of the statement, i.e., immediate after
730
** 'CodeAtomicEndBody'.
731
**
732
** These functions are just placeholders for the future HPC-GAP code.
733
*/
734
735
void CodeAtomicBegin ( void );
736
737
void CodeAtomicBeginBody ( UInt nrexprs );
738
739
void CodeAtomicEndBody (
740
UInt nrstats );
741
void CodeAtomicEnd ( void );
742
743
/****************************************************************************
744
**
745
*F CodeQualifiedExprBegin() . . . code readonly/readwrite expression start
746
*F CodeQualifiedExprEnd() . . . . . code readonly/readwrite expression end
747
**
748
*/
749
750
void CodeQualifiedExprBegin(UInt qual);
751
752
void CodeQualifiedExprEnd( void );
753
754
755
/****************************************************************************
756
**
757
*F CodeWhileBegin() . . . . . . . code while-statement, begin of statement
758
*F CodeWhileBeginBody() . . . . . . . . code while-statement, begin of body
759
*F CodeWhileEndBody(<nr>) . . . . . . . . code while-statement, end of body
760
*F CodeWhileEnd() . . . . . . . . . code while-statement, end of statement
761
**
762
** 'CodeWhileBegin' is an action to code a while-statement. It is called
763
** when the reader encounters the 'while', i.e., *before* the condition is
764
** read.
765
**
766
** 'CodeWhileBeginBody' is an action to code a while-statement. It is
767
** called when the reader encounters the beginning of the statement body,
768
** i.e., *after* the condition is read.
769
**
770
** 'CodeWhileEndBody' is an action to code a while-statement. It is called
771
** when the reader encounters the end of the statement body. <nr> is the
772
** number of statements in the body.
773
**
774
** 'CodeWhileEnd' is an action to code a while-statement. It is called when
775
** the reader encounters the end of the statement, i.e., immediate after
776
** 'CodeWhileEndBody'.
777
*/
778
extern void CodeWhileBegin ( void );
779
780
extern void CodeWhileBeginBody ( void );
781
782
extern void CodeWhileEndBody (
783
UInt nr );
784
785
extern void CodeWhileEnd ( void );
786
787
788
/****************************************************************************
789
**
790
*F CodeRepeatBegin() . . . . . . . code repeat-statement, begin of statement
791
*F CodeRepeatBeginBody() . . . . . . . code repeat-statement, begin of body
792
*F CodeRepeatEndBody(<nr>) . . . . . . . code repeat-statement, end of body
793
*F CodeRepeatEnd() . . . . . . . . . code repeat-statement, end of statement
794
**
795
** 'CodeRepeatBegin' is an action to code a repeat-statement. It is called
796
** when the reader encounters the 'repeat'.
797
**
798
** 'CodeRepeatBeginBody' is an action to code a repeat-statement. It is
799
** called when the reader encounters the beginning of the statement body,
800
** i.e., immediately after 'CodeRepeatBegin'.
801
**
802
** 'CodeRepeatEndBody' is an action to code a repeat-statement. It is
803
** called when the reader encounters the end of the statement body, i.e.,
804
** *before* the condition is read. <nr> is the number of statements in the
805
** body.
806
**
807
** 'CodeRepeatEnd' is an action to code a repeat-statement. It is called
808
** when the reader encounters the end of the statement, i.e., *after* the
809
** condition is read.
810
*/
811
extern void CodeRepeatBegin ( void );
812
813
extern void CodeRepeatBeginBody ( void );
814
815
extern void CodeRepeatEndBody (
816
UInt nr );
817
818
extern void CodeRepeatEnd ( void );
819
820
821
/****************************************************************************
822
**
823
*F CodeBreak() . . . . . . . . . . . . . . . . . . . . code break-statement
824
**
825
** 'CodeBreak' is the action to code a break-statement. It is called when
826
** the reader encounters a 'break;'.
827
*/
828
extern void CodeBreak ( void );
829
830
831
/****************************************************************************
832
**
833
*F CodeReturnObj() . . . . . . . . . . . . . . . code return-value-statement
834
**
835
** 'CodeReturnObj' is the action to code a return-value-statement. It is
836
** called when the reader encounters a 'return <expr>;', but *after* reading
837
** the expression <expr>.
838
*/
839
extern void CodeReturnObj ( void );
840
841
842
/****************************************************************************
843
**
844
*F CodeReturnVoid() . . . . . . . . . . . . . . code return-void-statement
845
**
846
** 'CodeReturnVoid' is the action to code a return-void-statement. It is
847
** called when the reader encounters a 'return;'.
848
*/
849
extern void CodeReturnVoid ( void );
850
851
852
/****************************************************************************
853
**
854
*F CodeOr() . . . . . . . . . . . . . . . . . . . . . . code or-expression
855
*F CodeAnd() . . . . . . . . . . . . . . . . . . . . . . code and-expression
856
*F CodeNot() . . . . . . . . . . . . . . . . . . . . . . code not-expression
857
*F CodeEq() . . . . . . . . . . . . . . . . . . . . . . . code =-expression
858
*F CodeNe() . . . . . . . . . . . . . . . . . . . . . . code <>-expression
859
*F CodeLt() . . . . . . . . . . . . . . . . . . . . . . . code <-expression
860
*F CodeGe() . . . . . . . . . . . . . . . . . . . . . . code >=-expression
861
*F CodeGt() . . . . . . . . . . . . . . . . . . . . . . . code >-expression
862
*F CodeLe() . . . . . . . . . . . . . . . . . . . . . . code <=-expression
863
*F CodeIn() . . . . . . . . . . . . . . . . . . . . . . code in-expression
864
*F CodeSum() . . . . . . . . . . . . . . . . . . . . . . . code +-expression
865
*F CodeAInv() . . . . . . . . . . . . . . . . . . . code unary --expression
866
*F CodeDiff() . . . . . . . . . . . . . . . . . . . . . . code --expression
867
*F CodeProd() . . . . . . . . . . . . . . . . . . . . . . code *-expression
868
*F CodeInv() . . . . . . . . . . . . . . . . . . . . . . code ^-1-expression
869
*F CodeQuo() . . . . . . . . . . . . . . . . . . . . . . . code /-expression
870
*F CodeMod() . . . . . . . . . . . . . . . . . . . . . . code mod-expression
871
*F CodePow() . . . . . . . . . . . . . . . . . . . . . . . code ^-expression
872
**
873
** 'CodeOr', 'CodeAnd', 'CodeNot', 'CodeEq', 'CodeNe', 'CodeGt', 'CodeGe',
874
** 'CodeIn', 'CodeSum', 'CodeDiff', 'CodeProd', 'CodeQuo', 'CodeMod', and
875
** 'CodePow' are the actions to code the respective operator expressions.
876
** They are called by the reader *after* *both* operands are read.
877
*/
878
extern void CodeOrL ( void );
879
880
extern void CodeOr ( void );
881
882
extern void CodeAndL ( void );
883
884
extern void CodeAnd ( void );
885
886
extern void CodeNot ( void );
887
888
extern void CodeEq ( void );
889
890
extern void CodeNe ( void );
891
892
extern void CodeLt ( void );
893
894
extern void CodeGe ( void );
895
896
extern void CodeGt ( void );
897
898
extern void CodeLe ( void );
899
900
extern void CodeIn ( void );
901
902
extern void CodeSum ( void );
903
904
extern void CodeAInv ( void );
905
906
extern void CodeDiff ( void );
907
908
extern void CodeProd ( void );
909
910
extern void CodeInv ( void );
911
912
extern void CodeQuo ( void );
913
914
extern void CodeMod ( void );
915
916
extern void CodePow ( void );
917
918
919
/****************************************************************************
920
**
921
*F CodeIntExpr(<str>) . . . . . . . . . . . code literal integer expression
922
**
923
** 'CodeIntExpr' is the action to code a literal integer expression. <str>
924
** is the integer as a (null terminated) C character string.
925
*/
926
extern void CodeIntExpr (
927
Char * str );
928
extern void CodeLongIntExpr (
929
Obj string );
930
931
/****************************************************************************
932
**
933
*F CodeTrueExpr() . . . . . . . . . . . . . . code literal true expression
934
**
935
** 'CodeTrueExpr' is the action to code a literal true expression.
936
*/
937
extern void CodeTrueExpr ( void );
938
939
940
/****************************************************************************
941
**
942
*F CodeFalseExpr() . . . . . . . . . . . . . . code literal false expression
943
**
944
** 'CodeFalseExpr' is the action to code a literal false expression.
945
*/
946
extern void CodeFalseExpr ( void );
947
948
949
/****************************************************************************
950
**
951
*F CodeCharExpr(<chr>) . . . . . . . . . . code literal character expression
952
**
953
** 'CodeCharExpr' is the action to code a literal character expression.
954
** <chr> is the C character.
955
*/
956
extern void CodeCharExpr (
957
Char chr );
958
959
960
/****************************************************************************
961
**
962
*F CodePermCycle(<nrx>,<nrc>) . . . . . code literal permutation expression
963
*F CodePerm(<nrc>) . . . . . . . . . . . code literal permutation expression
964
**
965
** 'CodePermCycle' is an action to code a literal permutation expression.
966
** It is called when one cycles is read completely. <nrc> is the number of
967
** elements in that cycle. <nrx> is the number of that cycles (i.e., 1 for
968
** the first cycle, 2 for the second, and so on).
969
**
970
** 'CodePerm' is an action to code a literal permutation expression. It is
971
** called when the permutation is read completely. <nrc> is the number of
972
** cycles.
973
*/
974
extern void CodePermCycle (
975
UInt nrx,
976
UInt nrc );
977
978
extern void CodePerm (
979
UInt nrc );
980
981
982
/****************************************************************************
983
**
984
*F CodeListExprBegin(<top>) . . . . . . . . . . code list expression, begin
985
*F CodeListExprBeginElm(<pos>) . . . . . code list expression, begin element
986
*F CodeListExprEndElm() . . . . . . . . . code list expression, end element
987
*F CodeListExprEnd(<nr>,<range>,<top>,<tilde>) . . code list expression, end
988
*/
989
extern void CodeListExprBegin (
990
UInt top );
991
992
extern void CodeListExprBeginElm (
993
UInt pos );
994
995
extern void CodeListExprEndElm ( void );
996
997
extern void CodeListExprEnd (
998
UInt nr,
999
UInt range,
1000
UInt top,
1001
UInt tilde );
1002
1003
1004
/****************************************************************************
1005
**
1006
*F CodeStringExpr(<str>) . . . . . . . . . . code literal string expression
1007
*/
1008
extern void CodeStringExpr (
1009
Obj str );
1010
1011
/****************************************************************************
1012
**
1013
*F CodeFloatExpr(<str>) . . . . . . . . . . code literal float expression
1014
*/
1015
extern void CodeFloatExpr (
1016
Char * str );
1017
1018
extern void CodeLongFloatExpr (
1019
Obj str );
1020
1021
1022
/****************************************************************************
1023
**
1024
*F CodeRecExprBegin(<top>) . . . . . . . . . . code record expression, begin
1025
*F CodeRecExprBeginElmName(<rnam>) . . code record expression, begin element
1026
*F CodeRecExprBeginElmExpr() . . . . . code record expression, begin element
1027
*F CodeRecExprEndElmExpr() . . . . . . . code record expression, end element
1028
*F CodeRecExprEnd(<nr>,<top>,<tilde>) . . . . . code record expression, end
1029
*/
1030
extern void CodeRecExprBegin (
1031
UInt top );
1032
1033
extern void CodeRecExprBeginElmName (
1034
UInt rnam );
1035
1036
extern void CodeRecExprBeginElmExpr ( void );
1037
1038
extern void CodeRecExprEndElm ( void );
1039
1040
extern void CodeRecExprEnd (
1041
UInt nr,
1042
UInt top,
1043
UInt tilde );
1044
1045
1046
/****************************************************************************
1047
**
1048
*F CodeAssLVar(<lvar>) . . . . . . . . . . . . . . code assignment to local
1049
**
1050
** 'CodeAssLVar' is the action to code an assignment to the local variable
1051
** <lvar> (given by its index). It is called by the reader *after* the
1052
** right hand side expression is read.
1053
**
1054
** An assignment to a local variable is represented by a bag with two
1055
** subexpressions. The *first* is the local variable, the *second* is the
1056
** right hand side expression.
1057
*/
1058
extern void CodeAssLVar (
1059
UInt lvar );
1060
1061
extern void CodeUnbLVar (
1062
UInt lvar );
1063
1064
1065
/****************************************************************************
1066
**
1067
*F CodeRefLVar(<lvar>) . . . . . . . . . . . . . . . code reference to local
1068
**
1069
** 'CodeRefLVar' is the action to code a reference to the local variable
1070
** <lvar> (given by its index). It is called by the reader when it
1071
** encounters a local variable.
1072
**
1073
** A reference to a local variable is represented immediately (see
1074
** 'REFLVAR_LVAR').
1075
*/
1076
extern void CodeRefLVar (
1077
UInt lvar );
1078
1079
extern void CodeIsbLVar (
1080
UInt lvar );
1081
1082
1083
/****************************************************************************
1084
**
1085
*F CodeAssHVar(<hvar>) . . . . . . . . . . . . . . code assignment to higher
1086
**
1087
** 'CodeAssHVar' is the action to code an assignment to the higher variable
1088
** <hvar> (given by its level and index). It is called by the reader
1089
** *after* the right hand side expression is read.
1090
**
1091
** An assignment to a higher variable is represented by a statement bag with
1092
** two subexpressions. The *first* is the higher variable, the *second* is
1093
** the right hand side expression.
1094
*/
1095
extern void CodeAssHVar (
1096
UInt hvar );
1097
1098
extern void CodeUnbHVar (
1099
UInt hvar );
1100
1101
1102
/****************************************************************************
1103
**
1104
*F CodeRefHVar(<hvar>) . . . . . . . . . . . . . . code reference to higher
1105
**
1106
** 'CodeRefHVar' is the action to code a reference to the higher variable
1107
** <hvar> (given by its level and index). It is called by the reader when
1108
** it encounters a higher variable.
1109
**
1110
** A reference to a higher variable is represented by an expression bag with
1111
** one subexpression. This is the higher variable.
1112
*/
1113
extern void CodeRefHVar (
1114
UInt hvar );
1115
1116
extern void CodeIsbHVar (
1117
UInt hvar );
1118
1119
1120
/****************************************************************************
1121
**
1122
*F CodeAssGVar(<gvar>) . . . . . . . . . . . . . . code assignment to global
1123
**
1124
** 'CodeAssGVar' is the action to code an assignment to the global variable
1125
** <gvar>. It is called by the reader *after* the right hand side
1126
** expression is read.
1127
**
1128
** An assignment to a global variable is represented by a statement bag with
1129
** two subexpressions. The *first* is the global variable, the *second* is
1130
** the right hand side expression.
1131
*/
1132
extern void CodeAssGVar (
1133
UInt gvar );
1134
1135
extern void CodeUnbGVar (
1136
UInt gvar );
1137
1138
1139
/****************************************************************************
1140
**
1141
*F CodeRefGVar(<gvar>) . . . . . . . . . . . . . . code reference to global
1142
**
1143
** 'CodeRefGVar' is the action to code a reference to the global variable
1144
** <gvar>. It is called by the reader when it encounters a global variable.
1145
**
1146
** A reference to a global variable is represented by an expression bag with
1147
** one subexpression. This is the global variable.
1148
*/
1149
extern void CodeRefGVar (
1150
UInt gvar );
1151
1152
extern void CodeIsbGVar (
1153
UInt gvar );
1154
1155
1156
/****************************************************************************
1157
**
1158
*F CodeAssList() . . . . . . . . . . . . . . . . . code assignment to a list
1159
*F CodeAsssList() . . . . . . . . . . . code multiple assignment to a list
1160
*F CodeAssListLevel(<level>) . . . . . . . code assignment to several lists
1161
*F CodeAsssListLevel(<level>) . . code multiple assignment to several lists
1162
*/
1163
extern void CodeAssList ( Int narg );
1164
1165
extern void CodeAsssList ( void );
1166
1167
extern void CodeAssListLevel ( Int narg,
1168
UInt level );
1169
1170
extern void CodeAsssListLevel (
1171
UInt level );
1172
1173
extern void CodeUnbList ( Int narg );
1174
1175
1176
/****************************************************************************
1177
**
1178
*F CodeElmList() . . . . . . . . . . . . . . . . . code selection of a list
1179
*F CodeElmsList() . . . . . . . . . . . . code multiple selection of a list
1180
*F CodeElmListLevel(<level>) . . . . . . . . code selection of several lists
1181
*F CodeElmsListLevel(<level>) . . code multiple selection of several lists
1182
*/
1183
extern void CodeElmList ( Int narg );
1184
1185
extern void CodeElmsList ( void );
1186
1187
extern void CodeElmListLevel (
1188
Int narg,
1189
UInt level);
1190
1191
extern void CodeElmsListLevel (
1192
UInt level );
1193
1194
extern void CodeIsbList ( Int narg );
1195
1196
1197
/****************************************************************************
1198
**
1199
*F CodeAssRecName(<rnam>) . . . . . . . . . . . code assignment to a record
1200
*F CodeAssRecExpr() . . . . . . . . . . . . . . code assignment to a record
1201
*/
1202
extern void CodeAssRecName (
1203
UInt rnam );
1204
1205
extern void CodeAssRecExpr ( void );
1206
1207
extern void CodeUnbRecName (
1208
UInt rnam );
1209
1210
extern void CodeUnbRecExpr ( void );
1211
1212
1213
/****************************************************************************
1214
**
1215
*F CodeElmRecName(<rnam>) . . . . . . . . . . . code selection of a record
1216
*F CodeElmRecExpr() . . . . . . . . . . . . . . code selection of a record
1217
*/
1218
extern void CodeElmRecName (
1219
UInt rnam );
1220
1221
extern void CodeElmRecExpr ( void );
1222
1223
extern void CodeIsbRecName (
1224
UInt rnam );
1225
1226
extern void CodeIsbRecExpr ( void );
1227
1228
1229
/****************************************************************************
1230
**
1231
*F CodeAssPosObj() . . . . . . . . . . . . . . . . code assignment to a list
1232
*F CodeAsssPosObj() . . . . . . . . . . code multiple assignment to a list
1233
*F CodeAssPosObjLevel(<level>) . . . . . . code assignment to several lists
1234
*F CodeAsssPosObjLevel(<level>) . code multiple assignment to several lists
1235
*/
1236
extern void CodeAssPosObj ( void );
1237
1238
extern void CodeAsssPosObj ( void );
1239
1240
extern void CodeAssPosObjLevel (
1241
UInt level );
1242
1243
extern void CodeAsssPosObjLevel (
1244
UInt level );
1245
1246
extern void CodeUnbPosObj ( void );
1247
1248
1249
/****************************************************************************
1250
**
1251
*F CodeElmPosObj() . . . . . . . . . . . . . . . . code selection of a list
1252
*F CodeElmsPosObj() . . . . . . . . . . . code multiple selection of a list
1253
*F CodeElmPosObjLevel(<level>) . . . . . . . code selection of several lists
1254
*F CodeElmsPosObjLevel(<level>) . code multiple selection of several lists
1255
*/
1256
extern void CodeElmPosObj ( void );
1257
1258
extern void CodeElmsPosObj ( void );
1259
1260
extern void CodeElmPosObjLevel (
1261
UInt level );
1262
1263
extern void CodeElmsPosObjLevel (
1264
UInt level );
1265
1266
extern void CodeIsbPosObj ( void );
1267
1268
1269
/****************************************************************************
1270
**
1271
*F CodeAssComObjName(<rnam>) . . . . . . . . . . code assignment to a record
1272
*F CodeAssComObjExpr() . . . . . . . . . . . . . code assignment to a record
1273
*/
1274
extern void CodeAssComObjName (
1275
UInt rnam );
1276
1277
extern void CodeAssComObjExpr ( void );
1278
1279
extern void CodeUnbComObjName (
1280
UInt rnam );
1281
1282
extern void CodeUnbComObjExpr ( void );
1283
1284
1285
/****************************************************************************
1286
**
1287
*F CodeElmComObjName(<rnam>) . . . . . . . . . . code selection of a record
1288
*F CodeElmComObjExpr() . . . . . . . . . . . . . code selection of a record
1289
*/
1290
extern void CodeElmComObjName (
1291
UInt rnam );
1292
1293
extern void CodeElmComObjExpr ( void );
1294
1295
extern void CodeIsbComObjName (
1296
UInt rnam );
1297
1298
extern void CodeIsbComObjExpr ( void );
1299
1300
/****************************************************************************
1301
**
1302
*F CodeEmpty() . . . . code an empty statement
1303
**
1304
*/
1305
1306
extern void CodeEmpty( void );
1307
1308
/****************************************************************************
1309
**
1310
*F CodeInfoBegin() . . . . . . . . . . . . . start coding of Info statement
1311
*F CodeInfoMiddle() . . . . . . . . . shift to coding printable arguments
1312
*F CodeInfoEnd( <narg> ) . . Info statement complete, <narg> things to print
1313
**
1314
** These actions deal with the Info statement, which is coded specially,
1315
** because not all of its arguments are always evaluated.
1316
*/
1317
extern void CodeInfoBegin ( void );
1318
1319
extern void CodeInfoMiddle ( void );
1320
1321
extern void CodeInfoEnd (
1322
UInt narg );
1323
1324
1325
/****************************************************************************
1326
**
1327
*F CodeAssertBegin() . . . . . . . start interpretation of Assert statement
1328
*F CodeAsseerAfterLevel() . . called after the first argument has been read
1329
*F CodeAssertAfterCondition() called after the second argument has been read
1330
*F CodeAssertEnd2Args() . . . . called after reading the closing parenthesis
1331
*F CodeAssertEnd3Args() . . . . called after reading the closing parenthesis
1332
*/
1333
extern void CodeAssertBegin ( void );
1334
1335
extern void CodeAssertAfterLevel ( void );
1336
1337
extern void CodeAssertAfterCondition ( void );
1338
1339
extern void CodeAssertEnd2Args ( void );
1340
1341
extern void CodeAssertEnd3Args ( void );
1342
1343
/* CodeContinue() . . . . . . . . . . . . . code continue-statement */
1344
extern void CodeContinue ( void );
1345
1346
1347
1348
/****************************************************************************
1349
**
1350
1351
*F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * *
1352
*/
1353
1354
/****************************************************************************
1355
**
1356
1357
*F InitInfoCode() . . . . . . . . . . . . . . . . . table of init functions
1358
*/
1359
StructInitInfo * InitInfoCode ( void );
1360
1361
1362
1363
#endif // GAP_CODE_H
1364
1365
/****************************************************************************
1366
**
1367
1368
*E code.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
1369
*/
1370
1371