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