From: Eric S. Raymond Date: Thu, 3 Nov 1994 23:29:19 +0000 (+0000) Subject: There is now a monitor module. X-Git-Tag: 1-2~80 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=79485f9c709f08d27415b42e55ede3932218ddb4;p=cupl.git There is now a monitor module. --- diff --git a/Makefile b/Makefile index d8b9254..01c1423 100644 --- 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 toktab.h '/^#/ {print $$3 ", \"" $$3 "\","}' diff --git a/READ.ME b/READ.ME index 7d2f09b..10221fc 100644 --- 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 02277e0..25b6f3d 100644 --- 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 diff --git a/interpret.c b/interpret.c index 33cb6c7..d993deb 100644 --- a/interpret.c +++ b/interpret.c @@ -13,7 +13,6 @@ of a CUPL parse tree. Actual execution is handed off to execute(). *****************************************************************************/ /*LINTLIBRARY*/ #include -#include #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)