[BACK]Return to d.h CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097

Annotation of OpenXM/src/k097/d.h, Revision 1.3

1.3     ! takayama    1: /* $OpenXM: OpenXM/src/k097/d.h,v 1.2 2000/01/21 03:01:25 takayama Exp $ */
1.1       maekawa     2: /* d.h;*/
                      3: /*  from stackm.h */
                      4:
                      5: /**** data types (class identifiers) ************/
                      6: #define Snull             0
                      7: #define Sinteger          1     /* integer */
                      8: #define Sstring           2     /* pointer to a string */
                      9: #define SexecutableArray  3     /* executable array */
                     10: #define Soperator         4     /* operators defined in the system dic */
                     11: #define Sdollar           5     /* pointer to a string obtained from $...$ */
                     12: #define Sarray            6     /* lc.ival is the size of array,
                     13:                                   (rc.op)[0], ..., (rc.op)[k] is the array
                     14:                                   of object */
                     15: #define SleftBraceTag    7     /* [ */
                     16: #define SrightBraceTag   8     /* ] */
                     17: #define Spoly            9
                     18: #define SarrayOfPOLY     10
                     19: #define SmatrixOfPOLY    11
                     20: #define Slist            12   /* list of object */
                     21: #define Sfile            13
                     22: #define Sring            14
                     23: #define SuniversalNumber 15
                     24: #define SrationalFunction 16
                     25: #define Sclass          17   /* class, for extension */
                     26: #define Sdouble         18
                     27:
                     28: #define TYPES            19   /* number of data types. */
                     29: /* NOTE! If you change the above, you need to change mklookup.c too. */
                     30: /* Change also dr.sm1 : datatype constants. */
                     31:
                     32: /* The following tags are not in stackm.h, but we use them. */
                     33: #define CLASSNAME_CONTEXT 258
                     34:
                     35:
                     36: /*********** fundamental data types ****************/
                     37: union cell {
                     38:   int ival;
                     39:   char *str;
                     40:   struct Object *op;
                     41:   FILE *file;
                     42:   struct stringBuf *sbuf;
                     43:   void *voidp;
                     44: };
                     45:
                     46: struct Object{
                     47:   int tag;                /* class identifier */
                     48:   union cell lc;          /* left cell */
                     49:   union cell rc;          /* right cell */
                     50: };
                     51:
                     52: struct object{         /* must be compatible with stackm.h */
                     53:   int tag;                /* class identifier */
                     54:   union cell lc;          /* left cell */
                     55:   union cell rc;          /* right cell */
                     56: };
                     57:
                     58: typedef struct Object * objectp;   /* cf. 65p of Schreiner. */
                     59: #define YYSTYPE objectp
                     60:
                     61:
                     62: struct stringBuf {
                     63:   char *str;
                     64:   int limit;
                     65:   int ptr;
                     66: };
                     67:
                     68: struct object Sm1obj;
                     69:
                     70: /*  for dic.c */
                     71: struct dictionary {
                     72:   char *key;
                     73:   int h0; /* Value of hash functions */
                     74:   int h1;
                     75:   objectp obj;
                     76:   int attr;
                     77: };
                     78: struct operandStack {
                     79:   objectp *ostack;
                     80:   int sp;
                     81:   int size;
                     82: };
                     83: struct context {
                     84:   struct dictionary *userDictionary;
                     85:   struct context *super;
                     86:   char *contextName;
                     87:   struct operandStack *mystack; /* It is not used for now. */
                     88: };
                     89: #define USER_DICTIONARY_SIZE   1223
                     90: /* The value of USER_DICTIONARY_SIZE must be prime number, because of hashing
                     91:    method */
                     92: #define EMPTY (char *)NULL
                     93: #define SET_ATTR_FOR_ALL_WORDS 0x10
                     94: #define PROTECT 0x1
                     95: #define ABSOLUTE_PROTECT 0x2
                     96: typedef enum {CCPUSH,CCPOP,CCRESTORE} actionOfContextControl;
                     97: #define CSTACK_SIZE 1000
                     98: typedef enum {IRESET,IPUT,IEXIT} actionOfPutIncetanceVariable;
                     99:
                    100: /* ki.c or dm.c */
                    101: void pkkan(char *s);
                    102: void pkkanInteger(int k);
                    103: void pkdebug(char *s0,char *s1,char *s2,char *s3);
                    104: void pkdebug2(void);
                    105: char *readstring();
                    106: char *newString(int size);
                    107:
                    108: /* object handling */
                    109: objectp newObject_d();
                    110: void printObject_d(FILE *fp,objectp op);
                    111: void printObjectSymbol(objectp op);
                    112: char *objectSymbolToString(objectp op);
                    113: int K00objectToInteger(objectp op);
                    114: objectp K00integerToObject(int k);
                    115: objectp K00contextToObject(struct context *cp);
                    116: struct context *K00objectToContext(objectp op);
                    117: objectp ooAdd(objectp a,objectp b);
                    118: objectp ooMult(objectp a,objectp b);
                    119:
                    120: /* memory */
                    121: void *mymalloc(int size);
                    122:
                    123: /* protection of symbols */
                    124: int isProtectedSymbol(char *s);
                    125: int ips(objectp op);
                    126: /* read from file */
                    127: void parseAFile(FILE *fp);
                    128: void parseAstring(char *s);
                    129: int fsgetc(objectp op);
                    130: int fsungetc(int c,objectp op);
                    131: void readLineFromFile(FILE *fp,struct stringBuf *obuf);
                    132: struct stringBuf *newStringBuf(char *initstr);
                    133: void doublingStringBuf(struct stringBuf *sbuf);
1.3     ! takayama  134: objectp checkIfTheFileExists(objectp name);
1.1       maekawa   135: void loadFile(objectp op);
                    136: void loadFileWithCpp(objectp op);
                    137: void showStringBuff(objectp op);
                    138: char *getLOAD_K_PATH();
                    139: void clearInop();
                    140:
                    141: struct object KSpop();
                    142: void testNewFunction(objectp op);
                    143:
                    144: /*  Dictionary and context handling. dic.c */
                    145: int K00putUserDictionary(char *str,int h0,int h1,objectp ob,
                    146:                         struct context *cp);
                    147: int K00putUserDictionary2(char *str,int h0,int h1, int attr,
                    148:                         struct context *cp);
                    149: objectp K00findUserDictionary(char *str,int h0,int h1,struct context *cp);
                    150: objectp K00findUserDictionary0(char *str,int h0,int h1,struct context *cp);
                    151: int K00hash0(char *str);
                    152: int K00hash1(char *str);
                    153: void K00hashInitialize(struct dictionary *dic);
                    154: void K00fprintContext(FILE *fp,struct context *cp);
                    155: void K00fprintContextAndDictionary(FILE *fp,struct context *cp);
                    156: struct context *K00newContext0(struct context *super,char *name);
                    157: void K00contextControl(actionOfContextControl ctl);
                    158: char *K00getCurrentContextName();
                    159: void K00InitDic();
                    160: void K00errorDic(char *s);
                    161:
                    162: /* name space control */
                    163: int K00putIncetanceVariable(actionOfPutIncetanceVariable action,char *s);
                    164: int K00getIncetanceVariable(char *s);
                    165: void K00recoverFromError();
                    166: int K00declareClass(char *name,char *supername);
                    167: void K00toPrimitiveClass();
                    168:
                    169:
                    170:
                    171:
                    172:
                    173:

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