Subversion Repositories tendra.SVN

Rev

Rev 7 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific, prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * $Id$
30
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
7 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
7 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
7 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
7 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
7 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
#include "config.h"
62
#include <ctype.h>
63
#include "types.h"
64
#include "file.h"
65
#include "high.h"
66
#include "names.h"
67
#include "node.h"
68
#include "shape.h"
69
#include "table.h"
70
#include "tdf.h"
71
#include "utility.h"
72
#include "write.h"
73
 
74
 
75
/*
76
    FLAGS CONTROLLING OUTPUT OF TOKENS ETC
77
 
78
    The output is in the fully expanded form if verbose is true.  The
79
    shape of each expression is printed if print_shapes is true.  The
80
    flag func_output controls whether the output should be lisp-like
81
    (default) or c-like.
82
*/
83
 
7 7u83 84
boolean verbose = 0;
85
boolean print_shapes = 0;
86
boolean func_output = 0;
2 7u83 87
 
88
 
7 7u83 89
static void	print_spaces(int);
90
 
2 7u83 91
/*
92
    PRINT A NUMBER OF SPACES
93
 
94
    An indentation of d spaces is printed to the output file.
95
*/
96
 
7 7u83 97
static void
98
print_spaces(int d)
2 7u83 99
{
7 7u83 100
    int n = 2 * d;
101
    while (n >= 8) {
102
	IGNORE fputc('\t', output);
103
	n -= 8;
2 7u83 104
    }
7 7u83 105
    while (n) {
106
	IGNORE fputc(' ', output);
107
	n--;
2 7u83 108
    }
7 7u83 109
    return;
2 7u83 110
}
111
 
112
 
113
/*
114
    PRINT A NODE
115
 
116
    The node p is printed to the output file with an indentation of
117
    d spaces.
118
*/
119
 
