[BACK]Return to stackm.h CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Annotation of OpenXM/src/kan96xx/Kan/stackm.h, Revision 1.13

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>