From: Eric S. Raymond Date: Wed, 2 Nov 1994 22:29:21 +0000 (+0000) Subject: Make the ID list accessible to the interpreter. X-Git-Tag: 1-2~111 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=9da25db5bf8b9d33b179f41a5d83040cbbf7bf3e;p=cupl.git Make the ID list accessible to the interpreter. --- diff --git a/cupl.h b/cupl.h index 728dc62..447e0cb 100644 --- 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 8504ff8..b81cef1 100644 --- a/cupl.l +++ b/cupl.l @@ -11,15 +11,6 @@ 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 *); diff --git a/interpret.c b/interpret.c index 503bccf..ee81c7b 100644 --- a/interpret.c +++ b/interpret.c @@ -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;