7 7u83 120
static boolean
121
print_node(node *p, int d)
2 7u83 122
{
7 7u83 123
    boolean negate = 0;
124
    boolean newline = 0;
125
    while (p) {
126
	construct *q = p->cons;
127
	sortname s = q->sortnum;
128
	long m = q->encoding;
129
	newline = 0;
130
	switch (s) {
2 7u83 131
 
7 7u83 132
	    case SORT_tdfbool: {
2 7u83 133
		/* Set neg for subsequent number */
7 7u83 134
		negate = (boolean)(m ? 1 : 0);
135
		break;
2 7u83 136
	    }
137
 
7 7u83 138
	    case SORT_bytestream: {
2 7u83 139
		/* Print a bytestream */
7 7u83 140
		newline = print_node(p->son, d);
141
		break;
2 7u83 142
	    }
143
 
7 7u83 144
	    case SORT_completion: {
2 7u83 145
		/* Print a completion */
7 7u83 146
		newline = print_node(p->son, d);
147
		break;
2 7u83 148
	    }
149
 
7 7u83 150
	    case SORT_small_tdfint: {
2 7u83 151
		/* Print a small number */
7 7u83 152
		long n = q->encoding;
153
		print_spaces(d);
154
		if (negate)n = -n;
155
		IGNORE fprintf(output, "%ld", n);
156
		negate = 0;
157
		newline = 1;
158
		break;
2 7u83 159
	    }
160
 
7 7u83 161
	    case SORT_tdfint: {
2 7u83 162
		/* Print a number */
7 7u83 163
		char *num = q->name;
164
		print_spaces(d);
165
		if (fits_ulong(num, 0)) {
166
		    unsigned long n = octal_to_ulong(num);
167
		    if (negate && n)IGNORE fputc('-', output);
168
		    IGNORE fprintf(output, "%lu", n);
2 7u83 169
		} else {
7 7u83 170
		    if (negate)IGNORE fputc('-', output);
171
		    IGNORE fprintf(output, "0%s", num);
2 7u83 172
		}
7 7u83 173
		negate = 0;
174
		newline = 1;
175
		break;
2 7u83 176
	    }
177
 
7 7u83 178
	    case SORT_option: {
2 7u83 179
		/* Print an optional argument */
7 7u83 180
		if (p->son) {
181
		    newline = print_node(p->son, d);
2 7u83 182
		} else {
7 7u83 183
		    print_spaces(d);
184
		    IGNORE fputc('-', output);
185
		    newline = 1;
2 7u83 186
		}
7 7u83 187
		break;
2 7u83 188
	    }
189
 
7 7u83 190
	    case SORT_repeat: {
2 7u83 191
		/* Print a repeated argument */
7 7u83 192
		if (m == 0) {
193
		    print_spaces(d);
194
		    IGNORE fputc('|', output);
195
		    newline = 1;
2 7u83 196
		} else {
7 7u83 197
		    newline = print_node(p->son, d);
198
		    if (func_output)IGNORE fputc(',', output);
199
		    IGNORE fputs(" |", output);
2 7u83 200
		}
7 7u83 201
		break;
2 7u83 202
	    }
203
 
7 7u83 204
	    case SORT_tdfstring: {
2 7u83 205
		/* Print a string */
7 7u83 206
		int i, n = (int)m;
207
		print_spaces(d);
208
		if (n == -1) {
209
		    char *f = (func_output ? "%s (\n" : "( %s\n");
210
		    IGNORE fprintf(output, f, MAKE_STRING);
211
		    newline = print_node(p->son, d + 1);
212
		    IGNORE fputs(" )", output);
2 7u83 213
		} else {
7 7u83 214
		    IGNORE fputc('"', output);
215
		    for (i = 0; i < n; i++) {
216
			int c = ((q->name[i]) & 0xff);
217
			if (isprint(c)) {
218
			    if (c == '\\' || c == '"') {
219
				IGNORE fputc('\\', output);
2 7u83 220
			    }
7 7u83 221
			    IGNORE fputc(c, output);
2 7u83 222
			} else {
7 7u83 223
			    if (c == '\n') {
224
				IGNORE fputs("\\n", output);
225
			    } else if (c == '\t') {
226
				IGNORE fputs("\\t", output);
2 7u83 227
			    } else {
7 7u83 228
				unsigned co = (unsigned)c;
229
				IGNORE fprintf(output, "\\%03o", co);
2 7u83 230
			    }
231
			}
232
		    }
7 7u83 233
		    IGNORE fputc('"', output);
234
		    newline = 1;
2 7u83 235
		}
7 7u83 236
		break;
2 7u83 237
	    }
238
 
7 7u83 239
	    case SORT_nat: {
2 7u83 240
		/* Print a nat */
7 7u83 241
		if (m != ENC_make_nat)goto default_label;
242
		newline = print_node(p->son, d);
243
		break;
2 7u83 244
	    }
245
 
7 7u83 246
	    case SORT_signed_nat: {
2 7u83 247
		/* Print a signed_nat */
7 7u83 248
		if (m != ENC_make_signed_nat)goto default_label;
249
		newline = print_node(p->son, d);
250
		break;
2 7u83 251
	    }
252
 
7 7u83 253
	    case SORT_string: {
2 7u83 254
		/* Print a string */
7 7u83 255
		if (m != ENC_make_string)goto default_label;
256
		newline = print_node(p->son, d);
257
		break;
2 7u83 258
	    }
259
 
7 7u83 260
	    case SORT_al_tag: {
2 7u83 261
		/* Print an alignment tag */
7 7u83 262
		if (verbose || m != ENC_make_al_tag || p->son == null) {
263
		    goto default_label;
2 7u83 264
		}
7 7u83 265
		newline = print_node(p->son, d);
266
		break;
2 7u83 267
	    }
268
 
7 7u83 269
	    case SORT_label: {
2 7u83 270
		/* Print a label */
7 7u83 271
		if (verbose || m != ENC_make_label || p->son == null) {
272
		    goto default_label;
2 7u83 273
		}
7 7u83 274
		newline = print_node(p->son, d);
275
		break;
2 7u83 276
	    }
277
 
7 7u83 278
	    case SORT_tag: {
2 7u83 279
		/* Print a tag */
7 7u83 280
		if (verbose || m != ENC_make_tag || p->son == null) {
281
		    goto default_label;
2 7u83 282
		}
7 7u83 283
		newline = print_node(p->son, d);
284
		break;
2 7u83 285
	    }
286
 
7 7u83 287
	    case SORT_exp: {
288
		static node special_node;
289
		if (print_shapes && p->shape != &special_node) {
2 7u83 290
		    /* Change exp to show shape */
7 7u83 291
		    node *z = new_node();
292
		    z->cons = &exp_shape;
293
		    z->bro = p->bro;
294
		    z->son = p;
295
		    if (p->shape) {
296
			z->son->bro = copy_node(p->shape);
2 7u83 297
		    } else {
7 7u83 298
			z->son->bro = new_node();
299
			z->son->bro->cons = &unknown_cons;
2 7u83 300
		    }
7 7u83 301
		    p->shape = &special_node;
302
		    p = z;
303
		    q = p->cons;
304
		    m = q->encoding;
2 7u83 305
		}
7 7u83 306
		goto default_label;
2 7u83 307
	    }
308
 
309
	    default : {
310
		/* Print a simple sort */
311
		default_label : {
7 7u83 312
		    if (!verbose && m == sort_tokens[s] && p->son &&
313
			 p->son->cons->sortnum == SORT_token) {
314
			newline = print_node(p->son, d);
2 7u83 315
		    } else {
7 7u83 316
			print_spaces(d);
317
			if (p->son) {
318
			    char *f = (func_output ? "%s (\n" : "( %s\n");
319
			    IGNORE fprintf(output, f, q->name);
320
			    newline = print_node(p->son, d + 1);
321
			    IGNORE fputs(" )", output);
2 7u83 322
			} else {
7 7u83 323
			    IGNORE fprintf(output, "%s", q->name);
324
			    newline = 1;
2 7u83 325
			}
326
		    }
327
		}
7 7u83 328
		break;
2 7u83 329
	    }
330
	}
7 7u83 331
	p = p->bro;
332
	if (newline && p) {
333
	    if (func_output)IGNORE fputc(',', output);
334
	    IGNORE fputc('\n', output);
335
	    newline = 0;
2 7u83 336
	}
337
    }
7 7u83 338
    return(newline);
2 7u83 339
}
340
 
