Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/* AUTOMATICALLY GENERATED BY make_tdf VERSION 2.0 FROM TDF 4.1 */
32
 
33
#include "config.h"
34
#include "types.h"
35
#include "de_types.h"
36
#include "enc_types.h"
37
#include "check.h"
38
#include "decode.h"
39
#include "de_capsule.h"
40
#include "de_unit.h"
41
#include "encode.h"
42
#include "node.h"
43
#include "read.h"
44
#include "shape.h"
45
#include "table.h"
46
#include "tdf.h"
47
#include "utility.h"
48
 
49
 
50
/* INITIALISE CONSTRUCTS */
51
 
52
void init_constructs
53
    PROTO_Z ()
54
{
55
    sortname s ;
56
 
57
    s = SORT_access ;
58
    sort_letters [s] = 'u' ;
59
    sort_encoding [s] = 4 ;
60
    sort_extension [s] = 1 ;
61
    sort_decode [s] = de_access ;
62
    sort_read [s] = read_access ;
63
    new_sort ( s, 14 ) ;
64
    new_cons ( "access_apply_token", s, 1, "!" ) ;
65
    sort_tokens [s] = 1 ;
66
    new_cons ( "access_cond", s, 2, "x@[u]@[u]" ) ;
67
    sort_conds [s] = 2 ;
68
    new_cons ( "add_accesses", s, 3, "uu" ) ;
69
    new_cons ( "constant", s, 4, ( char * ) null ) ;
70
    new_cons ( "long_jump_access", s, 5, ( char * ) null ) ;
71
    new_cons ( "no_other_read", s, 6, ( char * ) null ) ;
72
    new_cons ( "no_other_write", s, 7, ( char * ) null ) ;
73
    new_cons ( "out_par", s, 8, ( char * ) null ) ;
74
    new_cons ( "preserve", s, 9, ( char * ) null ) ;
75
    new_cons ( "register", s, 10, ( char * ) null ) ;
76
    new_cons ( "standard_access", s, 11, ( char * ) null ) ;
77
    new_cons ( "used_as_volatile", s, 12, ( char * ) null ) ;
78
    new_cons ( "visible", s, 13, ( char * ) null ) ;
79
 
80
    s = SORT_al_tag ;
81
    sort_letters [s] = 'A' ;
82
    sort_encoding [s] = 1 ;
83
    sort_extension [s] = 1 ;
84
    sort_decode [s] = de_al_tag ;
85
    sort_read [s] = read_al_tag ;
86
    new_sort ( s, 3 ) ;
87
    new_cons ( "al_tag_apply_token", s, 2, "!" ) ;
88
    sort_tokens [s] = 2 ;
89
    new_cons ( "make_al_tag", s, 1, "i" ) ;
90
 
91
    s = SORT_alignment ;
92
    sort_letters [s] = 'a' ;
93
    sort_encoding [s] = 4 ;
94
    sort_extension [s] = 1 ;
95
    sort_decode [s] = de_alignment ;
96
    sort_read [s] = read_alignment ;
97
    new_sort ( s, 13 ) ;
98
    new_cons ( "alignment_apply_token", s, 1, "!" ) ;
99
    sort_tokens [s] = 1 ;
100
    new_cons ( "alignment_cond", s, 2, "x@[a]@[a]" ) ;
101
    sort_conds [s] = 2 ;
102
    new_cons ( "alignment", s, 3, "S" ) ;
103
    new_cons ( "alloca_alignment", s, 4, ( char * ) null ) ;
104
    new_cons ( "callees_alignment", s, 5, "b" ) ;
105
    new_cons ( "callers_alignment", s, 6, "b" ) ;
106
    new_cons ( "code_alignment", s, 7, ( char * ) null ) ;
107
    new_cons ( "locals_alignment", s, 8, ( char * ) null ) ;
108
    new_cons ( "obtain_al_tag", s, 9, "A" ) ;
109
    new_cons ( "parameter_alignment", s, 10, "S" ) ;
110
    new_cons ( "unite_alignments", s, 11, "aa" ) ;
111
    new_cons ( "var_param_alignment", s, 12, ( char * ) null ) ;
112
 
113
    s = SORT_bitfield_variety ;
114
    sort_letters [s] = 'B' ;
115
    sort_encoding [s] = 2 ;
116
    sort_extension [s] = 1 ;
117
    sort_decode [s] = de_bitfield_variety ;
118
    sort_read [s] = read_bitfield_variety ;
119
    new_sort ( s, 4 ) ;
120
    new_cons ( "bfvar_apply_token", s, 1, "!" ) ;
121
    sort_tokens [s] = 1 ;
122
    new_cons ( "bfvar_cond", s, 2, "x@[B]@[B]" ) ;
123
    sort_conds [s] = 2 ;
124
    new_cons ( "bfvar_bits", s, 3, "bn" ) ;
125
 
126
    s = SORT_bool ;
127
    sort_letters [s] = 'b' ;
128
    sort_encoding [s] = 3 ;
129
    sort_extension [s] = 1 ;
130
    sort_decode [s] = de_bool ;
131
    sort_read [s] = read_bool ;
132
    new_sort ( s, 5 ) ;
133
    new_cons ( "bool_apply_token", s, 1, "!" ) ;
134
    sort_tokens [s] = 1 ;
135
    new_cons ( "bool_cond", s, 2, "x@[b]@[b]" ) ;
136
    sort_conds [s] = 2 ;
137
    new_cons ( "false", s, 3, ( char * ) null ) ;
138
    new_cons ( "true", s, 4, ( char * ) null ) ;
139
 
140
    s = SORT_callees ;
141
    sort_letters [s] = 'q' ;
142
    sort_encoding [s] = 2 ;
143
    sort_extension [s] = 1 ;
144
    sort_decode [s] = de_callees ;
145
    sort_read [s] = read_callees ;
146
    new_sort ( s, 4 ) ;
147
    new_cons ( "make_callee_list", s, 1, "*[x]" ) ;
148
    new_cons ( "make_dynamic_callees", s, 2, "xx" ) ;
149
    new_cons ( "same_callees", s, 3, ( char * ) null ) ;
150
 
151
    s = SORT_error_code ;
152
    sort_letters [s] = 'c' ;
153
    sort_encoding [s] = 2 ;
154
    sort_extension [s] = 1 ;
155
    sort_decode [s] = de_error_code ;
156
    sort_read [s] = read_error_code ;
157
    new_sort ( s, 4 ) ;
158
    new_cons ( "nil_access", s, 1, ( char * ) null ) ;
159
    new_cons ( "overflow", s, 2, ( char * ) null ) ;
160
    new_cons ( "stack_overflow", s, 3, ( char * ) null ) ;
161
 
162
    s = SORT_error_treatment ;
163
    sort_letters [s] = 'e' ;
164
    sort_encoding [s] = 3 ;
165
    sort_extension [s] = 1 ;
166
    sort_decode [s] = de_error_treatment ;
167
    sort_read [s] = read_error_treatment ;
168
    new_sort ( s, 8 ) ;
169
    new_cons ( "errt_apply_token", s, 1, "!" ) ;
170
    sort_tokens [s] = 1 ;
171
    new_cons ( "errt_cond", s, 2, "x@[e]@[e]" ) ;
172
    sort_conds [s] = 2 ;
173
    new_cons ( "continue", s, 3, ( char * ) null ) ;
174
    new_cons ( "error_jump", s, 4, "l" ) ;
175
    new_cons ( "trap", s, 5, "*[c]" ) ;
176
    new_cons ( "wrap", s, 6, ( char * ) null ) ;
177
    new_cons ( "impossible", s, 7, ( char * ) null ) ;
178
 
179
    s = SORT_exp ;
180
    sort_letters [s] = 'x' ;
181
    sort_encoding [s] = 7 ;
182
    sort_extension [s] = 1 ;
183
    sort_decode [s] = de_exp ;
184
    sort_read [s] = read_exp ;
185
    new_sort ( s, 117 ) ;
186
    new_cons ( "exp_apply_token", s, 1, "!" ) ;
187
    sort_tokens [s] = 1 ;
188
    new_cons ( "exp_cond", s, 2, "x@[x]@[x]" ) ;
189
    sort_conds [s] = 2 ;
190
    new_cons ( "abs", s, 3, "ex" ) ;
191
    new_cons ( "add_to_ptr", s, 4, "xx" ) ;
192
    new_cons ( "and", s, 5, "xx" ) ;
193
    new_cons ( "apply_proc", s, 6, "Sx*[x]?[x]" ) ;
194
    new_cons ( "apply_general_proc", s, 7, "S?[P]x*[?[t&]x]q{x}" ) ;
195
    new_cons ( "assign", s, 8, "xx" ) ;
196
    new_cons ( "assign_with_mode", s, 9, "mxx" ) ;
197
    new_cons ( "bitfield_assign", s, 10, "xxx" ) ;
198
    new_cons ( "bitfield_assign_with_mode", s, 11, "mxxx" ) ;
199
    new_cons ( "bitfield_contents", s, 12, "Bxx" ) ;
200
    new_cons ( "bitfield_contents_with_mode", s, 13, "mBxx" ) ;
201
    new_cons ( "case", s, 14, "bx*[lss]" ) ;
202
    new_cons ( "change_bitfield_to_int", s, 15, "vx" ) ;
203
    new_cons ( "change_floating_variety", s, 16, "efx" ) ;
204
    new_cons ( "change_variety", s, 17, "evx" ) ;
205
    new_cons ( "change_int_to_bitfield", s, 18, "Bx" ) ;
206
    new_cons ( "complex_conjugate", s, 19, "x" ) ;
207
    new_cons ( "component", s, 20, "Sxx" ) ;
208
    new_cons ( "concat_nof", s, 21, "xx" ) ;
209
    new_cons ( "conditional", s, 22, "l&{xx}" ) ;
210
    new_cons ( "contents", s, 23, "Sx" ) ;
211
    new_cons ( "contents_with_mode", s, 24, "mSx" ) ;
212
    new_cons ( "current_env", s, 25, ( char * ) null ) ;
213
    new_cons ( "div0", s, 26, "eexx" ) ;
214
    new_cons ( "div1", s, 27, "eexx" ) ;
215
    new_cons ( "div2", s, 28, "eexx" ) ;
216
    new_cons ( "env_offset", s, 29, "aat" ) ;
217
    new_cons ( "env_size", s, 30, "t" ) ;
218
    new_cons ( "fail_installer", s, 31, "X" ) ;
219
    new_cons ( "float_int", s, 32, "efx" ) ;
220
    new_cons ( "floating_abs", s, 33, "ex" ) ;
221
    new_cons ( "floating_div", s, 34, "exx" ) ;
222
    new_cons ( "floating_minus", s, 35, "exx" ) ;
223
    new_cons ( "floating_maximum", s, 36, "exx" ) ;
224
    new_cons ( "floating_minimum", s, 37, "exx" ) ;
225
    new_cons ( "floating_mult", s, 38, "e*[x]" ) ;
226
    new_cons ( "floating_negate", s, 39, "ex" ) ;
227
    new_cons ( "floating_plus", s, 40, "e*[x]" ) ;
228
    new_cons ( "floating_power", s, 41, "exx" ) ;
229
    new_cons ( "floating_test", s, 42, "?[n]eNlxx" ) ;
230
    new_cons ( "goto", s, 43, "l" ) ;
231
    new_cons ( "goto_local_lv", s, 44, "x" ) ;
232
    new_cons ( "identify", s, 45, "?[u]t^x{x}" ) ;
233
    new_cons ( "ignorable", s, 46, "x" ) ;
234
    new_cons ( "imaginary_part", s, 47, "x" ) ;
235
    new_cons ( "initial_value", s, 48, "{x}" ) ;
236
    new_cons ( "integer_test", s, 49, "?[n]Nlxx" ) ;
237
    new_cons ( "labelled", s, 50, "*[l&]{x*[x]}" ) ;
238
    new_cons ( "last_local", s, 51, "x" ) ;
239
    new_cons ( "local_alloc", s, 52, "x" ) ;
240
    new_cons ( "local_alloc_check", s, 53, "x" ) ;
241
    new_cons ( "local_free", s, 54, "xx" ) ;
242
    new_cons ( "local_free_all", s, 55, ( char * ) null ) ;
243
    new_cons ( "long_jump", s, 56, "xx" ) ;
244
    new_cons ( "make_complex", s, 57, "fxx" ) ;
245
    new_cons ( "make_compound", s, 58, "x*[x]" ) ;
246
    new_cons ( "make_floating", s, 59, "frbXns" ) ;
247
    new_cons ( "make_general_proc", s, 60, "S?[P]*[S?[u]t&]*[S?[u]t&]{x}" ) ;
248
    new_cons ( "make_int", s, 61, "vs" ) ;
249
    new_cons ( "make_local_lv", s, 62, "l" ) ;
250
    new_cons ( "make_nof", s, 63, "*[x]" ) ;
251
    new_cons ( "make_nof_int", s, 64, "vX" ) ;
252
    new_cons ( "make_null_local_lv", s, 65, ( char * ) null ) ;
253
    new_cons ( "make_null_proc", s, 66, ( char * ) null ) ;
254
    new_cons ( "make_null_ptr", s, 67, "a" ) ;
255
    new_cons ( "make_proc", s, 68, "S*[S?[u]t&]?[t&?[u]]{x}" ) ;
256
    new_cons ( "make_stack_limit", s, 116, "xxx" ) ;
257
    new_cons ( "make_top", s, 69, ( char * ) null ) ;
258
    new_cons ( "make_value", s, 70, "S" ) ;
259
    new_cons ( "maximum", s, 71, "xx" ) ;
260
    new_cons ( "minimum", s, 72, "xx" ) ;
261
    new_cons ( "minus", s, 73, "exx" ) ;
262
    new_cons ( "move_some", s, 74, "mxxx" ) ;
263
    new_cons ( "mult", s, 75, "exx" ) ;
264
    new_cons ( "n_copies", s, 76, "nx" ) ;
265
    new_cons ( "negate", s, 77, "ex" ) ;
266
    new_cons ( "not", s, 78, "x" ) ;
267
    new_cons ( "obtain_tag", s, 79, "t" ) ;
268
    new_cons ( "offset_add", s, 80, "xx" ) ;
269
    new_cons ( "offset_div", s, 81, "vxx" ) ;
270
    new_cons ( "offset_div_by_int", s, 82, "xx" ) ;
271
    new_cons ( "offset_max", s, 83, "xx" ) ;
272
    new_cons ( "offset_mult", s, 84, "xx" ) ;
273
    new_cons ( "offset_negate", s, 85, "x" ) ;
274
    new_cons ( "offset_pad", s, 86, "ax" ) ;
275
    new_cons ( "offset_subtract", s, 87, "xx" ) ;
276
    new_cons ( "offset_test", s, 88, "?[n]Nlxx" ) ;
277
    new_cons ( "offset_zero", s, 89, "a" ) ;
278
    new_cons ( "or", s, 90, "xx" ) ;
279
    new_cons ( "plus", s, 91, "exx" ) ;
280
    new_cons ( "pointer_test", s, 92, "?[n]Nlxx" ) ;
281
    new_cons ( "power", s, 93, "exx" ) ;
282
    new_cons ( "proc_test", s, 94, "?[n]Nlxx" ) ;
283
    new_cons ( "profile", s, 95, "n" ) ;
284
    new_cons ( "real_part", s, 96, "x" ) ;
285
    new_cons ( "rem0", s, 97, "eexx" ) ;
286
    new_cons ( "rem1", s, 98, "eexx" ) ;
287
    new_cons ( "rem2", s, 99, "eexx" ) ;
288
    new_cons ( "repeat", s, 100, "l&{xx}" ) ;
289
    new_cons ( "return", s, 101, "x" ) ;
290
    new_cons ( "return_to_label", s, 102, "x" ) ;
291
    new_cons ( "round_with_mode", s, 103, "ervx" ) ;
292
    new_cons ( "rotate_left", s, 104, "xx" ) ;
293
    new_cons ( "rotate_right", s, 105, "xx" ) ;
294
    new_cons ( "sequence", s, 106, "*[x]x" ) ;
295
    new_cons ( "set_stack_limit", s, 107, "x" ) ;
296
    new_cons ( "shape_offset", s, 108, "S" ) ;
297
    new_cons ( "shift_left", s, 109, "exx" ) ;
298
    new_cons ( "shift_right", s, 110, "xx" ) ;
299
    new_cons ( "subtract_ptrs", s, 111, "xx" ) ;
300
    new_cons ( "tail_call", s, 112, "?[P]xq" ) ;
301
    new_cons ( "untidy_return", s, 113, "x" ) ;
302
    new_cons ( "variable", s, 114, "?[u]t&x{x}" ) ;
303
    new_cons ( "xor", s, 115, "xx" ) ;
304
 
305
    s = SORT_floating_variety ;
306
    sort_letters [s] = 'f' ;
307
    sort_encoding [s] = 3 ;
308
    sort_extension [s] = 1 ;
309
    sort_decode [s] = de_floating_variety ;
310
    sort_read [s] = read_floating_variety ;
311
    new_sort ( s, 7 ) ;
312
    new_cons ( "flvar_apply_token", s, 1, "!" ) ;
313
    sort_tokens [s] = 1 ;
314
    new_cons ( "flvar_cond", s, 2, "x@[f]@[f]" ) ;
315
    sort_conds [s] = 2 ;
316
    new_cons ( "flvar_parms", s, 3, "nnnn" ) ;
317
    new_cons ( "complex_parms", s, 4, "nnnn" ) ;
318
    new_cons ( "float_of_complex", s, 5, "S" ) ;
319
    new_cons ( "complex_of_float", s, 6, "S" ) ;
320
 
321
    s = SORT_label ;
322
    sort_letters [s] = 'l' ;
323
    sort_encoding [s] = 1 ;
324
    sort_extension [s] = 1 ;
325
    sort_decode [s] = de_label ;
326
    sort_read [s] = read_label ;
327
    new_sort ( s, 3 ) ;
328
    new_cons ( "label_apply_token", s, 2, "!" ) ;
329
    sort_tokens [s] = 2 ;
330
    new_cons ( "make_label", s, 1, "i" ) ;
331
 
332
    s = SORT_nat ;
333
    sort_letters [s] = 'n' ;
334
    sort_encoding [s] = 3 ;
335
    sort_extension [s] = 1 ;
336
    sort_decode [s] = de_nat ;
337
    sort_read [s] = read_nat ;
338
    new_sort ( s, 6 ) ;
339
    new_cons ( "nat_apply_token", s, 1, "!" ) ;
340
    sort_tokens [s] = 1 ;
341
    new_cons ( "nat_cond", s, 2, "x@[n]@[n]" ) ;
342
    sort_conds [s] = 2 ;
343
    new_cons ( "computed_nat", s, 3, "x" ) ;
344
    new_cons ( "error_val", s, 4, "c" ) ;
345
    new_cons ( "make_nat", s, 5, "i" ) ;
346
 
347
    s = SORT_ntest ;
348
    sort_letters [s] = 'N' ;
349
    sort_encoding [s] = 4 ;
350
    sort_extension [s] = 1 ;
351
    sort_decode [s] = de_ntest ;
352
    sort_read [s] = read_ntest ;
353
    new_sort ( s, 17 ) ;
354
    new_cons ( "ntest_apply_token", s, 1, "!" ) ;
355
    sort_tokens [s] = 1 ;
356
    new_cons ( "ntest_cond", s, 2, "x@[N]@[N]" ) ;
357
    sort_conds [s] = 2 ;
358
    new_cons ( "equal", s, 3, ( char * ) null ) ;
359
    new_cons ( "greater_than", s, 4, ( char * ) null ) ;
360
    new_cons ( "greater_than_or_equal", s, 5, ( char * ) null ) ;
361
    new_cons ( "less_than", s, 6, ( char * ) null ) ;
362
    new_cons ( "less_than_or_equal", s, 7, ( char * ) null ) ;
363
    new_cons ( "not_equal", s, 8, ( char * ) null ) ;
364
    new_cons ( "not_greater_than", s, 9, ( char * ) null ) ;
365
    new_cons ( "not_greater_than_or_equal", s, 10, ( char * ) null ) ;
366
    new_cons ( "not_less_than", s, 11, ( char * ) null ) ;
367
    new_cons ( "not_less_than_or_equal", s, 12, ( char * ) null ) ;
368
    new_cons ( "less_than_or_greater_than", s, 13, ( char * ) null ) ;
369
    new_cons ( "not_less_than_and_not_greater_than", s, 14, ( char * ) null ) ;
370
    new_cons ( "comparable", s, 15, ( char * ) null ) ;
371
    new_cons ( "not_comparable", s, 16, ( char * ) null ) ;
372
 
373
    s = SORT_procprops ;
374
    sort_letters [s] = 'P' ;
375
    sort_encoding [s] = 4 ;
376
    sort_extension [s] = 1 ;
377
    sort_decode [s] = de_procprops ;
378
    sort_read [s] = read_procprops ;
379
    new_sort ( s, 10 ) ;
380
    new_cons ( "procprops_apply_token", s, 1, "!" ) ;
381
    sort_tokens [s] = 1 ;
382
    new_cons ( "procprops_cond", s, 2, "x@[P]@[P]" ) ;
383
    sort_conds [s] = 2 ;
384
    new_cons ( "add_procprops", s, 3, "PP" ) ;
385
    new_cons ( "check_stack", s, 4, ( char * ) null ) ;
386
    new_cons ( "inline", s, 5, ( char * ) null ) ;
387
    new_cons ( "no_long_jump_dest", s, 6, ( char * ) null ) ;
388
    new_cons ( "untidy", s, 7, ( char * ) null ) ;
389
    new_cons ( "var_callees", s, 8, ( char * ) null ) ;
390
    new_cons ( "var_callers", s, 9, ( char * ) null ) ;
391
 
392
    s = SORT_rounding_mode ;
393
    sort_letters [s] = 'r' ;
394
    sort_encoding [s] = 3 ;
395
    sort_extension [s] = 1 ;
396
    sort_decode [s] = de_rounding_mode ;
397
    sort_read [s] = read_rounding_mode ;
398
    new_sort ( s, 8 ) ;
399
    new_cons ( "rounding_mode_apply_token", s, 1, "!" ) ;
400
    sort_tokens [s] = 1 ;
401
    new_cons ( "rounding_mode_cond", s, 2, "x@[r]@[r]" ) ;
402
    sort_conds [s] = 2 ;
403
    new_cons ( "round_as_state", s, 3, ( char * ) null ) ;
404
    new_cons ( "to_nearest", s, 4, ( char * ) null ) ;
405
    new_cons ( "toward_larger", s, 5, ( char * ) null ) ;
406
    new_cons ( "toward_smaller", s, 6, ( char * ) null ) ;
407
    new_cons ( "toward_zero", s, 7, ( char * ) null ) ;
408
 
409
    s = SORT_shape ;
410
    sort_letters [s] = 'S' ;
411
    sort_encoding [s] = 4 ;
412
    sort_extension [s] = 1 ;
413
    sort_decode [s] = de_shape ;
414
    sort_read [s] = read_shape ;
415
    new_sort ( s, 13 ) ;
416
    new_cons ( "shape_apply_token", s, 1, "!" ) ;
417
    sort_tokens [s] = 1 ;
418
    new_cons ( "shape_cond", s, 2, "x@[S]@[S]" ) ;
419
    sort_conds [s] = 2 ;
420
    new_cons ( "bitfield", s, 3, "B" ) ;
421
    new_cons ( "bottom", s, 4, ( char * ) null ) ;
422
    new_cons ( "compound", s, 5, "x" ) ;
423
    new_cons ( "floating", s, 6, "f" ) ;
424
    new_cons ( "integer", s, 7, "v" ) ;
425
    new_cons ( "nof", s, 8, "nS" ) ;
426
    new_cons ( "offset", s, 9, "aa" ) ;
427
    new_cons ( "pointer", s, 10, "a" ) ;
428
    new_cons ( "proc", s, 11, ( char * ) null ) ;
429
    new_cons ( "top", s, 12, ( char * ) null ) ;
430
 
431
    s = SORT_signed_nat ;
432
    sort_letters [s] = 's' ;
433
    sort_encoding [s] = 3 ;
434
    sort_extension [s] = 1 ;
435
    sort_decode [s] = de_signed_nat ;
436
    sort_read [s] = read_signed_nat ;
437
    new_sort ( s, 6 ) ;
438
    new_cons ( "signed_nat_apply_token", s, 1, "!" ) ;
439
    sort_tokens [s] = 1 ;
440
    new_cons ( "signed_nat_cond", s, 2, "x@[s]@[s]" ) ;
441
    sort_conds [s] = 2 ;
442
    new_cons ( "computed_signed_nat", s, 3, "x" ) ;
443
    new_cons ( "make_signed_nat", s, 4, "ji" ) ;
444
    new_cons ( "snat_from_nat", s, 5, "bn" ) ;
445
 
446
    s = SORT_sortname ;
447
    new_sort ( s, 24 ) ;
448
    new_cons ( "access", s, 1, ( char * ) null ) ;
449
    new_cons ( "al_tag", s, 2, ( char * ) null ) ;
450
    new_cons ( "alignment", s, 3, ( char * ) null ) ;
451
    new_cons ( "bitfield_variety", s, 4, ( char * ) null ) ;
452
    new_cons ( "bool", s, 5, ( char * ) null ) ;
453
    new_cons ( "error_treatment", s, 6, ( char * ) null ) ;
454
    new_cons ( "exp", s, 7, ( char * ) null ) ;
455
    new_cons ( "floating_variety", s, 8, ( char * ) null ) ;
456
    new_cons ( "foreign_sort", s, 9, "X" ) ;
457
    new_cons ( "label", s, 10, ( char * ) null ) ;
458
    new_cons ( "nat", s, 11, ( char * ) null ) ;
459
    new_cons ( "ntest", s, 12, ( char * ) null ) ;
460
    new_cons ( "procprops", s, 13, ( char * ) null ) ;
461
    new_cons ( "rounding_mode", s, 14, ( char * ) null ) ;
462
    new_cons ( "shape", s, 15, ( char * ) null ) ;
463
    new_cons ( "signed_nat", s, 16, ( char * ) null ) ;
464
    new_cons ( "string", s, 17, ( char * ) null ) ;
465
    new_cons ( "tag", s, 18, ( char * ) null ) ;
466
    new_cons ( "transfer_mode", s, 19, ( char * ) null ) ;
467
    new_cons ( "token", s, 20, "~*[~]" ) ;
468
    new_cons ( "variety", s, 21, ( char * ) null ) ;
469
    new_cons ( "callees", s, 22, ( char * ) null ) ;
470
    new_cons ( "error_code", s, 23, ( char * ) null ) ;
471
 
472
    s = SORT_string ;
473
    sort_letters [s] = 'X' ;
474
    sort_encoding [s] = 3 ;
475
    sort_extension [s] = 1 ;
476
    sort_decode [s] = de_string ;
477
    sort_read [s] = read_string ;
478
    new_sort ( s, 5 ) ;
479
    new_cons ( "string_apply_token", s, 1, "!" ) ;
480
    sort_tokens [s] = 1 ;
481
    new_cons ( "string_cond", s, 2, "x@[X]@[X]" ) ;
482
    sort_conds [s] = 2 ;
483
    new_cons ( "concat_string", s, 3, "XX" ) ;
484
    new_cons ( "make_string", s, 4, "$" ) ;
485
 
486
    s = SORT_tag ;
487
    sort_letters [s] = 't' ;
488
    sort_encoding [s] = 1 ;
489
    sort_extension [s] = 1 ;
490
    sort_decode [s] = de_tag ;
491
    sort_read [s] = read_tag ;
492
    new_sort ( s, 3 ) ;
493
    new_cons ( "tag_apply_token", s, 2, "!" ) ;
494
    sort_tokens [s] = 2 ;
495
    new_cons ( "make_tag", s, 1, "i" ) ;
496
 
497
    s = SORT_transfer_mode ;
498
    sort_letters [s] = 'm' ;
499
    sort_encoding [s] = 3 ;
500
    sort_extension [s] = 1 ;
501
    sort_decode [s] = de_transfer_mode ;
502
    sort_read [s] = read_transfer_mode ;
503
    new_sort ( s, 9 ) ;
504
    new_cons ( "transfer_mode_apply_token", s, 1, "!" ) ;
505
    sort_tokens [s] = 1 ;
506
    new_cons ( "transfer_mode_cond", s, 2, "x@[m]@[m]" ) ;
507
    sort_conds [s] = 2 ;
508
    new_cons ( "add_modes", s, 3, "mm" ) ;
509
    new_cons ( "overlap", s, 4, ( char * ) null ) ;
510
    new_cons ( "standard_transfer_mode", s, 5, ( char * ) null ) ;
511
    new_cons ( "trap_on_nil", s, 6, ( char * ) null ) ;
512
    new_cons ( "volatile", s, 7, ( char * ) null ) ;
513
    new_cons ( "complete", s, 8, ( char * ) null ) ;
514
 
515
    s = SORT_variety ;
516
    sort_letters [s] = 'v' ;
517
    sort_encoding [s] = 2 ;
518
    sort_extension [s] = 1 ;
519
    sort_decode [s] = de_variety ;
520
    sort_read [s] = read_variety ;
521
    new_sort ( s, 5 ) ;
522
    new_cons ( "var_apply_token", s, 1, "!" ) ;
523
    sort_tokens [s] = 1 ;
524
    new_cons ( "var_cond", s, 2, "x@[v]@[v]" ) ;
525
    sort_conds [s] = 2 ;
526
    new_cons ( "var_limits", s, 3, "ss" ) ;
527
    new_cons ( "var_width", s, 4, "bn" ) ;
528
    return ;
529
}
530
 
