]> thyrsus.com Git - cupl.git/commitdiff
Make the ID list accessible to the interpreter.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 2 Nov 1994 22:29:21 +0000 (22:29 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 2 Nov 1994 22:29:21 +0000 (22:29 +0000)
cupl.h
cupl.l
interpret.c

diff --git a/cupl.h b/cupl.h
index 728dc6230e4b8a4a12a4400b9c64f797bc500fdf..447e0cbed985f166df0b3e79c71a5b01cb322530 100644 (file)
--- a/cupl.h
+++ b/cupl.h
@@ -59,6 +59,18 @@ typedef struct edon
 }
 node;
 
+/* access to the symbol list */
+typedef struct lvar_t
+{
+    struct lvar_t      *next;
+    int                        refcount;
+    int                        setcount;
+    bool               islabel;
+    node               *node;
+}
+lvar;
+static lvar *idlist;
+
 #define NOMEM  "out of memory\n"
 
 extern char *tokdump(int value);
diff --git a/cupl.l b/cupl.l
index 8504ff86410b58950046564d1ccc81ac09df3ebb..b81cef1fad3f2329c82b42724573f294499c78d1 100644 (file)
--- a/cupl.l
+++ b/cupl.l
 
 extern char *strdup(const char *s);
 
-typedef struct lvar_t
-{
-    struct lvar_t      *next;
-    node               *node;
-}
-lvar;
-
-static lvar *idlist;
-
 static node *intern_number(char *);
 static node *intern_identifier(char *);
 static node *intern_string(char *);
index 503bccfc17821afda8ee713739853d867c496128..ee81c7b3b4933fce2caf90d48f5916e03dc2d1fa 100644 (file)
@@ -2,37 +2,30 @@
 #include "cupl.h"
 #include "tokens.h"
 
-/* this structure represents a CUPL variable */
-typedef struct rav
+/* this structure represents a CUPL value */
+typedef struct
 {
-    char       name[MAXNAME + 1];      /* name of variable */
     int                type;                   /* type (syntax class) */
-    int                rank;
+    int                rank;                   /* 0, 1, or 2 */
     union
     {
-       struct 
-       {
-           int length;
-           scalar      *parts;
-       } vector;               /* a vector */
+       scalar  scalar;
 
        struct 
        {
-           int width, depth;
-           scalar      *parts;
-       } matrix;               /* a matrix */
-
-       char    *string;
-
-       struct
-       {
-           long        lineno;         /* source line number */
-           long        addr;           /* label seek offset */
-           int         refcount;       /* count of JUMPS and PERFORM to it */
+           int         width, depth;
+           scalar      *elements;
        }
-       label;
-#define BAD_LABEL      -1L             /* out-of-band labeladdr value */
-    } v;
+       array;          /* a vector or matrix */
+    } u;
+}
+value;
+
+/* this structure represents a CUPL variable */
+typedef struct rav
+{
+    char       name[MAXNAME + 1];      /* name of variable */
+    value      value;
 }
 variable;