1 saw 1.1 /*
2 * Revision History:
3 * $Log: thTestParse.h,v $
4 * Revision 1.6 1995/08/03 14:37:13 saw
5 * Add single argument functions
6 *
7 * Revision 1.5 1995/04/25 17:46:52 saw
8 * Make compatible with OSF/Alpha (64 bit pointers)
9 *
10 * Revision 1.4 1994/11/07 14:38:43 saw
11 * Add integer divide operator
12 *
13 * Revision 1.3 1994/07/21 20:52:33 saw
14 * Add Revision history
15 *
16 */
17 #ifndef _TH_TESTPARSE_H
18 #define _TH_TESTPARSE_H
19
20 #ifndef _TH_UTILS_H
21 #include "thUtils.h"
22 saw 1.1 #endif
23
24 /* thTestParse.h
25 Header file for thTestParse.c and thTestExecute.c
26 */
27
28 #define max(a,b) (a<b ? b : a)
29 #define min(a,b) (a>b ? b : a)
30
31 #ifndef NULL
32 #define NULL ((void *)0)
33 #endif
34
35 #define CODEGROWSIZE 250
36 #define CODESTARTSIZE 2500
37 typedef DAINT CODE;
38 typedef CODE * CODEPTR;
39
40
41
42 /* Operand types */
43 saw 1.1
44 /* Hex charcter meanings
45 H7 H6 H5 H4 H3 H2 H1 H0
46 H7 Groups instructions together for execution convenience
47 H7 H6 H5 Operator precidence ordering
48 H4 H3 Operator code within precidence group
49 H2 Type of Left operand
50 H1 Type of Right operand
51 H0 Type of the result
52
53 */
54 /* Operand types */
55 #define OPRINT 0
56 #define OPRFLOAT 1
57 #define OPRDOUBLE 2
58 /* Operators */
59 #define OPPUSHGROUP 0x0000000
60 #define OPPUSHINT 0x0800000
61 #define OPPUSHFLOAT 0x0800001
62 #define OPPUSHDOUBLE 0x0800002
63 /* Next word is a pointer, push the value pointed to onto rpn stack */
64 saw 1.1 #define OPPUSHINTP 0x0810000
65 #define OPPUSHFLOATP 0x0810001
66 #define OPPUSHDOUBLEP 0x0810002
67 /* Next word is a pointer, push the pointer onto the rpn stack */
68 #define OPPUSHPINT 0x0820000
69 #define OPPUSHPFLOAT 0x0820001
70 #define OPPUSHPDOUBLE 0x0820002
71 /* Next word is a index into a function table */
72 #define OPPUSHFUNCTION 0x0830000
73 /* Parenthesis operators */
74 #define OPLP 0x0100000
75 #define OPRP 0x0900000
76 #define OPRINDEX 0x0901000
77 #define OPRFARG 0x0B01000
78 #define OPLINDEXGROUP 0x1000000
79 #define OPLINDEX 0x1A00000
80 /* Fortran mode index */
81 #define OPLINDEXB 0x1A01000
82 /* These operators leave the pointer instead of the value on the stack */
83 /* They are used for the first indexing ( or [ before the = */
84 #define OPLINDEXP 0x1A10000
85 saw 1.1 /* Fortran mode index */
86 #define OPLINDEXPB 0x1A11000
87 /* Function operator. Is this the right place in precidence scheme? */
88 #define OPLFARG 0x1B00000
89 #define OPEOLGROUP 0x2000000
90 #define OPEOL 0x2E00000
91 #define OPCOMMA 0x2F00000
92
93 #define OPEQUAL 0x4000000
94
95 #define OPLOGGROUP 0x8000000
96 #define OPLOGOR 0x8300000
97 #define OPLOGXOR 0x8400000
98 #define OPLOGAND 0x8500000
99 #define OPBITOR 0x8600000
100 #define OPBITXOR 0x8700000
101 #define OPBITAND 0x8800000
102
103 #define OPCOMPGROUP 0xA000000
104 #define OPISEQUAL 0xA900000
105 #define OPISNOTEQUAL 0xA901000
106 saw 1.1 #define OPISLT 0xAA00000
107 #define OPISLE 0xAA01000
108 #define OPISGT 0xAA02000
109 #define OPISGE 0xAA03000
110
111 #define OPSHIFTGROUP 0xB000000
112 #define OPSHL 0xBB00000
113 #define OPSHR 0xBB01000
114
115 #define OPADDGROUP 0xC000000
116 #define OPADD 0xC000000
117 #define OPSUB 0xC001000
118
119 #define OPMULGROUP 0xD000000
120 #define OPTIMES 0xD000000
121 #define OPDIV 0xD001000
122 #define OPIDIV 0xD002000
123 #define OPMOD 0xD003000
124
125 #define OPUNARY 0xE000000
126 #define OPNEG 0xE000000
127 saw 1.1 #define OPNOT 0xE001000
128 #define OPCOMP 0xE002000
129
130 #define OPGROUPMASK 0xF000000
131 #define OPPRECMASK 0xFF00000
132 #define OPCODEMASK 0xFFFF000
133
134 #define OPLEFTTYPEMASK 0x0000F00
135 #define OPRIGHTTYPEMASK 0x00000F0
136 #define OPLRTYPEMASK 0x0000FF0
137 #define OPRESTYPEMASK 0x000000F
138
139 /* For Q like test package format */
140 typedef enum {
141 tGATE, tPAT, tEQ, tBIT, tAND, tIOR, tXOR, tMAJ, tUSER, tBAD,
142 PUSHI, PUSHITOFS, PUSHS, PUSHFTOIS, POPS
143 } thTestType;
144
145 /* Operand types deduced from context */
146 typedef enum {
147 otIMMED, otLOGIC, otVALUE, otRESULT} thOperandType;
148 saw 1.1
149 typedef struct
150 {
151 char *name;
152 CODE result[3];
153 } INTRINSIC_FUNCTIONS;
154
155 char *thGetTok(char *linep,int *tokenid, char **tokstr, CODE *tokval,
156 void **tokptr, int expflag, daVarStructList **vlisthead);
157 thStatus thBookaTest(char *line, CODEPTR *codeheadp, CODEPTR *codenextp,
158 CODEPTR *codelimitp, CODEPTR *codelastop,
159 daVarStructList **vlisthead);
160 thStatus thExecuteCode(char *blockname, CODEPTR code, CODEPTR codelimit);
161 thOperandType thGetOperandType(char *soperand, char *rest, CODE lastop,
162 int expflag);
163 char **thGetClassList(thOperandType optype);
164
165 #endif
|