531
 
532
/* FIND A SORT NAME */
533
 
534
sortname find_sort
535
    PROTO_N ( ( c ) )
536
    PROTO_T ( char c )
537
{
538
    sortname s ;
539
    switch ( c ) {
540
	case 'u' : s = SORT_access ; break ;
541
	case 'A' : s = SORT_al_tag ; break ;
542
	case 'a' : s = SORT_alignment ; break ;
543
	case 'B' : s = SORT_bitfield_variety ; break ;
544
	case 'b' : s = SORT_bool ; break ;
545
	case 'q' : s = SORT_callees ; break ;
546
	case 'c' : s = SORT_error_code ; break ;
547
	case 'e' : s = SORT_error_treatment ; break ;
548
	case 'x' : s = SORT_exp ; break ;
549
	case 'f' : s = SORT_floating_variety ; break ;
550
	case 'l' : s = SORT_label ; break ;
551
	case 'n' : s = SORT_nat ; break ;
552
	case 'N' : s = SORT_ntest ; break ;
553
	case 'P' : s = SORT_procprops ; break ;
554
	case 'r' : s = SORT_rounding_mode ; break ;
555
	case 'S' : s = SORT_shape ; break ;
556
	case 's' : s = SORT_signed_nat ; break ;
557
	case 'X' : s = SORT_string ; break ;
558
	case 't' : s = SORT_tag ; break ;
559
	case 'm' : s = SORT_transfer_mode ; break ;
560
	case 'v' : s = SORT_variety ; break ;
561
	default : {
562
	    input_error ( "Illegal decode letter, %c", c ) ;
563
	    s = SORT_unknown ;
564
	    break ;
565
	}
566
    }
567
    return ( s ) ;
568
}
569
 
