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