341
 
342
/*
343
    PRINT AN EXTERNAL NAME
344
 
345
    The start of a statement with name title concerning the construct
346
    p is output.  dec is true if this is the first statement concerning p.
347
*/
348
 
7 7u83 349
static void
350
print_name(char *title, construct *p, int dec)
2 7u83 351
{
7 7u83 352
    if (!func_output)IGNORE fputs("( ", output);
353
    if (p->ename == null)IGNORE fprintf(output, "%s ", LOCAL_DECL);
354
    IGNORE fprintf(output, "%s", title);
355
    if (func_output)IGNORE fputs(" (", output);
356
    if (p->ename && p->ename->cons->encoding && dec) {
357
	char *f = (func_output ? "\n  %s (\n" : "\n  ( %s\n");
358
	if (p->ename->son->cons->sortnum == SORT_tdfstring) {
359
	    if (p->ename->son->bro == null) {
360
		IGNORE fprintf(output, f, MAKE_STRING_EXTERN);
2 7u83 361
	    } else {
7 7u83 362
		IGNORE fprintf(output, f, MAKE_CHAIN_EXTERN);
2 7u83 363
	    }
364
	} else {
7 7u83 365
	    IGNORE fprintf(output, f, MAKE_UNIQUE_EXTERN);
2 7u83 366
	}
7 7u83 367
	IGNORE print_node(p->ename->son, 2);
368
	if (func_output) {
369
	    IGNORE fputs(" ),\n  ", output);
2 7u83 370
	} else {
7 7u83 371
	    IGNORE fputs(" )\n  ", output);
2 7u83 372
	}
373
    } else {
7 7u83 374
	IGNORE fputc(' ', output);
2 7u83 375
    }
7 7u83 376
    IGNORE fprintf(output, "%s", p->name);
377
    return;
2 7u83 378
}
379
 
