]> de.git.xonotic.org Git - voretournament/voretournament.git/blob - misc/source/fteqcc-src/execloop.h
Update the prebuilt engines to latest version of darkplaces. Also put Linux rebrand...
[voretournament/voretournament.git] / misc / source / fteqcc-src / execloop.h
1 //qc execution code.
2 //we have two conditions.
3 //one allows us to debug and trace through our code, the other doesn't.
4
5 //hopefully, the compiler will do a great job at optimising this code for us, where required.
6 //if it dosn't, then bum.
7
8 //the general overhead should be reduced significantly, and I would be supprised if it did run slower.
9
10 //run away loops are checked for ONLY on gotos and function calls. This might give a poorer check, but it will run faster overall.
11
12 //Appears to work fine.
13
14 #if INTSIZE == 16
15 #define cont cont16
16 #define reeval reeval16
17 #define st st16
18 #define pr_statements pr_statements16
19 #define fakeop fakeop16
20 #define dstatement_t dstatement16_t
21 #define sofs signed short
22 #define uofs unsigned short
23 #elif INTSIZE == 32
24 #define cont cont32
25 #define reeval reeval32
26 #define st st32
27 #define pr_statements pr_statements32
28 #define fakeop fakeop32
29 #define dstatement_t dstatement32_t
30 #define sofs signed int
31 #define uofs unsigned int
32 #elif INTSIZE == 24
33 #error INTSIZE should be set to 32.
34 #else
35 #error Bad cont size
36 #endif
37
38 #ifdef DEBUGABLE
39 #define OPCODE (st->op & ~0x8000)
40 #else
41 #define OPCODE (st->op)
42 #endif
43
44 #define ENGINEPOINTER(p) ((char*)(p) - progfuncs->stringtable)
45 #define QCPOINTER(p) (eval_t *)(p->_int+progfuncs->stringtable)
46 #define QCPOINTERM(p) (eval_t *)((p)+progfuncs->stringtable)
47
48 //rely upon just st
49 {
50 #ifdef DEBUGABLE
51 cont:   //last statement may have been a breakpoint             
52         s = st-pr_statements;
53         s+=1;
54         s=ShowStep(progfuncs, s);
55         st = pr_statements + s;
56
57 reeval:
58 #else
59         st++;
60 #endif
61         switch (OPCODE)
62         {
63         case OP_ADD_F:
64                 OPC->_float = OPA->_float + OPB->_float;
65                 break;
66         case OP_ADD_V:
67                 OPC->_vector[0] = OPA->_vector[0] + OPB->_vector[0];
68                 OPC->_vector[1] = OPA->_vector[1] + OPB->_vector[1];
69                 OPC->_vector[2] = OPA->_vector[2] + OPB->_vector[2];
70                 break;
71
72         case OP_SUB_F:
73                 OPC->_float = OPA->_float - OPB->_float;
74                 break;
75         case OP_SUB_V:
76                 OPC->_vector[0] = OPA->_vector[0] - OPB->_vector[0];
77                 OPC->_vector[1] = OPA->_vector[1] - OPB->_vector[1];
78                 OPC->_vector[2] = OPA->_vector[2] - OPB->_vector[2];
79                 break;
80
81         case OP_MUL_F:
82                 OPC->_float = OPA->_float * OPB->_float;
83                 break;
84         case OP_MUL_V:
85                 OPC->_float = OPA->_vector[0]*OPB->_vector[0]
86                                 + OPA->_vector[1]*OPB->_vector[1]
87                                 + OPA->_vector[2]*OPB->_vector[2];
88                 break;
89         case OP_MUL_FV:
90                 OPC->_vector[0] = OPA->_float * OPB->_vector[0];
91                 OPC->_vector[1] = OPA->_float * OPB->_vector[1];
92                 OPC->_vector[2] = OPA->_float * OPB->_vector[2];
93                 break;
94         case OP_MUL_VF:
95                 OPC->_vector[0] = OPB->_float * OPA->_vector[0];
96                 OPC->_vector[1] = OPB->_float * OPA->_vector[1];
97                 OPC->_vector[2] = OPB->_float * OPA->_vector[2];
98                 break;
99
100         case OP_DIV_F:
101                 OPC->_float = OPA->_float / OPB->_float;
102                 break;
103         case OP_DIV_VF:
104                 OPC->_vector[0] = OPB->_float / OPA->_vector[0];
105                 OPC->_vector[1] = OPB->_float / OPA->_vector[1];
106                 OPC->_vector[2] = OPB->_float / OPA->_vector[2];
107                 break;
108
109         case OP_BITAND_F:
110                 OPC->_float = (float)((int)OPA->_float & (int)OPB->_float);
111                 break;
112
113         case OP_BITOR_F:
114                 OPC->_float = (float)((int)OPA->_float | (int)OPB->_float);
115                 break;
116
117
118         case OP_GE_F:
119                 OPC->_float = (float)(OPA->_float >= OPB->_float);
120                 break;
121         case OP_GE_I:
122                 OPC->_int = (int)(OPA->_int >= OPB->_int);
123                 break;
124         case OP_GE_IF:
125                 OPC->_float = (float)(OPA->_int >= OPB->_float);
126                 break;
127         case OP_GE_FI:
128                 OPC->_float = (float)(OPA->_float >= OPB->_int);
129                 break;
130
131         case OP_LE_F:
132                 OPC->_float = (float)(OPA->_float <= OPB->_float);
133                 break;
134         case OP_LE_I:
135                 OPC->_int = (int)(OPA->_int <= OPB->_int);
136                 break;
137         case OP_LE_IF:
138                 OPC->_float = (float)(OPA->_int <= OPB->_float);
139                 break;
140         case OP_LE_FI:
141                 OPC->_float = (float)(OPA->_float <= OPB->_int);
142                 break;
143
144         case OP_GT_F:
145                 OPC->_float = (float)(OPA->_float > OPB->_float);
146                 break;
147         case OP_GT_I:
148                 OPC->_int = (int)(OPA->_int > OPB->_int);
149                 break;
150         case OP_GT_IF:
151                 OPC->_float = (float)(OPA->_int > OPB->_float);
152                 break;
153         case OP_GT_FI:
154                 OPC->_float = (float)(OPA->_float > OPB->_int);
155                 break;
156
157         case OP_LT_F:
158                 OPC->_float = (float)(OPA->_float < OPB->_float);
159                 break;
160         case OP_LT_I:
161                 OPC->_int = (int)(OPA->_int < OPB->_int);
162                 break;
163         case OP_LT_IF:
164                 OPC->_float = (float)(OPA->_int < OPB->_float);
165                 break;
166         case OP_LT_FI:
167                 OPC->_float = (float)(OPA->_float < OPB->_int);
168                 break;
169
170         case OP_AND_F:
171                 OPC->_float = (float)(OPA->_float && OPB->_float);
172                 break;
173         case OP_OR_F:
174                 OPC->_float = (float)(OPA->_float || OPB->_float);
175                 break;
176
177         case OP_NOT_F:
178                 OPC->_float = (float)(!OPA->_float);
179                 break;
180         case OP_NOT_V:
181                 OPC->_float = (float)(!OPA->_vector[0] && !OPA->_vector[1] && !OPA->_vector[2]);
182                 break;
183         case OP_NOT_S:
184                 OPC->_float = (float)(!(OPA->string) || !*PR_StringToNative(progfuncs, OPA->string));
185                 break;
186         case OP_NOT_FNC:
187                 OPC->_float = (float)(!(OPA->function & ~0xff000000));
188                 break;
189         case OP_NOT_ENT:
190                 OPC->_float = (float)(PROG_TO_EDICT(progfuncs, OPA->edict) == (edictrun_t *)sv_edicts);
191                 break;
192
193         case OP_EQ_F:
194                 OPC->_float = (float)(OPA->_float == OPB->_float);
195                 break;
196         case OP_EQ_IF:
197                 OPC->_float = (float)(OPA->_int == OPB->_float);
198                 break;
199         case OP_EQ_FI:
200                 OPC->_float = (float)(OPA->_float == OPB->_int);
201                 break;
202
203
204         case OP_EQ_V:
205                 OPC->_float = (float)((OPA->_vector[0] == OPB->_vector[0]) &&
206                                         (OPA->_vector[1] == OPB->_vector[1]) &&
207                                         (OPA->_vector[2] == OPB->_vector[2]));
208                 break;
209         case OP_EQ_S:
210                 if (OPA->string==OPB->string)
211                         OPC->_float = true;
212                 else if (!OPA->string)
213                 {
214                         if (!OPB->string || !*PR_StringToNative(progfuncs, OPB->string))
215                                 OPC->_float = true;
216                         else
217                                 OPC->_float = false;
218                 }
219                 else if (!OPB->string)
220                 {
221                         if (!OPA->string || !*PR_StringToNative(progfuncs, OPA->string))
222                                 OPC->_float = true;
223                         else
224                                 OPC->_float = false;
225                 }
226                 else
227                         OPC->_float = (float)(!strcmp(PR_StringToNative(progfuncs, OPA->string),PR_StringToNative(progfuncs, OPB->string)));
228                 break;
229         case OP_EQ_E:
230                 OPC->_float = (float)(OPA->_int == OPB->_int);
231                 break;
232         case OP_EQ_FNC:
233                 OPC->_float = (float)(OPA->function == OPB->function);
234                 break;
235
236
237         case OP_NE_F:
238                 OPC->_float = (float)(OPA->_float != OPB->_float);
239                 break;
240         case OP_NE_V:
241                 OPC->_float = (float)((OPA->_vector[0] != OPB->_vector[0]) ||
242                                         (OPA->_vector[1] != OPB->_vector[1]) ||
243                                         (OPA->_vector[2] != OPB->_vector[2]));
244                 break;
245         case OP_NE_S:
246                 if (OPA->string==OPB->string)
247                         OPC->_float = false;
248                 else if (!OPA->string)
249                 {
250                         if (!OPB->string || !*(PR_StringToNative(progfuncs, OPB->string)))
251                                 OPC->_float = false;
252                         else
253                                 OPC->_float = true;
254                 }
255                 else if (!OPB->string)
256                 {
257                         if (!OPA->string || !*PR_StringToNative(progfuncs, OPA->string))
258                                 OPC->_float = false;
259                         else
260                                 OPC->_float = true;
261                 }
262                 else
263                         OPC->_float = (float)(strcmp(PR_StringToNative(progfuncs, OPA->string),PR_StringToNative(progfuncs, OPB->string)));             
264                 break;
265         case OP_NE_E:
266                 OPC->_float = (float)(OPA->_int != OPB->_int);
267                 break;
268         case OP_NE_FNC:
269                 OPC->_float = (float)(OPA->function != OPB->function);
270                 break;
271
272 //==================
273         case OP_STORE_IF:
274                 OPB->_float = (float)OPA->_int;
275                 break;
276         case OP_STORE_FI:
277                 OPB->_int = (int)OPA->_float;
278                 break;
279                 
280         case OP_STORE_F:
281         case OP_STORE_ENT:
282         case OP_STORE_FLD:              // integers
283         case OP_STORE_S:
284         case OP_STORE_I:
285         case OP_STORE_FNC:              // pointers
286         case OP_STORE_P:
287                 OPB->_int = OPA->_int;
288                 break;
289         case OP_STORE_V:
290                 OPB->_vector[0] = OPA->_vector[0];
291                 OPB->_vector[1] = OPA->_vector[1];
292                 OPB->_vector[2] = OPA->_vector[2];
293                 break;
294
295         //store a value to a pointer
296         case OP_STOREP_IF:
297                 if ((unsigned int)OPB->_int >= prinst->addressableused)
298                 {
299                         pr_xstatement = st-pr_statements;
300                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
301                 }
302                 ptr = QCPOINTER(OPB);
303                 ptr->_float = (float)OPA->_int;
304                 break;
305         case OP_STOREP_FI:
306                 if ((unsigned int)OPB->_int >= prinst->addressableused)
307                 {
308                         pr_xstatement = st-pr_statements;
309                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
310                 }
311                 ptr = QCPOINTER(OPB);
312                 ptr->_int = (int)OPA->_float;
313                 break;
314         case OP_STOREP_I:
315         case OP_GSTOREP_I:
316                 if ((unsigned int)OPB->_int >= prinst->addressableused)
317                 {
318                         pr_xstatement = st-pr_statements;
319                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
320                 }
321                 ptr = QCPOINTER(OPB);
322                 ptr->_int = OPA->_int;
323                 break;
324         case OP_STOREP_F:
325         case OP_GSTOREP_F:
326         case OP_STOREP_ENT:
327         case OP_GSTOREP_ENT:
328         case OP_STOREP_FLD:             // integers
329         case OP_GSTOREP_FLD:
330         case OP_STOREP_S:
331         case OP_GSTOREP_S:
332         case OP_STOREP_FNC:             // pointers
333         case OP_GSTOREP_FNC:
334                 if ((unsigned int)OPB->_int >= prinst->addressableused)
335                 {
336                         pr_xstatement = st-pr_statements;
337                         PR_RunError (progfuncs, "bad pointer write in %s (%x >= %x)", PR_StringToNative(progfuncs, pr_xfunction->s_name), OPB->_int, prinst->addressableused);
338                 }
339                 ptr = QCPOINTER(OPB);
340                 ptr->_int = OPA->_int;
341                 break;
342         case OP_STOREP_V:
343         case OP_GSTOREP_V:
344                 if ((unsigned int)OPB->_int >= prinst->addressableused)
345                 {
346                         pr_xstatement = st-pr_statements;
347                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
348                 }
349                 ptr = QCPOINTER(OPB);
350                 ptr->_vector[0] = OPA->_vector[0];
351                 ptr->_vector[1] = OPA->_vector[1];
352                 ptr->_vector[2] = OPA->_vector[2];
353                 break;
354
355         case OP_STOREP_C:       //store character in a string
356                 if ((unsigned int)OPB->_int >= prinst->addressableused)
357                 {
358                         pr_xstatement = st-pr_statements;
359                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
360                 }
361                 ptr = QCPOINTER(OPB);
362                 *(unsigned char *)ptr = (char)OPA->_float;
363                 break;
364
365         case OP_MULSTORE_F: // f *= f
366                 OPB->_float *= OPA->_float;
367                 break;
368         case OP_MULSTORE_VF: // v *= f
369                 OPB->_vector[0] *= OPA->_float;
370                 OPB->_vector[1] *= OPA->_float;
371                 OPB->_vector[2] *= OPA->_float;
372                 break;
373         case OP_MULSTOREP_F: // e.f *= f
374                 if ((unsigned int)OPB->_int >= prinst->addressableused)
375                 {
376                         pr_xstatement = st-pr_statements;
377                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
378                 }
379                 ptr = QCPOINTER(OPB);
380                 OPC->_float = (ptr->_float *= OPA->_float);
381                 break;
382         case OP_MULSTOREP_VF: // e.v *= f
383                 if ((unsigned int)OPB->_int >= prinst->addressableused)
384                 {
385                         pr_xstatement = st-pr_statements;
386                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
387                 }
388                 ptr = QCPOINTER(OPB);
389                 OPC->_vector[0] = (ptr->_vector[0] *= OPA->_float);
390                 OPC->_vector[0] = (ptr->_vector[1] *= OPA->_float);
391                 OPC->_vector[0] = (ptr->_vector[2] *= OPA->_float);
392                 break;
393
394         case OP_DIVSTORE_F: // f /= f
395                 OPB->_float /= OPA->_float;
396                 break;
397         case OP_DIVSTOREP_F: // e.f /= f
398                 if ((unsigned int)OPB->_int >= prinst->addressableused)
399                 {
400                         pr_xstatement = st-pr_statements;
401                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
402                 }
403                 ptr = QCPOINTER(OPB);
404                 OPC->_float = (ptr->_float /= OPA->_float);
405                 break;
406
407         case OP_ADDSTORE_F: // f += f
408                 OPB->_float += OPA->_float;
409                 break;
410         case OP_ADDSTORE_V: // v += v
411                 OPB->_vector[0] += OPA->_vector[0];
412                 OPB->_vector[1] += OPA->_vector[1];
413                 OPB->_vector[2] += OPA->_vector[2];
414                 break;
415         case OP_ADDSTOREP_F: // e.f += f
416                 if ((unsigned int)OPB->_int >= prinst->addressableused)
417                 {
418                         pr_xstatement = st-pr_statements;
419                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
420                 }
421                 ptr = QCPOINTER(OPB);
422                 OPC->_float = (ptr->_float += OPA->_float);
423                 break;
424         case OP_ADDSTOREP_V: // e.v += v
425                 if ((unsigned int)OPB->_int >= prinst->addressableused)
426                 {
427                         pr_xstatement = st-pr_statements;
428                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
429                 }
430                 ptr = QCPOINTER(OPB);
431                 OPC->_vector[0] = (ptr->_vector[0] += OPA->_vector[0]);
432                 OPC->_vector[1] = (ptr->_vector[1] += OPA->_vector[1]);
433                 OPC->_vector[2] = (ptr->_vector[2] += OPA->_vector[2]);
434                 break;
435
436         case OP_SUBSTORE_F: // f -= f
437                 OPB->_float -= OPA->_float;
438                 break;
439         case OP_SUBSTORE_V: // v -= v
440                 OPB->_vector[0] -= OPA->_vector[0];
441                 OPB->_vector[1] -= OPA->_vector[1];
442                 OPB->_vector[2] -= OPA->_vector[2];
443                 break;
444         case OP_SUBSTOREP_F: // e.f -= f
445                 if ((unsigned int)OPB->_int >= prinst->addressableused)
446                 {
447                         pr_xstatement = st-pr_statements;
448                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
449                 }
450                 ptr = QCPOINTER(OPB);
451                 OPC->_float = (ptr->_float -= OPA->_float);
452                 break;
453         case OP_SUBSTOREP_V: // e.v -= v
454                 if ((unsigned int)OPB->_int >= prinst->addressableused)
455                 {
456                         pr_xstatement = st-pr_statements;
457                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
458                 }
459                 ptr = QCPOINTER(OPB);
460                 OPC->_vector[0] = (ptr->_vector[0] -= OPA->_vector[0]);
461                 OPC->_vector[1] = (ptr->_vector[1] -= OPA->_vector[1]);
462                 OPC->_vector[2] = (ptr->_vector[2] -= OPA->_vector[2]);
463                 break;
464
465
466         //get a pointer to a field var
467         case OP_ADDRESS:
468                 if ((unsigned)OPA->edict >= (unsigned)maxedicts)
469                 {
470 #ifndef DEBUGABLE
471                         pr_trace++;
472                         printf("OP_ADDRESS references invalid entity in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
473                         st--;
474                         goto cont;
475 #else
476                         PR_RunError (progfuncs, "OP_ADDRESS references invalid entity in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
477 #endif
478                 }
479                 ed = PROG_TO_EDICT(progfuncs, OPA->edict);
480 #ifdef PARANOID
481                 NUM_FOR_EDICT(ed);              // make sure it's in range
482 #endif
483                 if (!ed || ed->readonly)
484                 {
485                         pr_xstatement = st-pr_statements;
486 #ifndef DEBUGABLE
487                         //boot it over to the debugger
488                         pr_trace++;
489                         printf("assignment to read-only entity in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
490                         st--;
491                         goto cont;
492 #else
493                         {
494                                 ddef16_t *d16;
495                                 fdef_t *f;
496                                 d16 = ED_GlobalAtOfs16(progfuncs, st->a);
497                                 f = ED_FieldAtOfs(progfuncs, OPB->_int + progfuncs->fieldadjust);
498                                 printf ("assignment to read-only entity in %s (%s.%s)\n", PR_StringToNative(progfuncs, pr_xfunction->s_name), d16?PR_StringToNative(progfuncs, d16->s_name):NULL, f?f->name:NULL);
499                         }
500 #endif
501                 }
502
503 //Whilst the next block would technically be correct, we don't use it as it breaks too many quake mods.
504 //              if (ed->isfree)
505 //              {
506 //                      pr_xstatement = st-pr_statements;
507 //                      PR_RunError (progfuncs, "assignment to free entitiy in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
508 //              }
509                 OPC->_int = ENGINEPOINTER((((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust));
510                 break;
511
512         //load a field to a value
513         case OP_LOAD_I:
514         case OP_LOAD_F:
515         case OP_LOAD_FLD:
516         case OP_LOAD_ENT:
517         case OP_LOAD_S:
518         case OP_LOAD_FNC:
519                 if ((unsigned)OPA->edict >= (unsigned)maxedicts)
520                         PR_RunError (progfuncs, "OP_LOAD references invalid entity in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
521                 ed = PROG_TO_EDICT(progfuncs, OPA->edict);
522 #ifdef PARANOID
523                 NUM_FOR_EDICT(ed);              // make sure it's in range
524 #endif
525                 ptr = (eval_t *)(((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust);
526                 OPC->_int = ptr->_int;
527                 break;
528
529         case OP_LOAD_V:
530                 if ((unsigned)OPA->edict >= (unsigned)maxedicts)
531                         PR_RunError (progfuncs, "OP_LOAD_V references invalid entity in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
532                 ed = PROG_TO_EDICT(progfuncs, OPA->edict);
533 #ifdef PARANOID
534                 NUM_FOR_EDICT(ed);              // make sure it's in range
535 #endif
536                 ptr = (eval_t *)(((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust);
537                 OPC->_vector[0] = ptr->_vector[0];
538                 OPC->_vector[1] = ptr->_vector[1];
539                 OPC->_vector[2] = ptr->_vector[2];
540                 break;  
541                 
542 //==================
543
544         case OP_IFNOT_S:
545                 RUNAWAYCHECK();
546                 if (!OPA->string || !PR_StringToNative(progfuncs, OPA->string))
547                         st += (sofs)st->b - 1;  // offset the s++
548                 break;
549
550         case OP_IFNOT_F:
551                 RUNAWAYCHECK();
552                 if (!OPA->_float)
553                         st += (sofs)st->b - 1;  // offset the s++
554                 break;
555
556         case OP_IFNOT_I:
557                 RUNAWAYCHECK();
558                 if (!OPA->_int)
559                         st += (sofs)st->b - 1;  // offset the s++
560                 break;
561
562         case OP_IF_S:
563                 RUNAWAYCHECK();
564                 if (OPA->string && PR_StringToNative(progfuncs, OPA->string))
565                         st += (sofs)st->b - 1;  // offset the s++
566                 break;
567
568         case OP_IF_F:
569                 RUNAWAYCHECK();
570                 if (OPA->_int)
571                         st += (sofs)st->b - 1;  // offset the s++
572                 break;
573
574         case OP_IF_I:
575                 RUNAWAYCHECK();
576                 if (OPA->_int)
577                         st += (sofs)st->b - 1;  // offset the s++
578                 break;
579                 
580         case OP_GOTO:
581                 RUNAWAYCHECK();
582                 st += (sofs)st->a - 1;  // offset the s++
583                 break;
584
585         case OP_CALL8H:
586         case OP_CALL7H:
587         case OP_CALL6H:
588         case OP_CALL5H:
589         case OP_CALL4H:
590         case OP_CALL3H:
591         case OP_CALL2H:
592                 G_VECTOR(OFS_PARM1)[0] = OPC->_vector[0];
593                 G_VECTOR(OFS_PARM1)[1] = OPC->_vector[1];
594                 G_VECTOR(OFS_PARM1)[2] = OPC->_vector[2];
595         case OP_CALL1H:
596                 G_VECTOR(OFS_PARM0)[0] = OPB->_vector[0];
597                 G_VECTOR(OFS_PARM0)[1] = OPB->_vector[1];
598                 G_VECTOR(OFS_PARM0)[2] = OPB->_vector[2];
599
600         case OP_CALL8:
601         case OP_CALL7:
602         case OP_CALL6:
603         case OP_CALL5:
604         case OP_CALL4:
605         case OP_CALL3:
606         case OP_CALL2:
607         case OP_CALL1:
608         case OP_CALL0:
609                 RUNAWAYCHECK();
610                 pr_xstatement = st-pr_statements;
611
612                 if (OPCODE > OP_CALL8)
613                         pr_argc = OPCODE - (OP_CALL1H-1);
614                 else
615                         pr_argc = OPCODE - OP_CALL0;
616                 fnum = OPA->function;
617                 if ((fnum & ~0xff000000)==0)
618                 {
619                         PR_RunError(progfuncs, "NULL function from qc (%s).\n", PR_StringToNative(progfuncs, pr_xfunction->s_name));
620 #ifndef DEBUGABLE
621                         goto cont;
622 #endif
623                         break;
624                 }
625 /*
626 {
627         static char buffer[1024*1024*8];
628         int size = sizeof buffer;
629                 progfuncs->save_ents(progfuncs, buffer, &size, 0);
630 }*/
631
632                 {
633                 int callerprogs=pr_typecurrent;
634 //about to switch. needs caching.
635
636                 //if it's an external call, switch now (before any function pointers are used)
637                 PR_MoveParms(progfuncs, (fnum & 0xff000000)>>24, callerprogs);
638                 PR_SwitchProgs(progfuncs, (fnum & 0xff000000)>>24);
639
640                 newf = &pr_functions[fnum & ~0xff000000];
641
642                 if (newf->first_statement < 0)
643                 {       // negative statements are built in functions
644                         /*calling a builtin in another progs may affect that other progs' globals instead, is the theory anyway, so args and stuff need to move over*/
645                         if (pr_typecurrent != 0)
646                         {
647                                 PR_MoveParms(progfuncs, 0, pr_typecurrent);
648                                 PR_SwitchProgs(progfuncs, 0);
649                         }
650                         i = -newf->first_statement;
651 //                      p = pr_typecurrent;
652                         progfuncs->lastcalledbuiltinnumber = i;
653                         if (i < externs->numglobalbuiltins)
654                         {
655                                 prinst->numtempstringsstack = prinst->numtempstrings;
656                                 (*externs->globalbuiltins[i]) (progfuncs, (struct globalvars_s *)current_progstate->globals);
657                                 if (prinst->continuestatement!=-1)
658                                 {
659                                         st=&pr_statements[prinst->continuestatement];
660                                         prinst->continuestatement=-1;
661                                         break;
662                                 }
663                         }
664                         else
665                         {
666                                 i -= externs->numglobalbuiltins;
667                                 if (i >= current_progstate->numbuiltins)
668                                 {
669 //                                      if (newf->first_statement == -0x7fffffff)
670 //                                              ((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
671 //                                      else
672                                                 PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
673                                 }
674                                 else
675                                         current_progstate->builtins [i] (progfuncs, (struct globalvars_s *)current_progstate->globals);
676                         }
677                         PR_MoveParms(progfuncs, callerprogs, pr_typecurrent);
678 //                      memcpy(&pr_progstate[p].globals[OFS_RETURN], &current_progstate->globals[OFS_RETURN], sizeof(vec3_t));
679                         PR_SwitchProgs(progfuncs, (progsnum_t)callerprogs);
680
681 //#ifndef DEBUGABLE     //decide weather non debugger wants to start debugging.
682                         s = st-pr_statements;
683                         goto restart;
684 //#endif
685 //                      break;
686                 }
687 //              PR_MoveParms((OPA->function & 0xff000000)>>24, pr_typecurrent);
688 //              PR_SwitchProgs((OPA->function & 0xff000000)>>24);
689                 s = PR_EnterFunction (progfuncs, newf, callerprogs);
690                 st = &pr_statements[s];
691                 }
692                 
693                 goto restart;
694 //              break;
695
696         case OP_DONE:
697         case OP_RETURN:
698
699                 RUNAWAYCHECK();
700
701                 pr_globals[OFS_RETURN] = pr_globals[st->a];
702                 pr_globals[OFS_RETURN+1] = pr_globals[st->a+1];
703                 pr_globals[OFS_RETURN+2] = pr_globals[st->a+2];
704 /*
705 {
706         static char buffer[1024*1024*8];
707         int size = sizeof buffer;
708                 progfuncs->save_ents(progfuncs, buffer, &size, 0);
709 }
710 */
711                 s = PR_LeaveFunction (progfuncs);
712                 st = &pr_statements[s];         
713                 if (pr_depth == prinst->exitdepth)
714                 {               
715                         return;         // all done
716                 }
717                 goto restart;
718 //              break;
719
720         case OP_STATE:
721                 externs->stateop(progfuncs, OPA->_float, OPB->function);
722                 break;
723
724         case OP_ADD_I:          
725                 OPC->_int = OPA->_int + OPB->_int;
726                 break;
727         case OP_ADD_FI:
728                 OPC->_float = OPA->_float + (float)OPB->_int;
729                 break;
730         case OP_ADD_IF:
731                 OPC->_float = (float)OPA->_int + OPB->_float;
732                 break;
733   
734         case OP_SUB_I:
735                 OPC->_int = OPA->_int - OPB->_int;
736                 break;
737         case OP_SUB_FI:
738                 OPC->_float = OPA->_float - (float)OPB->_int;
739                 break;
740         case OP_SUB_IF:
741                 OPC->_float = (float)OPA->_int - OPB->_float;
742                 break;
743
744         case OP_CONV_ITOF:
745                 OPC->_float = (float)OPA->_int;
746                 break;
747         case OP_CONV_FTOI:
748                 OPC->_int = (int)OPA->_float;
749                 break;
750
751         case OP_CP_ITOF:
752                 ptr = (eval_t *)(((qbyte *)sv_edicts) + OPA->_int);
753                 OPC->_float = (float)ptr->_int;
754                 break;
755
756         case OP_CP_FTOI:
757                 ptr = (eval_t *)(((qbyte *)sv_edicts) + OPA->_int);
758                 OPC->_int = (int)ptr->_float;
759                 break;
760
761         case OP_BITAND_I:
762                 OPC->_int = (OPA->_int & OPB->_int);
763                 break;
764         
765         case OP_BITOR_I:
766                 OPC->_int = (OPA->_int | OPB->_int);
767                 break;
768
769         case OP_MUL_I:          
770                 OPC->_int = OPA->_int * OPB->_int;
771                 break;
772         case OP_DIV_I:
773                 if (OPB->_int == 0)     //no division by zero allowed...
774                         OPC->_int = 0;
775                 else
776                         OPC->_int = OPA->_int / OPB->_int;
777                 break;
778         case OP_EQ_I:
779                 OPC->_int = (OPA->_int == OPB->_int);
780                 break;
781         case OP_NE_I:
782                 OPC->_int = (OPA->_int != OPB->_int);
783                 break;
784         
785
786         //array/structure reading/writing.
787         case OP_GLOBALADDRESS:
788                 OPC->_int = ENGINEPOINTER(&OPA->_int + OPB->_int); /*pointer arithmatic*/
789                 break;
790         case OP_POINTER_ADD:    //pointer to 32 bit (remember to *3 for vectors)
791                 OPC->_int = OPA->_int + OPB->_int*4;
792                 break;
793
794         case OP_LOADA_I:
795         case OP_LOADA_F:
796         case OP_LOADA_FLD:
797         case OP_LOADA_ENT:
798         case OP_LOADA_S:
799         case OP_LOADA_FNC:
800                 ptr = (eval_t *)(&OPA->_int + OPB->_int); /*pointer arithmatic*/
801                 OPC->_int = ptr->_int;
802                 break;
803
804         case OP_LOADA_V:
805                 ptr = (eval_t *)(&OPA->_int + OPB->_int);
806                 OPC->_vector[0] = ptr->_vector[0];
807                 OPC->_vector[1] = ptr->_vector[1];
808                 OPC->_vector[2] = ptr->_vector[2];
809                 break;
810
811
812
813         case OP_ADD_SF: //(char*)c = (char*)a + (float)b
814                 OPC->_int = OPA->_int + (int)OPB->_float;
815                 break;
816         case OP_SUB_S:  //(float)c = (char*)a - (char*)b
817                 OPC->_int = OPA->_int - OPB->_int;
818                 break;
819         case OP_LOADP_C:        //load character from a string
820                 i = (unsigned int)OPA->_int + (unsigned int)OPB->_float;
821                 if ((unsigned int)i >= prinst->addressableused)
822                 {
823                         i = (unsigned int)OPB->_float;
824                         ptr = (eval_t*)PR_StringToNative(progfuncs, OPA->_int);
825                         if ((size_t)i > strlen((char*)ptr))
826                         {
827                                 pr_xstatement = st-pr_statements;
828                                 PR_RunError (progfuncs, "bad pointer read in %s (%i bytes into %s)", PR_StringToNative(progfuncs, pr_xfunction->s_name), i, ptr);
829                         }
830                         ptr = (eval_t*)((char*)ptr + i);
831                 }
832                 else 
833                         ptr = QCPOINTERM(i);
834                 OPC->_float = *(unsigned char *)ptr;
835                 break;
836         case OP_LOADP_I:
837         case OP_LOADP_F:
838         case OP_LOADP_FLD:
839         case OP_LOADP_ENT:
840         case OP_LOADP_S:
841         case OP_LOADP_FNC:
842                 i = OPA->_int + OPB->_int*4;
843                 if ((unsigned int)i >= prinst->addressableused)
844                 {
845                         pr_xstatement = st-pr_statements;
846                         PR_RunError (progfuncs, "bad pointer read in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
847                 }
848                 ptr = QCPOINTERM(OPA->_int + OPB->_int*4);
849                 OPC->_int = ptr->_int;
850                 break;
851
852         case OP_LOADP_V:
853                 i = OPA->_int + OPB->_int*4;
854                 if ((unsigned int)i >= prinst->addressableused)
855                 {
856                         pr_xstatement = st-pr_statements;
857                         PR_RunError (progfuncs, "bad pointer read in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
858                 }
859                 ptr = QCPOINTERM(i);
860                 OPC->_vector[0] = ptr->_vector[0];
861                 OPC->_vector[1] = ptr->_vector[1];
862                 OPC->_vector[2] = ptr->_vector[2];
863                 break;
864
865         case OP_XOR_I:
866                 OPC->_int = OPA->_int ^ OPB->_int;
867                 break;
868         case OP_RSHIFT_I:
869                 OPC->_int = OPA->_int >> OPB->_int;
870                 break;
871         case OP_LSHIFT_I:
872                 OPC->_int = OPA->_int << OPB->_int;
873                 break;
874
875
876         case OP_FETCH_GBL_F:
877         case OP_FETCH_GBL_S:
878         case OP_FETCH_GBL_E:
879         case OP_FETCH_GBL_FNC:
880                 i = (int)OPB->_float;
881                 if(i < 0 || i > ((eval_t *)&glob[st->a-1])->_int)
882                 {
883                         PR_RunError(progfuncs, "array index out of bounds: %s[%d] (max %d)", PR_GlobalStringNoContents(progfuncs, st->a), i, ((eval_t *)&glob[st->a-1])->_int);
884                 }
885                 t = (eval_t *)&pr_globals[(uofs)st->a + i];
886                 OPC->_int = t->_int;
887                 break;
888         case OP_FETCH_GBL_V:
889                 i = (int)OPB->_float;
890                 if(i < 0 || i > ((eval_t *)&glob[st->a-1])->_int)
891                 {
892                         PR_RunError(progfuncs, "array index out of bounds: %s[%d]", PR_GlobalStringNoContents(progfuncs, st->a), i);
893                 }
894                 t = (eval_t *)&pr_globals[(uofs)st->a + i*3];
895                 OPC->_vector[0] = t->_vector[0];
896                 OPC->_vector[1] = t->_vector[1];
897                 OPC->_vector[2] = t->_vector[2];
898                 break;
899
900         case OP_CSTATE:
901                 externs->cstateop(progfuncs, OPA->_float, OPB->_float, fnum);
902                 break;
903
904         case OP_CWSTATE:
905                 externs->cwstateop(progfuncs, OPA->_float, OPB->_float, fnum);
906                 break;
907
908         case OP_THINKTIME:
909                 externs->thinktimeop(progfuncs, (struct edict_s *)PROG_TO_EDICT(progfuncs, OPA->edict), OPB->_float);
910                 break;
911
912
913         case OP_BITSET: // b (+) a
914                 OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
915                 break;
916         case OP_BITSETP: // .b (+) a
917                 if ((unsigned int)OPB->_int >= prinst->addressableused)
918                 {
919                         pr_xstatement = st-pr_statements;
920                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
921                 }
922                 ptr = QCPOINTER(OPB);
923                 ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
924                 break;
925         case OP_BITCLR: // b (-) a
926                 OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
927                 break;
928         case OP_BITCLRP: // .b (-) a
929                 if ((unsigned int)OPB->_int >= prinst->addressableused)
930                 {
931                         pr_xstatement = st-pr_statements;
932                         PR_RunError (progfuncs, "bad pointer write in %s", PR_StringToNative(progfuncs, pr_xfunction->s_name));
933                 }
934                 ptr = QCPOINTER(OPB);
935                 ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
936                 break;
937
938         case OP_RAND0:
939                 OPC->_float = (rand()&0x7fff)/((float)0x7fff);
940                 break;
941         case OP_RAND1:
942                 OPC->_float = (rand()&0x7fff)/((float)0x7fff)*OPA->_float;
943                 break;
944         case OP_RAND2:
945                 if(OPA->_float < OPB->_float)
946                 {
947                         OPC->_float = OPA->_float+((rand()&0x7fff)/((float)0x7fff)
948                                 *(OPB->_float-OPA->_float));
949                 }
950                 else
951                 {
952                         OPC->_float = OPB->_float+((rand()&0x7fff)/((float)0x7fff)
953                                 *(OPA->_float-OPB->_float));
954                 }
955                 break;
956         case OP_RANDV0:
957                 OPC->_vector[0] = (rand()&0x7fff)/((float)0x7fff);
958                 OPC->_vector[1] = (rand()&0x7fff)/((float)0x7fff);
959                 OPC->_vector[2] = (rand()&0x7fff)/((float)0x7fff);
960                 break;
961         case OP_RANDV1:
962                 OPC->_vector[0] = (rand()&0x7fff)/((float)0x7fff)*OPA->_vector[0];
963                 OPC->_vector[1] = (rand()&0x7fff)/((float)0x7fff)*OPA->_vector[1];
964                 OPC->_vector[2] = (rand()&0x7fff)/((float)0x7fff)*OPA->_vector[2];
965                 break;
966         case OP_RANDV2:
967                 for(i = 0; i < 3; i++)
968                 {
969                         if(OPA->_vector[i] < OPB->_vector[i])
970                         {
971                                 OPC->_vector[i] = OPA->_vector[i]+((rand()&0x7fff)/((float)0x7fff)
972                                         *(OPB->_vector[i]-OPA->_vector[i]));
973                         }
974                         else
975                         {
976                                 OPC->_vector[i] = OPB->_vector[i]+(rand()*(1.0f/RAND_MAX)
977                                         *(OPA->_vector[i]-OPB->_vector[i]));
978                         }
979                 }
980                 break;
981
982
983         case OP_SWITCH_F:
984         case OP_SWITCH_V:
985         case OP_SWITCH_S:
986         case OP_SWITCH_E:
987         case OP_SWITCH_FNC:
988                 swtch = OPA;
989                 swtchtype = OPCODE;
990                 RUNAWAYCHECK();
991                 st += (sofs)st->b - 1;  // offset the st++
992                 break;
993         case OP_CASE:
994                 switch(swtchtype)
995                 {
996                 case OP_SWITCH_F:
997                         if (swtch->_float == OPA->_float)
998                         {
999                                 RUNAWAYCHECK();
1000                                 st += (sofs)st->b-1; // -1 to offset the s++
1001                         }
1002                         break;
1003                 case OP_SWITCH_E:
1004                 case OP_SWITCH_FNC:
1005                         if (swtch->_int == OPA->_int)
1006                         {
1007                                 RUNAWAYCHECK();
1008                                 st += (sofs)st->b-1; // -1 to offset the s++
1009                         }
1010                         break;
1011                 case OP_SWITCH_S:
1012                         if (swtch->_int == OPA->_int)
1013                         {
1014                                 RUNAWAYCHECK();
1015                                 st += (sofs)st->b-1; // -1 to offset the s++
1016                         }
1017                         if ((!swtch->_int && PR_StringToNative(progfuncs, OPA->string)) || (!OPA->_int && PR_StringToNative(progfuncs, swtch->string))) //one is null (cannot be not both).
1018                                 break;
1019                         if (!strcmp(PR_StringToNative(progfuncs, swtch->string), PR_StringToNative(progfuncs, OPA->string)))
1020                         {
1021                                 RUNAWAYCHECK();
1022                                 st += (sofs)st->b-1; // -1 to offset the s++
1023                         }
1024                         break;
1025                 case OP_SWITCH_V:
1026                         if (swtch->_vector[0] == OPA->_vector[0] && swtch->_vector[1] == OPA->_vector[1] && swtch->_vector[2] == OPA->_vector[2])
1027                         {
1028                                 RUNAWAYCHECK();
1029                                 st += (sofs)st->b-1; // -1 to offset the s++
1030                         }
1031                         break;
1032                 default:
1033                         PR_RunError (progfuncs, "OP_CASE with bad/missing OP_SWITCH %i", swtchtype);
1034                         break;
1035                 }
1036                 break;
1037         case OP_CASERANGE:
1038                 switch(swtchtype)
1039                 {
1040                 case OP_SWITCH_F:
1041                         if (swtch->_float >= OPA->_float && swtch->_float <= OPB->_float)
1042                         {
1043                                 RUNAWAYCHECK();
1044                                 st += (sofs)st->c-1; // -1 to offset the s++
1045                         }
1046                         break;
1047                 default:
1048                         PR_RunError (progfuncs, "OP_CASERANGE with bad/missing OP_SWITCH %i", swtchtype);
1049                 }
1050                 break;
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060         case OP_BITAND_IF:
1061                 OPC->_int = (OPA->_int & (int)OPB->_float);
1062                 break;
1063         case OP_BITOR_IF:
1064                 OPC->_int = (OPA->_int | (int)OPB->_float);
1065                 break;
1066         case OP_BITAND_FI:
1067                 OPC->_int = ((int)OPA->_float & OPB->_int);
1068                 break;
1069         case OP_BITOR_FI:
1070                 OPC->_int = ((int)OPA->_float | OPB->_int);
1071                 break;
1072
1073         case OP_MUL_IF:
1074                 OPC->_float = (OPA->_int * OPB->_float);
1075                 break;
1076         case OP_MUL_FI:
1077                 OPC->_float = (OPA->_float * OPB->_int);
1078                 break;
1079
1080         case OP_MUL_VI:
1081                 OPC->_vector[0] = OPA->_vector[0] * OPB->_int;
1082                 OPC->_vector[1] = OPA->_vector[0] * OPB->_int;
1083                 OPC->_vector[2] = OPA->_vector[0] * OPB->_int;
1084                 break;
1085         case OP_MUL_IV:
1086                 OPC->_vector[0] = OPB->_int * OPA->_vector[0];
1087                 OPC->_vector[1] = OPB->_int * OPA->_vector[1];
1088                 OPC->_vector[2] = OPB->_int * OPA->_vector[2];
1089                 break;
1090
1091         case OP_DIV_IF:
1092                 OPC->_float = (OPA->_int / OPB->_float);
1093                 break;
1094         case OP_DIV_FI:
1095                 OPC->_float = (OPA->_float / OPB->_int);
1096                 break;
1097
1098         case OP_AND_I:
1099                 OPC->_int = (OPA->_int && OPB->_int);
1100                 break;
1101         case OP_OR_I:
1102                 OPC->_int = (OPA->_int || OPB->_int);
1103                 break;
1104
1105         case OP_AND_IF:
1106                 OPC->_int = (OPA->_int && OPB->_float);
1107                 break;
1108         case OP_OR_IF:
1109                 OPC->_int = (OPA->_int || OPB->_float);
1110                 break;
1111
1112         case OP_AND_FI:
1113                 OPC->_int = (OPA->_float && OPB->_int);
1114                 break;
1115         case OP_OR_FI:
1116                 OPC->_int = (OPA->_float || OPB->_int);
1117                 break;
1118
1119         case OP_NOT_I:
1120                 OPC->_int = !OPA->_int;
1121                 break;
1122
1123         case OP_NE_IF:
1124                 OPC->_int = (OPA->_int != OPB->_float);
1125                 break;
1126         case OP_NE_FI:
1127                 OPC->_int = (OPA->_float != OPB->_int);
1128                 break;
1129
1130         case OP_GADDRESS:
1131         case OP_GLOAD_I:
1132         case OP_GLOAD_F:
1133         case OP_GLOAD_FLD:
1134         case OP_GLOAD_ENT:
1135         case OP_GLOAD_S:
1136         case OP_GLOAD_FNC:
1137                 pr_xstatement = st-pr_statements;
1138                 PR_RunError(progfuncs, "Extra opcode not implemented\n");
1139                 break;
1140
1141         case OP_BOUNDCHECK:
1142                 if ((unsigned int)OPA->_int < (unsigned int)st->c || (unsigned int)OPA->_int >= (unsigned int)st->b)
1143                 {
1144                         pr_xstatement = st-pr_statements;
1145                         PR_RunError(progfuncs, "Progs boundcheck failed. Value is %i. Must be between %u and %u", OPA->_int, st->c, st->b);
1146                 }
1147                 break;
1148 /*      case OP_PUSH:
1149                 OPC->_int = ENGINEPOINTER(&localstack[localstack_used+pr_spushed]);
1150                 pr_spushed += OPA->_int;
1151                 if (pr_spushed + localstack_used >= LOCALSTACK_SIZE)
1152                 {
1153                         pr_spushed = 0;
1154                         pr_xstatement = st-pr_statements;
1155                         PR_RunError(progfuncs, "Progs pushed too much");
1156                 }
1157                 break;
1158         case OP_POP:
1159                 pr_spushed -= OPA->_int;
1160                 if (pr_spushed < 0)
1161                 {
1162                         pr_spushed = 0;
1163                         pr_xstatement = st-pr_statements;
1164                         PR_RunError(progfuncs, "Progs poped more than it pushed");
1165                 }
1166                 break;
1167 */
1168         default:                                        
1169                 if (st->op & 0x8000)    //break point!
1170                 {
1171                         pr_xstatement = s = st-pr_statements;
1172
1173                         printf("Break point hit in %s.\n", PR_StringToNative(progfuncs, pr_xfunction->s_name));
1174                         if (pr_trace<1)
1175                                 pr_trace=1;     //this is what it's for
1176
1177                         s = ShowStep(progfuncs, s);
1178                         st = &pr_statements[s]; //let the user move execution
1179                         pr_xstatement = s = st-pr_statements;
1180
1181                         goto reeval;    //reexecute
1182                 }
1183                 pr_xstatement = st-pr_statements;
1184                 PR_RunError (progfuncs, "Bad opcode %i", st->op);
1185         }
1186 }
1187
1188
1189 #undef cont
1190 #undef reeval
1191 #undef st
1192 #undef pr_statements
1193 #undef fakeop
1194 #undef dstatement_t
1195 #undef sofs
1196 #undef uofs
1197 #undef OPCODE
1198
1199 #undef ENGINEPOINTER
1200 #undef QCPOINTER
1201 #undef QCPOINTERM
1202