home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * value.h
- * Copyright © 1992 Niklas Röjemo
- */
-
- #ifndef _value_h
- #define _value_h
-
- #ifndef _global_h
- #include "global.h"
- #endif
-
- typedef struct SYMBOL; /* Cannot include symbol.h as it needs value.h */
-
- typedef union CODE;
-
- typedef struct LATEINFO {
- struct LATEINFO *next;
- int factor;
- struct SYMBOL *symbol;
- } LateInfo;
-
- typedef enum {
- ValueIllegal = 0,
- ValueInt = 1,
- ValueFloat = 2,
- ValueString = 4,
- ValueBool = 8,
- ValueCode = 16,
- ValueLateLabel = 32
- } ValueTag;
-
- #define ValueAll (ValueInt|ValueFloat|ValueString|ValueBool|ValueCode|ValueLateLabel)
-
- typedef union {
- ValueTag Tag;
- struct { /* ValueInt */
- ValueTag Tag;
- int i;
- } ValueInt;
- struct { /* ValueFloat */
- ValueTag Tag;
- FLOAT f;
- } ValueFloat;
- struct { /* ValueString */
- ValueTag Tag;
- int len;
- char *s;
- } ValueString;
- struct { /* ValueBool */
- ValueTag Tag;
- BOOL b;
- } ValueBool;
- struct { /* ValueCode */
- ValueTag Tag;
- int len;
- union CODE *c;
- } ValueCode;
- struct { /* ValueLateLabel */
- ValueTag Tag; /* Must start identical with ValueInt */
- int i;
- struct LATEINFO *late;
- } ValueLate;
- } Value;
-
- Value valueLateToCode(int offset,LateInfo *late);
- Value valueCopy(Value value);
- int valueEqual(Value *a, Value *b);
- #endif
-