time: Use clock_gettime
[dragonfly.git] / contrib / byacc / output.c
blobecd9494cac38ccf4e9ca1262b651096f7216cf32
1 /* $Id: output.c,v 1.74 2014/10/05 23:21:09 tom Exp $ */
3 #include "defs.h"
5 #define StaticOrR (rflag ? "" : "static ")
6 #define CountLine(fp) (!rflag || ((fp) == code_file))
8 #if defined(YYBTYACC)
9 #define PER_STATE 3
10 #else
11 #define PER_STATE 2
12 #endif
14 static int nvectors;
15 static int nentries;
16 static Value_t **froms;
17 static Value_t **tos;
18 #if defined(YYBTYACC)
19 static Value_t *conflicts = NULL;
20 static Value_t nconflicts = 0;
21 #endif
22 static Value_t *tally;
23 static Value_t *width;
24 static Value_t *state_count;
25 static Value_t *order;
26 static Value_t *base;
27 static Value_t *pos;
28 static int maxtable;
29 static Value_t *table;
30 static Value_t *check;
31 static int lowzero;
32 static long high;
34 static void
35 putc_code(FILE * fp, int c)
37 if ((c == '\n') && (fp == code_file))
38 ++outline;
39 putc(c, fp);
42 static void
43 putl_code(FILE * fp, const char *s)
45 if (fp == code_file)
46 ++outline;
47 fputs(s, fp);
50 static void
51 puts_code(FILE * fp, const char *s)
53 fputs(s, fp);
56 static void
57 puts_param_types(FILE * fp, param * list, int more)
59 param *p;
61 if (list != 0)
63 for (p = list; p; p = p->next)
65 size_t len_type = strlen(p->type);
66 fprintf(fp, "%s%s%s%s%s", p->type,
67 (((len_type != 0) && (p->type[len_type - 1] == '*'))
68 ? ""
69 : " "),
70 p->name, p->type2,
71 ((more || p->next) ? ", " : ""));
74 else
76 if (!more)
77 fprintf(fp, "void");
81 static void
82 puts_param_names(FILE * fp, param * list, int more)
84 param *p;
86 for (p = list; p; p = p->next)
88 fprintf(fp, "%s%s", p->name,
89 ((more || p->next) ? ", " : ""));
93 static void
94 write_code_lineno(FILE * fp)
96 if (!lflag && (fp == code_file))
98 ++outline;
99 fprintf(fp, line_format, outline + 1, code_file_name);
103 static void
104 write_input_lineno(void)
106 if (!lflag)
108 ++outline;
109 fprintf(code_file, line_format, lineno, input_file_name);
113 static void
114 define_prefixed(FILE * fp, const char *name)
116 int bump_line = CountLine(fp);
117 if (bump_line)
118 ++outline;
119 fprintf(fp, "\n");
121 if (bump_line)
122 ++outline;
123 fprintf(fp, "#ifndef %s\n", name);
125 if (bump_line)
126 ++outline;
127 fprintf(fp, "#define %-10s %s%s\n", name, symbol_prefix, name + 2);
129 if (bump_line)
130 ++outline;
131 fprintf(fp, "#endif /* %s */\n", name);
134 static void
135 output_prefix(FILE * fp)
137 if (symbol_prefix == NULL)
139 symbol_prefix = "yy";
141 else
143 define_prefixed(fp, "yyparse");
144 define_prefixed(fp, "yylex");
145 define_prefixed(fp, "yyerror");
146 define_prefixed(fp, "yychar");
147 define_prefixed(fp, "yyval");
148 define_prefixed(fp, "yylval");
149 define_prefixed(fp, "yydebug");
150 define_prefixed(fp, "yynerrs");
151 define_prefixed(fp, "yyerrflag");
152 define_prefixed(fp, "yylhs");
153 define_prefixed(fp, "yylen");
154 define_prefixed(fp, "yydefred");
155 #if defined(YYBTYACC)
156 define_prefixed(fp, "yystos");
157 #endif
158 define_prefixed(fp, "yydgoto");
159 define_prefixed(fp, "yysindex");
160 define_prefixed(fp, "yyrindex");
161 define_prefixed(fp, "yygindex");
162 define_prefixed(fp, "yytable");
163 define_prefixed(fp, "yycheck");
164 define_prefixed(fp, "yyname");
165 define_prefixed(fp, "yyrule");
166 #if defined(YYBTYACC)
167 if (locations)
169 define_prefixed(fp, "yyloc");
170 define_prefixed(fp, "yylloc");
172 putc_code(fp, '\n');
173 putl_code(fp, "#if YYBTYACC\n");
175 define_prefixed(fp, "yycindex");
176 define_prefixed(fp, "yyctable");
178 putc_code(fp, '\n');
179 putl_code(fp, "#endif /* YYBTYACC */\n");
180 putc_code(fp, '\n');
181 #endif
183 if (CountLine(fp))
184 ++outline;
185 fprintf(fp, "#define YYPREFIX \"%s\"\n", symbol_prefix);
188 static void
189 output_newline(void)
191 if (!rflag)
192 ++outline;
193 putc('\n', output_file);
196 static void
197 output_line(const char *value)
199 fputs(value, output_file);
200 output_newline();
203 static void
204 output_int(int value)
206 fprintf(output_file, "%5d,", value);
209 static void
210 start_int_table(const char *name, int value)
212 int need = 34 - (int)(strlen(symbol_prefix) + strlen(name));
214 if (need < 6)
215 need = 6;
216 fprintf(output_file,
217 "%sconst YYINT %s%s[] = {%*d,",
218 StaticOrR, symbol_prefix, name, need, value);
221 static void
222 start_str_table(const char *name)
224 fprintf(output_file,
225 "%sconst char *const %s%s[] = {",
226 StaticOrR, symbol_prefix, name);
227 output_newline();
230 static void
231 end_table(void)
233 output_newline();
234 output_line("};");
237 static void
238 output_YYINT_typedef(FILE * fp)
240 /* generate the type used to index the various parser tables */
241 if (CountLine(fp))
242 ++outline;
243 fprintf(fp, "typedef %s YYINT;\n", CONCAT1("", YYINT));
246 static void
247 output_rule_data(void)
249 int i;
250 int j;
252 output_YYINT_typedef(output_file);
254 start_int_table("lhs", symbol_value[start_symbol]);
256 j = 10;
257 for (i = 3; i < nrules; i++)
259 if (j >= 10)
261 output_newline();
262 j = 1;
264 else
265 ++j;
267 output_int(symbol_value[rlhs[i]]);
269 end_table();
271 start_int_table("len", 2);
273 j = 10;
274 for (i = 3; i < nrules; i++)
276 if (j >= 10)
278 output_newline();
279 j = 1;
281 else
282 j++;
284 output_int(rrhs[i + 1] - rrhs[i] - 1);
286 end_table();
289 static void
290 output_yydefred(void)
292 int i, j;
294 start_int_table("defred", (defred[0] ? defred[0] - 2 : 0));
296 j = 10;
297 for (i = 1; i < nstates; i++)
299 if (j < 10)
300 ++j;
301 else
303 output_newline();
304 j = 1;
307 output_int((defred[i] ? defred[i] - 2 : 0));
310 end_table();
313 #if defined(YYBTYACC)
314 static void
315 output_accessing_symbols(void)
317 int i, j;
318 int *translate;
320 if (nstates != 0)
322 translate = TMALLOC(int, nstates);
323 NO_SPACE(translate);
325 for (i = 0; i < nstates; ++i)
327 int gsymb = accessing_symbol[i];
329 translate[i] = symbol_pval[gsymb];
332 /* yystos[] may be unused, depending on compile-time defines */
333 start_int_table("stos", translate[0]);
335 j = 10;
336 for (i = 1; i < nstates; ++i)
338 if (j < 10)
339 ++j;
340 else
342 output_newline();
343 j = 1;
346 output_int(translate[i]);
349 end_table();
350 FREE(translate);
354 static Value_t
355 find_conflict_base(int cbase)
357 int i, j;
359 for (i = 0; i < cbase; i++)
361 for (j = 0; j + cbase < nconflicts; j++)
363 if (conflicts[i + j] != conflicts[cbase + j])
364 break;
366 if (j + cbase >= nconflicts)
367 break;
369 return (Value_t) i;
371 #endif
373 static void
374 token_actions(void)
376 int i, j;
377 Value_t shiftcount, reducecount;
378 #if defined(YYBTYACC)
379 Value_t conflictcount = 0;
380 Value_t csym = -1;
381 Value_t cbase = 0;
382 #endif
383 int max, min;
384 Value_t *actionrow, *r, *s;
385 action *p;
387 actionrow = NEW2(PER_STATE * ntokens, Value_t);
388 for (i = 0; i < nstates; ++i)
390 if (parser[i])
392 for (j = 0; j < PER_STATE * ntokens; ++j)
393 actionrow[j] = 0;
395 shiftcount = 0;
396 reducecount = 0;
397 #if defined(YYBTYACC)
398 if (backtrack)
400 conflictcount = 0;
401 csym = -1;
402 cbase = nconflicts;
404 #endif
405 for (p = parser[i]; p; p = p->next)
407 #if defined(YYBTYACC)
408 if (backtrack)
410 if (csym != -1 && csym != p->symbol)
412 conflictcount++;
413 conflicts[nconflicts++] = -1;
414 j = find_conflict_base(cbase);
415 actionrow[csym + 2 * ntokens] = (Value_t) (j + 1);
416 if (j == cbase)
418 cbase = nconflicts;
420 else
422 if (conflicts[cbase] == -1)
423 cbase++;
424 nconflicts = cbase;
426 csym = -1;
429 #endif
430 if (p->suppressed == 0)
432 if (p->action_code == SHIFT)
434 ++shiftcount;
435 actionrow[p->symbol] = p->number;
437 else if (p->action_code == REDUCE && p->number != defred[i])
439 ++reducecount;
440 actionrow[p->symbol + ntokens] = p->number;
443 #if defined(YYBTYACC)
444 else if (backtrack && p->suppressed == 1)
446 csym = p->symbol;
447 if (p->action_code == SHIFT)
449 conflicts[nconflicts++] = p->number;
451 else if (p->action_code == REDUCE && p->number != defred[i])
453 if (cbase == nconflicts)
455 if (cbase)
456 cbase--;
457 else
458 conflicts[nconflicts++] = -1;
460 conflicts[nconflicts++] = (Value_t) (p->number - 2);
463 #endif
465 #if defined(YYBTYACC)
466 if (backtrack && csym != -1)
468 conflictcount++;
469 conflicts[nconflicts++] = -1;
470 j = find_conflict_base(cbase);
471 actionrow[csym + 2 * ntokens] = (Value_t) (j + 1);
472 if (j == cbase)
474 cbase = nconflicts;
476 else
478 if (conflicts[cbase] == -1)
479 cbase++;
480 nconflicts = cbase;
483 #endif
485 tally[i] = shiftcount;
486 tally[nstates + i] = reducecount;
487 #if defined(YYBTYACC)
488 if (backtrack)
489 tally[2 * nstates + i] = conflictcount;
490 #endif
491 width[i] = 0;
492 width[nstates + i] = 0;
493 #if defined(YYBTYACC)
494 if (backtrack)
495 width[2 * nstates + i] = 0;
496 #endif
497 if (shiftcount > 0)
499 froms[i] = r = NEW2(shiftcount, Value_t);
500 tos[i] = s = NEW2(shiftcount, Value_t);
501 min = MAXYYINT;
502 max = 0;
503 for (j = 0; j < ntokens; ++j)
505 if (actionrow[j])
507 if (min > symbol_value[j])
508 min = symbol_value[j];
509 if (max < symbol_value[j])
510 max = symbol_value[j];
511 *r++ = symbol_value[j];
512 *s++ = actionrow[j];
515 width[i] = (Value_t) (max - min + 1);
517 if (reducecount > 0)
519 froms[nstates + i] = r = NEW2(reducecount, Value_t);
520 tos[nstates + i] = s = NEW2(reducecount, Value_t);
521 min = MAXYYINT;
522 max = 0;
523 for (j = 0; j < ntokens; ++j)
525 if (actionrow[ntokens + j])
527 if (min > symbol_value[j])
528 min = symbol_value[j];
529 if (max < symbol_value[j])
530 max = symbol_value[j];
531 *r++ = symbol_value[j];
532 *s++ = (Value_t) (actionrow[ntokens + j] - 2);
535 width[nstates + i] = (Value_t) (max - min + 1);
537 #if defined(YYBTYACC)
538 if (backtrack && conflictcount > 0)
540 froms[2 * nstates + i] = r = NEW2(conflictcount, Value_t);
541 tos[2 * nstates + i] = s = NEW2(conflictcount, Value_t);
542 min = MAXYYINT;
543 max = 0;
544 for (j = 0; j < ntokens; ++j)
546 if (actionrow[2 * ntokens + j])
548 if (min > symbol_value[j])
549 min = symbol_value[j];
550 if (max < symbol_value[j])
551 max = symbol_value[j];
552 *r++ = symbol_value[j];
553 *s++ = (Value_t) (actionrow[2 * ntokens + j] - 1);
556 width[2 * nstates + i] = (Value_t) (max - min + 1);
558 #endif
561 FREE(actionrow);
564 static int
565 default_goto(int symbol)
567 int i;
568 int m;
569 int n;
570 int default_state;
571 int max;
573 m = goto_map[symbol];
574 n = goto_map[symbol + 1];
576 if (m == n)
577 return (0);
579 for (i = 0; i < nstates; i++)
580 state_count[i] = 0;
582 for (i = m; i < n; i++)
583 state_count[to_state[i]]++;
585 max = 0;
586 default_state = 0;
587 for (i = 0; i < nstates; i++)
589 if (state_count[i] > max)
591 max = state_count[i];
592 default_state = i;
596 return (default_state);
599 static void
600 save_column(int symbol, int default_state)
602 int i;
603 int m;
604 int n;
605 Value_t *sp;
606 Value_t *sp1;
607 Value_t *sp2;
608 Value_t count;
609 int symno;
611 m = goto_map[symbol];
612 n = goto_map[symbol + 1];
614 count = 0;
615 for (i = m; i < n; i++)
617 if (to_state[i] != default_state)
618 ++count;
620 if (count == 0)
621 return;
623 symno = symbol_value[symbol] + PER_STATE * nstates;
625 froms[symno] = sp1 = sp = NEW2(count, Value_t);
626 tos[symno] = sp2 = NEW2(count, Value_t);
628 for (i = m; i < n; i++)
630 if (to_state[i] != default_state)
632 *sp1++ = from_state[i];
633 *sp2++ = to_state[i];
637 tally[symno] = count;
638 width[symno] = (Value_t) (sp1[-1] - sp[0] + 1);
641 static void
642 goto_actions(void)
644 int i, j, k;
646 state_count = NEW2(nstates, Value_t);
648 k = default_goto(start_symbol + 1);
649 start_int_table("dgoto", k);
650 save_column(start_symbol + 1, k);
652 j = 10;
653 for (i = start_symbol + 2; i < nsyms; i++)
655 if (j >= 10)
657 output_newline();
658 j = 1;
660 else
661 ++j;
663 k = default_goto(i);
664 output_int(k);
665 save_column(i, k);
668 end_table();
669 FREE(state_count);
672 static void
673 sort_actions(void)
675 Value_t i;
676 int j;
677 int k;
678 int t;
679 int w;
681 order = NEW2(nvectors, Value_t);
682 nentries = 0;
684 for (i = 0; i < nvectors; i++)
686 if (tally[i] > 0)
688 t = tally[i];
689 w = width[i];
690 j = nentries - 1;
692 while (j >= 0 && (width[order[j]] < w))
693 j--;
695 while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t))
696 j--;
698 for (k = nentries - 1; k > j; k--)
699 order[k + 1] = order[k];
701 order[j + 1] = i;
702 nentries++;
707 /* The function matching_vector determines if the vector specified by */
708 /* the input parameter matches a previously considered vector. The */
709 /* test at the start of the function checks if the vector represents */
710 /* a row of shifts over terminal symbols or a row of reductions, or a */
711 /* column of shifts over a nonterminal symbol. Berkeley Yacc does not */
712 /* check if a column of shifts over a nonterminal symbols matches a */
713 /* previously considered vector. Because of the nature of LR parsing */
714 /* tables, no two columns can match. Therefore, the only possible */
715 /* match would be between a row and a column. Such matches are */
716 /* unlikely. Therefore, to save time, no attempt is made to see if a */
717 /* column matches a previously considered vector. */
718 /* */
719 /* Matching_vector is poorly designed. The test could easily be made */
720 /* faster. Also, it depends on the vectors being in a specific */
721 /* order. */
722 #if defined(YYBTYACC)
723 /* */
724 /* Not really any point in checking for matching conflicts -- it is */
725 /* extremely unlikely to occur, and conflicts are (hopefully) rare. */
726 #endif
728 static int
729 matching_vector(int vector)
731 int i;
732 int j;
733 int k;
734 int t;
735 int w;
736 int match;
737 int prev;
739 i = order[vector];
740 if (i >= 2 * nstates)
741 return (-1);
743 t = tally[i];
744 w = width[i];
746 for (prev = vector - 1; prev >= 0; prev--)
748 j = order[prev];
749 if (width[j] != w || tally[j] != t)
750 return (-1);
752 match = 1;
753 for (k = 0; match && k < t; k++)
755 if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k])
756 match = 0;
759 if (match)
760 return (j);
763 return (-1);
766 static int
767 pack_vector(int vector)
769 int i, j, k, l;
770 int t;
771 int loc;
772 int ok;
773 Value_t *from;
774 Value_t *to;
775 int newmax;
777 i = order[vector];
778 t = tally[i];
779 assert(t);
781 from = froms[i];
782 to = tos[i];
784 j = lowzero - from[0];
785 for (k = 1; k < t; ++k)
786 if (lowzero - from[k] > j)
787 j = lowzero - from[k];
788 for (;; ++j)
790 if (j == 0)
791 continue;
792 ok = 1;
793 for (k = 0; ok && k < t; k++)
795 loc = j + from[k];
796 if (loc >= maxtable - 1)
798 if (loc >= MAXTABLE - 1)
799 fatal("maximum table size exceeded");
801 newmax = maxtable;
804 newmax += 200;
806 while (newmax <= loc);
808 table = TREALLOC(Value_t, table, newmax);
809 NO_SPACE(table);
811 check = TREALLOC(Value_t, check, newmax);
812 NO_SPACE(check);
814 for (l = maxtable; l < newmax; ++l)
816 table[l] = 0;
817 check[l] = -1;
819 maxtable = newmax;
822 if (check[loc] != -1)
823 ok = 0;
825 for (k = 0; ok && k < vector; k++)
827 if (pos[k] == j)
828 ok = 0;
830 if (ok)
832 for (k = 0; k < t; k++)
834 loc = j + from[k];
835 table[loc] = to[k];
836 check[loc] = from[k];
837 if (loc > high)
838 high = loc;
841 while (check[lowzero] != -1)
842 ++lowzero;
844 return (j);
849 static void
850 pack_table(void)
852 int i;
853 Value_t place;
854 int state;
856 base = NEW2(nvectors, Value_t);
857 pos = NEW2(nentries, Value_t);
859 maxtable = 1000;
860 table = NEW2(maxtable, Value_t);
861 check = NEW2(maxtable, Value_t);
863 lowzero = 0;
864 high = 0;
866 for (i = 0; i < maxtable; i++)
867 check[i] = -1;
869 for (i = 0; i < nentries; i++)
871 state = matching_vector(i);
873 if (state < 0)
874 place = (Value_t) pack_vector(i);
875 else
876 place = base[state];
878 pos[i] = place;
879 base[order[i]] = place;
882 for (i = 0; i < nvectors; i++)
884 if (froms[i])
885 FREE(froms[i]);
886 if (tos[i])
887 FREE(tos[i]);
890 DO_FREE(froms);
891 DO_FREE(tos);
892 DO_FREE(tally);
893 DO_FREE(width);
894 DO_FREE(pos);
897 static void
898 output_base(void)
900 int i, j;
902 start_int_table("sindex", base[0]);
904 j = 10;
905 for (i = 1; i < nstates; i++)
907 if (j >= 10)
909 output_newline();
910 j = 1;
912 else
913 ++j;
915 output_int(base[i]);
918 end_table();
920 start_int_table("rindex", base[nstates]);
922 j = 10;
923 for (i = nstates + 1; i < 2 * nstates; i++)
925 if (j >= 10)
927 output_newline();
928 j = 1;
930 else
931 ++j;
933 output_int(base[i]);
936 end_table();
938 #if defined(YYBTYACC)
939 output_line("#if YYBTYACC");
940 start_int_table("cindex", base[2 * nstates]);
942 j = 10;
943 for (i = 2 * nstates + 1; i < 3 * nstates; i++)
945 if (j >= 10)
947 output_newline();
948 j = 1;
950 else
951 ++j;
953 output_int(base[i]);
956 end_table();
957 output_line("#endif");
958 #endif
960 start_int_table("gindex", base[PER_STATE * nstates]);
962 j = 10;
963 for (i = PER_STATE * nstates + 1; i < nvectors - 1; i++)
965 if (j >= 10)
967 output_newline();
968 j = 1;
970 else
971 ++j;
973 output_int(base[i]);
976 end_table();
977 FREE(base);
980 static void
981 output_table(void)
983 int i;
984 int j;
986 if (high >= MAXYYINT)
988 fprintf(stderr, "YYTABLESIZE: %ld\n", high);
989 fprintf(stderr, "Table is longer than %d elements.\n", MAXYYINT);
990 done(1);
993 ++outline;
994 fprintf(code_file, "#define YYTABLESIZE %ld\n", high);
995 start_int_table("table", table[0]);
997 j = 10;
998 for (i = 1; i <= high; i++)
1000 if (j >= 10)
1002 output_newline();
1003 j = 1;
1005 else
1006 ++j;
1008 output_int(table[i]);
1011 end_table();
1012 FREE(table);
1015 static void
1016 output_check(void)
1018 int i;
1019 int j;
1021 start_int_table("check", check[0]);
1023 j = 10;
1024 for (i = 1; i <= high; i++)
1026 if (j >= 10)
1028 output_newline();
1029 j = 1;
1031 else
1032 ++j;
1034 output_int(check[i]);
1037 end_table();
1038 FREE(check);
1041 #if defined(YYBTYACC)
1042 static void
1043 output_ctable(void)
1045 int i;
1046 int j;
1047 int limit = (conflicts != 0) ? nconflicts : 0;
1049 if (limit < high)
1050 limit = (int)high;
1052 output_line("#if YYBTYACC");
1053 start_int_table("ctable", conflicts ? conflicts[0] : -1);
1055 j = 10;
1056 for (i = 1; i < limit; i++)
1058 if (j >= 10)
1060 output_newline();
1061 j = 1;
1063 else
1064 ++j;
1066 output_int((conflicts != 0 && i < nconflicts) ? conflicts[i] : -1);
1069 if (conflicts)
1070 FREE(conflicts);
1072 end_table();
1073 output_line("#endif");
1075 #endif
1077 static void
1078 output_actions(void)
1080 nvectors = PER_STATE * nstates + nvars;
1082 froms = NEW2(nvectors, Value_t *);
1083 tos = NEW2(nvectors, Value_t *);
1084 tally = NEW2(nvectors, Value_t);
1085 width = NEW2(nvectors, Value_t);
1087 #if defined(YYBTYACC)
1088 if (backtrack && (SRtotal + RRtotal) != 0)
1089 conflicts = NEW2(4 * (SRtotal + RRtotal), Value_t);
1090 #endif
1092 token_actions();
1093 FREE(lookaheads);
1094 FREE(LA);
1095 FREE(LAruleno);
1096 FREE(accessing_symbol);
1098 goto_actions();
1099 FREE(goto_base);
1100 FREE(from_state);
1101 FREE(to_state);
1103 sort_actions();
1104 pack_table();
1105 output_base();
1106 output_table();
1107 output_check();
1108 #if defined(YYBTYACC)
1109 output_ctable();
1110 #endif
1113 static int
1114 is_C_identifier(char *name)
1116 char *s;
1117 int c;
1119 s = name;
1120 c = *s;
1121 if (c == '"')
1123 c = *++s;
1124 if (!isalpha(c) && c != '_' && c != '$')
1125 return (0);
1126 while ((c = *++s) != '"')
1128 if (!isalnum(c) && c != '_' && c != '$')
1129 return (0);
1131 return (1);
1134 if (!isalpha(c) && c != '_' && c != '$')
1135 return (0);
1136 while ((c = *++s) != 0)
1138 if (!isalnum(c) && c != '_' && c != '$')
1139 return (0);
1141 return (1);
1144 #if USE_HEADER_GUARDS
1145 static void
1146 start_defines_file(void)
1148 fprintf(defines_file, "#ifndef _%s_defines_h_\n", symbol_prefix);
1149 fprintf(defines_file, "#define _%s_defines_h_\n\n", symbol_prefix);
1152 static void
1153 end_defines_file(void)
1155 fprintf(defines_file, "\n#endif /* _%s_defines_h_ */\n", symbol_prefix);
1157 #else
1158 #define start_defines_file() /* nothing */
1159 #define end_defines_file() /* nothing */
1160 #endif
1162 static void
1163 output_defines(FILE * fp)
1165 int c, i;
1166 char *s;
1168 for (i = 2; i < ntokens; ++i)
1170 s = symbol_name[i];
1171 if (is_C_identifier(s) && (!sflag || *s != '"'))
1173 fprintf(fp, "#define ");
1174 c = *s;
1175 if (c == '"')
1177 while ((c = *++s) != '"')
1179 putc(c, fp);
1182 else
1186 putc(c, fp);
1188 while ((c = *++s) != 0);
1190 if (fp == code_file)
1191 ++outline;
1192 fprintf(fp, " %d\n", symbol_value[i]);
1196 if (fp == code_file)
1197 ++outline;
1198 if (fp != defines_file || iflag)
1199 fprintf(fp, "#define YYERRCODE %d\n", symbol_value[1]);
1201 if (fp == defines_file || (iflag && !dflag))
1203 if (unionized)
1205 if (union_file != 0)
1207 rewind(union_file);
1208 while ((c = getc(union_file)) != EOF)
1209 putc_code(fp, c);
1211 fprintf(fp, "extern YYSTYPE %slval;\n", symbol_prefix);
1216 static void
1217 output_stored_text(FILE * fp)
1219 int c;
1220 FILE *in;
1222 rewind(text_file);
1223 if (text_file == NULL)
1224 open_error("text_file");
1225 in = text_file;
1226 if ((c = getc(in)) == EOF)
1227 return;
1228 putc_code(fp, c);
1229 while ((c = getc(in)) != EOF)
1231 putc_code(fp, c);
1233 write_code_lineno(fp);
1236 static void
1237 output_debug(void)
1239 int i, j, k, max, maxtok;
1240 const char **symnam;
1241 const char *s;
1243 ++outline;
1244 fprintf(code_file, "#define YYFINAL %d\n", final_state);
1246 putl_code(code_file, "#ifndef YYDEBUG\n");
1247 ++outline;
1248 fprintf(code_file, "#define YYDEBUG %d\n", tflag);
1249 putl_code(code_file, "#endif\n");
1251 if (rflag)
1253 fprintf(output_file, "#ifndef YYDEBUG\n");
1254 fprintf(output_file, "#define YYDEBUG %d\n", tflag);
1255 fprintf(output_file, "#endif\n");
1258 maxtok = 0;
1259 for (i = 0; i < ntokens; ++i)
1260 if (symbol_value[i] > maxtok)
1261 maxtok = symbol_value[i];
1263 /* symbol_value[$accept] = -1 */
1264 /* symbol_value[<goal>] = 0 */
1265 /* remaining non-terminals start at 1 */
1266 max = maxtok;
1267 for (i = ntokens; i < nsyms; ++i)
1268 if (((maxtok + 1) + (symbol_value[i] + 1)) > max)
1269 max = (maxtok + 1) + (symbol_value[i] + 1);
1271 ++outline;
1272 fprintf(code_file, "#define YYMAXTOKEN %d\n", maxtok);
1274 ++outline;
1275 fprintf(code_file, "#define YYUNDFTOKEN %d\n", max + 1);
1277 ++outline;
1278 fprintf(code_file, "#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? "
1279 "YYUNDFTOKEN : (a))\n");
1281 symnam = TMALLOC(const char *, max + 2);
1282 NO_SPACE(symnam);
1284 /* Note that it is not necessary to initialize the element */
1285 /* symnam[max]. */
1286 #if defined(YYBTYACC)
1287 for (i = 0; i < max; ++i)
1288 symnam[i] = 0;
1289 for (i = nsyms - 1; i >= 0; --i)
1290 symnam[symbol_pval[i]] = symbol_name[i];
1291 symnam[max + 1] = "illegal-symbol";
1292 #else
1293 for (i = 0; i <= max; ++i)
1294 symnam[i] = 0;
1295 for (i = ntokens - 1; i >= 2; --i)
1296 symnam[symbol_value[i]] = symbol_name[i];
1297 symnam[0] = "end-of-file";
1298 symnam[max + 1] = "illegal-symbol";
1299 #endif
1302 * bison's yytname[] array is roughly the same as byacc's yyname[] array.
1303 * The difference is that byacc does not predefine "$undefined".
1305 * If the grammar declares "%token-table", define symbol "yytname" so
1306 * an application such as ntpd can build.
1308 if (token_table)
1310 output_line("#undef yytname");
1311 output_line("#define yytname yyname");
1313 else
1315 output_line("#if YYDEBUG");
1318 start_str_table("name");
1319 j = 80;
1320 for (i = 0; i <= max + 1; ++i)
1322 if ((s = symnam[i]) != 0)
1324 if (s[0] == '"')
1326 k = 7;
1327 while (*++s != '"')
1329 ++k;
1330 if (*s == '\\')
1332 k += 2;
1333 if (*++s == '\\')
1334 ++k;
1337 j += k;
1338 if (j > 80)
1340 output_newline();
1341 j = k;
1343 fprintf(output_file, "\"\\\"");
1344 s = symnam[i];
1345 while (*++s != '"')
1347 if (*s == '\\')
1349 fprintf(output_file, "\\\\");
1350 if (*++s == '\\')
1351 fprintf(output_file, "\\\\");
1352 else
1353 putc(*s, output_file);
1355 else
1356 putc(*s, output_file);
1358 fprintf(output_file, "\\\"\",");
1360 else if (s[0] == '\'')
1362 if (s[1] == '"')
1364 j += 7;
1365 if (j > 80)
1367 output_newline();
1368 j = 7;
1370 fprintf(output_file, "\"'\\\"'\",");
1372 else
1374 k = 5;
1375 while (*++s != '\'')
1377 ++k;
1378 if (*s == '\\')
1380 k += 2;
1381 if (*++s == '\\')
1382 ++k;
1385 j += k;
1386 if (j > 80)
1388 output_newline();
1389 j = k;
1391 fprintf(output_file, "\"'");
1392 s = symnam[i];
1393 while (*++s != '\'')
1395 if (*s == '\\')
1397 fprintf(output_file, "\\\\");
1398 if (*++s == '\\')
1399 fprintf(output_file, "\\\\");
1400 else
1401 putc(*s, output_file);
1403 else
1404 putc(*s, output_file);
1406 fprintf(output_file, "'\",");
1409 else
1411 k = (int)strlen(s) + 3;
1412 j += k;
1413 if (j > 80)
1415 output_newline();
1416 j = k;
1418 putc('"', output_file);
1421 putc(*s, output_file);
1423 while (*++s);
1424 fprintf(output_file, "\",");
1427 else
1429 j += 2;
1430 if (j > 80)
1432 output_newline();
1433 j = 2;
1435 fprintf(output_file, "0,");
1438 end_table();
1439 FREE(symnam);
1441 if (token_table)
1442 output_line("#if YYDEBUG");
1443 start_str_table("rule");
1444 for (i = 2; i < nrules; ++i)
1446 fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]);
1447 for (j = rrhs[i]; ritem[j] > 0; ++j)
1449 s = symbol_name[ritem[j]];
1450 if (s[0] == '"')
1452 fprintf(output_file, " \\\"");
1453 while (*++s != '"')
1455 if (*s == '\\')
1457 if (s[1] == '\\')
1458 fprintf(output_file, "\\\\\\\\");
1459 else
1460 fprintf(output_file, "\\\\%c", s[1]);
1461 ++s;
1463 else
1464 putc(*s, output_file);
1466 fprintf(output_file, "\\\"");
1468 else if (s[0] == '\'')
1470 if (s[1] == '"')
1471 fprintf(output_file, " '\\\"'");
1472 else if (s[1] == '\\')
1474 if (s[2] == '\\')
1475 fprintf(output_file, " '\\\\\\\\");
1476 else
1477 fprintf(output_file, " '\\\\%c", s[2]);
1478 s += 2;
1479 while (*++s != '\'')
1480 putc(*s, output_file);
1481 putc('\'', output_file);
1483 else
1484 fprintf(output_file, " '%c'", s[1]);
1486 else
1487 fprintf(output_file, " %s", s);
1489 fprintf(output_file, "\",");
1490 output_newline();
1493 end_table();
1494 output_line("#endif");
1497 #if defined(YYBTYACC)
1498 static void
1499 output_backtracking_parser(FILE * fp)
1501 putl_code(fp, "#undef YYBTYACC\n");
1502 #if defined(YYBTYACC)
1503 if (backtrack)
1505 putl_code(fp, "#define YYBTYACC 1\n");
1506 putl_code(fp,
1507 "#define YYDEBUGSTR (yytrial ? YYPREFIX \"debug(trial)\" : YYPREFIX \"debug\")\n");
1509 else
1510 #endif
1512 putl_code(fp, "#define YYBTYACC 0\n");
1513 putl_code(fp, "#define YYDEBUGSTR YYPREFIX \"debug\"\n");
1516 #endif
1518 static void
1519 output_pure_parser(FILE * fp)
1521 putc_code(fp, '\n');
1523 if (fp == code_file)
1524 ++outline;
1525 fprintf(fp, "#define YYPURE %d\n", pure_parser);
1526 putc_code(fp, '\n');
1529 static void
1530 output_stype(FILE * fp)
1532 if (!unionized && ntags == 0)
1534 putc_code(fp, '\n');
1535 putl_code(fp, "#if "
1536 "! defined(YYSTYPE) && "
1537 "! defined(YYSTYPE_IS_DECLARED)\n");
1538 putl_code(fp, "/* Default: YYSTYPE is the semantic value type. */\n");
1539 putl_code(fp, "typedef int YYSTYPE;\n");
1540 putl_code(fp, "# define YYSTYPE_IS_DECLARED 1\n");
1541 putl_code(fp, "#endif\n");
1545 #if defined(YYBTYACC)
1546 static void
1547 output_ltype(FILE * fp)
1549 putc_code(fp, '\n');
1550 putl_code(fp, "#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED\n");
1551 putl_code(fp, "/* Default: YYLTYPE is the text position type. */\n");
1552 putl_code(fp, "typedef struct YYLTYPE\n");
1553 putl_code(fp, "{\n");
1554 putl_code(fp, " int first_line;\n");
1555 putl_code(fp, " int first_column;\n");
1556 putl_code(fp, " int last_line;\n");
1557 putl_code(fp, " int last_column;\n");
1558 putl_code(fp, "} YYLTYPE;\n");
1559 putl_code(fp, "#define YYLTYPE_IS_DECLARED 1\n");
1560 putl_code(fp, "#endif\n");
1562 #endif
1564 static void
1565 output_trailing_text(void)
1567 int c, last;
1568 FILE *in;
1570 if (line == 0)
1571 return;
1573 in = input_file;
1574 c = *cptr;
1575 if (c == '\n')
1577 ++lineno;
1578 if ((c = getc(in)) == EOF)
1579 return;
1580 write_input_lineno();
1581 putc_code(code_file, c);
1582 last = c;
1584 else
1586 write_input_lineno();
1589 putc_code(code_file, c);
1591 while ((c = *++cptr) != '\n');
1592 putc_code(code_file, c);
1593 last = '\n';
1596 while ((c = getc(in)) != EOF)
1598 putc_code(code_file, c);
1599 last = c;
1602 if (last != '\n')
1604 putc_code(code_file, '\n');
1606 write_code_lineno(code_file);
1609 static void
1610 output_semantic_actions(void)
1612 int c, last;
1614 rewind(action_file);
1615 if ((c = getc(action_file)) == EOF)
1616 return;
1618 last = c;
1619 putc_code(code_file, c);
1620 while ((c = getc(action_file)) != EOF)
1622 putc_code(code_file, c);
1623 last = c;
1626 if (last != '\n')
1628 putc_code(code_file, '\n');
1631 write_code_lineno(code_file);
1634 static void
1635 output_parse_decl(FILE * fp)
1637 putc_code(fp, '\n');
1638 putl_code(fp, "/* compatibility with bison */\n");
1639 putl_code(fp, "#ifdef YYPARSE_PARAM\n");
1640 putl_code(fp, "/* compatibility with FreeBSD */\n");
1641 putl_code(fp, "# ifdef YYPARSE_PARAM_TYPE\n");
1642 putl_code(fp,
1643 "# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)\n");
1644 putl_code(fp, "# else\n");
1645 putl_code(fp, "# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)\n");
1646 putl_code(fp, "# endif\n");
1647 putl_code(fp, "#else\n");
1649 puts_code(fp, "# define YYPARSE_DECL() yyparse(");
1650 puts_param_types(fp, parse_param, 0);
1651 putl_code(fp, ")\n");
1653 putl_code(fp, "#endif\n");
1656 static void
1657 output_lex_decl(FILE * fp)
1659 putc_code(fp, '\n');
1660 putl_code(fp, "/* Parameters sent to lex. */\n");
1661 putl_code(fp, "#ifdef YYLEX_PARAM\n");
1662 if (pure_parser)
1664 putl_code(fp, "# ifdef YYLEX_PARAM_TYPE\n");
1665 #if defined(YYBTYACC)
1666 if (locations)
1668 putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval,"
1669 " YYLTYPE *yylloc,"
1670 " YYLEX_PARAM_TYPE YYLEX_PARAM)\n");
1672 else
1673 #endif
1675 putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval,"
1676 " YYLEX_PARAM_TYPE YYLEX_PARAM)\n");
1678 putl_code(fp, "# else\n");
1679 #if defined(YYBTYACC)
1680 if (locations)
1682 putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval,"
1683 " YYLTYPE *yylloc,"
1684 " void * YYLEX_PARAM)\n");
1686 else
1687 #endif
1689 putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval,"
1690 " void * YYLEX_PARAM)\n");
1692 putl_code(fp, "# endif\n");
1693 #if defined(YYBTYACC)
1694 if (locations)
1695 putl_code(fp,
1696 "# define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)\n");
1697 else
1698 #endif
1699 putl_code(fp, "# define YYLEX yylex(&yylval, YYLEX_PARAM)\n");
1701 else
1703 putl_code(fp, "# define YYLEX_DECL() yylex(void *YYLEX_PARAM)\n");
1704 putl_code(fp, "# define YYLEX yylex(YYLEX_PARAM)\n");
1706 putl_code(fp, "#else\n");
1707 if (pure_parser && lex_param)
1709 #if defined(YYBTYACC)
1710 if (locations)
1711 puts_code(fp,
1712 "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc, ");
1713 else
1714 #endif
1715 puts_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, ");
1716 puts_param_types(fp, lex_param, 0);
1717 putl_code(fp, ")\n");
1719 #if defined(YYBTYACC)
1720 if (locations)
1721 puts_code(fp, "# define YYLEX yylex(&yylval, &yylloc, ");
1722 else
1723 #endif
1724 puts_code(fp, "# define YYLEX yylex(&yylval, ");
1725 puts_param_names(fp, lex_param, 0);
1726 putl_code(fp, ")\n");
1728 else if (pure_parser)
1730 #if defined(YYBTYACC)
1731 if (locations)
1733 putl_code(fp,
1734 "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc)\n");
1735 putl_code(fp, "# define YYLEX yylex(&yylval, &yylloc)\n");
1737 else
1738 #endif
1740 putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n");
1741 putl_code(fp, "# define YYLEX yylex(&yylval)\n");
1744 else if (lex_param)
1746 puts_code(fp, "# define YYLEX_DECL() yylex(");
1747 puts_param_types(fp, lex_param, 0);
1748 putl_code(fp, ")\n");
1750 puts_code(fp, "# define YYLEX yylex(");
1751 puts_param_names(fp, lex_param, 0);
1752 putl_code(fp, ")\n");
1754 else
1756 putl_code(fp, "# define YYLEX_DECL() yylex(void)\n");
1757 putl_code(fp, "# define YYLEX yylex()\n");
1759 putl_code(fp, "#endif\n");
1762 static void
1763 output_error_decl(FILE * fp)
1765 putc_code(fp, '\n');
1766 putl_code(fp, "/* Parameters sent to yyerror. */\n");
1767 putl_code(fp, "#ifndef YYERROR_DECL\n");
1768 puts_code(fp, "#define YYERROR_DECL() yyerror(");
1769 #if defined(YYBTYACC)
1770 if (locations)
1771 puts_code(fp, "YYLTYPE loc, ");
1772 #endif
1773 puts_param_types(fp, parse_param, 1);
1774 putl_code(fp, "const char *s)\n");
1775 putl_code(fp, "#endif\n");
1777 putl_code(fp, "#ifndef YYERROR_CALL\n");
1779 puts_code(fp, "#define YYERROR_CALL(msg) yyerror(");
1780 #if defined(YYBTYACC)
1781 if (locations)
1782 puts_code(fp, "yylloc, ");
1783 #endif
1784 puts_param_names(fp, parse_param, 1);
1785 putl_code(fp, "msg)\n");
1787 putl_code(fp, "#endif\n");
1790 #if defined(YYBTYACC)
1791 static void
1792 output_yydestruct_decl(FILE * fp)
1794 putc_code(fp, '\n');
1795 putl_code(fp, "#ifndef YYDESTRUCT_DECL\n");
1797 puts_code(fp,
1798 "#define YYDESTRUCT_DECL() "
1799 "yydestruct(const char *msg, int psymb, YYSTYPE *val");
1800 #if defined(YYBTYACC)
1801 if (locations)
1802 puts_code(fp, ", YYLTYPE *loc");
1803 #endif
1804 if (parse_param)
1806 puts_code(fp, ", ");
1807 puts_param_types(fp, parse_param, 0);
1809 putl_code(fp, ")\n");
1811 putl_code(fp, "#endif\n");
1813 putl_code(fp, "#ifndef YYDESTRUCT_CALL\n");
1815 puts_code(fp, "#define YYDESTRUCT_CALL(msg, psymb, val");
1816 #if defined(YYBTYACC)
1817 if (locations)
1818 puts_code(fp, ", loc");
1819 #endif
1820 puts_code(fp, ") yydestruct(msg, psymb, val");
1821 #if defined(YYBTYACC)
1822 if (locations)
1823 puts_code(fp, ", loc");
1824 #endif
1825 if (parse_param)
1827 puts_code(fp, ", ");
1828 puts_param_names(fp, parse_param, 0);
1830 putl_code(fp, ")\n");
1832 putl_code(fp, "#endif\n");
1835 static void
1836 output_yydestruct_impl(void)
1838 int i;
1839 char *s, *destructor_code;
1841 putc_code(code_file, '\n');
1842 putl_code(code_file, "/* Release memory associated with symbol. */\n");
1843 putl_code(code_file, "#if ! defined YYDESTRUCT_IS_DECLARED\n");
1844 putl_code(code_file, "static void\n");
1845 putl_code(code_file, "YYDESTRUCT_DECL()\n");
1846 putl_code(code_file, "{\n");
1847 putl_code(code_file, " switch (psymb)\n");
1848 putl_code(code_file, " {\n");
1849 for (i = 2; i < nsyms; ++i)
1851 if ((destructor_code = symbol_destructor[i]) != NULL)
1853 ++outline;
1854 fprintf(code_file, "\tcase %d:\n", symbol_pval[i]);
1855 /* comprehend the number of lines in the destructor code */
1856 for (s = destructor_code; (s = strchr(s, '\n')) != NULL; s++)
1857 ++outline;
1858 puts_code(code_file, destructor_code);
1859 putc_code(code_file, '\n');
1860 putl_code(code_file, "\tbreak;\n");
1861 write_code_lineno(code_file);
1862 FREE(destructor_code);
1865 putl_code(code_file, " }\n");
1866 putl_code(code_file, "}\n");
1867 putl_code(code_file, "#define YYDESTRUCT_IS_DECLARED 1\n");
1868 putl_code(code_file, "#endif\n");
1870 DO_FREE(symbol_destructor);
1872 #endif
1874 static void
1875 free_itemsets(void)
1877 core *cp, *next;
1879 FREE(state_table);
1880 for (cp = first_state; cp; cp = next)
1882 next = cp->next;
1883 FREE(cp);
1887 static void
1888 free_shifts(void)
1890 shifts *sp, *next;
1892 FREE(shift_table);
1893 for (sp = first_shift; sp; sp = next)
1895 next = sp->next;
1896 FREE(sp);
1900 static void
1901 free_reductions(void)
1903 reductions *rp, *next;
1905 FREE(reduction_table);
1906 for (rp = first_reduction; rp; rp = next)
1908 next = rp->next;
1909 FREE(rp);
1913 static void
1914 output_externs(FILE * fp, const char *const section[])
1916 int i;
1917 const char *s;
1919 for (i = 0; (s = section[i]) != 0; ++i)
1921 /* prefix non-blank lines that don't start with
1922 C pre-processor directives with 'extern ' */
1923 if (*s && (*s != '#'))
1924 fputs("extern\t", fp);
1925 if (fp == code_file)
1926 ++outline;
1927 fprintf(fp, "%s\n", s);
1931 void
1932 output(void)
1934 FILE *fp;
1936 free_itemsets();
1937 free_shifts();
1938 free_reductions();
1940 #if defined(YYBTYACC)
1941 output_backtracking_parser(output_file);
1942 if (rflag)
1943 output_backtracking_parser(code_file);
1944 #endif
1946 if (iflag)
1948 write_code_lineno(code_file);
1949 ++outline;
1950 fprintf(code_file, "#include \"%s\"\n", externs_file_name);
1951 fp = externs_file;
1953 else
1954 fp = code_file;
1956 output_prefix(fp);
1957 output_pure_parser(fp);
1958 output_stored_text(fp);
1959 output_stype(fp);
1960 #if defined(YYBTYACC)
1961 if (locations)
1962 output_ltype(fp);
1963 #endif
1964 output_parse_decl(fp);
1965 output_lex_decl(fp);
1966 output_error_decl(fp);
1967 #if defined(YYBTYACC)
1968 if (destructor)
1969 output_yydestruct_decl(fp);
1970 #endif
1971 if (iflag || !rflag)
1973 write_section(fp, xdecls);
1976 if (iflag)
1978 output_externs(externs_file, global_vars);
1979 if (!pure_parser)
1980 output_externs(externs_file, impure_vars);
1983 if (iflag)
1985 if (dflag)
1987 ++outline;
1988 fprintf(code_file, "#include \"%s\"\n", defines_file_name);
1990 else
1991 output_defines(externs_file);
1993 else
1995 putc_code(code_file, '\n');
1996 output_defines(code_file);
1999 if (dflag)
2001 start_defines_file();
2002 output_defines(defines_file);
2003 end_defines_file();
2006 output_rule_data();
2007 output_yydefred();
2008 #if defined(YYBTYACC)
2009 output_accessing_symbols();
2010 #endif
2011 output_actions();
2012 free_parser();
2013 output_debug();
2014 if (rflag)
2016 write_section(code_file, xdecls);
2017 output_YYINT_typedef(code_file);
2018 write_section(code_file, tables);
2020 write_section(code_file, global_vars);
2021 if (!pure_parser)
2023 write_section(code_file, impure_vars);
2025 write_section(code_file, hdr_defs);
2026 if (!pure_parser)
2028 write_section(code_file, hdr_vars);
2030 output_trailing_text();
2031 #if defined(YYBTYACC)
2032 if (destructor)
2033 output_yydestruct_impl();
2034 #endif
2035 write_section(code_file, body_1);
2036 if (pure_parser)
2038 write_section(code_file, body_vars);
2040 write_section(code_file, body_2);
2041 output_semantic_actions();
2042 write_section(code_file, trailer);
2045 #ifdef NO_LEAKS
2046 void
2047 output_leaks(void)
2049 DO_FREE(tally);
2050 DO_FREE(width);
2051 DO_FREE(order);
2053 #endif