From 546bfc6246b2847613ca64bc674cdc69cdccc29d Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Wed, 22 Oct 2008 21:44:44 +0200 Subject: [PATCH] context in execError, define, CVS update global-RestartData.patch: * we need the right context for stackdump, so pass context around symbol-lookup.patch: * install symbol after parsing change-sym-types.patch: * adopt change from symbol-lookup.patch readonly-statement.patch: * remove 'readonly define ...' syntax B.W. --- Patch: !global-RestartData.patch Patch: !symbol-lookup.patch Patch: !change-sym-types.patch Patch: !readonly-statement.patch --- ColoredWinMenu-transient.patch | 2 +- ColoredWinMenu.diff | 2 +- CursorLine6.diff | 20 ++-- HairlineMargin9.diff | 28 +++--- MultipleAssignment-redux.patch | 6 +- PrevOpenIgnoreMask.patch | 2 +- Scrolltip.patch | 2 +- SmartCaseSearch.patch | 4 +- aryiter-on-stack.patch | 28 +++--- change-sym-types.patch | 60 ++++++------ dont-resize-window.patch | 2 +- global-AccumulatorData.patch | 2 +- global-RestartData.patch | 217 ++++++++++++++++++++++++++++++++++++----- handle_hardlink.patch | 2 +- key-grammar.patch | 20 ++-- langmoderegex.patch | 4 +- matching_patterns.patch | 16 +-- parseErrorLineNo.diff | 6 +- pushString.patch | 30 +++--- readonly-statement.patch | 37 ++----- remove-cast-warnings.patch | 8 +- remove_zero_sized_files.patch | 2 +- scrolltip-enable-opt.patch | 2 +- shell-in-help-output.patch | 2 +- symbol-lookup.patch | 105 +++++++++++--------- ternary-operator-GNU.patch | 14 +-- ternary-operator.patch | 8 +- 27 files changed, 396 insertions(+), 235 deletions(-) diff --git a/ColoredWinMenu-transient.patch b/ColoredWinMenu-transient.patch index 97a1ee3..abe126d 100644 --- a/ColoredWinMenu-transient.patch +++ b/ColoredWinMenu-transient.patch @@ -78,7 +78,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* setup language mode dependent info of user menus (to increase performance when switching between documents of different -@@ -2387,6 +2392,17 @@ void SetPrefBgMenuColorLength(const char +@@ -2386,6 +2391,17 @@ void SetPrefBgMenuColorLength(const char PrefData.bgMenuColorLength = strlen(string); } diff --git a/ColoredWinMenu.diff b/ColoredWinMenu.diff index 81cc96b..d356788 100644 --- a/ColoredWinMenu.diff +++ b/ColoredWinMenu.diff @@ -210,7 +210,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* setup language mode dependent info of user menus (to increase performance when switching between documents of different language modes) */ -@@ -2308,6 +2338,55 @@ Boolean GetPrefHonorSymlinks(void) +@@ -2307,6 +2337,55 @@ Boolean GetPrefHonorSymlinks(void) return PrefData.honorSymlinks; } diff --git a/CursorLine6.diff b/CursorLine6.diff index ba744db..dbb8f76 100644 --- a/CursorLine6.diff +++ b/CursorLine6.diff @@ -181,7 +181,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c }; static XrmOptionDescRec OpTable[] = { -@@ -2195,6 +2204,16 @@ void MarkPrefsChanged(void) +@@ -2194,6 +2203,16 @@ void MarkPrefsChanged(void) PrefsHaveChanged = True; } @@ -198,7 +198,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* ** Check if preferences have changed, and if so, ask the user if he wants ** to re-save. Returns False if user requests cancelation of Exit (or whatever -@@ -6074,6 +6093,7 @@ hiliteFg HILITE_FG_COLOR +@@ -6073,6 +6092,7 @@ hiliteFg HILITE_FG_COLOR hiliteBg HILITE_BG_COLOR lineNoFg LINENO_FG_COLOR cursorFg CURSOR_FG_COLOR @@ -206,7 +206,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c */ #define MARGIN_SPACING 10 -@@ -6137,6 +6157,13 @@ static void cursorFgModifiedCB(Widget w, +@@ -6136,6 +6156,13 @@ static void cursorFgModifiedCB(Widget w, showColorStatus(cd, cd->cursorFgW, cd->cursorFgErrW); } @@ -220,7 +220,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* * Helper functions for validating colors -@@ -6151,7 +6178,8 @@ static int verifyAllColors(colorDialog * +@@ -6150,7 +6177,8 @@ static int verifyAllColors(colorDialog * checkColorStatus(cd, cd->hiliteFgW) && checkColorStatus(cd, cd->hiliteBgW) && checkColorStatus(cd, cd->lineNoFgW) && @@ -230,7 +230,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } /* Returns True if the color is valid, False if it's not */ -@@ -6190,12 +6218,13 @@ static void updateColors(colorDialog *cd +@@ -6189,12 +6217,13 @@ static void updateColors(colorDialog *cd *hiliteFg = XmTextGetString(cd->hiliteFgW), *hiliteBg = XmTextGetString(cd->hiliteBgW), *lineNoFg = XmTextGetString(cd->lineNoFgW), @@ -246,7 +246,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } SetPrefColorName(TEXT_FG_COLOR , textFg ); -@@ -6206,6 +6235,7 @@ static void updateColors(colorDialog *cd +@@ -6205,6 +6234,7 @@ static void updateColors(colorDialog *cd SetPrefColorName(HILITE_BG_COLOR, hiliteBg); SetPrefColorName(LINENO_FG_COLOR, lineNoFg); SetPrefColorName(CURSOR_FG_COLOR, cursorFg); @@ -254,7 +254,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c XtFree(textFg); XtFree(textBg); -@@ -6215,6 +6245,7 @@ static void updateColors(colorDialog *cd +@@ -6214,6 +6244,7 @@ static void updateColors(colorDialog *cd XtFree(hiliteBg); XtFree(lineNoFg); XtFree(cursorFg); @@ -262,7 +262,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } -@@ -6384,6 +6415,20 @@ void ChooseColors(WindowInfo *window) +@@ -6383,6 +6414,20 @@ void ChooseColors(WindowInfo *window) topW = infoLbl; @@ -283,7 +283,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* The left column (foregrounds) of color entry groups */ tmpW = addColorGroup( form, "textFg", 'P', "Plain Text Foreground", &(cd->textFgW), &(cd->textFgErrW), topW, 1, 49, -@@ -6394,24 +6439,13 @@ void ChooseColors(WindowInfo *window) +@@ -6393,24 +6438,13 @@ void ChooseColors(WindowInfo *window) tmpW = addColorGroup( form, "hiliteFg", 'M', "Matching (..) Foreground", &(cd->hiliteFgW), &(cd->hiliteFgErrW), tmpW, 1, 49, hiliteFgModifiedCB, cd ); @@ -311,7 +311,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c tmpW = XtVaCreateManagedWidget("infoLbl", xmLabelGadgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, -@@ -6492,6 +6526,7 @@ void ChooseColors(WindowInfo *window) +@@ -6491,6 +6525,7 @@ void ChooseColors(WindowInfo *window) XmTextSetString(cd->hiliteBgW, GetPrefColorName(HILITE_BG_COLOR)); XmTextSetString(cd->lineNoFgW, GetPrefColorName(LINENO_FG_COLOR)); XmTextSetString(cd->cursorFgW, GetPrefColorName(CURSOR_FG_COLOR)); diff --git a/HairlineMargin9.diff b/HairlineMargin9.diff index ad25f07..7946034 100644 --- a/HairlineMargin9.diff +++ b/HairlineMargin9.diff @@ -176,7 +176,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* Module-global variables for shell selection dialog */ static int DoneWithShellSelDialog = False; -@@ -1569,6 +1582,16 @@ int GetPrefWrapMargin(void) +@@ -1568,6 +1581,16 @@ int GetPrefWrapMargin(void) return PrefData.wrapMargin; } @@ -193,7 +193,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c void SetPrefSearch(int searchType) { setIntPref(&PrefData.searchMethod, searchType); -@@ -2697,6 +2720,9 @@ void WrapMarginDialog(Widget parent, Win +@@ -2696,6 +2719,9 @@ void WrapMarginDialog(Widget parent, Win Arg selBoxArgs[2]; XmString s1; int margin; @@ -203,7 +203,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c XtSetArg(selBoxArgs[0], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); XtSetArg(selBoxArgs[1], XmNautoUnmanage, False); -@@ -2739,16 +2765,69 @@ void WrapMarginDialog(Widget parent, Win +@@ -2738,16 +2764,69 @@ void WrapMarginDialog(Widget parent, Win XmNbottomWidget, WrapText, NULL); XmStringFree(s1); @@ -275,7 +275,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* Handle mnemonic selection of buttons and focus to dialog */ AddDialogMnemonicHandler(form, FALSE); -@@ -2771,6 +2850,9 @@ static void wrapOKCB(Widget w, XtPointer +@@ -2770,6 +2849,9 @@ static void wrapOKCB(Widget w, XtPointer { int wrapAtWindow, margin, stat; WindowInfo *window = WrapDialogForWindow; @@ -285,7 +285,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* get the values that the user entered and make sure they're ok */ wrapAtWindow = XmToggleButtonGetState(WrapWindowToggle); -@@ -2790,6 +2872,14 @@ static void wrapOKCB(Widget w, XtPointer +@@ -2789,6 +2871,14 @@ static void wrapOKCB(Widget w, XtPointer } @@ -300,7 +300,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c #ifdef SGI_CUSTOM /* Ask the user about saving as a default preference */ if (WrapDialogForWindow != NULL) { -@@ -2801,20 +2891,25 @@ static void wrapOKCB(Widget w, XtPointer +@@ -2800,20 +2890,25 @@ static void wrapOKCB(Widget w, XtPointer } if (setDefault) { SetPrefWrapMargin(margin); @@ -328,7 +328,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } DoneWithWrapDialog = True; } -@@ -2830,6 +2925,8 @@ static void wrapWindowCB(Widget w, XtPoi +@@ -2829,6 +2924,8 @@ static void wrapWindowCB(Widget w, XtPoi XtSetSensitive(WrapTextLabel, !wrapAtWindow); XtSetSensitive(WrapText, !wrapAtWindow); @@ -337,7 +337,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } /* -@@ -6164,6 +6261,13 @@ static void cursorlineBgModifiedCB(Widge +@@ -6163,6 +6260,13 @@ static void cursorlineBgModifiedCB(Widge showColorStatus(cd, cd->cursorlineBgW, cd->cursorlineBgErrW); } @@ -351,7 +351,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* * Helper functions for validating colors -@@ -6179,7 +6283,8 @@ static int verifyAllColors(colorDialog * +@@ -6178,7 +6282,8 @@ static int verifyAllColors(colorDialog * checkColorStatus(cd, cd->hiliteBgW) && checkColorStatus(cd, cd->lineNoFgW) && checkColorStatus(cd, cd->cursorFgW) && @@ -361,7 +361,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } /* Returns True if the color is valid, False if it's not */ -@@ -6219,12 +6324,13 @@ static void updateColors(colorDialog *cd +@@ -6218,12 +6323,13 @@ static void updateColors(colorDialog *cd *hiliteBg = XmTextGetString(cd->hiliteBgW), *lineNoFg = XmTextGetString(cd->lineNoFgW), *cursorFg = XmTextGetString(cd->cursorFgW), @@ -377,7 +377,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } SetPrefColorName(TEXT_FG_COLOR , textFg ); -@@ -6236,6 +6342,7 @@ static void updateColors(colorDialog *cd +@@ -6235,6 +6341,7 @@ static void updateColors(colorDialog *cd SetPrefColorName(LINENO_FG_COLOR, lineNoFg); SetPrefColorName(CURSOR_FG_COLOR, cursorFg); SetPrefColorName(CURSORLINE_BG_COLOR, cursorlineBg); @@ -385,7 +385,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c XtFree(textFg); XtFree(textBg); -@@ -6246,6 +6353,7 @@ static void updateColors(colorDialog *cd +@@ -6245,6 +6352,7 @@ static void updateColors(colorDialog *cd XtFree(lineNoFg); XtFree(cursorFg); XtFree(cursorlineBg); @@ -393,7 +393,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } -@@ -6428,6 +6536,9 @@ void ChooseColors(WindowInfo *window) +@@ -6427,6 +6535,9 @@ void ChooseColors(WindowInfo *window) tmpW = addColorGroup( form, "cursorlineBg", 'r', "Cursorline Highlighting", &(cd->cursorlineBgW), &(cd->cursorlineBgErrW), tmpW, 51, 99, cursorlineBgModifiedCB, cd ); @@ -403,7 +403,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* The left column (foregrounds) of color entry groups */ tmpW = addColorGroup( form, "textFg", 'P', "Plain Text Foreground", -@@ -6527,6 +6638,7 @@ void ChooseColors(WindowInfo *window) +@@ -6526,6 +6637,7 @@ void ChooseColors(WindowInfo *window) XmTextSetString(cd->lineNoFgW, GetPrefColorName(LINENO_FG_COLOR)); XmTextSetString(cd->cursorFgW, GetPrefColorName(CURSOR_FG_COLOR)); XmTextSetString(cd->cursorlineBgW, GetPrefColorName(CURSORLINE_BG_COLOR)); diff --git a/MultipleAssignment-redux.patch b/MultipleAssignment-redux.patch index beb413a..fb96db7 100644 --- a/MultipleAssignment-redux.patch +++ b/MultipleAssignment-redux.patch @@ -9,7 +9,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -818,23 +818,6 @@ void SetMacroFocusWindow(WindowInfo *win +@@ -820,23 +820,6 @@ void SetMacroFocusWindow(WindowInfo *win } /* @@ -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. */ -@@ -2059,6 +2042,30 @@ static int dupStack(void) +@@ -2061,6 +2044,30 @@ static int dupStack(void) } /* @@ -64,7 +64,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 -@@ -4509,6 +4516,12 @@ static void disasmInternal(Inst *inst, i +@@ -4511,6 +4518,12 @@ static void disasmInternal(Inst *inst, i ++i; break; diff --git a/PrevOpenIgnoreMask.patch b/PrevOpenIgnoreMask.patch index 731233f..9283ed7 100644 --- a/PrevOpenIgnoreMask.patch +++ b/PrevOpenIgnoreMask.patch @@ -233,7 +233,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c {"bgMenuButton", "BGMenuButton" , PREF_STRING, "~Shift~Ctrl~Meta~Alt", PrefData.bgMenuBtn, (void *)sizeof(PrefData.bgMenuBtn), False}, -@@ -2157,6 +2161,11 @@ int GetPrefMaxPrevOpenFiles(void) +@@ -2156,6 +2160,11 @@ int GetPrefMaxPrevOpenFiles(void) return PrefData.maxPrevOpenFiles; } diff --git a/Scrolltip.patch b/Scrolltip.patch index 8d5e07f..1fc139b 100644 --- a/Scrolltip.patch +++ b/Scrolltip.patch @@ -525,7 +525,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c }; static XrmOptionDescRec OpTable[] = { -@@ -2239,6 +2242,12 @@ Boolean GetPrefShowCursorline(void) +@@ -2238,6 +2241,12 @@ Boolean GetPrefShowCursorline(void) return PrefData.showCursorline; } diff --git a/SmartCaseSearch.patch b/SmartCaseSearch.patch index ac73a4b..13f94e1 100644 --- a/SmartCaseSearch.patch +++ b/SmartCaseSearch.patch @@ -164,7 +164,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c NULL }; -@@ -2219,14 +2220,6 @@ int GetPrefTruncSubstitution(void) +@@ -2218,14 +2219,6 @@ int GetPrefTruncSubstitution(void) return PrefData.truncSubstitution; } @@ -179,7 +179,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c void SetPrefShowCursorline(Boolean value) { setIntPref(&PrefData.showCursorline, (int)value); -@@ -2238,6 +2231,14 @@ Boolean GetPrefShowCursorline(void) +@@ -2237,6 +2230,14 @@ Boolean GetPrefShowCursorline(void) } /* diff --git a/aryiter-on-stack.patch b/aryiter-on-stack.patch index 3634aca..c5c4a95 100644 --- a/aryiter-on-stack.patch +++ b/aryiter-on-stack.patch @@ -9,7 +9,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -835,24 +835,6 @@ Symbol *InstallMultiAssignExpr(void) +@@ -837,24 +837,6 @@ Symbol *InstallMultiAssignExpr(void) } /* @@ -34,7 +34,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. */ -@@ -3563,10 +3545,10 @@ static int arrayRefAndAssignSetup(void) +@@ -3565,10 +3547,10 @@ static int arrayRefAndAssignSetup(void) /* ** setup symbol values for array iteration in interpreter ** @@ -48,7 +48,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 -@@ -3574,30 +3556,24 @@ static int arrayRefAndAssignSetup(void) +@@ -3576,30 +3558,24 @@ static int arrayRefAndAssignSetup(void) */ static int beginArrayIter(void) { @@ -86,7 +86,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -3607,10 +3583,10 @@ static int beginArrayIter(void) +@@ -3609,10 +3585,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 ** @@ -101,7 +101,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 -@@ -3627,10 +3603,9 @@ static int beginArrayIter(void) +@@ -3629,10 +3605,9 @@ static int beginArrayIter(void) */ static int arrayIter(void) { @@ -113,7 +113,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DataValue *keyValPtr; DataValue *valPtr; SparseArrayEntry *thisEntry; -@@ -3638,16 +3613,17 @@ static int arrayIter(void) +@@ -3640,16 +3615,17 @@ static int arrayIter(void) int withVal; DISASM_RT(); @@ -133,7 +133,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (keySym->type == LOCAL_SYM) { keyValPtr = &FP_GET_SYM_VAL(FrameP, keySym); } -@@ -3672,14 +3648,7 @@ static int arrayIter(void) +@@ -3674,14 +3650,7 @@ static int arrayIter(void) valPtr->tag = NO_TAG; } @@ -149,7 +149,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (thisEntry && thisEntry->nodePtrs.color != -1) { /* set key */ keyValPtr->tag = STRING_TAG; -@@ -3692,52 +3661,48 @@ static int arrayIter(void) +@@ -3694,52 +3663,48 @@ static int arrayIter(void) } /* advance iterator */ @@ -215,7 +215,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -3796,17 +3761,16 @@ static Boolean splitKeyIntoArray(const c +@@ -3798,17 +3763,16 @@ static Boolean splitKeyIntoArray(const c /* ** @@ -238,7 +238,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DataValue *keyArrayPtr; DataValue *valPtr; SparseArrayEntry *thisEntry; -@@ -3816,16 +3780,16 @@ static int arrayIterArray(void) +@@ -3818,16 +3782,16 @@ static int arrayIterArray(void) Boolean keyFound = False; DISASM_RT(); @@ -257,7 +257,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c PEEK_INT(nDims, 0); if (keyArraySym->type == LOCAL_SYM) { -@@ -3853,14 +3817,7 @@ static int arrayIterArray(void) +@@ -3855,14 +3819,7 @@ static int arrayIterArray(void) valPtr->tag = NO_TAG; } @@ -273,7 +273,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 */ -@@ -3890,12 +3847,14 @@ static int arrayIterArray(void) +@@ -3892,12 +3849,14 @@ static int arrayIterArray(void) thisEntry = arrayIterateNext(thisEntry); break; } @@ -289,7 +289,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return STAT_OK; } -@@ -4595,39 +4554,26 @@ static void disasmInternal(Inst *inst, i +@@ -4597,39 +4556,26 @@ static void disasmInternal(Inst *inst, i } break; @@ -338,7 +338,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } break; -@@ -4635,27 +4581,22 @@ static void disasmInternal(Inst *inst, i +@@ -4637,27 +4583,22 @@ static void disasmInternal(Inst *inst, i CHECK_OPERANDS(1, IMMED_INST); if (!inst[i+1].val.immed) { /* without val */ diff --git a/change-sym-types.patch b/change-sym-types.patch index 0ab3628..b533eee 100644 --- a/change-sym-types.patch +++ b/change-sym-types.patch @@ -3,8 +3,8 @@ source/interpret.c | 120 +++++++++++++++++++++++++++++------------------------ source/interpret.h | 20 ++++++-- source/macro.c | 39 ++++++++++------- - source/parse.y | 13 +++-- - 4 files changed, 113 insertions(+), 79 deletions(-) + source/parse.y | 14 ++++-- + 4 files changed, 114 insertions(+), 79 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c @@ -54,7 +54,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -828,8 +832,8 @@ static Symbol *lookupSymbol(Symbol *syml +@@ -830,8 +834,8 @@ static Symbol *lookupSymbol(Symbol *syml /* ** find a symbol in the symbol table ** @@ -65,7 +65,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c */ Symbol *LookupSymbol(const char *name, int create) { -@@ -853,8 +857,8 @@ Symbol *LookupSymbol(const char *name, i +@@ -855,8 +859,8 @@ Symbol *LookupSymbol(const char *name, i if (create) { DataValue noValue = {NO_TAG, {0}}; @@ -76,7 +76,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } return s; -@@ -863,16 +867,17 @@ Symbol *LookupSymbol(const char *name, i +@@ -865,16 +869,17 @@ Symbol *LookupSymbol(const char *name, i /* ** install symbol name in symbol table */ @@ -97,7 +97,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (Interpreter) { s->next = LocalSymList; LocalSymList = s; -@@ -1441,36 +1446,49 @@ static void addToGlobalSymTab(Symbol *sy +@@ -1443,36 +1448,49 @@ static void addToGlobalSymTab(Symbol *sy static int pushSymVal(void) { Symbol *s; @@ -167,7 +167,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (symVal.tag == NO_TAG && !inTypeOfMode) { EXEC_ERROR("variable not set: %s", s->name); } -@@ -1602,7 +1620,7 @@ static int pushArraySymVal(void) +@@ -1604,7 +1622,7 @@ static int pushArraySymVal(void) GET_SYM(sym, True); GET_IMMED(initEmpty); @@ -176,7 +176,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c EXEC_ERROR("assigning to non-lvalue array or non-array: %s", sym->name); } dataPtr = &sym->value; -@@ -1909,16 +1927,8 @@ static int assign(void) +@@ -1911,16 +1929,8 @@ static int assign(void) GET_SYM(sym, True); @@ -195,7 +195,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } dataPtr = &sym->value; -@@ -2636,7 +2646,7 @@ static int callSubroutineFromSymbol(Symb +@@ -2638,7 +2648,7 @@ static int callSubroutineFromSymbol(Symb /* ** If the subroutine is built-in, call the built-in routine */ @@ -204,7 +204,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DataValue result; char *errMsg; -@@ -2661,7 +2671,7 @@ static int callSubroutineFromSymbol(Symb +@@ -2663,7 +2673,7 @@ static int callSubroutineFromSymbol(Symb ** stack for local variables (and initialize them), on top of the argument ** values which are already there. */ @@ -213,7 +213,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c prog = sym->value.val.prog; prog->refcount++; /* -nArgs means 'arguments are on stack' */ -@@ -2671,7 +2681,7 @@ static int callSubroutineFromSymbol(Symb +@@ -2673,7 +2683,7 @@ static int callSubroutineFromSymbol(Symb /* ** Call an action routine */ @@ -222,7 +222,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c String *argList; Cardinal numArgs = nArgs; XKeyEvent key_event; -@@ -2715,7 +2725,7 @@ static int callSubroutineFromSymbol(Symb +@@ -2717,7 +2727,7 @@ static int callSubroutineFromSymbol(Symb } /* Calling a non subroutine symbol */ @@ -231,7 +231,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -2878,9 +2888,9 @@ int OverlayRoutineFromProg(Program *prog +@@ -2880,9 +2890,9 @@ int OverlayRoutineFromProg(Program *prog { Symbol sym; @@ -243,7 +243,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c sym.value.val.prog = prog; sym.next = NULL; -@@ -3591,14 +3601,14 @@ static int arrayIter(void) +@@ -3593,14 +3603,14 @@ static int arrayIter(void) POP(iterator); @@ -260,7 +260,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c EXEC_ERROR("can't assign to: %s", valSym->name); } valPtr = &valSym->value; -@@ -3749,7 +3759,7 @@ static int arrayIterArray(void) +@@ -3751,7 +3761,7 @@ static int arrayIterArray(void) POP(iterator); PEEK_INT(nDims, 0); @@ -269,7 +269,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c EXEC_ERROR("can't assign to: %s", keyArraySym->name); } keyArrayPtr = &keyArraySym->value; -@@ -3757,7 +3767,7 @@ static int arrayIterArray(void) +@@ -3759,7 +3769,7 @@ static int arrayIterArray(void) keyArrayPtr->val.arrayPtr = NULL; if (withVal) { @@ -278,7 +278,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c EXEC_ERROR("can't assign to: %s", valSym->name); } valPtr = &valSym->value; -@@ -3935,6 +3945,8 @@ static int typeOfOut(void) +@@ -3937,6 +3947,8 @@ static int typeOfOut(void) case ARRAY_TAG: retVal.val.str.rep = PERM_ALLOC_STR("ARRAY"); break; @@ -438,28 +438,30 @@ diff --quilt old/source/macro.c new/source/macro.c diff --quilt old/source/parse.y new/source/parse.y --- old/source/parse.y +++ new/source/parse.y -@@ -202,15 +202,20 @@ definekw: DEFINE { - definesym: SYMBOL { - $$.sym = LookupSymbol($1, False); - if ($$.sym) { -- if ($$.sym->type != MACRO_FUNCTION_SYM) { +@@ -207,16 +207,22 @@ define: definekw blank definesym bla + prog = FinishCreatingProgram($3); + sym = LookupSymbol(prog->name, False); + if (sym) { +- if (sym->type != MACRO_FUNCTION_SYM) { ++ if (sym->attr & READONLY_ATTR) { + FreeProgram(prog); - yyerror("try to override built-in subroutine"); YYERROR; -+ if ($$.sym->attr & READONLY_ATTR) { + yyerror("try to re-define read-only symbol"); + YYERROR; + } -+ else if ($$.sym->value.tag != MACRO_SUBR_TAG) { ++ else if (sym->value.tag != MACRO_SUBR_TAG) { ++ FreeProgram(prog); + yyerror("try to override built-in subroutine"); + YYERROR; } + FreeProgram(sym->value.val.prog); } else { DataValue subrPtr; - subrPtr.tag = NO_TAG; +- sym = InstallSymbol(prog->name, MACRO_FUNCTION_SYM, + subrPtr.tag = MACRO_SUBR_TAG; - subrPtr.val.prog = NULL; -- $$.sym = InstallSymbol($1, MACRO_FUNCTION_SYM, subrPtr); -+ $$.sym = InstallSymbol($1, GLOBAL_SCOPE, NO_ATTR, subrPtr); ++ sym = InstallSymbol(prog->name, GLOBAL_SCOPE, NO_ATTR, + subrPtr); } - $$.acc = BeginCreatingProgram($$.sym->name); - } + sym->value.val.prog = prog; diff --git a/dont-resize-window.patch b/dont-resize-window.patch index 6012b3d..26b8bbc 100644 --- a/dont-resize-window.patch +++ b/dont-resize-window.patch @@ -27,7 +27,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c }; static XrmOptionDescRec OpTable[] = { -@@ -2449,6 +2452,11 @@ int GetPrefZeroSizedMode(void) +@@ -2448,6 +2451,11 @@ int GetPrefZeroSizedMode(void) return PrefData.zeroSizedMode; } diff --git a/global-AccumulatorData.patch b/global-AccumulatorData.patch index f32a51d..8629c03 100644 --- a/global-AccumulatorData.patch +++ b/global-AccumulatorData.patch @@ -187,7 +187,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return newProg; } -@@ -925,9 +917,11 @@ Symbol *LookupSymbol(const char *name) +@@ -927,9 +919,11 @@ Symbol *LookupSymbol(const char *name) hash = hashName(name); /* search in local symbols */ diff --git a/global-RestartData.patch b/global-RestartData.patch index 1a8d9f8..b3cbce3 100644 --- a/global-RestartData.patch +++ b/global-RestartData.patch @@ -1,8 +1,8 @@ --- - source/interpret.c | 117 ++++++++++++++++++++--------------------------------- - source/interpret.h | 3 - - 2 files changed, 47 insertions(+), 73 deletions(-) + source/interpret.c | 173 ++++++++++++++++++++++------------------------------- + source/interpret.h | 3 + 2 files changed, 76 insertions(+), 100 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c @@ -17,6 +17,28 @@ diff --quilt old/source/interpret.c new/source/interpret.c #define OP(name, fn) static int fn(void); #include "ops.h" +@@ -100,7 +99,7 @@ static void addToGlobalSymTab(Symbol *sy + static unsigned int hashNameWith(unsigned int hash, const char *name); + static unsigned int hashName(const char *name); + static int errCheck(const char *s); +-static int execError(const char *s1, const char *s2); ++static int execError(RestartData *context, const char *s1, const char *s2); + static rbTreeNode *arrayEmptyAllocator(void); + static rbTreeNode *arrayAllocateNode(rbTreeNode *src); + static int arrayEntryCopyToNode(rbTreeNode *dst, rbTreeNode *src); +@@ -133,9 +132,9 @@ static void disasmInternal(Inst *inst, i + #endif /* #ifndef DEBUG_ASSEMBLY */ + + #ifdef DEBUG_STACK /* for run-time instruction and stack trace */ +-static void stackdump(int n, int extra); +-static void stackdumpInternal(int n, int extra); +-#define STACKDUMP(n, x) stackdump(n, x) ++static void stackdump(RestartData *context, int n, int extra); ++static void stackdumpInternal(RestartData *context, int n, int extra); ++#define STACKDUMP(n, x) stackdump(Interpreter, n, x) + #define DISASM_RT() disasm(NULL, PC - 1, 1) + #else /* #ifndef DEBUG_STACK */ + #define STACKDUMP(n, x) @@ -175,16 +174,14 @@ static Inst **LoopStackPtr = LoopStack; static const char *ProgramName = ""; @@ -42,15 +64,17 @@ diff --quilt old/source/interpret.c new/source/interpret.c static int PreemptRequest; /* passes preemption requests from called routines back up to the interpreter */ -@@ -533,7 +530,7 @@ static int setupFrame(RestartData *conte +@@ -533,8 +530,8 @@ static int setupFrame(RestartData *conte } /* !OK_TO_PUSH(totalPushs) */ - if (!((context->stackP + totalPushs) <= &context->stack[STACK_SIZE])) { +- return execError(StackOverflowMsg, ""); + if (!((context->stackP + totalPushs) <= (context->stack + STACK_SIZE))) { - return execError(StackOverflowMsg, ""); ++ return execError(context, StackOverflowMsg, ""); } + /* Push arguments and caller information onto the stack */ @@ -648,8 +645,7 @@ int ExecuteMacro(WindowInfo *window, Pro /* Create an execution context (a stack, a stack pointer, a frame pointer, and a program counter) which will retain the program state across @@ -61,7 +85,16 @@ diff --quilt old/source/interpret.c new/source/interpret.c *continuation = context; context->stackP = context->stack; context->runWindow = window; -@@ -680,18 +676,17 @@ int ContinueMacro(RestartData *continuat +@@ -663,7 +659,7 @@ int ExecuteMacro(WindowInfo *window, Pro + prog->name ? prog->name : ""); + + if (status == STAT_ERROR) { +- *msg = ErrMsg; ++ *msg = context->errMsg; + FreeRestartData(context); + return MACRO_ERROR; + } +@@ -680,25 +676,25 @@ int ContinueMacro(RestartData *continuat { register int status, instCount = 0; register Inst *inst; @@ -86,7 +119,25 @@ diff --quilt old/source/interpret.c new/source/interpret.c ErrMsg = NULL; for (;;) { -@@ -716,21 +711,18 @@ int ContinueMacro(RestartData *continuat + /* Execute an instruction */ + inst = PC++; + if (inst->type != OP_INST) { +- status = execError("Unexpected instruction of type <%s>", ++ status = execError(continuation, ++ "Unexpected instruction of type <%s>", + instTypeToStr(inst->type)); + } + else { +@@ -709,28 +705,26 @@ int ContinueMacro(RestartData *continuat + status = (OpFns[inst->val.op])(); + break; + default: +- status = execError("Illegal instruction at %8p", (char *)inst); ++ status = execError(continuation, "Illegal instruction at %8p", ++ (char *)inst); + } + } + /* If error return was not STAT_OK, return to caller */ if (status != STAT_OK) { if (status == STAT_PREEMPT) { @@ -111,7 +162,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c return MACRO_DONE; } } -@@ -740,8 +732,7 @@ int ContinueMacro(RestartData *continuat +@@ -740,8 +734,7 @@ int ContinueMacro(RestartData *continuat X, other macros, and other shell scripts a chance to execute */ instCount++; if (instCount >= INSTRUCTION_LIMIT) { @@ -121,7 +172,16 @@ diff --quilt old/source/interpret.c new/source/interpret.c return MACRO_TIME_LIMIT; } } -@@ -777,7 +768,6 @@ int RunMacroAsSubrCall(RestartData *cont +@@ -763,7 +756,7 @@ int RunMacroAsSubrCall(RestartData *cont + prog->name ? prog->name : ""); + + if (status == STAT_ERROR) { +- *msg = ErrMsg; ++ *msg = context->errMsg; + FreeRestartData(context); + return MACRO_ERROR; + } +@@ -777,7 +770,6 @@ int RunMacroAsSubrCall(RestartData *cont void FreeRestartData(RestartData *context) { rewindStack(context); @@ -129,7 +189,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c XtFree((char *)context); } -@@ -798,8 +788,8 @@ void PreemptMacro(void) +@@ -798,8 +790,8 @@ void PreemptMacro(void) */ void ModifyReturnedValue(RestartData *context, DataValue dv) { @@ -140,7 +200,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -808,7 +798,7 @@ void ModifyReturnedValue(RestartData *co +@@ -808,7 +800,7 @@ void ModifyReturnedValue(RestartData *co */ WindowInfo *MacroRunWindow(void) { @@ -149,7 +209,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -818,7 +808,7 @@ WindowInfo *MacroRunWindow(void) +@@ -818,7 +810,7 @@ WindowInfo *MacroRunWindow(void) */ WindowInfo *MacroFocusWindow(void) { @@ -158,7 +218,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -827,7 +817,12 @@ WindowInfo *MacroFocusWindow(void) +@@ -827,7 +819,12 @@ WindowInfo *MacroFocusWindow(void) */ void SetMacroFocusWindow(WindowInfo *window) { @@ -172,7 +232,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -1317,24 +1312,11 @@ void GarbageCollectStrings(void) +@@ -1317,24 +1314,11 @@ void GarbageCollectStrings(void) /* ** Save and restore execution context to data structure "context" */ @@ -201,7 +261,16 @@ diff --quilt old/source/interpret.c new/source/interpret.c } static void freeSymbolList(Symbol *symList) -@@ -1435,7 +1417,7 @@ static void addToGlobalSymTab(Symbol *sy +@@ -1374,7 +1358,7 @@ static void addToGlobalSymTab(Symbol *sy + GlobalSymTab[idx] = sym; + } + +-#define EXEC_ERROR(s1, s2) return execError(s1, s2) ++#define EXEC_ERROR(s1, s2) return execError(Interpreter, s1, s2) + + #define GET_SYM(s) \ + do { \ +@@ -1435,7 +1419,7 @@ static void addToGlobalSymTab(Symbol *sy /* true, if you can push n values */ #define OK_TO_PUSH(n) \ @@ -210,7 +279,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #define PUSH_CHECK(n) \ do { \ -@@ -1604,9 +1586,8 @@ static int pushSymVal(void) +@@ -1604,9 +1588,8 @@ static int pushSymVal(void) symVal = FP_GET_ARG_N(FrameP, argNum); } } else if (s->type == PROC_VALUE_SYM) { @@ -222,7 +291,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c EXEC_ERROR(errMsg, s->name); } } else -@@ -2371,8 +2352,8 @@ static int eq(void) +@@ -2371,8 +2354,8 @@ static int eq(void) /* negated eq() call */ static int ne(void) { @@ -233,7 +302,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -2702,7 +2683,6 @@ static int callSubroutineFromSymbol(Symb +@@ -2702,7 +2685,6 @@ static int callSubroutineFromSymbol(Symb static DataValue noValue = {NO_TAG, {0}}; DataValue argArray = noValue; Program *prog; @@ -241,7 +310,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c int haveNamedArgs = (nArgs < 0); if (haveNamedArgs) { -@@ -2715,6 +2695,7 @@ static int callSubroutineFromSymbol(Symb +@@ -2715,6 +2697,7 @@ static int callSubroutineFromSymbol(Symb */ if (sym->type == C_FUNCTION_SYM) { DataValue result; @@ -249,7 +318,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c PUSH(argArray); /* push dummy named arg array */ -@@ -2723,9 +2704,9 @@ static int callSubroutineFromSymbol(Symb +@@ -2723,9 +2706,9 @@ static int callSubroutineFromSymbol(Symb /* Call the function and check for preemption */ PreemptRequest = False; @@ -261,7 +330,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c PUSH_RET_VAL(result); return PreemptRequest ? STAT_PREEMPT : STAT_OK; } -@@ -2738,15 +2719,10 @@ static int callSubroutineFromSymbol(Symb +@@ -2738,15 +2721,10 @@ static int callSubroutineFromSymbol(Symb ** values which are already there. */ if (sym->type == MACRO_FUNCTION_SYM) { @@ -278,7 +347,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -2999,7 +2975,6 @@ static int returnValOrNone(int valOnStac +@@ -2999,7 +2977,6 @@ static int returnValOrNone(int valOnStac { DataValue retVal; static DataValue noValue = {NO_TAG, {0}}; @@ -286,7 +355,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c DISASM_RT(); STACKDUMP(StackP - FrameP + FP_GET_ARG_COUNT(FrameP) + FP_TO_ARGS_DIST, 3); -@@ -3012,9 +2987,7 @@ static int returnValOrNone(int valOnStac +@@ -3012,9 +2989,7 @@ static int returnValOrNone(int valOnStac retVal = noValue; } @@ -297,6 +366,108 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* push returned value, if requsted */ PUSH_RET_VAL(retVal); +@@ -4157,27 +4132,27 @@ static int errCheck(const char *s) + /* + ** build a stack dump string, reallocating s as necessary. + */ +-static char *stackDumpStr(DataValue *fp, const char *msg, char **s, int *pLen) ++static char *stackDumpStr(RestartData *context, const char *msg, char **s, int *pLen) + { + static const char backtraceMsg[] = "\n\nBacktrace:"; + char frameBuf[TYPE_INT_STR_SIZE(int) + 2]; + int len, nFrames, frameWidth, thisFrameWidth; + const char *op; + char *np; +- DataValue *nfp = fp; ++ DataValue *nfp = context->frameP; + Inst *pc; + + #ifdef DEBUG_STACK + const char *dump; + static const char stackdumpMsg[] = "\n\nStack:\n"; +- disasmInternal(PC - 1, 1); +- stackdumpInternal(0, 50); ++ disasmInternal(context->pc - 1, 1); ++ stackdumpInternal(context, 0, 50); + dump = printd(NULL); + #endif + + /* first measure the lengths */ + len = strlen(msg) + strlen(backtraceMsg) + 1; +- nfp = fp; ++ nfp = context->frameP; + nFrames = 0; + do { + nFrames++; +@@ -4204,7 +4179,7 @@ static char *stackDumpStr(DataValue *fp, + while (*op) + *np++ = *op++; + +- nfp = fp; ++ nfp = context->frameP; + nFrames = 0; + do { + nFrames++; +@@ -4243,14 +4218,14 @@ static char *stackDumpStr(DataValue *fp, + ** result. Returns false so a single return execError() statement can + ** be used to both process the message and return. + */ +-static int execError(const char *s1, const char *s2) ++static int execError(RestartData *context, const char *s1, const char *s2) + { + static char msg[MAX_ERR_MSG_LEN]; + static char *err = NULL; + static int errlen = 0; + + sprintf(msg, s1, s2); +- ErrMsg = stackDumpStr(FrameP, msg, &err, &errlen); ++ context->errMsg = stackDumpStr(context, msg, &err, &errlen); + return STAT_ERROR; + } + +@@ -4854,25 +4829,25 @@ static void stackdumpframe(DataValue *ar + #endif /* #ifdef DEBUG_STACK_HEADFIRST */ + } + +-static void stackdumpInternal(int n, int extra) ++static void stackdumpInternal(RestartData *context, int n, int extra) + { +- DataValue *arrow = StackP - n; +- DataValue *outpt = StackP - n - extra; ++ DataValue *arrow = context->stackP - n; ++ DataValue *outpt = context->stackP - n - extra; + + #ifdef DEBUG_STACK_HEADFIRST + printd("Stack ----->\n"); +- stackdumpframe(arrow, outpt, FrameP, StackP, '*'); +- if (outpt < TheStack) ++ stackdumpframe(arrow, outpt, context->frameP, context->stackP, '*'); ++ if (outpt < context->stack) + printd("--------------Stack base--------------\n"); + #else +- if (outpt < TheStack) ++ if (outpt < context->stack) + printd("--------------Stack base--------------\n"); +- stackdumpframe(arrow, outpt, FrameP, StackP, '*'); ++ stackdumpframe(arrow, outpt, context->frameP, context->stackP, '*'); + printd("Stack ----->\n\n"); + #endif /* #ifdef DEBUG_STACK_HEADFIRST */ + } + +-static void stackdump(int n, int extra) ++static void stackdump(RestartData *context, int n, int extra) + { + static int outIsTTY = -1; + if (outIsTTY == -1) +@@ -4881,7 +4856,7 @@ static void stackdump(int n, int extra) + #ifndef DEBUG_STACKDUMP_EXTRA + #define DEBUG_STACKDUMP_EXTRA 0 + #endif +- stackdumpInternal(n, extra + DEBUG_STACKDUMP_EXTRA); ++ stackdumpInternal(context, n, extra + DEBUG_STACKDUMP_EXTRA); + #undef DEBUG_STACKDUMP_EXTRA + + if (outIsTTY) diff --quilt old/source/interpret.h new/source/interpret.h --- old/source/interpret.h +++ new/source/interpret.h diff --git a/handle_hardlink.patch b/handle_hardlink.patch index f31c63e..ec571dc 100644 --- a/handle_hardlink.patch +++ b/handle_hardlink.patch @@ -331,7 +331,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c }; static XrmOptionDescRec OpTable[] = { -@@ -2314,6 +2324,16 @@ Boolean GetPrefShowScrolltip(void) +@@ -2313,6 +2323,16 @@ Boolean GetPrefShowScrolltip(void) return True; } diff --git a/key-grammar.patch b/key-grammar.patch index b2546b8..76c5af1 100644 --- a/key-grammar.patch +++ b/key-grammar.patch @@ -6,7 +6,7 @@ diff --quilt old/source/parse.y new/source/parse.y --- old/source/parse.y +++ new/source/parse.y -@@ -124,7 +124,7 @@ static int nextSymIsField = 0; +@@ -121,7 +121,7 @@ static int nextSymIsField = 0; %token NUMBER %token DELETE ARG_LOOKUP %token IF WHILE DO ELSE FOR BREAK CONTINUE RETURN DEFINE TYPEOF KEYVAL @@ -14,8 +14,8 @@ diff --quilt old/source/parse.y new/source/parse.y +%type keyargs key keyopt catlist fnarglsopt fnarglist fnarg %type cond comastmts comastmtlst for while do else and or arrayexpr mark %type evalsym - %type definesym -@@ -349,49 +349,27 @@ simpstmt: /* simple variable assignmen + %type definesym +@@ -351,49 +351,27 @@ simpstmt: /* simple variable assignmen ADD_OP(OP_ASSIGN); ADD_SYM($1); } /* delete array entry simple statement */ @@ -83,7 +83,7 @@ diff --quilt old/source/parse.y new/source/parse.y } | initarraylv '[' '@' ']' '=' blank expr { ADD_OP(OP_ARRAY_ASSIGN_NEXT); -@@ -460,13 +438,9 @@ lvlist: blank { +@@ -462,13 +440,9 @@ lvlist: blank { SwapCode($4, $5, GetPC()); } ; @@ -99,7 +99,7 @@ diff --quilt old/source/parse.y new/source/parse.y } ; /* lventry's value is the start of the assignment code */ -@@ -476,17 +450,11 @@ lventry: SYMBOL { +@@ -478,17 +452,11 @@ lventry: SYMBOL { $$ = GetPC(); ADD_OP(OP_ASSIGN); ADD_SYM($1); } @@ -120,7 +120,7 @@ diff --quilt old/source/parse.y new/source/parse.y } ; -@@ -503,11 +471,14 @@ comastmtlst: simp +@@ -505,11 +473,14 @@ comastmtlst: simp ; /* array key argument lists */ @@ -139,7 +139,7 @@ diff --quilt old/source/parse.y new/source/parse.y ; /* string concatenation lists */ -@@ -543,11 +514,8 @@ funccall: TYPEOF '(' { +@@ -545,11 +516,8 @@ funccall: TYPEOF '(' { fnarg: expr { $$ = 0; } @@ -153,7 +153,7 @@ diff --quilt old/source/parse.y new/source/parse.y } ; fnarglsopt: blank { $$ = 0; } -@@ -603,22 +571,16 @@ expr: catlist { +@@ -605,22 +573,16 @@ expr: catlist { initarraylv: SYMBOL { ADD_OP(OP_PUSH_ARRAY_SYM); ADD_SYM($1); ADD_IMMED(1); } @@ -180,7 +180,7 @@ diff --quilt old/source/parse.y new/source/parse.y } ; -@@ -659,15 +621,10 @@ arrentry: blank { +@@ -661,15 +623,10 @@ arrentry: blank { /* make a suitable index >= 0 and add expr there */ ADD_OP(OP_ANONARRAY_NEXT_VAL); } @@ -198,7 +198,7 @@ diff --quilt old/source/parse.y new/source/parse.y } ; -@@ -685,11 +642,8 @@ numexpr: '(' blank expr blank ')' +@@ -687,11 +644,8 @@ numexpr: '(' blank expr blank ')' | ARG_LOOKUP '[' blank ']' { ADD_OP(OP_PUSH_ARG_COUNT); } */ | ARG_LOOKUP { ADD_OP(OP_PUSH_ARG_ARRAY); } diff --git a/langmoderegex.patch b/langmoderegex.patch index 94ede98..7b7357e 100644 --- a/langmoderegex.patch +++ b/langmoderegex.patch @@ -19,7 +19,7 @@ will match common ways of naming make files. diff --quilt old/source/preferences.c new/source/preferences.c --- old/source/preferences.c +++ new/source/preferences.c -@@ -3217,7 +3217,9 @@ the list on the left. To add a new lang +@@ -3216,7 +3216,9 @@ the list on the left. To add a new lang extLbl = XtVaCreateManagedWidget("extLbl", xmLabelGadgetClass, form, XmNlabelString, @@ -30,7 +30,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c XmNmnemonic, 'F', XmNalignment, XmALIGNMENT_BEGINNING, XmNleftAttachment, XmATTACH_POSITION, -@@ -4817,47 +4819,59 @@ static int matchLanguageMode(WindowInfo +@@ -4816,47 +4818,59 @@ static int matchLanguageMode(WindowInfo /*... look for an explicit mode statement first */ diff --git a/matching_patterns.patch b/matching_patterns.patch index e9dc11e..703729e 100644 --- a/matching_patterns.patch +++ b/matching_patterns.patch @@ -11170,7 +11170,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c PrefsHaveChanged = False; } -@@ -1921,16 +1997,6 @@ int GetPrefShowMatching(void) +@@ -1920,16 +1996,6 @@ int GetPrefShowMatching(void) return PrefData.showMatchingStyle; } @@ -11187,7 +11187,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c void SetPrefHighlightSyntax(Boolean state) { setIntPref(&PrefData.highlightSyntax, state); -@@ -3480,6 +3546,21 @@ static int lmDeleteConfirmCB(int itemInd +@@ -3479,6 +3545,21 @@ static int lmDeleteConfirmCB(int itemInd return False; } @@ -11209,7 +11209,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c return True; } -@@ -3500,15 +3581,15 @@ static int updateLMList(void) +@@ -3499,15 +3580,15 @@ static int updateLMList(void) return False; /* Fix up language mode indices in all open windows (which may change @@ -11228,7 +11228,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c newDelimiters = LMDialog.languageModeList[i]->delimiters; if (newDelimiters == NULL) newDelimiters = GetPrefDelimiters(); -@@ -3538,6 +3619,7 @@ static int updateLMList(void) +@@ -3537,6 +3618,7 @@ static int updateLMList(void) *strchr(LMDialog.languageModeList[i]->name, ':') = '\0'; RenameHighlightPattern(LMDialog.languageModeList[i]->name, newName); RenameSmartIndentMacros(LMDialog.languageModeList[i]->name, newName); @@ -11236,7 +11236,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c memmove(LMDialog.languageModeList[i]->name, newName, strlen(newName) + 1); ChangeManagedListData(LMDialog.managedListW); -@@ -3555,13 +3637,24 @@ static int updateLMList(void) +@@ -3554,13 +3636,24 @@ static int updateLMList(void) user menu items */ UpdateUserMenuInfo(); @@ -11262,7 +11262,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* cache user menus: Rebuild all user menus of this window */ RebuildAllMenus(window); } -@@ -3570,12 +3663,32 @@ static int updateLMList(void) +@@ -3569,12 +3662,32 @@ static int updateLMList(void) UpdateLanguageModeMenu(); /* The same for the smart indent macro dialog */ UpdateLangModeMenuSmartIndent(); @@ -11295,7 +11295,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c static void *lmGetDisplayedCB(void *oldItem, int explicitRequest, int *abort, void *cbArg) { -@@ -4569,6 +4682,10 @@ static void reapplyLanguageMode(WindowIn +@@ -4568,6 +4681,10 @@ static void reapplyLanguageMode(WindowIn DeleteTagsFile( LanguageModes[oldMode]->defTipsFile, TIP, False ); } @@ -11306,7 +11306,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* Set delimiters for all text widgets */ if (mode == PLAIN_LANGUAGE_MODE || LanguageModes[mode]->delimiters == NULL) delimiters = GetPrefDelimiters(); -@@ -5186,14 +5303,31 @@ char *ReadSymbolicFieldTextWidget(Widget +@@ -5185,14 +5302,31 @@ char *ReadSymbolicFieldTextWidget(Widget /* ** Create a pulldown menu pane with the names of the current language modes. ** XmNuserData for each item contains the language mode name. diff --git a/parseErrorLineNo.diff b/parseErrorLineNo.diff index 665b0a7..910d0d3 100644 --- a/parseErrorLineNo.diff +++ b/parseErrorLineNo.diff @@ -15,7 +15,7 @@ being parsed, not the whole file. diff --quilt old/source/preferences.c new/source/preferences.c --- old/source/preferences.c +++ new/source/preferences.c -@@ -5654,7 +5654,8 @@ int ParseError(Widget toDialog, const ch +@@ -5653,7 +5653,8 @@ int ParseError(Widget toDialog, const ch int len, nNonWhite = 0; const char *c; char *errorLine; @@ -25,7 +25,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c for (c=stoppedAt; c>=stringStart; c--) { if (c == stringStart) break; -@@ -5663,6 +5664,12 @@ int ParseError(Widget toDialog, const ch +@@ -5662,6 +5663,12 @@ int ParseError(Widget toDialog, const ch else if (*c != ' ' && *c != '\t') nNonWhite++; } @@ -38,7 +38,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c len = stoppedAt - c + (*stoppedAt == '\0' ? 0 : 1); errorLine = XtMalloc(len+4); strncpy(errorLine, c, len); -@@ -5672,11 +5679,13 @@ int ParseError(Widget toDialog, const ch +@@ -5671,11 +5678,13 @@ int ParseError(Widget toDialog, const ch errorLine[len] = '\0'; if (toDialog == NULL) { diff --git a/pushString.patch b/pushString.patch index 9edc041..4aa47a2 100644 --- a/pushString.patch +++ b/pushString.patch @@ -53,7 +53,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** Add a branch offset operand to the current program */ int AddBranchOffset(Inst *to, char **msg) -@@ -817,47 +830,6 @@ void SetMacroFocusWindow(WindowInfo *win +@@ -819,47 +832,6 @@ void SetMacroFocusWindow(WindowInfo *win } } @@ -101,7 +101,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c static Symbol *lookupSymbol(Symbol *symlist, const char *name, unsigned int hash) { -@@ -904,8 +876,7 @@ Symbol *InstallSymbol(const char *name, +@@ -906,8 +878,7 @@ Symbol *InstallSymbol(const char *name, Symbol *s; s = XtNew(Symbol); @@ -111,7 +111,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c s->type = type; s->value = value; s->hash = hashName(s->name); -@@ -1285,7 +1256,6 @@ static void freeSymbolList(Symbol *symLi +@@ -1287,7 +1258,6 @@ static void freeSymbolList(Symbol *symLi while (symList != NULL) { s = symList; symList = s->next; @@ -119,7 +119,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c XtFree((char *)s); } } -@@ -1347,6 +1317,16 @@ static void addToGlobalSymTab(Symbol *sy +@@ -1349,6 +1319,16 @@ static void addToGlobalSymTab(Symbol *sy PC++; \ } while (0) @@ -136,7 +136,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #define JUMP(a) \ do { \ PC = (a); \ -@@ -1529,7 +1509,7 @@ static int pushSymVal(void) +@@ -1531,7 +1511,7 @@ static int pushSymVal(void) if (s->type == LOCAL_SYM) { symVal = FP_GET_SYM_VAL(FrameP, s); @@ -145,7 +145,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c symVal = s->value; } else if (s->type == ARG_SYM) { nArgs = FP_GET_ARG_COUNT(FrameP); -@@ -1581,6 +1561,27 @@ static int pushImmed(void) +@@ -1583,6 +1563,27 @@ static int pushImmed(void) return STAT_OK; } @@ -173,7 +173,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c static int pushArgVal(void) { int nArgs, argNum; -@@ -2919,7 +2920,7 @@ int OverlayRoutineFromProg(Program *prog +@@ -2921,7 +2922,7 @@ int OverlayRoutineFromProg(Program *prog Symbol sym; sym.type = MACRO_FUNCTION_SYM; @@ -182,7 +182,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c sym.value.tag = NO_TAG; sym.value.val.prog = prog; sym.next = NULL; -@@ -4088,6 +4089,108 @@ static int errCheck(const char *s) +@@ -4090,6 +4091,108 @@ static int errCheck(const char *s) } /* @@ -290,8 +290,8 @@ 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) -@@ -4266,6 +4369,8 @@ static const char *instTypeToStr(enum in + static char *stackDumpStr(RestartData *context, const char *msg, char **s, int *pLen) +@@ -4268,6 +4371,8 @@ static const char *instTypeToStr(enum in return "operation"; case IMMED_INST: return "immediate"; @@ -300,7 +300,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c case BRANCH_INST: return "branch"; case SYM_INST: -@@ -4348,6 +4453,41 @@ int outPrintd() +@@ -4350,6 +4455,41 @@ int outPrintd() #endif /* #ifdef DEBUG_DISASSEMBLER */ #ifdef DEBUG_DISASSEMBLER /* dumping values in disassembly or stack dump */ @@ -342,7 +342,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c static void dumpVal(DataValue dv) { switch (dv.tag) { -@@ -4356,38 +4496,16 @@ static void dumpVal(DataValue dv) +@@ -4358,38 +4498,16 @@ static void dumpVal(DataValue dv) break; case STRING_TAG: { @@ -385,7 +385,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } } break; -@@ -4450,6 +4568,16 @@ static void dumpInst(Inst *inst, const c +@@ -4452,6 +4570,16 @@ static void dumpInst(Inst *inst, const c printd(" <%s %d>", name, inst->val.immed); break; @@ -402,7 +402,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c case BRANCH_INST: printd(" <%s %+td:%8p>", name, inst->val.branch, inst + inst->val.branch); -@@ -4503,10 +4631,6 @@ static void disasmInternal(Inst *inst, i +@@ -4505,10 +4633,6 @@ static void disasmInternal(Inst *inst, i case OP_ASSIGN: CHECK_OPERANDS(1, SYM_INST); dumpInst(&inst[i+1], NULL); @@ -413,7 +413,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ++i; break; -@@ -4516,6 +4640,12 @@ static void disasmInternal(Inst *inst, i +@@ -4518,6 +4642,12 @@ static void disasmInternal(Inst *inst, i ++i; break; diff --git a/readonly-statement.patch b/readonly-statement.patch index 62d1462..4666999 100644 --- a/readonly-statement.patch +++ b/readonly-statement.patch @@ -3,13 +3,13 @@ source/highlightData.c | 2 +- source/interpret.c | 14 ++++++++++++++ source/ops.h | 1 + - source/parse.y | 19 +++++++++++++++++-- - 4 files changed, 33 insertions(+), 3 deletions(-) + source/parse.y | 10 +++++++++- + 4 files changed, 25 insertions(+), 2 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -3955,6 +3955,20 @@ static int typeOfOut(void) +@@ -3957,6 +3957,20 @@ static int typeOfOut(void) return STAT_OK; } @@ -41,7 +41,7 @@ diff --quilt old/source/ops.h new/source/ops.h diff --quilt old/source/parse.y new/source/parse.y --- old/source/parse.y +++ new/source/parse.y -@@ -124,7 +124,7 @@ static int nextSymIsField = 0; +@@ -121,7 +121,7 @@ static int nextSymIsField = 0; %token SYMBOL STRING FIELD %token NUMBER %token DELETE ARG_LOOKUP @@ -50,32 +50,7 @@ diff --quilt old/source/parse.y new/source/parse.y %type keyargs key keyopt catlist fnarglsopt fnarglist fnarg %type cond comastmts comastmtlst for while do else and or arrayexpr mark %type evalsym -@@ -213,7 +213,7 @@ definesym: SYMBOL { - } - else { - DataValue subrPtr; -- subrPtr.tag = MACRO_SUBR_TAG; -+ subrPtr.tag = NO_TAG; - subrPtr.val.prog = NULL; - $$.sym = InstallSymbol($1, GLOBAL_SCOPE, NO_ATTR, subrPtr); - } -@@ -222,8 +222,15 @@ definesym: SYMBOL { - ; - define: definekw blank definesym blank blockwb { - ADD_OP(OP_RETURN_NO_VAL); -+ $3.sym->value.tag = MACRO_SUBR_TAG; - $3.sym->value.val.prog = FinishCreatingProgram($3.acc); - } -+ | READONLY definekw blank definesym blank blockwb { -+ ADD_OP(OP_RETURN_NO_VAL); -+ $4.sym->value.tag = MACRO_SUBR_TAG; -+ $4.sym->value.val.prog = FinishCreatingProgram($4.acc); -+ $4.sym->attr |= READONLY_ATTR; -+ } - ; - - stmtend: '\n' | ';' -@@ -382,6 +389,13 @@ simpstmt: /* simple variable assignmen +@@ -385,6 +385,13 @@ simpstmt: /* simple variable assignmen | initarraylv '[' '@' ']' '=' blank expr { ADD_OP(OP_ARRAY_ASSIGN_NEXT); } @@ -89,7 +64,7 @@ diff --quilt old/source/parse.y new/source/parse.y | funccall | lvlistexpr ; -@@ -911,6 +925,7 @@ static int yylex(void) +@@ -914,6 +921,7 @@ static int yylex(void) if (!strcmp(symName, "delete") && follow_non_whitespace('(', SYMBOL, DELETE) == DELETE) return DELETE; if (!strcmp(symName, "define") && follow_non_whitespace('(', SYMBOL, DEFINE) == DEFINE) return DEFINE; if (!strcmp(symName, "typeof")) return TYPEOF; diff --git a/remove-cast-warnings.patch b/remove-cast-warnings.patch index 8ee72ba..e40dfc5 100644 --- a/remove-cast-warnings.patch +++ b/remove-cast-warnings.patch @@ -13,7 +13,7 @@ Subject: remove more cast warnings diff --quilt old/source/preferences.c new/source/preferences.c --- old/source/preferences.c +++ new/source/preferences.c -@@ -2282,9 +2282,8 @@ void SetLanguageMode(WindowInfo *window, +@@ -2281,9 +2281,8 @@ void SetLanguageMode(WindowInfo *window, { Widget menu; WidgetList items; @@ -25,7 +25,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c /* Do mode-specific actions */ reapplyLanguageMode(window, mode, forceNewDefaults); -@@ -2293,9 +2292,9 @@ void SetLanguageMode(WindowInfo *window, +@@ -2292,9 +2291,9 @@ void SetLanguageMode(WindowInfo *window, if (IsTopDocument(window)) { XtVaGetValues(window->langModeCascade, XmNsubMenuId, &menu, NULL); XtVaGetValues(menu, XmNchildren, &items, XmNnumChildren, &nItems, NULL); @@ -37,7 +37,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c } } } -@@ -5147,7 +5146,7 @@ static void updateLanguageModeSubmenu(Wi +@@ -5146,7 +5145,7 @@ static void updateLanguageModeSubmenu(Wi xmToggleButtonGadgetClass, menu, XmNlabelString, s1=XmStringCreateSimple(LanguageModes[i]->name), XmNmarginHeight, 0, @@ -46,7 +46,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c XmNset, window->languageMode==i, NULL); XmStringFree(s1); XtAddCallback(btn, XmNvalueChangedCallback, setLangModeCB, window); -@@ -5159,23 +5158,25 @@ static void setLangModeCB(Widget w, XtPo +@@ -5158,23 +5157,25 @@ static void setLangModeCB(Widget w, XtPo { WindowInfo *window = WidgetToWindow(MENU_WIDGET(w)); char *params[1]; diff --git a/remove_zero_sized_files.patch b/remove_zero_sized_files.patch index a77a4a9..eff2a92 100644 --- a/remove_zero_sized_files.patch +++ b/remove_zero_sized_files.patch @@ -202,7 +202,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c }; static XrmOptionDescRec OpTable[] = { -@@ -2334,6 +2344,16 @@ int GetPrefHardlinkMode(void) +@@ -2333,6 +2343,16 @@ int GetPrefHardlinkMode(void) return PrefData.hardlinkMode; } diff --git a/scrolltip-enable-opt.patch b/scrolltip-enable-opt.patch index 705e20f..fbd0cda 100644 --- a/scrolltip-enable-opt.patch +++ b/scrolltip-enable-opt.patch @@ -19,7 +19,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c {"hardlinkMode", "HardlinkMode", PREF_ENUM, "Ignore", &PrefData.hardlinkMode, HardlinkModes, True}, {"zeroSizedMode", "ZeroSizedMode", PREF_ENUM, "Never", -@@ -2428,8 +2428,7 @@ Boolean GetPrefShowCursorline(void) +@@ -2427,8 +2427,7 @@ Boolean GetPrefShowCursorline(void) Boolean GetPrefShowScrolltip(void) { diff --git a/shell-in-help-output.patch b/shell-in-help-output.patch index 837b110..4e4825a 100644 --- a/shell-in-help-output.patch +++ b/shell-in-help-output.patch @@ -56,7 +56,7 @@ diff --quilt old/source/preferences.c new/source/preferences.c PrefData.shell[MAXPATHLEN] = '\0'; } -@@ -6505,7 +6504,7 @@ void ChooseColors(WindowInfo *window) +@@ -6504,7 +6503,7 @@ void ChooseColors(WindowInfo *window) ** shell, currently defined as the user's login shell. ** In case of errors, the fallback of "sh" will be returned. */ diff --git a/symbol-lookup.patch b/symbol-lookup.patch index 9ae5077..fe828c5 100644 --- a/symbol-lookup.patch +++ b/symbol-lookup.patch @@ -3,8 +3,8 @@ source/interpret.c | 251 +++++++++++++---------------------------------------- source/interpret.h | 8 - source/macro.c | 6 - - source/parse.y | 55 ++++------- - 4 files changed, 91 insertions(+), 229 deletions(-) + source/parse.y | 73 ++++++--------- + 4 files changed, 101 insertions(+), 237 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c @@ -138,7 +138,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* pop past local variables */ context->stackP = context->frameP; -@@ -844,17 +827,20 @@ static Symbol *lookupSymbol(Symbol *syml +@@ -846,17 +829,20 @@ static Symbol *lookupSymbol(Symbol *syml /* ** find a symbol in the symbol table @@ -162,7 +162,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c s = lookupSymbol(LocalSymList, name, hash); if (NULL != s) return s; -@@ -865,7 +851,13 @@ Symbol *LookupSymbol(const char *name) +@@ -867,7 +853,13 @@ Symbol *LookupSymbol(const char *name) if (NULL != s) return s; @@ -177,7 +177,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } /* -@@ -881,8 +873,17 @@ Symbol *InstallSymbol(const char *name, +@@ -883,8 +875,17 @@ Symbol *InstallSymbol(const char *name, s->value = value; s->hash = hashName(s->name); if (type == LOCAL_SYM) { @@ -197,7 +197,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else { addToGlobalSymTab(s); } -@@ -890,70 +891,6 @@ Symbol *InstallSymbol(const char *name, +@@ -892,70 +893,6 @@ Symbol *InstallSymbol(const char *name, } /* @@ -268,7 +268,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c ** Convert a long value to its decimal string representation, returned in a ** static string. */ -@@ -1123,7 +1060,7 @@ static SparseArrayEntry *allocateSparseA +@@ -1125,7 +1062,7 @@ static SparseArrayEntry *allocateSparseA { SparseArrayEntryWrapper *mem; @@ -277,9 +277,9 @@ diff --quilt old/source/interpret.c new/source/interpret.c mem->next = AllocatedSparseArrayEntries; AllocatedSparseArrayEntries = mem; #ifdef TRACK_GARBAGE_LEAKS -@@ -1287,14 +1224,19 @@ static void addToGlobalSymTab(Symbol *sy +@@ -1289,14 +1226,19 @@ static void addToGlobalSymTab(Symbol *sy - #define EXEC_ERROR(s1, s2) return execError(s1, s2) + #define EXEC_ERROR(s1, s2) return execError(Interpreter, s1, s2) -#define GET_SYM(s) \ +#define GET_SYM(s, create) \ @@ -299,7 +299,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } while (0) #define GET_IMMED(i) \ -@@ -1505,11 +1447,9 @@ static int pushSymVal(void) +@@ -1507,11 +1449,9 @@ static int pushSymVal(void) DISASM_RT(); STACKDUMP(0, 3); @@ -313,7 +313,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c symVal = s->value; } else if (s->type == ARG_SYM) { nArgs = FP_GET_ARG_COUNT(FrameP); -@@ -1659,18 +1599,13 @@ static int pushArraySymVal(void) +@@ -1661,18 +1601,13 @@ static int pushArraySymVal(void) DISASM_RT(); STACKDUMP(0, 3); @@ -335,7 +335,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (initEmpty && dataPtr->tag == NO_TAG) { dataPtr->tag = ARRAY_TAG; -@@ -1972,7 +1907,7 @@ static int assign(void) +@@ -1974,7 +1909,7 @@ static int assign(void) DISASM_RT(); STACKDUMP(1, 3); @@ -344,7 +344,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (sym->type != GLOBAL_SYM && sym->type != LOCAL_SYM) { if (sym->type == ARG_SYM) { -@@ -1985,13 +1920,7 @@ static int assign(void) +@@ -1987,13 +1922,7 @@ static int assign(void) EXEC_ERROR("assignment to non-variable: %s", sym->name); } } @@ -359,7 +359,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c POP(value); -@@ -2775,7 +2704,7 @@ static int callSubroutine(void) +@@ -2777,7 +2706,7 @@ static int callSubroutine(void) DISASM_RT(); @@ -368,7 +368,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c GET_IMMED(nArgs); STACKDUMP(nArgs > 0 ? nArgs : -nArgs, 3); -@@ -2813,7 +2742,7 @@ static int callSubroutineUnpackArray(voi +@@ -2815,7 +2744,7 @@ static int callSubroutineUnpackArray(voi DISASM_RT(); @@ -377,7 +377,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c GET_IMMED(nArgs); if (nArgs < 0) { -@@ -3624,35 +3553,25 @@ static int arrayIter(void) +@@ -3626,35 +3555,25 @@ static int arrayIter(void) STACKDUMP(1, 4); GET_IMMED(withVal); @@ -419,7 +419,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c valPtr->tag = NO_TAG; } -@@ -3791,37 +3710,27 @@ static int arrayIterArray(void) +@@ -3793,37 +3712,27 @@ static int arrayIterArray(void) STACKDUMP(2, 4); GET_IMMED(withVal); @@ -463,7 +463,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c valPtr->tag = NO_TAG; } -@@ -4584,7 +4493,7 @@ static void dumpInst(Inst *inst, const c +@@ -4586,7 +4495,7 @@ static void dumpInst(Inst *inst, const c break; case SYM_INST: @@ -472,7 +472,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c break; default: -@@ -4809,11 +4718,6 @@ static void stackdumpframe(DataValue *ar +@@ -4811,11 +4720,6 @@ static void stackdumpframe(DataValue *ar DataValue *endDv = (arg1 > outpt) ? arg1 : outpt; int nArgs = FP_GET_ARG_COUNT(fp); @@ -484,7 +484,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #ifdef DEBUG_STACK_HEADFIRST #else /* do caller's frame */ -@@ -4822,17 +4726,6 @@ static void stackdumpframe(DataValue *ar +@@ -4824,17 +4728,6 @@ static void stackdumpframe(DataValue *ar #endif /* #ifdef DEBUG_STACK_HEADFIRST */ /* do current frame */ @@ -502,7 +502,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c /* output instructions between endDv and sp - 1 inclusive */ #ifdef DEBUG_STACK_HEADFIRST -@@ -4843,7 +4736,6 @@ static void stackdumpframe(DataValue *ar +@@ -4845,7 +4738,6 @@ static void stackdumpframe(DataValue *ar #endif /* #ifdef DEBUG_STACK_HEADFIRST */ { const char *posFmt = "%-6s"; @@ -510,7 +510,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)]; -@@ -4867,10 +4759,6 @@ static void stackdumpframe(DataValue *ar +@@ -4869,10 +4761,6 @@ static void stackdumpframe(DataValue *ar sprintf(pos = buffer, STACK_DUMP_ARG_PREFIX "%d", offset + FP_TO_ARGS_DIST + nArgs + 1); } @@ -521,7 +521,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c else if (offset == 0) { pos = "FrameP"; } -@@ -4878,17 +4766,6 @@ static void stackdumpframe(DataValue *ar +@@ -4880,17 +4768,6 @@ static void stackdumpframe(DataValue *ar } printd(posFmt, pos); @@ -593,7 +593,7 @@ diff --quilt old/source/interpret.h new/source/interpret.h diff --quilt old/source/parse.y new/source/parse.y --- old/source/parse.y +++ new/source/parse.y -@@ -111,7 +111,6 @@ static int nextSymIsField = 0; +@@ -111,25 +111,20 @@ static int nextSymIsField = 0; %} %union { @@ -601,9 +601,12 @@ diff --quilt old/source/parse.y new/source/parse.y Inst *inst; int num; const char *str; -@@ -121,14 +120,13 @@ static int nextSymIsField = 0; - Symbol *sym; - } define; + enum operations oper; +- struct { +- AccumulatorData *acc; +- Symbol *sym; +- } define; ++ AccumulatorData *acc; } -%token SYMBOL -%token STRING FIELD @@ -614,11 +617,13 @@ diff --quilt old/source/parse.y new/source/parse.y %type arglistopt arglist catlist fnarglsopt fnarglist fnarg %type cond comastmts comastmtlst for while do else and or arrayexpr mark -%type evalsym +-%type definesym +%type evalsym - %type definesym ++%type definesym %type operassign incrdecr %token '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ -@@ -199,31 +197,24 @@ definekw: DEFINE { + %token INCR DECR +@@ -199,31 +194,29 @@ definekw: DEFINE { } ; definesym: SYMBOL { @@ -630,38 +635,46 @@ diff --quilt old/source/parse.y new/source/parse.y - */ - if ($1->type == MACRO_FUNCTION_SYM) { - FreeProgram($1->value.val.prog); -+ $$.sym = LookupSymbol($1, False); -+ if ($$.sym) { -+ if ($$.sym->type != MACRO_FUNCTION_SYM) { -+ yyerror("try to override built-in subroutine"); YYERROR; -+ } - } +- } - else if ($1->type == LOCAL_SYM || - $1->type == GLOBAL_SYM) { - /* newly created sym, or we overwrite a local sym */; - } else { - yyerror("try to override built-in subroutine"); YYERROR; -+ else { -+ DataValue subrPtr; -+ subrPtr.tag = NO_TAG; -+ subrPtr.val.prog = NULL; -+ $$.sym = InstallSymbol($1, MACRO_FUNCTION_SYM, subrPtr); - } +- } - $$.sym = PromoteToGlobal($1); - $$.acc = BeginCreatingProgram($$.sym->name); +- $$.acc = BeginCreatingProgram($$.sym->name); ++ $$ = BeginCreatingProgram($1); } ; define: definekw blank definesym blank blockwb { ++ Symbol *sym; ++ Program *prog; ADD_OP(OP_RETURN_NO_VAL); - Program *prog = FinishCreatingProgram($3.acc); - $3.sym->type = MACRO_FUNCTION_SYM; - $3.sym->value.tag = NO_TAG; - $3.sym->value.val.prog = prog; -+ $3.sym->value.val.prog = FinishCreatingProgram($3.acc); ++ prog = FinishCreatingProgram($3); ++ sym = LookupSymbol(prog->name, False); ++ if (sym) { ++ if (sym->type != MACRO_FUNCTION_SYM) { ++ FreeProgram(prog); ++ yyerror("try to override built-in subroutine"); YYERROR; ++ } ++ FreeProgram(sym->value.val.prog); ++ } ++ else { ++ DataValue subrPtr; ++ subrPtr.tag = NO_TAG; ++ sym = InstallSymbol(prog->name, MACRO_FUNCTION_SYM, ++ subrPtr); ++ } ++ sym->value.val.prog = prog; } ; -@@ -532,18 +523,18 @@ funccall: TYPEOF '(' { +@@ -532,18 +525,18 @@ funccall: TYPEOF '(' { } | SYMBOL '(' fnarglsopt ')' { ADD_OP(OP_SUBR_CALL); @@ -683,7 +696,7 @@ diff --quilt old/source/parse.y new/source/parse.y ADD_IMMED($3); } ; -@@ -931,19 +922,17 @@ static int yylex(void) +@@ -931,19 +924,17 @@ static int yylex(void) if (!strcmp(symName, "delete") && follow_non_whitespace('(', SYMBOL, DELETE) == DELETE) return DELETE; if (!strcmp(symName, "define") && follow_non_whitespace('(', SYMBOL, DEFINE) == DEFINE) return DEFINE; if (!strcmp(symName, "typeof")) return TYPEOF; @@ -708,7 +721,7 @@ diff --quilt old/source/parse.y new/source/parse.y return SYMBOL; } nextSymIsField = 0; -@@ -1105,7 +1094,7 @@ static Symbol *matchesActionRoutine(char +@@ -1105,7 +1096,7 @@ static Symbol *matchesActionRoutine(char if (!hasDash) return NULL; *symPtr = '\0'; diff --git a/ternary-operator-GNU.patch b/ternary-operator-GNU.patch index 2c1a468..471080c 100644 --- a/ternary-operator-GNU.patch +++ b/ternary-operator-GNU.patch @@ -16,7 +16,7 @@ diff --quilt old/source/parse.y new/source/parse.y static Symbol *matchesActionRoutine(char **inPtr); static int scanString(void); -@@ -134,7 +135,7 @@ static int nextSymIsField = 0; +@@ -131,7 +132,7 @@ static int nextSymIsField = 0; %type lvlist %type lventry %token ARGSEP @@ -25,7 +25,7 @@ diff --quilt old/source/parse.y new/source/parse.y %nonassoc IF_NO_ELSE %nonassoc ELSE -@@ -142,7 +143,7 @@ static int nextSymIsField = 0; +@@ -139,7 +140,7 @@ static int nextSymIsField = 0; %nonassoc ';' %nonassoc SYMBOL ARG_LOOKUP %right '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ @@ -34,7 +34,7 @@ diff --quilt old/source/parse.y new/source/parse.y %left CONCAT %left OR %left AND -@@ -676,6 +677,9 @@ numexpr: '(' blank expr blank ')' +@@ -678,6 +679,9 @@ numexpr: '(' blank expr blank ')' SET_BR_OFF($2, $5 + 1); /* thenx limb ends at $5+1 */ SET_BR_OFF($5, GetPC()); /* elsex limb ends here */ } @@ -44,7 +44,7 @@ diff --quilt old/source/parse.y new/source/parse.y | incrdecr blank SYMBOL %prec INCR { ADD_OP(OP_PUSH_SYM); ADD_SYM($3); ADD_OP($1); ADD_OP(OP_DUP); ADD_OP(OP_ASSIGN); ADD_SYM($3); -@@ -738,13 +742,24 @@ or: OR { +@@ -740,13 +744,24 @@ or: OR { ; thenx: '?' { @@ -69,7 +69,7 @@ diff --quilt old/source/parse.y new/source/parse.y dot: '.' %prec '.' { nextSymIsField = 1; -@@ -936,6 +951,7 @@ static int yylex(void) +@@ -938,6 +953,7 @@ static int yylex(void) return result; /* but return what we started with */ } case ',': return comma_look_ahead(); @@ -77,7 +77,7 @@ diff --quilt old/source/parse.y new/source/parse.y default: return *(InPtr-1); } } -@@ -1037,6 +1053,24 @@ static int comma_look_ahead(void) +@@ -1039,6 +1055,24 @@ static int comma_look_ahead(void) return ','; } @@ -105,7 +105,7 @@ diff --quilt old/source/parse.y new/source/parse.y diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c +++ new/source/interpret.c -@@ -2460,6 +2460,36 @@ static int power(void) +@@ -2462,6 +2462,36 @@ static int power(void) return errCheck("exponentiation"); } diff --git a/ternary-operator.patch b/ternary-operator.patch index 4584eaa..f13c541 100644 --- a/ternary-operator.patch +++ b/ternary-operator.patch @@ -6,7 +6,7 @@ diff --quilt old/source/parse.y new/source/parse.y --- old/source/parse.y +++ new/source/parse.y -@@ -134,6 +134,7 @@ static int nextSymIsField = 0; +@@ -131,6 +131,7 @@ static int nextSymIsField = 0; %type lvlist %type lventry %token ARGSEP @@ -14,7 +14,7 @@ diff --quilt old/source/parse.y new/source/parse.y %nonassoc IF_NO_ELSE %nonassoc ELSE -@@ -141,6 +142,7 @@ static int nextSymIsField = 0; +@@ -138,6 +139,7 @@ static int nextSymIsField = 0; %nonassoc ';' %nonassoc SYMBOL ARG_LOOKUP %right '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ @@ -22,7 +22,7 @@ diff --quilt old/source/parse.y new/source/parse.y %left CONCAT %left OR %left AND -@@ -670,6 +672,10 @@ numexpr: '(' blank expr blank ')' +@@ -672,6 +674,10 @@ numexpr: '(' blank expr blank ')' | numexpr or blank numexpr %prec OR { ADD_OP(OP_OR); SET_BR_OFF($2, GetPC()); } @@ -33,7 +33,7 @@ diff --quilt old/source/parse.y new/source/parse.y | incrdecr blank SYMBOL %prec INCR { ADD_OP(OP_PUSH_SYM); ADD_SYM($3); ADD_OP($1); ADD_OP(OP_DUP); ADD_OP(OP_ASSIGN); ADD_SYM($3); -@@ -731,6 +737,15 @@ or: OR { +@@ -733,6 +739,15 @@ or: OR { } ; -- 2.11.4.GIT