Annotation of OpenXM/src/kan96xx/Kan/stackm.h, Revision 1.11
1.11 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/stackm.h,v 1.10 2005/06/15 02:22:51 takayama Exp $ */
1.1 maekawa 2: #define LOAD_SM1_PATH "/usr/local/lib/sm1/"
3: /* Do not forget to put / at the tail.
4: "/usr/local/lib/sm1" does not work.
5: */
6:
7:
8: /******************* stackm.h ******************************/
9: #include <setjmp.h>
10:
11:
12:
13: /**** data types (class identifiers) ************/
14: /* Never change the following orders.
15: If you add a new class, add that class at the bottom and give the
16: max number. */
17: #define Snull 0
18: #define Sinteger 1 /* integer */
19: #define Sstring 2 /* pointer to a string */
20: #define SexecutableArray 3 /* executable array */
21: #define Soperator 4 /* operators defined in the system dic */
22: #define Sdollar 5 /* pointer to a string obtained from $...$ */
23: #define Sarray 6 /* lc.ival is the size of array,
24: (rc.op)[0], ..., (rc.op)[k] is the array
25: of object */
26: #define SleftBraceTag 7 /* [ */
27: #define SrightBraceTag 8 /* ] */
28: #define Spoly 9
29: #define SarrayOfPOLY 10
30: #define SmatrixOfPOLY 11
31: #define Slist 12 /* list of object */
32: #define Sfile 13
33: #define Sring 14
34: #define SuniversalNumber 15
35: #define SrationalFunction 16
36: #define Sclass 17 /* class, for extension */
37: #define Sdouble 18
1.8 takayama 38: #define SbyteArray 19
1.1 maekawa 39:
1.8 takayama 40: #define TYPES 20 /* number of data types. */
1.1 maekawa 41: /* NOTE! If you change the above, you need to change mklookup.c too. */
42: /* Change also dr.sm1 : datatype constants. */
43:
44: #define CMO 1024 /* cf. plugin cmo.h. Object tag used in cmo. */
45: /* CMO --- CMO+1024*3
46: CMO + LARGEID ( cf.cmo.h ) --- CMO + LARGEID+256
47: CMO + PRIVATEID ( cf.cmo.h ) --- CMO + PRIVATEID+256
48: are reserved area.
49: */
50:
51: typedef struct object * objectp;
52: /*********** fundamental data types ****************/
53: union cell {
54: int ival;
55: char *str;
56: struct object *op;
57: POLY poly;
58: struct arrayOfPOLY *arrayp;
59: struct matrixOfPOLY *matrixp;
60: struct tokens *tokenArray;
61: FILE *file;
62: struct ring *ringp;
63: struct coeff *universalNumber;
64: void *voidp;
65: double *dbl;
1.8 takayama 66: unsigned char *bytes;
1.1 maekawa 67: };
68:
69: struct object{
70: int tag; /* class identifier */
71: union cell lc; /* left cell */
72: union cell rc; /* right cell */
1.10 takayama 73: struct object *attr; /* Attribute list. See misc-2005/06/gfan/test1.sm1
74: as to performance test. */
1.1 maekawa 75: };
1.11 ! takayama 76:
! 77: #define OINIT { .attr = NULL}
1.1 maekawa 78:
79: struct dictionary {
80: char *key;
81: int h0; /* Value of hash functions */
82: int h1;
83: struct object obj;
84: int attr;
85: };
86:
87: struct operandStack {
88: struct object *ostack;
89: int sp;
90: int size;
91: };
92:
93: struct context {
94: struct dictionary *userDictionary;
95: struct context *super;
96: char *contextName;
97: struct operandStack *mystack; /* It is not used for now. */
98: };
99:
100: /* for the scanner */
101: typedef enum {INIT,GET,PUT,OPEN} actionType;
102:
103: struct tokens{
104: char *token;
105: int kind;
106: struct object object;
1.6 takayama 107: int tflag;
1.1 maekawa 108: };
109:
110: /* used in kind of tokens */
111: #define ID 2
112: #define DOLLAR 3 /* strings enclosed by dollar sign */
113: #define EXECUTABLE_STRING 4 /* strings enclosed by {} */
114: #define EXECUTABLE_ARRAY 8
115:
1.6 takayama 116: /* Used in tflag of tokens, bit wise */
117: #define NO_DELAY 0x2
1.1 maekawa 118:
119:
120: /********** macros to use Sarray **********************/
121: /* put to Object Array */
122: #define putoa(ob,i,cc) {\
123: if ((ob).tag != Sarray) {fprintf(stderr,"Warning: PUTOA is for an array of objects\n");} else \
124: {if ((0 <= (i)) && ((i) < (ob).lc.ival)) {\
125: (ob.rc.op)[i] = cc;\
126: }else{\
127: fprintf(stderr,"Warning: PUTOA, the size is %d.\n",(ob).lc.ival);\
128: }}}
129:
130: #define getoa(ob,i) ((ob.rc.op)[i])
131:
132: #define getoaSize(ob) ((ob).lc.ival)
133:
134: #define isObjectArray(ob) ((ob).tag == Sarray)
135:
136: #define isDollar(ob) ((ob).tag == Sdollar)
137:
138: /******** macros for lists ************/
139: #define isNullList(list) ((struct object *)NULL == list)
140: #define NULLLIST (struct object *)NULL
141:
1.5 takayama 142: /* For dictionary, flag bit */
1.1 maekawa 143: #define SET_ATTR_FOR_ALL_WORDS 0x10
1.7 takayama 144: #define OR_ATTR_FOR_ALL_WORDS 0x20
1.1 maekawa 145: #define PROTECT 0x1
146: #define ABSOLUTE_PROTECT 0x2
1.4 takayama 147: #define ATTR_INFIX 0x4
1.5 takayama 148: #define ATTR_EXPORT 0x8
1.3 takayama 149:
1.5 takayama 150: /* For status, flag bit */
1.4 takayama 151: #define STATUS_EOF -1
152: #define STATUS_BREAK 0x1
153: #define STATUS_INFIX 0x2
154: #define DO_QUOTE 0x10
1.1 maekawa 155:
156: typedef enum {CCPUSH,CCPOP,CCRESTORE} actionOfContextControl;
157:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>