From df84b51b6f0563c58b0d8256a0cbf2968483c8d4 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Wed, 15 Oct 2008 17:10:05 +0200 Subject: [PATCH] fix StringToNumEnd and remove unused variables in arrayEntryCopyToNode B.W. --- Patch: !guaranty-order-for-numeric-keys.patch --- EXEC_ERROR.patch | 44 +++++++++++++++++------------------ FastConcat3.diff | 4 ++-- InterpretDebug-mods.patch | 30 ++++++++++++------------ InterpretDebug5-fix-stackDumpStr.diff | 8 +++---- InterpretDebug5.diff | 22 +++++++++--------- MultipleAssignment-redux.patch | 2 +- SUBR_TAG.patch | 6 ++--- abstract-access-to-FrameP.patch | 16 ++++++------- abstract-access-to-PC.patch | 22 +++++++++--------- anonArrayNamedArgs7.diff | 6 ++--- array-key-array-iterator.patch | 6 ++--- array-next-num-index.patch | 4 ++-- arrayReplacesArglist-redux.patch | 2 +- arrayReplacesArglist5.diff | 2 +- aryiter-on-stack.patch | 26 ++++++++++----------- core-typeof-syntax.patch | 2 +- drop-SUBR_TAG.patch | 6 ++--- extend-for-key-in-array-syntax.patch | 10 ++++---- global-RestartData.patch | 16 ++++++------- guaranty-order-for-numeric-keys.patch | 21 +++++++++-------- op-not-func-in-Inst.patch | 8 +++---- remove-args-from-DISASM_RT.patch | 22 +++++++++--------- stringToNum.diff | 4 ++-- symbol-lookup.patch | 30 ++++++++++++------------ typed-Inst.patch | 14 +++++------ 25 files changed, 167 insertions(+), 166 deletions(-) diff --git a/EXEC_ERROR.patch b/EXEC_ERROR.patch index 844b91e..3dfc447 100644 --- a/EXEC_ERROR.patch +++ b/EXEC_ERROR.patch @@ -447,7 +447,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -3505,23 +3507,24 @@ static int arrayRef(void) +@@ -3503,23 +3505,24 @@ static int arrayRef(void) POP(srcArray); if (srcArray.tag == ARRAY_TAG) { if (!ArrayGet(&srcArray, keyString, &valueItem)) { @@ -477,7 +477,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } } } -@@ -3558,7 +3561,7 @@ static int arrayAssign(void) +@@ -3556,7 +3559,7 @@ static int arrayAssign(void) POP(dstArray); if (dstArray.tag != ARRAY_TAG && dstArray.tag != NO_TAG) { @@ -486,7 +486,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } if (srcValue.tag == ARRAY_TAG) { DataValue arrayCopyValue; -@@ -3570,13 +3573,13 @@ static int arrayAssign(void) +@@ -3568,13 +3571,13 @@ static int arrayAssign(void) } } if (ArrayInsert(&dstArray, keyString, &srcValue)) { @@ -503,7 +503,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -3614,20 +3617,21 @@ static int arrayRefAndAssignSetup(void) +@@ -3612,20 +3615,21 @@ static int arrayRefAndAssignSetup(void) PEEK(srcArray, nDim); if (srcArray.tag == ARRAY_TAG) { if (!ArrayGet(&srcArray, keyString, &valueItem)) { @@ -529,7 +529,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } } -@@ -3660,16 +3664,16 @@ static int beginArrayIter(void) +@@ -3658,16 +3662,16 @@ static int beginArrayIter(void) iteratorValPtr = &FRAME_GET_SYM_VAL(iterator); } else { @@ -549,7 +549,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -3726,7 +3730,7 @@ static int arrayIter(void) +@@ -3724,7 +3728,7 @@ static int arrayIter(void) keyValPtr = &(keySym->value); } else { @@ -558,7 +558,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } keyValPtr->tag = NO_TAG; -@@ -3738,7 +3742,7 @@ static int arrayIter(void) +@@ -3736,7 +3740,7 @@ static int arrayIter(void) valPtr = &(valSym->value); } else { @@ -567,7 +567,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } valPtr->tag = NO_TAG; } -@@ -3747,7 +3751,7 @@ static int arrayIter(void) +@@ -3745,7 +3749,7 @@ static int arrayIter(void) iteratorValPtr = &FRAME_GET_SYM_VAL(iterator); } else { @@ -576,7 +576,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } thisEntry = iteratorValPtr->val.arrayPtr; -@@ -3768,7 +3772,7 @@ static int arrayIter(void) +@@ -3766,7 +3770,7 @@ static int arrayIter(void) else { JUMP(branchAddr); } @@ -585,7 +585,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -3796,21 +3800,21 @@ static int beginArrayIterArray(void) +@@ -3794,21 +3798,21 @@ static int beginArrayIterArray(void) iteratorValPtr = &FRAME_GET_SYM_VAL(iterator); } else { @@ -611,7 +611,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } static int countDim(const char *key) -@@ -3906,7 +3910,7 @@ static int arrayIterArray(void) +@@ -3904,7 +3908,7 @@ static int arrayIterArray(void) keyArrayPtr = &(keyArraySym->value); } else { @@ -620,7 +620,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } keyArrayPtr->tag = ARRAY_TAG; keyArrayPtr->val.arrayPtr = NULL; -@@ -3919,7 +3923,7 @@ static int arrayIterArray(void) +@@ -3917,7 +3921,7 @@ static int arrayIterArray(void) valPtr = &valSym->value; } else { @@ -629,7 +629,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } valPtr->tag = NO_TAG; } -@@ -3928,7 +3932,7 @@ static int arrayIterArray(void) +@@ -3926,7 +3930,7 @@ static int arrayIterArray(void) iteratorValPtr = &FRAME_GET_SYM_VAL(iterator); } else { @@ -638,7 +638,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } thisEntry = iteratorValPtr->val.arrayPtr; -@@ -3949,7 +3953,7 @@ static int arrayIterArray(void) +@@ -3947,7 +3951,7 @@ static int arrayIterArray(void) /* set keys */ if (!splitKeyIntoArray(thisEntry->key, keyArrayPtr)) { @@ -647,7 +647,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } if (withVal) { -@@ -3993,7 +3997,7 @@ static int inArray(void) +@@ -3991,7 +3995,7 @@ static int inArray(void) POP(theArray); if (theArray.tag != ARRAY_TAG) { @@ -656,7 +656,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } PEEK(leftArray, 0); if (leftArray.tag == ARRAY_TAG) { -@@ -4014,7 +4018,7 @@ static int inArray(void) +@@ -4012,7 +4016,7 @@ static int inArray(void) } } PUSH_INT(inResult); @@ -665,7 +665,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -4057,15 +4061,15 @@ static int deleteArrayElement(void) +@@ -4055,15 +4059,15 @@ static int deleteArrayElement(void) } } else { @@ -684,7 +684,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } inTypeOfMode = 1; -@@ -4079,7 +4083,7 @@ static int typeOfOut(void) +@@ -4077,7 +4081,7 @@ static int typeOfOut(void) DataValue retVal; if (!inTypeOfMode) { @@ -693,7 +693,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } inTypeOfMode = 0; -@@ -4133,7 +4137,7 @@ static int arrayAssignNext(void) +@@ -4131,7 +4135,7 @@ static int arrayAssignNext(void) POP(dstArray); if (dstArray.tag != ARRAY_TAG && dstArray.tag != NO_TAG) { @@ -702,7 +702,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } if (srcValue.tag == ARRAY_TAG) { -@@ -4149,7 +4153,7 @@ static int arrayAssignNext(void) +@@ -4147,7 +4151,7 @@ static int arrayAssignNext(void) keyString = AllocStringOfNumber(arrayMaxNumIdx(&dstArray) + 1); if (!ArrayInsert(&dstArray, keyString, &srcValue)) { @@ -711,7 +711,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } return STAT_OK; -@@ -4173,7 +4177,7 @@ static int arrayNextNumIdx(void) +@@ -4171,7 +4175,7 @@ static int arrayNextNumIdx(void) POP(srcArray); if (srcArray.tag != ARRAY_TAG) { @@ -720,7 +720,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } PUSH_INT(arrayMaxNumIdx(&srcArray) + 1); -@@ -4188,9 +4192,9 @@ static int arrayNextNumIdx(void) +@@ -4186,9 +4190,9 @@ static int arrayNextNumIdx(void) static int errCheck(const char *s) { if (errno == EDOM) diff --git a/FastConcat3.diff b/FastConcat3.diff index be085b4..ec0d766 100644 --- a/FastConcat3.diff +++ b/FastConcat3.diff @@ -333,7 +333,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } return(STAT_OK); } -@@ -3108,6 +3212,10 @@ static void disasm(Inst *inst, int nInst +@@ -3109,6 +3213,10 @@ static void disasm(Inst *inst, int nInst &inst[i+1] + inst[i+1].value); ++i; } @@ -355,7 +355,7 @@ diff --quilt old/source/interpret.h new/source/interpret.h int AllocNString(NString *string, int length); int AllocNStringNCpy(NString *string, const char *s, int length); int AllocNStringCpy(NString *string, const char *s); -@@ -185,5 +186,7 @@ WindowInfo *MacroFocusWindow(void); +@@ -186,5 +187,7 @@ void SetMacroFocusWindow(WindowInfo *win /* function used for implicit conversion from string to number */ int StringToNum(const char *string, int *number); int StringToNumEnd(const char *string, const char *end, int *number); diff --git a/InterpretDebug-mods.patch b/InterpretDebug-mods.patch index a174e9a..2b5be8f 100644 --- a/InterpretDebug-mods.patch +++ b/InterpretDebug-mods.patch @@ -113,7 +113,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c XtFree((char *)prog); } } -@@ -3078,7 +3083,7 @@ static void arrayDisposeNode(rbTreeNode +@@ -3075,7 +3080,7 @@ static void arrayDisposeNode(rbTreeNode SparseArrayEntry *ArrayNew(void) { @@ -122,7 +122,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -3590,7 +3595,9 @@ static int errCheck(const char *s) +@@ -3587,7 +3592,9 @@ static int errCheck(const char *s) */ static char *stackDumpStr(DataValue *fp, const char *msg, char **s, int *pLen) { @@ -133,7 +133,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c const char *op; char *np; DataValue *nfp = fp; -@@ -3598,22 +3605,26 @@ static char *stackDumpStr(DataValue *fp, +@@ -3595,22 +3602,26 @@ static char *stackDumpStr(DataValue *fp, #ifdef DEBUG_STACK const char *dump; @@ -163,7 +163,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #endif if (*pLen < len) { -@@ -3625,10 +3636,25 @@ static char *stackDumpStr(DataValue *fp, +@@ -3622,10 +3633,25 @@ static char *stackDumpStr(DataValue *fp, op = msg; while (*op) *np++ = *op++; @@ -189,7 +189,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c op = FP_GET_ITEM(nfp, FP_FUNCTION_NAME).val.str.rep; while (*op) *np++ = *op++; -@@ -3636,12 +3662,15 @@ static char *stackDumpStr(DataValue *fp, +@@ -3633,12 +3659,15 @@ static char *stackDumpStr(DataValue *fp, nfp = FP_GET_OLD_FP(nfp); } while (pc); #ifdef DEBUG_STACK @@ -206,7 +206,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return *s; } -@@ -3781,31 +3810,50 @@ int outPrintd() +@@ -3782,31 +3811,50 @@ int outPrintd() #ifdef DEBUG_DISASSEMBLER /* dumping values in disassembly or stack dump */ static void dumpVal(DataValue dv) { @@ -269,7 +269,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c break; case NO_TAG: if (!dv.val.inst) { -@@ -3831,57 +3879,65 @@ static void disasmInternal(Inst *inst, i +@@ -3832,57 +3880,65 @@ static void disasmInternal(Inst *inst, i #undef OP }; int i, j; @@ -350,7 +350,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c inst[i+1].sym->name, inst[i+2].sym->name, inst[i+3].value, &inst[i+3] + inst[i+3].value); -@@ -3893,18 +3949,20 @@ static void disasmInternal(Inst *inst, i +@@ -3894,18 +3950,20 @@ static void disasmInternal(Inst *inst, i j == OP_ANONARRAY_INDEX_VAL || j == OP_NAMED_ARG1 || j == OP_NAMED_ARGN) { @@ -377,7 +377,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } printd("\n"); -@@ -3912,18 +3970,20 @@ static void disasmInternal(Inst *inst, i +@@ -3913,18 +3971,20 @@ static void disasmInternal(Inst *inst, i } } if (j == N_OPS) { @@ -400,7 +400,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c outPrintd(); } #endif /* #ifdef DEBUG_DISASSEMBLER */ -@@ -3974,7 +4034,7 @@ static void stackdumpframe(DataValue *ar +@@ -3975,7 +4035,7 @@ static void stackdumpframe(DataValue *ar for (dv = endDv; dv < sp; dv++) #endif /* #ifdef DEBUG_STACK_HEADFIRST */ { @@ -409,7 +409,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c const char *symName = ""; char *pos = ""; -@@ -3983,8 +4043,7 @@ static void stackdumpframe(DataValue *ar +@@ -3984,8 +4044,7 @@ static void stackdumpframe(DataValue *ar const char *leadIn = (dv >= arrow) ? ">>>>" : (dv == arg1) ? "----" : (dv == fnNm) ? "====" : ""; @@ -419,7 +419,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c switch (offset) { case FP_ARG_COUNT_INDEX: pos = "NArgs"; break; /* num. arguments */ case FP_FUNCTION_NAME: pos = "FnName"; break; -@@ -4002,7 +4061,7 @@ static void stackdumpframe(DataValue *ar +@@ -4003,7 +4062,7 @@ static void stackdumpframe(DataValue *ar } else if (0 <= offset && offset < nSyms) { sprintf(pos = buffer, offset ? "[%d]" : "FP[%d]", offset); @@ -428,7 +428,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (offset == 0) { pos = "FrameP"; -@@ -4020,10 +4079,10 @@ static void stackdumpframe(DataValue *ar +@@ -4021,10 +4080,10 @@ static void stackdumpframe(DataValue *ar } } } @@ -441,7 +441,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c else dumpVal(*dv); -@@ -4052,7 +4111,7 @@ static void stackdumpInternal(int n, int +@@ -4053,7 +4112,7 @@ static void stackdumpInternal(int n, int if (outpt < TheStack) printd("--------------Stack base--------------\n"); stackdumpframe(arrow, outpt, FrameP, StackP, '*'); @@ -450,7 +450,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #endif /* #ifdef DEBUG_STACK_HEADFIRST */ } -@@ -4062,7 +4121,11 @@ static void stackdump(int n, int extra) +@@ -4063,7 +4122,11 @@ static void stackdump(int n, int extra) if (outIsTTY == -1) outIsTTY = isatty(fileno(stdout)); diff --git a/InterpretDebug5-fix-stackDumpStr.diff b/InterpretDebug5-fix-stackDumpStr.diff index 2788eae..edbae0b 100644 --- a/InterpretDebug5-fix-stackDumpStr.diff +++ b/InterpretDebug5-fix-stackDumpStr.diff @@ -6,7 +6,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -3109,6 +3109,7 @@ static char *stackDumpStr(DataValue *fp, +@@ -3106,6 +3106,7 @@ static char *stackDumpStr(DataValue *fp, const char *op; char *np; DataValue *nfp = fp; @@ -14,7 +14,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #ifdef DEBUG_STACK const char *dump; -@@ -3120,9 +3121,12 @@ static char *stackDumpStr(DataValue *fp, +@@ -3117,9 +3118,12 @@ static char *stackDumpStr(DataValue *fp, /* first measure the lengths */ len = strlen(msg) + 1; @@ -29,7 +29,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #ifdef DEBUG_STACK len += strlen(dump); #endif -@@ -3137,12 +3141,15 @@ static char *stackDumpStr(DataValue *fp, +@@ -3134,12 +3138,15 @@ static char *stackDumpStr(DataValue *fp, while (*op) *np++ = *op++; @@ -47,7 +47,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #ifdef DEBUG_STACK op = dump; while (*op) -@@ -3426,8 +3433,8 @@ static void disasm(Inst *inst, int nInst +@@ -3427,8 +3434,8 @@ static void disasm(Inst *inst, int nInst static void stackdumpframe(DataValue *arrow, DataValue *outpt, DataValue *fp, DataValue *sp, char topMark) { diff --git a/InterpretDebug5.diff b/InterpretDebug5.diff index 25420a7..f15eff8 100644 --- a/InterpretDebug5.diff +++ b/InterpretDebug5.diff @@ -191,7 +191,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -2716,7 +2741,7 @@ static int arrayRef(void) +@@ -2713,7 +2738,7 @@ static int arrayRef(void) PC++; DISASM_RT(PC-2, 2); @@ -200,7 +200,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (nDim > 0) { errNum = makeArrayKeyFromArgs(nDim, &keyString, 0); -@@ -2767,7 +2792,7 @@ static int arrayAssign(void) +@@ -2764,7 +2789,7 @@ static int arrayAssign(void) PC++; DISASM_RT(PC-2, 1); @@ -209,7 +209,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (nDim > 0) { POP(srcValue); -@@ -2805,9 +2830,9 @@ static int arrayAssign(void) +@@ -2802,9 +2827,9 @@ static int arrayAssign(void) ** for use with assign-op operators (eg a[i,j] += k ** ** Before: Prog-> [binOp], nDim, next, ... @@ -221,7 +221,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c */ static int arrayRefAndAssignSetup(void) { -@@ -2822,7 +2847,7 @@ static int arrayRefAndAssignSetup(void) +@@ -2819,7 +2844,7 @@ static int arrayRefAndAssignSetup(void) PC++; DISASM_RT(PC-3, 3); @@ -230,7 +230,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (binaryOp) { POP(moveExpr); -@@ -3076,6 +3101,59 @@ static int errCheck(const char *s) +@@ -3073,6 +3098,59 @@ static int errCheck(const char *s) } /* @@ -290,7 +290,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** combine two strings in a static area and set ErrMsg to point to the ** result. Returns false so a single return execError() statement can ** be used to both process the message and return. -@@ -3083,9 +3161,11 @@ static int errCheck(const char *s) +@@ -3080,9 +3158,11 @@ static int errCheck(const char *s) static int execError(const char *s1, const char *s2) { static char msg[MAX_ERR_MSG_LEN]; @@ -303,7 +303,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_ERROR; } -@@ -3135,11 +3215,83 @@ static const char *tagToStr(enum typeTag +@@ -3136,11 +3216,83 @@ static const char *tagToStr(enum typeTag } #ifdef DEBUG_DISASSEMBLER /* dumping values in disassembly or stack dump */ @@ -388,7 +388,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c break; case STRING_TAG: { -@@ -3147,38 +3299,39 @@ static void dumpVal(DataValue dv) +@@ -3148,38 +3300,39 @@ static void dumpVal(DataValue dv) char s[21]; char *src = dv.val.str.rep; if (!src) { @@ -435,7 +435,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c { static const char *opNames[] = { #define OP(name, fn) #name, -@@ -3187,15 +3340,15 @@ static void disasm(Inst *inst, int nInst +@@ -3188,15 +3341,15 @@ static void disasm(Inst *inst, int nInst }; int i, j; @@ -455,7 +455,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (sym->value.tag == STRING_TAG && strncmp(sym->name, "string #", 8) == 0) { dumpVal(sym->value); -@@ -3203,29 +3356,29 @@ static void disasm(Inst *inst, int nInst +@@ -3204,29 +3357,29 @@ static void disasm(Inst *inst, int nInst ++i; } else if (j == OP_PUSH_IMMED) { @@ -491,7 +491,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c inst[i+1].sym->name, inst[i+2].sym->name, inst[i+3].value, &inst[i+3] + inst[i+3].value); -@@ -3233,68 +3386,182 @@ static void disasm(Inst *inst, int nInst +@@ -3234,68 +3387,182 @@ static void disasm(Inst *inst, int nInst } else if (j == OP_ARRAY_REF || j == OP_ARRAY_DELETE || j == OP_ARRAY_ASSIGN) { diff --git a/MultipleAssignment-redux.patch b/MultipleAssignment-redux.patch index ddd46c1..9b8886b 100644 --- a/MultipleAssignment-redux.patch +++ b/MultipleAssignment-redux.patch @@ -39,7 +39,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** if left and right arguments are arrays, then the result is a new array ** in which all the keys from both the right and left are copied ** the values from the right array are used in the result array when the -@@ -4538,6 +4562,12 @@ static void disasmInternal(Inst *inst, i +@@ -4536,6 +4560,12 @@ static void disasmInternal(Inst *inst, i ++i; break; diff --git a/SUBR_TAG.patch b/SUBR_TAG.patch index ad73159..0fb2443 100644 --- a/SUBR_TAG.patch +++ b/SUBR_TAG.patch @@ -91,7 +91,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* ** If the subroutine is built-in, call the built-in routine */ -@@ -3893,6 +3914,9 @@ static int typeOfOut(void) +@@ -3891,6 +3912,9 @@ static int typeOfOut(void) case ARRAY_TAG: retVal.val.str.rep = PERM_ALLOC_STR("ARRAY"); break; @@ -101,7 +101,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } retVal.val.str.len = strlen(retVal.val.str.rep); -@@ -4154,6 +4178,8 @@ static const char *tagToStr(enum typeTag +@@ -4152,6 +4176,8 @@ static const char *tagToStr(enum typeTag return "string"; case ARRAY_TAG: return "array"; @@ -110,7 +110,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c case NO_TAG: default: return "no value"; -@@ -4280,6 +4306,9 @@ static void dumpVal(DataValue dv) +@@ -4278,6 +4304,9 @@ static void dumpVal(DataValue dv) printd("<%s %u:%8p>", tagToStr(ARRAY_TAG), ArraySize(&dv), dv.val.arrayPtr); break; diff --git a/abstract-access-to-FrameP.patch b/abstract-access-to-FrameP.patch index c9dbcc3..d1b6f1a 100644 --- a/abstract-access-to-FrameP.patch +++ b/abstract-access-to-FrameP.patch @@ -127,7 +127,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* return value is on the stack */ if (valOnStack) { -@@ -3603,7 +3614,7 @@ static int beginArrayIter(void) +@@ -3601,7 +3612,7 @@ static int beginArrayIter(void) POP(arrayVal); if (iterator->type == LOCAL_SYM) { @@ -136,7 +136,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { return(execError("bad temporary iterator: %s", iterator->name)); -@@ -3666,7 +3677,7 @@ static int arrayIter(void) +@@ -3664,7 +3675,7 @@ static int arrayIter(void) GET_BRANCH(branchAddr); if (keySym->type == LOCAL_SYM) { @@ -145,7 +145,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (keySym->type == GLOBAL_SYM) { keyValPtr = &(keySym->value); -@@ -3678,7 +3689,7 @@ static int arrayIter(void) +@@ -3676,7 +3687,7 @@ static int arrayIter(void) if (withVal) { if (valSym->type == LOCAL_SYM) { @@ -154,7 +154,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (valSym->type == GLOBAL_SYM) { valPtr = &(valSym->value); -@@ -3690,7 +3701,7 @@ static int arrayIter(void) +@@ -3688,7 +3699,7 @@ static int arrayIter(void) } if (iterator->type == LOCAL_SYM) { @@ -163,7 +163,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { return(execError("bad temporary iterator: %s", iterator->name)); -@@ -3739,7 +3750,7 @@ static int beginArrayIterArray(void) +@@ -3737,7 +3748,7 @@ static int beginArrayIterArray(void) PEEK_INT(nDims, 0); if (iterator->type == LOCAL_SYM) { @@ -172,7 +172,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { return(execError("bad temporary iterator: %s", iterator->name)); -@@ -3846,7 +3857,7 @@ static int arrayIterArray(void) +@@ -3844,7 +3855,7 @@ static int arrayIterArray(void) PEEK_INT(nDims, 0); if (keyArraySym->type == LOCAL_SYM) { @@ -181,7 +181,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (keyArraySym->type == GLOBAL_SYM) { keyArrayPtr = &(keyArraySym->value); -@@ -3859,7 +3870,7 @@ static int arrayIterArray(void) +@@ -3857,7 +3868,7 @@ static int arrayIterArray(void) if (withVal) { if (valSym->type == LOCAL_SYM) { @@ -190,7 +190,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (valSym->type == GLOBAL_SYM) { valPtr = &valSym->value; -@@ -3871,7 +3882,7 @@ static int arrayIterArray(void) +@@ -3869,7 +3880,7 @@ static int arrayIterArray(void) } if (iterator->type == LOCAL_SYM) { diff --git a/abstract-access-to-PC.patch b/abstract-access-to-PC.patch index 82835db..d20624c 100644 --- a/abstract-access-to-PC.patch +++ b/abstract-access-to-PC.patch @@ -241,7 +241,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -3387,8 +3405,7 @@ static int arrayRef(void) +@@ -3385,8 +3403,7 @@ static int arrayRef(void) char *keyString = NULL; int nDim; @@ -251,7 +251,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DISASM_RT(PC-2, 2); STACKDUMP(nDim+1, 3); -@@ -3438,8 +3455,7 @@ static int arrayAssign(void) +@@ -3436,8 +3453,7 @@ static int arrayAssign(void) int errNum; int nDim; @@ -261,7 +261,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DISASM_RT(PC-2, 1); STACKDUMP(nDim+2, 3); -@@ -3491,10 +3507,8 @@ static int arrayRefAndAssignSetup(void) +@@ -3489,10 +3505,8 @@ static int arrayRefAndAssignSetup(void) char *keyString = NULL; int binaryOp, nDim; @@ -274,7 +274,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DISASM_RT(PC-3, 3); STACKDUMP(nDim + (binaryOp ? 2 : 1), 3); -@@ -3550,8 +3564,7 @@ static int beginArrayIter(void) +@@ -3548,8 +3562,7 @@ static int beginArrayIter(void) DISASM_RT(PC-1, 2); STACKDUMP(1, 3); @@ -284,7 +284,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c POP(arrayVal); -@@ -3610,18 +3623,13 @@ static int arrayIter(void) +@@ -3608,18 +3621,13 @@ static int arrayIter(void) DISASM_RT(PC-1, 4); STACKDUMP(0, 4); @@ -308,7 +308,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (keySym->type == LOCAL_SYM) { keyValPtr = &FP_GET_SYM_VAL(FrameP, keySym); -@@ -3670,7 +3678,7 @@ static int arrayIter(void) +@@ -3668,7 +3676,7 @@ static int arrayIter(void) iteratorValPtr->val.arrayPtr = arrayIterateNext(thisEntry); } else { @@ -317,7 +317,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } return(STAT_OK); } -@@ -3691,8 +3699,7 @@ static int beginArrayIterArray(void) +@@ -3689,8 +3697,7 @@ static int beginArrayIterArray(void) DISASM_RT(PC-1, 2); STACKDUMP(2, 3); @@ -327,7 +327,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c POP(arrayVal); PEEK_INT(nDims, 0); -@@ -3794,23 +3801,15 @@ static int arrayIterArray(void) +@@ -3792,23 +3799,15 @@ static int arrayIterArray(void) DISASM_RT(PC-1, 4); STACKDUMP(1, 4); @@ -357,7 +357,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (keyArraySym->type == LOCAL_SYM) { keyArrayPtr = &FP_GET_SYM_VAL(FrameP, keyArraySym); -@@ -3877,7 +3876,7 @@ static int arrayIterArray(void) +@@ -3875,7 +3874,7 @@ static int arrayIterArray(void) iteratorValPtr->val.arrayPtr = thisEntry; if (!keyFound && (!thisEntry || thisEntry->nodePtrs.color == -1)) { @@ -366,7 +366,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } return STAT_OK; -@@ -3945,8 +3944,7 @@ static int deleteArrayElement(void) +@@ -3943,8 +3942,7 @@ static int deleteArrayElement(void) char *keyString = NULL; int nDim; @@ -376,7 +376,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DISASM_RT(PC-2, 2); STACKDUMP(nDim + 1, 3); -@@ -4019,10 +4017,7 @@ static int typeOfOut(void) +@@ -4017,10 +4015,7 @@ static int typeOfOut(void) } retVal.val.str.len = strlen(retVal.val.str.rep); diff --git a/anonArrayNamedArgs7.diff b/anonArrayNamedArgs7.diff index 978d89a..b09a2d7 100644 --- a/anonArrayNamedArgs7.diff +++ b/anonArrayNamedArgs7.diff @@ -756,7 +756,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -3377,7 +3673,14 @@ static void disasmInternal(Inst *inst, i +@@ -3378,7 +3674,14 @@ static void disasmInternal(Inst *inst, i ++i; } else if (j == OP_SUBR_CALL) { @@ -772,7 +772,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c i += 2; } else if (j == OP_BEGIN_ARRAY_ITER) { -@@ -3391,8 +3694,12 @@ static void disasmInternal(Inst *inst, i +@@ -3392,8 +3695,12 @@ static void disasmInternal(Inst *inst, i inst[i+3].value, &inst[i+3] + inst[i+3].value); i += 3; } @@ -787,7 +787,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c printd("nDim=%d", inst[i+1].value); ++i; } -@@ -3486,13 +3793,13 @@ static void stackdumpframe(DataValue *ar +@@ -3487,13 +3794,13 @@ static void stackdumpframe(DataValue *ar printd("%4.4s", leadIn); printd("%8p%c", dv, topMark); switch (offset) { diff --git a/array-key-array-iterator.patch b/array-key-array-iterator.patch index a7ddf71..fb151aa 100644 --- a/array-key-array-iterator.patch +++ b/array-key-array-iterator.patch @@ -55,7 +55,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** copy the top value of the stack ** Before: TheStack-> value, next, ... ** After: TheStack-> value, value, next, ... -@@ -3515,6 +3535,214 @@ static int arrayIter(void) +@@ -3512,6 +3532,214 @@ static int arrayIter(void) } /* @@ -270,7 +270,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** determine if a key or keys exists in an array ** if the left argument is a string or integer a single check is performed ** if the key exists, 1 is pushed onto the stack, otherwise 0 -@@ -4011,7 +4239,8 @@ static void disasmInternal(Inst *inst, i +@@ -4012,7 +4240,8 @@ static void disasmInternal(Inst *inst, i printd(" %s args[] (?)", inst[i+1].sym->name); ++i; } @@ -280,7 +280,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c printd(" %s in", inst[i+1].sym->name); ++i; } -@@ -4036,6 +4265,27 @@ static void disasmInternal(Inst *inst, i +@@ -4037,6 +4266,27 @@ static void disasmInternal(Inst *inst, i i += 5; } } diff --git a/array-next-num-index.patch b/array-next-num-index.patch index c76d028..f143be3 100644 --- a/array-next-num-index.patch +++ b/array-next-num-index.patch @@ -22,7 +22,7 @@ assigns expr to the array at position arr[@]. diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -3231,6 +3231,27 @@ SparseArrayEntry *arrayIterateNext(Spars +@@ -3228,6 +3228,27 @@ SparseArrayEntry *arrayIterateNext(Spars return(nextPos); } @@ -50,7 +50,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* ** evaluate an array element and push the result onto the stack ** -@@ -3884,6 +3905,76 @@ static int typeOfOut(void) +@@ -3881,6 +3902,76 @@ static int typeOfOut(void) } /* diff --git a/arrayReplacesArglist-redux.patch b/arrayReplacesArglist-redux.patch index 0d22af2..56b6597 100644 --- a/arrayReplacesArglist-redux.patch +++ b/arrayReplacesArglist-redux.patch @@ -196,7 +196,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** This should never be executed, returnVal checks for the presence of this ** instruction at the PC to decide whether to push the function's return ** value, then skips over it without executing. -@@ -4326,9 +4327,16 @@ static void disasmInternal(Inst *inst, i +@@ -4327,9 +4328,16 @@ static void disasmInternal(Inst *inst, i } i += 2; } diff --git a/arrayReplacesArglist5.diff b/arrayReplacesArglist5.diff index 44ae338..1dc3e42 100644 --- a/arrayReplacesArglist5.diff +++ b/arrayReplacesArglist5.diff @@ -248,7 +248,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** This should never be executed, returnVal checks for the presence of this ** instruction at the PC to decide whether to push the function's return ** value, then skips over it without executing. -@@ -3745,6 +3853,10 @@ static void disasmInternal(Inst *inst, i +@@ -3746,6 +3854,10 @@ static void disasmInternal(Inst *inst, i } i += 2; } diff --git a/aryiter-on-stack.patch b/aryiter-on-stack.patch index 456e89d..4c8f2cd 100644 --- a/aryiter-on-stack.patch +++ b/aryiter-on-stack.patch @@ -33,7 +33,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** Lookup a constant string by its value. This allows reuse of string ** constants and fixing a leak in the interpreter. */ -@@ -3576,10 +3558,10 @@ static int arrayRefAndAssignSetup(void) +@@ -3574,10 +3556,10 @@ static int arrayRefAndAssignSetup(void) /* ** setup symbol values for array iteration in interpreter ** @@ -47,7 +47,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** Where: ** iter is a symbol which gives the position of the iterator value in ** the stack frame -@@ -3587,30 +3569,24 @@ static int arrayRefAndAssignSetup(void) +@@ -3585,30 +3567,24 @@ static int arrayRefAndAssignSetup(void) */ static int beginArrayIter(void) { @@ -85,7 +85,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -3620,10 +3596,10 @@ static int beginArrayIter(void) +@@ -3618,10 +3594,10 @@ static int beginArrayIter(void) ** this allows iterators to progress even if you delete any node in the array ** except the item just after the current key ** @@ -100,7 +100,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** Where: ** iter is a symbol which gives the position of the iterator value in ** the stack frame (set up by OP_BEGIN_ARRAY_ITER); that value refers -@@ -3640,10 +3616,9 @@ static int beginArrayIter(void) +@@ -3638,10 +3614,9 @@ static int beginArrayIter(void) */ static int arrayIter(void) { @@ -112,7 +112,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DataValue *keyValPtr; DataValue *valPtr; SparseArrayEntry *thisEntry; -@@ -3651,16 +3626,17 @@ static int arrayIter(void) +@@ -3649,16 +3624,17 @@ static int arrayIter(void) int withVal; DISASM_RT(); @@ -132,7 +132,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (keySym->type == LOCAL_SYM) { keyValPtr = &FP_GET_SYM_VAL(FrameP, keySym); } -@@ -3685,14 +3661,7 @@ static int arrayIter(void) +@@ -3683,14 +3659,7 @@ static int arrayIter(void) valPtr->tag = NO_TAG; } @@ -148,7 +148,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (thisEntry && thisEntry->nodePtrs.color != -1) { /* set key */ keyValPtr->tag = STRING_TAG; -@@ -3705,52 +3674,48 @@ static int arrayIter(void) +@@ -3703,52 +3672,48 @@ static int arrayIter(void) } /* advance iterator */ @@ -214,7 +214,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -3809,17 +3774,16 @@ static Boolean splitKeyIntoArray(const c +@@ -3807,17 +3772,16 @@ static Boolean splitKeyIntoArray(const c /* ** @@ -237,7 +237,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DataValue *keyArrayPtr; DataValue *valPtr; SparseArrayEntry *thisEntry; -@@ -3829,16 +3793,16 @@ static int arrayIterArray(void) +@@ -3827,16 +3791,16 @@ static int arrayIterArray(void) Boolean keyFound = False; DISASM_RT(); @@ -256,7 +256,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c PEEK_INT(nDims, 0); if (keyArraySym->type == LOCAL_SYM) { -@@ -3866,14 +3830,7 @@ static int arrayIterArray(void) +@@ -3864,14 +3828,7 @@ static int arrayIterArray(void) valPtr->tag = NO_TAG; } @@ -272,7 +272,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c while (thisEntry && thisEntry->nodePtrs.color != -1) { /* check if this is an nDims key, but only if requested */ -@@ -3903,12 +3860,14 @@ static int arrayIterArray(void) +@@ -3901,12 +3858,14 @@ static int arrayIterArray(void) thisEntry = arrayIterateNext(thisEntry); break; } @@ -288,7 +288,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -4608,39 +4567,26 @@ static void disasmInternal(Inst *inst, i +@@ -4606,39 +4565,26 @@ static void disasmInternal(Inst *inst, i } break; @@ -337,7 +337,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } break; -@@ -4648,27 +4594,22 @@ static void disasmInternal(Inst *inst, i +@@ -4646,27 +4592,22 @@ static void disasmInternal(Inst *inst, i CHECK_OPERANDS(1, IMMED_INST); if (!inst[i+1].val.immed) { /* without val */ diff --git a/core-typeof-syntax.patch b/core-typeof-syntax.patch index cdd639f..e8138a2 100644 --- a/core-typeof-syntax.patch +++ b/core-typeof-syntax.patch @@ -101,7 +101,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* NULL return PC indicates end of program */ -@@ -3576,6 +3575,55 @@ static int deleteArrayElement(void) +@@ -3573,6 +3572,55 @@ static int deleteArrayElement(void) return(STAT_OK); } diff --git a/drop-SUBR_TAG.patch b/drop-SUBR_TAG.patch index 2e1fdcb..8bca9f7 100644 --- a/drop-SUBR_TAG.patch +++ b/drop-SUBR_TAG.patch @@ -81,7 +81,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ret = OverlayRoutineFromSymbol(sym, nArgs, removeArgs); -@@ -4065,9 +4042,6 @@ static int typeOfOut(void) +@@ -4063,9 +4040,6 @@ static int typeOfOut(void) case ARRAY_TAG: retVal.val.str.rep = PERM_ALLOC_STR("ARRAY"); break; @@ -91,7 +91,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } retVal.val.str.len = strlen(retVal.val.str.rep); -@@ -4326,8 +4300,6 @@ static const char *tagToStr(enum typeTag +@@ -4324,8 +4298,6 @@ static const char *tagToStr(enum typeTag return "string"; case ARRAY_TAG: return "array"; @@ -100,7 +100,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c case NO_TAG: default: return "no value"; -@@ -4470,9 +4442,6 @@ static void dumpVal(DataValue dv) +@@ -4468,9 +4440,6 @@ static void dumpVal(DataValue dv) printd("<%s %u:%8p>", tagToStr(ARRAY_TAG), ArraySize(&dv), dv.val.arrayPtr); break; diff --git a/extend-for-key-in-array-syntax.patch b/extend-for-key-in-array-syntax.patch index d2d3dda..943f60d 100644 --- a/extend-for-key-in-array-syntax.patch +++ b/extend-for-key-in-array-syntax.patch @@ -16,7 +16,7 @@ Lets you iterate over the keys and the associated values from a array, like: diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -3371,9 +3371,9 @@ static int arrayRefAndAssignSetup(void) +@@ -3368,9 +3368,9 @@ static int arrayRefAndAssignSetup(void) /* ** setup symbol values for array iteration in interpreter ** @@ -28,7 +28,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** TheStack-> [next], ... ** Where: ** iter is a symbol which gives the position of the iterator value in -@@ -3411,21 +3411,23 @@ static int beginArrayIter(void) +@@ -3408,21 +3408,23 @@ static int beginArrayIter(void) } /* @@ -59,7 +59,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** endLoopBranch is the instruction offset to the instruction following the ** loop (measured from itself) ** arrayVal is the data value holding the array in question -@@ -3435,32 +3437,54 @@ static int beginArrayIter(void) +@@ -3432,32 +3434,54 @@ static int beginArrayIter(void) static int arrayIter(void) { Symbol *iterator; @@ -124,7 +124,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (iterator->type == LOCAL_SYM) { iteratorValPtr = &FP_GET_SYM_VAL(FrameP, iterator); -@@ -3471,10 +3495,17 @@ static int arrayIter(void) +@@ -3468,10 +3492,17 @@ static int arrayIter(void) thisEntry = iteratorValPtr->val.arrayPtr; if (thisEntry && thisEntry->nodePtrs.color != -1) { @@ -146,7 +146,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c iteratorValPtr->val.arrayPtr = arrayIterateNext(thisEntry); } else { -@@ -3985,11 +4016,25 @@ static void disasmInternal(Inst *inst, i +@@ -3986,11 +4017,25 @@ static void disasmInternal(Inst *inst, i ++i; } else if (j == OP_ARRAY_ITER) { diff --git a/global-RestartData.patch b/global-RestartData.patch index 4e58695..952d28b 100644 --- a/global-RestartData.patch +++ b/global-RestartData.patch @@ -443,7 +443,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* push returned value, if requsted */ PUSH_RET_VAL(retVal); -@@ -3661,7 +3627,7 @@ static int beginArrayIter(void) +@@ -3659,7 +3625,7 @@ static int beginArrayIter(void) POP(arrayVal); if (iterator->type == LOCAL_SYM) { @@ -452,7 +452,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { EXEC_ERROR("bad temporary iterator: %s", iterator->name); -@@ -3724,7 +3690,7 @@ static int arrayIter(void) +@@ -3722,7 +3688,7 @@ static int arrayIter(void) GET_BRANCH(branchAddr); if (keySym->type == LOCAL_SYM) { @@ -461,7 +461,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (keySym->type == GLOBAL_SYM) { keyValPtr = &(keySym->value); -@@ -3736,7 +3702,7 @@ static int arrayIter(void) +@@ -3734,7 +3700,7 @@ static int arrayIter(void) if (withVal) { if (valSym->type == LOCAL_SYM) { @@ -470,7 +470,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (valSym->type == GLOBAL_SYM) { valPtr = &(valSym->value); -@@ -3748,7 +3714,7 @@ static int arrayIter(void) +@@ -3746,7 +3712,7 @@ static int arrayIter(void) } if (iterator->type == LOCAL_SYM) { @@ -479,7 +479,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { EXEC_ERROR("bad temporary iterator: %s", iterator->name); -@@ -3797,7 +3763,7 @@ static int beginArrayIterArray(void) +@@ -3795,7 +3761,7 @@ static int beginArrayIterArray(void) PEEK_INT(nDims, 0); if (iterator->type == LOCAL_SYM) { @@ -488,7 +488,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { EXEC_ERROR("bad temporary iterator: %s", iterator->name); -@@ -3904,7 +3870,7 @@ static int arrayIterArray(void) +@@ -3902,7 +3868,7 @@ static int arrayIterArray(void) PEEK_INT(nDims, 0); if (keyArraySym->type == LOCAL_SYM) { @@ -497,7 +497,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (keyArraySym->type == GLOBAL_SYM) { keyArrayPtr = &(keyArraySym->value); -@@ -3917,7 +3883,7 @@ static int arrayIterArray(void) +@@ -3915,7 +3881,7 @@ static int arrayIterArray(void) if (withVal) { if (valSym->type == LOCAL_SYM) { @@ -506,7 +506,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (valSym->type == GLOBAL_SYM) { valPtr = &valSym->value; -@@ -3929,7 +3895,7 @@ static int arrayIterArray(void) +@@ -3927,7 +3893,7 @@ static int arrayIterArray(void) } if (iterator->type == LOCAL_SYM) { diff --git a/guaranty-order-for-numeric-keys.patch b/guaranty-order-for-numeric-keys.patch index f647189..5e3b9b1 100644 --- a/guaranty-order-for-numeric-keys.patch +++ b/guaranty-order-for-numeric-keys.patch @@ -1,5 +1,5 @@ From: Bert Wesarg -Subject: [PATCH] guaranty order for numeric array keys +Subject: [PATCH v2] guaranty order for numeric array keys Currently ther is no order guaranty for array keys in the for loops, this is for numeric keys a little amberressing. @@ -59,14 +59,17 @@ would be overridden by this: --- - source/interpret.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++-- +v2: + * replace strtol with a modifified StringToNum + + source/interpret.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++-- source/interpret.h | 1 - 2 files changed, 82 insertions(+), 3 deletions(-) + 2 files changed, 80 insertions(+), 3 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -2368,10 +2368,84 @@ static int arrayEntryCopyToNode(rbTreeNo +@@ -2368,10 +2368,82 @@ static int arrayEntryCopyToNode(rbTreeNo /* ** compare two array nodes returning an integer value similar to strcmp() @@ -90,8 +93,6 @@ diff --quilt old/source/interpret.c new/source/interpret.c + long dimb_len; + const char *dima_end = strstr(keya, ARRAY_DIM_SEP); + const char *dimb_end = strstr(keyb, ARRAY_DIM_SEP); -+ char *numa_end; -+ char *numb_end; + + if (!dima_end) { + dima_end = keya_end; @@ -152,7 +153,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -2910,7 +2984,7 @@ static int execError(const char *s1, con +@@ -2910,7 +2982,7 @@ static int execError(const char *s1, con return STAT_ERROR; } @@ -161,16 +162,16 @@ diff --quilt old/source/interpret.c new/source/interpret.c { const char *c = string; -@@ -2926,7 +3000,7 @@ int StringToNum(const char *string, int +@@ -2926,7 +2998,7 @@ int StringToNum(const char *string, int while (*c == ' ' || *c == '\t') { ++c; } - if (*c) { -+ if (end ? end == c : *c) { ++ if (end ? end != c : *c) { /* if everything went as expected, we should be at end, but we're not */ return False; } -@@ -2939,6 +3013,10 @@ int StringToNum(const char *string, int +@@ -2939,6 +3011,10 @@ int StringToNum(const char *string, int return True; } diff --git a/op-not-func-in-Inst.patch b/op-not-func-in-Inst.patch index 5b5873d..e0aabd8 100644 --- a/op-not-func-in-Inst.patch +++ b/op-not-func-in-Inst.patch @@ -69,7 +69,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (valOnStack) { PUSH(retVal); } else { -@@ -3990,7 +3998,7 @@ static int typeOfOut(void) +@@ -3988,7 +3996,7 @@ static int typeOfOut(void) } retVal.val.str.len = strlen(retVal.val.str.rep); @@ -78,7 +78,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c PUSH(retVal); PC++; } -@@ -4402,46 +4410,57 @@ static void disasmInternal(Inst *inst, i +@@ -4400,46 +4408,57 @@ static void disasmInternal(Inst *inst, i #include "ops.h" #undef OP }; @@ -166,7 +166,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c int args = inst[i+2].value; printd(" %s", inst[i+1].sym->name); if (args < 0) { -@@ -4452,7 +4471,9 @@ static void disasmInternal(Inst *inst, i +@@ -4450,7 +4469,9 @@ static void disasmInternal(Inst *inst, i } i += 2; } @@ -177,7 +177,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c int args = inst[i+2].value; printd(" %s", inst[i+1].sym->name); if (args < 0) { -@@ -4463,81 +4484,90 @@ static void disasmInternal(Inst *inst, i +@@ -4461,81 +4482,90 @@ static void disasmInternal(Inst *inst, i } i += 2; } diff --git a/remove-args-from-DISASM_RT.patch b/remove-args-from-DISASM_RT.patch index 3231cd2..12e9442 100644 --- a/remove-args-from-DISASM_RT.patch +++ b/remove-args-from-DISASM_RT.patch @@ -329,7 +329,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(0, 3); GET_BRANCH(addr); -@@ -3486,9 +3490,10 @@ static int arrayRef(void) +@@ -3484,9 +3488,10 @@ static int arrayRef(void) char *keyString = NULL; int nDim; @@ -341,7 +341,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(nDim+1, 3); if (nDim > 0) { -@@ -3536,9 +3541,10 @@ static int arrayAssign(void) +@@ -3534,9 +3539,10 @@ static int arrayAssign(void) int errNum; int nDim; @@ -353,7 +353,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(nDim+2, 3); if (nDim > 0) { -@@ -3588,10 +3594,11 @@ static int arrayRefAndAssignSetup(void) +@@ -3586,10 +3592,11 @@ static int arrayRefAndAssignSetup(void) char *keyString = NULL; int binaryOp, nDim; @@ -366,7 +366,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(nDim + (binaryOp ? 2 : 1), 3); if (binaryOp) { -@@ -3642,7 +3649,7 @@ static int beginArrayIter(void) +@@ -3640,7 +3647,7 @@ static int beginArrayIter(void) DataValue *iteratorValPtr; DataValue arrayVal; @@ -375,7 +375,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(1, 3); GET_SYM(iterator); -@@ -3701,7 +3708,7 @@ static int arrayIter(void) +@@ -3699,7 +3706,7 @@ static int arrayIter(void) Inst *branchAddr; int withVal; @@ -384,7 +384,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(0, 4); GET_IMMED(withVal); -@@ -3777,7 +3784,7 @@ static int beginArrayIterArray(void) +@@ -3775,7 +3782,7 @@ static int beginArrayIterArray(void) DataValue arrayVal; int nDims; @@ -393,7 +393,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(2, 3); GET_SYM(iterator); -@@ -3879,7 +3886,7 @@ static int arrayIterArray(void) +@@ -3877,7 +3884,7 @@ static int arrayIterArray(void) int nDims, d; Boolean keyFound = False; @@ -402,7 +402,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(1, 4); GET_IMMED(withVal); -@@ -3981,7 +3988,7 @@ static int inArray(void) +@@ -3979,7 +3986,7 @@ static int inArray(void) char *keyStr; int inResult = 0; @@ -411,7 +411,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(2, 3); POP(theArray); -@@ -4025,9 +4032,10 @@ static int deleteArrayElement(void) +@@ -4023,9 +4030,10 @@ static int deleteArrayElement(void) char *keyString = NULL; int nDim; @@ -423,7 +423,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(nDim + 1, 3); if (nDim > 0) { -@@ -4118,7 +4126,7 @@ static int arrayAssignNext(void) +@@ -4116,7 +4124,7 @@ static int arrayAssignNext(void) DataValue srcValue, dstArray; int errNum; @@ -432,7 +432,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c STACKDUMP(2, 3); POP(srcValue); -@@ -4160,7 +4168,7 @@ static int arrayNextNumIdx(void) +@@ -4158,7 +4166,7 @@ static int arrayNextNumIdx(void) DataValue srcArray; SparseArrayEntry *iter; diff --git a/stringToNum.diff b/stringToNum.diff index 010506b..c3245a8 100644 --- a/stringToNum.diff +++ b/stringToNum.diff @@ -11,7 +11,7 @@ It seems a shame to scan a string twice, as the older version does. diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -4088,33 +4088,56 @@ static int execError(const char *s1, con +@@ -4086,33 +4086,56 @@ static int execError(const char *s1, con return STAT_ERROR; } @@ -65,7 +65,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c + if (number) { + *number = sign * n; } - if (end ? end == c : *c) { + if (end ? end != c : *c) { /* if everything went as expected, we should be at end, but we're not */ return False; } diff --git a/symbol-lookup.patch b/symbol-lookup.patch index 5ee4fcb..087749e 100644 --- a/symbol-lookup.patch +++ b/symbol-lookup.patch @@ -583,7 +583,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -3629,35 +3533,25 @@ static int arrayIter(void) +@@ -3627,35 +3531,25 @@ static int arrayIter(void) STACKDUMP(1, 4); GET_IMMED(withVal); @@ -625,7 +625,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c valPtr->tag = NO_TAG; } -@@ -3796,37 +3690,27 @@ static int arrayIterArray(void) +@@ -3794,37 +3688,27 @@ static int arrayIterArray(void) STACKDUMP(2, 4); GET_IMMED(withVal); @@ -669,7 +669,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c valPtr->tag = NO_TAG; } -@@ -4094,6 +3978,108 @@ static int errCheck(const char *s) +@@ -4092,6 +3976,108 @@ static int errCheck(const char *s) } /* @@ -778,7 +778,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** build a stack dump string, reallocating s as necessary. */ static char *stackDumpStr(DataValue *fp, const char *msg, char **s, int *pLen) -@@ -4131,7 +4117,7 @@ static char *stackDumpStr(DataValue *fp, +@@ -4129,7 +4115,7 @@ static char *stackDumpStr(DataValue *fp, #endif if (*pLen < len) { @@ -787,7 +787,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c *pLen = len; } /* now copy */ -@@ -4272,6 +4258,8 @@ static const char *instTypeToStr(enum in +@@ -4270,6 +4256,8 @@ static const char *instTypeToStr(enum in return "operation"; case IMMED_INST: return "immediate"; @@ -796,7 +796,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c case BRANCH_INST: return "branch"; case SYM_INST: -@@ -4354,6 +4342,41 @@ int outPrintd() +@@ -4352,6 +4340,41 @@ int outPrintd() #endif /* #ifdef DEBUG_DISASSEMBLER */ #ifdef DEBUG_DISASSEMBLER /* dumping values in disassembly or stack dump */ @@ -838,7 +838,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c static void dumpVal(DataValue dv) { printd(" "); -@@ -4370,30 +4393,11 @@ static void dumpVal(DataValue dv) +@@ -4368,30 +4391,11 @@ static void dumpVal(DataValue dv) printd("<%s NULL>", tagToStr(STRING_TAG)); } else { @@ -874,7 +874,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } } break; -@@ -4456,13 +4460,23 @@ static void dumpInst(Inst *inst, const c +@@ -4454,13 +4458,23 @@ static void dumpInst(Inst *inst, const c printd(" <%s %d>", name, inst->val.immed); break; @@ -899,7 +899,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c break; default: -@@ -4509,10 +4523,6 @@ static void disasmInternal(Inst *inst, i +@@ -4507,10 +4521,6 @@ static void disasmInternal(Inst *inst, i case OP_ASSIGN: CHECK_OPERANDS(1, SYM_INST); dumpInst(&inst[i+1], NULL); @@ -910,7 +910,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ++i; break; -@@ -4522,6 +4532,12 @@ static void disasmInternal(Inst *inst, i +@@ -4520,6 +4530,12 @@ static void disasmInternal(Inst *inst, i ++i; break; @@ -923,7 +923,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c case OP_BRANCH: case OP_BRANCH_TRUE: case OP_BRANCH_FALSE: -@@ -4677,11 +4693,6 @@ static void stackdumpframe(DataValue *ar +@@ -4675,11 +4691,6 @@ static void stackdumpframe(DataValue *ar DataValue *endDv = (arg1 > outpt) ? arg1 : outpt; int nArgs = FP_GET_ARG_COUNT(fp); @@ -935,7 +935,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #ifdef DEBUG_STACK_HEADFIRST #else /* do caller's frame */ -@@ -4690,17 +4701,6 @@ static void stackdumpframe(DataValue *ar +@@ -4688,17 +4699,6 @@ static void stackdumpframe(DataValue *ar #endif /* #ifdef DEBUG_STACK_HEADFIRST */ /* do current frame */ @@ -953,7 +953,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* output instructions between endDv and sp - 1 inclusive */ #ifdef DEBUG_STACK_HEADFIRST -@@ -4711,7 +4711,6 @@ static void stackdumpframe(DataValue *ar +@@ -4709,7 +4709,6 @@ static void stackdumpframe(DataValue *ar #endif /* #ifdef DEBUG_STACK_HEADFIRST */ { const char *posFmt = "%-6s"; @@ -961,7 +961,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c char *pos = ""; char buffer[sizeof(STACK_DUMP_ARG_PREFIX) + TYPE_INT_STR_SIZE(int)]; -@@ -4735,10 +4734,6 @@ static void stackdumpframe(DataValue *ar +@@ -4733,10 +4732,6 @@ static void stackdumpframe(DataValue *ar sprintf(pos = buffer, STACK_DUMP_ARG_PREFIX "%d", offset + FP_TO_ARGS_DIST + nArgs + 1); } @@ -972,7 +972,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c else if (offset == 0) { pos = "FrameP"; } -@@ -4746,17 +4741,6 @@ static void stackdumpframe(DataValue *ar +@@ -4744,17 +4739,6 @@ static void stackdumpframe(DataValue *ar } printd(posFmt, pos); diff --git a/typed-Inst.patch b/typed-Inst.patch index c026a19..3c75b98 100644 --- a/typed-Inst.patch +++ b/typed-Inst.patch @@ -202,7 +202,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c PUSH(dv); \ PC++; \ } \ -@@ -4280,6 +4314,22 @@ static const char *tagToStr(enum typeTag +@@ -4278,6 +4312,22 @@ static const char *tagToStr(enum typeTag } } @@ -225,7 +225,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #ifdef DEBUG_DISASSEMBLER /* dumping values in disassembly or stack dump */ static char *printdBuffer = NULL; static int printdPos = 0; -@@ -4419,20 +4469,74 @@ static void dumpVal(DataValue dv) +@@ -4417,20 +4467,74 @@ static void dumpVal(DataValue dv) #endif /* #ifdef DEBUG_DISASSEMBLER */ #ifdef DEBUG_DISASSEMBLER /* For debugging code generation */ @@ -305,7 +305,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } } } -@@ -4440,25 +4544,33 @@ static void disasmInternal(Inst *inst, i +@@ -4438,25 +4542,33 @@ static void disasmInternal(Inst *inst, i for (i = 0; i < nInstr; ++i) { printd("Prog %8p", &inst[i]); @@ -347,7 +347,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ++i; break; -@@ -4466,37 +4578,42 @@ static void disasmInternal(Inst *inst, i +@@ -4464,37 +4576,42 @@ static void disasmInternal(Inst *inst, i case OP_BRANCH_TRUE: case OP_BRANCH_FALSE: case OP_BRANCH_NEVER: @@ -401,7 +401,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } i += 2; } -@@ -4504,50 +4621,64 @@ static void disasmInternal(Inst *inst, i +@@ -4502,50 +4619,64 @@ static void disasmInternal(Inst *inst, i case OP_BEGIN_ARRAY_ITER: case OP_BEGIN_ARRAY_ITER_ARRAY: @@ -491,7 +491,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c i += 5; } break; -@@ -4558,21 +4689,23 @@ static void disasmInternal(Inst *inst, i +@@ -4556,21 +4687,23 @@ static void disasmInternal(Inst *inst, i case OP_ANONARRAY_INDEX_VAL: case OP_NAMED_ARG1: case OP_NAMED_ARGN: @@ -522,7 +522,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c i += 2; break; -@@ -4582,7 +4715,7 @@ static void disasmInternal(Inst *inst, i +@@ -4580,7 +4713,7 @@ static void disasmInternal(Inst *inst, i break; default: -- 2.11.4.GIT