changes all over the place
[nedit-bw.git] / remove-args-from-DISASM_RT.patch
blobc066ee8332161298dc6be2dc5cebab8ead203115
1 ---
3 source/interpret.c | 103 ++++++++++++++++++++++++++++-------------------------
4 1 file changed, 56 insertions(+), 47 deletions(-)
6 diff --quilt old/source/interpret.c new/source/interpret.c
7 --- old/source/interpret.c
8 +++ new/source/interpret.c
9 @@ -136,10 +136,10 @@ static void disasmInternal(Inst *inst, i
10 static void stackdump(int n, int extra);
11 static void stackdumpInternal(int n, int extra);
12 #define STACKDUMP(n, x) stackdump(n, x)
13 -#define DISASM_RT(i, n) disasm(NULL, i, n)
14 +#define DISASM_RT() disasm(NULL, PC - 1, 1)
15 #else /* #ifndef DEBUG_STACK */
16 #define STACKDUMP(n, x)
17 -#define DISASM_RT(i, n)
18 +#define DISASM_RT()
19 #endif /* #ifndef DEBUG_STACK */
21 /* Global symbols and function definitions, is null initialized */
22 @@ -1560,7 +1560,7 @@ static void addToGlobalSymTab(Symbol *sy
23 #define BINARY_NUMERIC_OPERATION(operator) \
24 do { \
25 int n1, n2; \
26 - DISASM_RT(PC-1, 1); \
27 + DISASM_RT(); \
28 STACKDUMP(2, 3); \
29 POP_INT(n2); \
30 POP_INT(n1); \
31 @@ -1571,7 +1571,7 @@ static void addToGlobalSymTab(Symbol *sy
32 #define UNARY_NUMERIC_OPERATION(operator) \
33 do { \
34 int n; \
35 - DISASM_RT(PC-1, 1); \
36 + DISASM_RT(); \
37 STACKDUMP(1, 3); \
38 POP_INT(n); \
39 PUSH_INT(operator n); \
40 @@ -1591,7 +1591,7 @@ static int pushSymVal(void)
41 int nArgs, argNum;
42 DataValue symVal;
44 - DISASM_RT(PC-1, 2);
45 + DISASM_RT();
46 STACKDUMP(0, 3);
48 GET_SYM(s);
49 @@ -1646,7 +1646,7 @@ static int pushImmed(void)
51 int immed;
53 - DISASM_RT(PC-1, 2);
54 + DISASM_RT();
55 STACKDUMP(0, 3);
57 GET_IMMED(immed);
58 @@ -1660,7 +1660,7 @@ static int pushArgVal(void)
60 int nArgs, argNum;
62 - DISASM_RT(PC-1, 1);
63 + DISASM_RT();
64 STACKDUMP(1, 3);
66 POP_INT(argNum);
67 @@ -1676,7 +1676,7 @@ static int pushArgVal(void)
69 static int pushArgCount(void)
71 - DISASM_RT(PC-1, 1);
72 + DISASM_RT();
73 STACKDUMP(0, 3);
75 PUSH_INT(FRAME_GET_ARG_COUNT());
76 @@ -1689,7 +1689,7 @@ static int pushArgArray(void)
77 DataValue argVal, *argArray;
78 Boolean needArgCopy = False;
80 - DISASM_RT(PC-1, 1);
81 + DISASM_RT();
82 STACKDUMP(0, 3);
84 nArgs = FRAME_GET_ARG_COUNT();
85 @@ -1730,7 +1730,7 @@ static int pushArraySymVal(void)
86 DataValue *dataPtr;
87 int initEmpty;
89 - DISASM_RT(PC-1, 3);
90 + DISASM_RT();
91 STACKDUMP(0, 3);
93 GET_SYM(sym);
94 @@ -1773,7 +1773,7 @@ static int anonArrayOpen(void)
96 DataValue dataVal;
98 - DISASM_RT(PC-1, 1);
99 + DISASM_RT();
100 STACKDUMP(0, 3);
102 /* make an empty array */
103 @@ -1804,7 +1804,7 @@ static int anonArraySkip(void)
104 DataValue anonArray;
105 int nextIndex;
107 - DISASM_RT(PC-1, 1);
108 + DISASM_RT();
109 STACKDUMP(2, 3);
111 POP(anonArray);
112 @@ -1836,7 +1836,7 @@ static int anonArrayNextVal(void)
113 int nextIndex;
114 char numString[TYPE_INT_STR_SIZE(int)];
116 - DISASM_RT(PC-1, 1);
117 + DISASM_RT();
118 STACKDUMP(3, 3);
120 POP(exprVal);
121 @@ -1873,9 +1873,10 @@ static int anonArrayIndexVal(void)
122 int nextIndex, index;
123 int nDim;
125 + DISASM_RT();
127 GET_IMMED(nDim);
129 - DISASM_RT(PC-2, 2);
130 STACKDUMP(nDim+3, 3);
132 POP(exprVal);
133 @@ -1920,7 +1921,7 @@ static int anonArrayClose(void)
134 DataValue anonArray;
135 DataValue next_index;
137 - DISASM_RT(PC-1, 1);
138 + DISASM_RT();
139 STACKDUMP(2, 3);
141 /* remove top two elements */
142 @@ -1970,9 +1971,10 @@ static int namedArg1orN(Boolean isFirst)
143 DataValue exprVal, argsArray;
144 int nDim, index;
146 + DISASM_RT();
148 GET_IMMED(nDim);
150 - DISASM_RT(PC-2, 2);
151 STACKDUMP(nDim + (isFirst ? 2 : 1), 3);
153 POP(exprVal);
154 @@ -2016,7 +2018,7 @@ static int swapTop2(void)
156 DataValue dv1, dv2;
158 - DISASM_RT(PC-1, 1);
159 + DISASM_RT();
160 STACKDUMP(2, 3);
162 POP(dv1);
163 @@ -2041,7 +2043,7 @@ static int assign(void)
164 DataValue *dataPtr;
165 DataValue value;
167 - DISASM_RT(PC-1, 2);
168 + DISASM_RT();
169 STACKDUMP(1, 3);
171 GET_SYM(sym);
172 @@ -2088,7 +2090,7 @@ static int popStack(void)
174 DataValue val;
176 - DISASM_RT(PC-1, 1);
177 + DISASM_RT();
178 STACKDUMP(1, 4);
180 POP(val);
181 @@ -2105,7 +2107,7 @@ static int dupStack(void)
183 DataValue value;
185 - DISASM_RT(PC-1, 1);
186 + DISASM_RT();
187 STACKDUMP(1, 3);
189 PEEK(value, 0);
190 @@ -2127,7 +2129,7 @@ static int add(void)
191 DataValue leftVal, rightVal, resultArray;
192 int n1, n2;
194 - DISASM_RT(PC-1, 1);
195 + DISASM_RT();
196 STACKDUMP(2, 3);
198 PEEK(rightVal, 0);
199 @@ -2199,7 +2201,7 @@ static int subtract(void)
200 DataValue leftVal, rightVal, resultArray;
201 int n1, n2;
203 - DISASM_RT(PC-1, 1);
204 + DISASM_RT();
205 STACKDUMP(2, 3);
207 PEEK(rightVal, 0);
208 @@ -2271,7 +2273,7 @@ static int divide(void)
210 int n1, n2;
212 - DISASM_RT(PC-1, 1);
213 + DISASM_RT();
214 STACKDUMP(2, 3);
216 POP_INT(n2);
217 @@ -2287,7 +2289,7 @@ static int modulo(void)
219 int n1, n2;
221 - DISASM_RT(PC-1, 1);
222 + DISASM_RT();
223 STACKDUMP(2, 3);
225 POP_INT(n2);
226 @@ -2344,7 +2346,7 @@ static int eq(void)
228 DataValue v1, v2;
230 - DISASM_RT(PC-1, 1);
231 + DISASM_RT();
232 STACKDUMP(2, 3);
234 POP(v1);
235 @@ -2400,7 +2402,7 @@ static int bitAnd(void)
236 DataValue leftVal, rightVal, resultArray;
237 int n1, n2;
239 - DISASM_RT(PC-1, 1);
240 + DISASM_RT();
241 STACKDUMP(2, 3);
243 PEEK(rightVal, 0);
244 @@ -2460,7 +2462,7 @@ static int bitOr(void)
245 DataValue leftVal, rightVal, resultArray;
246 int n1, n2;
248 - DISASM_RT(PC-1, 1);
249 + DISASM_RT();
250 STACKDUMP(2, 3);
252 PEEK(rightVal, 0);
253 @@ -2543,7 +2545,7 @@ static int power(void)
255 int n1, n2, n3;
257 - DISASM_RT(PC-1, 1);
258 + DISASM_RT();
259 STACKDUMP(2, 3);
261 POP_INT(n2);
262 @@ -2667,9 +2669,10 @@ static int concat(void)
264 int nExpr;
266 + DISASM_RT();
268 GET_IMMED(nExpr);
270 - DISASM_RT(PC-2, 2);
271 STACKDUMP(nExpr, 3);
273 /* remember: concatenateNwithSep() succeeds with a non-positive number */
274 @@ -2840,10 +2843,11 @@ static int callSubroutine(void)
275 Symbol *sym;
276 int nArgs;
278 + DISASM_RT();
280 GET_SYM(sym);
281 GET_IMMED(nArgs);
283 - DISASM_RT(PC-3, 3);
284 STACKDUMP(nArgs > 0 ? nArgs : -nArgs, 3);
286 return callSubroutineFromSymbol(sym, nArgs);
287 @@ -2865,10 +2869,11 @@ static int callSubroutineStackedN(void)
288 /* this is much like callSubroutine, but we get nArgs off the stack
289 and it will always be negative since there is always an argArray */
291 + DISASM_RT();
293 GET_SYM(sym);
295 PEEK_INT(nArgs, 0);
296 - DISASM_RT(PC-2, 2);
297 STACKDUMP(-nArgs + 1, 3); /* +1 for stacked nArgs */
299 POP_INT(nArgs);
300 @@ -2977,7 +2982,7 @@ static int unpackArrayToArgs(void)
301 SparseArrayEntry *iter;
302 DataValue dvEntry, dvArray, argArray;
304 - DISASM_RT(PC-1, 1);
305 + DISASM_RT();
306 STACKDUMP(1, 3);
308 GET_IMMED(nArgs);
309 @@ -3065,7 +3070,7 @@ static int returnValOrNone(int valOnStac
310 DataValue retVal;
311 static DataValue noValue = {NO_TAG, {0}};
313 - DISASM_RT(PC-1, 1);
314 + DISASM_RT();
315 STACKDUMP(StackP - FrameP + FRAME_GET_ARG_COUNT() + FP_TO_ARGS_DIST, 3);
317 /* return value is on the stack */
318 @@ -3095,7 +3100,7 @@ static int branch(void)
320 Inst *addr;
322 - DISASM_RT(PC-1, 2);
323 + DISASM_RT();
324 STACKDUMP(0, 3);
326 GET_BRANCH(addr);
327 @@ -3125,7 +3130,7 @@ static int branchIf(Boolean trueOrFalse)
328 int value;
329 Inst *addr;
331 - DISASM_RT(PC-1, 2);
332 + DISASM_RT();
333 STACKDUMP(1, 3);
335 GET_BRANCH(addr);
336 @@ -3149,7 +3154,7 @@ static int branchNever(void)
338 Inst *addr;
340 - DISASM_RT(PC-1, 2);
341 + DISASM_RT();
342 STACKDUMP(0, 3);
344 GET_BRANCH(addr);
345 @@ -3515,9 +3520,10 @@ static int arrayRef(void)
346 char *keyString = NULL;
347 int nDim;
349 + DISASM_RT();
351 GET_IMMED(nDim);
353 - DISASM_RT(PC-2, 2);
354 STACKDUMP(nDim+1, 3);
356 if (nDim > 0) {
357 @@ -3565,9 +3571,10 @@ static int arrayAssign(void)
358 int errNum;
359 int nDim;
361 + DISASM_RT();
363 GET_IMMED(nDim);
365 - DISASM_RT(PC-2, 1);
366 STACKDUMP(nDim+2, 3);
368 if (nDim > 0) {
369 @@ -3617,10 +3624,11 @@ static int arrayRefAndAssignSetup(void)
370 char *keyString = NULL;
371 int binaryOp, nDim;
373 + DISASM_RT();
375 GET_IMMED(binaryOp);
376 GET_IMMED(nDim);
378 - DISASM_RT(PC-3, 3);
379 STACKDUMP(nDim + (binaryOp ? 2 : 1), 3);
381 if (binaryOp) {
382 @@ -3671,7 +3679,7 @@ static int beginArrayIter(void)
383 DataValue *iteratorValPtr;
384 DataValue arrayVal;
386 - DISASM_RT(PC-1, 2);
387 + DISASM_RT();
388 STACKDUMP(1, 3);
390 GET_SYM(iterator);
391 @@ -3730,7 +3738,7 @@ static int arrayIter(void)
392 Inst *branchAddr;
393 int withVal;
395 - DISASM_RT(PC-1, 4);
396 + DISASM_RT();
397 STACKDUMP(0, 4);
399 GET_IMMED(withVal);
400 @@ -3806,7 +3814,7 @@ static int beginArrayIterArray(void)
401 DataValue arrayVal;
402 int nDims;
404 - DISASM_RT(PC-1, 2);
405 + DISASM_RT();
406 STACKDUMP(2, 3);
408 GET_SYM(iterator);
409 @@ -3908,7 +3916,7 @@ static int arrayIterArray(void)
410 int nDims, d;
411 Boolean keyFound = False;
413 - DISASM_RT(PC-1, 4);
414 + DISASM_RT();
415 STACKDUMP(1, 4);
417 GET_IMMED(withVal);
418 @@ -4010,7 +4018,7 @@ static int inArray(void)
419 char *keyStr;
420 int inResult = 0;
422 - DISASM_RT(PC-1, 1);
423 + DISASM_RT();
424 STACKDUMP(2, 3);
426 POP(theArray);
427 @@ -4054,9 +4062,10 @@ static int deleteArrayElement(void)
428 char *keyString = NULL;
429 int nDim;
431 + DISASM_RT();
433 GET_IMMED(nDim);
435 - DISASM_RT(PC-2, 2);
436 STACKDUMP(nDim + 1, 3);
438 if (nDim > 0) {
439 @@ -4147,7 +4156,7 @@ static int arrayAssignNext(void)
440 DataValue srcValue, dstArray;
441 int errNum;
443 - DISASM_RT(PC-1, 1);
444 + DISASM_RT();
445 STACKDUMP(2, 3);
447 POP(srcValue);
448 @@ -4189,7 +4198,7 @@ static int arrayNextNumIdx(void)
449 DataValue srcArray;
450 SparseArrayEntry *iter;
452 - DISASM_RT(PC-1, 1);
453 + DISASM_RT();
454 STACKDUMP(1, 3);
456 POP(srcArray);