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

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

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

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