[ruamoko] Add tracy zones

Mostly for tracking memory issues, but handy for seeing where time is
spent, of course.
This commit is contained in:
Bill Currie 2024-01-04 16:29:05 +09:00
parent 0ed4df3fb9
commit 9b0589f7e5
25 changed files with 760 additions and 0 deletions

View file

@ -56,6 +56,7 @@ VISIBLE const char *pr_gametype = "";
VISIBLE char *
PF_VarString (progs_t *pr, int first, int argc)
{
qfZoneScoped (true);
char *out, *dst;
const char *src;
int len, i;
@ -79,6 +80,7 @@ PF_VarString (progs_t *pr, int first, int argc)
static void
PF_normalize (progs_t *pr, void *data)
{
qfZoneScoped (true);
float new;
float *value1;
vec3_t newvalue;
@ -107,6 +109,7 @@ PF_normalize (progs_t *pr, void *data)
static void
PF_vlen (progs_t *pr, void *data)
{
qfZoneScoped (true);
float new;
float *value1;
@ -125,6 +128,7 @@ PF_vlen (progs_t *pr, void *data)
static void
PF_vectoyaw (progs_t *pr, void *data)
{
qfZoneScoped (true);
float yaw;
float *value1;
@ -147,6 +151,7 @@ PF_vectoyaw (progs_t *pr, void *data)
static void
PF_vectoangles (progs_t *pr, void *data)
{
qfZoneScoped (true);
float forward, pitch, yaw;
float *value1;
@ -182,6 +187,7 @@ PF_vectoangles (progs_t *pr, void *data)
static void
PF_random (progs_t *pr, void *data)
{
qfZoneScoped (true);
float num;
num = (rand () & 0x7fff) / ((float) 0x7fff);
@ -195,6 +201,7 @@ PF_random (progs_t *pr, void *data)
static void
PF_break (progs_t *pr, void *data)
{
qfZoneScoped (true);
Sys_Printf ("break statement\n");
PR_DumpState (pr);
}
@ -205,6 +212,7 @@ PF_break (progs_t *pr, void *data)
static void
PF_cvar (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str;
str = P_GSTRING (pr, 0);
@ -218,6 +226,7 @@ PF_cvar (progs_t *pr, void *data)
static void
PF_cvar_set (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *var_name, *val;
cvar_t *var;
@ -240,6 +249,7 @@ PF_cvar_set (progs_t *pr, void *data)
static void
PF_fabs (progs_t *pr, void *data)
{
qfZoneScoped (true);
float v;
v = P_FLOAT (pr, 0);
@ -252,6 +262,7 @@ PF_fabs (progs_t *pr, void *data)
static void
PF_find (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *s = 0, *t; // ev_string
int i; // ev_vector
pr_uint_t e, f;
@ -316,6 +327,7 @@ PF_find (progs_t *pr, void *data)
static void
PF_coredump (progs_t *pr, void *data)
{
qfZoneScoped (true);
ED_PrintEdicts (pr, "");
}
@ -325,6 +337,7 @@ PF_coredump (progs_t *pr, void *data)
static void
PF_traceon (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr->pr_trace = true;
pr->pr_trace_depth = pr->pr_depth;
}
@ -335,6 +348,7 @@ PF_traceon (progs_t *pr, void *data)
static void
PF_traceoff (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr->pr_trace = false;
}
@ -344,6 +358,7 @@ PF_traceoff (progs_t *pr, void *data)
static void
PF_eprint (progs_t *pr, void *data)
{
qfZoneScoped (true);
ED_PrintNum (pr, P_EDICTNUM (pr, 0), 0);
}
@ -353,6 +368,7 @@ PF_eprint (progs_t *pr, void *data)
static void
PF_dprint (progs_t *pr, void *data)
{
qfZoneScoped (true);
Sys_Printf ("%s", PF_VarString (pr, 0, 1));
}
@ -362,6 +378,7 @@ PF_dprint (progs_t *pr, void *data)
static void
PF_rint (progs_t *pr, void *data)
{
qfZoneScoped (true);
float f;
f = P_FLOAT (pr, 0);
@ -377,6 +394,7 @@ PF_rint (progs_t *pr, void *data)
static void
PF_floor (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = floor (P_FLOAT (pr, 0));
}
@ -386,6 +404,7 @@ PF_floor (progs_t *pr, void *data)
static void
PF_ceil (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = ceil (P_FLOAT (pr, 0));
}
@ -395,6 +414,7 @@ PF_ceil (progs_t *pr, void *data)
static void
PF_nextent (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_uint_t i;
edict_t *ent;
@ -426,6 +446,7 @@ PF_nextent (progs_t *pr, void *data)
static void
PF_ftoi (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_INT (pr) = P_FLOAT (pr, 0);
}
@ -435,6 +456,7 @@ PF_ftoi (progs_t *pr, void *data)
static void
PF_ftos (progs_t *pr, void *data)
{
qfZoneScoped (true);
char string[STRING_BUF];
int i;
@ -459,6 +481,7 @@ PF_ftos (progs_t *pr, void *data)
static void
PF_itof (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = P_INT (pr, 0);
}
@ -468,6 +491,7 @@ PF_itof (progs_t *pr, void *data)
static void
PF_itos (progs_t *pr, void *data)
{
qfZoneScoped (true);
char string[STRING_BUF];
snprintf (string, sizeof (string), "%d", P_INT (pr, 0));
@ -481,6 +505,7 @@ PF_itos (progs_t *pr, void *data)
static void
PF_stof (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = atof (P_GSTRING (pr, 0));
}
@ -490,6 +515,7 @@ PF_stof (progs_t *pr, void *data)
static void
PF_stoi (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_INT (pr) = atoi (P_GSTRING (pr, 0));
}
@ -499,6 +525,7 @@ PF_stoi (progs_t *pr, void *data)
static void
PF_stov (progs_t *pr, void *data)
{
qfZoneScoped (true);
float v[3] = {0, 0, 0};
sscanf (P_GSTRING (pr, 0), "'%f %f %f'", v, v + 1, v + 2);
@ -512,6 +539,7 @@ PF_stov (progs_t *pr, void *data)
static void
PF_vtos (progs_t *pr, void *data)
{
qfZoneScoped (true);
char string[STRING_BUF * 3 + 5];
snprintf (string, sizeof (string), "'%5.1f %5.1f %5.1f'",
@ -528,6 +556,7 @@ PF_vtos (progs_t *pr, void *data)
static void
PF_charcount (progs_t *pr, void *data)
{
qfZoneScoped (true);
char goal;
const char *s;
int count;
@ -554,12 +583,14 @@ PF_charcount (progs_t *pr, void *data)
static void
PF_gametype (progs_t *pr, void *data)
{
qfZoneScoped (true);
RETURN_STRING (pr, pr_gametype);
}
static void
PF_PR_SetField (progs_t *pr, void *data)
{
qfZoneScoped (true);
edict_t *ent = P_EDICT (pr, 0);
pr_def_t *field = PR_FindField (pr, P_GSTRING (pr, 1));
const char *value = P_GSTRING (pr, 2);
@ -572,6 +603,7 @@ PF_PR_SetField (progs_t *pr, void *data)
static void
PF_PR_FindFunction (progs_t *pr, void *data)
{
qfZoneScoped (true);
dfunction_t *func = PR_FindFunction (pr, P_GSTRING (pr, 0));
R_FUNCTION (pr) = 0;
if (func)
@ -623,5 +655,6 @@ static builtin_t builtins[] = {
VISIBLE void
PR_Cmds_Init (progs_t *pr)
{
qfZoneScoped (true);
PR_RegisterBuiltins (pr, builtins, 0);
}

View file

@ -45,6 +45,7 @@ typedef struct {
static cbuf_t * __attribute__((pure))
_get_cbuf (progs_t *pr, cbuf_resources_t *res, int arg, const char *func)
{
qfZoneScoped (true);
cbuf_t *cbuf = 0;
if (arg == 0) {
@ -64,6 +65,7 @@ _get_cbuf (progs_t *pr, cbuf_resources_t *res, int arg, const char *func)
bi(Cbuf_AddText)
{
qfZoneScoped (true);
cbuf_t *cbuf = get_cbuf (pr, data, P_INT (pr, 0));
const char *text = P_GSTRING (pr, 1);
Cbuf_AddText (cbuf, text);
@ -71,6 +73,7 @@ bi(Cbuf_AddText)
bi(Cbuf_InsertText)
{
qfZoneScoped (true);
cbuf_t *cbuf = get_cbuf (pr, data, P_INT (pr, 0));
const char *text = P_GSTRING (pr, 1);
Cbuf_InsertText (cbuf, text);
@ -78,12 +81,14 @@ bi(Cbuf_InsertText)
bi(Cbuf_Execute)
{
qfZoneScoped (true);
cbuf_t *cbuf = get_cbuf (pr, data, P_INT (pr, 0));
Cbuf_Execute (cbuf);
}
bi(Cbuf_Execute_Sets)
{
qfZoneScoped (true);
cbuf_t *cbuf = get_cbuf (pr, data, P_INT (pr, 0));
Cbuf_Execute_Sets (cbuf);
}
@ -91,11 +96,13 @@ bi(Cbuf_Execute_Sets)
static void
bi_cbuf_clear (progs_t *pr, void *data)
{
qfZoneScoped (true);
}
static void
bi_cbuf_destroy (progs_t *pr, void *data)
{
qfZoneScoped (true);
free (data);
}
@ -114,6 +121,7 @@ static builtin_t builtins[] = {
void
RUA_Cbuf_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
cbuf_resources_t *res = calloc (sizeof (cbuf_resources_t), 1);
res->pr = pr;
PR_Resources_Register (pr, "Cbuf", res, bi_cbuf_clear, bi_cbuf_destroy);
@ -123,6 +131,7 @@ RUA_Cbuf_Init (progs_t *pr, int secure)
VISIBLE void
RUA_Cbuf_SetCbuf (progs_t *pr, cbuf_t *cbuf)
{
qfZoneScoped (true);
cbuf_resources_t *res = PR_Resources_Find (pr, "Cbuf");
res->default_cbuf = cbuf;
}

View file

@ -64,12 +64,14 @@ static int bi_cmds_refs;
static const char *
bi_cmd_get_key (const void *c, void *unused)
{
qfZoneScoped (true);
return ((bi_cmd_t *)c)->name;
}
static void
bi_cmd_free (void *_c, void *unused)
{
qfZoneScoped (true);
bi_cmd_t *c = (bi_cmd_t *) _c;
free (c->name);
@ -79,6 +81,7 @@ bi_cmd_free (void *_c, void *unused)
static void
bi_cmd_f (void)
{
qfZoneScoped (true);
bi_cmd_t *cmd = Hash_Find (bi_cmds, Cmd_Argv (0));
if (!cmd)
@ -89,6 +92,7 @@ bi_cmd_f (void)
static void
bi_Cmd_AddCommand (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (cmd_resources_t *) _res;
bi_cmd_t *cmd = malloc (sizeof (bi_cmd_t));
char *name = strdup (P_GSTRING (pr, 0));
@ -114,6 +118,7 @@ bi_Cmd_AddCommand (progs_t *pr, void *_res)
static void
bi_cmd_clear (progs_t *pr, void *data)
{
qfZoneScoped (true);
cmd_resources_t *res = (cmd_resources_t *)data;
bi_cmd_t *cmd;
@ -128,6 +133,7 @@ bi_cmd_clear (progs_t *pr, void *data)
static void
bi_cmd_destroy (progs_t *pr, void *data)
{
qfZoneScoped (true);
if (!--bi_cmds_refs) {
Hash_DelTable (bi_cmds);
Hash_DelContext (bi_cmd_hashctx);
@ -138,18 +144,21 @@ bi_cmd_destroy (progs_t *pr, void *data)
static void
bi_Cmd_Argc (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_INT (pr) = Cmd_Argc ();
}
static void
bi_Cmd_Argv (progs_t *pr, void *data)
{
qfZoneScoped (true);
RETURN_STRING (pr, Cmd_Argv (P_INT (pr, 0)));
}
static void
bi_Cmd_Args (progs_t *pr, void *data)
{
qfZoneScoped (true);
RETURN_STRING (pr, Cmd_Args (P_INT (pr, 0)));
}
@ -170,6 +179,7 @@ static builtin_t builtins[] = {
void
RUA_Cmd_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
cmd_resources_t *res = calloc (1, sizeof (cmd_resources_t));
res->cmds = 0;

View file

@ -57,6 +57,7 @@ typedef struct {
static void
bi_alias_free (void *_a, void *unused)
{
qfZoneScoped (true);
bi_alias_t *a = (bi_alias_t *) _a;
free (a->name);
@ -66,6 +67,7 @@ bi_alias_free (void *_a, void *unused)
static void
bi_cvar_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
cvar_resources_t *res = (cvar_resources_t *) _res;
bi_alias_t *alias;
@ -79,12 +81,14 @@ bi_cvar_clear (progs_t *pr, void *_res)
static void
bi_cvar_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
free (_res);
}
static void
bi_Cvar_MakeAlias (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (cvar_resources_t *) _res;
const char *alias_name = P_GSTRING (pr, 0);
const char *cvar_name = P_GSTRING (pr, 1);
@ -109,6 +113,7 @@ bi_Cvar_MakeAlias (progs_t *pr, void *_res)
static void
bi_Cvar_RemoveAlias (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (cvar_resources_t *) _res;
const char *alias_name = P_GSTRING (pr, 0);
bi_alias_t **a;
@ -128,6 +133,7 @@ bi_Cvar_RemoveAlias (progs_t *pr, void *_res)
static void
bi_Cvar_SetString (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
const char *val = P_GSTRING (pr, 1);
cvar_t *var = Cvar_FindVar (varname);
@ -141,6 +147,7 @@ bi_Cvar_SetString (progs_t *pr, void *_res)
static void
bi_Cvar_SetInteger (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
int val = P_INT (pr, 1);
cvar_t *var = Cvar_FindVar (varname);
@ -154,6 +161,7 @@ bi_Cvar_SetInteger (progs_t *pr, void *_res)
static void
bi_Cvar_SetFloat (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
float val = P_FLOAT (pr, 1);
cvar_t *var = Cvar_FindVar (varname);
@ -167,6 +175,7 @@ bi_Cvar_SetFloat (progs_t *pr, void *_res)
static void
bi_Cvar_SetVector (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
float *val = P_VECTOR (pr, 1);
cvar_t *var = Cvar_FindVar (varname);
@ -180,6 +189,7 @@ bi_Cvar_SetVector (progs_t *pr, void *_res)
static void
bi_Cvar_GetString (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
cvar_t *var = Cvar_FindVar (varname);
@ -194,6 +204,7 @@ bi_Cvar_GetString (progs_t *pr, void *_res)
static void
bi_Cvar_GetInteger (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
cvar_t *var = Cvar_FindVar (varname);
@ -209,6 +220,7 @@ bi_Cvar_GetInteger (progs_t *pr, void *_res)
static void
bi_Cvar_GetFloat (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
cvar_t *var = Cvar_FindVar (varname);
@ -223,6 +235,7 @@ bi_Cvar_GetFloat (progs_t *pr, void *_res)
static void
bi_Cvar_GetVector (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
cvar_t *var = Cvar_FindVar (varname);
@ -237,6 +250,7 @@ bi_Cvar_GetVector (progs_t *pr, void *_res)
static void
bi_Cvar_Toggle (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *varname = P_GSTRING (pr, 0);
cvar_t *var;
@ -269,6 +283,7 @@ static builtin_t builtins[] = {
void
RUA_Cvar_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
cvar_resources_t *res = calloc (1, sizeof (cvar_resources_t));
res->aliases = 0;

View file

@ -45,6 +45,7 @@ static void (*init_funcs[])(progs_t *, int) = {
VISIBLE void
RUA_Game_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
size_t i;
for (i = 0; i < sizeof (init_funcs) / sizeof (init_funcs[0]); i++)

View file

@ -80,12 +80,14 @@ typedef struct {
static rua_passage_t *
passage_new (gui_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->passage_map);
}
static void
passage_free (gui_resources_t *res, rua_passage_t *passage)
{
qfZoneScoped (true);
if (passage->next) {
passage->next->prev = passage->prev;
}
@ -96,24 +98,28 @@ passage_free (gui_resources_t *res, rua_passage_t *passage)
static void
passage_reset (gui_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->passage_map);
}
static inline rua_passage_t *
passage_get (gui_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->passage_map, index);
}
static inline int __attribute__((pure))
passage_index (gui_resources_t *res, rua_passage_t *passage)
{
qfZoneScoped (true);
return PR_RESINDEX(res->passage_map, passage);
}
static int
alloc_passage (gui_resources_t *res, passage_t *passage)
{
qfZoneScoped (true);
rua_passage_t *psg = passage_new (res);
psg->next = res->passages;
@ -129,6 +135,7 @@ alloc_passage (gui_resources_t *res, passage_t *passage)
static rua_passage_t * __attribute__((pure))
_get_passage (gui_resources_t *res, int handle, const char *func)
{
qfZoneScoped (true);
rua_passage_t *psg = passage_get (res, handle);
if (!psg) {
PR_RunError (res->pr, "invalid passage handle passed to %s", func);
@ -140,36 +147,42 @@ _get_passage (gui_resources_t *res, int handle, const char *func)
static rua_font_t *
font_new (gui_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->font_map);
}
static void
font_free (gui_resources_t *res, rua_font_t *font)
{
qfZoneScoped (true);
PR_RESFREE (res->font_map, font);
}
static void
font_reset (gui_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->font_map);
}
static inline rua_font_t *
font_get (gui_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->font_map, index);
}
static inline int __attribute__((pure))
font_index (gui_resources_t *res, rua_font_t *font)
{
qfZoneScoped (true);
return PR_RESINDEX(res->font_map, font);
}
static int
alloc_font (gui_resources_t *res, font_t *font)
{
qfZoneScoped (true);
rua_font_t *fnt = font_new (res);
fnt->next = res->fonts;
@ -185,6 +198,7 @@ alloc_font (gui_resources_t *res, font_t *font)
static rua_font_t * __attribute__((pure))
_get_font (gui_resources_t *res, int handle, const char *func)
{
qfZoneScoped (true);
rua_font_t *psg = font_get (res, handle);
if (!psg) {
PR_RunError (res->pr, "invalid font handle passed to %s", func);
@ -196,6 +210,7 @@ _get_font (gui_resources_t *res, int handle, const char *func)
static void
bi_gui_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
for (rua_passage_t *psg = res->passages; psg; psg = psg->next) {
@ -215,6 +230,7 @@ bi_gui_clear (progs_t *pr, void *_res)
static void
bi_gui_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
ECS_DelRegistry (res->reg);
PR_RESDELMAP (res->passage_map);
@ -226,6 +242,7 @@ bi_gui_destroy (progs_t *pr, void *_res)
bi (Font_Load)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
const char *font_path = P_GSTRING (pr, 0);
int font_size = P_INT (pr, 1);
@ -241,6 +258,7 @@ bi (Font_Load)
bi (Font_Free)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
rua_font_t *font = get_font (res, P_INT (pr, 0));
@ -250,6 +268,7 @@ bi (Font_Free)
bi (Passage_New)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
passage_t *passage = Passage_New (res->psys);
R_INT (pr) = alloc_passage (res, passage);
@ -257,6 +276,7 @@ bi (Passage_New)
bi (Passage_ParseText)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
int handle = P_INT (pr, 0);
rua_passage_t *psg = get_passage (res, handle);
@ -266,6 +286,7 @@ bi (Passage_ParseText)
bi (Passage_Delete)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
int handle = P_INT (pr, 0);
rua_passage_t *psg = get_passage (res, handle);
@ -275,6 +296,7 @@ bi (Passage_Delete)
bi (Passage_ChildCount)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
rua_passage_t *psg = get_passage (res, P_INT (pr, 0));
@ -286,6 +308,7 @@ bi (Passage_ChildCount)
bi (Passage_GetChild)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
rua_passage_t *psg = get_passage (res, P_INT (pr, 0));
@ -298,6 +321,7 @@ bi (Passage_GetChild)
bi (Text_PassageView)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
view_t parent = View_FromEntity (res->vsys, P_INT (pr, 0));
rua_font_t *font = get_font (res, P_INT (pr, 1));
@ -309,6 +333,7 @@ bi (Text_PassageView)
bi (Text_SetScript)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t textent = P_UINT (pr, 0);
const char *lang = P_GSTRING (pr, 1);
@ -320,6 +345,7 @@ bi (Text_SetScript)
static void
draw_glyphs (view_pos_t *abs, glyphset_t *glyphset, glyphref_t *gref)
{
qfZoneScoped (true);
uint32_t count = gref->count;
glyphobj_t *glyph = glyphset->glyphs + gref->start;
@ -333,6 +359,7 @@ draw_glyphs (view_pos_t *abs, glyphset_t *glyphset, glyphref_t *gref)
static void
draw_box (view_pos_t *abs, view_pos_t *len, uint32_t ind, int c)
{
qfZoneScoped (true);
int x = abs[ind].x;
int y = abs[ind].y;
int w = len[ind].x;
@ -345,6 +372,7 @@ draw_box (view_pos_t *abs, view_pos_t *len, uint32_t ind, int c)
bi (Text_Draw)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t passage_glyphs = res->tsys.text_base + text_passage_glyphs;
uint32_t glyphs = res->tsys.text_base + text_glyphs;
@ -382,6 +410,7 @@ bi (Text_Draw)
bi (View_Delete)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
view_t view = View_FromEntity (res->vsys, viewid);
@ -390,6 +419,7 @@ bi (View_Delete)
bi (View_ChildCount)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
view_t view = View_FromEntity (res->vsys, viewid);
@ -398,6 +428,7 @@ bi (View_ChildCount)
bi (View_GetChild)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
uint32_t index = P_UINT (pr, 1);
@ -407,6 +438,7 @@ bi (View_GetChild)
bi (View_SetPos)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
int x = P_INT (pr, 1);
@ -417,6 +449,7 @@ bi (View_SetPos)
bi (View_SetLen)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
int x = P_INT (pr, 1);
@ -427,6 +460,7 @@ bi (View_SetLen)
bi (View_GetLen)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
view_t view = View_FromEntity (res->vsys, viewid);
@ -436,6 +470,7 @@ bi (View_GetLen)
bi (View_UpdateHierarchy)
{
qfZoneScoped (true);
gui_resources_t *res = _res;
uint32_t viewid = P_UINT (pr, 0);
view_t view = View_FromEntity (res->vsys, viewid);
@ -474,6 +509,7 @@ static builtin_t builtins[] = {
void
RUA_GUI_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
gui_resources_t *res = calloc (1, sizeof (gui_resources_t));
res->pr = pr;
@ -502,6 +538,7 @@ RUA_GUI_Init (progs_t *pr, int secure)
canvas_system_t
RUA_GUI_GetCanvasSystem (progs_t *pr)
{
qfZoneScoped (true);
gui_resources_t *res = PR_Resources_Find (pr, "Draw");
return res->csys;
}
@ -509,6 +546,7 @@ RUA_GUI_GetCanvasSystem (progs_t *pr)
passage_t *
RUA_GUI_GetPassage (progs_t *pr, int handle)
{
qfZoneScoped (true);
gui_resources_t *res = PR_Resources_Find (pr, "Draw");
auto psg = get_passage (res, handle);
return psg->passage;

View file

@ -64,36 +64,42 @@ typedef struct {
static bi_hashtab_t *
table_new (hash_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->table_map);
}
static void
table_free (hash_resources_t *res, bi_hashtab_t *table)
{
qfZoneScoped (true);
PR_RESFREE (res->table_map, table);
}
static void
table_reset (hash_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->table_map);
}
static inline bi_hashtab_t *
table_get (hash_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->table_map, index);
}
static inline int __attribute__((pure))
table_index (hash_resources_t *res, bi_hashtab_t *table)
{
qfZoneScoped (true);
return PR_RESINDEX(res->table_map, table);
}
static const char *
bi_get_key (const void *key, void *_ht)
{
qfZoneScoped (true);
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_PushFrame (ht->pr);
PR_RESET_PARAMS (ht->pr);
@ -109,6 +115,7 @@ bi_get_key (const void *key, void *_ht)
static uintptr_t
bi_get_hash (const void *key, void *_ht)
{
qfZoneScoped (true);
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_PushFrame (ht->pr);
PR_RESET_PARAMS (ht->pr);
@ -124,6 +131,7 @@ bi_get_hash (const void *key, void *_ht)
static int
bi_compare (const void *key1, const void *key2, void *_ht)
{
qfZoneScoped (true);
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_PushFrame (ht->pr);
PR_RESET_PARAMS (ht->pr);
@ -140,6 +148,7 @@ bi_compare (const void *key1, const void *key2, void *_ht)
static void
bi_free (void *key, void *_ht)
{
qfZoneScoped (true);
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_PushFrame (ht->pr);
PR_RESET_PARAMS (ht->pr);
@ -153,6 +162,7 @@ bi_free (void *key, void *_ht)
static void
bi_Hash_NewTable (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
int tsize = P_INT (pr, 0);
const char *(*gk)(const void*,void*);
@ -180,6 +190,7 @@ bi_Hash_NewTable (progs_t *pr, void *_res)
static bi_hashtab_t * __attribute__((pure))
get_table (progs_t *pr, hash_resources_t *res, const char *name, int index)
{
qfZoneScoped (true);
bi_hashtab_t *ht = table_get (res, index);
if (!ht)
@ -190,6 +201,7 @@ get_table (progs_t *pr, hash_resources_t *res, const char *name, int index)
static void
bi_Hash_SetHashCompare (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
uintptr_t (*gh)(const void*,void*);
@ -205,6 +217,7 @@ bi_Hash_SetHashCompare (progs_t *pr, void *_res)
static void
bi_Hash_DelTable (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -218,6 +231,7 @@ bi_Hash_DelTable (progs_t *pr, void *_res)
static void
bi_Hash_FlushTable (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -227,6 +241,7 @@ bi_Hash_FlushTable (progs_t *pr, void *_res)
static void
bi_Hash_Add (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -236,6 +251,7 @@ bi_Hash_Add (progs_t *pr, void *_res)
static void
bi_Hash_AddElement (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -245,6 +261,7 @@ bi_Hash_AddElement (progs_t *pr, void *_res)
static void
bi_Hash_Find (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -254,6 +271,7 @@ bi_Hash_Find (progs_t *pr, void *_res)
static void
bi_Hash_FindElement (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -264,6 +282,7 @@ bi_Hash_FindElement (progs_t *pr, void *_res)
static void
bi_Hash_FindList (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
void **list, **l;
@ -284,6 +303,7 @@ bi_Hash_FindList (progs_t *pr, void *_res)
static void
bi_Hash_FindElementList (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
void **list, **l;
@ -304,6 +324,7 @@ bi_Hash_FindElementList (progs_t *pr, void *_res)
static void
bi_Hash_Del (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -313,6 +334,7 @@ bi_Hash_Del (progs_t *pr, void *_res)
static void
bi_Hash_DelElement (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -323,6 +345,7 @@ bi_Hash_DelElement (progs_t *pr, void *_res)
static void
bi_Hash_Free (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -332,18 +355,21 @@ bi_Hash_Free (progs_t *pr, void *_res)
static void
bi_Hash_String (progs_t *pr, void *_res)
{
qfZoneScoped (true);
R_INT (pr) = Hash_String (P_GSTRING (pr, 0));
}
static void
bi_Hash_Buffer (progs_t *pr, void *_res)
{
qfZoneScoped (true);
R_INT (pr) = Hash_Buffer (P_GPOINTER (pr, 0), P_INT (pr, 1));
}
static void
bi_Hash_GetList (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
void **list, **l;
@ -364,6 +390,7 @@ bi_Hash_GetList (progs_t *pr, void *_res)
static void
bi_Hash_Stats (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (hash_resources_t *) _res;
bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -373,6 +400,7 @@ bi_Hash_Stats (progs_t *pr, void *_res)
static void
bi_hash_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
hash_resources_t *res = (hash_resources_t *) _res;
bi_hashtab_t *ht;
@ -385,6 +413,7 @@ bi_hash_clear (progs_t *pr, void *_res)
static void
bi_hash_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
hash_resources_t *res = _res;
PR_RESDELMAP (res->table_map);
@ -418,6 +447,7 @@ static builtin_t builtins[] = {
void
RUA_Hash_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
hash_resources_t *res = calloc (1, sizeof (hash_resources_t));
res->tabs = 0;

View file

@ -58,36 +58,42 @@ typedef struct {
static bi_imui_ctx_t *
imui_ctx_new (imui_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->imui_ctx_map);
}
static void
imui_ctx_free (imui_resources_t *res, bi_imui_ctx_t *imui_ctx)
{
qfZoneScoped (true);
PR_RESFREE (res->imui_ctx_map, imui_ctx);
}
static void
imui_ctx_reset (imui_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->imui_ctx_map);
}
static inline bi_imui_ctx_t *
imui_ctx_get (imui_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->imui_ctx_map, index);
}
static inline int __attribute__((pure))
imui_ctx_index (imui_resources_t *res, bi_imui_ctx_t *imui_ctx)
{
qfZoneScoped (true);
return PR_RESINDEX(res->imui_ctx_map, imui_ctx);
}
static void
bi_imui_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
imui_resources_t *res = _res;
for (auto bi_ctx = res->imui_ctxs; bi_ctx; bi_ctx = bi_ctx->next) {
@ -100,6 +106,7 @@ bi_imui_clear (progs_t *pr, void *_res)
static void
bi_imui_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
imui_resources_t *res = _res;
PR_RESDELMAP (res->imui_ctx_map);
dstring_delete (res->dstr);
@ -110,6 +117,7 @@ bi_imui_destroy (progs_t *pr, void *_res)
bi(IMUI_NewWindow)
{
qfZoneScoped (true);
const char *name = P_GSTRING (pr, 0);
imui_window_t *window = PR_Zone_Malloc (pr, sizeof (imui_window_t));
@ -123,24 +131,28 @@ bi(IMUI_NewWindow)
bi(IMUI_DeleteWindow)
{
qfZoneScoped (true);
auto window = (imui_window_t *) P_GPOINTER (pr, 0);
PR_Zone_Free (pr, window);
}
bi(IMUI_Window_IsOpen)
{
qfZoneScoped (true);
auto window = (imui_window_t *) P_GPOINTER (pr, 0);
R_INT (pr) = window->is_open;
}
bi(IMUI_Window_IsCollapsed)
{
qfZoneScoped (true);
auto window = (imui_window_t *) P_GPOINTER (pr, 0);
R_INT (pr) = window->is_collapsed;
}
bi(IMUI_Window_SetSize)
{
qfZoneScoped (true);
auto window = (imui_window_t *) P_GPOINTER (pr, 0);
window->auto_fit = false;
window->xlen = P_INT (pr, 1);
@ -149,6 +161,7 @@ bi(IMUI_Window_SetSize)
bi(IMUI_NewContext)
{
qfZoneScoped (true);
imui_resources_t *res = _res;
const char *font = P_GSTRING (pr, 0);
float font_size = P_FLOAT (pr, 1);
@ -169,6 +182,7 @@ bi(IMUI_NewContext)
static bi_imui_ctx_t *__attribute__((pure))
_get_imui_ctx (imui_resources_t *res, const char *name, int index)
{
qfZoneScoped (true);
auto bi_ctx = imui_ctx_get (res, index);
if (!bi_ctx) {
@ -181,6 +195,7 @@ _get_imui_ctx (imui_resources_t *res, const char *name, int index)
bi(IMUI_DestroyContext)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_DestroyContext (bi_ctx->imui_ctx);
@ -193,6 +208,7 @@ bi(IMUI_DestroyContext)
bi (IMUI_SetVisible)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_SetVisible (bi_ctx->imui_ctx, P_INT (pr, 1));
@ -200,6 +216,7 @@ bi (IMUI_SetVisible)
bi (IMUI_SetSize)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_SetSize (bi_ctx->imui_ctx, P_INT (pr, 1), P_INT (pr, 2));
@ -207,6 +224,7 @@ bi (IMUI_SetSize)
bi (IMUI_ProcessEvent)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
auto ie_event = (struct IE_event_s *) P_GPOINTER (pr, 1);
@ -215,6 +233,7 @@ bi (IMUI_ProcessEvent)
bi (IMUI_BeginFrame)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_BeginFrame (bi_ctx->imui_ctx);
@ -222,6 +241,7 @@ bi (IMUI_BeginFrame)
bi (IMUI_Draw)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Draw (bi_ctx->imui_ctx);
@ -230,6 +250,7 @@ bi (IMUI_Draw)
bi (IMUI_PushLayout)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
R_INT (pr) = IMUI_PushLayout (bi_ctx->imui_ctx, P_INT (pr, 1));
@ -237,6 +258,7 @@ bi (IMUI_PushLayout)
bi (IMUI_PopLayout)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_PopLayout (bi_ctx->imui_ctx);
@ -244,6 +266,7 @@ bi (IMUI_PopLayout)
bi (IMUI_Layout_SetXSize)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Layout_SetXSize (bi_ctx->imui_ctx, P_INT (pr, 1), P_INT (pr, 2));
@ -251,6 +274,7 @@ bi (IMUI_Layout_SetXSize)
bi (IMUI_Layout_SetYSize)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Layout_SetYSize (bi_ctx->imui_ctx, P_INT (pr, 1), P_INT (pr, 2));
@ -258,6 +282,7 @@ bi (IMUI_Layout_SetYSize)
bi (IMUI_PushStyle)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
R_INT (pr) = IMUI_PushStyle (bi_ctx->imui_ctx,
@ -266,6 +291,7 @@ bi (IMUI_PushStyle)
bi (IMUI_PopStyle)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_PopStyle (bi_ctx->imui_ctx);
@ -273,6 +299,7 @@ bi (IMUI_PopStyle)
bi (IMUI_Style_Update)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Style_Update (bi_ctx->imui_ctx, (imui_style_t *) P_GPOINTER (pr, 1));
@ -280,6 +307,7 @@ bi (IMUI_Style_Update)
bi (IMUI_Style_Fetch)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Style_Fetch (bi_ctx->imui_ctx, (imui_style_t *) P_GPOINTER (pr, 1));
@ -287,6 +315,7 @@ bi (IMUI_Style_Fetch)
bi (IMUI_Label)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Label (bi_ctx->imui_ctx, P_GSTRING (pr, 1));
@ -294,6 +323,7 @@ bi (IMUI_Label)
bi (IMUI_Labelf)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
RUA_Sprintf (pr, res->dstr, "IMUI_Labelf", 1);
@ -302,6 +332,7 @@ bi (IMUI_Labelf)
bi (IMUI_Button)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Button (bi_ctx->imui_ctx, P_GSTRING (pr, 1));
@ -309,6 +340,7 @@ bi (IMUI_Button)
bi (IMUI_Checkbox)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
bool flag = *(bool *) P_GPOINTER (pr, 1);
@ -318,6 +350,7 @@ bi (IMUI_Checkbox)
bi (IMUI_Radio)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Radio (bi_ctx->imui_ctx, (int *) P_GPOINTER (pr, 1), P_INT (pr, 2),
@ -326,6 +359,7 @@ bi (IMUI_Radio)
bi (IMUI_Slider)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Slider (bi_ctx->imui_ctx, (float *) P_GPOINTER (pr, 1),
@ -334,6 +368,7 @@ bi (IMUI_Slider)
bi (IMUI_Spacer)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_Spacer (bi_ctx->imui_ctx, P_INT (pr, 1), P_INT (pr, 2),
@ -342,6 +377,7 @@ bi (IMUI_Spacer)
bi (IMUI_FlexibleSpace)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
//IMUI_FlexibleSpace (bi_ctx->imui_ctx);
@ -350,6 +386,7 @@ bi (IMUI_FlexibleSpace)
bi (IMUI_StartPanel)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
R_INT (pr) = IMUI_StartPanel (bi_ctx->imui_ctx,
@ -358,6 +395,7 @@ bi (IMUI_StartPanel)
bi (IMUI_ExtendPanel)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
R_INT (pr) = IMUI_ExtendPanel (bi_ctx->imui_ctx, P_GSTRING (pr, 1));
@ -365,6 +403,7 @@ bi (IMUI_ExtendPanel)
bi (IMUI_EndPanel)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_EndPanel (bi_ctx->imui_ctx);
@ -372,6 +411,7 @@ bi (IMUI_EndPanel)
bi (IMUI_StartMenu)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
R_INT (pr) = IMUI_StartMenu (bi_ctx->imui_ctx,
@ -381,6 +421,7 @@ bi (IMUI_StartMenu)
bi (IMUI_EndMenu)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_EndMenu (bi_ctx->imui_ctx);
@ -388,6 +429,7 @@ bi (IMUI_EndMenu)
bi (IMUI_MenuItem)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
R_INT (pr) = IMUI_MenuItem (bi_ctx->imui_ctx, P_GSTRING (pr, 1),
@ -396,6 +438,7 @@ bi (IMUI_MenuItem)
bi (IMUI_StartWindow)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
auto window = (imui_window_t *) P_GPOINTER (pr, 1);
@ -404,6 +447,7 @@ bi (IMUI_StartWindow)
bi (IMUI_EndWindow)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_EndWindow (bi_ctx->imui_ctx);
@ -411,6 +455,7 @@ bi (IMUI_EndWindow)
bi (IMUI_StartScrollBox)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
const char *name = P_GSTRING (pr, 1);
@ -419,6 +464,7 @@ bi (IMUI_StartScrollBox)
bi (IMUI_EndScrollBox)
{
qfZoneScoped (true);
auto res = (imui_resources_t *) _res;
auto bi_ctx = get_imui_ctx (P_INT (pr, 0));
IMUI_EndScrollBox (bi_ctx->imui_ctx);
@ -475,6 +521,7 @@ static builtin_t builtins[] = {
void
RUA_IMUI_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
imui_resources_t *res = calloc (1, sizeof (imui_resources_t));
res->pr = pr;

View file

@ -55,6 +55,7 @@ static void (*init_funcs[])(progs_t *, int) = {
VISIBLE void
RUA_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
size_t i;
for (i = 0; i < sizeof (init_funcs) / sizeof (init_funcs[0]); i++)

View file

@ -65,6 +65,7 @@ typedef struct input_resources_s {
static void
bi_IN_FindDeviceId (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *id = P_GSTRING (pr, 0);
R_INT (pr) = IN_FindDeviceId (id);
@ -73,6 +74,7 @@ bi_IN_FindDeviceId (progs_t *pr, void *_res)
static void
bi_IN_GetDeviceName (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
RETURN_STRING (pr, IN_GetDeviceName (devid));
@ -81,6 +83,7 @@ bi_IN_GetDeviceName (progs_t *pr, void *_res)
static void
bi_IN_GetDeviceId (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
RETURN_STRING (pr, IN_GetDeviceId (devid));
@ -89,16 +92,19 @@ bi_IN_GetDeviceId (progs_t *pr, void *_res)
static void
bi_IN_AxisInfo (progs_t *pr, void *_res)
{
qfZoneScoped (true);
}
static void
bi_IN_ButtonInfo (progs_t *pr, void *_res)
{
qfZoneScoped (true);
}
static void
bi_IN_GetAxisName (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
int axis = P_INT (pr, 1);
@ -108,6 +114,7 @@ bi_IN_GetAxisName (progs_t *pr, void *_res)
static void
bi_IN_GetButtonName (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
int button = P_INT (pr, 1);
@ -117,6 +124,7 @@ bi_IN_GetButtonName (progs_t *pr, void *_res)
static void
bi_IN_GetAxisNumber (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
const char *axis_name = P_GSTRING (pr, 1);
@ -126,6 +134,7 @@ bi_IN_GetAxisNumber (progs_t *pr, void *_res)
static void
bi_IN_GetButtonNumber (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
const char *button_name = P_GSTRING (pr, 1);
@ -135,18 +144,21 @@ bi_IN_GetButtonNumber (progs_t *pr, void *_res)
static void
bi_IN_ProcessEvents (progs_t *pr, void *_res)
{
qfZoneScoped (true);
IN_ProcessEvents ();
}
static void
bi_IN_ClearStates (progs_t *pr, void *_res)
{
qfZoneScoped (true);
IN_ClearStates ();
}
static int
ptrcmp (const void *a, const void *b)
{
qfZoneScoped (true);
pr_ptr_t ptra = *(const pr_ptr_t *) a;
pr_ptr_t ptrb = *(const pr_ptr_t *) b;
return ptra - ptrb;
@ -155,6 +167,7 @@ ptrcmp (const void *a, const void *b)
static void
bi_add_pointer (ptrset_t *pointers, pr_ptr_t ptr)
{
qfZoneScoped (true);
size_t ind = pointers->size;
if (ind && ptr < pointers->a[ind - 1]) {
pr_ptr_t *p = fbsearch (&ptr, pointers->a, ind, sizeof (pr_ptr_t),
@ -167,6 +180,7 @@ bi_add_pointer (ptrset_t *pointers, pr_ptr_t ptr)
static void
bi_IN_CreateButton (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
const char *name = P_GSTRING (pr, 0);
const char *desc = P_GSTRING (pr, 1);
@ -182,6 +196,7 @@ bi_IN_CreateButton (progs_t *pr, void *_res)
static void
bi_IN_CreateAxis (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
const char *name = P_GSTRING (pr, 0);
const char *desc = P_GSTRING (pr, 1);
@ -197,6 +212,7 @@ bi_IN_CreateAxis (progs_t *pr, void *_res)
static void
bi_IN_GetAxisInfo (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
int axis = P_INT (pr, 1);
@ -212,6 +228,7 @@ bi_IN_GetAxisInfo (progs_t *pr, void *_res)
static void
bi_IN_GetButtonInfo (progs_t *pr, void *_res)
{
qfZoneScoped (true);
int devid = P_INT (pr, 0);
int button = P_INT (pr, 1);
@ -227,6 +244,7 @@ bi_IN_GetButtonInfo (progs_t *pr, void *_res)
static rua_in_cookie_t *
make_cookie (progs_t *pr, input_resources_t *res, pr_func_t func, pr_ptr_t data)
{
qfZoneScoped (true);
rua_in_cookie_t search = {
.func = func,
.data = data,
@ -245,6 +263,7 @@ make_cookie (progs_t *pr, input_resources_t *res, pr_func_t func, pr_ptr_t data)
static rua_in_cookie_t *
find_cookie (progs_t *pr, input_resources_t *res, pr_func_t func, pr_ptr_t data)
{
qfZoneScoped (true);
rua_in_cookie_t search = {
.func = func,
.data = data,
@ -255,6 +274,7 @@ find_cookie (progs_t *pr, input_resources_t *res, pr_func_t func, pr_ptr_t data)
static void
release_cookie (progs_t *pr, input_resources_t *res, rua_in_cookie_t *cookie)
{
qfZoneScoped (true);
if (!--cookie->users) {
Hash_DelElement (res->cookies, cookie);
Hash_Free (res->cookies, cookie);
@ -265,6 +285,7 @@ static void
rua_add_axis_listener (progs_t *pr, input_resources_t *res,
axis_listener_t listener)
{
qfZoneScoped (true);
in_axis_t *axis = &P_STRUCT (pr, in_axis_t, 0);
pr_func_t func = P_FUNCTION (pr, 1);
pr_func_t data = P_POINTER (pr, 2);
@ -276,6 +297,7 @@ static void
rua_remove_axis_listener (progs_t *pr, input_resources_t *res,
axis_listener_t listener)
{
qfZoneScoped (true);
in_axis_t *axis = &P_STRUCT (pr, in_axis_t, 0);
pr_func_t func = P_FUNCTION (pr, 1);
pr_func_t data = P_POINTER (pr, 2);
@ -290,6 +312,7 @@ static void
rua_add_button_listener (progs_t *pr, input_resources_t *res,
button_listener_t listener)
{
qfZoneScoped (true);
in_button_t *button = &P_STRUCT (pr, in_button_t, 0);
pr_func_t func = P_FUNCTION (pr, 1);
pr_func_t data = P_POINTER (pr, 2);
@ -301,6 +324,7 @@ static void
rua_remove_button_listener (progs_t *pr, input_resources_t *res,
button_listener_t listener)
{
qfZoneScoped (true);
in_button_t *button = &P_STRUCT (pr, in_button_t, 0);
pr_func_t func = P_FUNCTION (pr, 1);
pr_func_t data = P_POINTER (pr, 2);
@ -314,6 +338,7 @@ rua_remove_button_listener (progs_t *pr, input_resources_t *res,
static void
rua_listener_func (rua_in_cookie_t *cookie, const void *input)
{
qfZoneScoped (true);
progs_t *pr = cookie->pr;
PR_PushFrame (pr);
PR_RESET_PARAMS (pr);
@ -327,6 +352,7 @@ rua_listener_func (rua_in_cookie_t *cookie, const void *input)
static void
rua_listener_method (rua_in_cookie_t *cookie, const void *input)
{
qfZoneScoped (true);
progs_t *pr = cookie->pr;
PR_PushFrame (pr);
PR_RESET_PARAMS (pr);
@ -341,30 +367,35 @@ rua_listener_method (rua_in_cookie_t *cookie, const void *input)
static void
rua_axis_listener_func (void *data, const in_axis_t *axis)
{
qfZoneScoped (true);
rua_listener_func (data, axis);
}
static void
rua_axis_listener_method (void *data, const in_axis_t *axis)
{
qfZoneScoped (true);
rua_listener_method (data, axis);
}
static void
rua_button_listener_func (void *data, const in_button_t *button)
{
qfZoneScoped (true);
rua_listener_func (data, button);
}
static void
rua_button_listener_method (void *data, const in_button_t *button)
{
qfZoneScoped (true);
rua_listener_method (data, button);
}
static void
rua_IN_ButtonAddListener_func (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_add_button_listener (pr, res, rua_button_listener_func);
}
@ -372,6 +403,7 @@ rua_IN_ButtonAddListener_func (progs_t *pr, void *_res)
static void
rua_IN_ButtonRemoveListener_func (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_remove_button_listener (pr, res, rua_button_listener_func);
}
@ -379,6 +411,7 @@ rua_IN_ButtonRemoveListener_func (progs_t *pr, void *_res)
static void
rua_IN_AxisAddListener_func (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_add_axis_listener (pr, res, rua_axis_listener_func);
}
@ -386,6 +419,7 @@ rua_IN_AxisAddListener_func (progs_t *pr, void *_res)
static void
rua_IN_AxisRemoveListener_func (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_remove_axis_listener (pr, res, rua_axis_listener_func);
}
@ -393,6 +427,7 @@ rua_IN_AxisRemoveListener_func (progs_t *pr, void *_res)
static void
rua_IN_ButtonAddListener_method (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_add_button_listener (pr, res, rua_button_listener_method);
}
@ -400,6 +435,7 @@ rua_IN_ButtonAddListener_method (progs_t *pr, void *_res)
static void
rua_IN_ButtonRemoveListener_method (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_remove_button_listener (pr, res, rua_button_listener_method);
}
@ -407,6 +443,7 @@ rua_IN_ButtonRemoveListener_method (progs_t *pr, void *_res)
static void
rua_IN_AxisAddListener_method (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_add_axis_listener (pr, res, rua_axis_listener_method);
}
@ -414,6 +451,7 @@ rua_IN_AxisAddListener_method (progs_t *pr, void *_res)
static void
rua_IN_AxisRemoveListener_method (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_remove_axis_listener (pr, res, rua_axis_listener_method);
}
@ -421,12 +459,14 @@ rua_IN_AxisRemoveListener_method (progs_t *pr, void *_res)
static void
bi_IN_LoadConfig (progs_t *pr, void *_res)
{
qfZoneScoped (true);
IN_LoadConfig (Plist_GetItem (pr, P_INT (pr, 0)));
}
static void
bi_IMT_CreateContext (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *name = P_GSTRING (pr, 0);
R_INT (pr) = IMT_CreateContext (name);
}
@ -434,18 +474,21 @@ bi_IMT_CreateContext (progs_t *pr, void *_res)
static void
bi_IMT_GetContext (progs_t *pr, void *_res)
{
qfZoneScoped (true);
R_INT (pr) = IMT_GetContext ();
}
static void
bi_IMT_SetContext (progs_t *pr, void *_res)
{
qfZoneScoped (true);
IMT_SetContext (P_INT (pr, 0));
}
static void
secured (progs_t *pr, void *_res)
{
qfZoneScoped (true);
PR_RunError (pr, "Secured function called");
}
@ -508,6 +551,7 @@ static builtin_t builtins[] = {
static void
bi_input_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
Hash_FlushTable (res->cookies);
@ -539,6 +583,7 @@ bi_input_clear (progs_t *pr, void *_res)
static void
bi_input_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
bi_input_clear (pr, res);
Hash_DelTable (res->cookies);
@ -552,6 +597,7 @@ bi_input_destroy (progs_t *pr, void *_res)
static uintptr_t
rua_in_hash_cookie (const void *_cookie, void *_res)
{
qfZoneScoped (true);
const rua_in_cookie_t *cookie = _cookie;
return cookie->func + cookie->data;
}
@ -559,6 +605,7 @@ rua_in_hash_cookie (const void *_cookie, void *_res)
static int
rua_in_cmp_cookies (const void *_a, const void *_b, void *_res)
{
qfZoneScoped (true);
const rua_in_cookie_t *a = _a;
const rua_in_cookie_t *b = _b;
return a->func == b->func && a->data == b->data;
@ -567,6 +614,7 @@ rua_in_cmp_cookies (const void *_a, const void *_b, void *_res)
static void
rua_in_free_cookie (void *_cookie, void *_res)
{
qfZoneScoped (true);
input_resources_t *res = _res;
rua_in_cookie_t *cookie = _cookie;
cmemfree (res->cookie_super, cookie);
@ -575,6 +623,7 @@ rua_in_free_cookie (void *_cookie, void *_res)
void
RUA_Input_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
input_resources_t *res = calloc (sizeof (input_resources_t), 1);
res->cookie_super = new_memsuper ();

View file

@ -43,6 +43,7 @@
static void
bi_Key_keydown (progs_t *pr, void *data)
{
qfZoneScoped (true);
#if 0
int keynum = P_INT (pr, 0);
R_INT (pr) = keydown[keynum];
@ -57,6 +58,7 @@ bi_Key_keydown (progs_t *pr, void *data)
static void
bi_Key_SetBinding (progs_t *pr, void *data)
{
qfZoneScoped (true);
#if 0
const char *imt_name = P_GSTRING (pr, 0);
int keynum = P_INT (pr, 1);
@ -82,6 +84,7 @@ bi_Key_SetBinding (progs_t *pr, void *data)
static void
bi_Key_LookupBinding (progs_t *pr, void *data)
{
qfZoneScoped (true);
#if 0
const char *imt_name = P_GSTRING (pr, 0);
int bindnum = P_INT (pr, 1);
@ -120,6 +123,7 @@ bi_Key_LookupBinding (progs_t *pr, void *data)
static void
bi_Key_CountBinding (progs_t *pr, void *data)
{
qfZoneScoped (true);
#if 0
const char *imt_name = P_GSTRING (pr, 0);
const char *binding = P_GSTRING (pr, 1);
@ -153,6 +157,7 @@ bi_Key_CountBinding (progs_t *pr, void *data)
static void
bi_Key_KeynumToString (progs_t *pr, void *data)
{
qfZoneScoped (true);
int keynum = P_INT (pr, 0);
RETURN_STRING (pr, Key_KeynumToString (keynum));
@ -161,6 +166,7 @@ bi_Key_KeynumToString (progs_t *pr, void *data)
static void
bi_Key_StringToKeynum (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *keyname = P_GSTRING (pr, 0);
R_INT (pr) = Key_StringToKeynum (keyname);
}
@ -181,5 +187,6 @@ static builtin_t builtins[] = {
void
RUA_Key_Init (progs_t *pr, void *data)
{
qfZoneScoped (true);
PR_RegisterBuiltins (pr, builtins, 0);
}

View file

@ -47,12 +47,14 @@
static void
bi_sinf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = sinf (P_FLOAT (pr, 0));
}
static void
bi_sincosf (progs_t *pr, void *data)
{
qfZoneScoped (true);
float *vec = &R_var (pr, float);
float x = P_FLOAT (pr, 0);
sincosf (x, &vec[0], &vec[1]);
@ -61,54 +63,63 @@ bi_sincosf (progs_t *pr, void *data)
static void
bi_cosf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = cosf (P_FLOAT (pr, 0));
}
static void
bi_tanf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = tanf (P_FLOAT (pr, 0));
}
static void
bi_asinf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = asinf (P_FLOAT (pr, 0));
}
static void
bi_acosf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = acosf (P_FLOAT (pr, 0));
}
static void
bi_atanf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = atanf (P_FLOAT (pr, 0));
}
static void
bi_atan2f (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = atan2f (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
}
static void
bi_expf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = expf (P_FLOAT (pr, 0));
}
static void
bi_logf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = logf (P_FLOAT (pr, 0));
}
static void
bi_log2f (progs_t *pr, void *data)
{
qfZoneScoped (true);
#ifdef HAVE_LOG2F
R_FLOAT (pr) = log2f (P_FLOAT (pr, 0));
#else
@ -119,42 +130,49 @@ bi_log2f (progs_t *pr, void *data)
static void
bi_log10f (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = log10f (P_FLOAT (pr, 0));
}
static void
bi_powf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = powf (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
}
static void
bi_sqrtf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = sqrtf (P_FLOAT (pr, 0));
}
static void
bi_cbrtf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = cbrtf (P_FLOAT (pr, 0));
}
static void
bi_hypotf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = hypotf (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
}
static void
bi_sinhf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = sinhf (P_FLOAT (pr, 0));
}
static void
bi_sincoshf (progs_t *pr, void *data)
{
qfZoneScoped (true);
float *vec = &R_var (pr, float);
float x = P_FLOAT (pr, 0);
vec[0] = sinhf (x);
@ -164,18 +182,21 @@ bi_sincoshf (progs_t *pr, void *data)
static void
bi_coshf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = coshf (P_FLOAT (pr, 0));
}
static void
bi_tanhf (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_FLOAT (pr) = tanhf (P_FLOAT (pr, 0));
}
static void
bi_asinhf (progs_t *pr, void *data)
{
qfZoneScoped (true);
double y = P_FLOAT (pr, 0);
R_FLOAT (pr) = logf (y + sqrtf (y * y + 1));
}
@ -183,6 +204,7 @@ bi_asinhf (progs_t *pr, void *data)
static void
bi_acoshf (progs_t *pr, void *data)
{
qfZoneScoped (true);
double y = P_FLOAT (pr, 0);
R_FLOAT (pr) = logf (y + sqrtf (y * y - 1));
}
@ -190,6 +212,7 @@ bi_acoshf (progs_t *pr, void *data)
static void
bi_atanhf (progs_t *pr, void *data)
{
qfZoneScoped (true);
double y = P_FLOAT (pr, 0);
R_FLOAT (pr) = logf ((1 + y) / (1 - y)) / 2;
}
@ -197,30 +220,35 @@ bi_atanhf (progs_t *pr, void *data)
static void
bi_floor (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = floor (P_DOUBLE (pr, 0));
}
static void
bi_ceil (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = ceil (P_DOUBLE (pr, 0));
}
static void
bi_fabs (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = fabs (P_DOUBLE (pr, 0));
}
static void
bi_sin (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = sin (P_DOUBLE (pr, 0));
}
static void
bi_sincos (progs_t *pr, void *data)
{
qfZoneScoped (true);
double *vec = &R_var (pr, double);
float x = P_FLOAT (pr, 0);
sincos (x, &vec[0], &vec[1]);
@ -229,96 +257,112 @@ bi_sincos (progs_t *pr, void *data)
static void
bi_cos (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = cos (P_DOUBLE (pr, 0));
}
static void
bi_tan (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = tan (P_DOUBLE (pr, 0));
}
static void
bi_asin (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = asin (P_DOUBLE (pr, 0));
}
static void
bi_acos (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = acos (P_DOUBLE (pr, 0));
}
static void
bi_atan (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = atan (P_DOUBLE (pr, 0));
}
static void
bi_atan2 (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = atan2 (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
}
static void
bi_exp (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = exp (P_DOUBLE (pr, 0));
}
static void
bi_log (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = log (P_DOUBLE (pr, 0));
}
static void
bi_log2 (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = log (P_DOUBLE (pr, 0)) / M_LOG2E;
}
static void
bi_log10 (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = log10 (P_DOUBLE (pr, 0));
}
static void
bi_pow (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = pow (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
}
static void
bi_sqrt (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = sqrt (P_DOUBLE (pr, 0));
}
static void
bi_cbrt (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = cbrt (P_DOUBLE (pr, 0));
}
static void
bi_hypot (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = hypot (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
}
static void
bi_sinh (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = sinh (P_DOUBLE (pr, 0));
}
static void
bi_sincosh (progs_t *pr, void *data)
{
qfZoneScoped (true);
float *vec = &R_var (pr, float);
float x = P_FLOAT (pr, 0);
vec[0] = sinh (x);
@ -328,18 +372,21 @@ bi_sincosh (progs_t *pr, void *data)
static void
bi_cosh (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = cosh (P_DOUBLE (pr, 0));
}
static void
bi_tanh (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_DOUBLE (pr) = tanh (P_DOUBLE (pr, 0));
}
static void
bi_asinh (progs_t *pr, void *data)
{
qfZoneScoped (true);
double y = P_DOUBLE (pr, 0);
R_DOUBLE (pr) = log (y + sqrt (y * y + 1));
}
@ -347,6 +394,7 @@ bi_asinh (progs_t *pr, void *data)
static void
bi_acosh (progs_t *pr, void *data)
{
qfZoneScoped (true);
double y = P_DOUBLE (pr, 0);
R_DOUBLE (pr) = log (y + sqrt (y * y - 1));
}
@ -354,6 +402,7 @@ bi_acosh (progs_t *pr, void *data)
static void
bi_atanh (progs_t *pr, void *data)
{
qfZoneScoped (true);
double y = P_DOUBLE (pr, 0);
R_DOUBLE (pr) = log ((1 + y) / (1 - y)) / 2;
}
@ -416,5 +465,6 @@ static builtin_t builtins[] = {
void
RUA_Math_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
PR_RegisterBuiltins (pr, builtins, 0);
}

View file

@ -53,36 +53,42 @@ typedef struct {
static mtstate_t *
state_new (mtwist_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->state_map);
}
static void
state_free (mtwist_resources_t *res, mtstate_t *state)
{
qfZoneScoped (true);
PR_RESFREE (res->state_map, state);
}
static void
state_reset (mtwist_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->state_map);
}
static inline mtstate_t *
state_get (mtwist_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->state_map, index);
}
static inline int __attribute__((pure))
state_index (mtwist_resources_t *res, mtstate_t *state)
{
qfZoneScoped (true);
return PR_RESINDEX(res->state_map, state);
}
static void
bi_mtwist_new (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = (mtwist_resources_t *) _res;
mtstate_t *mt = state_new (res);
mtwist_seed (mt, P_INT (pr, 0));
@ -92,6 +98,7 @@ bi_mtwist_new (progs_t *pr, void *_res)
static mtstate_t * __attribute__((pure))
get_state (progs_t *pr, mtwist_resources_t *res, const char *name, int index)
{
qfZoneScoped (true);
mtstate_t *mt = state_get (res, index);
if (!mt)
@ -103,6 +110,7 @@ get_state (progs_t *pr, mtwist_resources_t *res, const char *name, int index)
static void
bi_mtwist_delete (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = _res;
mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0));
state_free (res, mt);
@ -111,6 +119,7 @@ bi_mtwist_delete (progs_t *pr, void *_res)
static void
bi_mtwist_seed (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = _res;
mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0));
mtwist_seed (mt, P_INT (pr, 1));
@ -119,6 +128,7 @@ bi_mtwist_seed (progs_t *pr, void *_res)
static void
bi_mtwist_rand (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = _res;
mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = mtwist_rand (mt);
@ -127,6 +137,7 @@ bi_mtwist_rand (progs_t *pr, void *_res)
static void
bi_mtwist_rand_0_1 (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = _res;
mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0));
R_FLOAT (pr) = mtwist_rand_0_1 (mt);
@ -135,6 +146,7 @@ bi_mtwist_rand_0_1 (progs_t *pr, void *_res)
static void
bi_mtwist_rand_m1_1 (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = _res;
mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0));
R_FLOAT (pr) = mtwist_rand_m1_1 (mt);
@ -143,6 +155,7 @@ bi_mtwist_rand_m1_1 (progs_t *pr, void *_res)
static void
bi_mtwist_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
mtwist_resources_t *res = (mtwist_resources_t *) _res;
state_reset (res);
}
@ -150,6 +163,7 @@ bi_mtwist_clear (progs_t *pr, void *_res)
static void
bi_mtwist_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
free (_res);
}
@ -168,6 +182,7 @@ static builtin_t builtins[] = {
void
RUA_Mersenne_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
mtwist_resources_t *res = calloc (1, sizeof (mtwist_resources_t));
PR_Resources_Register (pr, "Mersenne Twister", res, bi_mtwist_clear,

View file

@ -56,24 +56,28 @@ typedef struct {
static rua_model_t *
rua_model_handle_new (rua_model_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->model_map);
}
static void
rua_model_handle_free (rua_model_resources_t *res, rua_model_t *handle)
{
qfZoneScoped (true);
PR_RESFREE (res->model_map, handle);
}
static void
rua_model_handle_reset (rua_model_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->model_map);
}
static inline rua_model_t * __attribute__((pure))
rua__model_handle_get (rua_model_resources_t *res, int index, const char *name)
{
qfZoneScoped (true);
rua_model_t *handle = 0;
handle = PR_RESGET(res->model_map, index);
@ -88,12 +92,14 @@ rua__model_handle_get (rua_model_resources_t *res, int index, const char *name)
static inline int __attribute__((pure))
rua_model_handle_index (rua_model_resources_t *res, rua_model_t *handle)
{
qfZoneScoped (true);
return PR_RESINDEX(res->model_map, handle);
}
static void
bi_rua_model_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_model_resources_t *res = (rua_model_resources_t *) _res;
rua_model_t *handle;
@ -106,6 +112,7 @@ bi_rua_model_clear (progs_t *pr, void *_res)
static void
bi_rua_model_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_model_resources_t *res = _res;
PR_RESDELMAP (res->model_map);
free (res);
@ -114,6 +121,7 @@ bi_rua_model_destroy (progs_t *pr, void *_res)
static int
alloc_handle (rua_model_resources_t *res, model_t *model)
{
qfZoneScoped (true);
rua_model_t *handle = rua_model_handle_new (res);
if (!handle)
@ -131,6 +139,7 @@ alloc_handle (rua_model_resources_t *res, model_t *model)
static void
bi_Model_Load (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (rua_model_resources_t *) _res;
const char *path = P_GSTRING (pr, 0);
model_t *model;
@ -145,6 +154,7 @@ bi_Model_Load (progs_t *pr, void *_res)
model_t *
Model_GetModel (progs_t *pr, int handle)
{
qfZoneScoped (true);
if (!handle) {
return 0;
}
@ -157,6 +167,7 @@ Model_GetModel (progs_t *pr, int handle)
static void
bi_Model_Unload (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (rua_model_resources_t *) _res;
int handle = P_INT (pr, 0);
rua_model_t *h = rua_model_handle_get (res, handle);
@ -182,6 +193,7 @@ static builtin_t builtins[] = {
void
RUA_Model_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
rua_model_resources_t *res = calloc (sizeof (rua_model_resources_t), 1);
res->pr = pr;

View file

@ -58,12 +58,14 @@ typedef struct {
static msgbuf_t *
msgbuf_new (msgbuf_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->msgbuf_map);
}
static void
msgbuf_free (progs_t *pr, msgbuf_resources_t *res, msgbuf_t *msgbuf)
{
qfZoneScoped (true);
PR_Zone_Free (pr, msgbuf->sizebuf.data);
PR_RESFREE (res->msgbuf_map, msgbuf);
}
@ -71,24 +73,28 @@ msgbuf_free (progs_t *pr, msgbuf_resources_t *res, msgbuf_t *msgbuf)
static void
msgbuf_reset (msgbuf_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->msgbuf_map);
}
static inline msgbuf_t *
msgbuf_get (msgbuf_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->msgbuf_map, index);
}
static inline int __attribute__((pure))
msgbuf_index (msgbuf_resources_t *res, msgbuf_t *msgbuf)
{
qfZoneScoped (true);
return PR_RESINDEX(res->msgbuf_map, msgbuf);
}
static void
bi_msgbuf_clear (progs_t *pr, void *data)
{
qfZoneScoped (true);
msgbuf_resources_t *res = (msgbuf_resources_t *) data;
msgbuf_reset (res);
@ -97,12 +103,14 @@ bi_msgbuf_clear (progs_t *pr, void *data)
static void
bi_msgbuf_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
free (_res);
}
static int
alloc_msgbuf (msgbuf_resources_t *res, byte *buf, int size)
{
qfZoneScoped (true);
msgbuf_t *msgbuf = msgbuf_new (res);
if (!msgbuf)
@ -119,6 +127,7 @@ alloc_msgbuf (msgbuf_resources_t *res, byte *buf, int size)
static msgbuf_t * __attribute__((pure))
get_msgbuf (progs_t *pr, msgbuf_resources_t *res, const char *name, int msgbuf)
{
qfZoneScoped (true);
msgbuf_t *mb = msgbuf_get (res, msgbuf);
if (!mb)
@ -129,6 +138,7 @@ get_msgbuf (progs_t *pr, msgbuf_resources_t *res, const char *name, int msgbuf)
static void
bi_MsgBuf_New (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = PR_Resources_Find (pr, "MsgBuf");
int size = P_INT (pr, 0);
byte *buf;
@ -140,6 +150,7 @@ bi_MsgBuf_New (progs_t *pr, void *_res)
static void
bi_MsgBuf_Delete (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = PR_Resources_Find (pr, "MsgBuf");
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
msgbuf_free (pr, res, mb);
@ -148,6 +159,7 @@ bi_MsgBuf_Delete (progs_t *pr, void *_res)
static void
bi_MsgBuf_FromFile (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
QFile *file = QFile_GetFile (pr, P_INT (pr, 1));
@ -162,6 +174,7 @@ bi_MsgBuf_FromFile (progs_t *pr, void *_res)
static void
bi_MsgBuf_MaxSize (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = mb->sizebuf.maxsize;
@ -170,6 +183,7 @@ bi_MsgBuf_MaxSize (progs_t *pr, void *_res)
static void
bi_MsgBuf_CurSize (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = mb->sizebuf.cursize;
@ -178,6 +192,7 @@ bi_MsgBuf_CurSize (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadCount (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = mb->msg.readcount;
@ -186,6 +201,7 @@ bi_MsgBuf_ReadCount (progs_t *pr, void *_res)
static void
bi_MsgBuf_DataPtr (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
byte *ptr = mb->sizebuf.data + mb->msg.readcount;
@ -195,6 +211,7 @@ bi_MsgBuf_DataPtr (progs_t *pr, void *_res)
static void
bi_MsgBuf_Clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
SZ_Clear (&mb->sizebuf);
@ -203,6 +220,7 @@ bi_MsgBuf_Clear (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteByte (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteByte (&mb->sizebuf, P_INT (pr, 1));
@ -211,6 +229,7 @@ bi_MsgBuf_WriteByte (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteShort (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteShort (&mb->sizebuf, P_INT (pr, 1));
@ -219,6 +238,7 @@ bi_MsgBuf_WriteShort (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteLong (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteLong (&mb->sizebuf, P_INT (pr, 1));
@ -227,6 +247,7 @@ bi_MsgBuf_WriteLong (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteFloat (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteFloat (&mb->sizebuf, P_FLOAT (pr, 1));
@ -235,6 +256,7 @@ bi_MsgBuf_WriteFloat (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteString (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteString (&mb->sizebuf, P_GSTRING (pr, 1));
@ -243,6 +265,7 @@ bi_MsgBuf_WriteString (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteBytes (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteBytes (&mb->sizebuf, P_INT (pr, 1));
@ -251,6 +274,7 @@ bi_MsgBuf_WriteBytes (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteCoord (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteCoord (&mb->sizebuf, P_FLOAT (pr, 1));
@ -259,6 +283,7 @@ bi_MsgBuf_WriteCoord (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteCoordV (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteCoordV (&mb->sizebuf, P_VECTOR (pr, 1));
@ -267,6 +292,7 @@ bi_MsgBuf_WriteCoordV (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteCoordAngleV (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteCoordAngleV (&mb->sizebuf,
@ -276,6 +302,7 @@ bi_MsgBuf_WriteCoordAngleV (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteAngle (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteAngle (&mb->sizebuf, P_FLOAT (pr, 1));
@ -284,6 +311,7 @@ bi_MsgBuf_WriteAngle (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteAngleV (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteAngleV (&mb->sizebuf, P_VECTOR (pr, 1));
@ -292,6 +320,7 @@ bi_MsgBuf_WriteAngleV (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteAngle16 (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteAngle16 (&mb->sizebuf, P_FLOAT (pr, 1));
@ -300,6 +329,7 @@ bi_MsgBuf_WriteAngle16 (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteAngle16V (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteAngle16V (&mb->sizebuf, P_VECTOR (pr, 1));
@ -308,6 +338,7 @@ bi_MsgBuf_WriteAngle16V (progs_t *pr, void *_res)
static void
bi_MsgBuf_WriteUTF8 (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_WriteUTF8 (&mb->sizebuf, P_INT (pr, 1));
@ -316,6 +347,7 @@ bi_MsgBuf_WriteUTF8 (progs_t *pr, void *_res)
static void
bi_MsgBuf_BeginReading (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_BeginReading (&mb->msg);
@ -324,6 +356,7 @@ bi_MsgBuf_BeginReading (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadByte (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = MSG_ReadByte (&mb->msg);
@ -332,6 +365,7 @@ bi_MsgBuf_ReadByte (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadShort (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = MSG_ReadShort (&mb->msg);
@ -340,6 +374,7 @@ bi_MsgBuf_ReadShort (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadLong (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = MSG_ReadLong (&mb->msg);
@ -348,6 +383,7 @@ bi_MsgBuf_ReadLong (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadFloat (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_FLOAT (pr) = MSG_ReadFloat (&mb->msg);
@ -356,6 +392,7 @@ bi_MsgBuf_ReadFloat (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadString (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
const char *str;
@ -367,6 +404,7 @@ bi_MsgBuf_ReadString (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadBytes (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_ReadBytes (&mb->msg);
@ -375,6 +413,7 @@ bi_MsgBuf_ReadBytes (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadCoord (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_FLOAT (pr) = MSG_ReadCoord (&mb->msg);
@ -383,6 +422,7 @@ bi_MsgBuf_ReadCoord (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadCoordV (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_ReadCoordV (&mb->msg, R_VECTOR (pr));
@ -391,6 +431,7 @@ bi_MsgBuf_ReadCoordV (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadCoordAngleV (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_ReadCoordAngleV (&mb->msg, P_VECTOR (pr, 1), P_VECTOR (pr, 2));
@ -399,6 +440,7 @@ bi_MsgBuf_ReadCoordAngleV (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadAngle (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_FLOAT (pr) = MSG_ReadAngle (&mb->msg);
@ -407,6 +449,7 @@ bi_MsgBuf_ReadAngle (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadAngleV (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_ReadAngleV (&mb->msg, R_VECTOR (pr));
@ -415,6 +458,7 @@ bi_MsgBuf_ReadAngleV (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadAngle16 (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_FLOAT (pr) = MSG_ReadAngle16 (&mb->msg);
@ -423,6 +467,7 @@ bi_MsgBuf_ReadAngle16 (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadAngle16V (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
MSG_ReadAngle16V (&mb->msg, R_VECTOR (pr));
@ -431,6 +476,7 @@ bi_MsgBuf_ReadAngle16V (progs_t *pr, void *_res)
static void
bi_MsgBuf_ReadUTF8 (progs_t *pr, void *_res)
{
qfZoneScoped (true);
msgbuf_resources_t *res = _res;
msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = MSG_ReadUTF8 (&mb->msg);
@ -485,6 +531,7 @@ static builtin_t builtins[] = {
void
RUA_MsgBuf_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
msgbuf_resources_t *res = calloc (sizeof (msgbuf_resources_t), 1);
PR_Resources_Register (pr, "MsgBuf", res, bi_msgbuf_clear,

View file

@ -150,6 +150,7 @@ typedef struct probj_resources_s {
static dtable_t *
dtable_new (probj_t *probj)
{
qfZoneScoped (true);
dtable_t *dtable = PR_RESNEW (probj->dtables);
dtable->next = probj->dtable_list;
dtable->prev = &probj->dtable_list;
@ -163,6 +164,7 @@ dtable_new (probj_t *probj)
static void
dtable_reset (probj_t *probj)
{
qfZoneScoped (true);
PR_RESRESET (probj->dtables);
probj->dtable_list = 0;
}
@ -170,18 +172,21 @@ dtable_reset (probj_t *probj)
static inline dtable_t *
dtable_get (probj_t *probj, int index)
{
qfZoneScoped (true);
return PR_RESGET (probj->dtables, index);
}
static inline int __attribute__((pure))
dtable_index (probj_t *probj, dtable_t *dtable)
{
qfZoneScoped (true);
return PR_RESINDEX (probj->dtables, dtable);
}
static always_inline dtable_t * __attribute__((pure))
get_dtable (probj_t *probj, const char *name, int index)
{
qfZoneScoped (true);
dtable_t *dtable = dtable_get (probj, index);
if (!dtable) {
@ -193,6 +198,7 @@ get_dtable (probj_t *probj, const char *name, int index)
static obj_list *
obj_list_new (probj_t *probj)
{
qfZoneScoped (true);
int i;
obj_list *l;
@ -213,6 +219,7 @@ obj_list_new (probj_t *probj)
static void
obj_list_free (probj_t *probj, obj_list *l)
{
qfZoneScoped (true);
obj_list *e;
if (!l)
@ -227,6 +234,7 @@ obj_list_free (probj_t *probj, obj_list *l)
static inline obj_list *
list_cons (probj_t *probj, void *data, obj_list *next)
{
qfZoneScoped (true);
obj_list *l = obj_list_new (probj);
l->data = data;
l->next = next;
@ -236,6 +244,7 @@ list_cons (probj_t *probj, void *data, obj_list *next)
static inline void
list_remove (probj_t *probj, obj_list **list)
{
qfZoneScoped (true);
if ((*list)->next) {
obj_list *l = *list;
*list = (*list)->next;
@ -250,6 +259,7 @@ list_remove (probj_t *probj, obj_list **list)
static class_tree *
class_tree_new (probj_t *probj)
{
qfZoneScoped (true);
int i;
class_tree *t;
@ -271,6 +281,7 @@ static int
class_is_subclass_of_class (probj_t *probj, pr_class_t *class,
pr_class_t *superclass)
{
qfZoneScoped (true);
while (class) {
if (class == superclass)
return 1;
@ -286,6 +297,7 @@ static class_tree *
create_tree_of_subclasses_inherited_from (probj_t *probj, pr_class_t *bottom,
pr_class_t *upper)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
const char *super_class = PR_GetString (pr, bottom->super_class);
pr_class_t *superclass;
@ -311,6 +323,7 @@ create_tree_of_subclasses_inherited_from (probj_t *probj, pr_class_t *bottom,
static class_tree *
_obj_tree_insert_class (probj_t *probj, class_tree *tree, pr_class_t *class)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
obj_list *subclasses;
class_tree *new_tree;
@ -356,6 +369,7 @@ _obj_tree_insert_class (probj_t *probj, class_tree *tree, pr_class_t *class)
static void
obj_tree_insert_class (probj_t *probj, pr_class_t *class)
{
qfZoneScoped (true);
obj_list *list_node;
class_tree *tree;
@ -379,6 +393,7 @@ obj_tree_insert_class (probj_t *probj, pr_class_t *class)
static void
obj_create_classes_tree (probj_t *probj, pr_module_t *module)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_symtab_t *symtab = &G_STRUCT (pr, pr_symtab_t, module->symtab);
int i;
@ -392,6 +407,7 @@ obj_create_classes_tree (probj_t *probj, pr_module_t *module)
static void
obj_destroy_class_tree_node (probj_t *probj, class_tree *tree, int level)
{
qfZoneScoped (true);
tree->subclasses = (obj_list *) probj->class_tree_free_list;
probj->class_tree_free_list = tree;
}
@ -400,6 +416,7 @@ static void
obj_preorder_traverse (probj_t *probj, class_tree *tree, int level,
void (*func) (probj_t *, class_tree *, int))
{
qfZoneScoped (true);
obj_list *node;
func (probj, tree, level);
@ -411,6 +428,7 @@ static void
obj_postorder_traverse (probj_t *probj, class_tree *tree, int level,
void (*func) (probj_t *, class_tree *, int))
{
qfZoneScoped (true);
obj_list *node;
for (node = tree->subclasses; node; node = node->next)
@ -421,6 +439,7 @@ obj_postorder_traverse (probj_t *probj, class_tree *tree, int level,
static const char *
selector_get_key (const void *s, void *_probj)
{
qfZoneScoped (true);
__auto_type probj = (probj_t *) _probj;
return PR_GetString (probj->pr, probj->selector_names[(intptr_t) s]);
}
@ -428,6 +447,7 @@ selector_get_key (const void *s, void *_probj)
static const char *
class_get_key (const void *c, void *_probj)
{
qfZoneScoped (true);
__auto_type probj = (probj_t *) _probj;
return PR_GetString (probj->pr, ((pr_class_t *)c)->name);
}
@ -435,6 +455,7 @@ class_get_key (const void *c, void *_probj)
static const char *
protocol_get_key (const void *p, void *_probj)
{
qfZoneScoped (true);
__auto_type probj = (probj_t *) _probj;
return PR_GetString (probj->pr, ((pr_protocol_t *)p)->protocol_name);
}
@ -442,18 +463,21 @@ protocol_get_key (const void *p, void *_probj)
static uintptr_t
load_methods_get_hash (const void *m, void *_probj)
{
qfZoneScoped (true);
return (uintptr_t) m;
}
static int
load_methods_compare (const void *m1, const void *m2, void *_probj)
{
qfZoneScoped (true);
return m1 == m2;
}
static inline int
sel_eq (pr_sel_t *s1, pr_sel_t *s2)
{
qfZoneScoped (true);
if (!s1 || !s2)
return s1 == s2;
return s1->sel_id == s2->sel_id;
@ -462,6 +486,7 @@ sel_eq (pr_sel_t *s1, pr_sel_t *s2)
static int
object_is_instance (probj_t *probj, pr_id_t *object)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *class;
@ -475,6 +500,7 @@ object_is_instance (probj_t *probj, pr_id_t *object)
static pr_string_t
object_get_class_name (probj_t *probj, pr_id_t *object)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *class;
@ -497,6 +523,7 @@ object_get_class_name (probj_t *probj, pr_id_t *object)
static void
finish_class (probj_t *probj, pr_class_t *class, pr_ptr_t object_ptr)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *meta = &G_STRUCT (pr, pr_class_t, class->class_pointer);
pr_class_t *val;
@ -526,6 +553,7 @@ finish_class (probj_t *probj, pr_class_t *class, pr_ptr_t object_ptr)
static int
add_sel_name (probj_t *probj, const char *name)
{
qfZoneScoped (true);
int ind = ++probj->selector_index;
int size, i;
@ -552,6 +580,7 @@ static pr_sel_t *
sel_register_typed_name (probj_t *probj, const char *name, const char *types,
pr_sel_t *sel)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
intptr_t index;
int is_new = 0;
@ -620,6 +649,7 @@ done:
static pr_sel_t *
sel_register_name (probj_t *probj, const char *name)
{
qfZoneScoped (true);
return sel_register_typed_name (probj, name, "", 0);
}
@ -627,6 +657,7 @@ static void
obj_register_selectors_from_description_list (probj_t *probj,
pr_method_description_list_t *method_list)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
int i;
@ -646,6 +677,7 @@ static void
obj_register_selectors_from_list (probj_t *probj,
pr_method_list_t *method_list)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
int i;
@ -661,6 +693,7 @@ obj_register_selectors_from_list (probj_t *probj,
static void
obj_register_selectors_from_class (probj_t *probj, pr_class_t *class)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_method_list_t *method_list = &G_STRUCT (pr, pr_method_list_t,
class->methods);
@ -677,6 +710,7 @@ static void
obj_init_protocol (probj_t *probj, pr_class_t *proto_class,
pr_protocol_t *proto)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
if (!proto->class_pointer) {
@ -702,6 +736,7 @@ obj_init_protocol (probj_t *probj, pr_class_t *proto_class,
static void
obj_init_protocols (probj_t *probj, pr_protocol_list_t *protos)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *proto_class;
pr_protocol_t *proto;
@ -726,6 +761,7 @@ static void
class_add_method_list (probj_t *probj, pr_class_t *class,
pr_method_list_t *list)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
int i;
@ -747,6 +783,7 @@ static void
obj_class_add_protocols (probj_t *probj, pr_class_t *class,
pr_protocol_list_t *protos)
{
qfZoneScoped (true);
if (!protos)
return;
@ -757,6 +794,7 @@ obj_class_add_protocols (probj_t *probj, pr_class_t *class,
static void
finish_category (probj_t *probj, pr_category_t *category, pr_class_t *class)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_method_list_t *method_list;
pr_protocol_list_t *protocol_list;
@ -784,6 +822,7 @@ static void
obj_send_message_in_list (probj_t *probj, pr_method_list_t *method_list,
pr_class_t *class, pr_sel_t *op)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
int i;
@ -812,6 +851,7 @@ obj_send_message_in_list (probj_t *probj, pr_method_list_t *method_list,
static void
send_load (probj_t *probj, class_tree *tree, int level)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_sel_t *load_sel = sel_register_name (probj, "load");
pr_class_t *class = tree->class;
@ -825,6 +865,7 @@ send_load (probj_t *probj, class_tree *tree, int level)
static void
obj_send_load (probj_t *probj)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
obj_list *m;
@ -865,6 +906,7 @@ obj_send_load (probj_t *probj)
static pr_method_t *
obj_find_message (probj_t *probj, pr_class_t *class, pr_sel_t *selector)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *c = class;
pr_method_list_t *method_list;
@ -919,6 +961,7 @@ obj_find_message (probj_t *probj, pr_class_t *class, pr_sel_t *selector)
static void
obj_send_initialize (probj_t *probj, pr_class_t *class)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_method_list_t *method_list;
pr_method_t *method;
@ -962,6 +1005,7 @@ static void
obj_install_methods_in_dtable (probj_t *probj, pr_class_t *class,
pr_method_list_t *method_list)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
dtable_t *dtable;
@ -987,6 +1031,7 @@ obj_install_methods_in_dtable (probj_t *probj, pr_class_t *class,
static void
obj_install_dispatch_table_for_class (probj_t *probj, pr_class_t *class)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *super = &G_STRUCT (pr, pr_class_t, class->super_class);
dtable_t *dtable;
@ -1018,6 +1063,7 @@ obj_install_dispatch_table_for_class (probj_t *probj, pr_class_t *class)
static inline dtable_t *
obj_check_dtable_installed (probj_t *probj, pr_class_t *class)
{
qfZoneScoped (true);
if (!class->dtable) {
obj_install_dispatch_table_for_class (probj, class);
}
@ -1027,6 +1073,7 @@ obj_check_dtable_installed (probj_t *probj, pr_class_t *class)
static pr_func_t
get_imp (probj_t *probj, pr_class_t *class, pr_sel_t *sel)
{
qfZoneScoped (true);
pr_func_t imp = 0;
if (class->dtable) {
@ -1049,6 +1096,7 @@ get_imp (probj_t *probj, pr_class_t *class, pr_sel_t *sel)
static int
obj_reponds_to (probj_t *probj, pr_id_t *obj, pr_sel_t *sel)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *class;
dtable_t *dtable;
@ -1066,6 +1114,7 @@ obj_reponds_to (probj_t *probj, pr_id_t *obj, pr_sel_t *sel)
static pr_func_t
obj_msg_lookup (probj_t *probj, pr_id_t *receiver, pr_sel_t *op)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *class;
if (!receiver)
@ -1085,6 +1134,7 @@ obj_msg_lookup (probj_t *probj, pr_id_t *receiver, pr_sel_t *op)
static pr_func_t
obj_msg_lookup_super (probj_t *probj, pr_super_t *super, pr_sel_t *op)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_class_t *class;
@ -1099,6 +1149,7 @@ static void
obj_verror (probj_t *probj, pr_id_t *object, int code, const char *fmt, int count,
pr_type_t **args)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
const char *name = "nil";
if (object) {
@ -1113,6 +1164,7 @@ obj_verror (probj_t *probj, pr_id_t *object, int code, const char *fmt, int coun
static void
dump_ivars (probj_t *probj, pr_ptr_t _ivars)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_ivar_list_t *ivars;
int i;
@ -1131,6 +1183,7 @@ dump_ivars (probj_t *probj, pr_ptr_t _ivars)
static void
obj_init_statics (probj_t *probj)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
obj_list **cell = &probj->uninitialized_statics;
pr_ptr_t *ptr;
@ -1176,6 +1229,7 @@ obj_init_statics (probj_t *probj)
static void
rua___obj_exec_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_module_t *module = &P_STRUCT (pr, pr_module_t, 0);
pr_symtab_t *symtab;
@ -1324,6 +1378,7 @@ rua___obj_exec_class (progs_t *pr, void *data)
static void
rua___obj_forward (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *obj = &P_STRUCT (pr, pr_id_t, 0);
pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 1);
@ -1412,6 +1467,7 @@ rua___obj_forward (progs_t *pr, void *data)
static void
rua___obj_responds_to (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *obj = &P_STRUCT (pr, pr_id_t, 0);
pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 1);
@ -1422,6 +1478,7 @@ rua___obj_responds_to (progs_t *pr, void *data)
static void
rua_obj_error (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
int code = P_INT (pr, 1);
@ -1447,6 +1504,7 @@ rua_obj_error (progs_t *pr, void *data)
static void
rua_obj_verror (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
int code = P_INT (pr, 1);
@ -1464,6 +1522,7 @@ rua_obj_verror (progs_t *pr, void *data)
static void
rua_obj_set_error_handler (progs_t *pr, void *data)
{
qfZoneScoped (true);
//probj_t *probj = pr->pr_objective_resources;
//pr_func_t func = P_INT (pr, 0);
//arglist
@ -1474,6 +1533,7 @@ rua_obj_set_error_handler (progs_t *pr, void *data)
static const char *
rua_at_handler (progs_t *pr, pr_ptr_t at_param, void *_probj)
{
qfZoneScoped (true);
if (!at_param) {
return "nil";
}
@ -1499,6 +1559,7 @@ rua_at_handler (progs_t *pr, pr_ptr_t at_param, void *_probj)
static void
rua_obj_msg_lookup (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *receiver = &P_STRUCT (pr, pr_id_t, 0);
pr_sel_t *op = &P_STRUCT (pr, pr_sel_t, 1);
@ -1509,6 +1570,7 @@ rua_obj_msg_lookup (progs_t *pr, void *data)
static void
rua_obj_msg_lookup_super (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_super_t *super = &P_STRUCT (pr, pr_super_t, 0);
pr_sel_t *_cmd = &P_STRUCT (pr, pr_sel_t, 1);
@ -1519,6 +1581,7 @@ rua_obj_msg_lookup_super (progs_t *pr, void *data)
static void
rua_obj_msg_sendv (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_ptr_t obj = P_POINTER (pr, 0);
pr_id_t *receiver = &P_STRUCT (pr, pr_id_t, 0);
@ -1563,6 +1626,7 @@ rua_obj_msg_sendv (progs_t *pr, void *data)
static void
rua_obj_increment_retaincount (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0);
R_INT (pr) = ++RETAIN_COUNT (obj);
}
@ -1570,6 +1634,7 @@ rua_obj_increment_retaincount (progs_t *pr, void *data)
static void
rua_obj_decrement_retaincount (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0);
R_INT (pr) = --RETAIN_COUNT (obj);
}
@ -1577,6 +1642,7 @@ rua_obj_decrement_retaincount (progs_t *pr, void *data)
static void
rua_obj_get_retaincount (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0);
R_INT (pr) = RETAIN_COUNT (obj);
}
@ -1584,6 +1650,7 @@ rua_obj_get_retaincount (progs_t *pr, void *data)
static void
rua_obj_malloc (progs_t *pr, void *data)
{
qfZoneScoped (true);
int size = P_INT (pr, 0) * sizeof (pr_type_t);
void *mem = PR_Zone_Malloc (pr, size);
@ -1593,6 +1660,7 @@ rua_obj_malloc (progs_t *pr, void *data)
static void
rua_obj_atomic_malloc (progs_t *pr, void *data)
{
qfZoneScoped (true);
int size = P_INT (pr, 0) * sizeof (pr_type_t);
void *mem = PR_Zone_Malloc (pr, size);
@ -1602,6 +1670,7 @@ rua_obj_atomic_malloc (progs_t *pr, void *data)
static void
rua_obj_valloc (progs_t *pr, void *data)
{
qfZoneScoped (true);
int size = P_INT (pr, 0) * sizeof (pr_type_t);
void *mem = PR_Zone_Malloc (pr, size);
@ -1611,6 +1680,7 @@ rua_obj_valloc (progs_t *pr, void *data)
static void
rua_obj_realloc (progs_t *pr, void *data)
{
qfZoneScoped (true);
void *mem = (void*)P_GPOINTER (pr, 0);
int size = P_INT (pr, 1) * sizeof (pr_type_t);
@ -1621,6 +1691,7 @@ rua_obj_realloc (progs_t *pr, void *data)
static void
rua_obj_calloc (progs_t *pr, void *data)
{
qfZoneScoped (true);
int size = P_INT (pr, 0) * P_INT (pr, 1) * sizeof (pr_type_t);
void *mem = PR_Zone_Malloc (pr, size);
@ -1631,6 +1702,7 @@ rua_obj_calloc (progs_t *pr, void *data)
static void
rua_obj_free (progs_t *pr, void *data)
{
qfZoneScoped (true);
void *mem = (void*)P_GPOINTER (pr, 0);
PR_Zone_Free (pr, mem);
@ -1639,6 +1711,7 @@ rua_obj_free (progs_t *pr, void *data)
static void
rua_obj_get_uninstalled_dtable (progs_t *pr, void *data)
{
qfZoneScoped (true);
//probj_t *probj = pr->pr_objective_resources;
//XXX
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
@ -1647,6 +1720,7 @@ rua_obj_get_uninstalled_dtable (progs_t *pr, void *data)
static void
rua_obj_msgSend (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *self = &P_STRUCT (pr, pr_id_t, 0);
pr_sel_t *_cmd = &P_STRUCT (pr, pr_sel_t, 1);
@ -1673,6 +1747,7 @@ rua_obj_msgSend (progs_t *pr, void *data)
static void
rua_obj_msgSend_super (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_super_t *super = &P_STRUCT (pr, pr_super_t, 0);
pr_sel_t *_cmd = &P_STRUCT (pr, pr_sel_t, 1);
@ -1695,6 +1770,7 @@ rua_obj_msgSend_super (progs_t *pr, void *data)
static void
rua_obj_get_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
const char *name = P_GSTRING (pr, 0);
pr_class_t *class;
@ -1708,6 +1784,7 @@ rua_obj_get_class (progs_t *pr, void *data)
static void
rua_obj_lookup_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
const char *name = P_GSTRING (pr, 0);
pr_class_t *class;
@ -1719,6 +1796,7 @@ rua_obj_lookup_class (progs_t *pr, void *data)
static void
rua_obj_next_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
//probj_t *probj = pr->pr_objective_resources;
//XXX
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
@ -1729,6 +1807,7 @@ rua_obj_next_class (progs_t *pr, void *data)
static void
rua_sel_get_name (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 0);
@ -1741,6 +1820,7 @@ rua_sel_get_name (progs_t *pr, void *data)
static void
rua_sel_get_type (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 0);
R_INT (pr) = sel->sel_types;
@ -1749,6 +1829,7 @@ rua_sel_get_type (progs_t *pr, void *data)
static void
rua_sel_get_uid (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
const char *name = P_GSTRING (pr, 0);
@ -1758,6 +1839,7 @@ rua_sel_get_uid (progs_t *pr, void *data)
static void
rua_sel_register_name (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
const char *name = P_GSTRING (pr, 0);
@ -1767,6 +1849,7 @@ rua_sel_register_name (progs_t *pr, void *data)
static void
rua_sel_is_mapped (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
// FIXME might correspond to a string
pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 0);
@ -1778,6 +1861,7 @@ rua_sel_is_mapped (progs_t *pr, void *data)
static void
rua_class_get_class_method (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
pr_sel_t *aSel = &P_STRUCT (pr, pr_sel_t, 1);
@ -1790,6 +1874,7 @@ rua_class_get_class_method (progs_t *pr, void *data)
static void
rua_class_get_instance_method (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
pr_sel_t *aSel = &P_STRUCT (pr, pr_sel_t, 1);
@ -1802,6 +1887,7 @@ rua_class_get_instance_method (progs_t *pr, void *data)
static void
rua_class_pose_as (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *impostor = &P_STRUCT (pr, pr_class_t, 0);
pr_class_t *superclass = &P_STRUCT (pr, pr_class_t, 1);
pr_ptr_t *subclass;
@ -1835,6 +1921,7 @@ rua_class_pose_as (progs_t *pr, void *data)
static inline pr_id_t *
class_create_instance (progs_t *pr, pr_class_t *class)
{
qfZoneScoped (true);
int size = class->instance_size * sizeof (pr_type_t);
pr_type_t *mem;
pr_id_t *id = 0;
@ -1851,6 +1938,7 @@ class_create_instance (progs_t *pr, pr_class_t *class)
static void
rua_class_create_instance (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
pr_id_t *id = class_create_instance (pr, class);
@ -1860,6 +1948,7 @@ rua_class_create_instance (progs_t *pr, void *data)
static void
rua_class_get_class_name (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class) ? class->name
: PR_SetString (pr, "Nil");
@ -1868,6 +1957,7 @@ rua_class_get_class_name (progs_t *pr, void *data)
static void
rua_class_get_instance_size (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class) ? class->instance_size : 0;
}
@ -1875,6 +1965,7 @@ rua_class_get_instance_size (progs_t *pr, void *data)
static void
rua_class_get_meta_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class) ? class->class_pointer : 0;
}
@ -1882,6 +1973,7 @@ rua_class_get_meta_class (progs_t *pr, void *data)
static void
rua_class_get_super_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class) ? class->super_class : 0;
}
@ -1889,6 +1981,7 @@ rua_class_get_super_class (progs_t *pr, void *data)
static void
rua_class_get_version (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class) ? class->version : -1;
}
@ -1896,6 +1989,7 @@ rua_class_get_version (progs_t *pr, void *data)
static void
rua_class_is_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class);
}
@ -1903,6 +1997,7 @@ rua_class_is_class (progs_t *pr, void *data)
static void
rua_class_is_meta_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISMETA (class);
}
@ -1910,6 +2005,7 @@ rua_class_is_meta_class (progs_t *pr, void *data)
static void
rua_class_set_version (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
if (PR_CLS_ISCLASS (class))
class->version = P_INT (pr, 1);
@ -1918,6 +2014,7 @@ rua_class_set_version (progs_t *pr, void *data)
static void
rua_class_get_gc_object_type (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
R_INT (pr) = PR_CLS_ISCLASS (class) ? class->gc_object_type : 0;
}
@ -1925,6 +2022,7 @@ rua_class_get_gc_object_type (progs_t *pr, void *data)
static void
rua_class_ivar_set_gcinvisible (progs_t *pr, void *data)
{
qfZoneScoped (true);
//probj_t *probj = pr->pr_objective_resources;
//pr_class_t *impostor = &P_STRUCT (pr, pr_class_t, 0);
//const char *ivarname = P_GSTRING (pr, 1);
@ -1938,6 +2036,7 @@ rua_class_ivar_set_gcinvisible (progs_t *pr, void *data)
static void
rua_method_get_imp (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_method_t *method = &P_STRUCT (pr, pr_method_t, 0);
R_INT (pr) = method ? method->method_imp : 0;
@ -1946,6 +2045,7 @@ rua_method_get_imp (progs_t *pr, void *data)
static void
rua_get_imp (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0);
pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 1);
@ -1958,6 +2058,7 @@ rua_get_imp (progs_t *pr, void *data)
static void
rua_object_dispose (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
pr_type_t *mem = (pr_type_t *) object;
PR_Zone_Free (pr, mem);
@ -1966,6 +2067,7 @@ rua_object_dispose (progs_t *pr, void *data)
static void
rua_object_copy (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
pr_class_t *class = &G_STRUCT (pr, pr_class_t, object->class_pointer);
pr_id_t *id;
@ -1982,6 +2084,7 @@ rua_object_copy (progs_t *pr, void *data)
static void
rua_object_get_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
pr_class_t *class;
@ -2002,6 +2105,7 @@ rua_object_get_class (progs_t *pr, void *data)
static void
rua_object_get_super_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
pr_class_t *class;
@ -2022,6 +2126,7 @@ rua_object_get_super_class (progs_t *pr, void *data)
static void
rua_object_get_meta_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
pr_class_t *class;
@ -2042,6 +2147,7 @@ rua_object_get_meta_class (progs_t *pr, void *data)
static void
rua_object_get_class_name (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
@ -2051,6 +2157,7 @@ rua_object_get_class_name (progs_t *pr, void *data)
static void
rua_object_is_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
if (object) {
@ -2063,6 +2170,7 @@ rua_object_is_class (progs_t *pr, void *data)
static void
rua_object_is_instance (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
@ -2072,6 +2180,7 @@ rua_object_is_instance (progs_t *pr, void *data)
static void
rua_object_is_meta_class (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
if (object) {
@ -2086,12 +2195,14 @@ rua_object_is_meta_class (progs_t *pr, void *data)
static void
rua__i_Object__hash (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_INT (pr) = P_INT (pr, 0);
}
static void
rua__i_Object_error_error_ (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *self = &P_STRUCT (pr, pr_id_t, 0);
const char *fmt = P_GSTRING (pr, 2);
@ -2120,6 +2231,7 @@ static int
obj_protocol_conformsToProtocol (probj_t *probj, pr_protocol_t *proto,
pr_protocol_t *protocol)
{
qfZoneScoped (true);
progs_t *pr = probj->pr;
pr_protocol_list_t *proto_list;
@ -2156,6 +2268,7 @@ obj_protocol_conformsToProtocol (probj_t *probj, pr_protocol_t *proto,
static void
rua__c_Object__conformsToProtocol_ (progs_t *pr, void *data)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
// class points to _OBJ_CLASS_foo, and class->class_pointer points to
// _OBJ_METACLASS_foo
@ -2203,6 +2316,7 @@ conforms:
static void
rua_PR_FindGlobal (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *name = P_GSTRING (pr, 0);
pr_def_t *def;
@ -2290,6 +2404,7 @@ static builtin_t obj_methods [] = {
static int
rua_init_finish (progs_t *pr)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_class_t **class_list, **class;
@ -2314,6 +2429,7 @@ rua_init_finish (progs_t *pr)
static int
rua_obj_init_runtime (progs_t *pr)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_def_t *def;
dfunction_t *obj_forward;
@ -2333,6 +2449,7 @@ rua_obj_init_runtime (progs_t *pr)
static void
rua_obj_cleanup (progs_t *pr, void *data)
{
qfZoneScoped (true);
unsigned i;
__auto_type probj = (probj_t *) data;
@ -2367,6 +2484,7 @@ rua_obj_cleanup (progs_t *pr, void *data)
static void
rua_obj_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
probj_t *probj = _res;
dstring_delete (probj->msg);
@ -2397,6 +2515,7 @@ rua_obj_destroy (progs_t *pr, void *_res)
void
RUA_Obj_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
probj_t *probj = calloc (1, sizeof (*probj));
probj->pr = pr;
@ -2424,6 +2543,7 @@ RUA_Obj_Init (progs_t *pr, int secure)
pr_func_t
RUA_Obj_msg_lookup (progs_t *pr, pr_ptr_t _self, pr_ptr_t __cmd)
{
qfZoneScoped (true);
probj_t *probj = pr->pr_objective_resources;
pr_id_t *self = &G_STRUCT (pr, pr_id_t, _self);
pr_sel_t *_cmd = &G_STRUCT (pr, pr_sel_t, __cmd);
@ -2445,6 +2565,7 @@ RUA_Obj_msg_lookup (progs_t *pr, pr_ptr_t _self, pr_ptr_t __cmd)
int
RUA_obj_increment_retaincount (progs_t *pr, void *data)
{
qfZoneScoped (true);
rua_obj_increment_retaincount (pr, data);
return R_INT (pr);
}
@ -2452,6 +2573,7 @@ RUA_obj_increment_retaincount (progs_t *pr, void *data)
int
RUA_obj_decrement_retaincount (progs_t *pr, void *data)
{
qfZoneScoped (true);
rua_obj_decrement_retaincount (pr, data);
return R_INT (pr);
}

View file

@ -62,36 +62,42 @@ typedef struct {
static bi_plist_t *
plist_new (plist_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->plist_map);
}
static void
plist_free (plist_resources_t *res, bi_plist_t *plist)
{
qfZoneScoped (true);
PR_RESFREE (res->plist_map, plist);
}
static void
plist_reset (plist_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->plist_map);
}
static inline bi_plist_t *
plist_get (plist_resources_t *res, unsigned index)
{
qfZoneScoped (true);
return PR_RESGET(res->plist_map, index);
}
static inline int __attribute__((pure))
plist_index (plist_resources_t *res, bi_plist_t *plist)
{
qfZoneScoped (true);
return PR_RESINDEX(res->plist_map, plist);
}
static void
bi_plist_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = (plist_resources_t *) _res;
bi_plist_t *plist;
@ -106,6 +112,7 @@ bi_plist_clear (progs_t *pr, void *_res)
static void
bi_plist_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (plist_resources_t *) _res;
PR_RESDELMAP (res->plist_map);
@ -116,6 +123,7 @@ bi_plist_destroy (progs_t *pr, void *_res)
static inline int
plist_handle (plist_resources_t *res, plitem_t *plitem)
{
qfZoneScoped (true);
bi_plist_t *plist = PL_GetUserData (plitem);
if (plist)
@ -142,6 +150,7 @@ plist_handle (plist_resources_t *res, plitem_t *plitem)
static inline void
plist_free_handle (plist_resources_t *res, bi_plist_t *plist)
{
qfZoneScoped (true);
PL_SetUserData (plist->plitem, 0);
PL_Release (plist->plitem);
@ -154,6 +163,7 @@ plist_free_handle (plist_resources_t *res, bi_plist_t *plist)
static always_inline bi_plist_t * __attribute__((pure))
get_plist (progs_t *pr, plist_resources_t *res, const char *name, int handle)
{
qfZoneScoped (true);
bi_plist_t *plist = plist_get (res, handle);
// plist->prev will be null if the handle is unallocated
@ -165,6 +175,7 @@ get_plist (progs_t *pr, plist_resources_t *res, const char *name, int handle)
static inline int
plist_retain (plist_resources_t *res, plitem_t *plitem)
{
qfZoneScoped (true);
int handle;
if (!plitem)
@ -186,6 +197,7 @@ static void
bi_pl_getfromfile (progs_t *pr, plist_resources_t *res,
plitem_t *get (const char *, struct hashctx_s **))
{
qfZoneScoped (true);
QFile *file = QFile_GetFile (pr, P_INT (pr, 0));
plitem_t *plitem;
long offset;
@ -210,6 +222,7 @@ static void
bi_pl_get (progs_t *pr, plist_resources_t *res,
plitem_t *get (const char *, struct hashctx_s **))
{
qfZoneScoped (true);
plitem_t *plitem = get (P_GSTRING (pr, 0), pr->hashctx);
R_INT (pr) = plist_retain (res, plitem);
@ -218,6 +231,7 @@ bi_pl_get (progs_t *pr, plist_resources_t *res,
static void
bi_PL_GetFromFile (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
bi_pl_getfromfile (pr, res, PL_GetPropertyList);
}
@ -225,6 +239,7 @@ bi_PL_GetFromFile (progs_t *pr, void *_res)
static void
bi_PL_GetPropertyList (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
bi_pl_get (pr, res, PL_GetPropertyList);
}
@ -232,6 +247,7 @@ bi_PL_GetPropertyList (progs_t *pr, void *_res)
static void
bi_PL_GetDictionaryFromFile (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
bi_pl_getfromfile (pr, res, PL_GetDictionary);
}
@ -239,6 +255,7 @@ bi_PL_GetDictionaryFromFile (progs_t *pr, void *_res)
static void
bi_PL_GetDictionary (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
bi_pl_get (pr, res, PL_GetDictionary);
}
@ -246,6 +263,7 @@ bi_PL_GetDictionary (progs_t *pr, void *_res)
static void
bi_PL_GetArrayFromFile (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
bi_pl_getfromfile (pr, res, PL_GetArray);
}
@ -253,6 +271,7 @@ bi_PL_GetArrayFromFile (progs_t *pr, void *_res)
static void
bi_PL_GetArray (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
bi_pl_get (pr, res, PL_GetArray);
}
@ -260,6 +279,7 @@ bi_PL_GetArray (progs_t *pr, void *_res)
static void
bi_PL_WritePropertyList (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -272,6 +292,7 @@ bi_PL_WritePropertyList (progs_t *pr, void *_res)
static void
bi_PL_Type (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -282,6 +303,7 @@ bi_PL_Type (progs_t *pr, void *_res)
static void
bi_PL_Line (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -292,6 +314,7 @@ bi_PL_Line (progs_t *pr, void *_res)
static void
bi_PL_String (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -303,6 +326,7 @@ bi_PL_String (progs_t *pr, void *_res)
static void
bi_PL_ObjectForKey (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -318,6 +342,7 @@ bi_PL_ObjectForKey (progs_t *pr, void *_res)
static void
bi_PL_RemoveObjectForKey (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -328,6 +353,7 @@ bi_PL_RemoveObjectForKey (progs_t *pr, void *_res)
static void
bi_PL_ObjectAtIndex (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -343,6 +369,7 @@ bi_PL_ObjectAtIndex (progs_t *pr, void *_res)
static void
bi_PL_D_AllKeys (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -354,6 +381,7 @@ bi_PL_D_AllKeys (progs_t *pr, void *_res)
static void
bi_PL_D_NumKeys (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -364,6 +392,7 @@ bi_PL_D_NumKeys (progs_t *pr, void *_res)
static void
bi_PL_KeyAtIndex (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
int index = P_INT (pr, 1);
@ -376,6 +405,7 @@ bi_PL_KeyAtIndex (progs_t *pr, void *_res)
static void
bi_PL_D_AddObject (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int dict_handle = P_INT (pr, 0);
int obj_handle = P_INT (pr, 2);
@ -389,6 +419,7 @@ bi_PL_D_AddObject (progs_t *pr, void *_res)
static void
bi_PL_A_AddObject (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int arr_handle = P_INT (pr, 0);
int obj_handle = P_INT (pr, 1);
@ -401,6 +432,7 @@ bi_PL_A_AddObject (progs_t *pr, void *_res)
static void
bi_PL_A_NumObjects (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -411,6 +443,7 @@ bi_PL_A_NumObjects (progs_t *pr, void *_res)
static void
bi_PL_A_InsertObjectAtIndex (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int dict_handle = P_INT (pr, 0);
int obj_handle = P_INT (pr, 1);
@ -424,6 +457,7 @@ bi_PL_A_InsertObjectAtIndex (progs_t *pr, void *_res)
static void
bi_PL_RemoveObjectAtIndex (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -434,6 +468,7 @@ bi_PL_RemoveObjectAtIndex (progs_t *pr, void *_res)
static void
bi_PL_NewDictionary (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
plitem_t *plitem = PL_NewDictionary (pr->hashctx);
@ -443,6 +478,7 @@ bi_PL_NewDictionary (progs_t *pr, void *_res)
static void
bi_PL_NewArray (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
plitem_t *plitem = PL_NewArray ();
@ -452,6 +488,7 @@ bi_PL_NewArray (progs_t *pr, void *_res)
static void
bi_PL_NewData (progs_t *pr, void *_res)
{
qfZoneScoped (true);
//FIXME not safe
plist_resources_t *res = _res;
plitem_t *plitem = PL_NewData (P_GPOINTER (pr, 0), P_INT (pr, 1));
@ -462,6 +499,7 @@ bi_PL_NewData (progs_t *pr, void *_res)
static void
bi_PL_NewString (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
plitem_t *plitem = PL_NewString (P_GSTRING (pr, 0));
@ -471,6 +509,7 @@ bi_PL_NewString (progs_t *pr, void *_res)
static void
bi_PL_Release (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -485,6 +524,7 @@ bi_PL_Release (progs_t *pr, void *_res)
static void
bi_PL_Retain (progs_t *pr, void *_res)
{
qfZoneScoped (true);
plist_resources_t *res = _res;
int handle = P_INT (pr, 0);
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
@ -496,6 +536,7 @@ bi_PL_Retain (progs_t *pr, void *_res)
plitem_t *
Plist_GetItem (progs_t *pr, int handle)
{
qfZoneScoped (true);
plist_resources_t *res = PR_Resources_Find (pr, "plist");
bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle);
return plist->plitem;
@ -537,6 +578,7 @@ static builtin_t builtins[] = {
void
RUA_Plist_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
plist_resources_t *res = calloc (1, sizeof (plist_resources_t));
PR_Resources_Register (pr, "plist", res, bi_plist_clear, bi_plist_destroy);

View file

@ -57,36 +57,42 @@ typedef struct {
static qfile_t *
handle_new (qfile_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->handle_map);
}
static void
handle_free (qfile_resources_t *res, qfile_t *handle)
{
qfZoneScoped (true);
PR_RESFREE (res->handle_map, handle);
}
static void
handle_reset (qfile_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->handle_map);
}
static inline qfile_t *
handle_get (qfile_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->handle_map, index);
}
static inline int __attribute__((pure))
handle_index (qfile_resources_t *res, qfile_t *handle)
{
qfZoneScoped (true);
return PR_RESINDEX(res->handle_map, handle);
}
static void
bi_qfile_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
qfile_resources_t *res = (qfile_resources_t *) _res;
qfile_t *handle;
@ -99,6 +105,7 @@ bi_qfile_clear (progs_t *pr, void *_res)
static void
bi_qfile_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
qfile_resources_t *res = _res;
PR_RESDELMAP (res->handle_map);
@ -110,6 +117,7 @@ bi_qfile_destroy (progs_t *pr, void *_res)
static int
alloc_handle (qfile_resources_t *res, QFile *file)
{
qfZoneScoped (true);
qfile_t *handle = handle_new (res);
if (!handle)
@ -127,6 +135,7 @@ alloc_handle (qfile_resources_t *res, QFile *file)
int
QFile_AllocHandle (progs_t *pr, QFile *file)
{
qfZoneScoped (true);
qfile_resources_t *res = PR_Resources_Find (pr, "QFile");
return alloc_handle (res, file);
@ -135,12 +144,14 @@ QFile_AllocHandle (progs_t *pr, QFile *file)
static void
secured (progs_t *pr, void *_res)
{
qfZoneScoped (true);
PR_RunError (pr, "Secured function called");
}
static void
bi_Qrename (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *old = P_GSTRING (pr, 0);
const char *new = P_GSTRING (pr, 1);
@ -150,6 +161,7 @@ bi_Qrename (progs_t *pr, void *_res)
static void
bi_Qremove (progs_t *pr, void *_res)
{
qfZoneScoped (true);
const char *path = P_GSTRING (pr, 0);
R_INT (pr) = Qremove (path);
@ -158,6 +170,7 @@ bi_Qremove (progs_t *pr, void *_res)
static void
bi_Qopen (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
const char *path = P_GSTRING (pr, 0);
const char *mode = P_GSTRING (pr, 1);
@ -173,6 +186,7 @@ bi_Qopen (progs_t *pr, void *_res)
static qfile_t * __attribute__((pure))
get_handle (progs_t *pr, qfile_resources_t *res, const char *name, int handle)
{
qfZoneScoped (true);
qfile_t *h = handle_get (res, handle);
if (!h)
@ -183,6 +197,7 @@ get_handle (progs_t *pr, qfile_resources_t *res, const char *name, int handle)
QFile *
QFile_GetFile (progs_t *pr, int handle)
{
qfZoneScoped (true);
qfile_resources_t *res = PR_Resources_Find (pr, "QFile");
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -192,6 +207,7 @@ QFile_GetFile (progs_t *pr, int handle)
static void
bi_Qclose (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = handle_get (res, handle);
@ -208,6 +224,7 @@ bi_Qclose (progs_t *pr, void *_res)
static void
bi_Qgetline (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -223,6 +240,7 @@ bi_Qgetline (progs_t *pr, void *_res)
static void
bi_Qreadstring (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
int len = P_INT (pr, 1);
@ -241,6 +259,7 @@ bi_Qreadstring (progs_t *pr, void *_res)
static void
check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
{
qfZoneScoped (true);
int len;
len = (count + sizeof (pr_type_t) - 1) / sizeof (pr_type_t);
@ -251,6 +270,7 @@ check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
static void
bi_Qread (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -264,6 +284,7 @@ bi_Qread (progs_t *pr, void *_res)
static void
bi_Qwrite (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -277,6 +298,7 @@ bi_Qwrite (progs_t *pr, void *_res)
static void
bi_Qputs (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -288,6 +310,7 @@ bi_Qputs (progs_t *pr, void *_res)
static void
bi_Qgets (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -301,6 +324,7 @@ bi_Qgets (progs_t *pr, void *_res)
static void
bi_Qgetc (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -311,6 +335,7 @@ bi_Qgetc (progs_t *pr, void *_res)
static void
bi_Qputc (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -322,6 +347,7 @@ bi_Qputc (progs_t *pr, void *_res)
static void
bi_Qseek (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -334,6 +360,7 @@ bi_Qseek (progs_t *pr, void *_res)
static void
bi_Qtell (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -344,6 +371,7 @@ bi_Qtell (progs_t *pr, void *_res)
static void
bi_Qflush (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -354,6 +382,7 @@ bi_Qflush (progs_t *pr, void *_res)
static void
bi_Qeof (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -364,6 +393,7 @@ bi_Qeof (progs_t *pr, void *_res)
static void
bi_Qfilesize (progs_t *pr, void *_res)
{
qfZoneScoped (true);
__auto_type res = (qfile_resources_t *) _res;
int handle = P_INT (pr, 0);
qfile_t *h = get_handle (pr, res, __FUNCTION__, handle);
@ -411,6 +441,7 @@ static builtin_t builtins[] = {
void
RUA_QFile_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
qfile_resources_t *res = calloc (sizeof (qfile_resources_t), 1);
res->buffer = dstring_new ();

View file

@ -51,6 +51,7 @@ typedef struct {
static void
check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
{
qfZoneScoped (true);
int len;
len = (count + sizeof (pr_type_t) - 1) / sizeof (pr_type_t);
@ -62,6 +63,7 @@ check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
static void
bi_QFS_Open (progs_t *pr, void *data)
{
qfZoneScoped (true);
QFile *file;
const char *path = P_GSTRING (pr, 0);
const char *mode = P_GSTRING (pr, 1);
@ -77,6 +79,7 @@ bi_QFS_Open (progs_t *pr, void *data)
static void
bi_QFS_WOpen (progs_t *pr, void *data)
{
qfZoneScoped (true);
QFile *file;
const char *path = P_GSTRING (pr, 0);
int zip = P_INT (pr, 1);
@ -92,6 +95,7 @@ bi_QFS_WOpen (progs_t *pr, void *data)
static void
bi_QFS_Rename (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *old = P_GSTRING (pr, 0);
const char *new = P_GSTRING (pr, 1);
@ -101,6 +105,7 @@ bi_QFS_Rename (progs_t *pr, void *data)
static void
bi_QFS_LoadFile (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *filename = P_GSTRING (pr, 0);
QFile *file;
int size;
@ -126,6 +131,7 @@ bi_QFS_LoadFile (progs_t *pr, void *data)
static void
bi_QFS_OpenFile (progs_t *pr, void *data)
{
qfZoneScoped (true);
QFile *file;
const char *filename = P_GSTRING (pr, 0);
@ -141,6 +147,7 @@ bi_QFS_OpenFile (progs_t *pr, void *data)
static void
bi_QFS_WriteFile (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *filename = P_GSTRING (pr, 0);
pr_type_t *buf = P_GPOINTER (pr, 1);
int count = P_INT (pr, 2);
@ -153,6 +160,7 @@ bi_QFS_WriteFile (progs_t *pr, void *data)
static void
bi_QFS_Filelist (progs_t *pr, void *data)
{
qfZoneScoped (true);
filelist_t *filelist = QFS_FilelistNew ();
qfslist_t *list;
pr_string_t *strings;
@ -173,6 +181,7 @@ bi_QFS_Filelist (progs_t *pr, void *data)
static void
bi_QFS_FilelistFree (progs_t *pr, void *data)
{
qfZoneScoped (true);
qfslist_t *list = &P_STRUCT (pr, qfslist_t, 0);
pr_string_t *strings = &G_STRUCT (pr, pr_string_t, list->list);
int i;
@ -185,6 +194,7 @@ bi_QFS_FilelistFree (progs_t *pr, void *data)
static void
bi_QFS_GetDirectory (progs_t *pr, void *data)
{
qfZoneScoped (true);
RETURN_STRING (pr, qfs_gamedir->dir.def);
}
@ -206,5 +216,6 @@ static builtin_t builtins[] = {
void
RUA_QFS_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
PR_RegisterBuiltins (pr, builtins, 0);
}

View file

@ -52,6 +52,7 @@
static void
bi_va_copy (progs_t *pr, void *data)
{
qfZoneScoped (true);
__auto_type src_args = (pr_va_list_t *) &P_POINTER (pr, 0);
__auto_type src_list = &G_STRUCT (pr, pr_type_t, src_args->list);
size_t parm_size = pr->pr_param_size * sizeof(pr_type_t);
@ -80,5 +81,6 @@ static builtin_t builtins[] = {
void
RUA_Runtime_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
PR_RegisterBuiltins (pr, builtins, 0);
}

View file

@ -74,12 +74,14 @@ typedef struct rua_scene_resources_s {
static rua_scene_t *
rua_scene_new (rua_scene_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->scene_map);
}
static void
rua_scene_free (rua_scene_resources_t *res, rua_scene_t *scene)
{
qfZoneScoped (true);
if (scene->next) {
scene->next->prev = scene->prev;
}
@ -91,6 +93,7 @@ rua_scene_free (rua_scene_resources_t *res, rua_scene_t *scene)
static rua_scene_t * __attribute__((pure))
rua__scene_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
{
qfZoneScoped (true);
rua_scene_t *scene = 0;
id &= 0xffffffffu;
@ -107,12 +110,14 @@ rua__scene_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
static int __attribute__((pure))
rua_scene_index (rua_scene_resources_t *res, rua_scene_t *scene)
{
qfZoneScoped (true);
return PR_RESINDEX (res->scene_map, scene);
}
static entity_t __attribute__((pure))
rua__entity_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
{
qfZoneScoped (true);
pr_ulong_t scene_id = id & 0xffffffff;
entity_t ent = nullentity;
@ -134,6 +139,7 @@ rua__entity_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
static transform_t __attribute__((pure))
rua__transform_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
{
qfZoneScoped (true);
pr_ulong_t scene_id = id & 0xffffffff;
transform_t transform = nulltransform;
@ -157,12 +163,14 @@ rua__transform_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
static rua_lighting_t *
rua_lighting_new (rua_scene_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->lighting_map);
}
static void
rua_lighting_free (rua_scene_resources_t *res, rua_lighting_t *ldata)
{
qfZoneScoped (true);
if (ldata->next) {
ldata->next->prev = ldata->prev;
}
@ -174,6 +182,7 @@ rua_lighting_free (rua_scene_resources_t *res, rua_lighting_t *ldata)
static rua_lighting_t * __attribute__((pure))
rua__lighting_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
{
qfZoneScoped (true);
rua_lighting_t *ldata = 0;
if (id <= 0xffffffffu) {
@ -191,6 +200,7 @@ rua__lighting_get (rua_scene_resources_t *res, pr_ulong_t id, const char *name)
static int __attribute__((pure))
rua_lighting_index (rua_scene_resources_t *res, rua_lighting_t *ldata)
{
qfZoneScoped (true);
return PR_RESINDEX (res->lighting_map, ldata);
}
@ -200,6 +210,7 @@ rua_lighting_index (rua_scene_resources_t *res, rua_lighting_t *ldata)
static void
bi_Scene_NewScene (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
rua_scene_t *scene = rua_scene_new (res);
@ -221,6 +232,7 @@ bi_Scene_NewScene (progs_t *pr, void *_res)
static void
rua_delete_scene (rua_scene_resources_t *res, rua_scene_t *scene)
{
qfZoneScoped (true);
Scene_DeleteScene (scene->scene);
rua_scene_free (res, scene);
}
@ -228,6 +240,7 @@ rua_delete_scene (rua_scene_resources_t *res, rua_scene_t *scene)
static void
bi_Scene_DeleteScene (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
rua_scene_t *scene = rua_scene_get (res, P_ULONG (pr, 0));
@ -237,6 +250,7 @@ bi_Scene_DeleteScene (progs_t *pr, void *_res)
scene_t *
Scene_GetScene (progs_t *pr, pr_ulong_t handle)
{
qfZoneScoped (true);
if (!handle) {
return 0;
}
@ -248,6 +262,7 @@ Scene_GetScene (progs_t *pr, pr_ulong_t handle)
static void
bi_Scene_CreateEntity (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t scene_id = P_ULONG (pr, 0);
rua_scene_t *scene = rua_scene_get (res, scene_id);
@ -258,6 +273,7 @@ bi_Scene_CreateEntity (progs_t *pr, void *_res)
static void
bi_Scene_DestroyEntity (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t id = P_ULONG (pr, 0);
entity_t ent = rua_entity_get (res, id);
@ -271,6 +287,7 @@ bi_Scene_DestroyEntity (progs_t *pr, void *_res)
static void
bi_Scene_SetLighting (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t scene_id = P_ULONG (pr, 0);
rua_scene_t *scene = rua_scene_get (res, scene_id);
@ -287,6 +304,7 @@ bi_Scene_SetLighting (progs_t *pr, void *_res)
static void
bi_Entity_GetTransform (progs_t *pr, void *_res)
{
qfZoneScoped (true);
pr_ulong_t ent_id = P_ULONG (pr, 0);
// ent_id is used to fetch the transform every time
@ -296,6 +314,7 @@ bi_Entity_GetTransform (progs_t *pr, void *_res)
static void
bi_Entity_SetModel (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t ent_id = P_ULONG (pr, 0);
pr_int_t model_id = P_INT (pr, 1);
@ -313,6 +332,7 @@ bi_Entity_SetModel (progs_t *pr, void *_res)
static void
bi_Transform_ChildCount (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
@ -322,6 +342,7 @@ bi_Transform_ChildCount (progs_t *pr, void *_res)
static void
bi_Transform_GetChild (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t transform_id = P_ULONG (pr, 0);
transform_t transform = rua_transform_get (res, transform_id);
@ -333,6 +354,7 @@ bi_Transform_GetChild (progs_t *pr, void *_res)
static void
bi_Transform_SetParent (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
transform_t parent = rua_transform_get (res, P_ULONG (pr, 1));
@ -343,6 +365,7 @@ bi_Transform_SetParent (progs_t *pr, void *_res)
static void
bi_Transform_GetParent (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t transform_id = P_ULONG (pr, 0);
transform_t transform = rua_transform_get (res, transform_id);
@ -356,6 +379,7 @@ bi_Transform_GetParent (progs_t *pr, void *_res)
static void
bi_Transform_SetTag (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
pr_uint_t tag = P_UINT (pr, 2);
@ -365,6 +389,7 @@ bi_Transform_SetTag (progs_t *pr, void *_res)
static void
bi_Transform_GetTag (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
@ -374,6 +399,7 @@ bi_Transform_GetTag (progs_t *pr, void *_res)
static void
bi_Transform_GetLocalMatrix (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_GetLocalMatrix (transform, &R_PACKED (pr, pr_vec4_t));
@ -382,6 +408,7 @@ bi_Transform_GetLocalMatrix (progs_t *pr, void *_res)
static void
bi_Transform_GetLocalInverse (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_GetLocalInverse (transform, &R_PACKED (pr, pr_vec4_t));
@ -390,6 +417,7 @@ bi_Transform_GetLocalInverse (progs_t *pr, void *_res)
static void
bi_Transform_GetWorldMatrix (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_GetWorldMatrix (transform, &R_PACKED (pr, pr_vec4_t));
@ -398,6 +426,7 @@ bi_Transform_GetWorldMatrix (progs_t *pr, void *_res)
static void
bi_Transform_GetWorldInverse (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_GetWorldInverse (transform, &R_PACKED (pr, pr_vec4_t));
@ -406,6 +435,7 @@ bi_Transform_GetWorldInverse (progs_t *pr, void *_res)
static void
bi_Transform_SetLocalPosition (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_SetLocalPosition (transform, P_PACKED (pr, pr_vec4_t, 1));
@ -414,6 +444,7 @@ bi_Transform_SetLocalPosition (progs_t *pr, void *_res)
static void
bi_Transform_GetLocalPosition (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_GetLocalPosition (transform);
@ -422,6 +453,7 @@ bi_Transform_GetLocalPosition (progs_t *pr, void *_res)
static void
bi_Transform_SetLocalRotation (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_SetLocalRotation (transform, P_PACKED (pr, pr_vec4_t, 1));
@ -430,6 +462,7 @@ bi_Transform_SetLocalRotation (progs_t *pr, void *_res)
static void
bi_Transform_GetLocalRotation (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_GetLocalRotation (transform);
@ -438,6 +471,7 @@ bi_Transform_GetLocalRotation (progs_t *pr, void *_res)
static void
bi_Transform_SetLocalScale (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_SetLocalScale (transform, P_PACKED (pr, pr_vec4_t, 1));
@ -446,6 +480,7 @@ bi_Transform_SetLocalScale (progs_t *pr, void *_res)
static void
bi_Transform_GetLocalScale (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_GetLocalScale (transform);
@ -454,6 +489,7 @@ bi_Transform_GetLocalScale (progs_t *pr, void *_res)
static void
bi_Transform_SetWorldPosition (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_SetWorldPosition (transform, P_PACKED (pr, pr_vec4_t, 1));
@ -462,6 +498,7 @@ bi_Transform_SetWorldPosition (progs_t *pr, void *_res)
static void
bi_Transform_GetWorldPosition (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_GetWorldPosition (transform);
@ -470,6 +507,7 @@ bi_Transform_GetWorldPosition (progs_t *pr, void *_res)
static void
bi_Transform_SetWorldRotation (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_SetWorldRotation (transform, P_PACKED (pr, pr_vec4_t, 1));
@ -478,6 +516,7 @@ bi_Transform_SetWorldRotation (progs_t *pr, void *_res)
static void
bi_Transform_GetWorldRotation (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_GetWorldRotation (transform);
@ -486,6 +525,7 @@ bi_Transform_GetWorldRotation (progs_t *pr, void *_res)
static void
bi_Transform_GetWorldScale (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_GetWorldScale (transform);
@ -494,6 +534,7 @@ bi_Transform_GetWorldScale (progs_t *pr, void *_res)
static void
bi_Transform_SetLocalTransform (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
Transform_SetLocalTransform (transform, P_PACKED (pr, pr_vec4_t, 1),
@ -503,6 +544,7 @@ bi_Transform_SetLocalTransform (progs_t *pr, void *_res)
static void
bi_Transform_Forward (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_Forward (transform);
@ -511,6 +553,7 @@ bi_Transform_Forward (progs_t *pr, void *_res)
static void
bi_Transform_Right (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_Right (transform);
@ -519,6 +562,7 @@ bi_Transform_Right (progs_t *pr, void *_res)
static void
bi_Transform_Up (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
transform_t transform = rua_transform_get (res, P_ULONG (pr, 0));
R_PACKED (pr, pr_vec4_t) = Transform_Up (transform);
@ -527,6 +571,7 @@ bi_Transform_Up (progs_t *pr, void *_res)
static void
bi_Light_CreateLightingData (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
pr_ulong_t scene_id = P_ULONG (pr, 0);
rua_scene_t *scene = rua_scene_get (res, scene_id);
@ -550,6 +595,7 @@ bi_Light_CreateLightingData (progs_t *pr, void *_res)
static void
rua_delete_lighting (rua_scene_resources_t *res, rua_lighting_t *ldata)
{
qfZoneScoped (true);
Light_DestroyLightingData (ldata->ldata);
rua_lighting_free (res, ldata);
}
@ -557,6 +603,7 @@ rua_delete_lighting (rua_scene_resources_t *res, rua_lighting_t *ldata)
static void
bi_Light_DestroyLightingData (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
rua_lighting_t *ldata = rua_lighting_get (res, P_ULONG (pr, 0));
@ -566,6 +613,7 @@ bi_Light_DestroyLightingData (progs_t *pr, void *_res)
static void
bi_Light_ClearLights (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
rua_lighting_t *ldata = rua_lighting_get (res, P_ULONG (pr, 0));
@ -575,6 +623,7 @@ bi_Light_ClearLights (progs_t *pr, void *_res)
static void
bi_Light_AddLight (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
rua_lighting_t *ldata = rua_lighting_get (res, P_ULONG (pr, 0));
light_t *light = &P_PACKED (pr, light_t, 1);
@ -586,6 +635,7 @@ bi_Light_AddLight (progs_t *pr, void *_res)
static void
bi_Light_EnableSun (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
rua_lighting_t *ldata = rua_lighting_get (res, P_ULONG (pr, 0));
@ -649,6 +699,7 @@ static builtin_t builtins[] = {
static void
bi_scene_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
while (res->ldatas) {
@ -662,6 +713,7 @@ bi_scene_clear (progs_t *pr, void *_res)
static void
bi_scene_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
rua_scene_resources_t *res = _res;
PR_RESDELMAP (res->scene_map);
PR_RESDELMAP (res->lighting_map);
@ -671,6 +723,7 @@ bi_scene_destroy (progs_t *pr, void *_res)
void
RUA_Scene_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
rua_scene_resources_t *res = calloc (sizeof (rua_scene_resources_t), 1);
res->pr = pr;

View file

@ -61,36 +61,42 @@ typedef struct {
static rua_script_t *
script_new (script_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->script_map);
}
static void
script_free (script_resources_t *res, rua_script_t *script)
{
qfZoneScoped (true);
PR_RESFREE (res->script_map, script);
}
static void
script_reset (script_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->script_map);
}
static inline rua_script_t *
script_get (script_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->script_map, index);
}
static inline int __attribute__((pure))
script_index (script_resources_t *res, rua_script_t *script)
{
qfZoneScoped (true);
return PR_RESINDEX(res->script_map, script);
}
static void
bi_script_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = (script_resources_t *) _res;
for (rua_script_t *s = res->scripts; s; s = s->next) {
free ((char *) s->script.single);
@ -103,12 +109,14 @@ bi_script_clear (progs_t *pr, void *_res)
static void
bi_script_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
free (_res);
}
static void
bi_Script_New (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_new (res);
@ -130,6 +138,7 @@ bi_Script_New (progs_t *pr, void *_res)
static void
bi_Script_Delete (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -148,6 +157,7 @@ bi_Script_Delete (progs_t *pr, void *_res)
static void
bi_Script_Start (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -160,6 +170,7 @@ bi_Script_Start (progs_t *pr, void *_res)
static void
bi_Script_FromFile (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
if (!script)
@ -183,6 +194,7 @@ bi_Script_FromFile (progs_t *pr, void *_res)
static void
bi_Script_TokenAvailable (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -194,6 +206,7 @@ bi_Script_TokenAvailable (progs_t *pr, void *_res)
static void
bi_Script_GetToken (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -205,6 +218,7 @@ bi_Script_GetToken (progs_t *pr, void *_res)
static void
bi_Script_UngetToken (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -216,6 +230,7 @@ bi_Script_UngetToken (progs_t *pr, void *_res)
static void
bi_Script_Error (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -228,6 +243,7 @@ bi_Script_Error (progs_t *pr, void *_res)
static void
bi_Script_NoQuoteLines (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
@ -240,6 +256,7 @@ bi_Script_NoQuoteLines (progs_t *pr, void *_res)
static void
bi_Script_SetSingle (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
if (!script)
@ -255,6 +272,7 @@ bi_Script_SetSingle (progs_t *pr, void *_res)
static void
bi_Script_GetLine (progs_t *pr, void *_res)
{
qfZoneScoped (true);
script_resources_t *res = _res;
rua_script_t *script = script_get (res, P_INT (pr, 0));
if (!script)
@ -282,6 +300,7 @@ static builtin_t builtins[] = {
void
RUA_Script_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
script_resources_t *res = calloc (1, sizeof (script_resources_t));
PR_Resources_Register (pr, "Script", res, bi_script_clear,

View file

@ -79,66 +79,77 @@ typedef struct {
static bi_set_t *
res_set_new (set_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->set_map);
}
static void
res_set_free (set_resources_t *res, bi_set_t *set)
{
qfZoneScoped (true);
PR_RESFREE (res->set_map, set);
}
static void
res_set_reset (set_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->set_map);
}
static inline bi_set_t *
res_set_get (set_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->set_map, index);
}
static inline int __attribute__((pure))
res_set_index (set_resources_t *res, bi_set_t *set)
{
qfZoneScoped (true);
return PR_RESINDEX(res->set_map, set);
}
static bi_set_iter_t *
res_set_iter_new (set_resources_t *res)
{
qfZoneScoped (true);
return PR_RESNEW (res->set_iter_map);
}
static void
res_set_iter_free (set_resources_t *res, bi_set_iter_t *set_iter)
{
qfZoneScoped (true);
PR_RESFREE (res->set_iter_map, set_iter);
}
static void
res_set_iter_reset (set_resources_t *res)
{
qfZoneScoped (true);
PR_RESRESET (res->set_iter_map);
}
static inline bi_set_iter_t *
res_set_iter_get (set_resources_t *res, int index)
{
qfZoneScoped (true);
return PR_RESGET(res->set_iter_map, index);
}
static inline int __attribute__((pure))
res_set_iter_index (set_resources_t *res, bi_set_iter_t *set_iter)
{
qfZoneScoped (true);
return PR_RESINDEX(res->set_iter_map, set_iter);
}
static bi_set_t * __attribute__((pure))
get_set (progs_t *pr, set_resources_t *res, const char *name, int index)
{
qfZoneScoped (true);
bi_set_t *set = res_set_get (res, index);
if (!set)
@ -149,6 +160,7 @@ get_set (progs_t *pr, set_resources_t *res, const char *name, int index)
static bi_set_iter_t * __attribute__((pure))
get_set_iter (progs_t *pr, set_resources_t *res, const char *name, int index)
{
qfZoneScoped (true);
bi_set_iter_t *set = res_set_iter_get (res, index);
if (!set)
@ -159,6 +171,7 @@ get_set_iter (progs_t *pr, set_resources_t *res, const char *name, int index)
static void
del_set_iter (progs_t *pr, set_resources_t *res, bi_set_iter_t *set_iter)
{
qfZoneScoped (true);
*set_iter->prev = set_iter->next;
if (set_iter->next)
set_iter->next->prev = set_iter->prev;
@ -168,6 +181,7 @@ del_set_iter (progs_t *pr, set_resources_t *res, bi_set_iter_t *set_iter)
static void
bi_set_del_iter (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__,
P_INT (pr, 0));
@ -179,6 +193,7 @@ bi_set_del_iter (progs_t *pr, void *_res)
static void
bi_set_iter_element (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__,
P_INT (pr, 0));
@ -190,6 +205,7 @@ bi_set_iter_element (progs_t *pr, void *_res)
static void
bi_set_new (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
bi_set_t *set;
@ -209,6 +225,7 @@ bi_set_new (progs_t *pr, void *_res)
static void
bi_set_delete (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
bi_set_t *set = get_set (pr, res, __FUNCTION__, P_INT (pr, 0));
@ -223,6 +240,7 @@ static void
rua_set_add (progs_t *pr, set_resources_t *res,
pr_int_t setid, pr_uint_t element)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
set_add (set->set, element);
@ -231,6 +249,7 @@ rua_set_add (progs_t *pr, set_resources_t *res,
static void
bi_set_add (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_add (pr, res, P_INT (pr, 0), P_UINT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -240,6 +259,7 @@ static void
rua_set_remove (progs_t *pr, set_resources_t *res,
pr_int_t setid, pr_uint_t element)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
set_remove (set->set, element);
@ -248,6 +268,7 @@ rua_set_remove (progs_t *pr, set_resources_t *res,
static void
bi_set_remove (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_remove (pr, res, P_INT (pr, 0), P_UINT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -256,6 +277,7 @@ bi_set_remove (progs_t *pr, void *_res)
static void
rua_set_invert (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
set_invert (set->set);
@ -264,6 +286,7 @@ rua_set_invert (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_invert (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_invert (pr, res, P_INT (pr, 0));
R_INT (pr) = P_INT (pr, 0);
@ -273,6 +296,7 @@ static void
rua_set_union (progs_t *pr, set_resources_t *res,
pr_int_t dstid, pr_int_t srcid)
{
qfZoneScoped (true);
bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid);
bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid);
@ -282,6 +306,7 @@ rua_set_union (progs_t *pr, set_resources_t *res,
static void
bi_set_union (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_union (pr, res, P_INT (pr, 0), P_INT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -291,6 +316,7 @@ static void
rua_set_intersection (progs_t *pr, set_resources_t *res,
pr_int_t dstid, pr_int_t srcid)
{
qfZoneScoped (true);
bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid);
bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid);
@ -300,6 +326,7 @@ rua_set_intersection (progs_t *pr, set_resources_t *res,
static void
bi_set_intersection (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_intersection (pr, res, P_INT (pr, 0), P_INT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -309,6 +336,7 @@ static void
rua_set_difference (progs_t *pr, set_resources_t *res,
pr_int_t dstid, pr_int_t srcid)
{
qfZoneScoped (true);
bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid);
bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid);
@ -318,6 +346,7 @@ rua_set_difference (progs_t *pr, set_resources_t *res,
static void
bi_set_difference (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_difference (pr, res, P_INT (pr, 0), P_INT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -327,6 +356,7 @@ static void
rua_set_reverse_difference (progs_t *pr, set_resources_t *res,
pr_int_t dstid, pr_int_t srcid)
{
qfZoneScoped (true);
bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid);
bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid);
@ -336,6 +366,7 @@ rua_set_reverse_difference (progs_t *pr, set_resources_t *res,
static void
bi_set_reverse_difference (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_reverse_difference (pr, res, P_INT (pr, 0), P_INT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -345,6 +376,7 @@ static void
rua_set_assign (progs_t *pr, set_resources_t *res,
pr_int_t dstid, pr_int_t srcid)
{
qfZoneScoped (true);
bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid);
bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid);
@ -354,6 +386,7 @@ rua_set_assign (progs_t *pr, set_resources_t *res,
static void
bi_set_assign (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_assign (pr, res, P_INT (pr, 0), P_INT (pr, 1));
R_INT (pr) = P_INT (pr, 0);
@ -362,6 +395,7 @@ bi_set_assign (progs_t *pr, void *_res)
static void
rua_set_empty (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
set_empty (set->set);
@ -370,6 +404,7 @@ rua_set_empty (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_empty (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_empty (pr, res, P_INT (pr, 0));
R_INT (pr) = P_INT (pr, 0);
@ -378,6 +413,7 @@ bi_set_empty (progs_t *pr, void *_res)
static void
rua_set_everything (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
set_everything (set->set);
@ -386,6 +422,7 @@ rua_set_everything (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_everything (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_everything (pr, res, P_INT (pr, 0));
R_INT (pr) = P_INT (pr, 0);
@ -394,6 +431,7 @@ bi_set_everything (progs_t *pr, void *_res)
static void
rua_set_is_empty (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
R_INT (pr) = set_is_empty (set->set);
@ -402,6 +440,7 @@ rua_set_is_empty (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_is_empty (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_empty (pr, res, P_INT (pr, 0));
}
@ -409,6 +448,7 @@ bi_set_is_empty (progs_t *pr, void *_res)
static void
rua_set_is_everything (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = set_is_everything (set->set);
@ -417,6 +457,7 @@ rua_set_is_everything (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_is_everything (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_everything (pr, res, P_INT (pr, 0));
}
@ -425,6 +466,7 @@ static void
rua_set_is_disjoint (progs_t *pr, set_resources_t *res,
pr_int_t sid1, pr_int_t sid2)
{
qfZoneScoped (true);
bi_set_t *set1 = get_set (pr, res, __FUNCTION__, sid1);
bi_set_t *set2 = get_set (pr, res, __FUNCTION__, sid2);
@ -434,6 +476,7 @@ rua_set_is_disjoint (progs_t *pr, set_resources_t *res,
static void
bi_set_is_disjoint (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_disjoint (pr, res, P_INT (pr, 0), P_INT (pr, 1));
}
@ -442,6 +485,7 @@ static void
rua_set_is_intersecting (progs_t *pr, set_resources_t *res,
pr_int_t sid1, pr_int_t sid2)
{
qfZoneScoped (true);
bi_set_t *set1 = get_set (pr, res, __FUNCTION__, sid1);
bi_set_t *set2 = get_set (pr, res, __FUNCTION__, sid2);
@ -451,6 +495,7 @@ rua_set_is_intersecting (progs_t *pr, set_resources_t *res,
static void
bi_set_is_intersecting (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_intersecting (pr, res, P_INT (pr, 0), P_INT (pr, 1));
}
@ -459,6 +504,7 @@ static void
rua_set_is_equivalent (progs_t *pr, set_resources_t *res,
pr_int_t sid1, pr_int_t sid2)
{
qfZoneScoped (true);
bi_set_t *set1 = get_set (pr, res, __FUNCTION__, sid1);
bi_set_t *set2 = get_set (pr, res, __FUNCTION__, sid2);
@ -468,6 +514,7 @@ rua_set_is_equivalent (progs_t *pr, set_resources_t *res,
static void
bi_set_is_equivalent (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_equivalent (pr, res, P_INT (pr, 0), P_INT (pr, 1));
}
@ -476,6 +523,7 @@ static void
rua_set_is_subset (progs_t *pr, set_resources_t *res, pr_int_t setid,
pr_int_t subid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
bi_set_t *sub = get_set (pr, res, __FUNCTION__, subid);
@ -485,6 +533,7 @@ rua_set_is_subset (progs_t *pr, set_resources_t *res, pr_int_t setid,
static void
bi_set_is_subset (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_subset (pr, res, P_INT (pr, 0), P_INT (pr, 1));
}
@ -493,6 +542,7 @@ static void
rua_set_is_member (progs_t *pr, set_resources_t *res, pr_int_t setid,
pr_uint_t element)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
R_INT (pr) = set_is_member (set->set, element);
@ -501,6 +551,7 @@ rua_set_is_member (progs_t *pr, set_resources_t *res, pr_int_t setid,
static void
bi_set_is_member (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_is_member (pr, res, P_INT (pr, 0), P_UINT (pr, 1));
}
@ -508,6 +559,7 @@ bi_set_is_member (progs_t *pr, void *_res)
static void
rua_set_count (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
R_INT (pr) = set_count (set->set);
@ -516,6 +568,7 @@ rua_set_count (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_count (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_count (pr, res, P_INT (pr, 0));
}
@ -523,6 +576,7 @@ bi_set_count (progs_t *pr, void *_res)
static void
bi_set_first (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
bi_set_t *set = get_set (pr, res, __FUNCTION__, P_INT (pr, 0));
set_iter_t *iter;
@ -549,6 +603,7 @@ bi_set_first (progs_t *pr, void *_res)
static void
bi_set_next (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__,
P_INT (pr, 0));
@ -564,6 +619,7 @@ bi_set_next (progs_t *pr, void *_res)
static void
rua_set_as_string (progs_t *pr, set_resources_t *res, pr_int_t setid)
{
qfZoneScoped (true);
bi_set_t *set = get_set (pr, res, __FUNCTION__, setid);
RETURN_STRING (pr, set_as_string (set->set));
@ -572,6 +628,7 @@ rua_set_as_string (progs_t *pr, set_resources_t *res, pr_int_t setid)
static void
bi_set_as_string (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
rua_set_as_string (pr, res, P_INT (pr, 0));
}
@ -579,6 +636,7 @@ bi_set_as_string (progs_t *pr, void *_res)
static void
bi__i_SetIterator__element (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_iter_t *iter_obj = &P_STRUCT (pr, pr_set_iter_t, 0);
bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__,
@ -590,6 +648,7 @@ bi__i_SetIterator__element (progs_t *pr, void *_res)
static void
bi__i_Set__add_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -601,6 +660,7 @@ bi__i_Set__add_ (progs_t *pr, void *_res)
static void
bi__i_Set__remove_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -612,6 +672,7 @@ bi__i_Set__remove_ (progs_t *pr, void *_res)
static void
bi__i_Set__invert (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -623,6 +684,7 @@ bi__i_Set__invert (progs_t *pr, void *_res)
static void
bi__i_Set__union_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -634,6 +696,7 @@ bi__i_Set__union_ (progs_t *pr, void *_res)
static void
bi__i_Set__intersection_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -646,6 +709,7 @@ bi__i_Set__intersection_ (progs_t *pr, void *_res)
static void
bi__i_Set__difference_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -658,6 +722,7 @@ bi__i_Set__difference_ (progs_t *pr, void *_res)
static void
bi__i_Set__reverse_difference_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -670,6 +735,7 @@ bi__i_Set__reverse_difference_ (progs_t *pr, void *_res)
static void
bi__i_Set__assign_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -682,6 +748,7 @@ bi__i_Set__assign_ (progs_t *pr, void *_res)
static void
bi__i_Set__empty (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -693,6 +760,7 @@ bi__i_Set__empty (progs_t *pr, void *_res)
static void
bi__i_Set__everything (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -704,6 +772,7 @@ bi__i_Set__everything (progs_t *pr, void *_res)
static void
bi__i_Set__is_empty (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -713,6 +782,7 @@ bi__i_Set__is_empty (progs_t *pr, void *_res)
static void
bi__i_Set__is_everything (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -722,6 +792,7 @@ bi__i_Set__is_everything (progs_t *pr, void *_res)
static void
bi__i_Set__is_disjoint_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -732,6 +803,7 @@ bi__i_Set__is_disjoint_ (progs_t *pr, void *_res)
static void
bi__i_Set__is_intersecting_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -742,6 +814,7 @@ bi__i_Set__is_intersecting_ (progs_t *pr, void *_res)
static void
bi__i_Set__is_equivalent_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -752,6 +825,7 @@ bi__i_Set__is_equivalent_ (progs_t *pr, void *_res)
static void
bi__i_Set__is_subset_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *sub_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -762,6 +836,7 @@ bi__i_Set__is_subset_ (progs_t *pr, void *_res)
static void
bi__i_Set__is_member_ (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -771,6 +846,7 @@ bi__i_Set__is_member_ (progs_t *pr, void *_res)
static void
bi__i_Set__size (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -780,6 +856,7 @@ bi__i_Set__size (progs_t *pr, void *_res)
static void
bi__i_Set__as_string (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = _res;
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -789,6 +866,7 @@ bi__i_Set__as_string (progs_t *pr, void *_res)
static void
res_set_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
set_resources_t *res = (set_resources_t *) _res;
bi_set_t *set;
bi_set_iter_t *set_iter;
@ -806,6 +884,7 @@ res_set_clear (progs_t *pr, void *_res)
static void
res_set_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
free (_res);
}
@ -866,6 +945,7 @@ static builtin_t builtins[] = {
void
RUA_Set_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
set_resources_t *res = calloc (1, sizeof (set_resources_t));
res->sets = 0;

View file

@ -64,6 +64,7 @@ typedef struct {
static int
int_compare (const void *_a, const void *_b)
{
qfZoneScoped (true);
const int *a = _a;
const int *b = _b;
return *a - *b;
@ -72,6 +73,7 @@ int_compare (const void *_a, const void *_b)
static int
rua_compare (const void *a, const void *b, void *_f)
{
qfZoneScoped (true);
function_t *f = _f;
PR_PushFrame (f->pr);
@ -88,6 +90,7 @@ rua_compare (const void *a, const void *b, void *_f)
static void
bi_bsearch (progs_t *pr, void *data)
{
qfZoneScoped (true);
const void *key = P_GPOINTER (pr, 0);
const void *array = P_GPOINTER (pr, 1);
size_t nmemb = P_INT (pr, 2);
@ -107,6 +110,7 @@ bi_bsearch (progs_t *pr, void *data)
static void
bi_fbsearch (progs_t *pr, void *data)
{
qfZoneScoped (true);
const void *key = P_GPOINTER (pr, 0);
const void *array = P_GPOINTER (pr, 1);
size_t nmemb = P_INT (pr, 2);
@ -126,6 +130,7 @@ bi_fbsearch (progs_t *pr, void *data)
static void
bi_qsort (progs_t *pr, void *data)
{
qfZoneScoped (true);
void *array = P_GPOINTER (pr, 0);
size_t nmemb = P_INT (pr, 1);
size_t size = P_INT (pr, 2) * sizeof (pr_int_t);
@ -142,6 +147,7 @@ bi_qsort (progs_t *pr, void *data)
static void
bi_prefixsumi (progs_t *pr, void *data)
{
qfZoneScoped (true);
int *array = (int *) P_GPOINTER (pr, 0);
int count = P_INT (pr, 1);
@ -153,6 +159,7 @@ bi_prefixsumi (progs_t *pr, void *data)
static void
bi_prefixsumf (progs_t *pr, void *data)
{
qfZoneScoped (true);
float *array = (float *) P_GPOINTER (pr, 0);
int count = P_INT (pr, 1);
@ -176,5 +183,6 @@ static builtin_t builtins[] = {
void
RUA_Stdlib_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
PR_RegisterBuiltins (pr, builtins, 0);
}

View file

@ -59,6 +59,7 @@ typedef struct str_resources_s {
static void
bi_strlen (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *s;
s = P_GSTRING (pr, 0);
@ -68,6 +69,7 @@ bi_strlen (progs_t *pr, void *data)
void
RUA_Sprintf (progs_t *pr, dstring_t *dstr, const char *func, int fmt_arg)
{
qfZoneScoped (true);
const char *fmt = P_GSTRING (pr, fmt_arg);
int count = pr->pr_argc - (fmt_arg + 1);
pr_type_t **args = pr->pr_params + (fmt_arg + 1);
@ -91,6 +93,7 @@ RUA_Sprintf (progs_t *pr, dstring_t *dstr, const char *func, int fmt_arg)
static void
bi_sprintf (progs_t *pr, void *_res)
{
qfZoneScoped (true);
str_resources_t *res = _res;
dstring_clearstr (res->printbuf);
RUA_Sprintf (pr, res->printbuf, "sprintf", 0);
@ -100,6 +103,7 @@ bi_sprintf (progs_t *pr, void *_res)
static void
bi_vsprintf (progs_t *pr, void *_res)
{
qfZoneScoped (true);
str_resources_t *res = _res;
const char *fmt = P_GSTRING (pr, 0);
__auto_type args = &P_PACKED (pr, pr_va_list_t, 1);
@ -118,24 +122,28 @@ bi_vsprintf (progs_t *pr, void *_res)
static void
bi_str_new (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_STRING (pr) = PR_NewMutableString (pr);
}
static void
bi_str_unmutable (progs_t *pr, void *data)
{
qfZoneScoped (true);
RETURN_STRING (pr, P_GSTRING (pr, 0));
}
static void
bi_str_free (progs_t *pr, void *data)
{
qfZoneScoped (true);
PR_FreeString (pr, P_STRING (pr, 0));
}
static void
bi_str_hold (progs_t *pr, void *data)
{
qfZoneScoped (true);
pr_string_t str = P_STRING (pr, 0);
PR_HoldString (pr, str);
R_STRING (pr) = str;
@ -144,18 +152,21 @@ bi_str_hold (progs_t *pr, void *data)
static void
bi_str_valid (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_INT (pr) = PR_StringValid (pr, P_STRING (pr, 0));
}
static void
bi_str_mutable (progs_t *pr, void *data)
{
qfZoneScoped (true);
R_INT (pr) = PR_StringMutable (pr, P_STRING (pr, 0));
}
static void
bi_str_copy (progs_t *pr, void *data)
{
qfZoneScoped (true);
dstring_t *dst = P_DSTRING (pr, 0);
const char *src = P_GSTRING (pr, 1);
@ -166,6 +177,7 @@ bi_str_copy (progs_t *pr, void *data)
static void
bi_str_cat (progs_t *pr, void *data)
{
qfZoneScoped (true);
dstring_t *dst = P_DSTRING (pr, 0);
const char *src = P_GSTRING (pr, 1);
@ -176,6 +188,7 @@ bi_str_cat (progs_t *pr, void *data)
static void
bi_str_clear (progs_t *pr, void *data)
{
qfZoneScoped (true);
dstring_t *str = P_DSTRING (pr, 0);
dstring_clearstr (str);
@ -185,6 +198,7 @@ bi_str_clear (progs_t *pr, void *data)
static void
str_mid (progs_t *pr, const char *str, int pos, int end, int size)
{
qfZoneScoped (true);
char *temp;
R_STRING (pr) = 0;
@ -209,6 +223,7 @@ str_mid (progs_t *pr, const char *str, int pos, int end, int size)
static void
bi_str_mid_2 (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
int pos = P_INT (pr, 1);
int size = strlen (str);
@ -219,6 +234,7 @@ bi_str_mid_2 (progs_t *pr, void *data)
static void
bi_str_mid_3 (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
int pos = P_INT (pr, 1);
int end = P_INT (pr, 2);
@ -230,6 +246,7 @@ bi_str_mid_3 (progs_t *pr, void *data)
static void
bi_str_str (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *haystack = P_GSTRING (pr, 0);
const char *needle = P_GSTRING (pr, 1);
char *res = strstr (haystack, needle);
@ -243,6 +260,7 @@ bi_str_str (progs_t *pr, void *data)
static void
bi_str_char (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
int ind = P_INT (pr, 1);
@ -255,6 +273,7 @@ bi_str_char (progs_t *pr, void *data)
static void
bi_str_quote (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
// can have up to 4 chars per char (a -> \x61)
char *quote = alloca (strlen (str) * 4 + 1);
@ -294,6 +313,7 @@ bi_str_quote (progs_t *pr, void *data)
static void
bi_str_lower (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
char *lower = alloca (strlen (str) + 1);
char *l = lower;
@ -310,6 +330,7 @@ bi_str_lower (progs_t *pr, void *data)
static void
bi_str_upper (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
char *upper = alloca (strlen (str) + 1);
char *l = upper;
@ -326,6 +347,7 @@ bi_str_upper (progs_t *pr, void *data)
static void
bi_strtod (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
pr_type_t *end = P_GPOINTER (pr, 1);
char *end_ptr;
@ -338,6 +360,7 @@ bi_strtod (progs_t *pr, void *data)
static void
bi_strtof (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
pr_type_t *end = P_GPOINTER (pr, 1);
char *end_ptr;
@ -350,6 +373,7 @@ bi_strtof (progs_t *pr, void *data)
static void
bi_strtol (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
pr_type_t *end = P_GPOINTER (pr, 1);
char *end_ptr;
@ -362,6 +386,7 @@ bi_strtol (progs_t *pr, void *data)
static void
bi_strtoul (progs_t *pr, void *data)
{
qfZoneScoped (true);
const char *str = P_GSTRING (pr, 0);
pr_type_t *end = P_GPOINTER (pr, 1);
char *end_ptr;
@ -404,11 +429,13 @@ static builtin_t builtins[] = {
static void
rua_string_clear (progs_t *pr, void *_res)
{
qfZoneScoped (true);
}
static void
rua_string_destroy (progs_t *pr, void *_res)
{
qfZoneScoped (true);
str_resources_t *res = _res;
dstring_delete (res->printbuf);
free (res);
@ -417,6 +444,7 @@ rua_string_destroy (progs_t *pr, void *_res)
void
RUA_String_Init (progs_t *pr, int secure)
{
qfZoneScoped (true);
str_resources_t *res = malloc (sizeof (str_resources_t));
res->printbuf = dstring_newstr ();