]> thyrsus.com Git - cupl.git/commitdiff
There is now a monitor module.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 3 Nov 1994 23:29:19 +0000 (23:29 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 3 Nov 1994 23:29:19 +0000 (23:29 +0000)
Makefile
READ.ME
cupl.h
interpret.c

index d8b9254b2c02bc0e7f2287d72dff3eaf792e5cb7..01c14230b2706a1114836237430559dd7f2e9b7e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,10 +6,11 @@ CDEBUG = -g
 YFLAGS = -vlt
 CFLAGS = $(CDEBUG) -D_POSIX_SOURCE -DYYDEBUG=1 -DPARSEDEBUG
 
-SOURCES = cupl.[ylh] tokdump.c main.c interpret.c execute.c
+SOURCES = cupl.[ylh] tokdump.c main.c interpret.c execute.c monitor.c
 
-cupl: main.o grammar.o lexer.o interpret.o tokdump.o execute.o
-       $(CC) main.o grammar.o lexer.o interpret.o tokdump.o execute.o -o cupl
+MODULES = main.o grammar.o lexer.o interpret.o tokdump.o execute.o monitor.o
+cupl: $(MODULES)
+       $(CC) $(MODULES) -o cupl
 
 lexer.c: cupl.l
        lex $(LFLAGS) cupl.l
@@ -27,6 +28,7 @@ lexer.o: lexer.c tokens.h cupl.h
 interpret.o: interpret.c tokens.h cupl.h
 interpret.o: interpret.c tokens.h cupl.h
 execute.o: execute.c tokens.h cupl.h
+monitor.o: monitor.c tokens.h cupl.h
 
 toktab.h: tokens.h
        awk <tokens.h >toktab.h '/^#/ {print $$3 ", \"" $$3 "\","}'
diff --git a/READ.ME b/READ.ME
index 7d2f09b8a6c5a7e4745da22c2760f3e21ce90ed1..10221fc1c901225194d64aace71f1387b87ffd8f 100644 (file)
--- a/READ.ME
+++ b/READ.ME
@@ -38,6 +38,7 @@ cupl.h                        -- fundamental types and defines
 tokdump.c              -- token-dumper code (used for debugging)
 interpret.c            -- parse tree interpretation
 execute.c              -- actual execution
+monitor.c              -- runtime support
 main.c                 -- cupl's main sequence
 
                        CUPL samples
diff --git a/cupl.h b/cupl.h
index 02277e05af74320015ae9c6f6ba110fb2e3f59ff..25b6f3dcaf12ec6224a28ea5c28915cd3569b1cf 100644 (file)
--- a/cupl.h
+++ b/cupl.h
@@ -94,12 +94,19 @@ extern lvar *idlist;
 
 #define NOMEM  "out of memory\n"
 
+/* miscellaneous */
 extern char *tokdump(int value);
 extern void yyerror(const char *errmsg);
 extern void interpret(node *tree);
-extern void execute(node *tree);
 extern int verbose;
 
+/* execute.c */
+extern void execute(node *tree);
+
+/* monitor.c */
+extern void die(char *msg, ...);
+extern void warn(char *msg, ...);
+
 #define DEBUG_PARSEDUMP        1
 #define DEBUG_CHECKDUMP        2
 #define DEBUG_ALLOCATE 3
index 33cb6c776e285d6d83f444e8365fe17683a0e707..d993deb30843a4700ee951ef7750ab393683aafd 100644 (file)
@@ -13,7 +13,6 @@ of a CUPL parse tree.  Actual execution is handed off to execute().
 *****************************************************************************/
 /*LINTLIBRARY*/
 #include <stdio.h>
-#include <stdarg.h>
 #include "cupl.h"
 #include "tokens.h"
 
@@ -91,28 +90,6 @@ static void prettyprint(node *tree, int indent)
 }
 #endif /* PARSEDEBUG */
 
-static void warn(char *msg, ...)
-/* warn of an error and die */
-{
-    va_list    args;
-
-    va_start(args, msg);
-    vfprintf(stderr, msg, args);
-    va_end(args);
-}
-
-static void die(char *msg, ...)
-/* complain of a fatal error and die */
-{
-    va_list    args;
-
-    va_start(args, msg);
-    vfprintf(stderr, msg, args);
-    va_end(args);
-
-    exit(1);
-}
-
 static bool recursive_apply(node *tree, bool (*fun)(node *))
 /* apply fun recursively to tree, short-circuiting on FALSE return */
 {
@@ -365,7 +342,6 @@ static void rewrite(node *tree)
 
     /* now, hack label references to eliminate name references */
     recursive_apply(tree, r_label_rewrite);
-
 }
 
 void interpret(node *tree)