Disabled vsync when doing a timedemo.
[divverent/darkplaces.git] / pr_execprogram.h
1
2 // This code isn't #ifdef/#define protectable, don't try.
3
4                 while (1)
5                 {
6                         st++;
7                         if (++profile > 10000000) // LordHavoc: increased runaway loop limit 100x
8                         {
9                                 // LordHavoc: update profile counter for debugging reasons
10                                 // (identifying erroneous loops and recursion patterns)
11                                 pr_xfunction->profile += profile - startprofile;
12                                 startprofile = profile;
13                                 // update the statement number before we error out
14                                 pr_xstatement = st - pr_statements;
15                                 Host_Error("runaway loop counter hit limit of %d opcodes\ntip: if having trouble identifying the problem, try typing profile now", profile);
16                         }
17
18 #if PRTRACE
19                         pr_xfunction->profile += profile - startprofile;
20                         startprofile = profile;
21                         pr_xstatement = st - pr_statements;
22                         PR_PrintStatement(st);
23 #endif
24
25                         switch (st->op)
26                         {
27                         case OP_ADD_F:
28                                 OPC->_float = OPA->_float + OPB->_float;
29                                 break;
30                         case OP_ADD_V:
31                                 OPC->vector[0] = OPA->vector[0] + OPB->vector[0];
32                                 OPC->vector[1] = OPA->vector[1] + OPB->vector[1];
33                                 OPC->vector[2] = OPA->vector[2] + OPB->vector[2];
34                                 break;
35                         case OP_SUB_F:
36                                 OPC->_float = OPA->_float - OPB->_float;
37                                 break;
38                         case OP_SUB_V:
39                                 OPC->vector[0] = OPA->vector[0] - OPB->vector[0];
40                                 OPC->vector[1] = OPA->vector[1] - OPB->vector[1];
41                                 OPC->vector[2] = OPA->vector[2] - OPB->vector[2];
42                                 break;
43                         case OP_MUL_F:
44                                 OPC->_float = OPA->_float * OPB->_float;
45                                 break;
46                         case OP_MUL_V:
47                                 OPC->_float = OPA->vector[0]*OPB->vector[0] + OPA->vector[1]*OPB->vector[1] + OPA->vector[2]*OPB->vector[2];
48                                 break;
49                         case OP_MUL_FV:
50                                 OPC->vector[0] = OPA->_float * OPB->vector[0];
51                                 OPC->vector[1] = OPA->_float * OPB->vector[1];
52                                 OPC->vector[2] = OPA->_float * OPB->vector[2];
53                                 break;
54                         case OP_MUL_VF:
55                                 OPC->vector[0] = OPB->_float * OPA->vector[0];
56                                 OPC->vector[1] = OPB->_float * OPA->vector[1];
57                                 OPC->vector[2] = OPB->_float * OPA->vector[2];
58                                 break;
59                         case OP_DIV_F:
60                                 OPC->_float = OPA->_float / OPB->_float;
61                                 break;
62                         case OP_BITAND:
63                                 OPC->_float = (int)OPA->_float & (int)OPB->_float;
64                                 break;
65                         case OP_BITOR:
66                                 OPC->_float = (int)OPA->_float | (int)OPB->_float;
67                                 break;
68                         case OP_GE:
69                                 OPC->_float = OPA->_float >= OPB->_float;
70                                 break;
71                         case OP_LE:
72                                 OPC->_float = OPA->_float <= OPB->_float;
73                                 break;
74                         case OP_GT:
75                                 OPC->_float = OPA->_float > OPB->_float;
76                                 break;
77                         case OP_LT:
78                                 OPC->_float = OPA->_float < OPB->_float;
79                                 break;
80                         case OP_AND:
81                                 OPC->_float = OPA->_float && OPB->_float;
82                                 break;
83                         case OP_OR:
84                                 OPC->_float = OPA->_float || OPB->_float;
85                                 break;
86                         case OP_NOT_F:
87                                 OPC->_float = !OPA->_float;
88                                 break;
89                         case OP_NOT_V:
90                                 OPC->_float = !OPA->vector[0] && !OPA->vector[1] && !OPA->vector[2];
91                                 break;
92                         case OP_NOT_S:
93                                 OPC->_float = !OPA->string || !*PR_GetString(OPA->string);
94                                 break;
95                         case OP_NOT_FNC:
96                                 OPC->_float = !OPA->function;
97                                 break;
98                         case OP_NOT_ENT:
99                                 OPC->_float = (OPA->edict == 0);
100                                 break;
101                         case OP_EQ_F:
102                                 OPC->_float = OPA->_float == OPB->_float;
103                                 break;
104                         case OP_EQ_V:
105                                 OPC->_float = (OPA->vector[0] == OPB->vector[0]) && (OPA->vector[1] == OPB->vector[1]) && (OPA->vector[2] == OPB->vector[2]);
106                                 break;
107                         case OP_EQ_S:
108                                 OPC->_float = !strcmp(PR_GetString(OPA->string),PR_GetString(OPB->string));
109                                 break;
110                         case OP_EQ_E:
111                                 OPC->_float = OPA->_int == OPB->_int;
112                                 break;
113                         case OP_EQ_FNC:
114                                 OPC->_float = OPA->function == OPB->function;
115                                 break;
116                         case OP_NE_F:
117                                 OPC->_float = OPA->_float != OPB->_float;
118                                 break;
119                         case OP_NE_V:
120                                 OPC->_float = (OPA->vector[0] != OPB->vector[0]) || (OPA->vector[1] != OPB->vector[1]) || (OPA->vector[2] != OPB->vector[2]);
121                                 break;
122                         case OP_NE_S:
123                                 OPC->_float = strcmp(PR_GetString(OPA->string),PR_GetString(OPB->string));
124                                 break;
125                         case OP_NE_E:
126                                 OPC->_float = OPA->_int != OPB->_int;
127                                 break;
128                         case OP_NE_FNC:
129                                 OPC->_float = OPA->function != OPB->function;
130                                 break;
131
132                 //==================
133                         case OP_STORE_F:
134                         case OP_STORE_ENT:
135                         case OP_STORE_FLD:              // integers
136                         case OP_STORE_S:
137                         case OP_STORE_FNC:              // pointers
138                                 OPB->_int = OPA->_int;
139                                 break;
140                         case OP_STORE_V:
141                                 OPB->ivector[0] = OPA->ivector[0];
142                                 OPB->ivector[1] = OPA->ivector[1];
143                                 OPB->ivector[2] = OPA->ivector[2];
144                                 break;
145
146                         case OP_STOREP_F:
147                         case OP_STOREP_ENT:
148                         case OP_STOREP_FLD:             // integers
149                         case OP_STOREP_S:
150                         case OP_STOREP_FNC:             // pointers
151 #if PRBOUNDSCHECK
152                                 if (OPB->_int < 0 || OPB->_int + 4 > pr_edictareasize)
153                                 {
154                                         pr_xfunction->profile += profile - startprofile;
155                                         startprofile = profile;
156                                         pr_xstatement = st - pr_statements;
157                                         Host_Error("Progs attempted to write to an out of bounds edict (%i)\n", OPB->_int);
158                                         return;
159                                 }
160 #endif
161                                 ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
162                                 ptr->_int = OPA->_int;
163                                 break;
164                         case OP_STOREP_V:
165 #if PRBOUNDSCHECK
166                                 if (OPB->_int < 0 || OPB->_int + 12 > pr_edictareasize)
167                                 {
168                                         pr_xfunction->profile += profile - startprofile;
169                                         startprofile = profile;
170                                         pr_xstatement = st - pr_statements;
171                                         Host_Error("Progs attempted to write to an out of bounds edict (%i)\n", OPB->_int);
172                                         return;
173                                 }
174 #endif
175                                 ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
176                                 ptr->vector[0] = OPA->vector[0];
177                                 ptr->vector[1] = OPA->vector[1];
178                                 ptr->vector[2] = OPA->vector[2];
179                                 break;
180
181                         case OP_ADDRESS:
182 #if PRBOUNDSCHECK
183                                 if ((unsigned int)(OPB->_int) >= (unsigned int)(progs->entityfields))
184                                 {
185                                         pr_xfunction->profile += profile - startprofile;
186                                         startprofile = profile;
187                                         pr_xstatement = st - pr_statements;
188                                         Host_Error("Progs attempted to address an invalid field (%i) in an edict\n", OPB->_int);
189                                         return;
190                                 }
191 #endif
192                                 if (OPA->edict == 0 && sv.state == ss_active)
193                                 {
194                                         pr_xfunction->profile += profile - startprofile;
195                                         startprofile = profile;
196                                         pr_xstatement = st - pr_statements;
197                                         Host_Error("assignment to world entity");
198                                         return;
199                                 }
200                                 ed = PROG_TO_EDICT(OPA->edict);
201                                 OPC->_int = (qbyte *)((int *)ed->v + OPB->_int) - (qbyte *)sv.edictsfields;
202                                 break;
203
204                         case OP_LOAD_F:
205                         case OP_LOAD_FLD:
206                         case OP_LOAD_ENT:
207                         case OP_LOAD_S:
208                         case OP_LOAD_FNC:
209 #if PRBOUNDSCHECK
210                                 if ((unsigned int)(OPB->_int) >= (unsigned int)(progs->entityfields))
211                                 {
212                                         pr_xfunction->profile += profile - startprofile;
213                                         startprofile = profile;
214                                         pr_xstatement = st - pr_statements;
215                                         Host_Error("Progs attempted to read an invalid field in an edict (%i)\n", OPB->_int);
216                                         return;
217                                 }
218 #endif
219                                 ed = PROG_TO_EDICT(OPA->edict);
220                                 OPC->_int = ((eval_t *)((int *)ed->v + OPB->_int))->_int;
221                                 break;
222
223                         case OP_LOAD_V:
224 #if PRBOUNDSCHECK
225                                 if (OPB->_int < 0 || OPB->_int + 2 >= progs->entityfields)
226                                 {
227                                         pr_xfunction->profile += profile - startprofile;
228                                         startprofile = profile;
229                                         pr_xstatement = st - pr_statements;
230                                         Host_Error("Progs attempted to read an invalid field in an edict (%i)\n", OPB->_int);
231                                         return;
232                                 }
233 #endif
234                                 ed = PROG_TO_EDICT(OPA->edict);
235                                 OPC->vector[0] = ((eval_t *)((int *)ed->v + OPB->_int))->vector[0];
236                                 OPC->vector[1] = ((eval_t *)((int *)ed->v + OPB->_int))->vector[1];
237                                 OPC->vector[2] = ((eval_t *)((int *)ed->v + OPB->_int))->vector[2];
238                                 break;
239
240                 //==================
241
242                         case OP_IFNOT:
243                                 if (!OPA->_int)
244                                         st += st->b - 1;        // offset the s++
245                                 break;
246
247                         case OP_IF:
248                                 if (OPA->_int)
249                                         st += st->b - 1;        // offset the s++
250                                 break;
251
252                         case OP_GOTO:
253                                 st += st->a - 1;        // offset the s++
254                                 break;
255
256                         case OP_CALL0:
257                         case OP_CALL1:
258                         case OP_CALL2:
259                         case OP_CALL3:
260                         case OP_CALL4:
261                         case OP_CALL5:
262                         case OP_CALL6:
263                         case OP_CALL7:
264                         case OP_CALL8:
265                                 pr_xfunction->profile += profile - startprofile;
266                                 startprofile = profile;
267                                 pr_xstatement = st - pr_statements;
268                                 pr_argc = st->op - OP_CALL0;
269                                 if (!OPA->function )
270                                         Host_Error("NULL function");
271                                 else if (OPA->function > (unsigned) progs->numfunctions)
272                                         Host_Error("Bad function number");
273
274                                 newf = &pr_functions[OPA->function];
275
276                                 if (newf->first_statement < 0)
277                                 {
278                                         // negative statements are built in functions
279                                         int builtinnumber = -newf->first_statement;
280                                         pr_xfunction->builtinsprofile++;
281                                         if (builtinnumber < pr_numbuiltins && pr_builtins[builtinnumber])
282                                                 pr_builtins[builtinnumber]();
283                                         else
284                                                 Host_Error("No such builtin #%i", builtinnumber);
285                                 }
286                                 else
287                                         st = pr_statements + PR_EnterFunction(newf);
288                                 if (pr_trace != cachedpr_trace)
289                                         goto chooseexecprogram;
290                                 break;
291
292                         case OP_DONE:
293                         case OP_RETURN:
294                                 pr_xfunction->profile += profile - startprofile;
295                                 startprofile = profile;
296                                 pr_xstatement = st - pr_statements;
297
298                                 pr_globals[OFS_RETURN] = pr_globals[(unsigned short) st->a];
299                                 pr_globals[OFS_RETURN+1] = pr_globals[(unsigned short) st->a+1];
300                                 pr_globals[OFS_RETURN+2] = pr_globals[(unsigned short) st->a+2];
301
302                                 st = pr_statements + PR_LeaveFunction();
303                                 if (pr_depth <= exitdepth)
304                                         return;         // all done
305                                 if (pr_trace != cachedpr_trace)
306                                         goto chooseexecprogram;
307                                 break;
308
309                         case OP_STATE:
310                                 pr_xfunction->profile += profile - startprofile;
311                                 startprofile = profile;
312                                 pr_xstatement = st - pr_statements;
313                                 ed = PROG_TO_EDICT(pr_global_struct->self);
314                                 ed->v->nextthink = pr_global_struct->time + 0.1;
315                                 ed->v->frame = OPA->_float;
316                                 ed->v->think = OPB->function;
317                                 break;
318
319 // LordHavoc: to be enabled when Progs version 7 (or whatever it will be numbered) is finalized
320 /*
321                         case OP_ADD_I:
322                                 OPC->_int = OPA->_int + OPB->_int;
323                                 break;
324                         case OP_ADD_IF:
325                                 OPC->_int = OPA->_int + (int) OPB->_float;
326                                 break;
327                         case OP_ADD_FI:
328                                 OPC->_float = OPA->_float + (float) OPB->_int;
329                                 break;
330                         case OP_SUB_I:
331                                 OPC->_int = OPA->_int - OPB->_int;
332                                 break;
333                         case OP_SUB_IF:
334                                 OPC->_int = OPA->_int - (int) OPB->_float;
335                                 break;
336                         case OP_SUB_FI:
337                                 OPC->_float = OPA->_float - (float) OPB->_int;
338                                 break;
339                         case OP_MUL_I:
340                                 OPC->_int = OPA->_int * OPB->_int;
341                                 break;
342                         case OP_MUL_IF:
343                                 OPC->_int = OPA->_int * (int) OPB->_float;
344                                 break;
345                         case OP_MUL_FI:
346                                 OPC->_float = OPA->_float * (float) OPB->_int;
347                                 break;
348                         case OP_MUL_VI:
349                                 OPC->vector[0] = (float) OPB->_int * OPA->vector[0];
350                                 OPC->vector[1] = (float) OPB->_int * OPA->vector[1];
351                                 OPC->vector[2] = (float) OPB->_int * OPA->vector[2];
352                                 break;
353                         case OP_DIV_VF:
354                                 {
355                                         float temp = 1.0f / OPB->_float;
356                                         OPC->vector[0] = temp * OPA->vector[0];
357                                         OPC->vector[1] = temp * OPA->vector[1];
358                                         OPC->vector[2] = temp * OPA->vector[2];
359                                 }
360                                 break;
361                         case OP_DIV_I:
362                                 OPC->_int = OPA->_int / OPB->_int;
363                                 break;
364                         case OP_DIV_IF:
365                                 OPC->_int = OPA->_int / (int) OPB->_float;
366                                 break;
367                         case OP_DIV_FI:
368                                 OPC->_float = OPA->_float / (float) OPB->_int;
369                                 break;
370                         case OP_CONV_IF:
371                                 OPC->_float = OPA->_int;
372                                 break;
373                         case OP_CONV_FI:
374                                 OPC->_int = OPA->_float;
375                                 break;
376                         case OP_BITAND_I:
377                                 OPC->_int = OPA->_int & OPB->_int;
378                                 break;
379                         case OP_BITOR_I:
380                                 OPC->_int = OPA->_int | OPB->_int;
381                                 break;
382                         case OP_BITAND_IF:
383                                 OPC->_int = OPA->_int & (int)OPB->_float;
384                                 break;
385                         case OP_BITOR_IF:
386                                 OPC->_int = OPA->_int | (int)OPB->_float;
387                                 break;
388                         case OP_BITAND_FI:
389                                 OPC->_float = (int)OPA->_float & OPB->_int;
390                                 break;
391                         case OP_BITOR_FI:
392                                 OPC->_float = (int)OPA->_float | OPB->_int;
393                                 break;
394                         case OP_GE_I:
395                                 OPC->_float = OPA->_int >= OPB->_int;
396                                 break;
397                         case OP_LE_I:
398                                 OPC->_float = OPA->_int <= OPB->_int;
399                                 break;
400                         case OP_GT_I:
401                                 OPC->_float = OPA->_int > OPB->_int;
402                                 break;
403                         case OP_LT_I:
404                                 OPC->_float = OPA->_int < OPB->_int;
405                                 break;
406                         case OP_AND_I:
407                                 OPC->_float = OPA->_int && OPB->_int;
408                                 break;
409                         case OP_OR_I:
410                                 OPC->_float = OPA->_int || OPB->_int;
411                                 break;
412                         case OP_GE_IF:
413                                 OPC->_float = (float)OPA->_int >= OPB->_float;
414                                 break;
415                         case OP_LE_IF:
416                                 OPC->_float = (float)OPA->_int <= OPB->_float;
417                                 break;
418                         case OP_GT_IF:
419                                 OPC->_float = (float)OPA->_int > OPB->_float;
420                                 break;
421                         case OP_LT_IF:
422                                 OPC->_float = (float)OPA->_int < OPB->_float;
423                                 break;
424                         case OP_AND_IF:
425                                 OPC->_float = (float)OPA->_int && OPB->_float;
426                                 break;
427                         case OP_OR_IF:
428                                 OPC->_float = (float)OPA->_int || OPB->_float;
429                                 break;
430                         case OP_GE_FI:
431                                 OPC->_float = OPA->_float >= (float)OPB->_int;
432                                 break;
433                         case OP_LE_FI:
434                                 OPC->_float = OPA->_float <= (float)OPB->_int;
435                                 break;
436                         case OP_GT_FI:
437                                 OPC->_float = OPA->_float > (float)OPB->_int;
438                                 break;
439                         case OP_LT_FI:
440                                 OPC->_float = OPA->_float < (float)OPB->_int;
441                                 break;
442                         case OP_AND_FI:
443                                 OPC->_float = OPA->_float && (float)OPB->_int;
444                                 break;
445                         case OP_OR_FI:
446                                 OPC->_float = OPA->_float || (float)OPB->_int;
447                                 break;
448                         case OP_NOT_I:
449                                 OPC->_float = !OPA->_int;
450                                 break;
451                         case OP_EQ_I:
452                                 OPC->_float = OPA->_int == OPB->_int;
453                                 break;
454                         case OP_EQ_IF:
455                                 OPC->_float = (float)OPA->_int == OPB->_float;
456                                 break;
457                         case OP_EQ_FI:
458                                 OPC->_float = OPA->_float == (float)OPB->_int;
459                                 break;
460                         case OP_NE_I:
461                                 OPC->_float = OPA->_int != OPB->_int;
462                                 break;
463                         case OP_NE_IF:
464                                 OPC->_float = (float)OPA->_int != OPB->_float;
465                                 break;
466                         case OP_NE_FI:
467                                 OPC->_float = OPA->_float != (float)OPB->_int;
468                                 break;
469                         case OP_STORE_I:
470                                 OPB->_int = OPA->_int;
471                                 break;
472                         case OP_STOREP_I:
473 #if PRBOUNDSCHECK
474                                 if (OPB->_int < 0 || OPB->_int + 4 > pr_edictareasize)
475                                 {
476                                         pr_xfunction->profile += profile - startprofile;
477                                         startprofile = profile;
478                                         pr_xstatement = st - pr_statements;
479                                         Host_Error("Progs attempted to write to an out of bounds edict\n");
480                                         return;
481                                 }
482 #endif
483                                 ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
484                                 ptr->_int = OPA->_int;
485                                 break;
486                         case OP_LOAD_I:
487 #if PRBOUNDSCHECK
488                                 if (OPA->edict < 0 || OPA->edict >= pr_edictareasize)
489                                 {
490                                         pr_xfunction->profile += profile - startprofile;
491                                         startprofile = profile;
492                                         pr_xstatement = st - pr_statements;
493                                         Host_Error("Progs attempted to read an out of bounds edict number\n");
494                                         return;
495                                 }
496                                 if (OPB->_int < 0 || OPB->_int >= progs->entityfields)
497                                 {
498                                         pr_xfunction->profile += profile - startprofile;
499                                         startprofile = profile;
500                                         pr_xstatement = st - pr_statements;
501                                         Host_Error("Progs attempted to read an invalid field in an edict\n");
502                                         return;
503                                 }
504 #endif
505                                 ed = PROG_TO_EDICT(OPA->edict);
506                                 OPC->_int = ((eval_t *)((int *)ed->v + OPB->_int))->_int;
507                                 break;
508
509                         case OP_GSTOREP_I:
510                         case OP_GSTOREP_F:
511                         case OP_GSTOREP_ENT:
512                         case OP_GSTOREP_FLD:            // integers
513                         case OP_GSTOREP_S:
514                         case OP_GSTOREP_FNC:            // pointers
515 #if PRBOUNDSCHECK
516                                 if (OPB->_int < 0 || OPB->_int >= pr_globaldefs)
517                                 {
518                                         pr_xfunction->profile += profile - startprofile;
519                                         startprofile = profile;
520                                         pr_xstatement = st - pr_statements;
521                                         Host_Error("Progs attempted to write to an invalid indexed global\n");
522                                         return;
523                                 }
524 #endif
525                                 pr_globals[OPB->_int] = OPA->_float;
526                                 break;
527                         case OP_GSTOREP_V:
528 #if PRBOUNDSCHECK
529                                 if (OPB->_int < 0 || OPB->_int + 2 >= pr_globaldefs)
530                                 {
531                                         pr_xfunction->profile += profile - startprofile;
532                                         startprofile = profile;
533                                         pr_xstatement = st - pr_statements;
534                                         Host_Error("Progs attempted to write to an invalid indexed global\n");
535                                         return;
536                                 }
537 #endif
538                                 pr_globals[OPB->_int  ] = OPA->vector[0];
539                                 pr_globals[OPB->_int+1] = OPA->vector[1];
540                                 pr_globals[OPB->_int+2] = OPA->vector[2];
541                                 break;
542
543                         case OP_GADDRESS:
544                                 i = OPA->_int + (int) OPB->_float;
545 #if PRBOUNDSCHECK
546                                 if (i < 0 || i >= pr_globaldefs)
547                                 {
548                                         pr_xfunction->profile += profile - startprofile;
549                                         startprofile = profile;
550                                         pr_xstatement = st - pr_statements;
551                                         Host_Error("Progs attempted to address an out of bounds global\n");
552                                         return;
553                                 }
554 #endif
555                                 OPC->_float = pr_globals[i];
556                                 break;
557
558                         case OP_GLOAD_I:
559                         case OP_GLOAD_F:
560                         case OP_GLOAD_FLD:
561                         case OP_GLOAD_ENT:
562                         case OP_GLOAD_S:
563                         case OP_GLOAD_FNC:
564 #if PRBOUNDSCHECK
565                                 if (OPA->_int < 0 || OPA->_int >= pr_globaldefs)
566                                 {
567                                         pr_xfunction->profile += profile - startprofile;
568                                         startprofile = profile;
569                                         pr_xstatement = st - pr_statements;
570                                         Host_Error("Progs attempted to read an invalid indexed global\n");
571                                         return;
572                                 }
573 #endif
574                                 OPC->_float = pr_globals[OPA->_int];
575                                 break;
576
577                         case OP_GLOAD_V:
578 #if PRBOUNDSCHECK
579                                 if (OPA->_int < 0 || OPA->_int + 2 >= pr_globaldefs)
580                                 {
581                                         pr_xfunction->profile += profile - startprofile;
582                                         startprofile = profile;
583                                         pr_xstatement = st - pr_statements;
584                                         Host_Error("Progs attempted to read an invalid indexed global\n");
585                                         return;
586                                 }
587 #endif
588                                 OPC->vector[0] = pr_globals[OPA->_int  ];
589                                 OPC->vector[1] = pr_globals[OPA->_int+1];
590                                 OPC->vector[2] = pr_globals[OPA->_int+2];
591                                 break;
592
593                         case OP_BOUNDCHECK:
594                                 if (OPA->_int < 0 || OPA->_int >= st->b)
595                                 {
596                                         pr_xfunction->profile += profile - startprofile;
597                                         startprofile = profile;
598                                         pr_xstatement = st - pr_statements;
599                                         Host_Error("Progs boundcheck failed at line number %d, value is < 0 or >= %d\n", st->b, st->c);
600                                         return;
601                                 }
602                                 break;
603
604 */
605
606                         default:
607                                 pr_xfunction->profile += profile - startprofile;
608                                 startprofile = profile;
609                                 pr_xstatement = st - pr_statements;
610                                 Host_Error ("Bad opcode %i", st->op);
611                         }
612                 }
613