570
 
571
/* DECODE A ACCESS */
572
 
573
node *de_access
574
    PROTO_Z ()
575
{
576
    long n = fetch_extn ( 4 ) ;
577
    char *args ;
578
    node *p = new_node () ;
579
    construct *cons = cons_no ( SORT_access, n ) ;
580
    p->cons = cons ;
581
    if ( n < 1 || n > 13 || cons->name == null ) {
582
	input_error ( "Illegal access value, %ld", n ) ;
583
    }
584
    switch ( n ) {
585
	case 1 : {
586
	    IGNORE de_token ( p, SORT_access ) ;
587
	    break ;
588
	}
589
	case 2 : {
590
	    args = get_char_info ( cons ) ;
591
	    p->son = de_node ( args ) ;
592
	    if ( do_check ) {
593
		checking = "access_cond" ;
594
		IGNORE check1 ( ENC_integer, p->son ) ;
595
	    }
596
	    break ;
597
	}
598
	default : {
599
	    args = get_char_info ( cons ) ;
600
	    if ( args ) p->son = de_node ( args ) ;
601
	    break ;
602
	}
603
    }
604
#ifdef check_access
605
    check_access ( p ) ;
606
#endif
607
    return ( p ) ;
608
}
609
 
610
 
611
/* DECODE A AL_TAG */
612
 
613
node *de_al_tag
614
    PROTO_Z ()
615
{
616
    long n = fetch_extn ( 1 ) ;
617
    char *args ;
618
    node *p = new_node () ;
619
    construct *cons = cons_no ( SORT_al_tag, n ) ;
620
    p->cons = cons ;
621
    if ( n < 1 || n > 2 || cons->name == null ) {
622
	input_error ( "Illegal al_tag value, %ld", n ) ;
623
    }
624
    switch ( n ) {
625
	case 2 : {
626
	    IGNORE de_token ( p, SORT_al_tag ) ;
627
	    break ;
628
	}
629
	case 1 : {
630
	    p->son = de_var_sort ( al_tag_var ) ;
631
	    break ;
632
	}
633
	default : {
634
	    args = get_char_info ( cons ) ;
635
	    if ( args ) p->son = de_node ( args ) ;
636
	    break ;
637
	}
638
    }
639
#ifdef check_al_tag
640
    check_al_tag ( p ) ;
641
#endif
642
    return ( p ) ;
643
}
644
 
645
 
646
/* DECODE A AL_TAGDEF */
647
 
648
long de_al_tagdef_bits
649
    PROTO_Z ()
650
{
651
    long n = fetch_extn ( 1 ) ;
652
    if ( n < 1 || n > 1 ) {
653
	input_error ( "Illegal al_tagdef value, %ld", n ) ;
654
    }
655
    return ( n ) ;
656
}
657
 
658
 
659
/* DECODE A ALIGNMENT */
660
 
661
node *de_alignment
662
    PROTO_Z ()
