3 source/interpret.c | 53 ++++++++++++++++++++++++++++++++---------------------
4 1 file changed, 32 insertions(+), 21 deletions(-)
6 diff --quilt old/source/interpret.c new/source/interpret.c
7 --- old/source/interpret.c
8 +++ new/source/interpret.c
9 @@ -1388,6 +1388,17 @@ static void addToGlobalSymTab(Symbol *sy
13 +#define FRAME_GET_ITEM(xIndex) FP_GET_ITEM(FrameP,xIndex)
14 +#define FRAME_GET_ARG_ARRAY() FP_GET_ARG_ARRAY(FrameP)
15 +#define FRAME_GET_ARG_COUNT() FP_GET_ARG_COUNT(FrameP)
16 +#define FRAME_GET_OLD_FP() FP_GET_OLD_FP(FrameP)
17 +#define FRAME_GET_RET_PC() FP_GET_RET_PC(FrameP)
18 +#define FRAME_GET_PROG() FP_GET_PROG(FrameP)
19 +#define FRAME_ARG_START_INDEX() FP_ARG_START_INDEX(FrameP)
20 +#define FRAME_GET_ARG_N(xN) FP_GET_ARG_N(FrameP,xN)
21 +#define FRAME_GET_SYM_N(xN) FP_GET_SYM_N(FrameP,xN)
22 +#define FRAME_GET_SYM_VAL(xSym) FP_GET_SYM_VAL(FrameP,xSym)
24 /* true, if you can pop n values */
25 #define OK_TO_POP(n) \
26 ((StackP - (n)) >= TheStack)
27 @@ -1553,11 +1564,11 @@ static int pushSymVal(void)
30 if (s->type == LOCAL_SYM) {
31 - symVal = FP_GET_SYM_VAL(FrameP, s);
32 + symVal = FRAME_GET_SYM_VAL(s);
33 } else if (s->type == GLOBAL_SYM || s->type == CONST_SYM) {
35 } else if (s->type == ARG_SYM) {
36 - nArgs = FP_GET_ARG_COUNT(FrameP);
37 + nArgs = FRAME_GET_ARG_COUNT();
38 argNum = s->value.val.n;
39 if (argNum >= nArgs) {
40 return execError("referenced undefined argument: %s", s->name);
41 @@ -1567,7 +1578,7 @@ static int pushSymVal(void)
45 - symVal = FP_GET_ARG_N(FrameP, argNum);
46 + symVal = FRAME_GET_ARG_N(argNum);
48 } else if (s->type == PROC_VALUE_SYM) {
50 @@ -1621,12 +1632,12 @@ static int pushArgVal(void)
54 - nArgs = FP_GET_ARG_COUNT(FrameP);
55 + nArgs = FRAME_GET_ARG_COUNT();
56 if (argNum >= nArgs || argNum < 0) {
57 return execError("referenced undefined argument: $args[%s]",
58 longAsStr(argNum + 1));
60 - PUSH(FP_GET_ARG_N(FrameP, argNum));
61 + PUSH(FRAME_GET_ARG_N(argNum));
65 @@ -1635,7 +1646,7 @@ static int pushArgCount(void)
69 - PUSH_INT(FP_GET_ARG_COUNT(FrameP));
70 + PUSH_INT(FRAME_GET_ARG_COUNT());
74 @@ -1648,8 +1659,8 @@ static int pushArgArray(void)
78 - nArgs = FP_GET_ARG_COUNT(FrameP);
79 - argArray = &FP_GET_ARG_ARRAY(FrameP);
80 + nArgs = FRAME_GET_ARG_COUNT();
81 + argArray = &FRAME_GET_ARG_ARRAY();
82 if (argArray->tag != ARRAY_TAG) {
83 /* we require a real array in the argArray position */
84 argArray->tag = ARRAY_TAG;
85 @@ -1660,7 +1671,7 @@ static int pushArgArray(void)
86 if (needArgCopy || (nArgs && !ArrayGet(argArray, (char *)"1", &argVal))) {
87 /* load arguments from positional arg list if not already done */
88 for (argNum = 0; argNum < nArgs; ++argNum) {
89 - argVal = FP_GET_ARG_N(FrameP, argNum);
90 + argVal = FRAME_GET_ARG_N(argNum);
91 if (!ArrayInsert(argArray, AllocStringOfNumber(argNum + 1),
93 return(execError("argument array insertion failure", NULL));
94 @@ -1693,7 +1704,7 @@ static int pushArraySymVal(void)
97 if (sym->type == LOCAL_SYM) {
98 - dataPtr = &FP_GET_SYM_VAL(FrameP, sym);
99 + dataPtr = &FRAME_GET_SYM_VAL(sym);
101 else if (sym->type == GLOBAL_SYM) {
102 dataPtr = &sym->value;
103 @@ -2015,7 +2026,7 @@ static int assign(void)
106 if (sym->type == LOCAL_SYM) {
107 - dataPtr = &FP_GET_SYM_VAL(FrameP, sym);
108 + dataPtr = &FRAME_GET_SYM_VAL(sym);
111 dataPtr = &sym->value;
112 @@ -2680,7 +2691,7 @@ static int callSubroutineFromSymbol(Symb
115 if (sym->type == LOCAL_SYM) {
116 - symValPtr = &FP_GET_SYM_VAL(FrameP, sym);
117 + symValPtr = &FRAME_GET_SYM_VAL(sym);
118 } else if (sym->type == GLOBAL_SYM) {
119 symValPtr = &sym->value;
121 @@ -3019,7 +3030,7 @@ static int returnValOrNone(int valOnStac
122 static DataValue noValue = {NO_TAG, {0}};
125 - STACKDUMP(StackP - FrameP + FP_GET_ARG_COUNT(FrameP) + FP_TO_ARGS_DIST, 3);
126 + STACKDUMP(StackP - FrameP + FRAME_GET_ARG_COUNT() + FP_TO_ARGS_DIST, 3);
128 /* return value is on the stack */
130 @@ -3632,7 +3643,7 @@ static int beginArrayIter(void)
133 if (iterator->type == LOCAL_SYM) {
134 - iteratorValPtr = &FP_GET_SYM_VAL(FrameP, iterator);
135 + iteratorValPtr = &FRAME_GET_SYM_VAL(iterator);
138 return(execError("bad temporary iterator: %s", iterator->name));
139 @@ -3695,7 +3706,7 @@ static int arrayIter(void)
140 GET_BRANCH(branchAddr);
142 if (keySym->type == LOCAL_SYM) {
143 - keyValPtr = &FP_GET_SYM_VAL(FrameP, keySym);
144 + keyValPtr = &FRAME_GET_SYM_VAL(keySym);
146 else if (keySym->type == GLOBAL_SYM) {
147 keyValPtr = &(keySym->value);
148 @@ -3707,7 +3718,7 @@ static int arrayIter(void)
151 if (valSym->type == LOCAL_SYM) {
152 - valPtr = &FP_GET_SYM_VAL(FrameP, valSym);
153 + valPtr = &FRAME_GET_SYM_VAL(valSym);
155 else if (valSym->type == GLOBAL_SYM) {
156 valPtr = &(valSym->value);
157 @@ -3719,7 +3730,7 @@ static int arrayIter(void)
160 if (iterator->type == LOCAL_SYM) {
161 - iteratorValPtr = &FP_GET_SYM_VAL(FrameP, iterator);
162 + iteratorValPtr = &FRAME_GET_SYM_VAL(iterator);
165 return(execError("bad temporary iterator: %s", iterator->name));
166 @@ -3768,7 +3779,7 @@ static int beginArrayIterArray(void)
169 if (iterator->type == LOCAL_SYM) {
170 - iteratorValPtr = &FP_GET_SYM_VAL(FrameP, iterator);
171 + iteratorValPtr = &FRAME_GET_SYM_VAL(iterator);
174 return(execError("bad temporary iterator: %s", iterator->name));
175 @@ -3875,7 +3886,7 @@ static int arrayIterArray(void)
178 if (keyArraySym->type == LOCAL_SYM) {
179 - keyArrayPtr = &FP_GET_SYM_VAL(FrameP, keyArraySym);
180 + keyArrayPtr = &FRAME_GET_SYM_VAL(keyArraySym);
182 else if (keyArraySym->type == GLOBAL_SYM) {
183 keyArrayPtr = &(keyArraySym->value);
184 @@ -3888,7 +3899,7 @@ static int arrayIterArray(void)
187 if (valSym->type == LOCAL_SYM) {
188 - valPtr = &FP_GET_SYM_VAL(FrameP, valSym);
189 + valPtr = &FRAME_GET_SYM_VAL(valSym);
191 else if (valSym->type == GLOBAL_SYM) {
192 valPtr = &valSym->value;
193 @@ -3900,7 +3911,7 @@ static int arrayIterArray(void)
196 if (iterator->type == LOCAL_SYM) {
197 - iteratorValPtr = &FP_GET_SYM_VAL(FrameP, iterator);
198 + iteratorValPtr = &FRAME_GET_SYM_VAL(iterator);
201 return(execError("bad temporary iterator: %s", iterator->name));