xref: /csrg-svn/usr.bin/pascal/src/tmps.c (revision 3219)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)tmps.c 1.1 03/11/81";
4 
5 #include "whoami.h"
6 #include "0.h"
7 
8 /*
9  * allocate runtime temporary variables
10  */
11 long
12 tmpalloc(size, type, loc)
13 	long size;
14 	struct nl *type;
15 	int loc;
16 {
17 	long offset;
18 
19 	offset = sizes[ cbn ].curtmps.om_off -= size;
20 	if ( offset < sizes[ cbn ].om_max ) {
21 	    sizes[ cbn ].om_max = offset;
22 	}
23 #	ifdef PC
24 	    putlbracket( ftnno , -offset );
25 #	endif PC
26 	return offset;
27 }
28 
29 /*
30  * deallocate runtime temporary variables
31  */
32 tmpfree(restore)
33 	struct tmps *restore;
34 {
35 	long offset;
36 
37 	offset = restore->om_off;
38 	if (offset > sizes[cbn].curtmps.om_off) {
39 		sizes[cbn].curtmps.om_off = offset;
40 #		ifdef PC
41 		    putlbracket( ftnno , -offset );
42 #		endif PC
43 	}
44 }
45