663
{
664
    long n = fetch_extn ( 4 ) ;
665
    char *args ;
666
    node *p = new_node () ;
667
    construct *cons = cons_no ( SORT_alignment, n ) ;
668
    p->cons = cons ;
669
    if ( n < 1 || n > 12 || cons->name == null ) {
670
	input_error ( "Illegal alignment value, %ld", n ) ;
671
    }
672
    switch ( n ) {
673
	case 1 : {
674
	    IGNORE de_token ( p, SORT_alignment ) ;
675
	    break ;
676
	}
677
	case 2 : {
678
	    args = get_char_info ( cons ) ;
679
	    p->son = de_node ( args ) ;
680
	    if ( do_check ) {
681
		checking = "alignment_cond" ;
682
		IGNORE check1 ( ENC_integer, p->son ) ;
683
	    }
684
	    break ;
685
	}
686
	default : {
687
	    args = get_char_info ( cons ) ;
688
	    if ( args ) p->son = de_node ( args ) ;
689
	    break ;
690
	}
691
    }
692
#ifdef check_alignment
693
    check_alignment ( p ) ;
694
#endif
695
    return ( p ) ;
696
}
697
 
698
 
699
/* DECODE A BITFIELD_VARIETY */
700
 
701
node *de_bitfield_variety
702
    PROTO_Z ()
703
{
704
    long n = fetch_extn ( 2 ) ;
705
    char *args ;
706
    node *p = new_node () ;
707
    construct *cons = cons_no ( SORT_bitfield_variety, n ) ;
708
    p->cons = cons ;
709
    if ( n < 1 || n > 3 || cons->name == null ) {
710
	input_error ( "Illegal bitfield_variety value, %ld", n ) ;
711
    }
712
    switch ( n ) {
713
	case 1 : {
714
	    IGNORE de_token ( p, SORT_bitfield_variety ) ;
715
	    break ;
716
	}
717
	case 2 : {
718
	    args = get_char_info ( cons ) ;
719
	    p->son = de_node ( args ) ;
720
	    if ( do_check ) {
721
		checking = "bfvar_cond" ;
722
		IGNORE check1 ( ENC_integer, p->son ) ;
723
	    }
724
	    break ;
725
	}
726
	default : {
727
	    args = get_char_info ( cons ) ;
728
	    if ( args ) p->son = de_node ( args ) ;
729
	    break ;
730
	}
731
    }
732
#ifdef check_bitfield_variety
733
    check_bitfield_variety ( p ) ;
734
#endif
735
    return ( p ) ;
736
}
737
 
738
 
739
/* DECODE A BOOL */
740
 
741
node *de_bool
742
    PROTO_Z ()
743
{
744
    long n = fetch_extn ( 3 ) ;
745
    char *args ;
746
    node *p = new_node () ;
747
    construct *cons = cons_no ( SORT_bool, n ) ;
748
    p->cons = cons ;
749
    if ( n < 1 || n > 4 || cons->name == null ) {
750
	input_error ( "Illegal bool value, %ld", n ) ;
751
    }
752
    switch ( n ) {
753
	case 1 : {
754
	    IGNORE de_token ( p, SORT_bool ) ;
755
	    break ;
756
	}
757
	case 2 : {
758
	    args = get_char_info ( cons ) ;
759
	    p->son = de_node ( args ) ;
760
	    if ( do_check ) {
761
		checking = "bool_cond" ;
762
		IGNORE check1 ( ENC_integer, p->son ) ;
763
	    }
764
	    break ;
765
	}
766
	default : {
767
	    args = get_char_info ( cons ) ;
768
	    if ( args ) p->son = de_node ( args ) ;
769
	    break ;
770
	}
771
    }
772
#ifdef check_bool
773
    check_bool ( p ) ;
774
#endif
775
    return ( p ) ;
776
}
777
 
778
 
779
/* DECODE A CALLEES */
780
 
781
node *de_callees
782
    PROTO_Z ()
783
{
784
    long n = fetch_extn ( 2 ) ;
785
    char *args ;
786
    node *p = new_node () ;
787
    construct *cons = cons_no ( SORT_callees, n ) ;
788
    p->cons = cons ;
789
    if ( n < 1 || n > 3 || cons->name == null ) {
790
	input_error ( "Illegal callees value, %ld", n ) ;
791
    }
792
    args = get_char_info ( cons ) ;
793
    if ( args ) p->son = de_node ( args ) ;
794
#ifdef check_callees
795
    check_callees ( p ) ;
796
#endif
797
    return ( p ) ;
798
}
799
 
800
 
801
/* DECODE A ERROR_CODE */
802
 
803
node *de_error_code
804
    PROTO_Z ()
805
{
806
    long n = fetch_extn ( 2 ) ;
807
    char *args ;
808
    node *p = new_node () ;
809
    construct *cons = cons_no ( SORT_error_code, n ) ;
810
    p->cons = cons ;
811
    if ( n < 1 || n > 3 || cons->name == null ) {
812
	input_error ( "Illegal error_code value, %ld", n ) ;
813
    }
814
    args = get_char_info ( cons ) ;
815
    if ( args ) p->son = de_node ( args ) ;
816
#ifdef check_error_code
817
    check_error_code ( p ) ;
818
#endif
819
    return ( p ) ;
820
}
821
 
822
 
823
/* DECODE A ERROR_TREATMENT */
824
 
825
node *de_error_treatment
826
    PROTO_Z ()
827
{
828
    long n = fetch_extn ( 3 ) ;
829
    char *args ;
830
    node *p = new_node () ;
831
    construct *cons = cons_no ( SORT_error_treatment, n ) ;
832
    p->cons = cons ;
833
    if ( n < 1 || n > 7 || cons->name == null ) {
834
	input_error ( "Illegal error_treatment value, %ld", n ) ;
835
    }
836
    switch ( n ) {
837
	case 1 : {
838
	    IGNORE de_token ( p, SORT_error_treatment ) ;
839
	    break ;
840
	}
841
	case 2 : {
842
	    args = get_char_info ( cons ) ;
843
	    p->son = de_node ( args ) ;
844
	    if ( do_check ) {
845
		checking = "errt_cond" ;
846
		IGNORE check1 ( ENC_integer, p->son ) ;
847
	    }
848
	    break ;
849
	}
850
	default : {
851
	    args = get_char_info ( cons ) ;
852
	    if ( args ) p->son = de_node ( args ) ;
853
	    break ;
854
	}
855
    }
856
#ifdef check_error_treatment
857
    check_error_treatment ( p ) ;
858
#endif
859
    return ( p ) ;
860
}
861
 
862
 
863
/* DECODE A EXP */
864
 
865
node *de_exp
866
    PROTO_Z ()
867
{
868
    long n = fetch_extn ( 7 ) ;
869
    char *args ;
870
    node *p = new_node () ;
871
    construct *cons = cons_no ( SORT_exp, n ) ;
872
    p->cons = cons ;
873
    if ( n < 1 || n > 116 || cons->name == null ) {
874
	input_error ( "Illegal exp value, %ld", n ) ;
875
    }
876
    switch ( n ) {
877
	case 1 : {
878
	    IGNORE de_token ( p, SORT_exp ) ;
879
	    break ;
880
	}
881
	case 2 : {
882
	    args = get_char_info ( cons ) ;
883
	    p->son = de_node ( args ) ;
884
	    if ( do_check ) {
885
		checking = "exp_cond" ;
886
		IGNORE check1 ( ENC_integer, p->son ) ;
887
	    }
888
	    break ;
889
	}
890
	default : {
891
	    args = get_char_info ( cons ) ;
892
	    if ( args ) p->son = de_node ( args ) ;
893
	    break ;
894
	}
895
    }
896
#ifdef check_exp
897
    check_exp ( p ) ;
898
#endif
899
    return ( p ) ;
900
}
901
 
902
 
903
/* DECODE A EXTERNAL */
904
 
905
long de_external_bits
906
    PROTO_Z ()
907
{
908
    long n = fetch_extn ( 2 ) ;
909
    if ( n < 1 || n > 3 ) {
910
	input_error ( "Illegal external value, %ld", n ) ;
911
    }
912
    return ( n ) ;
913
}
914
 
915
 
916
/* DECODE A FLOATING_VARIETY */
917
 
918
node *de_floating_variety
919
    PROTO_Z ()
920
{
921
    long n = fetch_extn ( 3 ) ;
922
    char *args ;
923
    node *p = new_node () ;
924
    construct *cons = cons_no ( SORT_floating_variety, n ) ;
925
    p->cons = cons ;
926
    if ( n < 1 || n > 6 || cons->name == null ) {
927
	input_error ( "Illegal floating_variety value, %ld", n ) ;
928
    }
929
    switch ( n ) {
930
	case 1 : {
931
	    IGNORE de_token ( p, SORT_floating_variety ) ;
932
	    break ;
933
	}
934
	case 2 : {
935
	    args = get_char_info ( cons ) ;
936
	    p->son = de_node ( args ) ;
937
	    if ( do_check ) {
938
		checking = "flvar_cond" ;
939
		IGNORE check1 ( ENC_integer, p->son ) ;
940
	    }
941
	    break ;
942
	}
943
	default : {
944
	    args = get_char_info ( cons ) ;
945
	    if ( args ) p->son = de_node ( args ) ;
946
	    break ;
947
	}
948
    }
949
#ifdef check_floating_variety
950
    check_floating_variety ( p ) ;
951
#endif
952
    return ( p ) ;
953
}
954
 
955
 
956
/* DECODE A LABEL */
957
 
958
node *de_label
959
    PROTO_Z ()
960
{
961
    long n = fetch_extn ( 1 ) ;
962
    char *args ;
963
    node *p = new_node () ;
964
    construct *cons = cons_no ( SORT_label, n ) ;
965
    p->cons = cons ;
966
    if ( n < 1 || n > 2 || cons->name == null ) {
967
	input_error ( "Illegal label value, %ld", n ) ;
968
    }
969
    switch ( n ) {
970
	case 2 : {
971
	    IGNORE de_token ( p, SORT_label ) ;
972
	    break ;
973
	}
974
	case 1 : {
975
	    long m = tdf_int () ;
976
	    p->son = new_node () ;
977
	    p->son->cons = find_label ( m ) ;
978
	    break ;
979
	}
980
	default : {
981
	    args = get_char_info ( cons ) ;
982
	    if ( args ) p->son = de_node ( args ) ;
983
	    break ;
984
	}
985
    }
986
#ifdef check_label
987
    check_label ( p ) ;
988
#endif
989
    return ( p ) ;
990
}
991
 
992
 
993
/* DECODE A NAT */
994
 
995
node *de_nat
996
    PROTO_Z ()
997
{
998
    long n = fetch_extn ( 3 ) ;
999
    char *args ;
1000
    node *p = new_node () ;
1001
    construct *cons = cons_no ( SORT_nat, n ) ;
1002
    p->cons = cons ;
1003
    if ( n < 1 || n > 5 || cons->name == null ) {
1004
	input_error ( "Illegal nat value, %ld", n ) ;
1005
    }
1006
    switch ( n ) {
1007
	case 1 : {
1008
	    IGNORE de_token ( p, SORT_nat ) ;
1009
	    break ;
1010
	}
1011
	case 2 : {
1012
	    args = get_char_info ( cons ) ;
1013
	    p->son = de_node ( args ) ;
1014
	    if ( do_check ) {
1015
		checking = "nat_cond" ;
1016
		IGNORE check1 ( ENC_integer, p->son ) ;
1017
	    }
1018
	    break ;
1019
	}
1020
	default : {
1021
	    args = get_char_info ( cons ) ;
1022
	    if ( args ) p->son = de_node ( args ) ;
1023
	    break ;
1024
	}
1025
    }
1026
#ifdef check_nat
1027
    check_nat ( p ) ;
1028
#endif
1029
    return ( p ) ;
1030
}
1031
 
1032
 
1033
/* DECODE A NTEST */
1034
 
1035
node *de_ntest
1036
    PROTO_Z ()
