From 1dd896d1194e531977e3d174f706ddfd84709f4a Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 4 Feb 2008 11:49:46 +0100 Subject: [PATCH] InterpretDebug-mods: calculate OpName length B.W. --- InterpretDebug-mods.patch | 26 ++++++++++++++++++-------- core-typeof-syntax.patch | 4 ++-- extend-for-key-in-array-syntax.patch | 8 ++++---- extend-if-key-in-array-syntax.patch | 6 +++--- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/InterpretDebug-mods.patch b/InterpretDebug-mods.patch index 48e2d00..8982d7c 100644 --- a/InterpretDebug-mods.patch +++ b/InterpretDebug-mods.patch @@ -1,10 +1,10 @@ --- - source/interpret.c | 104 +++++++++++++++++++++++++++++++++-------------------- - source/interpret.h | 2 - - source/parse.y | 14 ++----- - source/userCmds.c | 4 +- - 4 files changed, 73 insertions(+), 51 deletions(-) + source/interpret.c | 113 ++++++++++++++++++++++++++++++++++------------------- + source/interpret.h | 2 + source/parse.y | 14 ++---- + source/userCmds.c | 4 - + 4 files changed, 82 insertions(+), 51 deletions(-) diff --quilt old/source/interpret.c new/source/interpret.c --- old/source/interpret.c @@ -143,20 +143,30 @@ diff --quilt old/source/interpret.c new/source/interpret.c if (!dv.val.inst) { printd(""); } -@@ -3699,98 +3720,103 @@ static void disasmInternal(Inst *inst, i +@@ -3698,99 +3719,113 @@ static void disasmInternal(Inst *inst, i + "SWAP_TOP2", /* swapTop2: cf namedArgN */ "SUBR_CALL_STACKED_N", /* callSubroutineStackedN */ "UNPACKTOARGS", /* unpackArrayToArgs */ }; int i, j; ++ static size_t opLen; - printd("\n"); ++ if (!opLen) { ++ for (j = 0; j < N_OPS; ++j) { ++ if (opLen < strlen(opNames[j])) { ++ opLen = strlen(opNames[j]); ++ } ++ } ++ } ++ for (i = 0; i < nInstr; ++i) { - printd("Prog %8p ", &inst[i]); + printd("Prog %8p", &inst[i]); for (j = 0; j < N_OPS; ++j) { if (inst[i].func == OpFns[j]) { - printd("%22s ", opNames[j]); -+ printd(" %23s", opNames[j]); ++ printd(" %*s", (int)opLen, opNames[j]); if (j == OP_PUSH_SYM || j == OP_ASSIGN) { Symbol *sym = inst[i+1].sym; - printd("%s", sym->name); @@ -268,7 +278,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c #endif /* #ifdef DEBUG_DISASSEMBLER */ #ifdef DEBUG_STACK /* for run-time stack dumping */ -@@ -3914,11 +3940,11 @@ static void stackdumpInternal(int n, int +@@ -3914,11 +3949,11 @@ static void stackdumpInternal(int n, int printd("--------------Stack base--------------\n"); #else if (outpt < TheStack) diff --git a/core-typeof-syntax.patch b/core-typeof-syntax.patch index 9cff020..f3ebbe2 100644 --- a/core-typeof-syntax.patch +++ b/core-typeof-syntax.patch @@ -158,9 +158,9 @@ diff --quilt old/source/interpret.c new/source/interpret.c + "TYPEOF_OUT", /* typeOfOut */ }; int i, j; + static size_t opLen; - for (i = 0; i < nInstr; ++i) { - printd("Prog %8p", &inst[i]); + if (!opLen) { diff --quilt old/source/interpret.h new/source/interpret.h --- old/source/interpret.h +++ new/source/interpret.h diff --git a/extend-for-key-in-array-syntax.patch b/extend-for-key-in-array-syntax.patch index 65fb066..66bdd93 100644 --- a/extend-for-key-in-array-syntax.patch +++ b/extend-for-key-in-array-syntax.patch @@ -192,10 +192,10 @@ diff --quilt old/source/interpret.c new/source/interpret.c + "ARRAY_ITER_KEYVAL", /* arrayIterKeyVal */ }; int i, j; + static size_t opLen; - for (i = 0; i < nInstr; ++i) { - printd("Prog %8p", &inst[i]); -@@ -3803,11 +3945,12 @@ static void disasmInternal(Inst *inst, i + if (!opLen) { +@@ -3812,11 +3954,12 @@ static void disasmInternal(Inst *inst, i } else if (j == OP_SUBR_CALL_STACKED_N) { printd(" %s args[] (?)", inst[i+1].sym->name); @@ -209,7 +209,7 @@ diff --quilt old/source/interpret.c new/source/interpret.c } else if (j == OP_ARRAY_ITER) { printd(" %s = %s++ end-loop=(%+d) %8p", -@@ -3815,10 +3958,19 @@ static void disasmInternal(Inst *inst, i +@@ -3824,10 +3967,19 @@ static void disasmInternal(Inst *inst, i inst[i+2].sym->name, inst[i+3].value, &inst[i+3] + inst[i+3].value); diff --git a/extend-if-key-in-array-syntax.patch b/extend-if-key-in-array-syntax.patch index 9f762f9..98a8264 100644 --- a/extend-if-key-in-array-syntax.patch +++ b/extend-if-key-in-array-syntax.patch @@ -88,10 +88,10 @@ diff --quilt old/source/interpret.c new/source/interpret.c + "ARRAY_INDEX", /* arrayIndex */ }; int i, j; + static size_t opLen; - for (i = 0; i < nInstr; ++i) { - printd("Prog %8p", &inst[i]); -@@ -3782,11 +3820,12 @@ static void disasmInternal(Inst *inst, i + if (!opLen) { +@@ -3791,11 +3829,12 @@ static void disasmInternal(Inst *inst, i else if (j == OP_ARRAY_REF || j == OP_ARRAY_DELETE || j == OP_ARRAY_ASSIGN || -- 2.11.4.GIT