]> thyrsus.com Git - cupl.git/commitdiff
Four debug levels.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 10 Nov 1994 19:30:39 +0000 (19:30 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 10 Nov 1994 19:30:39 +0000 (19:30 +0000)
cupl.h
cupl.xml
execute.c
interpret.c

diff --git a/cupl.h b/cupl.h
index 8c8aee449925a63997ced1f78c327ca9723a2ee5..e8b5d52edb9297fd2f3fb8c71210055d39bb4a43 100644 (file)
--- a/cupl.h
+++ b/cupl.h
@@ -162,6 +162,7 @@ extern bool cupl_ge(value, value);
 
 #define DEBUG_PARSEDUMP        1
 #define DEBUG_CHECKDUMP        2
-#define DEBUG_ALLOCATE 3
+#define DEBUG_EXECUTE  3
+#define DEBUG_ALLOCATE 4
 
 /* cupl.h ends here */
index b5477596794ce817b07ae9d2db0b3de46b9cb16a..448faaed8000abf4903643f1e61044fa4f4b5a38 100644 (file)
--- a/cupl.xml
+++ b/cupl.xml
@@ -96,3 +96,19 @@ at field-width precision.
 Also, by default, we wrap after three 20-char fields rather than 6, so
 as to fit on an 80-column line.  Command-line options to change the
 line and field widths are available.
+.P
+.H 1 "Command-line options"
+.P
+The -w options sets the line width (default 80).
+.P
+The -f option sets the field width (default 20).
+.P
+The -v option enables debugging output.  At level 1, the parse tree is
+prettyprinted.  At level 2, definition/reference counts for each
+variable and label are printed after each run.  At level 3, an
+execution trace is displayed as the parse tree is printed.  At level
+4, each token intern and cons-cell allocation during parsing is also
+dumped.
+
+
+
index 899cbf7ec432abda778587948b1b5a7eebb211ff..71b0238c936be72a4bcd07563462852e44b96353 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -128,7 +128,7 @@ static void eval_write(node *tp)
 static void display_return(node *tree, node *left, node *right, value v)
 /* display the returned value of a node (for tracing purposes) */
 {
-    if (verbose >= DEBUG_ALLOCATE)
+    if (verbose >= DEBUG_EXECUTE)
     {
        (void) printf("eval returns: %x (%-10s of %9x, %9x) ",
                      tree, tokdump(tree->type), left, right);
@@ -164,7 +164,7 @@ static value cupl_eval(node *tree)
     int                n;
     jmp_buf    jmpperf;
 
-    if (verbose >= DEBUG_ALLOCATE)
+    if (verbose >= DEBUG_EXECUTE)
        (void) printf("eval begins:  %x (%-10s of %9x, %9x)\n",
                      tree, tokdump(tree->type), tree->car, tree->cdr);
 
index f377be6230731e0bc978ac7d1712f1c50e9b8b0b..36568197d13af9e92f6583181596e14463aa096c 100644 (file)
@@ -297,7 +297,19 @@ static void rewrite(node *tree)
     /* first, make a pointer from each label to its destination statement */
     for_cdr(np, tree)
        if (np->car->type == LABEL)
-           np->car->car->syminf->target = np;
+           switch (np->car->cdr->type)
+           {
+           case END:
+               break;
+
+           case BLOCK:
+               np->car->car->syminf->target = np;
+               break;
+
+           default:
+               np->car->car->syminf->target = np;
+               break;
+           }
 
     /* figure end addresses */
     for_cdr(np, tree)