]> thyrsus.com Git - cupl.git/commitdiff
No more nodetype.h file.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 11 Nov 1994 21:46:57 +0000 (21:46 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 11 Nov 1994 21:46:57 +0000 (21:46 +0000)
Makefile
cupl.h
execute.c
interpret.c

index 559c1a95ea55bded03faf71c7c3565f66b0bbbaa..581aaac439c66017c5386375257930f37361b5af 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,8 +26,8 @@ grammar.o: grammar.c cupl.h
 tokdump.o: tokdump.c toktab.h
 lexer.o: lexer.c tokens.h cupl.h
 interpret.o: interpret.c tokens.h cupl.h
-interpret.o: interpret.c tokens.h nodetype.h cupl.h
-execute.o: execute.c tokens.h nodetype.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
diff --git a/cupl.h b/cupl.h
index 54835d9b8acf7f24c04540bf9efe0f50a5f71f53..1d02d7b7ab3b52afba002117ae6d5c89af5448ed 100644 (file)
--- a/cupl.h
+++ b/cupl.h
@@ -65,6 +65,9 @@ node;
 
 #define        NULLNODE        (node *)NULL
 
+#define car    u.n.left
+#define cdr    u.n.right
+
 #define for_cdr(x, t)    for (x = (t); x; x = x->u.n.right)
 
 /* this structure represents a CUPL value */
index d35f789458d8194f40d9c5d3635e55e8fc9df843..d1bb5aba282b4e9cd6f550d17f69d11fb56d8d53 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -641,9 +641,7 @@ void execute(node *tree)
     }
 
     /* break the link to the data */
-    if (!data)
-       warn("no data supplied\n");
-    else if (last)
+    if (data && last)
        last->cdr = cons(END, NULLNODE, NULLNODE);
 
     /* first, setjmp so we can use STOP to exit */
index ecde385606989417182ad8ea00eeb668d3e1affd..fd7c1d1f4dd4a0d034072e22436aab1c2c1803f5 100644 (file)
@@ -19,7 +19,31 @@ differently if we get a compiler back end.
 #include <stdio.h>
 #include "cupl.h"
 #include "tokens.h"
-#include "nodetype.h"
+
+/* nodetype.h -- macros that describe the semantics of nodes */
+
+/*
+ * Define token classes for consistency checks here.  The theory is
+ * that by separating this from the tree-traversal machinery below, we
+ * may be able to parametrize for different source languages someday.
+ */
+/* does the node represent an atom? */
+#define ATOMIC(n)      ((n) == IDENTIFIER || (n) == NUMBER || (n) == STRING)
+/* does the node reference a statement label? */
+#define SLABELREF(n)   ((n) == GO || (n) == OG)
+/* does the node reference a block label? */
+#define BLABELREF(n)   ((n) == PERFORM)
+/* does the node set a variable? */
+#define VARSET(n)      ((n) == LET || (n) == READ || (n) == ITERATE)
+/* does the (non-VARSET) node refer to its left operand as a variable? */ 
+#define LEFTREF(n)     ((n) != FOR && (n) != GO && (n) != OG && (n) != LABEL \
+                               && (n) != ALLOCATE && (n) != WATCH \
+                               && (n) != ITERATE && (n) != FROM \
+                               && (n) != PERFORM)
+/* does the (non-VARSET) node refer to its right operand? */
+#define RIGHTREF(n)    ((n) != PERFORM)
+
+/* nodetype.h ends here */
 
 #ifdef PARSEDEBUG
 /*