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