Pristine Ack-5.5
[Ack-5.5.git] / util / int / fra.c
1 /* $Id: fra.c,v 2.3 1994/06/24 10:47:18 ceriel Exp $ */
2
3 #include        "logging.h"
4 #include        "global.h"
5 #include        "mem.h"
6 #include        "shadow.h"
7 #include        "fra.h"
8 #include        "alloc.h"
9
10 #ifdef  LOGGING
11 char *FRA_sh;                           /* shadowbytes */
12 #endif  /* LOGGING */
13
14 init_FRA() {
15         FRA = Malloc(FRALimit, "Function Return Area");
16 #ifdef  LOGGING
17         FRA_sh = Malloc(FRALimit, "shadowspace for Function Return Area");
18 #endif  /* LOGGING */
19         FRA_def = UNDEFINED;            /* set FRA illegal */
20 }
21
22 pushFRA(sz)
23         size sz;
24 {
25         register int i;
26
27         if (sz == 0)
28                 return;
29
30         st_inc(max(sz, wsize));
31         for (i = 0; i < sz; i++) {
32                 stack_loc(SP + i) = FRA[i];
33 #ifdef  LOGGING
34                 st_sh(SP + i) = (i < FRASize ? FRA_sh[i] : UNDEFINED);
35 #endif  /* LOGGING */
36         }
37 }
38
39 popFRA(sz)
40         size sz;
41 {
42         register int i;
43
44         if (sz == 0)
45                 return;
46
47         for (i = 0; i < sz; i++) {
48                 FRA[i] = stack_loc(SP + i);
49 #ifdef  LOGGING
50                 FRA_sh[i] = st_sh(SP + i);
51 #endif  /* LOGGING */
52         }
53         st_dec(max(sz, wsize));
54 }
55