if ( (unsigned)s->op < sizeof(prvm_opnames)/sizeof(prvm_opnames[0]))
{
- Con_Printf ("%s ", prvm_opnames[s->op]);
+ Con_Printf("%s ", prvm_opnames[s->op]);
i = strlen(prvm_opnames[s->op]);
for ( ; i<10 ; i++)
- Con_Printf (" ");
+ Con_Print(" ");
}
if (s->op == OP_IF || s->op == OP_IFNOT)
- Con_Printf ("%sbranch %i",PRVM_GlobalString((unsigned short) s->a),s->b);
+ Con_Printf("%sbranch %i",PRVM_GlobalString((unsigned short) s->a),s->b);
else if (s->op == OP_GOTO)
{
- Con_Printf ("branch %i",s->a);
+ Con_Printf("branch %i",s->a);
}
else if ( (unsigned)(s->op - OP_STORE_F) < 6)
{
- Con_Printf ("%s", PRVM_GlobalString((unsigned short) s->a));
- Con_Printf ("%s", PRVM_GlobalStringNoContents((unsigned short) s->b));
+ Con_Print(PRVM_GlobalString((unsigned short) s->a));
+ Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->b));
}
else
{
if (s->a)
- Con_Printf ("%s", PRVM_GlobalString((unsigned short) s->a));
+ Con_Print(PRVM_GlobalString((unsigned short) s->a));
if (s->b)
- Con_Printf ("%s", PRVM_GlobalString((unsigned short) s->b));
+ Con_Print(PRVM_GlobalString((unsigned short) s->b));
if (s->c)
- Con_Printf ("%s", PRVM_GlobalStringNoContents((unsigned short) s->c));
+ Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->c));
}
- Con_Printf ("\n");
+ Con_Print("\n");
}
/*
f = prog->stack[i].f;
if (!f)
- Con_Printf ("<NULL FUNCTION>\n");
+ Con_Print("<NULL FUNCTION>\n");
else
- Con_Printf ("%12s : %s : statement %i\n", PRVM_GetString(f->s_file), PRVM_GetString(f->s_name), prog->stack[i].s - f->first_statement);
+ Con_Printf("%12s : %s : statement %i\n", PRVM_GetString(f->s_file), PRVM_GetString(f->s_name), prog->stack[i].s - f->first_statement);
}
}
if (best)
{
//if (num < howmany)
- Con_Printf ("%s: %7i %7i %s\n", PRVM_NAME, best->profile, best->builtinsprofile, PRVM_GetString(best->s_name));
+ Con_Printf("%s: %7i %7i %s\n", PRVM_NAME, best->profile, best->builtinsprofile, PRVM_GetString(best->s_name));
num++;
best->profile = 0;
best->builtinsprofile = 0;
void PRVM_CrashAll()
{
int i;
- PRVM_Begin;
+ prvm_prog_t *oldprog = prog;
+
for(i = 0; i < PRVM_MAXPROGS; i++)
{
if(!PRVM_ProgLoaded(i))
PRVM_SetProg(i);
PRVM_Crash();
}
- PRVM_End;
+
+ prog = oldprog;
}
-void PRVM_Crash()
+void PRVM_PrintState(void)
{
int i;
-
+ if (prog->xfunction)
+ {
+ for (i = -4;i <= 0;i++)
+ if (prog->xstatement + i >= prog->xfunction->first_statement)
+ PRVM_PrintStatement (prog->statements + prog->xstatement + i);
+ }
+ else
+ Con_Print("null function executing??\n");
+ PRVM_StackTrace ();
+}
+
+void PRVM_Crash()
+{
if (prog->depth < 1)
{
// kill the stack just to be sure
}
Con_Printf("QuakeC crash report for %s:\n", PRVM_NAME);
- if (prog->xfunction)
- {
- for (i = -4;i <= 0;i++)
- if (prog->xstatement + i >= prog->xfunction->first_statement)
- PRVM_PrintStatement (prog->statements + prog->xstatement + i);
- }
- else
- Con_Printf("null function executing??\n");
- PRVM_StackTrace ();
+ PRVM_PrintState();
// dump the stack so host_error can shutdown functions
prog->depth = 0;
====================
*/
// LordHavoc: optimized
-#define OPA ((eval_t *)&prog->globals[(unsigned short) st->a])
-#define OPB ((eval_t *)&prog->globals[(unsigned short) st->b])
-#define OPC ((eval_t *)&prog->globals[(unsigned short) st->c])
+#define OPA ((prvm_eval_t *)&prog->globals[(unsigned short) st->a])
+#define OPB ((prvm_eval_t *)&prog->globals[(unsigned short) st->b])
+#define OPC ((prvm_eval_t *)&prog->globals[(unsigned short) st->c])
extern cvar_t prvm_boundscheck;
extern cvar_t prvm_traceqc;
extern int PRVM_ED_FindFieldOffset (const char *field);
if (!fnum || fnum >= prog->progs->numfunctions)
{
if (prog->self && PRVM_G_INT(prog->self->ofs))
- PRVM_ED_Print (PRVM_PROG_TO_EDICT(PRVM_G_INT(prog->self->ofs)));
+ PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_G_INT(prog->self->ofs)));
PRVM_ERROR ("PR_ExecuteProgram: %s", errormessage);
}