1037
{
1038
    long n = fetch_extn ( 4 ) ;
1039
    char *args ;
1040
    node *p = new_node () ;
1041
    construct *cons = cons_no ( SORT_ntest, n ) ;
1042
    p->cons = cons ;
1043
    if ( n < 1 || n > 16 || cons->name == null ) {
1044
	input_error ( "Illegal ntest value, %ld", n ) ;
1045
    }
1046
    switch ( n ) {
1047
	case 1 : {
1048
	    IGNORE de_token ( p, SORT_ntest ) ;
1049
	    break ;
1050
	}
1051
	case 2 : {
1052
	    args = get_char_info ( cons ) ;
1053
	    p->son = de_node ( args ) ;
1054
	    if ( do_check ) {
1055
		checking = "ntest_cond" ;
1056
		IGNORE check1 ( ENC_integer, p->son ) ;
1057
	    }
1058
	    break ;
1059
	}
1060
	default : {
1061
	    args = get_char_info ( cons ) ;
1062
	    if ( args ) p->son = de_node ( args ) ;
1063
	    break ;
1064
	}
1065
    }
1066
#ifdef check_ntest
1067
    check_ntest ( p ) ;
1068
#endif
1069
    return ( p ) ;
1070
}
1071
 
1072
 
1073
/* DECODE A PROCPROPS */
1074
 
1075
node *de_procprops
1076
    PROTO_Z ()
1077
{
1078
    long n = fetch_extn ( 4 ) ;
1079
    char *args ;
1080
    node *p = new_node () ;
1081
    construct *cons = cons_no ( SORT_procprops, n ) ;
1082
    p->cons = cons ;
1083
    if ( n < 1 || n > 9 || cons->name == null ) {
1084
	input_error ( "Illegal procprops value, %ld", n ) ;
1085
    }
1086
    switch ( n ) {
1087
	case 1 : {
1088
	    IGNORE de_token ( p, SORT_procprops ) ;
1089
	    break ;
1090
	}
1091
	case 2 : {
1092
	    args = get_char_info ( cons ) ;
1093
	    p->son = de_node ( args ) ;
1094
	    if ( do_check ) {
1095
		checking = "procprops_cond" ;
1096
		IGNORE check1 ( ENC_integer, p->son ) ;
1097
	    }
1098
	    break ;
1099
	}
1100
	default : {
1101
	    args = get_char_info ( cons ) ;
1102
	    if ( args ) p->son = de_node ( args ) ;
1103
	    break ;
1104
	}
1105
    }
1106
#ifdef check_procprops
1107
    check_procprops ( p ) ;
1108
#endif
1109
    return ( p ) ;
1110
}
1111
 
1112
 
1113
/* DECODE A ROUNDING_MODE */
1114
 
1115
node *de_rounding_mode
1116
    PROTO_Z ()
1117
{
1118
    long n = fetch_extn ( 3 ) ;
1119
    char *args ;
1120
    node *p = new_node () ;
1121
    construct *cons = cons_no ( SORT_rounding_mode, n ) ;
1122
    p->cons = cons ;
1123
    if ( n < 1 || n > 7 || cons->name == null ) {
1124
	input_error ( "Illegal rounding_mode value, %ld", n ) ;
1125
    }
1126
    switch ( n ) {
1127
	case 1 : {
1128
	    IGNORE de_token ( p, SORT_rounding_mode ) ;
1129
	    break ;
1130
	}
1131
	case 2 : {
1132
	    args = get_char_info ( cons ) ;
1133
	    p->son = de_node ( args ) ;
1134
	    if ( do_check ) {
1135
		checking = "rounding_mode_cond" ;
1136
		IGNORE check1 ( ENC_integer, p->son ) ;
1137
	    }
1138
	    break ;
1139
	}
1140
	default : {
1141
	    args = get_char_info ( cons ) ;
1142
	    if ( args ) p->son = de_node ( args ) ;
1143
	    break ;
1144
	}
1145
    }
1146
#ifdef check_rounding_mode
1147
    check_rounding_mode ( p ) ;
1148
#endif
1149
    return ( p ) ;
1150
}
1151
 
1152
 
1153
/* DECODE A SHAPE */
1154
 
1155
node *de_shape
1156
    PROTO_Z ()
1157
{
1158
    long n = fetch_extn ( 4 ) ;
1159
    char *args ;
1160
    node *p = new_node () ;
1161
    construct *cons = cons_no ( SORT_shape, n ) ;
1162
    p->cons = cons ;
1163
    if ( n < 1 || n > 12 || cons->name == null ) {
1164
	input_error ( "Illegal shape value, %ld", n ) ;
1165
    }
1166
    switch ( n ) {
1167
	case 1 : {
1168
	    IGNORE de_token ( p, SORT_shape ) ;
1169
	    break ;
1170
	}
1171
	case 2 : {
1172
	    args = get_char_info ( cons ) ;
1173
	    p->son = de_node ( args ) ;
1174
	    if ( do_check ) {
1175
		checking = "shape_cond" ;
1176
		IGNORE check1 ( ENC_integer, p->son ) ;
1177
	    }
1178
	    break ;
1179
	}
1180
	default : {
1181
	    args = get_char_info ( cons ) ;
1182
	    if ( args ) p->son = de_node ( args ) ;
1183
	    break ;
1184
	}
1185
    }
1186
#ifdef check_shape
1187
    check_shape ( p ) ;
1188
#endif
1189
    return ( p ) ;
1190
}
1191
 
1192
 
1193
/* DECODE A SIGNED_NAT */
1194
 
1195
node *de_signed_nat
1196
    PROTO_Z ()
1197
{
1198
    long n = fetch_extn ( 3 ) ;
1199
    char *args ;
1200
    node *p = new_node () ;
1201
    construct *cons = cons_no ( SORT_signed_nat, n ) ;
1202
    p->cons = cons ;
1203
    if ( n < 1 || n > 5 || cons->name == null ) {
1204
	input_error ( "Illegal signed_nat value, %ld", n ) ;
1205
    }
1206
    switch ( n ) {
1207
	case 1 : {
1208
	    IGNORE de_token ( p, SORT_signed_nat ) ;
1209
	    break ;
1210
	}
1211
	case 2 : {
1212
	    args = get_char_info ( cons ) ;
1213
	    p->son = de_node ( args ) ;
1214
	    if ( do_check ) {
1215
		checking = "signed_nat_cond" ;
1216
		IGNORE check1 ( ENC_integer, p->son ) ;
1217
	    }
1218
	    break ;
1219
	}
1220
	default : {
1221
	    args = get_char_info ( cons ) ;
1222
	    if ( args ) p->son = de_node ( args ) ;
1223
	    break ;
1224
	}
1225
    }
1226
#ifdef check_signed_nat
1227
    check_signed_nat ( p ) ;
1228
#endif
1229
    return ( p ) ;
1230
}
1231
 
1232
 
1233
/* DECODE A SORTNAME */
1234
 
1235
long de_sortname_bits
1236
    PROTO_Z ()
1237
{
1238
    long n = fetch_extn ( 5 ) ;
1239
    if ( n < 1 || n > 21 ) {
1240
	input_error ( "Illegal sortname value, %ld", n ) ;
1241
    }
1242
    return ( n ) ;
1243
}
1244
 
1245
 
1246
/* DECODE A STRING */
1247
 
1248
node *de_string
1249
    PROTO_Z ()
1250
{
1251
    long n = fetch_extn ( 3 ) ;
1252
    char *args ;
1253
    node *p = new_node () ;
1254
    construct *cons = cons_no ( SORT_string, n ) ;
1255
    p->cons = cons ;
1256
    if ( n < 1 || n > 4 || cons->name == null ) {
1257
	input_error ( "Illegal string value, %ld", n ) ;
1258
    }
1259
    switch ( n ) {
1260
	case 1 : {
1261
	    IGNORE de_token ( p, SORT_string ) ;
1262
	    break ;
1263
	}
1264
	case 2 : {
1265
	    args = get_char_info ( cons ) ;
1266
	    p->son = de_node ( args ) ;
1267
	    if ( do_check ) {
1268
		checking = "string_cond" ;
1269
		IGNORE check1 ( ENC_integer, p->son ) ;
1270
	    }
1271
	    break ;
1272
	}
1273
	default : {
1274
	    args = get_char_info ( cons ) ;
1275
	    if ( args ) p->son = de_node ( args ) ;
1276
	    break ;
1277
	}
1278
    }
1279
#ifdef check_string
1280
    check_string ( p ) ;
1281
#endif
1282
    return ( p ) ;
1283
}
1284
 
1285
 
1286
/* DECODE A TAG */
1287
 
1288
node *de_tag
1289
    PROTO_Z ()
1290
{
1291
    long n = fetch_extn ( 1 ) ;
1292
    char *args ;
1293
    node *p = new_node () ;
1294
    construct *cons = cons_no ( SORT_tag, n ) ;
1295
    p->cons = cons ;
1296
    if ( n < 1 || n > 2 || cons->name == null ) {
1297
	input_error ( "Illegal tag value, %ld", n ) ;
1298
    }
1299
    switch ( n ) {
1300
	case 2 : {
1301
	    IGNORE de_token ( p, SORT_tag ) ;
1302
	    break ;
1303
	}
1304
	case 1 : {
1305
	    p->son = de_var_sort ( tag_var ) ;
1306
	    break ;
1307
	}
1308
	default : {
1309
	    args = get_char_info ( cons ) ;
1310
	    if ( args ) p->son = de_node ( args ) ;
1311
	    break ;
1312
	}
1313
    }
1314
#ifdef check_tag
1315
    check_tag ( p ) ;
1316
#endif
1317
    return ( p ) ;
1318
}
1319
 
1320
 
1321
/* DECODE A TAGDEC */
1322
 
1323
long de_tagdec_bits
1324
    PROTO_Z ()
1325
{
1326
    long n = fetch_extn ( 2 ) ;
1327
    if ( n < 1 || n > 3 ) {
1328
	input_error ( "Illegal tagdec value, %ld", n ) ;
1329
    }
1330
    return ( n ) ;
1331
}
1332
 
1333
 
1334
/* DECODE A TAGDEF */
1335
 
1336
long de_tagdef_bits
1337
    PROTO_Z ()
1338
{
1339
    long n = fetch_extn ( 2 ) ;
1340
    if ( n < 1 || n > 3 ) {
1341
	input_error ( "Illegal tagdef value, %ld", n ) ;
1342
    }
1343
    return ( n ) ;
1344
}
1345
 
1346
 
1347
/* DECODE A TOKDEC */
1348
 
1349
long de_tokdec_bits
1350
    PROTO_Z ()
1351
{
1352
    long n = fetch_extn ( 1 ) ;
1353
    if ( n < 1 || n > 1 ) {
1354
	input_error ( "Illegal tokdec value, %ld", n ) ;
1355
    }
1356
    return ( n ) ;
1357
}
1358
 
1359
 
1360
/* DECODE A TOKDEF */
1361
 
1362
long de_tokdef_bits
1363
    PROTO_Z ()
1364
{
1365
    long n = fetch_extn ( 1 ) ;
1366
    if ( n < 1 || n > 1 ) {
1367
	input_error ( "Illegal tokdef value, %ld", n ) ;
1368
    }
1369
    return ( n ) ;
1370
}
1371
 
1372
 
1373
/* DECODE A TOKEN */
1374
 
1375
long de_token_bits
1376
    PROTO_Z ()
1377
{
1378
    long n = fetch_extn ( 2 ) ;
1379
    if ( n < 1 || n > 3 ) {
1380
	input_error ( "Illegal token value, %ld", n ) ;
1381
    }
1382
    return ( n ) ;
1383
}
1384
 
