Annotation of OpenXM/src/kan96xx/Kan/stackm.h, Revision 1.5
1.5 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/stackm.h,v 1.4 2004/09/11 12:13:41 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
38:
39: #define TYPES 19 /* number of data types. */
40: /* NOTE! If you change the above, you need to change mklookup.c too. */
41: /* Change also dr.sm1 : datatype constants. */
42:
43: #define CMO 1024 /* cf. plugin cmo.h. Object tag used in cmo. */
44: /* CMO --- CMO+1024*3
45: CMO + LARGEID ( cf.cmo.h ) --- CMO + LARGEID+256
46: CMO + PRIVATEID ( cf.cmo.h ) --- CMO + PRIVATEID+256
47: are reserved area.
48: */
49:
50: typedef struct object * objectp;
51: /*********** fundamental data types ****************/
52: union cell {
53: int ival;
54: char *str;
55: struct object *op;
56: POLY poly;
57: struct arrayOfPOLY *arrayp;
58: struct matrixOfPOLY *matrixp;
59: struct tokens *tokenArray;
60: FILE *file;
61: struct ring *ringp;
62: struct coeff *universalNumber;
63: void *voidp;
64: double *dbl;
65: };
66:
67: struct object{
68: int tag; /* class identifier */
69: union cell lc; /* left cell */
70: union cell rc; /* right cell */
71: };
72:
73: struct dictionary {
74: char *key;
75: int h0; /* Value of hash functions */
76: int h1;
77: struct object obj;
78: int attr;
79: };
80:
81: struct operandStack {
82: struct object *ostack;
83: int sp;
84: int size;
85: };
86:
87: struct context {
88: struct dictionary *userDictionary;
89: struct context *super;
90: char *contextName;
91: struct operandStack *mystack; /* It is not used for now. */
92: };
93:
94: /* for the scanner */
95: typedef enum {INIT,GET,PUT,OPEN} actionType;
96:
97: struct tokens{
98: char *token;
99: int kind;
100: struct object object;
101: };
102:
103: /* used in kind of tokens */
104: #define ID 2
105: #define DOLLAR 3 /* strings enclosed by dollar sign */
106: #define EXECUTABLE_STRING 4 /* strings enclosed by {} */
107: #define EXECUTABLE_ARRAY 8
108:
109:
110:
111: /********** macros to use Sarray **********************/
112: /* put to Object Array */
113: #define putoa(ob,i,cc) {\
114: if ((ob).tag != Sarray) {fprintf(stderr,"Warning: PUTOA is for an array of objects\n");} else \
115: {if ((0 <= (i)) && ((i) < (ob).lc.ival)) {\
116: (ob.rc.op)[i] = cc;\
117: }else{\
118: fprintf(stderr,"Warning: PUTOA, the size is %d.\n",(ob).lc.ival);\
119: }}}
120:
121: #define getoa(ob,i) ((ob.rc.op)[i])
122:
123: #define getoaSize(ob) ((ob).lc.ival)
124:
125: #define isObjectArray(ob) ((ob).tag == Sarray)
126:
127: #define isDollar(ob) ((ob).tag == Sdollar)
128:
129: /******** macros for lists ************/
130: #define isNullList(list) ((struct object *)NULL == list)
131: #define NULLLIST (struct object *)NULL
132:
1.5 ! takayama 133: /* For dictionary, flag bit */
1.1 maekawa 134: #define SET_ATTR_FOR_ALL_WORDS 0x10
135: #define PROTECT 0x1
136: #define ABSOLUTE_PROTECT 0x2
1.4 takayama 137: #define ATTR_INFIX 0x4
1.5 ! takayama 138: #define ATTR_EXPORT 0x8
1.3 takayama 139:
1.5 ! takayama 140: /* For status, flag bit */
1.4 takayama 141: #define STATUS_EOF -1
142: #define STATUS_BREAK 0x1
143: #define STATUS_INFIX 0x2
144: #define DO_QUOTE 0x10
1.1 maekawa 145:
146: typedef enum {CCPUSH,CCPOP,CCRESTORE} actionOfContextControl;
147:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>