380
 
381
/*
382
    ALIGNMENT TAG DECLARATION AUXILIARY PRINTING ROUTINE
383
 
384
    Print the declaration of the alignment tag p.
385
*/
386
 
7 7u83 387
static void
388
print_aldec(construct *p)
2 7u83 389
{
7 7u83 390
    if (p->encoding == -1) return;
391
    print_name(MAKE_ALDEC, p, 1);
392
    IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
393
    return;
2 7u83 394
}
395
 
396
 
397
/*
398
    ALIGNMENT TAG DEFINITION AUXILIARY PRINTING ROUTINE
399
 
400
    Print the definition of the alignment tag p.
401
*/
402
 
7 7u83 403
static void
404
print_aldef(construct *p)
2 7u83 405
{
7 7u83 406
    al_tag_info *info = get_al_tag_info(p);
407
    if (p->encoding == -1) return;
408
    if (info->def == null) return;
409
    print_name(MAKE_ALDEF, p, !show_aldecs);
410
    if (func_output)IGNORE fputc(',', output);
411
    IGNORE fputc('\n', output);
412
    IGNORE print_node(info->def, 1);
413
    IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
414
    return;
2 7u83 415
}
416
 
417
 
418
/*
419
    TAG DECLARATION AUXILIARY PRINTING ROUTINE
420
 
421
    Print the declaration of the tag p.
422
*/
423
 
7 7u83 424
static void
425
print_tagdec(construct *p)
2 7u83 426
{
7 7u83 427
    tag_info *info = get_tag_info(p);
428
    if (p->encoding == -1 || info->dec == null) return;
429
    switch (info->var) {
430
	case 0: print_name(MAKE_ID_TAGDEC, p, 1); break;
431
	case 1: print_name(MAKE_VAR_TAGDEC, p, 1); break;
432
	case 2: print_name(COMMON_TAGDEC, p, 1); break;
2 7u83 433
    }
7 7u83 434
    if (func_output)IGNORE fputc(',', output);
435
    IGNORE fputc('\n', output);
436
    IGNORE print_node(info->dec, 1);
437
    IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
438
    return;
2 7u83 439
}
440
 
441
 
442
/*
443
    TAG DEFINITION AUXILIARY PRINTING ROUTINE
444
 
445
    Print the definition of the tag p.
446
*/
447
 
7 7u83 448
static void
449
print_tagdef(construct *p)
2 7u83 450
{
7 7u83 451
    char *instr;
452
    tag_info *info = get_tag_info(p);
453
    node *d = info->def;
454
    if (p->encoding == -1 || d == null) return;
455
    switch (info->var)EXHAUSTIVE {
456
	case 0: instr = MAKE_ID_TAGDEF; break;
457
	case 1: instr = MAKE_VAR_TAGDEF; break;
458
	case 2: instr = COMMON_TAGDEF; break;
2 7u83 459
    }
7 7u83 460
    while (d) {
2 7u83 461
	/* Can have multiple definitions */
7 7u83 462
	print_name(instr, p, !show_tagdecs);
463
	if (func_output)IGNORE fputc(',', output);
464
	IGNORE fputc('\n', output);
465
	IGNORE print_node(d->son, 1);
466
	IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
467
	d = d->bro;
2 7u83 468
    }
7 7u83 469
    return;
2 7u83 470
}
471
 
472
 
