From d866d22a6cf83b034aee392428b67d13850ff40b Mon Sep 17 00:00:00 2001 From: "Joshua J. Cogliati" Date: Mon, 26 Sep 2022 20:54:36 -0600 Subject: [PATCH 1/5] Adding comment on how to use debugging. --- eval.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eval.c b/eval.c index 64ebe7e..a04cba0 100644 --- a/eval.c +++ b/eval.c @@ -54,6 +54,10 @@ NODE #define USE_GCC_DISPATCH 1 #endif +/* Hint: + make "redefp "true + to get lots of output after defining DEBUGGING 1 +*/ #define DEBUGGING 0 #if DEBUGGING From ae1135a01ae64851785a819eb50de8f15b9328fa Mon Sep 17 00:00:00 2001 From: "Joshua J. Cogliati" Date: Tue, 4 Oct 2022 19:30:16 -0600 Subject: [PATCH 2/5] Add line number to debug print. --- eval.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eval.c b/eval.c index a04cba0..9e54381 100644 --- a/eval.c +++ b/eval.c @@ -92,14 +92,15 @@ void vs_print() { printf(", stopping_flag = %s\n", names[stopping_flag]); } -void debprint(char *name) { +void debprintline(int line, char *name) { if (!varTrue(Redefp)) return; - printf("%s: ", name); + printf("%d %s: ", line, name); do_debug(deb_enum) vs_print(); printf("current_unode=0x%x, output_unode=0x%x\n",current_unode, output_unode); } +#define debprint(name) debprintline(__LINE__, name) #define debprint2(a,b) if (varTrue(Redefp)) ndprintf(stdout,a,b) #else #define debprint(name) From 0d56ea89397d5c758160d132e5274e65f6dfa80b Mon Sep 17 00:00:00 2001 From: "Joshua J. Cogliati" Date: Tue, 27 Dec 2022 16:03:18 -0700 Subject: [PATCH 3/5] Make debug printing consistent. --- eval.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eval.c b/eval.c index 9e54381..490440c 100644 --- a/eval.c +++ b/eval.c @@ -79,25 +79,25 @@ void vs_print() { "MACRO_RETURN"}; if (!varTrue(Redefp)) return; - printf("Val_status = "); + ndprintf(stdout, "Val_status = "); for (i=0; i<6; i++) { if (vs&1) { - printf(vnames[i]); + ndprintf(stdout, vnames[i]); vs >>= 1; - if (vs != 0) printf("|"); + if (vs != 0) ndprintf(stdout, "|"); } else vs >>= 1; if (vs == 0) break; } - if (vs != 0) printf("0%o", vs<<6); - printf(", stopping_flag = %s\n", names[stopping_flag]); + if (vs != 0) ndprintf(stdout, "0%o", vs<<6); + ndprintf(stdout, ", stopping_flag = %s\n", names[stopping_flag]); } void debprintline(int line, char *name) { if (!varTrue(Redefp)) return; - printf("%d %s: ", line, name); + ndprintf(stdout, "%d %s: ", line, name); do_debug(deb_enum) vs_print(); - printf("current_unode=0x%x, output_unode=0x%x\n",current_unode, + ndprintf(stdout, "current_unode=0x%x, output_unode=0x%x\n\n",current_unode, output_unode); } #define debprint(name) debprintline(__LINE__, name) From 00c6946a21fc627331db1ce1601372166629537b Mon Sep 17 00:00:00 2001 From: "Joshua J. Cogliati" Date: Wed, 28 Dec 2022 10:44:48 -0700 Subject: [PATCH 4/5] Fixing print modifications. --- eval.c | 6 +++--- print.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eval.c b/eval.c index 490440c..5febb74 100644 --- a/eval.c +++ b/eval.c @@ -86,15 +86,15 @@ void vs_print() { vs >>= 1; if (vs != 0) ndprintf(stdout, "|"); } else vs >>= 1; - if (vs == 0) break; + if (vs == 0) break; } if (vs != 0) ndprintf(stdout, "0%o", vs<<6); - ndprintf(stdout, ", stopping_flag = %s\n", names[stopping_flag]); + ndprintf(stdout, ", stopping_flag = %t\n", names[stopping_flag]); } void debprintline(int line, char *name) { if (!varTrue(Redefp)) return; - ndprintf(stdout, "%d %s: ", line, name); + ndprintf(stdout, "%d %t: ", line, name); do_debug(deb_enum) vs_print(); ndprintf(stdout, "current_unode=0x%x, output_unode=0x%x\n\n",current_unode, diff --git a/print.c b/print.c index 4b35cdd..73aafa3 100644 --- a/print.c +++ b/print.c @@ -192,6 +192,11 @@ void ndprintf(FILE *strm, char *fmt, ...) { sprintf(buf,"%ld",i); cp = buf; while ((ch = *cp++) != '\0') print_char(strm,ch); + } else if (ch == 'x') { /* hexadecimal */ + i = va_arg(ap, int); + sprintf(buf,"%lx",i); + cp = buf; + while ((ch = *cp++) != '\0') print_char(strm,ch); } else { print_char(strm,'%'); print_char(strm,ch); From a82dba46a5d5ba73e2cba7e168dab003b3f5a03f Mon Sep 17 00:00:00 2001 From: "Joshua J. Cogliati" Date: Fri, 30 Dec 2022 10:07:11 -0700 Subject: [PATCH 5/5] Add newline to output. --- eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eval.c b/eval.c index 5febb74..13914a3 100644 --- a/eval.c +++ b/eval.c @@ -94,7 +94,7 @@ void vs_print() { void debprintline(int line, char *name) { if (!varTrue(Redefp)) return; - ndprintf(stdout, "%d %t: ", line, name); + ndprintf(stdout, "%d %t:\n", line, name); do_debug(deb_enum) vs_print(); ndprintf(stdout, "current_unode=0x%x, output_unode=0x%x\n\n",current_unode,