This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcommon.h
310 lines (249 loc) · 5.57 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/*
isDcc
(c) 1998 Andrew de Quincey
See README.TXT for copying/distribution/modification details.
*/
#ifndef COMMON_H
#define COMMON_H
#include <stdlib.h>
#include <vector>
enum VarType : unsigned int
{
TYPE_STRING = 0,
TYPE_CHAR = 1,
TYPE_LONG = 2,
TYPE_INT = 3,
TYPE_NUMBER = 4,
TYPE_LIST = 5,
TYPE_BOOL = 6,
TYPE_HWND = 7,
TYPE_UNDEF1 = 8,
TYPE_CONSTANT = 9,
TYPE_UNDEF2 = 10,
TYPE_UNDEF3 = 11,
TYPE_UNDEF4 = 12,
TYPE_AUTOSTRING = 13,
};
typedef struct
{
int type;
int byref;
union
{
int intVal;
char* string;
int variableNumber;
int userFunction;
int label;
} data;
} Parameter;
typedef struct CodeLine CodeLine;
struct CodeLine
{
int type;
long offset; // version2 by Mr. Smith
int opcode;
char* name;
Parameter* destination;
Parameter** params;
int paramsCount;
CodeLine** subCodeLines;
int subCodeLinesCount;
int functionNumber;
char string[32];
int operationNumber;
int destLabel;
int comparisonType;
int labelNumber;
};
#define FUNCTION 0
#define OPERATION 1
#define IFSTATEMENT 2
#define COMPARISON 3
#define LABEL 4
#define GOTO 5
#define EXIT 6
#define ABORT 7
#define FUNCRETURN 8
#define HANDLER 9
#define CALL 10
#define RETURN 11
#define FCTEND 12
#define OP_UNKNOWN 0
#define OP_EQUATE 1
#define OP_LESSTHAN 2
#define OP_GREATERTHAN 3
#define OP_LESSTHANEQUAL 4
#define OP_GREATERTHANEQUAL 5
#define OP_EQUAL 6
#define OP_NOTEQUAL 7
#define OP_PLUS 8
#define OP_MINUS 9
#define OP_MULT 10
#define OP_DIV 11
#define OP_BITAND 12
#define OP_BITOR 13
#define OP_BITEOR 14
#define OP_BITNOT 15
#define OP_SHIFTL 16
#define OP_SHIFTR 17
#define OP_LOGICAND 18
#define OP_LOGICOR 19
#define OP_STRCAT 20
#define OP_PATHCAT 21
#define OP_MOD 22
#define OP_LOGICNOT 23
#define OP_STRUCT_MEMBER 24
#define OP_POINTER 25
#define OP_INDIRECTION 26
#define OP_ADDRESS_OF 27
#define OP_IF 28
#define OP_UNKNOWN1 29
#define OP_UNKNOWN2 30
#define OP_TRY 31
#define OP_CATCH 32
#define OP_ENDCATCH 33
#define OP_STRUCT_MEMBER1 34
#define OP_STRUCT_MEMBER2 35
#define OP_USEDLL 36
#define OP_UNUSEDLL 37
#define OP_STRTONUM 38
#define OP_NUMTOSTR 39
#define OP_STRCOMP 40
#define OP_STRFIND 41
#define OP_STRSUB 42
#define OP_STRLC 43
#define OP_STRBR 44
#define OP_STRBW 45
#define OP_RESIZE 46
#define OP_SIZEOF 47
#define OP_EXEHANDLER 48
#define OP_HANDLER 49
#define OP_SPECIAL1 50
static char* operations[] = {NULL, "=", "<", ">", "<=", ">=", "==", "!=",
"+", "-", "*", "/", "&", "|", "^", "~", "<<",
">>", "&&", "||", "+", "^", "%","!",".","->","*","&","if","??","??",
"try","catch","endcatch","",".","UseDll","UnUseDll","StrToNum",
"NumToStr","StrCompare","StrFind","StrSub","StrLengthChars","","",
"Resize","SizeOf","ExecuteHandler","Handler","Set2Handler??"}; //version2.1
typedef struct {
char* name;
} SysVar;
//version2.1
struct LabelRef {
long offset;
struct LabelRef *lRefPointer;
};
typedef struct {
int usage;
int position;
int file_position;
int functionNumber;
int passed;
struct LabelRef *lRefPointer; //version2.1
} Label;
typedef struct{
CodeLine** codeLines;
int codeLinesCount;
int codeLinesMax;
int* localParamSize;
int prototype;
} FunctionBody;
typedef struct
{
int type;
char *name;
int label;
int returnType;
FunctionBody* functionBody;
// top bit set => byref
int* params;
int paramsCount;
char** paramStringsNames;
int paramStringsCount;
char** paramNumbersNames;
int paramNumbersCount;
int* localParamSize;
} FunctionPrototype;
#define EVENT_HANDLER 0xA
#define FUNCTION_USER 2
#define FUNCTION_DLL 1
typedef struct
{
VarType type;
unsigned int size;
char* name;
} TypeEntry;
typedef struct
{
char* name;
std::vector<TypeEntry> entries;
} DataType;
typedef struct
{
unsigned long versionMagic;
unsigned char fileVersion;
unsigned long crc;
char* infoString;
unsigned char compilerVersion;
long eofPos;
FunctionPrototype** functionPrototypes;
int functionPrototypesCount;
FunctionBody** functionBodies;
int functionBodiesCount;
SysVar** stringSysVars;
int stringSysVarsCount;
SysVar** numberSysVars;
int numberSysVarsCount;
int* stringUserVars;
int stringUserVarsCount;
int* numberUserVars;
int numberUserVarsCount;
int endCodeSegmentOffset;
std::vector<DataType*> dataTypes;
CodeLine** codeLines;
int codeLinesCount;
int codeLinesMax;
Label** labels;
int labelsCount;
} ISData;
#define PARAM_UNKNOWN 0
#define PARAM_STRINGCONST 1
#define PARAM_LONGCONST 2
#define PARAM_SYSTEMSTRINGVARIABLE 3
#define PARAM_USERSTRINGVARIABLE 4
#define PARAM_SYSTEMNUMBERVARIABLE 5
#define PARAM_USERNUMBERVARIABLE 6
#define PARAM_FNPARAMSTRINGVARIABLE 7
#define PARAM_FNPARAMNUMBERVARIABLE 8
#define PARAM_FNLOCALSTRINGVARIABLE 9
#define PARAM_FNLOCALNUMBERVARIABLE 10
#define PARAM_LABEL 11
#define PARAM_DATATYPENUM 12
#define OTHER_UNKNOWN 0
#define OTHER_USERFUNCTION 1
#define OTHER_LABEL 2
#define OTHER_NUMPARAMS 3
/*
BOOL*
CHAR*
HWND*
INT*
LIST*
LONG (number)*
LPSTR (pointer)
Number*
Object
Pointer
Short (Number)
String *
Variant
Void
WString
*/
static char* types[] = {"fixstr", "char", "long", "int", "number",
"LIST", "BOOL", "HWND","UNDEF1","CONSTANT","UNDEF2",
"UNDEF3", "UNDEF4", "autostr" };
extern int argnum; //version2
#endif