473
/*
474
    TOKEN DECLARATION AUXILIARY PRINTING ROUTINE
475
 
476
    Print the declaration of the token p.
477
*/
478
 
7 7u83 479
static void
480
print_tokdec(construct *p)
2 7u83 481
{
7 7u83 482
    tok_info *info = get_tok_info(p);
483
    if (p->encoding == -1) return;
484
    if (!info->dec) return;
485
    print_name(MAKE_TOKDEC, p, 1);
486
    if (func_output)IGNORE fputc(',', output);
487
    IGNORE fputc('\n', output);
488
    if (info->sig) {
489
	IGNORE print_node(info->sig, 1);
2 7u83 490
    } else {
7 7u83 491
	print_spaces(1);
492
	IGNORE fputc('-', output);
2 7u83 493
    }
7 7u83 494
    if (func_output)IGNORE fputc(',', output);
495
    IGNORE fputs("\n  ", output);
496
    if (info->args) {
497
	int n = 0;
498
	char *q = info->args;
499
	IGNORE fputs("( ", output);
500
	while (*q) {
501
	    sortname s;
502
	    q = find_sortname(q, &s);
503
	    q++;
504
	    if (n++ == 8) {
505
		IGNORE fputs("\n  ", output);
506
		n = 1;
2 7u83 507
	    }
7 7u83 508
	    IGNORE fputs(sort_name(s), output);
509
	    if (func_output && *q)IGNORE fputc(',', output);
510
	    IGNORE fputc(' ', output);
2 7u83 511
	}
7 7u83 512
	IGNORE fputs(") ", output);
513
	if (func_output)IGNORE fputs("-> ", output);
2 7u83 514
    }
7 7u83 515
    IGNORE fputs(sort_name(info->res), output);
516
    IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
517
    return;
2 7u83 518
}
519
 
520
 
521
/*
522
    TOKEN DEFINITION AUXILIARY PRINTING ROUTINE
523
 
524
    Print the definition of the token p.
525
*/
526
 
7 7u83 527
static void
528
print_tokdef(construct *p)
2 7u83 529
{
7 7u83 530
    tok_info *info = get_tok_info(p);
531
    if (p->encoding == -1) return;
532
    if (!info->dec) return;
533
    if (info->def == null) return;
534
    print_name(MAKE_TOKDEF, p, !show_tagdefs);
535
    if (func_output)IGNORE fputc(',', output);
536
    IGNORE fputc('\n', output);
537
    if (info->sig) {
538
	IGNORE print_node(info->sig, 1);
2 7u83 539
    } else {
7 7u83 540
	print_spaces(1);
541
	IGNORE fputc('-', output);
2 7u83 542
    }
7 7u83 543
    if (func_output)IGNORE fputc(',', output);
544
    IGNORE fputs("\n  ", output);
545
    if (info->args) {
546
	int n = 0;
547
	construct **q = info->pars;
548
	IGNORE fputs("( ", output);
549
	while (*q) {
550
	    tok_info *qinfo = get_tok_info(*q);
551
	    if (n++ == 4) {
552
		IGNORE fputs("\n    ", output);
553
		n = 1;
2 7u83 554
	    }
7 7u83 555
	    IGNORE fprintf(output, "%s %s", sort_name(qinfo->res),
556
			    (*q) ->name);
557
	    q++;
558
	    if (func_output && *q)IGNORE fputc(',', output);
559
	    IGNORE fputc(' ', output);
2 7u83 560
	}
7 7u83 561
	IGNORE fputs(") ", output);
562
	if (func_output)IGNORE fputs("-> ", output);
2 7u83 563
    }
7 7u83 564
    IGNORE fputs(sort_name(info->res), output);
565
    if (func_output)IGNORE fputc(',', output);
566
    IGNORE fputc('\n', output);
567
    IGNORE print_node(info->def, 1);
568
    IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
569
    return;
2 7u83 570
}
571
 
572
 