1385
 
1386
/* DECODE A TOKEN_DEFN */
1387
 
1388
long de_token_defn_bits
1389
    PROTO_Z ()
1390
{
1391
    long n = fetch_extn ( 1 ) ;
1392
    if ( n < 1 || n > 1 ) {
1393
	input_error ( "Illegal token_defn value, %ld", n ) ;
1394
    }
1395
    return ( n ) ;
1396
}
1397
 
1398
 
1399
/* DECODE A TRANSFER_MODE */
1400
 
1401
node *de_transfer_mode
1402
    PROTO_Z ()
1403
{
1404
    long n = fetch_extn ( 3 ) ;
1405
    char *args ;
1406
    node *p = new_node () ;
1407
    construct *cons = cons_no ( SORT_transfer_mode, n ) ;
1408
    p->cons = cons ;
1409
    if ( n < 1 || n > 8 || cons->name == null ) {
1410
	input_error ( "Illegal transfer_mode value, %ld", n ) ;
1411
    }
1412
    switch ( n ) {
1413
	case 1 : {
1414
	    IGNORE de_token ( p, SORT_transfer_mode ) ;
1415
	    break ;
1416
	}
1417
	case 2 : {
1418
	    args = get_char_info ( cons ) ;
1419
	    p->son = de_node ( args ) ;
1420
	    if ( do_check ) {
1421
		checking = "transfer_mode_cond" ;
1422
		IGNORE check1 ( ENC_integer, p->son ) ;
1423
	    }
1424
	    break ;
1425
	}
1426
	default : {
1427
	    args = get_char_info ( cons ) ;
1428
	    if ( args ) p->son = de_node ( args ) ;
1429
	    break ;
1430
	}
1431
    }
1432
#ifdef check_transfer_mode
1433
    check_transfer_mode ( p ) ;
1434
#endif
1435
    return ( p ) ;
1436
}
1437
 
1438
 
1439
/* DECODE A VARIETY */
1440
 
1441
node *de_variety
1442
    PROTO_Z ()
1443
{
1444
    long n = fetch_extn ( 2 ) ;
1445
    char *args ;
1446
    node *p = new_node () ;
1447
    construct *cons = cons_no ( SORT_variety, n ) ;
1448
    p->cons = cons ;
1449
    if ( n < 1 || n > 4 || cons->name == null ) {
1450
	input_error ( "Illegal variety value, %ld", n ) ;
1451
    }
1452
    switch ( n ) {
1453
	case 1 : {
1454
	    IGNORE de_token ( p, SORT_variety ) ;
1455
	    break ;
1456
	}
1457
	case 2 : {
1458
	    args = get_char_info ( cons ) ;
1459
	    p->son = de_node ( args ) ;
1460
	    if ( do_check ) {
1461
		checking = "var_cond" ;
1462
		IGNORE check1 ( ENC_integer, p->son ) ;
1463
	    }
1464
	    break ;
1465
	}
1466
	default : {
1467
	    args = get_char_info ( cons ) ;
1468
	    if ( args ) p->son = de_node ( args ) ;
1469
	    break ;
1470
	}
1471
    }
1472
#ifdef check_variety
1473
    check_variety ( p ) ;
1474
#endif
1475
    return ( p ) ;
1476
}
1477
 
1478
 
1479
/* DECODE A VERSION */
1480
 
1481
long de_version_bits
1482
    PROTO_Z ()
1483
{
1484
    long n = fetch_extn ( 1 ) ;
1485
    if ( n < 1 || n > 2 ) {
1486
	input_error ( "Illegal version value, %ld", n ) ;
1487
    }
1488
    return ( n ) ;
1489
}
1490
 
1491
 
1492
/* ENCODE A AL_TAG */
1493
 
1494
void enc_al_tag_bits
1495
    PROTO_N ( ( p, n ) )
1496
    PROTO_T ( bitstream *p X int n )
1497
{
1498
    enc_bits_extn ( p, 1, ( long ) n ) ;
1499
    return ;
1500
}
1501
 
1502
 
1503
/* ENCODE A AL_TAGDEF */
1504
 
1505
void enc_al_tagdef_bits
1506
    PROTO_N ( ( p, n ) )
1507
    PROTO_T ( bitstream *p X int n )
1508
{
1509
    enc_bits_extn ( p, 1, ( long ) n ) ;
1510
    return ;
1511
}
1512
 
1513
 
1514
/* ENCODE A EXTERNAL */
1515
 
1516
void enc_external_bits
1517
    PROTO_N ( ( p, n ) )
1518
    PROTO_T ( bitstream *p X int n )
1519
{
1520
    enc_bits_extn ( p, 2, ( long ) n ) ;
1521
    return ;
1522
}
1523
 
1524
 
1525
/* ENCODE A LABEL */
1526
 
1527
void enc_label_bits
1528
    PROTO_N ( ( p, n ) )
1529
    PROTO_T ( bitstream *p X int n )
1530
{
1531
    enc_bits_extn ( p, 1, ( long ) n ) ;
1532
    return ;
1533
}
1534
 
1535
 
1536
/* ENCODE A SORTNAME */
1537
 
1538
void enc_sortname_bits
1539
    PROTO_N ( ( p, n ) )
1540
    PROTO_T ( bitstream *p X int n )
1541
{
1542
    enc_bits_extn ( p, 5, ( long ) n ) ;
1543
    return ;
1544
}
1545
 
1546
 
1547
/* ENCODE A TAG */
1548
 
1549
void enc_tag_bits
1550
    PROTO_N ( ( p, n ) )
1551
    PROTO_T ( bitstream *p X int n )
1552
{
1553
    enc_bits_extn ( p, 1, ( long ) n ) ;
1554
    return ;
1555
}
1556
 
1557
 
1558
/* ENCODE A TAGDEC */
1559
 
1560
void enc_tagdec_bits
1561
    PROTO_N ( ( p, n ) )
1562
    PROTO_T ( bitstream *p X int n )
1563
{
1564
    enc_bits_extn ( p, 2, ( long ) n ) ;
1565
    return ;
1566
}
1567
 
1568
 
1569
/* ENCODE A TAGDEF */
1570
 
1571
void enc_tagdef_bits
1572
    PROTO_N ( ( p, n ) )
1573
    PROTO_T ( bitstream *p X int n )
1574
{
1575
    enc_bits_extn ( p, 2, ( long ) n ) ;
1576
    return ;
1577
}
1578
 
1579
 
1580
/* ENCODE A TOKDEC */
1581
 
1582
void enc_tokdec_bits
1583
    PROTO_N ( ( p, n ) )
1584
    PROTO_T ( bitstream *p X int n )
1585
{
1586
    enc_bits_extn ( p, 1, ( long ) n ) ;
1587
    return ;
1588
}
1589
 
1590
 
1591
/* ENCODE A TOKDEF */
1592
 
1593
void enc_tokdef_bits
1594
    PROTO_N ( ( p, n ) )
1595
    PROTO_T ( bitstream *p X int n )
1596
{
1597
    enc_bits_extn ( p, 1, ( long ) n ) ;
1598
    return ;
1599
}
1600
 
1601
 
1602
/* ENCODE A TOKEN */
1603
 
1604
void enc_token_bits
1605
    PROTO_N ( ( p, n ) )
1606
    PROTO_T ( bitstream *p X int n )
1607
{
1608
    enc_bits_extn ( p, 2, ( long ) n ) ;
1609
    return ;
1610
}
1611
 
1612
 
1613
/* ENCODE A TOKEN_DEFN */
1614
 
1615
void enc_token_defn_bits
1616
    PROTO_N ( ( p, n ) )
1617
    PROTO_T ( bitstream *p X int n )
1618
{
1619
    enc_bits_extn ( p, 1, ( long ) n ) ;
1620
    return ;
1621
}
1622
 
1623
 
1624
/* ENCODE A VERSION */
1625
 
1626
void enc_version_bits
1627
    PROTO_N ( ( p, n ) )
1628
    PROTO_T ( bitstream *p X int n )
1629
{
1630
    enc_bits_extn ( p, 1, ( long ) n ) ;
1631
    return ;
1632
}
1633
 
1634
 
1635
/* READ A ACCESS */
1636
 
1637
node *read_access
1638
    PROTO_N ( ( n ) )
1639
    PROTO_T ( long n )
1640
{
1641
    char *args ;
1642
    node *p = new_node () ;
1643
    construct *cons = cons_no ( SORT_access, n ) ;
1644
    p->cons = cons ;
1645
    if ( n < 0 || n > 13 || cons->name == null ) {
1646
	input_error ( "Illegal access value, %ld", n ) ;
1647
    }
1648
    switch ( n ) {
1649
	case 1 : {
1650
	    read_token ( p, SORT_access ) ;
1651
	    break ;
1652
	}
1653
	case 2 : {
1654
	    args = get_char_info ( cons ) ;
1655
	    p->son = read_node ( args ) ;
1656
	    if ( do_check ) {
1657
		checking = "access_cond" ;
1658
		IGNORE check1 ( ENC_integer, p->son ) ;
1659
	    }
1660
	    break ;
1661
	}
1662
	default : {
1663
	    args = get_char_info ( cons ) ;
1664
	    if ( args ) p->son = read_node ( args ) ;
1665
	    break ;
1666
	}
1667
    }
1668
#ifdef check_access
1669
    check_access ( p ) ;
1670
#endif
1671
    return ( p ) ;
1672
}
1673
 
1674
 
1675
/* READ A AL_TAG */
1676
 
1677
node *read_al_tag
1678
    PROTO_N ( ( n ) )
1679
    PROTO_T ( long n )
1680
{
1681
    char *args ;
1682
    node *p = new_node () ;
1683
    construct *cons = cons_no ( SORT_al_tag, n ) ;
1684
    p->cons = cons ;
1685
    if ( n < 0 || n > 2 || cons->name == null ) {
1686
	input_error ( "Illegal al_tag value, %ld", n ) ;
1687
    }
1688
    switch ( n ) {
1689
	case 2 : {
1690
	    read_token ( p, SORT_al_tag ) ;
1691
	    break ;
1692
	}
1693
	case 1 : {
1694
	    p->son = read_var_sort ( SORT_al_tag ) ;
1695
	    break ;
1696
	}
1697
	default : {
1698
	    args = get_char_info ( cons ) ;
1699
	    if ( args ) p->son = read_node ( args ) ;
1700
	    break ;
1701
	}
1702
    }
1703
#ifdef check_al_tag
1704
    check_al_tag ( p ) ;
1705
#endif
1706
    return ( p ) ;
1707
}
1708
 
1709
 
1710
/* READ A ALIGNMENT */
1711
 
1712
node *read_alignment
1713
    PROTO_N ( ( n ) )
1714
    PROTO_T ( long n )
1715
{
1716
    char *args ;
1717
    node *p = new_node () ;
1718
    construct *cons = cons_no ( SORT_alignment, n ) ;
1719
    p->cons = cons ;
1720
    if ( n < 0 || n > 12 || cons->name == null ) {
1721
	input_error ( "Illegal alignment value, %ld", n ) ;
1722
    }
1723
    switch ( n ) {
1724
	case 1 : {
1725
	    read_token ( p, SORT_alignment ) ;
1726
	    break ;
1727
	}
1728
	case 2 : {
1729
	    args = get_char_info ( cons ) ;
1730
	    p->son = read_node ( args ) ;
1731
	    if ( do_check ) {
1732
		checking = "alignment_cond" ;
1733
		IGNORE check1 ( ENC_integer, p->son ) ;
1734
	    }
1735
	    break ;
1736
	}
1737
	default : {
1738
	    args = get_char_info ( cons ) ;
1739
	    if ( args ) p->son = read_node ( args ) ;
1740
	    break ;
1741
	}
1742
    }
1743
#ifdef check_alignment
1744
    check_alignment ( p ) ;
1745
#endif
1746
    return ( p ) ;
1747
}
1748
 
