xref: /original-bsd/usr.bin/pascal/pxp/lab.c (revision 6c57d260)
1 static	char *sccsid = "@(#)lab.c	1.1 (Berkeley) 03/02/81";
2 /* Copyright (c) 1979 Regents of the University of California */
3 #
4 /*
5  * pxp - Pascal execution profiler
6  *
7  * Bill Joy UCB
8  * Version 1.2 January 1979
9  */
10 
11 #include "0.h"
12 
13 /*
14  * Label declaration part
15  */
16 label(r, l)
17 	int *r, l;
18 {
19 	register *ll;
20 
21 	if (nodecl)
22 		printoff();
23 	puthedr();
24 	setline(l);
25 	ppnl();
26 	indent();
27 	ppkw("label");
28 	ppgoin(DECL);
29 	ppnl();
30 	indent();
31 	ppbra(NIL);
32 	ll = r;
33 	if (ll != NIL)
34 		for (;;) {
35 			pplab(ll[1]);
36 			ll = ll[2];
37 			if (ll == NIL)
38 				break;
39 			ppsep(", ");
40 		}
41 	else
42 		ppid("{label list}");
43 	ppket(";");
44 	putcml();
45 	ppgoout(DECL);
46 }
47 
48 /*
49  * Goto statement
50  */
51 gotoop(s)
52 	char *s;
53 {
54 
55 	gocnt++;
56 	ppkw("goto");
57 	ppspac();
58 	pplab(s);
59 }
60 
61 /*
62  * A label on a statement
63  */
64 labeled(s)
65 	char *s;
66 {
67 
68 	linopr();
69 	indentlab();
70 	pplab(s);
71 	ppsep(":");
72 }
73