/* C--, version 2.0, June 2, 2005 */ #include /* stack element type */ typedef int ITYPE; typedef float FTYPE; typedef union u_type { ITYPE ival; FTYPE fval;} S__TYPE; S__TYPE *STACK__S; /* stack */ ITYPE SP__S; /* stack pointer */ /* integer registers */ ITYPE R__0,R__1,R__2,R__3,R__4,R__5,R__6,R__7,R__8,R__9; FTYPE F__0,F__1,F__2,F__3,F__4,F__5,F__6,F__7,F__8,F__9; /* initial stack */ void INIT__S(void) { STACK__S = (S__TYPE *) malloc(sizeof(S__TYPE) * (MAX__S+1)); SP__S = 0; } /* return top of stack pointer */ ITYPE TOP__S(void) { return(SP__S); } /* returns the int value at stack pointer + i */ ITYPE VAL__S(i) ITYPE i; { return(STACK__S[SP__S+i].ival); } /* returns the float value at stack pointer + i */ FTYPE FVAL__S(i) ITYPE i; { return(STACK__S[SP__S+i].fval); } /* set new stack pointer to be current stack pointer $+ i$ */ void SETSP__S(i) ITYPE i; { SP__S += i; } /* set the int value at stack pointer $+ i$ to the int value $k$ */ void SSET__S(i,k) ITYPE i; ITYPE k; { STACK__S[SP__S+i].ival = k; } /* set the int value at stack pointer $+ i$ to the int value $k$ */ void FSSET__S(i,k) ITYPE i; FTYPE k; { STACK__S[SP__S+i].fval = k; } /* push int value k into stack */ void PUSH__S(k) ITYPE k; { SP__S += 1; STACK__S[SP__S].ival = k; } /* push float value k into stack */ void FPUSH__S(k) FTYPE k; { SP__S += 1; STACK__S[SP__S].fval = k; } /* pop int value from stack */ ITYPE POP__S(void) { return(STACK__S[SP__S--].ival); } /* pop float value from stack */ FTYPE FPOP__S(void) { return(STACK__S[SP__S--].fval); }