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