1749
 
1750
/* READ A BITFIELD_VARIETY */
1751
 
1752
node *read_bitfield_variety
1753
    PROTO_N ( ( n ) )
1754
    PROTO_T ( long n )
1755
{
1756
    char *args ;
1757
    node *p = new_node () ;
1758
    construct *cons = cons_no ( SORT_bitfield_variety, n ) ;
1759
    p->cons = cons ;
1760
    if ( n < 0 || n > 3 || cons->name == null ) {
1761
	input_error ( "Illegal bitfield_variety value, %ld", n ) ;
1762
    }
1763
    switch ( n ) {
1764
	case 1 : {
1765
	    read_token ( p, SORT_bitfield_variety ) ;
1766
	    break ;
1767
	}
1768
	case 2 : {
1769
	    args = get_char_info ( cons ) ;
1770
	    p->son = read_node ( args ) ;
1771
	    if ( do_check ) {
1772
		checking = "bfvar_cond" ;
1773
		IGNORE check1 ( ENC_integer, p->son ) ;
1774
	    }
1775
	    break ;
1776
	}
1777
	default : {
1778
	    args = get_char_info ( cons ) ;
1779
	    if ( args ) p->son = read_node ( args ) ;
1780
	    break ;
1781
	}
1782
    }
1783
#ifdef check_bitfield_variety
1784
    check_bitfield_variety ( p ) ;
1785
#endif
1786
    return ( p ) ;
1787
}
1788
 
1789
 
1790
/* READ A BOOL */
1791
 
1792
node *read_bool
1793
    PROTO_N ( ( n ) )
1794
    PROTO_T ( long n )
1795
{
1796
    char *args ;
1797
    node *p = new_node () ;
1798
    construct *cons = cons_no ( SORT_bool, n ) ;
1799
    p->cons = cons ;
1800
    if ( n < 0 || n > 4 || cons->name == null ) {
1801
	input_error ( "Illegal bool value, %ld", n ) ;
1802
    }
1803
    switch ( n ) {
1804
	case 1 : {
1805
	    read_token ( p, SORT_bool ) ;
1806
	    break ;
1807
	}
1808
	case 2 : {
1809
	    args = get_char_info ( cons ) ;
1810
	    p->son = read_node ( args ) ;
1811
	    if ( do_check ) {
1812
		checking = "bool_cond" ;
1813
		IGNORE check1 ( ENC_integer, p->son ) ;
1814
	    }
1815
	    break ;
1816
	}
1817
	default : {
1818
	    args = get_char_info ( cons ) ;
1819
	    if ( args ) p->son = read_node ( args ) ;
1820
	    break ;
1821
	}
1822
    }
1823
#ifdef check_bool
1824
    check_bool ( p ) ;
1825
#endif
1826
    return ( p ) ;
1827
}
1828
 
1829
 
1830
/* READ A CALLEES */
1831
 
1832
node *read_callees
1833
    PROTO_N ( ( n ) )
1834
    PROTO_T ( long n )
1835
{
1836
    char *args ;
1837
    node *p = new_node () ;
1838
    construct *cons = cons_no ( SORT_callees, n ) ;
1839
    p->cons = cons ;
1840
    if ( n < 0 || n > 3 || cons->name == null ) {
1841
	input_error ( "Illegal callees value, %ld", n ) ;
1842
    }
1843
    args = get_char_info ( cons ) ;
1844
    if ( args ) p->son = read_node ( args ) ;
1845
#ifdef check_callees
1846
    check_callees ( p ) ;
1847
#endif
1848
    return ( p ) ;
1849
}
1850
 
1851
 
1852
/* READ A ERROR_CODE */
1853
 
1854
node *read_error_code
1855
    PROTO_N ( ( n ) )
1856
    PROTO_T ( long n )
1857
{
1858
    char *args ;
1859
    node *p = new_node () ;
1860
    construct *cons = cons_no ( SORT_error_code, n ) ;
1861
    p->cons = cons ;
1862
    if ( n < 0 || n > 3 || cons->name == null ) {
1863
	input_error ( "Illegal error_code value, %ld", n ) ;
1864
    }
1865
    args = get_char_info ( cons ) ;
1866
    if ( args ) p->son = read_node ( args ) ;
1867
#ifdef check_error_code
1868
    check_error_code ( p ) ;
1869
#endif
1870
    return ( p ) ;
1871
}
1872
 
1873
 
1874
/* READ A ERROR_TREATMENT */
1875
 
1876
node *read_error_treatment
1877
    PROTO_N ( ( n ) )
1878
    PROTO_T ( long n )
1879
{
1880
    char *args ;
1881
    node *p = new_node () ;
1882
    construct *cons = cons_no ( SORT_error_treatment, n ) ;
1883
    p->cons = cons ;
1884
    if ( n < 0 || n > 7 || cons->name == null ) {
1885
	input_error ( "Illegal error_treatment value, %ld", n ) ;
1886
    }
1887
    switch ( n ) {
1888
	case 1 : {
1889
	    read_token ( p, SORT_error_treatment ) ;
1890
	    break ;
1891
	}
1892
	case 2 : {
1893
	    args = get_char_info ( cons ) ;
1894
	    p->son = read_node ( args ) ;
1895
	    if ( do_check ) {
1896
		checking = "errt_cond" ;
1897
		IGNORE check1 ( ENC_integer, p->son ) ;
1898
	    }
1899
	    break ;
1900
	}
1901
	default : {
1902
	    args = get_char_info ( cons ) ;
1903
	    if ( args ) p->son = read_node ( args ) ;
1904
	    break ;
1905
	}
1906
    }
1907
#ifdef check_error_treatment
1908
    check_error_treatment ( p ) ;
1909
#endif
1910
    return ( p ) ;
1911
}
1912
 
1913
 
1914
/* READ A EXP */
1915
 
1916
node *read_exp
1917
    PROTO_N ( ( n ) )
1918
    PROTO_T ( long n )
1919
{
1920
    char *args ;
1921
    node *p = new_node () ;
1922
    construct *cons = cons_no ( SORT_exp, n ) ;
1923
    p->cons = cons ;
1924
    if ( n < 0 || n > 116 || cons->name == null ) {
1925
	input_error ( "Illegal exp value, %ld", n ) ;
1926
    }
1927
    switch ( n ) {
1928
	case 1 : {
1929
	    read_token ( p, SORT_exp ) ;
1930
	    break ;
1931
	}
1932
	case 2 : {
1933
	    args = get_char_info ( cons ) ;
1934
	    p->son = read_node ( args ) ;
1935
	    if ( do_check ) {
1936
		checking = "exp_cond" ;
1937
		IGNORE check1 ( ENC_integer, p->son ) ;
1938
	    }
1939
	    break ;
1940
	}
1941
	case 106 : {
1942
	    read_sequence ( p, get_char_info ( cons ) ) ;
1943
	    break ;
1944
	}
1945
	default : {
1946
	    args = get_char_info ( cons ) ;
1947
	    if ( args ) p->son = read_node ( args ) ;
1948
	    break ;
1949
	}
1950
    }
1951
#ifdef check_exp
1952
    check_exp ( p ) ;
1953
#endif
1954
    return ( p ) ;
1955
}
1956
 
1957
 
1958
/* READ A FLOATING_VARIETY */
1959
 
1960
node *read_floating_variety
1961
    PROTO_N ( ( n ) )
1962
    PROTO_T ( long n )
1963
{
1964
    char *args ;
1965
    node *p = new_node () ;
1966
    construct *cons = cons_no ( SORT_floating_variety, n ) ;
1967
    p->cons = cons ;
1968
    if ( n < 0 || n > 6 || cons->name == null ) {
1969
	input_error ( "Illegal floating_variety value, %ld", n ) ;
1970
    }
1971
    switch ( n ) {
1972
	case 1 : {
1973
	    read_token ( p, SORT_floating_variety ) ;
1974
	    break ;
1975
	}
1976
	case 2 : {
1977
	    args = get_char_info ( cons ) ;
1978
	    p->son = read_node ( args ) ;
1979
	    if ( do_check ) {
1980
		checking = "flvar_cond" ;
1981
		IGNORE check1 ( ENC_integer, p->son ) ;
1982
	    }
1983
	    break ;
1984
	}
1985
	default : {
1986
	    args = get_char_info ( cons ) ;
1987
	    if ( args ) p->son = read_node ( args ) ;
1988
	    break ;
1989
	}
1990
    }
1991
#ifdef check_floating_variety
1992
    check_floating_variety ( p ) ;
1993
#endif
1994
    return ( p ) ;
1995
}
1996
 
1997
 
1998
/* READ A LABEL */
1999
 
2000
node *read_label
2001
    PROTO_N ( ( n ) )
2002
    PROTO_T ( long n )
2003
{
2004
    char *args ;
2005
    node *p = new_node () ;
2006
    construct *cons = cons_no ( SORT_label, n ) ;
2007
    p->cons = cons ;
2008
    if ( n < 0 || n > 2 || cons->name == null ) {
2009
	input_error ( "Illegal label value, %ld", n ) ;
2010
    }
2011
    switch ( n ) {
2012
	case 2 : {
2013
	    read_token ( p, SORT_label ) ;
2014
	    break ;
2015
	}
2016
	case 1 : {
2017
	    p->son = read_var_sort ( SORT_label ) ;
2018
	    break ;
2019
	}
2020
	default : {
2021
	    args = get_char_info ( cons ) ;
2022
	    if ( args ) p->son = read_node ( args ) ;
2023
	    break ;
2024
	}
2025
    }
2026
#ifdef check_label
2027
    check_label ( p ) ;
2028
#endif
2029
    return ( p ) ;
2030
}
2031
 
2032
 
2033
/* READ A NAT */
2034
 
2035
node *read_nat
2036
    PROTO_N ( ( n ) )
2037
    PROTO_T ( long n )
2038
{
2039
    char *args ;
2040
    node *p = new_node () ;
2041
    construct *cons = cons_no ( SORT_nat, n ) ;
2042
    p->cons = cons ;
2043
    if ( n < 0 || n > 5 || cons->name == null ) {
2044
	input_error ( "Illegal nat value, %ld", n ) ;
2045
    }
2046
    switch ( n ) {
2047
	case 1 : {
2048
	    read_token ( p, SORT_nat ) ;
2049
	    break ;
2050
	}
2051
	case 2 : {
2052
	    args = get_char_info ( cons ) ;
2053
	    p->son = read_node ( args ) ;
2054
	    if ( do_check ) {
2055
		checking = "nat_cond" ;
2056
		IGNORE check1 ( ENC_integer, p->son ) ;
2057
	    }
2058
	    break ;
2059
	}
2060
	default : {
2061
	    args = get_char_info ( cons ) ;
2062
	    if ( args ) p->son = read_node ( args ) ;
2063
	    break ;
2064
	}
2065
    }
2066
#ifdef check_nat
2067
    check_nat ( p ) ;
2068
#endif
2069
    return ( p ) ;
2070
}
2071
 
2072
 
2073
/* READ A NTEST */
2074
 
2075
node *read_ntest
2076
    PROTO_N ( ( n ) )
2077
    PROTO_T ( long n )
