Annotation of OpenXM/src/k097/d.h, Revision 1.4
1.4 ! takayama 1: /* $OpenXM: OpenXM/src/k097/d.h,v 1.3 2000/12/10 02:21:45 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 */
1.4 ! takayama 50: struct object *attr;
1.1 maekawa 51: };
52:
53: struct object{ /* must be compatible with stackm.h */
54: int tag; /* class identifier */
55: union cell lc; /* left cell */
56: union cell rc; /* right cell */
1.4 ! takayama 57: struct object *attr;
1.1 maekawa 58: };
59:
60: typedef struct Object * objectp; /* cf. 65p of Schreiner. */
61: #define YYSTYPE objectp
62:
63:
64: struct stringBuf {
65: char *str;
66: int limit;
67: int ptr;
68: };
69:
70: struct object Sm1obj;
71:
72: /* for dic.c */
73: struct dictionary {
74: char *key;
75: int h0; /* Value of hash functions */
76: int h1;
77: objectp obj;
78: int attr;
79: };
80: struct operandStack {
81: objectp *ostack;
82: int sp;
83: int size;
84: };
85: struct context {
86: struct dictionary *userDictionary;
87: struct context *super;
88: char *contextName;
89: struct operandStack *mystack; /* It is not used for now. */
90: };
91: #define USER_DICTIONARY_SIZE 1223
92: /* The value of USER_DICTIONARY_SIZE must be prime number, because of hashing
93: method */
94: #define EMPTY (char *)NULL
95: #define SET_ATTR_FOR_ALL_WORDS 0x10
96: #define PROTECT 0x1
97: #define ABSOLUTE_PROTECT 0x2
98: typedef enum {CCPUSH,CCPOP,CCRESTORE} actionOfContextControl;
99: #define CSTACK_SIZE 1000
100: typedef enum {IRESET,IPUT,IEXIT} actionOfPutIncetanceVariable;
101:
102: /* ki.c or dm.c */
103: void pkkan(char *s);
104: void pkkanInteger(int k);
105: void pkdebug(char *s0,char *s1,char *s2,char *s3);
106: void pkdebug2(void);
107: char *readstring();
108: char *newString(int size);
109:
110: /* object handling */
111: objectp newObject_d();
112: void printObject_d(FILE *fp,objectp op);
113: void printObjectSymbol(objectp op);
114: char *objectSymbolToString(objectp op);
115: int K00objectToInteger(objectp op);
116: objectp K00integerToObject(int k);
117: objectp K00contextToObject(struct context *cp);
118: struct context *K00objectToContext(objectp op);
119: objectp ooAdd(objectp a,objectp b);
120: objectp ooMult(objectp a,objectp b);
121:
122: /* memory */
123: void *mymalloc(int size);
124:
125: /* protection of symbols */
126: int isProtectedSymbol(char *s);
127: int ips(objectp op);
128: /* read from file */
129: void parseAFile(FILE *fp);
130: void parseAstring(char *s);
131: int fsgetc(objectp op);
132: int fsungetc(int c,objectp op);
133: void readLineFromFile(FILE *fp,struct stringBuf *obuf);
134: struct stringBuf *newStringBuf(char *initstr);
135: void doublingStringBuf(struct stringBuf *sbuf);
1.3 takayama 136: objectp checkIfTheFileExists(objectp name);
1.1 maekawa 137: void loadFile(objectp op);
138: void loadFileWithCpp(objectp op);
139: void showStringBuff(objectp op);
140: char *getLOAD_K_PATH();
141: void clearInop();
142:
143: struct object KSpop();
144: void testNewFunction(objectp op);
145:
146: /* Dictionary and context handling. dic.c */
147: int K00putUserDictionary(char *str,int h0,int h1,objectp ob,
148: struct context *cp);
149: int K00putUserDictionary2(char *str,int h0,int h1, int attr,
150: struct context *cp);
151: objectp K00findUserDictionary(char *str,int h0,int h1,struct context *cp);
152: objectp K00findUserDictionary0(char *str,int h0,int h1,struct context *cp);
153: int K00hash0(char *str);
154: int K00hash1(char *str);
155: void K00hashInitialize(struct dictionary *dic);
156: void K00fprintContext(FILE *fp,struct context *cp);
157: void K00fprintContextAndDictionary(FILE *fp,struct context *cp);
158: struct context *K00newContext0(struct context *super,char *name);
159: void K00contextControl(actionOfContextControl ctl);
160: char *K00getCurrentContextName();
161: void K00InitDic();
162: void K00errorDic(char *s);
163:
164: /* name space control */
165: int K00putIncetanceVariable(actionOfPutIncetanceVariable action,char *s);
166: int K00getIncetanceVariable(char *s);
167: void K00recoverFromError();
168: int K00declareClass(char *name,char *supername);
169: void K00toPrimitiveClass();
170:
171:
172:
173:
174:
175:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>