NO SCCS FILE!! "@(#)yyget.c 5.2 (Berkeley) 6/29/90"
[unix-history] / usr / src / usr.bin / pascal / pxp / var.c
CommitLineData
252367af
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8static char sccsid[] = "@(#)var.c 5.1 (Berkeley) %G%";
9#endif not lint
10
8a0ba70e
PK
11/*
12 * pxp - Pascal execution profiler
13 *
14 * Bill Joy UCB
15 * Version 1.2 January 1979
16 */
17
18#include "0.h"
19#include "tree.h"
20
f4e01610 21STATIC int varcnt = -1;
8a0ba70e
PK
22/*
23 * Var declaration part
24 */
25varbeg(l, vline)
26 int l, vline;
27{
28
29 line = l;
30 if (nodecl)
31 printoff();
32 puthedr();
33 putcm();
34 ppnl();
35 indent();
36 ppkw("var");
37 ppgoin(DECL);
38 varcnt = 0;
39 setline(vline);
40}
41
42var(vline, vidl, vtype)
43 int vline;
44 register int *vidl;
45 int *vtype;
46{
47
48 if (varcnt)
49 putcm();
50 setline(vline);
51 ppitem();
52 if (vidl != NIL)
53 for (;;) {
54 ppid(vidl[1]);
55 vidl = vidl[2];
56 if (vidl == NIL)
57 break;
58 ppsep(", ");
59 }
60 else
61 ppid("{identifier list}");
62 ppsep(":");
63 gtype(vtype);
64 ppsep(";");
65 setinfo(vline);
66 putcml();
67 varcnt++;
68}
69
70varend()
71{
72
73 if (varcnt == -1)
74 return;
75 if (varcnt == 0)
76 ppid("{variable decls}");
77 ppgoout(DECL);
78 varcnt = -1;
79}