2078
{
2079
    char *args ;
2080
    node *p = new_node () ;
2081
    construct *cons = cons_no ( SORT_ntest, n ) ;
2082
    p->cons = cons ;
2083
    if ( n < 0 || n > 16 || cons->name == null ) {
2084
	input_error ( "Illegal ntest value, %ld", n ) ;
2085
    }
2086
    switch ( n ) {
2087
	case 1 : {
2088
	    read_token ( p, SORT_ntest ) ;
2089
	    break ;
2090
	}
2091
	case 2 : {
2092
	    args = get_char_info ( cons ) ;
2093
	    p->son = read_node ( args ) ;
2094
	    if ( do_check ) {
2095
		checking = "ntest_cond" ;
2096
		IGNORE check1 ( ENC_integer, p->son ) ;
2097
	    }
2098
	    break ;
2099
	}
2100
	default : {
2101
	    args = get_char_info ( cons ) ;
2102
	    if ( args ) p->son = read_node ( args ) ;
2103
	    break ;
2104
	}
2105
    }
2106
#ifdef check_ntest
2107
    check_ntest ( p ) ;
2108
#endif
2109
    return ( p ) ;
2110
}
2111
 
2112
 
2113
/* READ A PROCPROPS */
2114
 
2115
node *read_procprops
2116
    PROTO_N ( ( n ) )
2117
    PROTO_T ( long n )
2118
{
2119
    char *args ;
2120
    node *p = new_node () ;
2121
    construct *cons = cons_no ( SORT_procprops, n ) ;
2122
    p->cons = cons ;
2123
    if ( n < 0 || n > 9 || cons->name == null ) {
2124
	input_error ( "Illegal procprops value, %ld", n ) ;
2125
    }
2126
    switch ( n ) {
2127
	case 1 : {
2128
	    read_token ( p, SORT_procprops ) ;
2129
	    break ;
2130
	}
2131
	case 2 : {
2132
	    args = get_char_info ( cons ) ;
2133
	    p->son = read_node ( args ) ;
2134
	    if ( do_check ) {
2135
		checking = "procprops_cond" ;
2136
		IGNORE check1 ( ENC_integer, p->son ) ;
2137
	    }
2138
	    break ;
2139
	}
2140
	default : {
2141
	    args = get_char_info ( cons ) ;
2142
	    if ( args ) p->son = read_node ( args ) ;
2143
	    break ;
2144
	}
2145
    }
2146
#ifdef check_procprops
2147
    check_procprops ( p ) ;
2148
#endif
2149
    return ( p ) ;
2150
}
2151
 
2152
 
2153
/* READ A ROUNDING_MODE */
2154
 
2155
node *read_rounding_mode
2156
    PROTO_N ( ( n ) )
2157
    PROTO_T ( long n )
2158
{
2159
    char *args ;
2160
    node *p = new_node () ;
2161
    construct *cons = cons_no ( SORT_rounding_mode, n ) ;
2162
    p->cons = cons ;
2163
    if ( n < 0 || n > 7 || cons->name == null ) {
2164
	input_error ( "Illegal rounding_mode value, %ld", n ) ;
2165
    }
2166
    switch ( n ) {
2167
	case 1 : {
2168
	    read_token ( p, SORT_rounding_mode ) ;
2169
	    break ;
2170
	}
2171
	case 2 : {
2172
	    args = get_char_info ( cons ) ;
2173
	    p->son = read_node ( args ) ;
2174
	    if ( do_check ) {
2175
		checking = "rounding_mode_cond" ;
2176
		IGNORE check1 ( ENC_integer, p->son ) ;
2177
	    }
2178
	    break ;
2179
	}
2180
	default : {
2181
	    args = get_char_info ( cons ) ;
2182
	    if ( args ) p->son = read_node ( args ) ;
2183
	    break ;
2184
	}
2185
    }
2186
#ifdef check_rounding_mode
2187
    check_rounding_mode ( p ) ;
2188
#endif
2189
    return ( p ) ;
2190
}
2191
 
2192
 
2193
/* READ A SHAPE */
2194
 
2195
node *read_shape
2196
    PROTO_N ( ( n ) )
2197
    PROTO_T ( long n )
2198
{
2199
    char *args ;
2200
    node *p = new_node () ;
2201
    construct *cons = cons_no ( SORT_shape, n ) ;
2202
    p->cons = cons ;
2203
    if ( n < 0 || n > 12 || cons->name == null ) {
2204
	input_error ( "Illegal shape value, %ld", n ) ;
2205
    }
2206
    switch ( n ) {
2207
	case 1 : {
2208
	    read_token ( p, SORT_shape ) ;
2209
	    break ;
2210
	}
2211
	case 2 : {
2212
	    args = get_char_info ( cons ) ;
2213
	    p->son = read_node ( args ) ;
2214
	    if ( do_check ) {
2215
		checking = "shape_cond" ;
2216
		IGNORE check1 ( ENC_integer, p->son ) ;
2217
	    }
2218
	    break ;
2219
	}
2220
	default : {
2221
	    args = get_char_info ( cons ) ;
2222
	    if ( args ) p->son = read_node ( args ) ;
2223
	    break ;
2224
	}
2225
    }
2226
#ifdef check_shape
2227
    check_shape ( p ) ;
2228
#endif
2229
    return ( p ) ;
2230
}
2231
 
2232
 
2233
/* READ A SIGNED_NAT */
2234
 
2235
node *read_signed_nat
2236
    PROTO_N ( ( n ) )
2237
    PROTO_T ( long n )
2238
{
2239
    char *args ;
2240
    node *p = new_node () ;
2241
    construct *cons = cons_no ( SORT_signed_nat, n ) ;
2242
    p->cons = cons ;
2243
    if ( n < 0 || n > 5 || cons->name == null ) {
2244
	input_error ( "Illegal signed_nat value, %ld", n ) ;
2245
    }
2246
    switch ( n ) {
2247
	case 1 : {
2248
	    read_token ( p, SORT_signed_nat ) ;
2249
	    break ;
2250
	}
2251
	case 2 : {
2252
	    args = get_char_info ( cons ) ;
2253
	    p->son = read_node ( args ) ;
2254
	    if ( do_check ) {
2255
		checking = "signed_nat_cond" ;
2256
		IGNORE check1 ( ENC_integer, p->son ) ;
2257
	    }
2258
	    break ;
2259
	}
2260
	case 4 : {
2261
	    read_make_signed_nat ( p, get_char_info ( cons ) ) ;
2262
	    break ;
2263
	}
2264
	default : {
2265
	    args = get_char_info ( cons ) ;
2266
	    if ( args ) p->son = read_node ( args ) ;
2267
	    break ;
2268
	}
2269
    }
2270
#ifdef check_signed_nat
2271
    check_signed_nat ( p ) ;
2272
#endif
2273
    return ( p ) ;
2274
}
2275
 
2276
 
2277
/* READ A STRING */
2278
 
2279
node *read_string
2280
    PROTO_N ( ( n ) )
2281
    PROTO_T ( long n )
2282
{
2283
    char *args ;
2284
    node *p = new_node () ;
2285
    construct *cons = cons_no ( SORT_string, n ) ;
2286
    p->cons = cons ;
2287
    if ( n < 0 || n > 4 || cons->name == null ) {
2288
	input_error ( "Illegal string value, %ld", n ) ;
2289
    }
2290
    switch ( n ) {
2291
	case 1 : {
2292
	    read_token ( p, SORT_string ) ;
2293
	    break ;
2294
	}
2295
	case 2 : {
2296
	    args = get_char_info ( cons ) ;
2297
	    p->son = read_node ( args ) ;
2298
	    if ( do_check ) {
2299
		checking = "string_cond" ;
2300
		IGNORE check1 ( ENC_integer, p->son ) ;
2301
	    }
2302
	    break ;
2303
	}
2304
	default : {
2305
	    args = get_char_info ( cons ) ;
2306
	    if ( args ) p->son = read_node ( args ) ;
2307
	    break ;
2308
	}
2309
    }
2310
#ifdef check_string
2311
    check_string ( p ) ;
2312
#endif
2313
    return ( p ) ;
2314
}
2315
 
2316
 
2317
/* READ A TAG */
2318
 
2319
node *read_tag
2320
    PROTO_N ( ( n ) )
2321
    PROTO_T ( long n )
2322
{
2323
    char *args ;
2324
    node *p = new_node () ;
2325
    construct *cons = cons_no ( SORT_tag, n ) ;
2326
    p->cons = cons ;
2327
    if ( n < 0 || n > 2 || cons->name == null ) {
2328
	input_error ( "Illegal tag value, %ld", n ) ;
2329
    }
2330
    switch ( n ) {
2331
	case 2 : {
2332
	    read_token ( p, SORT_tag ) ;
2333
	    break ;
2334
	}
2335
	case 1 : {
2336
	    p->son = read_var_sort ( SORT_tag ) ;
2337
	    break ;
2338
	}
2339
	default : {
2340
	    args = get_char_info ( cons ) ;
2341
	    if ( args ) p->son = read_node ( args ) ;
2342
	    break ;
2343
	}
2344
    }
2345
#ifdef check_tag
2346
    check_tag ( p ) ;
2347
#endif
2348
    return ( p ) ;
2349
}
2350
 
2351
 
2352
/* READ A TRANSFER_MODE */
2353
 
2354
node *read_transfer_mode
2355
    PROTO_N ( ( n ) )
2356
    PROTO_T ( long n )
2357
{
2358
    char *args ;
2359
    node *p = new_node () ;
2360
    construct *cons = cons_no ( SORT_transfer_mode, n ) ;
2361
    p->cons = cons ;
2362
    if ( n < 0 || n > 8 || cons->name == null ) {
2363
	input_error ( "Illegal transfer_mode value, %ld", n ) ;
2364
    }
2365
    switch ( n ) {
2366
	case 1 : {
2367
	    read_token ( p, SORT_transfer_mode ) ;
2368
	    break ;
2369
	}
2370
	case 2 : {
2371
	    args = get_char_info ( cons ) ;
2372
	    p->son = read_node ( args ) ;
2373
	    if ( do_check ) {
2374
		checking = "transfer_mode_cond" ;
2375
		IGNORE check1 ( ENC_integer, p->son ) ;
2376
	    }
2377
	    break ;
2378
	}
2379
	default : {
2380
	    args = get_char_info ( cons ) ;
2381
	    if ( args ) p->son = read_node ( args ) ;
2382
	    break ;
2383
	}
2384
    }
2385
#ifdef check_transfer_mode
2386
    check_transfer_mode ( p ) ;
2387
#endif
2388
    return ( p ) ;
2389
}
2390
 
2391
 
2392
/* READ A VARIETY */
2393
 
2394
node *read_variety
2395
    PROTO_N ( ( n ) )
2396
    PROTO_T ( long n )
2397
{
2398
    char *args ;
2399
    node *p = new_node () ;
2400
    construct *cons = cons_no ( SORT_variety, n ) ;
2401
    p->cons = cons ;
2402
    if ( n < 0 || n > 4 || cons->name == null ) {
2403
	input_error ( "Illegal variety value, %ld", n ) ;
2404
    }
2405
    switch ( n ) {
2406
	case 1 : {
2407
	    read_token ( p, SORT_variety ) ;
2408
	    break ;
2409
	}
2410
	case 2 : {
2411
	    args = get_char_info ( cons ) ;
2412
	    p->son = read_node ( args ) ;
2413
	    if ( do_check ) {
2414
		checking = "var_cond" ;
2415
		IGNORE check1 ( ENC_integer, p->son ) ;
2416
	    }
2417
	    break ;
2418
	}
2419
	default : {
2420
	    args = get_char_info ( cons ) ;
2421
	    if ( args ) p->son = read_node ( args ) ;
2422
	    break ;
2423
	}
2424
    }
2425
#ifdef check_variety
2426
    check_variety ( p ) ;
2427
#endif
2428
    return ( p ) ;
2429
}