#ifndef TOKEN_H #define TOKEN_H #include #include #include "func.h" #include "style.h" #ifdef __cplusplus extern "C" { #endif /* TO PRESERVE ABILITY TO READ OLD SAVE FILES, ONLY ADD ITEMS AT END */ typedef enum { EMPTY #ifndef __cplusplus , STRING, FLOAT, INT, OPERATOR, LIDENT, FIDENT, LOCATION, EEK, FUNCALL, BOOL, STYLE #endif } Type; #define MAX_TYPE_NAME_LENGTH 16 extern const char *Type_Name[]; typedef enum { PLUS, MINUS, MUL, DIV, OP, CP, COMMA, LT, /* Take care with the macros just below */ LE, GE, GT, ISEQUAL, ABOUTEQ, NE, POW, MOD, LAND, LOR } Operator; #define MAX_OP_NAME_LENGTH 3 #define IS_RELATION_OP(op) (((op)>= LT) && ((op)<=NE)) extern const char *Op_Name[]; typedef enum { X=0, Y=1, Z=2, HYPER} Dimensions; typedef int CoordT; #define COORD_MIN INT_MIN #define COORD_MAX INT_MAX typedef CoordT Location[HYPER]; /* NOTE: Locations are passed by REFERENCE not value */ #define OLOCATION(loc) ((void)memset(loc, 0, sizeof(Location))) #define IN_OCTANT(loc) (loc[X]>=0 && loc[Y]>=0 && loc[Z]>=0) #define LOCATION_GETS(la,lb) ((void)memcpy(la, lb, sizeof(Location))) #define SAME_LOC(la,lb) (memcmp(la,lb,sizeof(Location))==0) #define LOCATION_SUB(la,lb) (la)[X]-=(lb)[X], (la)[Y]-=(lb)[Y], (la)[Z]-=(lb)[Z] #define LOCATION_ADD(la,lb) (la)[X]+=(lb)[X], (la)[Y]+=(lb)[Y], (la)[Z]+=(lb)[Z] #define LOCATION_LT(la,lb) (la[X]