}
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);
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 *);
#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;