/* Make a new environment on the stack. The prevsize parameter is the count of objects already on the stack that become part of the environment that is being created, and extrasize are the additional elements on the stack that are to be added. These additional elements have the initial value CUNBOUND. */ void __arc_mkenv(arc *c, value thr, int prevsize, int extrasize) { value *envstart; int i, esofs; /* Add the extra environment entries */ for (i=0; i<extrasize; i++) CPUSH(thr, CUNBOUND); /* Add the count */ CPUSH(thr, INT2FIX(prevsize+extrasize)); envstart = TSP(thr); CPUSH(thr, TENVR(thr)); esofs = envstart - TSBASE(thr); TSFN(thr) = TSP(thr); /* start of stack after env */ SENVR(thr, ((value)((long)(esofs << 4) | ENV_FLAG))); }
void _Call (void) { // CALLTELO // cmd-> CALLTELO // +1 ADR // address of DSSP-procedure // +2 ... // address of this position // // will be in C-STACK CPUSH(cmd+2); cmd = (lptr)ML(cmd+1); EXECMD; }
// Initialize leave for a loop // Pushes Rstack pointer on Pstack with BHEAD_LEAVE static void initLeave(void) { int32_t data; // Get pointer from rstack // Add one because -1 cannot be coded data=(int32_t)(MainContext.rstack.Pointer)+1; // Add BHEAD_LEAVE data|=BHEAD_LEAVE; CPUSH(data); //Push on parameter stack }
void _Br1 (void) { // BR1 CPOP(pc); if (AITEM(1)==AT) { ADELn(2); GETCMD; // looking for ELSE while (ML(pc)!=cmd_Else) pc++; pc +=2; // so that pc points after P0 EXECMD; } else { ADEL; pc++; GETCMD; CPUSH(pc); pc=PCADR(cmd_BR1); EXECMD; } }
// start new-level interpretation ( BEGIN DSSP-procedure ) void _Int (void) { CPUSH(pc); pc = PCADR(cmd+1); }
void _SetR (void) { // !R int32 RVal; APOP(RVal); CPUSH(RVal); }
void _Br (void) { // BR // BR V1 P1 V2 P2 ... VX PX ELSE P0 GETCMD; CPUSH(pc); pc=PCADR(cmd_BR1); EXECMD; }