573
/*
574
    PRINT A HIGH-LEVEL SORT
575
 
576
    This routine prints the high level sort h.
577
*/
578
 
7 7u83 579
static void
580
print_high_sort(high_sort *h)
2 7u83 581
{
7 7u83 582
    int i, n;
583
    if (h->id == SORT_unknown) return;
584
    if (func_output) {
585
	IGNORE fprintf(output, "%s ( %s, ", MAKE_SORT, h->name);
2 7u83 586
    } else {
7 7u83 587
	IGNORE fprintf(output, "( %s %s ", MAKE_SORT, h->name);
2 7u83 588
    }
7 7u83 589
    n = h->no_args;
590
    if (n) {
591
	int m = 0;
592
	IGNORE fputs("( ", output);
593
	for (i = 0; i < n; i++) {
594
	    if (m++ == 8) {
595
		IGNORE fputs("\n  ", output);
596
		m = 1;
2 7u83 597
	    }
7 7u83 598
	    IGNORE fputs(sort_name(h->args[i]), output);
599
	    if (func_output && i < n - 1)IGNORE fputc(',', output);
600
	    IGNORE fputc(' ', output);
2 7u83 601
	}
7 7u83 602
	IGNORE fputs(") ", output);
603
	if (func_output)IGNORE fputs("-> ", output);
2 7u83 604
    }
7 7u83 605
    IGNORE fputs(sort_name(h->res), output);
606
    IGNORE fputs((func_output ? " ) ;\n\n" : " )\n\n"), output);
607
    return;
2 7u83 608
}
609
 
610
 
611
/*
612
    MAIN PRINTING ROUTINE
613
 
614
    This routine prints an entire capsule to the output file.
615
*/
616
 
7 7u83 617
void
618
print_capsule(void)
2 7u83 619
{
7 7u83 620
    if (high_sorts) {
621
	int i;
622
	IGNORE fputs("# HIGH-LEVEL SORTS\n\n", output);
623
	for (i = 0; i < crt_high_sort; i++) {
624
	    print_high_sort(high_sorts + i);
2 7u83 625
	}
7 7u83 626
	IGNORE fputc('\n', output);
2 7u83 627
    }
7 7u83 628
    if (show_tokdecs) {
629
	IGNORE fputs("# TOKEN DECLARATIONS\n\n", output);
630
	apply_to_all(print_tokdec, SORT_token);
631
	IGNORE fputc('\n', output);
2 7u83 632
    }
7 7u83 633
    if (show_aldecs) {
634
	IGNORE fputs("# ALIGNMENT TAG DECLARATIONS\n\n", output);
635
	apply_to_all(print_aldec, SORT_al_tag);
636
	IGNORE fputc('\n', output);
2 7u83 637
    }
7 7u83 638
    if (show_tagdecs) {
639
	IGNORE fputs("# TAG DECLARATIONS\n\n", output);
640
	apply_to_all(print_tagdec, SORT_tag);
641
	IGNORE fputc('\n', output);
2 7u83 642
    }
7 7u83 643
    if (show_tokdefs) {
644
	IGNORE fputs("# TOKEN DEFINITIONS\n\n", output);
645
	apply_to_all(print_tokdef, SORT_token);
646
	IGNORE fputc('\n', output);
2 7u83 647
    }
7 7u83 648
    if (show_aldefs) {
649
	IGNORE fputs("# ALIGNMENT TAG DEFINITIONS\n\n", output);
650
	apply_to_all(print_aldef, SORT_al_tag);
651
	IGNORE fputc('\n', output);
2 7u83 652
    }
7 7u83 653
    if (show_tagdefs) {
654
	IGNORE fputs("# TAG DEFINITIONS\n\n", output);
655
	apply_to_all(print_tagdef, SORT_tag);
656
	IGNORE fputc('\n', output);
2 7u83 657
    }
7 7u83 658
    return;
2 7u83 659
}