mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 12:10:48 +00:00
search for .self' before
self'
This commit is contained in:
parent
e11e2f3718
commit
f78f921285
6 changed files with 27 additions and 24 deletions
|
@ -73,7 +73,7 @@ PR_AddBuiltin (progs_t *pr, const char *name, builtin_proc builtin, int num)
|
|||
pr->builtins = calloc (PR_AUTOBUILTIN, sizeof (builtin_t*));
|
||||
pr->numbuiltins = PR_AUTOBUILTIN;
|
||||
if (!pr->builtins)
|
||||
PR_Error (pr, "PR_AddBuiltin: memory allocation error!\n");
|
||||
PR_Error (pr, "PR_AddBuiltin: memory allocation error!");
|
||||
}
|
||||
|
||||
if (num < 0) {
|
||||
|
@ -85,13 +85,13 @@ PR_AddBuiltin (progs_t *pr, const char *name, builtin_proc builtin, int num)
|
|||
pr->builtins = realloc (pr->builtins,
|
||||
pr->numbuiltins * sizeof (builtin_t*));
|
||||
if (!pr->builtins)
|
||||
PR_Error (pr, "PR_AddBuiltin: memory allocation error!\n");
|
||||
PR_Error (pr, "PR_AddBuiltin: memory allocation error!");
|
||||
}
|
||||
} else {
|
||||
if (num >= PR_AUTOBUILTIN || num == 0)
|
||||
PR_Error (pr, "PR_AddBuiltin: invalid builtin number.\n");
|
||||
PR_Error (pr, "PR_AddBuiltin: invalid builtin number.");
|
||||
if (pr->builtins[num])
|
||||
PR_Error (pr, "PR_AddBuiltin: builtin number already exists.\n");
|
||||
PR_Error (pr, "PR_AddBuiltin: builtin number already exists.");
|
||||
i = num;
|
||||
}
|
||||
pr->builtins[i] = malloc (sizeof (builtin_t));
|
||||
|
|
|
@ -461,7 +461,7 @@ ED_Print (progs_t * pr, edict_t *ed)
|
|||
continue;
|
||||
break;
|
||||
default:
|
||||
PR_Error (pr, "ED_Print: Unhandled type %d\n", type);
|
||||
PR_Error (pr, "ED_Print: Unhandled type %d", type);
|
||||
}
|
||||
|
||||
Sys_Printf ("%s", name);
|
||||
|
|
|
@ -196,7 +196,7 @@ PR_EnterFunction (progs_t * pr, dfunction_t *f)
|
|||
// save off any locals that the new function steps on
|
||||
c = f->locals;
|
||||
if (pr->localstack_used + c > LOCALSTACK_SIZE)
|
||||
PR_RunError (pr, "PR_ExecuteProgram: locals stack overflow\n");
|
||||
PR_RunError (pr, "PR_ExecuteProgram: locals stack overflow");
|
||||
|
||||
memcpy (&pr->localstack[pr->localstack_used],
|
||||
&pr->pr_globals[f->parm_start],
|
||||
|
@ -234,7 +234,7 @@ PR_LeaveFunction (progs_t * pr)
|
|||
c = pr->pr_xfunction->locals;
|
||||
pr->localstack_used -= c;
|
||||
if (pr->localstack_used < 0)
|
||||
PR_RunError (pr, "PR_ExecuteProgram: locals stack underflow\n");
|
||||
PR_RunError (pr, "PR_ExecuteProgram: locals stack underflow");
|
||||
|
||||
memcpy (&pr->pr_globals[pr->pr_xfunction->parm_start],
|
||||
&pr->localstack[pr->localstack_used],
|
||||
|
@ -481,7 +481,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
pr->pr_edictareasize)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs attempted to address an out of "
|
||||
"bounds edict\n");
|
||||
"bounds edict");
|
||||
return;
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
|
@ -495,7 +495,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
pr->progs->entityfields)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs attempted to address an invalid "
|
||||
"field in an edict\n");
|
||||
"field in an edict");
|
||||
return;
|
||||
}
|
||||
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||
|
@ -524,7 +524,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
pr->pr_edictareasize)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs attempted to read an out of "
|
||||
"bounds edict number\n");
|
||||
"bounds edict number");
|
||||
return;
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
|
@ -532,7 +532,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
pr->progs->entityfields)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||
"field in an edict\n");
|
||||
"field in an edict");
|
||||
return;
|
||||
}
|
||||
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||
|
@ -544,7 +544,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
pr->pr_edictareasize)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs attempted to read an out of "
|
||||
"bounds edict number\n");
|
||||
"bounds edict number");
|
||||
return;
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
|
@ -552,7 +552,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
|| OPB.integer_var + 2 >= pr->progs->entityfields)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||
"field in an edict\n");
|
||||
"field in an edict");
|
||||
return;
|
||||
}
|
||||
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||
|
@ -677,7 +677,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
if (pr_boundscheck->int_val
|
||||
&& (OPA.uinteger_var >= pr->progs->numstatements)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Invalid jump destination\n");
|
||||
PR_RunError (pr, "Invalid jump destination");
|
||||
return;
|
||||
}
|
||||
st = &pr->pr_statements[OPA.uinteger_var];
|
||||
|
@ -690,7 +690,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
if (pr_boundscheck->int_val
|
||||
&& (pointer >= pr->progs->numstatements)) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Invalid jump destination\n");
|
||||
PR_RunError (pr, "Invalid jump destination");
|
||||
return;
|
||||
}
|
||||
st = &pr->pr_statements[pointer];
|
||||
|
@ -838,7 +838,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
if (OPA.integer_var < 0 || OPA.integer_var >= st->b) {
|
||||
pr->pr_xstatement = st - pr->pr_statements;
|
||||
PR_RunError (pr, "Progs boundcheck failed at line number "
|
||||
"%d, value is < 0 or >= %d\n", st->b, st->c);
|
||||
"%d, value is < 0 or >= %d", st->b, st->c);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -296,7 +296,7 @@ check_branch (progs_t *pr, dstatement_t *st, opcode_t *op, short offset)
|
|||
|
||||
address += offset;
|
||||
if (address < 0 || address >= pr->progs->numstatements)
|
||||
PR_Error (pr, "PR_Check_Opcodes: invalid branch (statement %ld: %s)\n",
|
||||
PR_Error (pr, "PR_Check_Opcodes: invalid branch (statement %ld: %s)",
|
||||
(long)(st - pr->pr_statements), op->opname);
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ check_global (progs_t *pr, dstatement_t *st, opcode_t *op, etype_t type,
|
|||
return;
|
||||
error:
|
||||
PR_PrintStatement (pr, st);
|
||||
PR_Error (pr, "PR_Check_Opcodes: %s (statement %ld: %s)\n", msg,
|
||||
PR_Error (pr, "PR_Check_Opcodes: %s (statement %ld: %s)", msg,
|
||||
(long)(st - pr->pr_statements), op->opname);
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ PR_Check_Opcodes (progs_t *pr)
|
|||
op = PR_Opcode (st->op);
|
||||
if (!op) {
|
||||
PR_Error (pr,
|
||||
"PR_Check_Opcodes: unknown opcode %d at statement %ld\n",
|
||||
"PR_Check_Opcodes: unknown opcode %d at statement %ld",
|
||||
st->op, (long)(st - pr->pr_statements));
|
||||
}
|
||||
switch (st->op) {
|
||||
|
|
|
@ -162,11 +162,15 @@ int
|
|||
PR_ResolveGlobals (progs_t *pr)
|
||||
{
|
||||
char *sym;
|
||||
ddef_t *def;
|
||||
|
||||
if (!(pr->globals.time = (float*)PR_GetGlobalPointer (pr, sym = "time")))
|
||||
goto error;
|
||||
if (!(pr->globals.self = (int*)PR_GetGlobalPointer (pr, sym = "self")))
|
||||
if (!(def = PR_FindGlobal (pr, sym = "time")))
|
||||
goto error;
|
||||
pr->globals.time = &G_FLOAT (pr, def->ofs);
|
||||
if (!(def = PR_FindGlobal (pr, ".self")))
|
||||
if (!(def = PR_FindGlobal (pr, "self")))
|
||||
goto error;
|
||||
pr->globals.self = &G_INT (pr, def->ofs);
|
||||
if ((pr->fields.nextthink = ED_GetFieldIndex (pr, sym = "nextthink")) == -1)
|
||||
goto error;
|
||||
if ((pr->fields.frame = ED_GetFieldIndex (pr, sym = "frame")) == -1)
|
||||
|
@ -175,7 +179,7 @@ PR_ResolveGlobals (progs_t *pr)
|
|||
goto error;
|
||||
return 1;
|
||||
error:
|
||||
Sys_Printf ("%s: undefined symbol: %s", pr->progs_name, sym);
|
||||
Sys_Printf ("%s: undefined symbol: %s\n", pr->progs_name, sym);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,6 @@ SV_LoadProgs (void)
|
|||
sv_globals.self = sv_pr_state.globals.self;
|
||||
sv_globals.time = sv_pr_state.globals.time;
|
||||
|
||||
(void *) sv_globals.self = PR_GetGlobalPointer (&sv_pr_state, "self");
|
||||
(void *) sv_globals.other = PR_GetGlobalPointer (&sv_pr_state, "other");
|
||||
(void *) sv_globals.world = PR_GetGlobalPointer (&sv_pr_state, "world");
|
||||
(void *) sv_globals.time = PR_GetGlobalPointer (&sv_pr_state, "time");
|
||||
|
|
Loading…
Reference in a new issue