From db8cf68ef33c190d59f9a35fb7c3c5482997a899 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 14 Feb 2022 12:28:38 +0900 Subject: [PATCH] [gamecode] Pass registered data pointer to builtins This is the bulk of the work for recording the resource pointer with with builtin data. I don't know how much of a difference it makes for most things, but it's probably pretty big for qwaq-curses due to the very high number of calls to the curses builtins. Closes #26 --- include/QF/progs.h | 4 +- include/QF/ruamoko.h | 4 +- libs/audio/snd_progs.c | 2 +- libs/console/bi_inputline.c | 68 +++-- libs/console/menu.c | 52 ++-- libs/gamecode/pr_builtins.c | 2 +- libs/gamecode/pr_exec.c | 2 +- libs/gamecode/pr_parse.c | 2 +- libs/gib/bi_gib.c | 16 +- libs/ruamoko/pr_cmds.c | 62 ++--- libs/ruamoko/rua_cbuf.c | 8 +- libs/ruamoko/rua_cmd.c | 10 +- libs/ruamoko/rua_cvar.c | 30 +- libs/ruamoko/rua_hash.c | 86 +++--- libs/ruamoko/rua_input.c | 113 ++++---- libs/ruamoko/rua_keys.c | 14 +- libs/ruamoko/rua_math.c | 90 +++--- libs/ruamoko/rua_mersenne.c | 38 +-- libs/ruamoko/rua_msgbuf.c | 184 ++++++++----- libs/ruamoko/rua_obj.c | 124 ++++----- libs/ruamoko/rua_plist.c | 121 ++++---- libs/ruamoko/rua_qfile.c | 89 +++--- libs/ruamoko/rua_qfs.c | 18 +- libs/ruamoko/rua_runtime.c | 2 +- libs/ruamoko/rua_script.c | 36 +-- libs/ruamoko/rua_set.c | 354 ++++++++++++++---------- libs/ruamoko/rua_stdlib.c | 10 +- libs/ruamoko/rua_string.c | 36 +-- libs/video/renderer/r_progs.c | 53 ++-- nq/include/server.h | 2 +- nq/include/sv_pr_cmds.h | 2 +- nq/source/sv_move.c | 4 +- nq/source/sv_pr_cmds.c | 104 +++---- qw/include/server.h | 2 +- qw/include/sv_pr_cmds.h | 2 +- qw/source/sv_move.c | 4 +- qw/source/sv_pr_cmds.c | 138 +++++----- qw/source/sv_pr_cpqw.c | 32 +-- qw/source/sv_pr_qwe.c | 42 +-- qw/source/sv_user.c | 2 +- ruamoko/qwaq/builtins/curses.c | 426 +++++++++++++++-------------- ruamoko/qwaq/builtins/debug.c | 104 +++---- ruamoko/qwaq/builtins/editbuffer.c | 142 +++++----- ruamoko/qwaq/builtins/graphics.c | 6 +- ruamoko/qwaq/builtins/main.c | 6 +- ruamoko/qwaq/builtins/term-input.c | 20 +- tools/qfcc/test/test-bi.c | 12 +- 47 files changed, 1427 insertions(+), 1253 deletions(-) diff --git a/include/QF/progs.h b/include/QF/progs.h index 0fd8efdfc..12d96f009 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -348,7 +348,7 @@ struct plitem_s *ED_ConvertToPlist (struct script_s *script, int nohack, struct hashlink_s **hashlinks); struct plitem_s *ED_Parse (progs_t *pr, const char *data); void ED_LoadFromFile (progs_t *pr, const char *data); -void ED_EntityParseFunction (progs_t *pr); +void ED_EntityParseFunction (progs_t *pr, void *data); #define PR_edicts(p) (*(p)->pr_edicts) @@ -1209,7 +1209,7 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_ #define PR_RANGE_NONE 0xffff #define PR_AUTOBUILTIN (PR_RANGE_AUTO << PR_RANGE_SHIFT) -typedef void (*builtin_proc) (progs_t *pr); +typedef void (*builtin_proc) (progs_t *pr, void *data); /** Create a static array of these and pass the array to PR_RegisterBuiltins() to register the module's QC builtin functions. diff --git a/include/QF/ruamoko.h b/include/QF/ruamoko.h index 71c2fe6ee..7af3ff57f 100644 --- a/include/QF/ruamoko.h +++ b/include/QF/ruamoko.h @@ -44,8 +44,8 @@ pr_func_t RUA_Obj_msg_lookup (struct progs_s *pr, pr_ptr_t _self, void RUA_Game_Init (struct progs_s *pr, int secure); // self is expected in param 0 -int RUA_obj_increment_retaincount (struct progs_s *pr); +int RUA_obj_increment_retaincount (struct progs_s *pr, void *data); // self is expected in param 0 -int RUA_obj_decrement_retaincount (struct progs_s *pr); +int RUA_obj_decrement_retaincount (struct progs_s *pr, void *data); #endif//__QF_ruamoko_h diff --git a/libs/audio/snd_progs.c b/libs/audio/snd_progs.c index 912686412..52eeb945d 100644 --- a/libs/audio/snd_progs.c +++ b/libs/audio/snd_progs.c @@ -40,7 +40,7 @@ #include "QF/sound.h" static void -bi_S_LocalSound (progs_t *pr) +bi_S_LocalSound (progs_t *pr, void *data) { const char *sound = P_GSTRING (pr, 0); diff --git a/libs/console/bi_inputline.c b/libs/console/bi_inputline.c index 69494450f..1399319e5 100644 --- a/libs/console/bi_inputline.c +++ b/libs/console/bi_inputline.c @@ -91,9 +91,9 @@ il_data_index (il_resources_t *res, il_data_t *line) } static void -bi_il_clear (progs_t *pr, void *data) +bi_il_clear (progs_t *pr, void *_res) { - il_resources_t *res = (il_resources_t *)data; + il_resources_t *res = (il_resources_t *)_res; il_data_t *line; for (line = res->lines; line; line = line->next) @@ -103,9 +103,8 @@ bi_il_clear (progs_t *pr, void *data) } static il_data_t * -get_inputline (progs_t *pr, int arg, const char *func) +get_inputline (progs_t *pr, il_resources_t *res, int arg, const char *func) { - il_resources_t *res = PR_Resources_Find (pr, "InputLine"); il_data_t *line = il_data_get (res, arg); // line->prev will be null if the handle is unallocated @@ -142,9 +141,9 @@ bi_inputline_enter (inputline_t *il) } static void -bi_InputLine_Create (progs_t *pr) +bi_InputLine_Create (progs_t *pr, void *_res) { - il_resources_t *res = PR_Resources_Find (pr, "InputLine"); + il_resources_t *res = _res; il_data_t *data; inputline_t *line; int lines = P_INT (pr, 0); @@ -182,26 +181,29 @@ bi_InputLine_Create (progs_t *pr) } static void -bi_InputLine_SetPos (progs_t *pr) +bi_InputLine_SetPos (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), "InputLine_SetPos"); line->line->x = P_INT (pr, 1); line->line->y = P_INT (pr, 2); } static void -bi_InputLine_SetCursor (progs_t *pr) +bi_InputLine_SetCursor (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), "InputLine_SetCursor"); line->line->cursor = P_INT (pr, 1); } static void -bi_InputLine_SetEnter (progs_t *pr) +bi_InputLine_SetEnter (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), "InputLine_SetEnter"); line->data[1] = 0; @@ -221,9 +223,10 @@ bi_InputLine_SetEnter (progs_t *pr) } static void -bi_InputLine_SetWidth (progs_t *pr) +bi_InputLine_SetWidth (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), "InputLine_SetWidth"); int width = P_INT (pr, 1); @@ -231,10 +234,11 @@ bi_InputLine_SetWidth (progs_t *pr) } static void -bi_InputLine_Destroy (progs_t *pr) +bi_InputLine_Destroy (progs_t *pr, void *_res) { - il_resources_t *res = PR_Resources_Find (pr, "InputLine"); - il_data_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_Destroy"); + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), + "InputLine_Destroy"); Con_DestroyInputLine (line->line); *line->prev = line->next; @@ -244,18 +248,22 @@ bi_InputLine_Destroy (progs_t *pr) } static void -bi_InputLine_Clear (progs_t *pr) +bi_InputLine_Clear (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_Clear"); + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), + "InputLine_Clear"); int save = P_INT (pr, 1); Con_ClearTyping (line->line, save); } static void -bi_InputLine_Process (progs_t *pr) +bi_InputLine_Process (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_Process"); + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), + "InputLine_Process"); int ch = P_INT (pr, 1); Con_ProcessInputLine (line->line, ch); @@ -267,9 +275,11 @@ bi_InputLine_Process (progs_t *pr) Sets the inputline to a specified text */ static void -bi_InputLine_SetText (progs_t *pr) +bi_InputLine_SetText (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_SetText"); + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), + "InputLine_SetText"); const char *str = P_GSTRING (pr, 1); inputline_t *il = line->line; @@ -286,18 +296,22 @@ bi_InputLine_SetText (progs_t *pr) Gets the text from a inputline */ static void -bi_InputLine_GetText (progs_t *pr) +bi_InputLine_GetText (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_GetText"); + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), + "InputLine_GetText"); inputline_t *il = line->line; RETURN_STRING(pr, il->lines[il->edit_line]+1); } static void -bi_InputLine_Draw (progs_t *pr) +bi_InputLine_Draw (progs_t *pr, void *_res) { - il_data_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_Draw"); + il_resources_t *res = _res; + il_data_t *line = get_inputline (pr, res, P_INT (pr, 0), + "InputLine_Draw"); line->line->draw (line->line); } diff --git a/libs/console/menu.c b/libs/console/menu.c index 171de8084..896ab7b82 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -212,7 +212,7 @@ menu_pic (int x, int y, const char *name, } static void -bi_Menu_Begin (progs_t *pr) +bi_Menu_Begin (progs_t *pr, void *data) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -230,31 +230,31 @@ bi_Menu_Begin (progs_t *pr) } static void -bi_Menu_FadeScreen (progs_t *pr) +bi_Menu_FadeScreen (progs_t *pr, void *data) { menu->fadescreen = P_INT (pr, 0); } static void -bi_Menu_Draw (progs_t *pr) +bi_Menu_Draw (progs_t *pr, void *data) { menu->draw = P_FUNCTION (pr, 0); } static void -bi_Menu_EnterHook (progs_t *pr) +bi_Menu_EnterHook (progs_t *pr, void *data) { menu->enter_hook = P_FUNCTION (pr, 0); } static void -bi_Menu_LeaveHook (progs_t *pr) +bi_Menu_LeaveHook (progs_t *pr, void *data) { menu->leave_hook = P_FUNCTION (pr, 0); } static void -bi_Menu_Pic (progs_t *pr) +bi_Menu_Pic (progs_t *pr, void *data) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -264,7 +264,7 @@ bi_Menu_Pic (progs_t *pr) } static void -bi_Menu_SubPic (progs_t *pr) +bi_Menu_SubPic (progs_t *pr, void *data) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -278,7 +278,7 @@ bi_Menu_SubPic (progs_t *pr) } static void -bi_Menu_CenterPic (progs_t *pr) +bi_Menu_CenterPic (progs_t *pr, void *data) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -292,7 +292,7 @@ bi_Menu_CenterPic (progs_t *pr) } static void -bi_Menu_CenterSubPic (progs_t *pr) +bi_Menu_CenterSubPic (progs_t *pr, void *data) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -310,7 +310,7 @@ bi_Menu_CenterSubPic (progs_t *pr) } static void -bi_Menu_Item (progs_t *pr) +bi_Menu_Item (progs_t *pr, void *data) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -329,7 +329,7 @@ bi_Menu_Item (progs_t *pr) } static void -bi_Menu_Cursor (progs_t *pr) +bi_Menu_Cursor (progs_t *pr, void *data) { pr_func_t func = P_FUNCTION (pr, 0); @@ -337,7 +337,7 @@ bi_Menu_Cursor (progs_t *pr) } static void -bi_Menu_KeyEvent (progs_t *pr) +bi_Menu_KeyEvent (progs_t *pr, void *data) { pr_func_t func = P_FUNCTION (pr, 0); @@ -345,13 +345,13 @@ bi_Menu_KeyEvent (progs_t *pr) } static void -bi_Menu_End (progs_t *pr) +bi_Menu_End (progs_t *pr, void *data) { menu = menu->parent; } static void -bi_Menu_TopMenu (progs_t *pr) +bi_Menu_TopMenu (progs_t *pr, void *data) { const char *name = P_GSTRING (pr, 0); @@ -361,7 +361,7 @@ bi_Menu_TopMenu (progs_t *pr) } static void -bi_Menu_SelectMenu (progs_t *pr) +bi_Menu_SelectMenu (progs_t *pr, void *data) { const char *name = P_GSTRING (pr, 0); @@ -383,7 +383,7 @@ bi_Menu_SelectMenu (progs_t *pr) } static void -bi_Menu_SetQuit (progs_t *pr) +bi_Menu_SetQuit (progs_t *pr, void *data) { pr_func_t func = P_FUNCTION (pr, 0); @@ -391,7 +391,7 @@ bi_Menu_SetQuit (progs_t *pr) } static void -bi_Menu_Quit (progs_t *pr) +bi_Menu_Quit (progs_t *pr, void *data) { if (con_data.quit) con_data.quit (); @@ -399,7 +399,7 @@ bi_Menu_Quit (progs_t *pr) } static void -bi_Menu_GetIndex (progs_t *pr) +bi_Menu_GetIndex (progs_t *pr, void *data) { if (menu) { R_INT (pr) = menu->cur_item; @@ -409,21 +409,21 @@ bi_Menu_GetIndex (progs_t *pr) } static void -bi_Menu_Next (progs_t *pr) +bi_Menu_Next (progs_t *pr, void *data) { menu->cur_item++; menu->cur_item %= menu->num_items; } static void -bi_Menu_Prev (progs_t *pr) +bi_Menu_Prev (progs_t *pr, void *data) { menu->cur_item += menu->num_items - 1; menu->cur_item %= menu->num_items; } static void -bi_Menu_Enter (progs_t *pr) +bi_Menu_Enter (progs_t *pr, void *data) { menu_item_t *item; @@ -453,7 +453,7 @@ bi_Menu_Enter (progs_t *pr) } static void -bi_Menu_Leave (progs_t *pr) +bi_Menu_Leave (progs_t *pr, void *data) { if (menu) { if (menu->leave_hook) { @@ -490,7 +490,7 @@ quit_f (void) if (!ret) return; } - bi_Menu_Quit (&menu_pr_state); + bi_Menu_Quit (&menu_pr_state, 0); } static void * @@ -795,15 +795,15 @@ menu_key_event (const IE_event_t *ie_event) break; case QFK_DOWN: // case QFM_WHEEL_DOWN: - bi_Menu_Next (&menu_pr_state); + bi_Menu_Next (&menu_pr_state, 0); break; case QFK_UP: // case QFM_WHEEL_UP: - bi_Menu_Prev (&menu_pr_state); + bi_Menu_Prev (&menu_pr_state, 0); break; case QFK_RETURN: // case QFM_BUTTON1: - bi_Menu_Enter (&menu_pr_state); + bi_Menu_Enter (&menu_pr_state, 0); break; default: break; diff --git a/libs/gamecode/pr_builtins.c b/libs/gamecode/pr_builtins.c index eaec8b148..cb0a5a694 100644 --- a/libs/gamecode/pr_builtins.c +++ b/libs/gamecode/pr_builtins.c @@ -89,7 +89,7 @@ builtin_next (progs_t *pr) } static void -bi_no_function (progs_t *pr) +bi_no_function (progs_t *pr, void *data) { // no need for checking: the /only/ way to get here is via a function // descriptor with a bad builtin number diff --git a/libs/gamecode/pr_exec.c b/libs/gamecode/pr_exec.c index c24d35bcf..ea819c6e9 100644 --- a/libs/gamecode/pr_exec.c +++ b/libs/gamecode/pr_exec.c @@ -454,7 +454,7 @@ PR_CallFunction (progs_t *pr, pr_func_t fnum, pr_type_t *return_ptr) pr_type_t *saved_return = pr->pr_return; int builtin_depth = pr->pr_depth; pr->pr_return = return_ptr; - f->func (pr); + f->func (pr, f->data); f->profile++; // to show number times the builtin is called if (builtin_depth == pr->pr_depth) { pr->pr_return = saved_return; diff --git a/libs/gamecode/pr_parse.c b/libs/gamecode/pr_parse.c index 182146261..a1c198192 100644 --- a/libs/gamecode/pr_parse.c +++ b/libs/gamecode/pr_parse.c @@ -532,7 +532,7 @@ ED_LoadFromFile (progs_t *pr, const char *data) } VISIBLE void -ED_EntityParseFunction (progs_t *pr) +ED_EntityParseFunction (progs_t *pr, void *data) { pr->edict_parse = P_FUNCTION (pr, 0); } diff --git a/libs/gib/bi_gib.c b/libs/gib/bi_gib.c index 8c0deb4e8..c0a59178c 100644 --- a/libs/gib/bi_gib.c +++ b/libs/gib/bi_gib.c @@ -98,9 +98,9 @@ bi_gib_builtin_f (void) } static void -bi_gib_builtin_clear (progs_t *progs, void *data) +bi_gib_builtin_clear (progs_t *progs, void *_res) { - bi_gib_resources_t *res = (bi_gib_resources_t *) data; + bi_gib_resources_t *res = (bi_gib_resources_t *) _res; bi_gib_builtin_t *cur; while ((cur = res->builtins)) { @@ -112,9 +112,9 @@ bi_gib_builtin_clear (progs_t *progs, void *data) } static void -bi_GIB_Builtin_Add (progs_t *pr) +bi_GIB_Builtin_Add (progs_t *pr, void *_res) { - bi_gib_resources_t *res = PR_Resources_Find (pr, "GIB"); + bi_gib_resources_t *res = _res; bi_gib_builtin_t *builtin; const char *name = P_GSTRING (pr, 0); pr_func_t func = P_FUNCTION (pr, 1); @@ -138,7 +138,7 @@ bi_GIB_Builtin_Add (progs_t *pr) } static void -bi_GIB_Return (progs_t *pr) +bi_GIB_Return (progs_t *pr, void *_res) { const char *str = P_GSTRING(pr, 0); @@ -148,7 +148,7 @@ bi_GIB_Return (progs_t *pr) } static void -bi_GIB_Handle_New (progs_t *pr) +bi_GIB_Handle_New (progs_t *pr, void *_res) { //long *qcptr = malloc (sizeof (long)); //*qcptr = P_POINTER (pr, 0); @@ -156,7 +156,7 @@ bi_GIB_Handle_New (progs_t *pr) } static void -bi_GIB_Handle_Free (progs_t *pr) +bi_GIB_Handle_Free (progs_t *pr, void *_res) { //unsigned long int hand = P_INT (pr, 0); //long *qcptr = GIB_Handle_Get (hand); @@ -166,7 +166,7 @@ bi_GIB_Handle_Free (progs_t *pr) } static void -bi_GIB_Handle_Get (progs_t *pr) +bi_GIB_Handle_Get (progs_t *pr, void *_res) { //long *hand = GIB_Handle_Get (P_INT (pr, 0)); //if (hand) diff --git a/libs/ruamoko/pr_cmds.c b/libs/ruamoko/pr_cmds.c index 1b03f1bad..8e38ac948 100644 --- a/libs/ruamoko/pr_cmds.c +++ b/libs/ruamoko/pr_cmds.c @@ -77,7 +77,7 @@ PF_VarString (progs_t *pr, int first, int argc) vector (vector v) normalize */ static void -PF_normalize (progs_t *pr) +PF_normalize (progs_t *pr, void *data) { float new; float *value1; @@ -105,7 +105,7 @@ PF_normalize (progs_t *pr) float (vector v) vlen */ static void -PF_vlen (progs_t *pr) +PF_vlen (progs_t *pr, void *data) { float new; float *value1; @@ -123,7 +123,7 @@ PF_vlen (progs_t *pr) float (vector v) vectoyaw */ static void -PF_vectoyaw (progs_t *pr) +PF_vectoyaw (progs_t *pr, void *data) { float yaw; float *value1; @@ -145,7 +145,7 @@ PF_vectoyaw (progs_t *pr) vector (vector v) vectoangles */ static void -PF_vectoangles (progs_t *pr) +PF_vectoangles (progs_t *pr, void *data) { float forward, pitch, yaw; float *value1; @@ -180,7 +180,7 @@ PF_vectoangles (progs_t *pr) Returns a number from 0<= num < 1 */ static void -PF_random (progs_t *pr) +PF_random (progs_t *pr, void *data) { float num; @@ -193,7 +193,7 @@ PF_random (progs_t *pr) void () break */ static void -PF_break (progs_t *pr) +PF_break (progs_t *pr, void *data) { Sys_Printf ("break statement\n"); PR_DumpState (pr); @@ -203,7 +203,7 @@ PF_break (progs_t *pr) float (string s) cvar */ static void -PF_cvar (progs_t *pr) +PF_cvar (progs_t *pr, void *data) { const char *str; @@ -216,7 +216,7 @@ PF_cvar (progs_t *pr) void (string var, string val) cvar_set */ static void -PF_cvar_set (progs_t *pr) +PF_cvar_set (progs_t *pr, void *data) { const char *var_name, *val; cvar_t *var; @@ -238,7 +238,7 @@ PF_cvar_set (progs_t *pr) float (float f) fabs */ static void -PF_fabs (progs_t *pr) +PF_fabs (progs_t *pr, void *data) { float v; @@ -250,7 +250,7 @@ PF_fabs (progs_t *pr) entity (entity start, .(...) fld, ... match) find */ static void -PF_find (progs_t *pr) +PF_find (progs_t *pr, void *data) { const char *s = 0, *t; // ev_string int i; // ev_vector @@ -314,7 +314,7 @@ PF_find (progs_t *pr) void () coredump */ static void -PF_coredump (progs_t *pr) +PF_coredump (progs_t *pr, void *data) { ED_PrintEdicts (pr, ""); } @@ -323,7 +323,7 @@ PF_coredump (progs_t *pr) void () traceon */ static void -PF_traceon (progs_t *pr) +PF_traceon (progs_t *pr, void *data) { pr->pr_trace = true; pr->pr_trace_depth = pr->pr_depth; @@ -333,7 +333,7 @@ PF_traceon (progs_t *pr) void () traceoff */ static void -PF_traceoff (progs_t *pr) +PF_traceoff (progs_t *pr, void *data) { pr->pr_trace = false; } @@ -342,7 +342,7 @@ PF_traceoff (progs_t *pr) void (entity e) eprint */ static void -PF_eprint (progs_t *pr) +PF_eprint (progs_t *pr, void *data) { ED_PrintNum (pr, P_EDICTNUM (pr, 0), 0); } @@ -351,7 +351,7 @@ PF_eprint (progs_t *pr) void (string s) dprint */ static void -PF_dprint (progs_t *pr) +PF_dprint (progs_t *pr, void *data) { Sys_Printf ("%s", PF_VarString (pr, 0, 1)); } @@ -360,7 +360,7 @@ PF_dprint (progs_t *pr) float (float v) rint */ static void -PF_rint (progs_t *pr) +PF_rint (progs_t *pr, void *data) { float f; @@ -375,7 +375,7 @@ PF_rint (progs_t *pr) float (float v) floor */ static void -PF_floor (progs_t *pr) +PF_floor (progs_t *pr, void *data) { R_FLOAT (pr) = floor (P_FLOAT (pr, 0)); } @@ -384,7 +384,7 @@ PF_floor (progs_t *pr) float (float v) ceil */ static void -PF_ceil (progs_t *pr) +PF_ceil (progs_t *pr, void *data) { R_FLOAT (pr) = ceil (P_FLOAT (pr, 0)); } @@ -393,7 +393,7 @@ PF_ceil (progs_t *pr) entity (entity e) nextent */ static void -PF_nextent (progs_t *pr) +PF_nextent (progs_t *pr, void *data) { pr_uint_t i; edict_t *ent; @@ -424,7 +424,7 @@ PF_nextent (progs_t *pr) int (float f) ftoi */ static void -PF_ftoi (progs_t *pr) +PF_ftoi (progs_t *pr, void *data) { R_INT (pr) = P_FLOAT (pr, 0); } @@ -433,7 +433,7 @@ PF_ftoi (progs_t *pr) string (float f) ftos */ static void -PF_ftos (progs_t *pr) +PF_ftos (progs_t *pr, void *data) { char string[STRING_BUF]; int i; @@ -457,7 +457,7 @@ PF_ftos (progs_t *pr) float (int i) itof */ static void -PF_itof (progs_t *pr) +PF_itof (progs_t *pr, void *data) { R_FLOAT (pr) = P_INT (pr, 0); } @@ -466,7 +466,7 @@ PF_itof (progs_t *pr) string (int i) itos */ static void -PF_itos (progs_t *pr) +PF_itos (progs_t *pr, void *data) { char string[STRING_BUF]; @@ -479,7 +479,7 @@ PF_itos (progs_t *pr) float (string s) stof */ static void -PF_stof (progs_t *pr) +PF_stof (progs_t *pr, void *data) { R_FLOAT (pr) = atof (P_GSTRING (pr, 0)); } @@ -488,7 +488,7 @@ PF_stof (progs_t *pr) int (string s) stoi */ static void -PF_stoi (progs_t *pr) +PF_stoi (progs_t *pr, void *data) { R_INT (pr) = atoi (P_GSTRING (pr, 0)); } @@ -497,7 +497,7 @@ PF_stoi (progs_t *pr) vector (string s) stov */ static void -PF_stov (progs_t *pr) +PF_stov (progs_t *pr, void *data) { float v[3] = {0, 0, 0}; @@ -510,7 +510,7 @@ PF_stov (progs_t *pr) string (vector v) vtos */ static void -PF_vtos (progs_t *pr) +PF_vtos (progs_t *pr, void *data) { char string[STRING_BUF * 3 + 5]; @@ -526,7 +526,7 @@ PF_vtos (progs_t *pr) float (string char, string s) charcount */ static void -PF_charcount (progs_t *pr) +PF_charcount (progs_t *pr, void *data) { char goal; const char *s; @@ -558,13 +558,13 @@ PF_charcount (progs_t *pr) string () gametype */ static void -PF_gametype (progs_t *pr) +PF_gametype (progs_t *pr, void *data) { RETURN_STRING (pr, pr_gametype); } static void -PF_PR_SetField (progs_t *pr) +PF_PR_SetField (progs_t *pr, void *data) { edict_t *ent = P_EDICT (pr, 0); pr_def_t *field = PR_FindField (pr, P_GSTRING (pr, 1)); @@ -576,7 +576,7 @@ PF_PR_SetField (progs_t *pr) } static void -PF_PR_FindFunction (progs_t *pr) +PF_PR_FindFunction (progs_t *pr, void *data) { dfunction_t *func = PR_FindFunction (pr, P_GSTRING (pr, 0)); R_FUNCTION (pr) = 0; diff --git a/libs/ruamoko/rua_cbuf.c b/libs/ruamoko/rua_cbuf.c index 7f96f4783..b5689461b 100644 --- a/libs/ruamoko/rua_cbuf.c +++ b/libs/ruamoko/rua_cbuf.c @@ -59,7 +59,7 @@ get_cbuf (progs_t *pr, int arg, const char *func) } static void -bi_Cbuf_AddText (progs_t *pr) +bi_Cbuf_AddText (progs_t *pr, void *data) { const char *text = P_GSTRING (pr, 0); cbuf_t *cbuf = get_cbuf (pr, 0, __FUNCTION__); @@ -67,7 +67,7 @@ bi_Cbuf_AddText (progs_t *pr) } static void -bi_Cbuf_InsertText (progs_t *pr) +bi_Cbuf_InsertText (progs_t *pr, void *data) { const char *text = P_GSTRING (pr, 0); cbuf_t *cbuf = get_cbuf (pr, 0, __FUNCTION__); @@ -75,14 +75,14 @@ bi_Cbuf_InsertText (progs_t *pr) } static void -bi_Cbuf_Execute (progs_t *pr) +bi_Cbuf_Execute (progs_t *pr, void *data) { cbuf_t *cbuf = get_cbuf (pr, 0, __FUNCTION__); Cbuf_Execute (cbuf); } static void -bi_Cbuf_Execute_Sets (progs_t *pr) +bi_Cbuf_Execute_Sets (progs_t *pr, void *data) { cbuf_t *cbuf = get_cbuf (pr, 0, __FUNCTION__); Cbuf_Execute_Sets (cbuf); diff --git a/libs/ruamoko/rua_cmd.c b/libs/ruamoko/rua_cmd.c index c325e3c3a..9391da918 100644 --- a/libs/ruamoko/rua_cmd.c +++ b/libs/ruamoko/rua_cmd.c @@ -85,9 +85,9 @@ bi_cmd_f (void) } static void -bi_Cmd_AddCommand (progs_t *pr) +bi_Cmd_AddCommand (progs_t *pr, void *_res) { - cmd_resources_t *res = PR_Resources_Find (pr, "Cmd"); + __auto_type res = (cmd_resources_t *) _res; bi_cmd_t *cmd = malloc (sizeof (bi_cmd_t)); char *name = strdup (P_GSTRING (pr, 0)); pr_func_t func = P_FUNCTION (pr, 1); @@ -124,19 +124,19 @@ bi_cmd_clear (progs_t *pr, void *data) } static void -bi_Cmd_Argc (progs_t *pr) +bi_Cmd_Argc (progs_t *pr, void *data) { R_INT (pr) = Cmd_Argc (); } static void -bi_Cmd_Argv (progs_t *pr) +bi_Cmd_Argv (progs_t *pr, void *data) { RETURN_STRING (pr, Cmd_Argv (P_INT (pr, 0))); } static void -bi_Cmd_Args (progs_t *pr) +bi_Cmd_Args (progs_t *pr, void *data) { RETURN_STRING (pr, Cmd_Args (P_INT (pr, 0))); } diff --git a/libs/ruamoko/rua_cvar.c b/libs/ruamoko/rua_cvar.c index 12cc3fca1..4d953db9c 100644 --- a/libs/ruamoko/rua_cvar.c +++ b/libs/ruamoko/rua_cvar.c @@ -62,9 +62,9 @@ bi_alias_free (void *_a, void *unused) } static void -bi_cvar_clear (progs_t *pr, void *data) +bi_cvar_clear (progs_t *pr, void *_res) { - cvar_resources_t *res = (cvar_resources_t *) data; + cvar_resources_t *res = (cvar_resources_t *) _res; bi_alias_t *alias; while ((alias = res->aliases)) { @@ -75,9 +75,9 @@ bi_cvar_clear (progs_t *pr, void *data) } static void -bi_Cvar_MakeAlias (progs_t *pr) +bi_Cvar_MakeAlias (progs_t *pr, void *_res) { - cvar_resources_t *res = PR_Resources_Find (pr, "Cvar"); + __auto_type res = (cvar_resources_t *) _res; const char *alias_name = P_GSTRING (pr, 0); const char *cvar_name = P_GSTRING (pr, 1); cvar_t *cvar = Cvar_FindVar (cvar_name); @@ -99,9 +99,9 @@ bi_Cvar_MakeAlias (progs_t *pr) } static void -bi_Cvar_RemoveAlias (progs_t *pr) +bi_Cvar_RemoveAlias (progs_t *pr, void *_res) { - cvar_resources_t *res = PR_Resources_Find (pr, "Cvar"); + __auto_type res = (cvar_resources_t *) _res; const char *alias_name = P_GSTRING (pr, 0); bi_alias_t **a; @@ -118,7 +118,7 @@ bi_Cvar_RemoveAlias (progs_t *pr) } static void -bi_Cvar_SetString (progs_t *pr) +bi_Cvar_SetString (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); const char *val = P_GSTRING (pr, 1); @@ -131,7 +131,7 @@ bi_Cvar_SetString (progs_t *pr) } static void -bi_Cvar_SetInteger (progs_t *pr) +bi_Cvar_SetInteger (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); int val = P_INT (pr, 1); @@ -144,7 +144,7 @@ bi_Cvar_SetInteger (progs_t *pr) } static void -bi_Cvar_SetFloat (progs_t *pr) +bi_Cvar_SetFloat (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); float val = P_FLOAT (pr, 1); @@ -157,7 +157,7 @@ bi_Cvar_SetFloat (progs_t *pr) } static void -bi_Cvar_SetVector (progs_t *pr) +bi_Cvar_SetVector (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); float *val = P_VECTOR (pr, 1); @@ -170,7 +170,7 @@ bi_Cvar_SetVector (progs_t *pr) } static void -bi_Cvar_GetString (progs_t *pr) +bi_Cvar_GetString (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); cvar_t *var = Cvar_FindVar (varname); @@ -184,7 +184,7 @@ bi_Cvar_GetString (progs_t *pr) } static void -bi_Cvar_GetInteger (progs_t *pr) +bi_Cvar_GetInteger (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); cvar_t *var = Cvar_FindVar (varname); @@ -195,7 +195,7 @@ bi_Cvar_GetInteger (progs_t *pr) } static void -bi_Cvar_GetFloat (progs_t *pr) +bi_Cvar_GetFloat (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); cvar_t *var = Cvar_FindVar (varname); @@ -206,7 +206,7 @@ bi_Cvar_GetFloat (progs_t *pr) } static void -bi_Cvar_GetVector (progs_t *pr) +bi_Cvar_GetVector (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); cvar_t *var = Cvar_FindVar (varname); @@ -220,7 +220,7 @@ bi_Cvar_GetVector (progs_t *pr) } static void -bi_Cvar_Toggle (progs_t *pr) +bi_Cvar_Toggle (progs_t *pr, void *_res) { const char *varname = P_GSTRING (pr, 0); cvar_t *var; diff --git a/libs/ruamoko/rua_hash.c b/libs/ruamoko/rua_hash.c index c4939e1e7..c7ca65322 100644 --- a/libs/ruamoko/rua_hash.c +++ b/libs/ruamoko/rua_hash.c @@ -151,9 +151,9 @@ bi_free (void *key, void *_ht) } static void -bi_Hash_NewTable (progs_t *pr) +bi_Hash_NewTable (progs_t *pr, void *_res) { - hash_resources_t *res = PR_Resources_Find (pr, "Hash"); + __auto_type res = (hash_resources_t *) _res; int tsize = P_INT (pr, 0); const char *(*gk)(const void*,void*); void (*f)(void*,void*); @@ -178,9 +178,8 @@ bi_Hash_NewTable (progs_t *pr) } static bi_hashtab_t * -get_table (progs_t *pr, const char *name, int index) +get_table (progs_t *pr, hash_resources_t *res, const char *name, int index) { - hash_resources_t *res = PR_Resources_Find (pr, "Hash"); bi_hashtab_t *ht = table_get (res, index); if (!ht) @@ -189,9 +188,10 @@ get_table (progs_t *pr, const char *name, int index) } static void -bi_Hash_SetHashCompare (progs_t *pr) +bi_Hash_SetHashCompare (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __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*); int (*cmp)(const void*,const void*,void*); @@ -203,10 +203,10 @@ bi_Hash_SetHashCompare (progs_t *pr) } static void -bi_Hash_DelTable (progs_t *pr) +bi_Hash_DelTable (progs_t *pr, void *_res) { - hash_resources_t *res = PR_Resources_Find (pr, "Hash"); - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); Hash_DelTable (ht->tab); *ht->prev = ht->next; @@ -216,50 +216,56 @@ bi_Hash_DelTable (progs_t *pr) } static void -bi_Hash_FlushTable (progs_t *pr) +bi_Hash_FlushTable (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); Hash_FlushTable (ht->tab); } static void -bi_Hash_Add (progs_t *pr) +bi_Hash_Add (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = Hash_Add (ht->tab, (void *) (intptr_t) P_INT (pr, 1)); } static void -bi_Hash_AddElement (progs_t *pr) +bi_Hash_AddElement (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = Hash_AddElement (ht->tab, (void *) (intptr_t) P_INT (pr, 1)); } static void -bi_Hash_Find (progs_t *pr) +bi_Hash_Find (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = (intptr_t) Hash_Find (ht->tab, P_GSTRING (pr, 1)); } static void -bi_Hash_FindElement (progs_t *pr) +bi_Hash_FindElement (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = (intptr_t) Hash_FindElement (ht->tab, (void *) (intptr_t) P_INT (pr, 1)); } static void -bi_Hash_FindList (progs_t *pr) +bi_Hash_FindList (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); void **list, **l; pr_type_t *pr_list; int count; @@ -276,9 +282,10 @@ bi_Hash_FindList (progs_t *pr) } static void -bi_Hash_FindElementList (progs_t *pr) +bi_Hash_FindElementList (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); void **list, **l; pr_type_t *pr_list; int count; @@ -295,46 +302,50 @@ bi_Hash_FindElementList (progs_t *pr) } static void -bi_Hash_Del (progs_t *pr) +bi_Hash_Del (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = (intptr_t) Hash_Del (ht->tab, P_GSTRING (pr, 1)); } static void -bi_Hash_DelElement (progs_t *pr) +bi_Hash_DelElement (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = (intptr_t) Hash_DelElement (ht->tab, (void *) (intptr_t) P_INT (pr, 1)); } static void -bi_Hash_Free (progs_t *pr) +bi_Hash_Free (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); Hash_Free (ht->tab, (void *) (intptr_t) P_INT (pr, 1)); } static void -bi_Hash_String (progs_t *pr) +bi_Hash_String (progs_t *pr, void *_res) { R_INT (pr) = Hash_String (P_GSTRING (pr, 0)); } static void -bi_Hash_Buffer (progs_t *pr) +bi_Hash_Buffer (progs_t *pr, void *_res) { R_INT (pr) = Hash_Buffer (P_GPOINTER (pr, 0), P_INT (pr, 1)); } static void -bi_Hash_GetList (progs_t *pr) +bi_Hash_GetList (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); void **list, **l; pr_type_t *pr_list; int count; @@ -351,17 +362,18 @@ bi_Hash_GetList (progs_t *pr) } static void -bi_Hash_Stats (progs_t *pr) +bi_Hash_Stats (progs_t *pr, void *_res) { - bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0)); + __auto_type res = (hash_resources_t *) _res; + bi_hashtab_t *ht = get_table (pr, res, __FUNCTION__, P_INT (pr, 0)); Hash_Stats (ht->tab); } static void -bi_hash_clear (progs_t *pr, void *data) +bi_hash_clear (progs_t *pr, void *_res) { - hash_resources_t *res = (hash_resources_t *) data; + hash_resources_t *res = (hash_resources_t *) _res; bi_hashtab_t *ht; for (ht = res->tabs; ht; ht = ht->next) diff --git a/libs/ruamoko/rua_input.c b/libs/ruamoko/rua_input.c index 406ce18bc..787fbf66c 100644 --- a/libs/ruamoko/rua_input.c +++ b/libs/ruamoko/rua_input.c @@ -57,7 +57,7 @@ typedef struct input_resources_s { } input_resources_t; static void -bi_IN_FindDeviceId (progs_t *pr) +bi_IN_FindDeviceId (progs_t *pr, void *_res) { const char *id = P_GSTRING (pr, 0); @@ -65,7 +65,7 @@ bi_IN_FindDeviceId (progs_t *pr) } static void -bi_IN_GetDeviceName (progs_t *pr) +bi_IN_GetDeviceName (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); @@ -73,7 +73,7 @@ bi_IN_GetDeviceName (progs_t *pr) } static void -bi_IN_GetDeviceId (progs_t *pr) +bi_IN_GetDeviceId (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); @@ -81,17 +81,17 @@ bi_IN_GetDeviceId (progs_t *pr) } static void -bi_IN_AxisInfo (progs_t *pr) +bi_IN_AxisInfo (progs_t *pr, void *_res) { } static void -bi_IN_ButtonInfo (progs_t *pr) +bi_IN_ButtonInfo (progs_t *pr, void *_res) { } static void -bi_IN_GetAxisName (progs_t *pr) +bi_IN_GetAxisName (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); int axis = P_INT (pr, 1); @@ -100,7 +100,7 @@ bi_IN_GetAxisName (progs_t *pr) } static void -bi_IN_GetButtonName (progs_t *pr) +bi_IN_GetButtonName (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); int button = P_INT (pr, 1); @@ -109,7 +109,7 @@ bi_IN_GetButtonName (progs_t *pr) } static void -bi_IN_GetAxisNumber (progs_t *pr) +bi_IN_GetAxisNumber (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); const char *axis_name = P_GSTRING (pr, 1); @@ -118,7 +118,7 @@ bi_IN_GetAxisNumber (progs_t *pr) } static void -bi_IN_GetButtonNumber (progs_t *pr) +bi_IN_GetButtonNumber (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); const char *button_name = P_GSTRING (pr, 1); @@ -127,19 +127,19 @@ bi_IN_GetButtonNumber (progs_t *pr) } static void -bi_IN_ProcessEvents (progs_t *pr) +bi_IN_ProcessEvents (progs_t *pr, void *_res) { IN_ProcessEvents (); } static void -bi_IN_ClearStates (progs_t *pr) +bi_IN_ClearStates (progs_t *pr, void *_res) { IN_ClearStates (); } static void -bi_IN_CreateButton (progs_t *pr) +bi_IN_CreateButton (progs_t *pr, void *_res) { const char *name = P_GSTRING (pr, 0); const char *desc = P_GSTRING (pr, 1); @@ -151,7 +151,7 @@ bi_IN_CreateButton (progs_t *pr) } static void -bi_IN_CreateAxis (progs_t *pr) +bi_IN_CreateAxis (progs_t *pr, void *_res) { const char *name = P_GSTRING (pr, 0); const char *desc = P_GSTRING (pr, 1); @@ -163,7 +163,7 @@ bi_IN_CreateAxis (progs_t *pr) } static void -bi_IN_GetAxisInfo (progs_t *pr) +bi_IN_GetAxisInfo (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); int axis = P_INT (pr, 1); @@ -178,7 +178,7 @@ bi_IN_GetAxisInfo (progs_t *pr) } static void -bi_IN_GetButtonInfo (progs_t *pr) +bi_IN_GetButtonInfo (progs_t *pr, void *_res) { int devid = P_INT (pr, 0); int button = P_INT (pr, 1); @@ -193,9 +193,8 @@ bi_IN_GetButtonInfo (progs_t *pr) } static rua_in_cookie_t * -make_cookie (progs_t *pr, pr_func_t func, pr_ptr_t data) +make_cookie (progs_t *pr, input_resources_t *res, pr_func_t func, pr_ptr_t data) { - input_resources_t *res = PR_Resources_Find (pr, "input"); rua_in_cookie_t search = { .func = func, .data = data, @@ -212,9 +211,8 @@ make_cookie (progs_t *pr, pr_func_t func, pr_ptr_t data) } static rua_in_cookie_t * -find_cookie (progs_t *pr, pr_func_t func, pr_ptr_t data) +find_cookie (progs_t *pr, input_resources_t *res, pr_func_t func, pr_ptr_t data) { - input_resources_t *res = PR_Resources_Find (pr, "input"); rua_in_cookie_t search = { .func = func, .data = data, @@ -223,58 +221,61 @@ find_cookie (progs_t *pr, pr_func_t func, pr_ptr_t data) } static void -release_cookie (progs_t *pr, rua_in_cookie_t *cookie) +release_cookie (progs_t *pr, input_resources_t *res, rua_in_cookie_t *cookie) { if (!--cookie->users) { - input_resources_t *res = PR_Resources_Find (pr, "input"); Hash_DelElement (res->cookies, cookie); Hash_Free (res->cookies, cookie); } } static void -rua_add_axis_listener (progs_t *pr, axis_listener_t listener) +rua_add_axis_listener (progs_t *pr, input_resources_t *res, + axis_listener_t listener) { 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); - rua_in_cookie_t *cookie = make_cookie (pr, func, data); + rua_in_cookie_t *cookie = make_cookie (pr, res, func, data); IN_AxisAddListener (axis, listener, cookie); } static void -rua_remove_axis_listener (progs_t *pr, axis_listener_t listener) +rua_remove_axis_listener (progs_t *pr, input_resources_t *res, + axis_listener_t listener) { 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); - rua_in_cookie_t *cookie = find_cookie (pr, func, data); + rua_in_cookie_t *cookie = find_cookie (pr, res, func, data); if (cookie) { IN_AxisRemoveListener (axis, listener, cookie); - release_cookie (pr, cookie); + release_cookie (pr, res, cookie); } } static void -rua_add_button_listener (progs_t *pr, button_listener_t listener) +rua_add_button_listener (progs_t *pr, input_resources_t *res, + button_listener_t listener) { 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); - rua_in_cookie_t *cookie = make_cookie (pr, func, data); + rua_in_cookie_t *cookie = make_cookie (pr, res, func, data); IN_ButtonAddListener (button, listener, cookie); } static void -rua_remove_button_listener (progs_t *pr, button_listener_t listener) +rua_remove_button_listener (progs_t *pr, input_resources_t *res, + button_listener_t listener) { 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); - rua_in_cookie_t *cookie = find_cookie (pr, func, data); + rua_in_cookie_t *cookie = find_cookie (pr, res, func, data); if (cookie) { IN_ButtonRemoveListener (button, listener, cookie); - release_cookie (pr, cookie); + release_cookie (pr, res, cookie); } } @@ -330,80 +331,88 @@ rua_button_listener_method (void *data, const in_button_t *button) } static void -rua_IN_ButtonAddListener_func (progs_t *pr) +rua_IN_ButtonAddListener_func (progs_t *pr, void *_res) { - rua_add_button_listener (pr, rua_button_listener_func); + input_resources_t *res = _res; + rua_add_button_listener (pr, res, rua_button_listener_func); } static void -rua_IN_ButtonRemoveListener_func (progs_t *pr) +rua_IN_ButtonRemoveListener_func (progs_t *pr, void *_res) { - rua_remove_button_listener (pr, rua_button_listener_func); + input_resources_t *res = _res; + rua_remove_button_listener (pr, res, rua_button_listener_func); } static void -rua_IN_AxisAddListener_func (progs_t *pr) +rua_IN_AxisAddListener_func (progs_t *pr, void *_res) { - rua_add_axis_listener (pr, rua_axis_listener_func); + input_resources_t *res = _res; + rua_add_axis_listener (pr, res, rua_axis_listener_func); } static void -rua_IN_AxisRemoveListener_func (progs_t *pr) +rua_IN_AxisRemoveListener_func (progs_t *pr, void *_res) { - rua_remove_axis_listener (pr, rua_axis_listener_func); + input_resources_t *res = _res; + rua_remove_axis_listener (pr, res, rua_axis_listener_func); } static void -rua_IN_ButtonAddListener_method (progs_t *pr) +rua_IN_ButtonAddListener_method (progs_t *pr, void *_res) { - rua_add_button_listener (pr, rua_button_listener_method); + input_resources_t *res = _res; + rua_add_button_listener (pr, res, rua_button_listener_method); } static void -rua_IN_ButtonRemoveListener_method (progs_t *pr) +rua_IN_ButtonRemoveListener_method (progs_t *pr, void *_res) { - rua_remove_button_listener (pr, rua_button_listener_method); + input_resources_t *res = _res; + rua_remove_button_listener (pr, res, rua_button_listener_method); } static void -rua_IN_AxisAddListener_method (progs_t *pr) +rua_IN_AxisAddListener_method (progs_t *pr, void *_res) { - rua_add_axis_listener (pr, rua_axis_listener_method); + input_resources_t *res = _res; + rua_add_axis_listener (pr, res, rua_axis_listener_method); } static void -rua_IN_AxisRemoveListener_method (progs_t *pr) +rua_IN_AxisRemoveListener_method (progs_t *pr, void *_res) { - rua_remove_axis_listener (pr, rua_axis_listener_method); + input_resources_t *res = _res; + rua_remove_axis_listener (pr, res, rua_axis_listener_method); } static void -bi_IN_LoadConfig (progs_t *pr) +bi_IN_LoadConfig (progs_t *pr, void *_res) { IN_LoadConfig (Plist_GetItem (pr, P_INT (pr, 0))); } static void -bi_IMT_CreateContext (progs_t *pr) +bi_IMT_CreateContext (progs_t *pr, void *_res) { const char *name = P_GSTRING (pr, 0); R_INT (pr) = IMT_CreateContext (name); } static void -bi_IMT_GetContext (progs_t *pr) +bi_IMT_GetContext (progs_t *pr, void *_res) { R_INT (pr) = IMT_GetContext (); } static void -bi_IMT_SetContext (progs_t *pr) +bi_IMT_SetContext (progs_t *pr, void *_res) { IMT_SetContext (P_INT (pr, 0)); } static void -secured (progs_t *pr) +secured (progs_t *pr, void *_res) { PR_RunError (pr, "Secured function called"); } diff --git a/libs/ruamoko/rua_keys.c b/libs/ruamoko/rua_keys.c index d6e9acaa8..7a0d5d43f 100644 --- a/libs/ruamoko/rua_keys.c +++ b/libs/ruamoko/rua_keys.c @@ -41,7 +41,7 @@ #include "QF/zone.h" static void -bi_Key_keydown (progs_t *pr) +bi_Key_keydown (progs_t *pr, void *data) { #if 0 int keynum = P_INT (pr, 0); @@ -55,7 +55,7 @@ bi_Key_keydown (progs_t *pr) QC-Function for set a binding */ static void -bi_Key_SetBinding (progs_t *pr) +bi_Key_SetBinding (progs_t *pr, void *data) { #if 0 const char *imt_name = P_GSTRING (pr, 0); @@ -80,7 +80,7 @@ bi_Key_SetBinding (progs_t *pr) Perform a reverse-binding-lookup */ static void -bi_Key_LookupBinding (progs_t *pr) +bi_Key_LookupBinding (progs_t *pr, void *data) { #if 0 const char *imt_name = P_GSTRING (pr, 0); @@ -118,7 +118,7 @@ bi_Key_LookupBinding (progs_t *pr) Counts how often a binding is assigned to a key */ static void -bi_Key_CountBinding (progs_t *pr) +bi_Key_CountBinding (progs_t *pr, void *data) { #if 0 const char *imt_name = P_GSTRING (pr, 0); @@ -151,7 +151,7 @@ bi_Key_CountBinding (progs_t *pr) Convertes a keynum to a string */ static void -bi_Key_KeynumToString (progs_t *pr) +bi_Key_KeynumToString (progs_t *pr, void *data) { int keynum = P_INT (pr, 0); @@ -159,7 +159,7 @@ bi_Key_KeynumToString (progs_t *pr) } static void -bi_Key_StringToKeynum (progs_t *pr) +bi_Key_StringToKeynum (progs_t *pr, void *data) { const char *keyname = P_GSTRING (pr, 0); R_INT (pr) = Key_StringToKeynum (keyname); @@ -179,7 +179,7 @@ static builtin_t builtins[] = { }; void -RUA_Key_Init (progs_t *pr) +RUA_Key_Init (progs_t *pr, void *data) { PR_RegisterBuiltins (pr, builtins, 0); } diff --git a/libs/ruamoko/rua_math.c b/libs/ruamoko/rua_math.c index 2d7e09398..cf00b84a3 100644 --- a/libs/ruamoko/rua_math.c +++ b/libs/ruamoko/rua_math.c @@ -42,61 +42,61 @@ #include "rua_internal.h" static void -bi_sinf (progs_t *pr) +bi_sinf (progs_t *pr, void *data) { R_FLOAT (pr) = sinf (P_FLOAT (pr, 0)); } static void -bi_cosf (progs_t *pr) +bi_cosf (progs_t *pr, void *data) { R_FLOAT (pr) = cosf (P_FLOAT (pr, 0)); } static void -bi_tanf (progs_t *pr) +bi_tanf (progs_t *pr, void *data) { R_FLOAT (pr) = tanf (P_FLOAT (pr, 0)); } static void -bi_asinf (progs_t *pr) +bi_asinf (progs_t *pr, void *data) { R_FLOAT (pr) = asinf (P_FLOAT (pr, 0)); } static void -bi_acosf (progs_t *pr) +bi_acosf (progs_t *pr, void *data) { R_FLOAT (pr) = acosf (P_FLOAT (pr, 0)); } static void -bi_atanf (progs_t *pr) +bi_atanf (progs_t *pr, void *data) { R_FLOAT (pr) = atanf (P_FLOAT (pr, 0)); } static void -bi_atan2f (progs_t *pr) +bi_atan2f (progs_t *pr, void *data) { R_FLOAT (pr) = atan2f (P_FLOAT (pr, 0), P_FLOAT (pr, 1)); } static void -bi_expf (progs_t *pr) +bi_expf (progs_t *pr, void *data) { R_FLOAT (pr) = expf (P_FLOAT (pr, 0)); } static void -bi_logf (progs_t *pr) +bi_logf (progs_t *pr, void *data) { R_FLOAT (pr) = logf (P_FLOAT (pr, 0)); } static void -bi_log2f (progs_t *pr) +bi_log2f (progs_t *pr, void *data) { #ifdef HAVE_LOG2F R_FLOAT (pr) = log2f (P_FLOAT (pr, 0)); @@ -106,216 +106,216 @@ bi_log2f (progs_t *pr) } static void -bi_log10f (progs_t *pr) +bi_log10f (progs_t *pr, void *data) { R_FLOAT (pr) = log10f (P_FLOAT (pr, 0)); } static void -bi_powf (progs_t *pr) +bi_powf (progs_t *pr, void *data) { R_FLOAT (pr) = powf (P_FLOAT (pr, 0), P_FLOAT (pr, 1)); } static void -bi_sqrtf (progs_t *pr) +bi_sqrtf (progs_t *pr, void *data) { R_FLOAT (pr) = sqrtf (P_FLOAT (pr, 0)); } static void -bi_cbrtf (progs_t *pr) +bi_cbrtf (progs_t *pr, void *data) { R_FLOAT (pr) = cbrtf (P_FLOAT (pr, 0)); } static void -bi_hypotf (progs_t *pr) +bi_hypotf (progs_t *pr, void *data) { R_FLOAT (pr) = hypotf (P_FLOAT (pr, 0), P_FLOAT (pr, 1)); } static void -bi_sinhf (progs_t *pr) +bi_sinhf (progs_t *pr, void *data) { R_FLOAT (pr) = sinhf (P_FLOAT (pr, 0)); } static void -bi_coshf (progs_t *pr) +bi_coshf (progs_t *pr, void *data) { R_FLOAT (pr) = coshf (P_FLOAT (pr, 0)); } static void -bi_tanhf (progs_t *pr) +bi_tanhf (progs_t *pr, void *data) { R_FLOAT (pr) = tanhf (P_FLOAT (pr, 0)); } static void -bi_asinhf (progs_t *pr) +bi_asinhf (progs_t *pr, void *data) { double y = P_FLOAT (pr, 0); R_FLOAT (pr) = logf (y + sqrtf (y * y + 1)); } static void -bi_acoshf (progs_t *pr) +bi_acoshf (progs_t *pr, void *data) { double y = P_FLOAT (pr, 0); R_FLOAT (pr) = logf (y + sqrtf (y * y - 1)); } static void -bi_atanhf (progs_t *pr) +bi_atanhf (progs_t *pr, void *data) { double y = P_FLOAT (pr, 0); R_FLOAT (pr) = logf ((1 + y) / (1 - y)) / 2; } static void -bi_floor (progs_t *pr) +bi_floor (progs_t *pr, void *data) { R_DOUBLE (pr) = floor (P_DOUBLE (pr, 0)); } static void -bi_ceil (progs_t *pr) +bi_ceil (progs_t *pr, void *data) { R_DOUBLE (pr) = ceil (P_DOUBLE (pr, 0)); } static void -bi_fabs (progs_t *pr) +bi_fabs (progs_t *pr, void *data) { R_DOUBLE (pr) = fabs (P_DOUBLE (pr, 0)); } static void -bi_sin (progs_t *pr) +bi_sin (progs_t *pr, void *data) { R_DOUBLE (pr) = sin (P_DOUBLE (pr, 0)); } static void -bi_cos (progs_t *pr) +bi_cos (progs_t *pr, void *data) { R_DOUBLE (pr) = cos (P_DOUBLE (pr, 0)); } static void -bi_tan (progs_t *pr) +bi_tan (progs_t *pr, void *data) { R_DOUBLE (pr) = tan (P_DOUBLE (pr, 0)); } static void -bi_asin (progs_t *pr) +bi_asin (progs_t *pr, void *data) { R_DOUBLE (pr) = asin (P_DOUBLE (pr, 0)); } static void -bi_acos (progs_t *pr) +bi_acos (progs_t *pr, void *data) { R_DOUBLE (pr) = acos (P_DOUBLE (pr, 0)); } static void -bi_atan (progs_t *pr) +bi_atan (progs_t *pr, void *data) { R_DOUBLE (pr) = atan (P_DOUBLE (pr, 0)); } static void -bi_atan2 (progs_t *pr) +bi_atan2 (progs_t *pr, void *data) { R_DOUBLE (pr) = atan2 (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1)); } static void -bi_exp (progs_t *pr) +bi_exp (progs_t *pr, void *data) { R_DOUBLE (pr) = exp (P_DOUBLE (pr, 0)); } static void -bi_log (progs_t *pr) +bi_log (progs_t *pr, void *data) { R_DOUBLE (pr) = log (P_DOUBLE (pr, 0)); } static void -bi_log2 (progs_t *pr) +bi_log2 (progs_t *pr, void *data) { R_DOUBLE (pr) = log (P_DOUBLE (pr, 0)) / M_LOG2E; } static void -bi_log10 (progs_t *pr) +bi_log10 (progs_t *pr, void *data) { R_DOUBLE (pr) = log10 (P_DOUBLE (pr, 0)); } static void -bi_pow (progs_t *pr) +bi_pow (progs_t *pr, void *data) { R_DOUBLE (pr) = pow (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1)); } static void -bi_sqrt (progs_t *pr) +bi_sqrt (progs_t *pr, void *data) { R_DOUBLE (pr) = sqrt (P_DOUBLE (pr, 0)); } static void -bi_cbrt (progs_t *pr) +bi_cbrt (progs_t *pr, void *data) { R_DOUBLE (pr) = cbrt (P_DOUBLE (pr, 0)); } static void -bi_hypot (progs_t *pr) +bi_hypot (progs_t *pr, void *data) { R_DOUBLE (pr) = hypot (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1)); } static void -bi_sinh (progs_t *pr) +bi_sinh (progs_t *pr, void *data) { R_DOUBLE (pr) = sinh (P_DOUBLE (pr, 0)); } static void -bi_cosh (progs_t *pr) +bi_cosh (progs_t *pr, void *data) { R_DOUBLE (pr) = cosh (P_DOUBLE (pr, 0)); } static void -bi_tanh (progs_t *pr) +bi_tanh (progs_t *pr, void *data) { R_DOUBLE (pr) = tanh (P_DOUBLE (pr, 0)); } static void -bi_asinh (progs_t *pr) +bi_asinh (progs_t *pr, void *data) { double y = P_DOUBLE (pr, 0); R_DOUBLE (pr) = log (y + sqrt (y * y + 1)); } static void -bi_acosh (progs_t *pr) +bi_acosh (progs_t *pr, void *data) { double y = P_DOUBLE (pr, 0); R_DOUBLE (pr) = log (y + sqrt (y * y - 1)); } static void -bi_atanh (progs_t *pr) +bi_atanh (progs_t *pr, void *data) { double y = P_DOUBLE (pr, 0); R_DOUBLE (pr) = log ((1 + y) / (1 - y)) / 2; diff --git a/libs/ruamoko/rua_mersenne.c b/libs/ruamoko/rua_mersenne.c index c55c495c1..8cb854dc3 100644 --- a/libs/ruamoko/rua_mersenne.c +++ b/libs/ruamoko/rua_mersenne.c @@ -81,19 +81,17 @@ state_index (mtwist_resources_t *res, mtstate_t *state) } static void -bi_mtwist_new (progs_t *pr) +bi_mtwist_new (progs_t *pr, void *_res) { - mtwist_resources_t *res = PR_Resources_Find (pr, "Mersenne Twister"); - + mtwist_resources_t *res = (mtwist_resources_t *) _res; mtstate_t *mt = state_new (res); mtwist_seed (mt, P_INT (pr, 0)); R_INT (pr) = state_index (res, mt); } static mtstate_t * -get_state (progs_t *pr, const char *name, int index) +get_state (progs_t *pr, mtwist_resources_t *res, const char *name, int index) { - mtwist_resources_t *res = PR_Resources_Find (pr, "Mersenne Twister"); mtstate_t *mt = state_get (res, index); if (!mt) @@ -103,45 +101,49 @@ get_state (progs_t *pr, const char *name, int index) } static void -bi_mtwist_delete (progs_t *pr) +bi_mtwist_delete (progs_t *pr, void *_res) { - mtwist_resources_t *res = PR_Resources_Find (pr, "Mersenne Twister"); - mtstate_t *mt = get_state (pr, __FUNCTION__, P_INT (pr, 0)); + mtwist_resources_t *res = _res; + mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0)); state_free (res, mt); } static void -bi_mtwist_seed (progs_t *pr) +bi_mtwist_seed (progs_t *pr, void *_res) { - mtstate_t *mt = get_state (pr, __FUNCTION__, P_INT (pr, 0)); + mtwist_resources_t *res = _res; + mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0)); mtwist_seed (mt, P_INT (pr, 1)); } static void -bi_mtwist_rand (progs_t *pr) +bi_mtwist_rand (progs_t *pr, void *_res) { - mtstate_t *mt = get_state (pr, __FUNCTION__, P_INT (pr, 0)); + mtwist_resources_t *res = _res; + mtstate_t *mt = get_state (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = mtwist_rand (mt); } static void -bi_mtwist_rand_0_1 (progs_t *pr) +bi_mtwist_rand_0_1 (progs_t *pr, void *_res) { - mtstate_t *mt = get_state (pr, __FUNCTION__, P_INT (pr, 0)); + 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); } static void -bi_mtwist_rand_m1_1 (progs_t *pr) +bi_mtwist_rand_m1_1 (progs_t *pr, void *_res) { - mtstate_t *mt = get_state (pr, __FUNCTION__, P_INT (pr, 0)); + 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); } static void -bi_mtwist_clear (progs_t *pr, void *data) +bi_mtwist_clear (progs_t *pr, void *_res) { - mtwist_resources_t *res = (mtwist_resources_t *) data; + mtwist_resources_t *res = (mtwist_resources_t *) _res; state_reset (res); } diff --git a/libs/ruamoko/rua_msgbuf.c b/libs/ruamoko/rua_msgbuf.c index c2420ed99..23959a2cf 100644 --- a/libs/ruamoko/rua_msgbuf.c +++ b/libs/ruamoko/rua_msgbuf.c @@ -111,9 +111,8 @@ alloc_msgbuf (msgbuf_resources_t *res, byte *buf, int size) } static msgbuf_t * -get_msgbuf (progs_t *pr, const char *name, int msgbuf) +get_msgbuf (progs_t *pr, msgbuf_resources_t *res, const char *name, int msgbuf) { - msgbuf_resources_t *res = PR_Resources_Find (pr, "MsgBuf"); msgbuf_t *mb = msgbuf_get (res, msgbuf); if (!mb) @@ -122,7 +121,7 @@ get_msgbuf (progs_t *pr, const char *name, int msgbuf) } static void -bi_MsgBuf_New (progs_t *pr) +bi_MsgBuf_New (progs_t *pr, void *_res) { msgbuf_resources_t *res = PR_Resources_Find (pr, "MsgBuf"); int size = P_INT (pr, 0); @@ -133,17 +132,18 @@ bi_MsgBuf_New (progs_t *pr) } static void -bi_MsgBuf_Delete (progs_t *pr) +bi_MsgBuf_Delete (progs_t *pr, void *_res) { msgbuf_resources_t *res = PR_Resources_Find (pr, "MsgBuf"); - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); msgbuf_free (pr, res, mb); } static void -bi_MsgBuf_FromFile (progs_t *pr) +bi_MsgBuf_FromFile (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); int bytes; @@ -154,179 +154,204 @@ bi_MsgBuf_FromFile (progs_t *pr) } static void -bi_MsgBuf_MaxSize (progs_t *pr) +bi_MsgBuf_MaxSize (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = mb->sizebuf.maxsize; } static void -bi_MsgBuf_CurSize (progs_t *pr) +bi_MsgBuf_CurSize (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = mb->sizebuf.cursize; } static void -bi_MsgBuf_ReadCount (progs_t *pr) +bi_MsgBuf_ReadCount (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = mb->msg.readcount; } static void -bi_MsgBuf_DataPtr (progs_t *pr) +bi_MsgBuf_DataPtr (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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; R_INT (pr) = ptr - (byte *) pr->pr_strings; } static void -bi_MsgBuf_Clear (progs_t *pr) +bi_MsgBuf_Clear (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); SZ_Clear (&mb->sizebuf); } static void -bi_MsgBuf_WriteByte (progs_t *pr) +bi_MsgBuf_WriteByte (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteShort (progs_t *pr) +bi_MsgBuf_WriteShort (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteLong (progs_t *pr) +bi_MsgBuf_WriteLong (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteFloat (progs_t *pr) +bi_MsgBuf_WriteFloat (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteString (progs_t *pr) +bi_MsgBuf_WriteString (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } #if 0 static void -bi_MsgBuf_WriteBytes (progs_t *pr) +bi_MsgBuf_WriteBytes (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } #endif static void -bi_MsgBuf_WriteCoord (progs_t *pr) +bi_MsgBuf_WriteCoord (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteCoordV (progs_t *pr) +bi_MsgBuf_WriteCoordV (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteCoordAngleV (progs_t *pr) +bi_MsgBuf_WriteCoordAngleV (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); MSG_WriteCoordAngleV (&mb->sizebuf, P_VECTOR (pr, 1), P_VECTOR (pr, 2)); } static void -bi_MsgBuf_WriteAngle (progs_t *pr) +bi_MsgBuf_WriteAngle (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteAngleV (progs_t *pr) +bi_MsgBuf_WriteAngleV (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteAngle16 (progs_t *pr) +bi_MsgBuf_WriteAngle16 (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteAngle16V (progs_t *pr) +bi_MsgBuf_WriteAngle16V (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_WriteUTF8 (progs_t *pr) +bi_MsgBuf_WriteUTF8 (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_BeginReading (progs_t *pr) +bi_MsgBuf_BeginReading (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); MSG_BeginReading (&mb->msg); } static void -bi_MsgBuf_ReadByte (progs_t *pr) +bi_MsgBuf_ReadByte (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = MSG_ReadByte (&mb->msg); } static void -bi_MsgBuf_ReadShort (progs_t *pr) +bi_MsgBuf_ReadShort (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = MSG_ReadShort (&mb->msg); } static void -bi_MsgBuf_ReadLong (progs_t *pr) +bi_MsgBuf_ReadLong (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = MSG_ReadLong (&mb->msg); } static void -bi_MsgBuf_ReadFloat (progs_t *pr) +bi_MsgBuf_ReadFloat (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_FLOAT (pr) = MSG_ReadFloat (&mb->msg); } static void -bi_MsgBuf_ReadString (progs_t *pr) +bi_MsgBuf_ReadString (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); const char *str; str = MSG_ReadString (&mb->msg); @@ -334,65 +359,74 @@ bi_MsgBuf_ReadString (progs_t *pr) } #if 0 static void -bi_MsgBuf_ReadBytes (progs_t *pr) +bi_MsgBuf_ReadBytes (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); MSG_ReadBytes (&mb->msg); } #endif static void -bi_MsgBuf_ReadCoord (progs_t *pr) +bi_MsgBuf_ReadCoord (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_FLOAT (pr) = MSG_ReadCoord (&mb->msg); } static void -bi_MsgBuf_ReadCoordV (progs_t *pr) +bi_MsgBuf_ReadCoordV (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); MSG_ReadCoordV (&mb->msg, R_VECTOR (pr)); } static void -bi_MsgBuf_ReadCoordAngleV (progs_t *pr) +bi_MsgBuf_ReadCoordAngleV (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + 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)); } static void -bi_MsgBuf_ReadAngle (progs_t *pr) +bi_MsgBuf_ReadAngle (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_FLOAT (pr) = MSG_ReadAngle (&mb->msg); } static void -bi_MsgBuf_ReadAngleV (progs_t *pr) +bi_MsgBuf_ReadAngleV (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); MSG_ReadAngleV (&mb->msg, R_VECTOR (pr)); } static void -bi_MsgBuf_ReadAngle16 (progs_t *pr) +bi_MsgBuf_ReadAngle16 (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_FLOAT (pr) = MSG_ReadAngle16 (&mb->msg); } static void -bi_MsgBuf_ReadAngle16V (progs_t *pr) +bi_MsgBuf_ReadAngle16V (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); MSG_ReadAngle16V (&mb->msg, R_VECTOR (pr)); } static void -bi_MsgBuf_ReadUTF8 (progs_t *pr) +bi_MsgBuf_ReadUTF8 (progs_t *pr, void *_res) { - msgbuf_t *mb = get_msgbuf (pr, __FUNCTION__, P_INT (pr, 0)); + msgbuf_resources_t *res = _res; + msgbuf_t *mb = get_msgbuf (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = MSG_ReadUTF8 (&mb->msg); } diff --git a/libs/ruamoko/rua_obj.c b/libs/ruamoko/rua_obj.c index 992d659a5..65df011d6 100644 --- a/libs/ruamoko/rua_obj.c +++ b/libs/ruamoko/rua_obj.c @@ -1160,7 +1160,7 @@ obj_init_statics (probj_t *probj) } static void -rua___obj_exec_class (progs_t *pr) +rua___obj_exec_class (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_module_t *module = &P_STRUCT (pr, pr_module_t, 0); @@ -1308,7 +1308,7 @@ rua___obj_exec_class (progs_t *pr) } static void -rua___obj_forward (progs_t *pr) +rua___obj_forward (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *obj = &P_STRUCT (pr, pr_id_t, 0); @@ -1396,7 +1396,7 @@ rua___obj_forward (progs_t *pr) } static void -rua___obj_responds_to (progs_t *pr) +rua___obj_responds_to (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *obj = &P_STRUCT (pr, pr_id_t, 0); @@ -1406,7 +1406,7 @@ rua___obj_responds_to (progs_t *pr) } static void -rua_obj_error (progs_t *pr) +rua_obj_error (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); @@ -1419,7 +1419,7 @@ rua_obj_error (progs_t *pr) } static void -rua_obj_verror (progs_t *pr) +rua_obj_verror (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); @@ -1436,7 +1436,7 @@ rua_obj_verror (progs_t *pr) } static void -rua_obj_set_error_handler (progs_t *pr) +rua_obj_set_error_handler (progs_t *pr, void *data) { //probj_t *probj = pr->pr_objective_resources; //pr_func_t func = P_INT (pr, 0); @@ -1446,7 +1446,7 @@ rua_obj_set_error_handler (progs_t *pr) } static void -rua_obj_msg_lookup (progs_t *pr) +rua_obj_msg_lookup (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *receiver = &P_STRUCT (pr, pr_id_t, 0); @@ -1456,7 +1456,7 @@ rua_obj_msg_lookup (progs_t *pr) } static void -rua_obj_msg_lookup_super (progs_t *pr) +rua_obj_msg_lookup_super (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_super_t *super = &P_STRUCT (pr, pr_super_t, 0); @@ -1466,7 +1466,7 @@ rua_obj_msg_lookup_super (progs_t *pr) } static void -rua_obj_msg_sendv (progs_t *pr) +rua_obj_msg_sendv (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_ptr_t obj = P_POINTER (pr, 0); @@ -1508,28 +1508,28 @@ rua_obj_msg_sendv (progs_t *pr) } static void -rua_obj_increment_retaincount (progs_t *pr) +rua_obj_increment_retaincount (progs_t *pr, void *data) { pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0); R_INT (pr) = ++(*--obj).int_var; } static void -rua_obj_decrement_retaincount (progs_t *pr) +rua_obj_decrement_retaincount (progs_t *pr, void *data) { pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0); R_INT (pr) = --(*--obj).int_var; } static void -rua_obj_get_retaincount (progs_t *pr) +rua_obj_get_retaincount (progs_t *pr, void *data) { pr_type_t *obj = &P_STRUCT (pr, pr_type_t, 0); R_INT (pr) = (*--obj).int_var; } static void -rua_obj_malloc (progs_t *pr) +rua_obj_malloc (progs_t *pr, void *data) { int size = P_INT (pr, 0) * sizeof (pr_type_t); void *mem = PR_Zone_Malloc (pr, size); @@ -1538,7 +1538,7 @@ rua_obj_malloc (progs_t *pr) } static void -rua_obj_atomic_malloc (progs_t *pr) +rua_obj_atomic_malloc (progs_t *pr, void *data) { int size = P_INT (pr, 0) * sizeof (pr_type_t); void *mem = PR_Zone_Malloc (pr, size); @@ -1547,7 +1547,7 @@ rua_obj_atomic_malloc (progs_t *pr) } static void -rua_obj_valloc (progs_t *pr) +rua_obj_valloc (progs_t *pr, void *data) { int size = P_INT (pr, 0) * sizeof (pr_type_t); void *mem = PR_Zone_Malloc (pr, size); @@ -1556,7 +1556,7 @@ rua_obj_valloc (progs_t *pr) } static void -rua_obj_realloc (progs_t *pr) +rua_obj_realloc (progs_t *pr, void *data) { void *mem = (void*)P_GPOINTER (pr, 0); int size = P_INT (pr, 1) * sizeof (pr_type_t); @@ -1566,7 +1566,7 @@ rua_obj_realloc (progs_t *pr) } static void -rua_obj_calloc (progs_t *pr) +rua_obj_calloc (progs_t *pr, void *data) { int size = P_INT (pr, 0) * P_INT (pr, 1) * sizeof (pr_type_t); void *mem = PR_Zone_Malloc (pr, size); @@ -1576,7 +1576,7 @@ rua_obj_calloc (progs_t *pr) } static void -rua_obj_free (progs_t *pr) +rua_obj_free (progs_t *pr, void *data) { void *mem = (void*)P_GPOINTER (pr, 0); @@ -1584,7 +1584,7 @@ rua_obj_free (progs_t *pr) } static void -rua_obj_get_uninstalled_dtable (progs_t *pr) +rua_obj_get_uninstalled_dtable (progs_t *pr, void *data) { //probj_t *probj = pr->pr_objective_resources; //XXX @@ -1592,7 +1592,7 @@ rua_obj_get_uninstalled_dtable (progs_t *pr) } static void -rua_obj_msgSend (progs_t *pr) +rua_obj_msgSend (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *self = &P_STRUCT (pr, pr_id_t, 0); @@ -1618,7 +1618,7 @@ rua_obj_msgSend (progs_t *pr) } static void -rua_obj_msgSend_super (progs_t *pr) +rua_obj_msgSend_super (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_super_t *super = &P_STRUCT (pr, pr_super_t, 0); @@ -1640,7 +1640,7 @@ rua_obj_msgSend_super (progs_t *pr) } static void -rua_obj_get_class (progs_t *pr) +rua_obj_get_class (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; const char *name = P_GSTRING (pr, 0); @@ -1653,7 +1653,7 @@ rua_obj_get_class (progs_t *pr) } static void -rua_obj_lookup_class (progs_t *pr) +rua_obj_lookup_class (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; const char *name = P_GSTRING (pr, 0); @@ -1664,7 +1664,7 @@ rua_obj_lookup_class (progs_t *pr) } static void -rua_obj_next_class (progs_t *pr) +rua_obj_next_class (progs_t *pr, void *data) { //probj_t *probj = pr->pr_objective_resources; //XXX @@ -1674,7 +1674,7 @@ rua_obj_next_class (progs_t *pr) //==================================================================== static void -rua_sel_get_name (progs_t *pr) +rua_sel_get_name (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 0); @@ -1686,7 +1686,7 @@ rua_sel_get_name (progs_t *pr) } static void -rua_sel_get_type (progs_t *pr) +rua_sel_get_type (progs_t *pr, void *data) { pr_sel_t *sel = &P_STRUCT (pr, pr_sel_t, 0); @@ -1694,7 +1694,7 @@ rua_sel_get_type (progs_t *pr) } static void -rua_sel_get_uid (progs_t *pr) +rua_sel_get_uid (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; const char *name = P_GSTRING (pr, 0); @@ -1703,7 +1703,7 @@ rua_sel_get_uid (progs_t *pr) } static void -rua_sel_register_name (progs_t *pr) +rua_sel_register_name (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; const char *name = P_GSTRING (pr, 0); @@ -1712,7 +1712,7 @@ rua_sel_register_name (progs_t *pr) } static void -rua_sel_is_mapped (progs_t *pr) +rua_sel_is_mapped (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; // FIXME might correspond to a string @@ -1723,7 +1723,7 @@ rua_sel_is_mapped (progs_t *pr) //==================================================================== static void -rua_class_get_class_method (progs_t *pr) +rua_class_get_class_method (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); @@ -1735,7 +1735,7 @@ rua_class_get_class_method (progs_t *pr) } static void -rua_class_get_instance_method (progs_t *pr) +rua_class_get_instance_method (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); @@ -1747,7 +1747,7 @@ rua_class_get_instance_method (progs_t *pr) #define CLASSOF(x) (&G_STRUCT (pr, pr_class_t, (x)->class_pointer)) static void -rua_class_pose_as (progs_t *pr) +rua_class_pose_as (progs_t *pr, void *data) { pr_class_t *impostor = &P_STRUCT (pr, pr_class_t, 0); pr_class_t *superclass = &P_STRUCT (pr, pr_class_t, 1); @@ -1796,7 +1796,7 @@ class_create_instance (progs_t *pr, pr_class_t *class) } static void -rua_class_create_instance (progs_t *pr) +rua_class_create_instance (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); pr_id_t *id = class_create_instance (pr, class); @@ -1805,7 +1805,7 @@ rua_class_create_instance (progs_t *pr) } static void -rua_class_get_class_name (progs_t *pr) +rua_class_get_class_name (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class) ? class->name @@ -1813,49 +1813,49 @@ rua_class_get_class_name (progs_t *pr) } static void -rua_class_get_instance_size (progs_t *pr) +rua_class_get_instance_size (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class) ? class->instance_size : 0; } static void -rua_class_get_meta_class (progs_t *pr) +rua_class_get_meta_class (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class) ? class->class_pointer : 0; } static void -rua_class_get_super_class (progs_t *pr) +rua_class_get_super_class (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class) ? class->super_class : 0; } static void -rua_class_get_version (progs_t *pr) +rua_class_get_version (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class) ? class->version : -1; } static void -rua_class_is_class (progs_t *pr) +rua_class_is_class (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class); } static void -rua_class_is_meta_class (progs_t *pr) +rua_class_is_meta_class (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISMETA (class); } static void -rua_class_set_version (progs_t *pr) +rua_class_set_version (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); if (PR_CLS_ISCLASS (class)) @@ -1863,14 +1863,14 @@ rua_class_set_version (progs_t *pr) } static void -rua_class_get_gc_object_type (progs_t *pr) +rua_class_get_gc_object_type (progs_t *pr, void *data) { pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); R_INT (pr) = PR_CLS_ISCLASS (class) ? class->gc_object_type : 0; } static void -rua_class_ivar_set_gcinvisible (progs_t *pr) +rua_class_ivar_set_gcinvisible (progs_t *pr, void *data) { //probj_t *probj = pr->pr_objective_resources; //pr_class_t *impostor = &P_STRUCT (pr, pr_class_t, 0); @@ -1883,7 +1883,7 @@ rua_class_ivar_set_gcinvisible (progs_t *pr) //==================================================================== static void -rua_method_get_imp (progs_t *pr) +rua_method_get_imp (progs_t *pr, void *data) { pr_method_t *method = &P_STRUCT (pr, pr_method_t, 0); @@ -1891,7 +1891,7 @@ rua_method_get_imp (progs_t *pr) } static void -rua_get_imp (progs_t *pr) +rua_get_imp (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_class_t *class = &P_STRUCT (pr, pr_class_t, 0); @@ -1903,7 +1903,7 @@ rua_get_imp (progs_t *pr) //==================================================================== static void -rua_object_dispose (progs_t *pr) +rua_object_dispose (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); pr_type_t *mem = (pr_type_t *) object; @@ -1911,7 +1911,7 @@ rua_object_dispose (progs_t *pr) } static void -rua_object_copy (progs_t *pr) +rua_object_copy (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); pr_class_t *class = &G_STRUCT (pr, pr_class_t, object->class_pointer); @@ -1927,7 +1927,7 @@ rua_object_copy (progs_t *pr) } static void -rua_object_get_class (progs_t *pr) +rua_object_get_class (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); pr_class_t *class; @@ -1947,7 +1947,7 @@ rua_object_get_class (progs_t *pr) } static void -rua_object_get_super_class (progs_t *pr) +rua_object_get_super_class (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); pr_class_t *class; @@ -1967,7 +1967,7 @@ rua_object_get_super_class (progs_t *pr) } static void -rua_object_get_meta_class (progs_t *pr) +rua_object_get_meta_class (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); pr_class_t *class; @@ -1987,7 +1987,7 @@ rua_object_get_meta_class (progs_t *pr) } static void -rua_object_get_class_name (progs_t *pr) +rua_object_get_class_name (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); @@ -1996,7 +1996,7 @@ rua_object_get_class_name (progs_t *pr) } static void -rua_object_is_class (progs_t *pr) +rua_object_is_class (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); @@ -2008,7 +2008,7 @@ rua_object_is_class (progs_t *pr) } static void -rua_object_is_instance (progs_t *pr) +rua_object_is_instance (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); @@ -2017,7 +2017,7 @@ rua_object_is_instance (progs_t *pr) } static void -rua_object_is_meta_class (progs_t *pr) +rua_object_is_meta_class (progs_t *pr, void *data) { pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0); @@ -2031,13 +2031,13 @@ rua_object_is_meta_class (progs_t *pr) //==================================================================== static void -rua__i_Object__hash (progs_t *pr) +rua__i_Object__hash (progs_t *pr, void *data) { R_INT (pr) = P_INT (pr, 0); } static void -rua__i_Object_error_error_ (progs_t *pr) +rua__i_Object_error_error_ (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; pr_id_t *self = &P_STRUCT (pr, pr_id_t, 0); @@ -2090,7 +2090,7 @@ obj_protocol_conformsToProtocol (probj_t *probj, pr_protocol_t *proto, } static void -rua__c_Object__conformsToProtocol_ (progs_t *pr) +rua__c_Object__conformsToProtocol_ (progs_t *pr, void *data) { probj_t *probj = pr->pr_objective_resources; // class points to _OBJ_CLASS_foo, and class->class_pointer points to @@ -2137,7 +2137,7 @@ conforms: } static void -rua_PR_FindGlobal (progs_t *pr) +rua_PR_FindGlobal (progs_t *pr, void *data) { const char *name = P_GSTRING (pr, 0); pr_def_t *def; @@ -2346,15 +2346,15 @@ RUA_Obj_msg_lookup (progs_t *pr, pr_ptr_t _self, pr_ptr_t __cmd) } int -RUA_obj_increment_retaincount (progs_t *pr) +RUA_obj_increment_retaincount (progs_t *pr, void *data) { - rua_obj_increment_retaincount (pr); + rua_obj_increment_retaincount (pr, data); return R_INT (pr); } int -RUA_obj_decrement_retaincount (progs_t *pr) +RUA_obj_decrement_retaincount (progs_t *pr, void *data) { - rua_obj_decrement_retaincount (pr); + rua_obj_decrement_retaincount (pr, data); return R_INT (pr); } diff --git a/libs/ruamoko/rua_plist.c b/libs/ruamoko/rua_plist.c index 4aae2db06..b07e365a6 100644 --- a/libs/ruamoko/rua_plist.c +++ b/libs/ruamoko/rua_plist.c @@ -91,9 +91,9 @@ plist_index (plist_resources_t *res, bi_plist_t *plist) } static void -bi_plist_clear (progs_t *pr, void *data) +bi_plist_clear (progs_t *pr, void *_res) { - plist_resources_t *res = (plist_resources_t *) data; + plist_resources_t *res = (plist_resources_t *) _res; bi_plist_t *plist; for (plist = res->plists; plist; plist = plist->next) { @@ -143,9 +143,8 @@ plist_free_handle (plist_resources_t *res, bi_plist_t *plist) } static always_inline bi_plist_t * -get_plist (progs_t *pr, const char *name, int handle) +get_plist (progs_t *pr, plist_resources_t *res, const char *name, int handle) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); bi_plist_t *plist = plist_get (res, handle); // plist->prev will be null if the handle is unallocated @@ -178,9 +177,9 @@ plist_retain (plist_resources_t *res, plitem_t *plitem) } static void -bi_PL_GetFromFile (progs_t *pr) +bi_PL_GetFromFile (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; QFile *file = QFile_GetFile (pr, P_INT (pr, 0)); plitem_t *plitem; long offset; @@ -201,9 +200,9 @@ bi_PL_GetFromFile (progs_t *pr) } static void -bi_PL_GetPropertyList (progs_t *pr) +bi_PL_GetPropertyList (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; plitem_t *plitem = PL_GetPropertyList (P_GSTRING (pr, 0), pr->hashlink_freelist); @@ -211,10 +210,11 @@ bi_PL_GetPropertyList (progs_t *pr) } static void -bi_PL_WritePropertyList (progs_t *pr) +bi_PL_WritePropertyList (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); char *pl = PL_WritePropertyList (plist->plitem); R_STRING (pr) = PR_SetDynamicString (pr, pl); @@ -222,39 +222,42 @@ bi_PL_WritePropertyList (progs_t *pr) } static void -bi_PL_Type (progs_t *pr) +bi_PL_Type (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); R_INT (pr) = PL_Type (plist->plitem); } static void -bi_PL_Line (progs_t *pr) +bi_PL_Line (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); R_INT (pr) = PL_Line (plist->plitem); } static void -bi_PL_String (progs_t *pr) +bi_PL_String (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); const char *str = PL_String (plist->plitem); RETURN_STRING (pr, str); } static void -bi_PL_ObjectForKey (progs_t *pr) +bi_PL_ObjectForKey (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); const char *key = P_GSTRING (pr, 1); plitem_t *plitem = PL_ObjectForKey (plist->plitem, key); @@ -265,11 +268,11 @@ bi_PL_ObjectForKey (progs_t *pr) } static void -bi_PL_RemoveObjectForKey (progs_t *pr) +bi_PL_RemoveObjectForKey (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); const char *key = P_GSTRING (pr, 1); plitem_t *plitem = PL_RemoveObjectForKey (plist->plitem, key); @@ -277,11 +280,11 @@ bi_PL_RemoveObjectForKey (progs_t *pr) } static void -bi_PL_ObjectAtIndex (progs_t *pr) +bi_PL_ObjectAtIndex (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); int ind = P_INT (pr, 1); plitem_t *plitem = PL_ObjectAtIndex (plist->plitem, ind); @@ -292,66 +295,71 @@ bi_PL_ObjectAtIndex (progs_t *pr) } static void -bi_PL_D_AllKeys (progs_t *pr) +bi_PL_D_AllKeys (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); plitem_t *plitem = PL_D_AllKeys (plist->plitem); R_INT (pr) = plist_retain (res, plitem); } static void -bi_PL_D_NumKeys (progs_t *pr) +bi_PL_D_NumKeys (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); R_INT (pr) = PL_D_NumKeys (plist->plitem); } static void -bi_PL_D_AddObject (progs_t *pr) +bi_PL_D_AddObject (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int dict_handle = P_INT (pr, 0); int obj_handle = P_INT (pr, 2); - bi_plist_t *dict = get_plist (pr, __FUNCTION__, dict_handle); + bi_plist_t *dict = get_plist (pr, res, __FUNCTION__, dict_handle); const char *key = P_GSTRING (pr, 1); - bi_plist_t *obj = get_plist (pr, __FUNCTION__, obj_handle); + bi_plist_t *obj = get_plist (pr, res, __FUNCTION__, obj_handle); obj->own = 0; R_INT (pr) = PL_D_AddObject (dict->plitem, key, obj->plitem); } static void -bi_PL_A_AddObject (progs_t *pr) +bi_PL_A_AddObject (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int arr_handle = P_INT (pr, 0); int obj_handle = P_INT (pr, 1); - bi_plist_t *arr = get_plist (pr, __FUNCTION__, arr_handle); - bi_plist_t *obj = get_plist (pr, __FUNCTION__, obj_handle); + bi_plist_t *arr = get_plist (pr, res, __FUNCTION__, arr_handle); + bi_plist_t *obj = get_plist (pr, res, __FUNCTION__, obj_handle); obj->own = 0; R_INT (pr) = PL_A_AddObject (arr->plitem, obj->plitem); } static void -bi_PL_A_NumObjects (progs_t *pr) +bi_PL_A_NumObjects (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); R_INT (pr) = PL_A_NumObjects (plist->plitem); } static void -bi_PL_A_InsertObjectAtIndex (progs_t *pr) +bi_PL_A_InsertObjectAtIndex (progs_t *pr, void *_res) { + plist_resources_t *res = _res; int dict_handle = P_INT (pr, 0); int obj_handle = P_INT (pr, 1); - bi_plist_t *arr = get_plist (pr, __FUNCTION__, dict_handle); - bi_plist_t *obj = get_plist (pr, __FUNCTION__, obj_handle); + bi_plist_t *arr = get_plist (pr, res, __FUNCTION__, dict_handle); + bi_plist_t *obj = get_plist (pr, res, __FUNCTION__, obj_handle); int ind = P_INT (pr, 2); obj->own = 0; @@ -359,11 +367,11 @@ bi_PL_A_InsertObjectAtIndex (progs_t *pr) } static void -bi_PL_RemoveObjectAtIndex (progs_t *pr) +bi_PL_RemoveObjectAtIndex (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); int ind = P_INT (pr, 1); plitem_t *plitem = PL_RemoveObjectAtIndex (plist->plitem, ind); @@ -371,48 +379,48 @@ bi_PL_RemoveObjectAtIndex (progs_t *pr) } static void -bi_PL_NewDictionary (progs_t *pr) +bi_PL_NewDictionary (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; plitem_t *plitem = PL_NewDictionary (pr->hashlink_freelist); R_INT (pr) = plist_retain (res, plitem); } static void -bi_PL_NewArray (progs_t *pr) +bi_PL_NewArray (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; plitem_t *plitem = PL_NewArray (); R_INT (pr) = plist_retain (res, plitem); } static void -bi_PL_NewData (progs_t *pr) +bi_PL_NewData (progs_t *pr, void *_res) { //FIXME not safe - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; plitem_t *plitem = PL_NewData (P_GPOINTER (pr, 0), P_INT (pr, 1)); R_INT (pr) = plist_retain (res, plitem); } static void -bi_PL_NewString (progs_t *pr) +bi_PL_NewString (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; plitem_t *plitem = PL_NewString (P_GSTRING (pr, 0)); R_INT (pr) = plist_retain (res, plitem); } static void -bi_PL_Free (progs_t *pr) +bi_PL_Free (progs_t *pr, void *_res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plist_resources_t *res = _res; int handle = P_INT (pr, 0); - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); if (!plist->own) PR_RunError (pr, "attempt to free unowned plist"); @@ -425,7 +433,8 @@ bi_PL_Free (progs_t *pr) plitem_t * Plist_GetItem (progs_t *pr, int handle) { - bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + bi_plist_t *plist = get_plist (pr, res, __FUNCTION__, handle); return plist->plitem; } diff --git a/libs/ruamoko/rua_qfile.c b/libs/ruamoko/rua_qfile.c index 1fee454dc..89df29a33 100644 --- a/libs/ruamoko/rua_qfile.c +++ b/libs/ruamoko/rua_qfile.c @@ -84,9 +84,9 @@ handle_index (qfile_resources_t *res, qfile_t *handle) } static void -bi_qfile_clear (progs_t *pr, void *data) +bi_qfile_clear (progs_t *pr, void *_res) { - qfile_resources_t *res = (qfile_resources_t *) data; + qfile_resources_t *res = (qfile_resources_t *) _res; qfile_t *handle; for (handle = res->handles; handle; handle = handle->next) @@ -121,13 +121,13 @@ QFile_AllocHandle (progs_t *pr, QFile *file) } static void -secured (progs_t *pr) +secured (progs_t *pr, void *_res) { PR_RunError (pr, "Secured function called"); } static void -bi_Qrename (progs_t *pr) +bi_Qrename (progs_t *pr, void *_res) { const char *old = P_GSTRING (pr, 0); const char *new = P_GSTRING (pr, 1); @@ -136,7 +136,7 @@ bi_Qrename (progs_t *pr) } static void -bi_Qremove (progs_t *pr) +bi_Qremove (progs_t *pr, void *_res) { const char *path = P_GSTRING (pr, 0); @@ -144,9 +144,9 @@ bi_Qremove (progs_t *pr) } static void -bi_Qopen (progs_t *pr) +bi_Qopen (progs_t *pr, void *_res) { - qfile_resources_t *res = PR_Resources_Find (pr, "QFile"); + __auto_type res = (qfile_resources_t *) _res; const char *path = P_GSTRING (pr, 0); const char *mode = P_GSTRING (pr, 1); QFile *file; @@ -159,9 +159,8 @@ bi_Qopen (progs_t *pr) } static qfile_t * -get_handle (progs_t *pr, const char *name, int handle) +get_handle (progs_t *pr, qfile_resources_t *res, const char *name, int handle) { - qfile_resources_t *res = PR_Resources_Find (pr, "QFile"); qfile_t *h = handle_get (res, handle); if (!h) @@ -172,15 +171,16 @@ get_handle (progs_t *pr, const char *name, int handle) QFile * QFile_GetFile (progs_t *pr, int handle) { - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_resources_t *res = PR_Resources_Find (pr, "QFile"); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); return h->file; } static void -bi_Qclose (progs_t *pr) +bi_Qclose (progs_t *pr, void *_res) { - qfile_resources_t *res = PR_Resources_Find (pr, "QFile"); + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); qfile_t *h = handle_get (res, handle); @@ -194,10 +194,11 @@ bi_Qclose (progs_t *pr) } static void -bi_Qgetline (progs_t *pr) +bi_Qgetline (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); const char *s; s = Qgetline (h->file); @@ -208,11 +209,12 @@ bi_Qgetline (progs_t *pr) } static void -bi_Qreadstring (progs_t *pr) +bi_Qreadstring (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); int len = P_INT (pr, 1); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); pr_string_t str = PR_NewMutableString (pr); dstring_t *dstr = PR_GetMutableString (pr, str); @@ -235,10 +237,11 @@ check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name) } static void -bi_Qread (progs_t *pr) +bi_Qread (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); pr_type_t *buf = P_GPOINTER (pr, 1); int count = P_INT (pr, 2); @@ -247,10 +250,11 @@ bi_Qread (progs_t *pr) } static void -bi_Qwrite (progs_t *pr) +bi_Qwrite (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); pr_type_t *buf = P_GPOINTER (pr, 1); int count = P_INT (pr, 2); @@ -259,20 +263,22 @@ bi_Qwrite (progs_t *pr) } static void -bi_Qputs (progs_t *pr) +bi_Qputs (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); const char *str = P_GSTRING (pr, 1); R_INT (pr) = Qputs (h->file, str); } #if 0 static void -bi_Qgets (progs_t *pr) +bi_Qgets (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); pr_type_t *buf = P_GPOINTER (pr, 1); int count = P_INT (pr, 2); @@ -281,29 +287,32 @@ bi_Qgets (progs_t *pr) } #endif static void -bi_Qgetc (progs_t *pr) +bi_Qgetc (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); R_INT (pr) = Qgetc (h->file); } static void -bi_Qputc (progs_t *pr) +bi_Qputc (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); int c = P_INT (pr, 1); R_INT (pr) = Qputc (h->file, c); } static void -bi_Qseek (progs_t *pr) +bi_Qseek (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); int offset = P_INT (pr, 1); int whence = P_INT (pr, 2); @@ -311,37 +320,41 @@ bi_Qseek (progs_t *pr) } static void -bi_Qtell (progs_t *pr) +bi_Qtell (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); R_INT (pr) = Qtell (h->file); } static void -bi_Qflush (progs_t *pr) +bi_Qflush (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); R_INT (pr) = Qflush (h->file); } static void -bi_Qeof (progs_t *pr) +bi_Qeof (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); R_INT (pr) = Qeof (h->file); } static void -bi_Qfilesize (progs_t *pr) +bi_Qfilesize (progs_t *pr, void *_res) { + __auto_type res = (qfile_resources_t *) _res; int handle = P_INT (pr, 0); - qfile_t *h = get_handle (pr, __FUNCTION__, handle); + qfile_t *h = get_handle (pr, res, __FUNCTION__, handle); R_INT (pr) = Qfilesize (h->file); } diff --git a/libs/ruamoko/rua_qfs.c b/libs/ruamoko/rua_qfs.c index 8f36c4528..f920678ca 100644 --- a/libs/ruamoko/rua_qfs.c +++ b/libs/ruamoko/rua_qfs.c @@ -60,7 +60,7 @@ check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name) static void -bi_QFS_Open (progs_t *pr) +bi_QFS_Open (progs_t *pr, void *data) { QFile *file; const char *path = P_GSTRING (pr, 0); @@ -75,7 +75,7 @@ bi_QFS_Open (progs_t *pr) } static void -bi_QFS_WOpen (progs_t *pr) +bi_QFS_WOpen (progs_t *pr, void *data) { QFile *file; const char *path = P_GSTRING (pr, 0); @@ -90,7 +90,7 @@ bi_QFS_WOpen (progs_t *pr) } static void -bi_QFS_Rename (progs_t *pr) +bi_QFS_Rename (progs_t *pr, void *data) { const char *old = P_GSTRING (pr, 0); const char *new = P_GSTRING (pr, 1); @@ -99,7 +99,7 @@ bi_QFS_Rename (progs_t *pr) } static void -bi_QFS_LoadFile (progs_t *pr) +bi_QFS_LoadFile (progs_t *pr, void *data) { const char *filename = P_GSTRING (pr, 0); QFile *file; @@ -124,7 +124,7 @@ bi_QFS_LoadFile (progs_t *pr) } static void -bi_QFS_OpenFile (progs_t *pr) +bi_QFS_OpenFile (progs_t *pr, void *data) { QFile *file; const char *filename = P_GSTRING (pr, 0); @@ -139,7 +139,7 @@ bi_QFS_OpenFile (progs_t *pr) } static void -bi_QFS_WriteFile (progs_t *pr) +bi_QFS_WriteFile (progs_t *pr, void *data) { const char *filename = P_GSTRING (pr, 0); pr_type_t *buf = P_GPOINTER (pr, 1); @@ -151,7 +151,7 @@ bi_QFS_WriteFile (progs_t *pr) } static void -bi_QFS_Filelist (progs_t *pr) +bi_QFS_Filelist (progs_t *pr, void *data) { filelist_t *filelist = QFS_FilelistNew (); qfslist_t *list; @@ -171,7 +171,7 @@ bi_QFS_Filelist (progs_t *pr) } static void -bi_QFS_FilelistFree (progs_t *pr) +bi_QFS_FilelistFree (progs_t *pr, void *data) { qfslist_t *list = &P_STRUCT (pr, qfslist_t, 0); pr_string_t *strings = &G_STRUCT (pr, pr_string_t, list->list); @@ -183,7 +183,7 @@ bi_QFS_FilelistFree (progs_t *pr) } static void -bi_QFS_GetDirectory (progs_t *pr) +bi_QFS_GetDirectory (progs_t *pr, void *data) { RETURN_STRING (pr, qfs_gamedir->dir.def); } diff --git a/libs/ruamoko/rua_runtime.c b/libs/ruamoko/rua_runtime.c index 5a1c906ad..7ea55a68b 100644 --- a/libs/ruamoko/rua_runtime.c +++ b/libs/ruamoko/rua_runtime.c @@ -50,7 +50,7 @@ #include "rua_internal.h" static void -bi_va_copy (progs_t *pr) +bi_va_copy (progs_t *pr, void *data) { __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); diff --git a/libs/ruamoko/rua_script.c b/libs/ruamoko/rua_script.c index 8cafdb387..592b412d4 100644 --- a/libs/ruamoko/rua_script.c +++ b/libs/ruamoko/rua_script.c @@ -85,16 +85,16 @@ script_index (script_resources_t *res, rua_script_t *script) } static void -bi_script_clear (progs_t *pr, void *data) +bi_script_clear (progs_t *pr, void *_res) { - script_resources_t *res = (script_resources_t *) data; + script_resources_t *res = (script_resources_t *) _res; script_reset (res); } static void -bi_Script_New (progs_t *pr) +bi_Script_New (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_new (res); if (!script) @@ -107,9 +107,9 @@ bi_Script_New (progs_t *pr) } static void -bi_Script_Delete (progs_t *pr) +bi_Script_Delete (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) @@ -119,9 +119,9 @@ bi_Script_Delete (progs_t *pr) } static void -bi_Script_Start (progs_t *pr) +bi_Script_Start (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) @@ -131,9 +131,9 @@ bi_Script_Start (progs_t *pr) } static void -bi_Script_TokenAvailable (progs_t *pr) +bi_Script_TokenAvailable (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) @@ -142,9 +142,9 @@ bi_Script_TokenAvailable (progs_t *pr) } static void -bi_Script_GetToken (progs_t *pr) +bi_Script_GetToken (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) @@ -153,9 +153,9 @@ bi_Script_GetToken (progs_t *pr) } static void -bi_Script_UngetToken (progs_t *pr) +bi_Script_UngetToken (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) @@ -164,9 +164,9 @@ bi_Script_UngetToken (progs_t *pr) } static void -bi_Script_Error (progs_t *pr) +bi_Script_Error (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) @@ -176,9 +176,9 @@ bi_Script_Error (progs_t *pr) } static void -bi_Script_NoQuoteLines (progs_t *pr) +bi_Script_NoQuoteLines (progs_t *pr, void *_res) { - script_resources_t *res = PR_Resources_Find (pr, "Script"); + script_resources_t *res = _res; rua_script_t *script = script_get (res, P_INT (pr, 0)); if (!script) diff --git a/libs/ruamoko/rua_set.c b/libs/ruamoko/rua_set.c index c8a0f2672..b6ee26f4d 100644 --- a/libs/ruamoko/rua_set.c +++ b/libs/ruamoko/rua_set.c @@ -137,9 +137,8 @@ res_set_iter_index (set_resources_t *res, bi_set_iter_t *set_iter) } static bi_set_t * -get_set (progs_t *pr, const char *name, int index) +get_set (progs_t *pr, set_resources_t *res, const char *name, int index) { - set_resources_t *res = PR_Resources_Find (pr, "Set"); bi_set_t *set = res_set_get (res, index); if (!set) @@ -148,9 +147,8 @@ get_set (progs_t *pr, const char *name, int index) } static bi_set_iter_t * -get_set_iter (progs_t *pr, const char *name, int index) +get_set_iter (progs_t *pr, set_resources_t *res, const char *name, int index) { - set_resources_t *res = PR_Resources_Find (pr, "Set"); bi_set_iter_t *set = res_set_iter_get (res, index); if (!set) @@ -159,10 +157,8 @@ get_set_iter (progs_t *pr, const char *name, int index) } static void -del_set_iter (progs_t *pr, bi_set_iter_t *set_iter) +del_set_iter (progs_t *pr, set_resources_t *res, bi_set_iter_t *set_iter) { - set_resources_t *res = PR_Resources_Find (pr, "Set"); - *set_iter->prev = set_iter->next; if (set_iter->next) set_iter->next->prev = set_iter->prev; @@ -170,27 +166,31 @@ del_set_iter (progs_t *pr, bi_set_iter_t *set_iter) } static void -bi_set_del_iter (progs_t *pr) +bi_set_del_iter (progs_t *pr, void *_res) { - bi_set_iter_t *set_iter = get_set_iter (pr, __FUNCTION__, P_INT (pr, 0)); + set_resources_t *res = _res; + bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__, + P_INT (pr, 0)); set_del_iter (set_iter->iter); - del_set_iter (pr, set_iter); + del_set_iter (pr, res, set_iter); } static void -bi_set_iter_element (progs_t *pr) +bi_set_iter_element (progs_t *pr, void *_res) { - bi_set_iter_t *set_iter = get_set_iter (pr, __FUNCTION__, P_INT (pr, 0)); + set_resources_t *res = _res; + bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__, + P_INT (pr, 0)); R_INT (pr) = set_iter->iter->element; } static void -bi_set_new (progs_t *pr) +bi_set_new (progs_t *pr, void *_res) { - set_resources_t *res = PR_Resources_Find (pr, "Set"); + set_resources_t *res = _res; bi_set_t *set; set = res_set_new (res); @@ -207,10 +207,10 @@ bi_set_new (progs_t *pr) } static void -bi_set_delete (progs_t *pr) +bi_set_delete (progs_t *pr, void *_res) { - set_resources_t *res = PR_Resources_Find (pr, "Set"); - bi_set_t *set = get_set (pr, __FUNCTION__, P_INT (pr, 0)); + set_resources_t *res = _res; + bi_set_t *set = get_set (pr, res, __FUNCTION__, P_INT (pr, 0)); set_delete (set->set); *set->prev = set->next; @@ -220,281 +220,311 @@ bi_set_delete (progs_t *pr) } static void -rua_set_add (progs_t *pr, pr_int_t setid, pr_uint_t element) +rua_set_add (progs_t *pr, set_resources_t *res, + pr_int_t setid, pr_uint_t element) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); set_add (set->set, element); } static void -bi_set_add (progs_t *pr) +bi_set_add (progs_t *pr, void *_res) { - rua_set_add (pr, P_INT (pr, 0), P_UINT (pr, 1)); + 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); } static void -rua_set_remove (progs_t *pr, pr_int_t setid, pr_uint_t element) +rua_set_remove (progs_t *pr, set_resources_t *res, + pr_int_t setid, pr_uint_t element) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); set_remove (set->set, element); } static void -bi_set_remove (progs_t *pr) +bi_set_remove (progs_t *pr, void *_res) { - rua_set_remove (pr, P_INT (pr, 0), P_UINT (pr, 1)); + 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); } static void -rua_set_invert (progs_t *pr, pr_int_t setid) +rua_set_invert (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); set_invert (set->set); } static void -bi_set_invert (progs_t *pr) +bi_set_invert (progs_t *pr, void *_res) { - rua_set_invert (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_invert (pr, res, P_INT (pr, 0)); R_INT (pr) = P_INT (pr, 0); } static void -rua_set_union (progs_t *pr, pr_int_t dstid, pr_int_t srcid) +rua_set_union (progs_t *pr, set_resources_t *res, + pr_int_t dstid, pr_int_t srcid) { - bi_set_t *dst = get_set (pr, __FUNCTION__, dstid); - bi_set_t *src = get_set (pr, __FUNCTION__, srcid); + bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid); + bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid); set_union (dst->set, src->set); } static void -bi_set_union (progs_t *pr) +bi_set_union (progs_t *pr, void *_res) { - rua_set_union (pr, P_INT (pr, 0), P_INT (pr, 1)); + 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); } static void -rua_set_intersection (progs_t *pr, pr_int_t dstid, pr_int_t srcid) +rua_set_intersection (progs_t *pr, set_resources_t *res, + pr_int_t dstid, pr_int_t srcid) { - bi_set_t *dst = get_set (pr, __FUNCTION__, dstid); - bi_set_t *src = get_set (pr, __FUNCTION__, srcid); + bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid); + bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid); set_intersection (dst->set, src->set); } static void -bi_set_intersection (progs_t *pr) +bi_set_intersection (progs_t *pr, void *_res) { - rua_set_intersection (pr, P_INT (pr, 0), P_INT (pr, 1)); + 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); } static void -rua_set_difference (progs_t *pr, pr_int_t dstid, pr_int_t srcid) +rua_set_difference (progs_t *pr, set_resources_t *res, + pr_int_t dstid, pr_int_t srcid) { - bi_set_t *dst = get_set (pr, __FUNCTION__, dstid); - bi_set_t *src = get_set (pr, __FUNCTION__, srcid); + bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid); + bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid); set_difference (dst->set, src->set); } static void -bi_set_difference (progs_t *pr) +bi_set_difference (progs_t *pr, void *_res) { - rua_set_difference (pr, P_INT (pr, 0), P_INT (pr, 1)); + 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); } static void -rua_set_reverse_difference (progs_t *pr, pr_int_t dstid, pr_int_t srcid) +rua_set_reverse_difference (progs_t *pr, set_resources_t *res, + pr_int_t dstid, pr_int_t srcid) { - bi_set_t *dst = get_set (pr, __FUNCTION__, dstid); - bi_set_t *src = get_set (pr, __FUNCTION__, srcid); + bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid); + bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid); set_reverse_difference (dst->set, src->set); } static void -bi_set_reverse_difference (progs_t *pr) +bi_set_reverse_difference (progs_t *pr, void *_res) { - rua_set_reverse_difference (pr, P_INT (pr, 0), P_INT (pr, 1)); + 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); } static void -rua_set_assign (progs_t *pr, pr_int_t dstid, pr_int_t srcid) +rua_set_assign (progs_t *pr, set_resources_t *res, + pr_int_t dstid, pr_int_t srcid) { - bi_set_t *dst = get_set (pr, __FUNCTION__, dstid); - bi_set_t *src = get_set (pr, __FUNCTION__, srcid); + bi_set_t *dst = get_set (pr, res, __FUNCTION__, dstid); + bi_set_t *src = get_set (pr, res, __FUNCTION__, srcid); set_assign (dst->set, src->set); } static void -bi_set_assign (progs_t *pr) +bi_set_assign (progs_t *pr, void *_res) { - rua_set_assign (pr, P_INT (pr, 0), P_INT (pr, 1)); + 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); } static void -rua_set_empty (progs_t *pr, pr_int_t setid) +rua_set_empty (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); set_empty (set->set); } static void -bi_set_empty (progs_t *pr) +bi_set_empty (progs_t *pr, void *_res) { - rua_set_empty (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_empty (pr, res, P_INT (pr, 0)); R_INT (pr) = P_INT (pr, 0); } static void -rua_set_everything (progs_t *pr, pr_int_t setid) +rua_set_everything (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); set_everything (set->set); } static void -bi_set_everything (progs_t *pr) +bi_set_everything (progs_t *pr, void *_res) { - rua_set_everything (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_everything (pr, res, P_INT (pr, 0)); R_INT (pr) = P_INT (pr, 0); } static void -rua_set_is_empty (progs_t *pr, pr_int_t setid) +rua_set_is_empty (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); R_INT (pr) = set_is_empty (set->set); } static void -bi_set_is_empty (progs_t *pr) +bi_set_is_empty (progs_t *pr, void *_res) { - rua_set_is_empty (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_is_empty (pr, res, P_INT (pr, 0)); } static void -rua_set_is_everything (progs_t *pr, pr_int_t setid) +rua_set_is_everything (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, P_INT (pr, 0)); + bi_set_t *set = get_set (pr, res, __FUNCTION__, P_INT (pr, 0)); R_INT (pr) = set_is_everything (set->set); } static void -bi_set_is_everything (progs_t *pr) +bi_set_is_everything (progs_t *pr, void *_res) { - rua_set_is_everything (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_is_everything (pr, res, P_INT (pr, 0)); } static void -rua_set_is_disjoint (progs_t *pr, pr_int_t sid1, pr_int_t sid2) +rua_set_is_disjoint (progs_t *pr, set_resources_t *res, + pr_int_t sid1, pr_int_t sid2) { - bi_set_t *set1 = get_set (pr, __FUNCTION__, sid1); - bi_set_t *set2 = get_set (pr, __FUNCTION__, sid2); + bi_set_t *set1 = get_set (pr, res, __FUNCTION__, sid1); + bi_set_t *set2 = get_set (pr, res, __FUNCTION__, sid2); R_INT (pr) = set_is_disjoint (set1->set, set2->set); } static void -bi_set_is_disjoint (progs_t *pr) +bi_set_is_disjoint (progs_t *pr, void *_res) { - rua_set_is_disjoint (pr, P_INT (pr, 0), P_INT (pr, 1)); + set_resources_t *res = _res; + rua_set_is_disjoint (pr, res, P_INT (pr, 0), P_INT (pr, 1)); } static void -rua_set_is_intersecting (progs_t *pr, pr_int_t sid1, pr_int_t sid2) +rua_set_is_intersecting (progs_t *pr, set_resources_t *res, + pr_int_t sid1, pr_int_t sid2) { - bi_set_t *set1 = get_set (pr, __FUNCTION__, sid1); - bi_set_t *set2 = get_set (pr, __FUNCTION__, sid2); + bi_set_t *set1 = get_set (pr, res, __FUNCTION__, sid1); + bi_set_t *set2 = get_set (pr, res, __FUNCTION__, sid2); R_INT (pr) = set_is_intersecting (set1->set, set2->set); } static void -bi_set_is_intersecting (progs_t *pr) +bi_set_is_intersecting (progs_t *pr, void *_res) { - rua_set_is_intersecting (pr, P_INT (pr, 0), P_INT (pr, 1)); + set_resources_t *res = _res; + rua_set_is_intersecting (pr, res, P_INT (pr, 0), P_INT (pr, 1)); } static void -rua_set_is_equivalent (progs_t *pr, pr_int_t sid1, pr_int_t sid2) +rua_set_is_equivalent (progs_t *pr, set_resources_t *res, + pr_int_t sid1, pr_int_t sid2) { - bi_set_t *set1 = get_set (pr, __FUNCTION__, sid1); - bi_set_t *set2 = get_set (pr, __FUNCTION__, sid2); + bi_set_t *set1 = get_set (pr, res, __FUNCTION__, sid1); + bi_set_t *set2 = get_set (pr, res, __FUNCTION__, sid2); R_INT (pr) = set_is_equivalent (set1->set, set2->set); } static void -bi_set_is_equivalent (progs_t *pr) +bi_set_is_equivalent (progs_t *pr, void *_res) { - rua_set_is_equivalent (pr, P_INT (pr, 0), P_INT (pr, 1)); + set_resources_t *res = _res; + rua_set_is_equivalent (pr, res, P_INT (pr, 0), P_INT (pr, 1)); } static void -rua_set_is_subset (progs_t *pr, pr_int_t setid, pr_int_t subid) +rua_set_is_subset (progs_t *pr, set_resources_t *res, pr_int_t setid, + pr_int_t subid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); - bi_set_t *sub = get_set (pr, __FUNCTION__, subid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); + bi_set_t *sub = get_set (pr, res, __FUNCTION__, subid); R_INT (pr) = set_is_subset (set->set, sub->set); } static void -bi_set_is_subset (progs_t *pr) +bi_set_is_subset (progs_t *pr, void *_res) { - rua_set_is_subset (pr, P_INT (pr, 0), P_INT (pr, 1)); + set_resources_t *res = _res; + rua_set_is_subset (pr, res, P_INT (pr, 0), P_INT (pr, 1)); } static void -rua_set_is_member (progs_t *pr, pr_int_t setid, pr_uint_t element) +rua_set_is_member (progs_t *pr, set_resources_t *res, pr_int_t setid, + pr_uint_t element) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); R_INT (pr) = set_is_member (set->set, element); } static void -bi_set_is_member (progs_t *pr) +bi_set_is_member (progs_t *pr, void *_res) { - rua_set_is_member (pr, P_INT (pr, 0), P_UINT (pr, 1)); + set_resources_t *res = _res; + rua_set_is_member (pr, res, P_INT (pr, 0), P_UINT (pr, 1)); } static void -rua_set_count (progs_t *pr, pr_int_t setid) +rua_set_count (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); R_INT (pr) = set_count (set->set); } static void -bi_set_count (progs_t *pr) +bi_set_count (progs_t *pr, void *_res) { - rua_set_count (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_count (pr, res, P_INT (pr, 0)); } static void -bi_set_first (progs_t *pr) +bi_set_first (progs_t *pr, void *_res) { - set_resources_t *res = PR_Resources_Find (pr, "Set"); - bi_set_t *set = get_set (pr, __FUNCTION__, P_INT (pr, 0)); + set_resources_t *res = _res; + bi_set_t *set = get_set (pr, res, __FUNCTION__, P_INT (pr, 0)); set_iter_t *iter; bi_set_iter_t *set_iter; @@ -517,12 +547,14 @@ bi_set_first (progs_t *pr) } static void -bi_set_next (progs_t *pr) +bi_set_next (progs_t *pr, void *_res) { - bi_set_iter_t *set_iter = get_set_iter (pr, __FUNCTION__, P_INT (pr, 0)); + set_resources_t *res = _res; + bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__, + P_INT (pr, 0)); if (!set_next (set_iter->iter)) { - del_set_iter (pr, set_iter); + del_set_iter (pr, res, set_iter); R_INT (pr) = 0; return; } @@ -530,212 +562,234 @@ bi_set_next (progs_t *pr) } static void -rua_set_as_string (progs_t *pr, pr_int_t setid) +rua_set_as_string (progs_t *pr, set_resources_t *res, pr_int_t setid) { - bi_set_t *set = get_set (pr, __FUNCTION__, setid); + bi_set_t *set = get_set (pr, res, __FUNCTION__, setid); RETURN_STRING (pr, set_as_string (set->set)); } static void -bi_set_as_string (progs_t *pr) +bi_set_as_string (progs_t *pr, void *_res) { - rua_set_as_string (pr, P_INT (pr, 0)); + set_resources_t *res = _res; + rua_set_as_string (pr, res, P_INT (pr, 0)); } static void -bi__i_SetIterator__element (progs_t *pr) +bi__i_SetIterator__element (progs_t *pr, void *_res) { + 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, __FUNCTION__, iter_obj->iter); + bi_set_iter_t *set_iter = get_set_iter (pr, res, __FUNCTION__, + iter_obj->iter); R_INT (pr) = set_iter->iter->element; } static void -bi__i_Set__add_ (progs_t *pr) +bi__i_Set__add_ (progs_t *pr, void *_res) { + 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); - rua_set_add (pr, set_obj->set, P_UINT (pr, 2)); + rua_set_add (pr, res, set_obj->set, P_UINT (pr, 2)); R_INT (pr) = set_ptr; } static void -bi__i_Set__remove_ (progs_t *pr) +bi__i_Set__remove_ (progs_t *pr, void *_res) { + 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); - rua_set_remove (pr, set_obj->set, P_UINT (pr, 2)); + rua_set_remove (pr, res, set_obj->set, P_UINT (pr, 2)); R_INT (pr) = set_ptr; } static void -bi__i_Set__invert (progs_t *pr) +bi__i_Set__invert (progs_t *pr, void *_res) { + 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); - rua_set_invert (pr, set_obj->set); + rua_set_invert (pr, res, set_obj->set); R_INT (pr) = set_ptr; } static void -bi__i_Set__union_ (progs_t *pr) +bi__i_Set__union_ (progs_t *pr, void *_res) { + 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); pr_set_t *src_obj = &P_STRUCT (pr, pr_set_t, 2); - rua_set_union (pr, dst_obj->set, src_obj->set); + rua_set_union (pr, res, dst_obj->set, src_obj->set); } static void -bi__i_Set__intersection_ (progs_t *pr) +bi__i_Set__intersection_ (progs_t *pr, void *_res) { + 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); pr_set_t *src_obj = &P_STRUCT (pr, pr_set_t, 2); - rua_set_intersection (pr, dst_obj->set, src_obj->set); + rua_set_intersection (pr, res, dst_obj->set, src_obj->set); R_INT (pr) = dst_ptr; } static void -bi__i_Set__difference_ (progs_t *pr) +bi__i_Set__difference_ (progs_t *pr, void *_res) { + 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); pr_set_t *src_obj = &P_STRUCT (pr, pr_set_t, 2); - rua_set_difference (pr, dst_obj->set, src_obj->set); + rua_set_difference (pr, res, dst_obj->set, src_obj->set); R_INT (pr) = dst_ptr; } static void -bi__i_Set__reverse_difference_ (progs_t *pr) +bi__i_Set__reverse_difference_ (progs_t *pr, void *_res) { + 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); pr_set_t *src_obj = &P_STRUCT (pr, pr_set_t, 2); - rua_set_reverse_difference (pr, dst_obj->set, src_obj->set); + rua_set_reverse_difference (pr, res, dst_obj->set, src_obj->set); R_INT (pr) = dst_ptr; } static void -bi__i_Set__assign_ (progs_t *pr) +bi__i_Set__assign_ (progs_t *pr, void *_res) { + 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); pr_set_t *src_obj = &P_STRUCT (pr, pr_set_t, 2); - rua_set_assign (pr, dst_obj->set, src_obj->set); + rua_set_assign (pr, res, dst_obj->set, src_obj->set); R_INT (pr) = dst_ptr; } static void -bi__i_Set__empty (progs_t *pr) +bi__i_Set__empty (progs_t *pr, void *_res) { + 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); - rua_set_empty (pr, set_obj->set); + rua_set_empty (pr, res, set_obj->set); R_INT (pr) = set_ptr; } static void -bi__i_Set__everything (progs_t *pr) +bi__i_Set__everything (progs_t *pr, void *_res) { + 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); - rua_set_everything (pr, set_obj->set); + rua_set_everything (pr, res, set_obj->set); R_INT (pr) = set_ptr; } static void -bi__i_Set__is_empty (progs_t *pr) +bi__i_Set__is_empty (progs_t *pr, void *_res) { + set_resources_t *res = _res; pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0); - rua_set_is_empty (pr, set_obj->set); + rua_set_is_empty (pr, res, set_obj->set); } static void -bi__i_Set__is_everything (progs_t *pr) +bi__i_Set__is_everything (progs_t *pr, void *_res) { + set_resources_t *res = _res; pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0); - rua_set_is_everything (pr, set_obj->set); + rua_set_is_everything (pr, res, set_obj->set); } static void -bi__i_Set__is_disjoint_ (progs_t *pr) +bi__i_Set__is_disjoint_ (progs_t *pr, void *_res) { + 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); - rua_set_is_disjoint (pr, s1_obj->set, s2_obj->set); + rua_set_is_disjoint (pr, res, s1_obj->set, s2_obj->set); } static void -bi__i_Set__is_intersecting_ (progs_t *pr) +bi__i_Set__is_intersecting_ (progs_t *pr, void *_res) { + 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); - rua_set_is_intersecting (pr, s1_obj->set, s2_obj->set); + rua_set_is_intersecting (pr, res, s1_obj->set, s2_obj->set); } static void -bi__i_Set__is_equivalent_ (progs_t *pr) +bi__i_Set__is_equivalent_ (progs_t *pr, void *_res) { + 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); - rua_set_is_equivalent (pr, s1_obj->set, s2_obj->set); + rua_set_is_equivalent (pr, res, s1_obj->set, s2_obj->set); } static void -bi__i_Set__is_subset_ (progs_t *pr) +bi__i_Set__is_subset_ (progs_t *pr, void *_res) { + 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); - rua_set_is_subset (pr, set_obj->set, sub_obj->set); + rua_set_is_subset (pr, res, set_obj->set, sub_obj->set); } static void -bi__i_Set__is_member_ (progs_t *pr) +bi__i_Set__is_member_ (progs_t *pr, void *_res) { + set_resources_t *res = _res; pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0); - rua_set_is_member (pr, set_obj->set, P_UINT (pr, 2)); + rua_set_is_member (pr, res, set_obj->set, P_UINT (pr, 2)); } static void -bi__i_Set__size (progs_t *pr) +bi__i_Set__size (progs_t *pr, void *_res) { + set_resources_t *res = _res; pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0); - rua_set_count (pr, set_obj->set); + rua_set_count (pr, res, set_obj->set); } static void -bi__i_Set__as_string (progs_t *pr) +bi__i_Set__as_string (progs_t *pr, void *_res) { + set_resources_t *res = _res; pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0); - rua_set_as_string (pr, set_obj->set); + rua_set_as_string (pr, res, set_obj->set); } static void -res_set_clear (progs_t *pr, void *data) +res_set_clear (progs_t *pr, void *_res) { - set_resources_t *res = (set_resources_t *) data; + set_resources_t *res = (set_resources_t *) _res; bi_set_t *set; bi_set_iter_t *set_iter; diff --git a/libs/ruamoko/rua_stdlib.c b/libs/ruamoko/rua_stdlib.c index 50fd1cc04..d74d6b403 100644 --- a/libs/ruamoko/rua_stdlib.c +++ b/libs/ruamoko/rua_stdlib.c @@ -84,7 +84,7 @@ rua_compare (const void *a, const void *b, void *_f) } static void -bi_bsearch (progs_t *pr) +bi_bsearch (progs_t *pr, void *data) { const void *key = P_GPOINTER (pr, 0); const void *array = P_GPOINTER (pr, 1); @@ -103,7 +103,7 @@ bi_bsearch (progs_t *pr) } static void -bi_fbsearch (progs_t *pr) +bi_fbsearch (progs_t *pr, void *data) { const void *key = P_GPOINTER (pr, 0); const void *array = P_GPOINTER (pr, 1); @@ -122,7 +122,7 @@ bi_fbsearch (progs_t *pr) } static void -bi_qsort (progs_t *pr) +bi_qsort (progs_t *pr, void *data) { void *array = P_GPOINTER (pr, 0); size_t nmemb = P_INT (pr, 1); @@ -138,7 +138,7 @@ bi_qsort (progs_t *pr) } static void -bi_prefixsumi (progs_t *pr) +bi_prefixsumi (progs_t *pr, void *data) { int *array = (int *) P_GPOINTER (pr, 0); int count = P_INT (pr, 1); @@ -149,7 +149,7 @@ bi_prefixsumi (progs_t *pr) } static void -bi_prefixsumf (progs_t *pr) +bi_prefixsumf (progs_t *pr, void *data) { float *array = (float *) P_GPOINTER (pr, 0); int count = P_INT (pr, 1); diff --git a/libs/ruamoko/rua_string.c b/libs/ruamoko/rua_string.c index f5ccd6d86..8977160a7 100644 --- a/libs/ruamoko/rua_string.c +++ b/libs/ruamoko/rua_string.c @@ -52,7 +52,7 @@ #include "rua_internal.h" static void -bi_strlen (progs_t *pr) +bi_strlen (progs_t *pr, void *data) { const char *s; @@ -84,7 +84,7 @@ RUA_Sprintf (progs_t *pr, dstring_t *dstr, const char *func, int fmt_arg) } static void -bi_sprintf (progs_t *pr) +bi_sprintf (progs_t *pr, void *data) { dstring_t *dstr; @@ -95,7 +95,7 @@ bi_sprintf (progs_t *pr) } static void -bi_vsprintf (progs_t *pr) +bi_vsprintf (progs_t *pr, void *data) { const char *fmt = P_GSTRING (pr, 0); __auto_type args = &P_PACKED (pr, pr_va_list_t, 1); @@ -114,19 +114,19 @@ bi_vsprintf (progs_t *pr) } static void -bi_str_new (progs_t *pr) +bi_str_new (progs_t *pr, void *data) { R_STRING (pr) = PR_NewMutableString (pr); } static void -bi_str_free (progs_t *pr) +bi_str_free (progs_t *pr, void *data) { PR_FreeString (pr, P_STRING (pr, 0)); } static void -bi_str_hold (progs_t *pr) +bi_str_hold (progs_t *pr, void *data) { pr_string_t str = P_STRING (pr, 0); PR_HoldString (pr, str); @@ -134,19 +134,19 @@ bi_str_hold (progs_t *pr) } static void -bi_str_valid (progs_t *pr) +bi_str_valid (progs_t *pr, void *data) { R_INT (pr) = PR_StringValid (pr, P_STRING (pr, 0)); } static void -bi_str_mutable (progs_t *pr) +bi_str_mutable (progs_t *pr, void *data) { R_INT (pr) = PR_StringMutable (pr, P_STRING (pr, 0)); } static void -bi_str_copy (progs_t *pr) +bi_str_copy (progs_t *pr, void *data) { dstring_t *dst = P_DSTRING (pr, 0); const char *src = P_GSTRING (pr, 1); @@ -156,7 +156,7 @@ bi_str_copy (progs_t *pr) } static void -bi_str_cat (progs_t *pr) +bi_str_cat (progs_t *pr, void *data) { dstring_t *dst = P_DSTRING (pr, 0); const char *src = P_GSTRING (pr, 1); @@ -166,7 +166,7 @@ bi_str_cat (progs_t *pr) } static void -bi_str_clear (progs_t *pr) +bi_str_clear (progs_t *pr, void *data) { dstring_t *str = P_DSTRING (pr, 0); @@ -199,7 +199,7 @@ str_mid (progs_t *pr, const char *str, int pos, int end, int size) } static void -bi_str_mid_2 (progs_t *pr) +bi_str_mid_2 (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 0); int pos = P_INT (pr, 1); @@ -209,7 +209,7 @@ bi_str_mid_2 (progs_t *pr) } static void -bi_str_mid_3 (progs_t *pr) +bi_str_mid_3 (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 0); int pos = P_INT (pr, 1); @@ -220,7 +220,7 @@ bi_str_mid_3 (progs_t *pr) } static void -bi_str_str (progs_t *pr) +bi_str_str (progs_t *pr, void *data) { const char *haystack = P_GSTRING (pr, 0); const char *needle = P_GSTRING (pr, 1); @@ -233,7 +233,7 @@ bi_str_str (progs_t *pr) } static void -bi_str_char (progs_t *pr) +bi_str_char (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 0); int ind = P_INT (pr, 1); @@ -245,7 +245,7 @@ bi_str_char (progs_t *pr) } static void -bi_str_quote (progs_t *pr) +bi_str_quote (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 0); // can have up to 4 chars per char (a -> \x61) @@ -284,7 +284,7 @@ bi_str_quote (progs_t *pr) } static void -bi_str_lower (progs_t *pr) +bi_str_lower (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 0); char *lower = alloca (strlen (str) + 1); @@ -300,7 +300,7 @@ bi_str_lower (progs_t *pr) } static void -bi_str_upper (progs_t *pr) +bi_str_upper (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 0); char *upper = alloca (strlen (str) + 1); diff --git a/libs/video/renderer/r_progs.c b/libs/video/renderer/r_progs.c index 87cd3e513..ef2e5b403 100644 --- a/libs/video/renderer/r_progs.c +++ b/libs/video/renderer/r_progs.c @@ -108,9 +108,8 @@ qpic_index (draw_resources_t *res, qpic_res_t *qp) } static qpic_res_t * -get_qpic (progs_t *pr, const char *name, int qpic_handle) +get_qpic (progs_t *pr, draw_resources_t *res, const char *name, int qpic_handle) { - draw_resources_t *res = PR_Resources_Find (pr, "Draw"); qpic_res_t *qp = qpic_get (res, qpic_handle); if (!qp) @@ -119,20 +118,20 @@ get_qpic (progs_t *pr, const char *name, int qpic_handle) } static void -bi_Draw_FreePic (progs_t *pr) +bi_Draw_FreePic (progs_t *pr, void *_res) { - draw_resources_t *res = PR_Resources_Find (pr, "Draw"); + draw_resources_t *res = _res; bi_qpic_t *bq = &P_STRUCT (pr, bi_qpic_t, 0); - qpic_res_t *qp = get_qpic (pr, __FUNCTION__, bq->pic_handle); + qpic_res_t *qp = get_qpic (pr, res, __FUNCTION__, bq->pic_handle); PR_Zone_Free (pr, qp->bq); qpic_free (res, qp); } static void -bi_Draw_MakePic (progs_t *pr) +bi_Draw_MakePic (progs_t *pr, void *_res) { - draw_resources_t *res = PR_Resources_Find (pr, "Draw"); + draw_resources_t *res = _res; int width = P_INT (pr, 0); int height = P_INT (pr, 1); byte *data = (byte *) P_GSTRING (pr, 2); @@ -154,9 +153,9 @@ bi_Draw_MakePic (progs_t *pr) } static void -bi_Draw_CachePic (progs_t *pr) +bi_Draw_CachePic (progs_t *pr, void *_res) { - draw_resources_t *res = PR_Resources_Find (pr, "Draw"); + draw_resources_t *res = _res; const char *name = P_GSTRING (pr, 0); int alpha = P_INT (pr, 1); qpic_t *pic; @@ -183,36 +182,39 @@ bi_Draw_CachePic (progs_t *pr) } static void -bi_Draw_Pic (progs_t *pr) +bi_Draw_Pic (progs_t *pr, void *_res) { + draw_resources_t *res = _res; int x = P_INT (pr, 0); int y = P_INT (pr, 1); bi_qpic_t *bq = &P_STRUCT (pr, bi_qpic_t, 2); - qpic_res_t *qp = get_qpic (pr, __FUNCTION__, bq->pic_handle); + qpic_res_t *qp = get_qpic (pr, res, __FUNCTION__, bq->pic_handle); qpic_t *pic = qp->pic; r_funcs->Draw_Pic (x, y, pic); } static void -bi_Draw_Picf (progs_t *pr) +bi_Draw_Picf (progs_t *pr, void *_res) { + draw_resources_t *res = _res; float x = P_FLOAT (pr, 0); float y = P_FLOAT (pr, 1); bi_qpic_t *bq = &P_STRUCT (pr, bi_qpic_t, 2); - qpic_res_t *qp = get_qpic (pr, __FUNCTION__, bq->pic_handle); + qpic_res_t *qp = get_qpic (pr, res, __FUNCTION__, bq->pic_handle); qpic_t *pic = qp->pic; r_funcs->Draw_Picf (x, y, pic); } static void -bi_Draw_SubPic (progs_t *pr) +bi_Draw_SubPic (progs_t *pr, void *_res) { + draw_resources_t *res = _res; int x = P_INT (pr, 0); int y = P_INT (pr, 1); bi_qpic_t *bq = &P_STRUCT (pr, bi_qpic_t, 2); - qpic_res_t *qp = get_qpic (pr, __FUNCTION__, bq->pic_handle); + qpic_res_t *qp = get_qpic (pr, res, __FUNCTION__, bq->pic_handle); qpic_t *pic = qp->pic; int srcx = P_INT (pr, 3); int srcy = P_INT (pr, 4); @@ -223,19 +225,20 @@ bi_Draw_SubPic (progs_t *pr) } static void -bi_Draw_CenterPic (progs_t *pr) +bi_Draw_CenterPic (progs_t *pr, void *_res) { + draw_resources_t *res = _res; int x = P_INT (pr, 0); int y = P_INT (pr, 1); bi_qpic_t *bq = &P_STRUCT (pr, bi_qpic_t, 2); - qpic_res_t *qp = get_qpic (pr, __FUNCTION__, bq->pic_handle); + qpic_res_t *qp = get_qpic (pr, res, __FUNCTION__, bq->pic_handle); qpic_t *pic = qp->pic; r_funcs->Draw_Pic (x - pic->width / 2, y, pic); } static void -bi_Draw_Character (progs_t *pr) +bi_Draw_Character (progs_t *pr, void *_res) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -245,7 +248,7 @@ bi_Draw_Character (progs_t *pr) } static void -bi_Draw_String (progs_t *pr) +bi_Draw_String (progs_t *pr, void *_res) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -255,7 +258,7 @@ bi_Draw_String (progs_t *pr) } static void -bi_Draw_nString (progs_t *pr) +bi_Draw_nString (progs_t *pr, void *_res) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -266,7 +269,7 @@ bi_Draw_nString (progs_t *pr) } static void -bi_Draw_AltString (progs_t *pr) +bi_Draw_AltString (progs_t *pr, void *_res) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -282,7 +285,7 @@ bi_Draw_AltString (progs_t *pr) (only a wrapper function to original qf-api) */ static void -bi_Draw_Fill (progs_t *pr) +bi_Draw_Fill (progs_t *pr, void *_res) { int x = P_INT (pr, 0); int y = P_INT (pr, 1); @@ -294,7 +297,7 @@ bi_Draw_Fill (progs_t *pr) } static void -bi_Draw_Crosshair (progs_t *pr) +bi_Draw_Crosshair (progs_t *pr, void *_res) { int ch = P_INT (pr, 0); int x = P_INT (pr, 1); @@ -310,9 +313,9 @@ bi_draw_get_key (const void *p, void *unused) } static void -bi_draw_clear (progs_t *pr, void *data) +bi_draw_clear (progs_t *pr, void *_res) { - draw_resources_t *res = (draw_resources_t *) data; + draw_resources_t *res = (draw_resources_t *) _res; qpic_res_t *qp; for (qp = res->qpics; qp; qp = qp->next) { diff --git a/nq/include/server.h b/nq/include/server.h index 5af088cc8..8c43ed2e4 100644 --- a/nq/include/server.h +++ b/nq/include/server.h @@ -285,7 +285,7 @@ qboolean SV_movestep (edict_t *ent, const vec3_t move, qboolean relink); void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg); -void SV_MoveToGoal (progs_t *pr); +void SV_MoveToGoal (progs_t *pr, void *data); void SV_CheckForNewClients (void); void SV_RunClients (void); diff --git a/nq/include/sv_pr_cmds.h b/nq/include/sv_pr_cmds.h index c068a4487..5716e9793 100644 --- a/nq/include/sv_pr_cmds.h +++ b/nq/include/sv_pr_cmds.h @@ -31,6 +31,6 @@ #ifndef __sv_pr_cmds_h #define __sv_pr_cmds_h -void PF_changeyaw (progs_t * pr); +void PF_changeyaw (progs_t * pr, void *data); #endif // __sv_pr_cmds_h diff --git a/nq/source/sv_move.c b/nq/source/sv_move.c index 494fc7083..3970f6d78 100644 --- a/nq/source/sv_move.c +++ b/nq/source/sv_move.c @@ -229,7 +229,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist) vec3_t move, oldorigin; SVfloat (ent, ideal_yaw) = yaw; - PF_changeyaw (&sv_pr_state); + PF_changeyaw (&sv_pr_state, 0); yaw = yaw * M_PI * 2 / 360; move[0] = cos (yaw) * dist; @@ -346,7 +346,7 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) } void -SV_MoveToGoal (progs_t *pr) +SV_MoveToGoal (progs_t *pr, void *data) { edict_t *ent, *goal; float dist; diff --git a/nq/source/sv_pr_cmds.c b/nq/source/sv_pr_cmds.c index eee7778a1..b805a40be 100644 --- a/nq/source/sv_pr_cmds.c +++ b/nq/source/sv_pr_cmds.c @@ -66,7 +66,7 @@ // void (string e) error */ static void -PF_error (progs_t *pr) +PF_error (progs_t *pr, void *data) { const char *s; edict_t *ed; @@ -90,7 +90,7 @@ PF_error (progs_t *pr) // void (string e) objerror */ static void -PF_objerror (progs_t *pr) +PF_objerror (progs_t *pr, void *data) { const char *s; edict_t *ed; @@ -112,7 +112,7 @@ PF_objerror (progs_t *pr) void (vector angles) makevectors */ static void -PF_makevectors (progs_t *pr) +PF_makevectors (progs_t *pr, void *data) { AngleVectors (P_VECTOR (pr, 0), *sv_globals.v_forward, *sv_globals.v_right, *sv_globals.v_up); @@ -131,7 +131,7 @@ PF_makevectors (progs_t *pr) // void (entity e, vector o) setorigin */ static void -PF_setorigin (progs_t *pr) +PF_setorigin (progs_t *pr, void *data) { edict_t *e; float *org; @@ -221,7 +221,7 @@ SetMinMaxSize (progs_t *pr, edict_t *e, const vec3_t min, const vec3_t max, // void (entity e, vector min, vector max) setsize */ static void -PF_setsize (progs_t *pr) +PF_setsize (progs_t *pr, void *data) { edict_t *e; float *min, *max; @@ -239,7 +239,7 @@ PF_setsize (progs_t *pr) // void (entity e, string m) setmodel */ static void -PF_setmodel (progs_t *pr) +PF_setmodel (progs_t *pr, void *data) { edict_t *e; const char *m, **check; @@ -283,7 +283,7 @@ PF_setmodel (progs_t *pr) // void (string s) bprint */ static void -PF_bprint (progs_t *pr) +PF_bprint (progs_t *pr, void *data) { const char *s; @@ -300,7 +300,7 @@ PF_bprint (progs_t *pr) // void (entity client, string s) sprint */ static void -PF_sprint (progs_t *pr) +PF_sprint (progs_t *pr, void *data) { const char *s; client_t *client; @@ -329,7 +329,7 @@ PF_sprint (progs_t *pr) // void (...) centerprint */ static void -PF_centerprint (progs_t *pr) +PF_centerprint (progs_t *pr, void *data) { const char *s; client_t *cl; @@ -351,7 +351,7 @@ PF_centerprint (progs_t *pr) // void (vector o, vector d, float color, float count) particle static void -PF_particle (progs_t *pr) +PF_particle (progs_t *pr, void *data) { float *org, *dir; float color; @@ -369,7 +369,7 @@ PF_particle (progs_t *pr) // void (vector pos, string samp, float vol, float atten) ambientsound */ static void -PF_ambientsound (progs_t *pr) +PF_ambientsound (progs_t *pr, void *data) { const char **check; const char *samp; @@ -425,7 +425,7 @@ PF_ambientsound (progs_t *pr) // void (entity e, float chan, string samp) sound */ static void -PF_sound (progs_t *pr) +PF_sound (progs_t *pr, void *data) { const char *sample; edict_t *entity; @@ -459,7 +459,7 @@ PF_sound (progs_t *pr) // float (vector v1, vector v2, float tryents) traceline */ static void -PF_traceline (progs_t *pr) +PF_traceline (progs_t *pr, void *data) { float *v1, *v2; edict_t *ent; @@ -497,7 +497,7 @@ PF_traceline (progs_t *pr) redundant. */ static void -PF_tracebox (progs_t *pr) +PF_tracebox (progs_t *pr, void *data) { edict_t *ent; float *start, *end, *mins, *maxs; @@ -536,7 +536,7 @@ PF_tracebox (progs_t *pr) scalar checkpos (entity, vector) */ static void __attribute__ ((used)) -PF_checkpos (progs_t *pr) +PF_checkpos (progs_t *pr, void *data) { } @@ -610,7 +610,7 @@ int c_invis, c_notvis; // entity () clientlist */ static void -PF_checkclient (progs_t *pr) +PF_checkclient (progs_t *pr, void *data) { edict_t *ent, *self; int l; @@ -652,7 +652,7 @@ PF_checkclient (progs_t *pr) // void (entity client, string s) stuffcmd */ static void -PF_stuffcmd (progs_t *pr) +PF_stuffcmd (progs_t *pr, void *data) { const char *str; client_t *old; @@ -678,7 +678,7 @@ PF_stuffcmd (progs_t *pr) // void (string s) localcmd */ static void -PF_localcmd (progs_t *pr) +PF_localcmd (progs_t *pr, void *data) { const char *str; @@ -695,7 +695,7 @@ PF_localcmd (progs_t *pr) // entity (vector org, float rad) findradius */ static void -PF_findradius (progs_t *pr) +PF_findradius (progs_t *pr, void *data) { edict_t *ent, *chain; float rsqr; @@ -731,7 +731,7 @@ PF_findradius (progs_t *pr) // entity () spawn static void -PF_spawn (progs_t *pr) +PF_spawn (progs_t *pr, void *data) { edict_t *ed; @@ -741,7 +741,7 @@ PF_spawn (progs_t *pr) // void (entity e) remove static void -PF_remove (progs_t *pr) +PF_remove (progs_t *pr, void *data) { edict_t *ed; @@ -793,7 +793,7 @@ do_precache (progs_t *pr, const char **cache, int max, const char *name, // string (string s) precache_file // string (string s) precache_file2 static void -PF_precache_file (progs_t *pr) +PF_precache_file (progs_t *pr, void *data) { // precache_file is used only to copy files with qcc, it does nothing R_INT (pr) = P_INT (pr, 0); @@ -803,7 +803,7 @@ PF_precache_file (progs_t *pr) // void (string s) precache_sound // string (string s) precache_sound2 static void -PF_precache_sound (progs_t *pr) +PF_precache_sound (progs_t *pr, void *data) { do_precache (pr, sv.sound_precache, MAX_SOUNDS, P_GSTRING (pr, 0), "precache_sound"); @@ -814,7 +814,7 @@ PF_precache_sound (progs_t *pr) // void (string s) precache_model // string (string s) precache_model2 static void -PF_precache_model (progs_t *pr) +PF_precache_model (progs_t *pr, void *data) { int ind; const char *mod = P_GSTRING (pr, 0); @@ -832,7 +832,7 @@ PF_precache_model (progs_t *pr) // float (float yaw, float dist) walkmove */ static void -PF_walkmove (progs_t *pr) +PF_walkmove (progs_t *pr, void *data) { edict_t *ent; float yaw, dist; @@ -870,7 +870,7 @@ PF_walkmove (progs_t *pr) // float () droptofloor */ static void -PF_droptofloor (progs_t *pr) +PF_droptofloor (progs_t *pr, void *data) { edict_t *ent; trace_t trace; @@ -902,7 +902,7 @@ PF_droptofloor (progs_t *pr) // void (float style, string value) lightstyle */ static void -PF_lightstyle (progs_t *pr) +PF_lightstyle (progs_t *pr, void *data) { const char *val; client_t *cl; @@ -929,7 +929,7 @@ PF_lightstyle (progs_t *pr) // float (entity e) checkbottom static void -PF_checkbottom (progs_t *pr) +PF_checkbottom (progs_t *pr, void *data) { edict_t *ent; @@ -940,7 +940,7 @@ PF_checkbottom (progs_t *pr) // float (vector v) pointcontents static void -PF_pointcontents (progs_t *pr) +PF_pointcontents (progs_t *pr, void *data) { float *v; @@ -959,7 +959,7 @@ cvar_t *sv_aim; // vector (entity e, float speed) aim */ static void -PF_aim (progs_t *pr) +PF_aim (progs_t *pr, void *data) { edict_t *ent, *check, *bestent; float dist, bestdist, speed; @@ -1038,7 +1038,7 @@ PF_aim (progs_t *pr) // void () ChangeYaw */ void -PF_changeyaw (progs_t *pr) +PF_changeyaw (progs_t *pr, void *data) { edict_t *ent; float ideal, current, move, speed; @@ -1111,7 +1111,7 @@ WriteDest (progs_t *pr) // void (float to, ...) WriteBytes static void -PF_WriteBytes (progs_t *pr) +PF_WriteBytes (progs_t *pr, void *data) { int i, p; int argc = pr->pr_argc - 1; @@ -1138,49 +1138,49 @@ PF_WriteBytes (progs_t *pr) // void (float to, float f) WriteByte static void -PF_WriteByte (progs_t *pr) +PF_WriteByte (progs_t *pr, void *data) { MSG_WriteByte (WriteDest (pr), P_FLOAT (pr, 1)); } // void (float to, float f) WriteChar static void -PF_WriteChar (progs_t *pr) +PF_WriteChar (progs_t *pr, void *data) { MSG_WriteByte (WriteDest (pr), P_FLOAT (pr, 1)); } // void (float to, float f) WriteShort static void -PF_WriteShort (progs_t *pr) +PF_WriteShort (progs_t *pr, void *data) { MSG_WriteShort (WriteDest (pr), P_FLOAT (pr, 1)); } // void (float to, float f) WriteLong static void -PF_WriteLong (progs_t *pr) +PF_WriteLong (progs_t *pr, void *data) { MSG_WriteLong (WriteDest (pr), P_FLOAT (pr, 1)); } // void (float to, float f) WriteAngle static void -PF_WriteAngle (progs_t *pr) +PF_WriteAngle (progs_t *pr, void *data) { MSG_WriteAngle (WriteDest (pr), P_FLOAT (pr, 1)); } // void (float to, float f) WriteCoord static void -PF_WriteCoord (progs_t *pr) +PF_WriteCoord (progs_t *pr, void *data) { MSG_WriteCoord (WriteDest (pr), P_FLOAT (pr, 1)); } // void (float to, vector v) WriteAngleV static void -PF_WriteAngleV (progs_t *pr) +PF_WriteAngleV (progs_t *pr, void *data) { float *ang = P_VECTOR (pr, 1); @@ -1189,7 +1189,7 @@ PF_WriteAngleV (progs_t *pr) // void (float to, vector v) WriteCoordV static void -PF_WriteCoordV (progs_t *pr) +PF_WriteCoordV (progs_t *pr, void *data) { float *coord = P_VECTOR (pr, 1); @@ -1198,21 +1198,21 @@ PF_WriteCoordV (progs_t *pr) // void (float to, string s) WriteString static void -PF_WriteString (progs_t *pr) +PF_WriteString (progs_t *pr, void *data) { MSG_WriteString (WriteDest (pr), P_GSTRING (pr, 1)); } // void (float to, entity s) WriteEntity static void -PF_WriteEntity (progs_t *pr) +PF_WriteEntity (progs_t *pr, void *data) { MSG_WriteShort (WriteDest (pr), P_EDICTNUM (pr, 1)); } // void (entity e) makestatic static void -PF_makestatic (progs_t *pr) +PF_makestatic (progs_t *pr, void *data) { const char *model; edict_t *ent; @@ -1270,7 +1270,7 @@ nosend: // void (entity e) setspawnparms static void -PF_setspawnparms (progs_t *pr) +PF_setspawnparms (progs_t *pr, void *data) { client_t *client; edict_t *ent; @@ -1290,7 +1290,7 @@ PF_setspawnparms (progs_t *pr) // void (string s) changelevel static void -PF_changelevel (progs_t *pr) +PF_changelevel (progs_t *pr, void *data) { const char *s; @@ -1305,7 +1305,7 @@ PF_changelevel (progs_t *pr) // entity (entity ent) testentitypos static void -PF_testentitypos (progs_t *pr) +PF_testentitypos (progs_t *pr, void *data) { edict_t *ent = P_EDICT (pr, 0); ent = SV_TestEntityPosition (ent); @@ -1317,7 +1317,7 @@ clip_hull_t *pf_hull_list[MAX_PF_HULLS]; // integer (entity ent, vector point) hullpointcontents static void -PF_hullpointcontents (progs_t *pr) +PF_hullpointcontents (progs_t *pr, void *data) { edict_t *edict = P_EDICT (pr, 0); float *mins = P_VECTOR (pr, 1); @@ -1333,7 +1333,7 @@ PF_hullpointcontents (progs_t *pr) // vector (integer hull, integer max) getboxbounds static void -PF_getboxbounds (progs_t *pr) +PF_getboxbounds (progs_t *pr, void *data) { clip_hull_t *ch; int h = P_INT (pr, 0) - 1; @@ -1350,7 +1350,7 @@ PF_getboxbounds (progs_t *pr) // integer () getboxhull static void -PF_getboxhull (progs_t *pr) +PF_getboxhull (progs_t *pr, void *data) { clip_hull_t *ch = 0; int i; @@ -1375,7 +1375,7 @@ PF_getboxhull (progs_t *pr) // void (integer hull) freeboxhull static void -PF_freeboxhull (progs_t *pr) +PF_freeboxhull (progs_t *pr, void *data) { int h = P_INT (pr, 0) - 1; clip_hull_t *ch; @@ -1405,7 +1405,7 @@ calc_dist (vec3_t p, vec3_t n, vec3_t *offsets) // void (integer hull, vector right, vector forward, vector up, vector mins, vector maxs) rotate_bbox static void -PF_rotate_bbox (progs_t *pr) +PF_rotate_bbox (progs_t *pr, void *data) { clip_hull_t *ch; float l; @@ -1484,7 +1484,7 @@ PF_rotate_bbox (progs_t *pr) // float () checkextension static void -PF_checkextension (progs_t *pr) +PF_checkextension (progs_t *pr, void *data) { R_FLOAT (pr) = 0; // FIXME: make this function actually useful } diff --git a/qw/include/server.h b/qw/include/server.h index bd7fb8062..be60ccf95 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -510,7 +510,7 @@ qboolean SV_movestep (struct edict_s *ent, const vec3_t move, void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg); struct progs_s; -void SV_MoveToGoal (struct progs_s *pr); +void SV_MoveToGoal (struct progs_s *pr, void *data); void SV_SaveSpawnparms (void); diff --git a/qw/include/sv_pr_cmds.h b/qw/include/sv_pr_cmds.h index 0ef2d00ac..6cfb999d7 100644 --- a/qw/include/sv_pr_cmds.h +++ b/qw/include/sv_pr_cmds.h @@ -28,6 +28,6 @@ #ifndef __sv_pr_cmds_h #define __sv_pr_cmds_h -void PF_changeyaw (progs_t *pr); +void PF_changeyaw (progs_t *pr, void *data); #endif // __sv_pr_cmds_h diff --git a/qw/source/sv_move.c b/qw/source/sv_move.c index 75b4f8e01..c500e30ed 100644 --- a/qw/source/sv_move.c +++ b/qw/source/sv_move.c @@ -228,7 +228,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist) vec3_t move, oldorigin; SVfloat (ent, ideal_yaw) = yaw; - PF_changeyaw (&sv_pr_state); + PF_changeyaw (&sv_pr_state, 0); yaw = yaw * M_PI * 2 / 360; move[0] = cos (yaw) * dist; @@ -345,7 +345,7 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) } void -SV_MoveToGoal (progs_t *pr) +SV_MoveToGoal (progs_t *pr, void *data) { edict_t *ent, *goal; float dist; diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index f2e9b8a37..9eb50bca6 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -68,7 +68,7 @@ // void (string e) error */ static void -PF_error (progs_t *pr) +PF_error (progs_t *pr, void *data) { const char *s; edict_t *ed; @@ -92,7 +92,7 @@ PF_error (progs_t *pr) // void (string e) objerror */ static void -PF_objerror (progs_t *pr) +PF_objerror (progs_t *pr, void *data) { const char *s; edict_t *ed; @@ -114,7 +114,7 @@ PF_objerror (progs_t *pr) void (vector angles) makevectors */ static void -PF_makevectors (progs_t *pr) +PF_makevectors (progs_t *pr, void *data) { AngleVectors (P_VECTOR (pr, 0), *sv_globals.v_forward, *sv_globals.v_right, *sv_globals.v_up); @@ -133,7 +133,7 @@ PF_makevectors (progs_t *pr) // void (entity e, vector o) setorigin */ static void -PF_setorigin (progs_t *pr) +PF_setorigin (progs_t *pr, void *data) { edict_t *e; float *org; @@ -153,7 +153,7 @@ PF_setorigin (progs_t *pr) // void (entity e, vector min, vector max) setsize */ static void -PF_setsize (progs_t *pr) +PF_setsize (progs_t *pr, void *data) { edict_t *e; float *min, *max; @@ -175,7 +175,7 @@ PF_setsize (progs_t *pr) Also sets size, mins, and maxs for inline bmodels */ static void -PF_setmodel (progs_t *pr) +PF_setmodel (progs_t *pr, void *data) { edict_t *e; const char *m, **check; @@ -215,7 +215,7 @@ PF_setmodel (progs_t *pr) // void (string s) bprint */ static void -PF_bprint (progs_t *pr) +PF_bprint (progs_t *pr, void *data) { const char *s; int level; @@ -235,7 +235,7 @@ PF_bprint (progs_t *pr) // void (entity client, string s) sprint */ static void -PF_sprint (progs_t *pr) +PF_sprint (progs_t *pr, void *data) { const char *s; client_t *client; @@ -268,7 +268,7 @@ PF_sprint (progs_t *pr) // void (...) centerprint */ static void -PF_centerprint (progs_t *pr) +PF_centerprint (progs_t *pr, void *data) { const char *s; client_t *cl; @@ -304,7 +304,7 @@ PF_centerprint (progs_t *pr) // void (vector pos, string samp, float vol, float atten) ambientsound */ static void -PF_ambientsound (progs_t *pr) +PF_ambientsound (progs_t *pr, void *data) { const char **check; const char *samp; @@ -350,7 +350,7 @@ PF_ambientsound (progs_t *pr) // void (entity e, float chan, string samp) sound */ static void -PF_sound (progs_t *pr) +PF_sound (progs_t *pr, void *data) { const char *sample; edict_t *entity; @@ -377,7 +377,7 @@ PF_sound (progs_t *pr) // float (vector v1, vector v2, float tryents) traceline */ static void -PF_traceline (progs_t *pr) +PF_traceline (progs_t *pr, void *data) { float *v1, *v2; edict_t *ent; @@ -418,7 +418,7 @@ PF_traceline (progs_t *pr) redundant. */ static void -PF_tracebox (progs_t *pr) +PF_tracebox (progs_t *pr, void *data) { edict_t *ent; float *start, *end, *mins, *maxs; @@ -457,7 +457,7 @@ PF_tracebox (progs_t *pr) scalar checkpos (entity, vector) */ static void __attribute__ ((used)) -PF_checkpos (progs_t *pr) +PF_checkpos (progs_t *pr, void *data) { } @@ -531,7 +531,7 @@ int c_invis, c_notvis; // entity () clientlist */ static void -PF_checkclient (progs_t *pr) +PF_checkclient (progs_t *pr, void *data) { edict_t *ent, *self; int l; @@ -573,7 +573,7 @@ PF_checkclient (progs_t *pr) // void (entity client, string s) stuffcmd */ static void -PF_stuffcmd (progs_t *pr) +PF_stuffcmd (progs_t *pr, void *data) { const char *str; char *buf, *p; @@ -631,7 +631,7 @@ PF_stuffcmd (progs_t *pr) // void (string s) localcmd */ static void -PF_localcmd (progs_t *pr) +PF_localcmd (progs_t *pr, void *data) { const char *str; @@ -648,7 +648,7 @@ PF_localcmd (progs_t *pr) // entity (vector org, float rad) findradius */ static void -PF_findradius (progs_t *pr) +PF_findradius (progs_t *pr, void *data) { edict_t *ent, *chain; float rsqr; @@ -684,7 +684,7 @@ PF_findradius (progs_t *pr) // entity () spawn static void -PF_spawn (progs_t *pr) +PF_spawn (progs_t *pr, void *data) { edict_t *ed; @@ -696,7 +696,7 @@ cvar_t *pr_double_remove; // void (entity e) remove static void -PF_remove (progs_t *pr) +PF_remove (progs_t *pr, void *data) { edict_t *ed; @@ -762,7 +762,7 @@ do_precache (progs_t *pr, const char **cache, int max, const char *name, // string (string s) precache_file // string (string s) precache_file2 static void -PF_precache_file (progs_t *pr) +PF_precache_file (progs_t *pr, void *data) { // precache_file is used only to copy files with qcc, it does nothing R_INT (pr) = P_INT (pr, 0); @@ -772,7 +772,7 @@ PF_precache_file (progs_t *pr) // void (string s) precache_sound // string (string s) precache_sound2 static void -PF_precache_sound (progs_t *pr) +PF_precache_sound (progs_t *pr, void *data) { do_precache (pr, sv.sound_precache, MAX_SOUNDS, P_GSTRING (pr, 0), "precache_sound"); @@ -783,7 +783,7 @@ PF_precache_sound (progs_t *pr) // void (string s) precache_model // string (string s) precache_model2 static void -PF_precache_model (progs_t *pr) +PF_precache_model (progs_t *pr, void *data) { do_precache (pr, sv.model_precache, MAX_MODELS, P_GSTRING (pr, 0), "precache_model"); @@ -798,7 +798,7 @@ PF_precache_model (progs_t *pr) // float (float yaw, float dist) walkmove */ static void -PF_walkmove (progs_t *pr) +PF_walkmove (progs_t *pr, void *data) { edict_t *ent; float yaw, dist; @@ -836,7 +836,7 @@ PF_walkmove (progs_t *pr) // float () droptofloor */ static void -PF_droptofloor (progs_t *pr) +PF_droptofloor (progs_t *pr, void *data) { edict_t *ent; trace_t trace; @@ -868,7 +868,7 @@ PF_droptofloor (progs_t *pr) // void (float style, string value) lightstyle */ static void -PF_lightstyle (progs_t *pr) +PF_lightstyle (progs_t *pr, void *data) { const char *val; client_t *cl; @@ -902,7 +902,7 @@ PF_lightstyle (progs_t *pr) // float (entity e) checkbottom static void -PF_checkbottom (progs_t *pr) +PF_checkbottom (progs_t *pr, void *data) { edict_t *ent; @@ -913,7 +913,7 @@ PF_checkbottom (progs_t *pr) // float (vector v) pointcontents static void -PF_pointcontents (progs_t *pr) +PF_pointcontents (progs_t *pr, void *data) { float *v; @@ -932,7 +932,7 @@ cvar_t *sv_aim; // vector (entity e, float speed) aim */ static void -PF_aim (progs_t *pr) +PF_aim (progs_t *pr, void *data) { const char *noaim; edict_t *ent, *check, *bestent; @@ -1027,7 +1027,7 @@ PF_aim (progs_t *pr) // void () ChangeYaw */ void -PF_changeyaw (progs_t *pr) +PF_changeyaw (progs_t *pr, void *data) { edict_t *ent; float ideal, current, move, speed; @@ -1114,7 +1114,7 @@ Write_GetClient (progs_t *pr) // void (float to, ...) WriteBytes static void -PF_WriteBytes (progs_t *pr) +PF_WriteBytes (progs_t *pr, void *data) { int i, p; byte buf[PR_MAX_PARAMS]; @@ -1158,7 +1158,7 @@ PF_WriteBytes (progs_t *pr) // void (float to, float f) WriteByte static void -PF_WriteByte (progs_t *pr) +PF_WriteByte (progs_t *pr, void *data) { if (P_FLOAT (pr, 0) == MSG_ONE) { client_t *cl = Write_GetClient (pr); @@ -1178,7 +1178,7 @@ PF_WriteByte (progs_t *pr) // void (float to, float f) WriteChar static void -PF_WriteChar (progs_t *pr) +PF_WriteChar (progs_t *pr, void *data) { if (P_FLOAT (pr, 0) == MSG_ONE) { client_t *cl = Write_GetClient (pr); @@ -1198,7 +1198,7 @@ PF_WriteChar (progs_t *pr) // void (float to, float f) WriteShort static void -PF_WriteShort (progs_t *pr) +PF_WriteShort (progs_t *pr, void *data) { if (P_FLOAT (pr, 0) == MSG_ONE) { client_t *cl = Write_GetClient (pr); @@ -1218,7 +1218,7 @@ PF_WriteShort (progs_t *pr) // void (float to, float f) WriteLong static void -PF_WriteLong (progs_t *pr) +PF_WriteLong (progs_t *pr, void *data) { if (P_FLOAT (pr, 0) == MSG_ONE) { client_t *cl = Write_GetClient (pr); @@ -1238,7 +1238,7 @@ PF_WriteLong (progs_t *pr) // void (float to, float f) WriteAngle static void -PF_WriteAngle (progs_t *pr) +PF_WriteAngle (progs_t *pr, void *data) { if (P_FLOAT (pr, 0) == MSG_ONE) { client_t *cl = Write_GetClient (pr); @@ -1258,7 +1258,7 @@ PF_WriteAngle (progs_t *pr) // void (float to, float f) WriteCoord static void -PF_WriteCoord (progs_t *pr) +PF_WriteCoord (progs_t *pr, void *data) { if (P_FLOAT (pr, 0) == MSG_ONE) { client_t *cl = Write_GetClient (pr); @@ -1278,7 +1278,7 @@ PF_WriteCoord (progs_t *pr) // void (float to, vector v) WriteAngleV static void -PF_WriteAngleV (progs_t *pr) +PF_WriteAngleV (progs_t *pr, void *data) { float *ang = P_VECTOR (pr, 1); @@ -1300,7 +1300,7 @@ PF_WriteAngleV (progs_t *pr) // void (float to, vector v) WriteCoordV static void -PF_WriteCoordV (progs_t *pr) +PF_WriteCoordV (progs_t *pr, void *data) { float *coord = P_VECTOR (pr, 1); @@ -1322,7 +1322,7 @@ PF_WriteCoordV (progs_t *pr) // void (float to, string s) WriteString static void -PF_WriteString (progs_t *pr) +PF_WriteString (progs_t *pr, void *data) { const char *str = P_GSTRING (pr, 1); @@ -1344,7 +1344,7 @@ PF_WriteString (progs_t *pr) // void (float to, entity s) WriteEntity static void -PF_WriteEntity (progs_t *pr) +PF_WriteEntity (progs_t *pr, void *data) { int ent = P_EDICTNUM (pr, 1); @@ -1366,7 +1366,7 @@ PF_WriteEntity (progs_t *pr) // void (entity e) makestatic static void -PF_makestatic (progs_t *pr) +PF_makestatic (progs_t *pr, void *data) { const char *model; edict_t *ent; @@ -1394,7 +1394,7 @@ PF_makestatic (progs_t *pr) // void (entity e) setspawnparms static void -PF_setspawnparms (progs_t *pr) +PF_setspawnparms (progs_t *pr, void *data) { client_t *client; edict_t *ent; @@ -1417,7 +1417,7 @@ PF_setspawnparms (progs_t *pr) // void (string s) changelevel static void -PF_changelevel (progs_t *pr) +PF_changelevel (progs_t *pr, void *data) { const char *s; static int last_spawncount; @@ -1438,7 +1438,7 @@ PF_changelevel (progs_t *pr) // void (entity killer, entity killee) logfrag */ static void -PF_logfrag (progs_t *pr) +PF_logfrag (progs_t *pr, void *data) { const char *s; edict_t *ent1, *ent2; @@ -1500,7 +1500,7 @@ PF_logfrag (progs_t *pr) // string (entity e, string key) infokey */ static void -PF_infokey (progs_t *pr) +PF_infokey (progs_t *pr, void *data) { const char *key, *value; edict_t *e; @@ -1544,7 +1544,7 @@ PF_infokey (progs_t *pr) // void (vector where, float set) multicast */ static void -PF_multicast (progs_t *pr) +PF_multicast (progs_t *pr, void *data) { float *o; int to; @@ -1562,7 +1562,7 @@ PF_multicast (progs_t *pr) // float (string path, string mode) cfopen */ static void -PF_cfopen (progs_t *pr) +PF_cfopen (progs_t *pr, void *data) { R_FLOAT (pr) = CF_Open (P_GSTRING (pr, 0), P_GSTRING (pr, 1)); } @@ -1574,7 +1574,7 @@ PF_cfopen (progs_t *pr) // void (float desc) cfclose */ static void -PF_cfclose (progs_t *pr) +PF_cfclose (progs_t *pr, void *data) { CF_Close ((int) P_FLOAT (pr, 0)); } @@ -1586,7 +1586,7 @@ PF_cfclose (progs_t *pr) // string (float desc) cfread */ static void -PF_cfread (progs_t *pr) +PF_cfread (progs_t *pr, void *data) { RETURN_STRING (pr, CF_Read ((int) P_FLOAT (pr, 0))); } @@ -1598,7 +1598,7 @@ PF_cfread (progs_t *pr) // float (float desc, string buf) cfwrite */ static void -PF_cfwrite (progs_t *pr) +PF_cfwrite (progs_t *pr, void *data) { R_FLOAT (pr) = CF_Write ((int) P_FLOAT (pr, 0), P_GSTRING (pr, 1)); } @@ -1610,7 +1610,7 @@ PF_cfwrite (progs_t *pr) // float (float desc) cfeof */ static void -PF_cfeof (progs_t *pr) +PF_cfeof (progs_t *pr, void *data) { R_FLOAT (pr) = CF_EOF ((int) P_FLOAT (pr, 0)); } @@ -1622,14 +1622,14 @@ PF_cfeof (progs_t *pr) // float () cfquota */ static void -PF_cfquota (progs_t *pr) +PF_cfquota (progs_t *pr, void *data) { R_FLOAT (pr) = CF_Quota (); } // void (entity ent, string key, string value) setinfokey static void -PF_setinfokey (progs_t *pr) +PF_setinfokey (progs_t *pr, void *data) { edict_t *edict = P_EDICT (pr, 0); int e1 = NUM_FOR_EDICT (pr, edict); @@ -1645,7 +1645,7 @@ PF_setinfokey (progs_t *pr) // entity (entity ent) testentitypos static void -PF_testentitypos (progs_t *pr) +PF_testentitypos (progs_t *pr, void *data) { edict_t *ent = P_EDICT (pr, 0); ent = SV_TestEntityPosition (ent); @@ -1657,7 +1657,7 @@ clip_hull_t *pf_hull_list[MAX_PF_HULLS]; // int (entity ent, vector point) hullpointcontents static void -PF_hullpointcontents (progs_t *pr) +PF_hullpointcontents (progs_t *pr, void *data) { edict_t *edict = P_EDICT (pr, 0); float *mins = P_VECTOR (pr, 1); @@ -1673,7 +1673,7 @@ PF_hullpointcontents (progs_t *pr) // vector (int hull, int max) getboxbounds static void -PF_getboxbounds (progs_t *pr) +PF_getboxbounds (progs_t *pr, void *data) { clip_hull_t *ch; int h = P_INT (pr, 0) - 1; @@ -1690,7 +1690,7 @@ PF_getboxbounds (progs_t *pr) // int () getboxhull static void -PF_getboxhull (progs_t *pr) +PF_getboxhull (progs_t *pr, void *data) { clip_hull_t *ch = 0; int i; @@ -1715,7 +1715,7 @@ PF_getboxhull (progs_t *pr) // void (int hull) freeboxhull static void -PF_freeboxhull (progs_t *pr) +PF_freeboxhull (progs_t *pr, void *data) { int h = P_INT (pr, 0) - 1; clip_hull_t *ch; @@ -1745,7 +1745,7 @@ calc_dist (vec3_t p, vec3_t n, vec3_t *offsets) // void (int hull, vector right, vector forward, vector up, vector mins, vector maxs) rotate_bbox static void -PF_rotate_bbox (progs_t *pr) +PF_rotate_bbox (progs_t *pr, void *data) { clip_hull_t *ch; float l; @@ -1824,13 +1824,13 @@ PF_rotate_bbox (progs_t *pr) // float () checkextension static void -PF_checkextension (progs_t *pr) +PF_checkextension (progs_t *pr, void *data) { R_FLOAT (pr) = 0; // FIXME: make this function actually useful :P } static void -PF_sv_cvar (progs_t *pr) +PF_sv_cvar (progs_t *pr, void *data) { const char *str; @@ -1848,7 +1848,7 @@ PF_sv_cvar (progs_t *pr) // returns -1 if the entity is not a client (either not in the client range // or the entity is not in use by a client) static void -PF_SV_ClientNumber (progs_t *pr) +PF_SV_ClientNumber (progs_t *pr, void *data) { int entnum = P_EDICTNUM (pr, 0); client_t *cl = svs.clients + entnum - 1; @@ -1862,7 +1862,7 @@ PF_SV_ClientNumber (progs_t *pr) // entity () SV_AllocClient static void -PF_SV_AllocClient (progs_t *pr) +PF_SV_AllocClient (progs_t *pr, void *data) { client_t *cl = SV_AllocClient (0, 1); @@ -1880,7 +1880,7 @@ PF_SV_AllocClient (progs_t *pr) // void (entity cl) SV_FreeClient static void -PF_SV_FreeClient (progs_t *pr) +PF_SV_FreeClient (progs_t *pr, void *data) { int entnum = P_EDICTNUM (pr, 0); client_t *cl = svs.clients + entnum - 1; @@ -1901,7 +1901,7 @@ PF_SV_FreeClient (progs_t *pr) // void (entity cl, string userinfo) SV_SetUserinfo static void -PF_SV_SetUserinfo (progs_t *pr) +PF_SV_SetUserinfo (progs_t *pr, void *data) { int entnum = P_EDICTNUM (pr, 0); client_t *cl = svs.clients + entnum - 1; @@ -1917,7 +1917,7 @@ PF_SV_SetUserinfo (progs_t *pr) // void (entity cl, int ping) SV_SetPing static void -PF_SV_SetPing (progs_t *pr) +PF_SV_SetPing (progs_t *pr, void *data) { int entnum = P_EDICTNUM (pr, 0); client_t *cl = svs.clients + entnum - 1; @@ -1929,7 +1929,7 @@ PF_SV_SetPing (progs_t *pr) // void (entity cl, float secs, vector angles, vector move, int buttons, int impulse) SV_UserCmd static void -PF_SV_UserCmd (progs_t *pr) +PF_SV_UserCmd (progs_t *pr, void *data) { usercmd_t ucmd; int entnum = P_EDICTNUM (pr, 0); @@ -1955,7 +1955,7 @@ PF_SV_UserCmd (progs_t *pr) // void (entity cl) SV_Spawn static void -PF_SV_Spawn (progs_t *pr) +PF_SV_Spawn (progs_t *pr, void *data) { int entnum = P_EDICTNUM (pr, 0); client_t *cl = svs.clients + entnum - 1; diff --git a/qw/source/sv_pr_cpqw.c b/qw/source/sv_pr_cpqw.c index 32e82e7b9..f75cddf98 100644 --- a/qw/source/sv_pr_cpqw.c +++ b/qw/source/sv_pr_cpqw.c @@ -54,7 +54,7 @@ static struct { float(entity client) getuid */ static void -PF_getuid (progs_t *pr) +PF_getuid (progs_t *pr, void *data) { edict_t *client_ent; int e_num; @@ -76,7 +76,7 @@ PF_getuid (progs_t *pr) string(string st1, string st2) strcat */ static void -PF_strcat (progs_t *pr) +PF_strcat (progs_t *pr, void *data) { const char *st1 = P_GSTRING (pr, 0); const char *st2 = P_GSTRING (pr, 1); @@ -90,7 +90,7 @@ PF_strcat (progs_t *pr) string(string st, float len) padstr */ static void -PF_padstr (progs_t *pr) +PF_padstr (progs_t *pr, void *data) { const char *st; size_t i, padlen, givenlen; @@ -133,7 +133,7 @@ PF_padstr (progs_t *pr) // non-original charsets) static void -PF_colstr (progs_t *pr) +PF_colstr (progs_t *pr, void *data) { const char *srcstr; unsigned char *result; @@ -226,7 +226,7 @@ PF_colstr (progs_t *pr) float(string st1, string st2) strcasecmp */ static void -PF_strcasecmp (progs_t *pr) +PF_strcasecmp (progs_t *pr, void *data) { const char *st1; const char *st2; @@ -244,7 +244,7 @@ PF_strcasecmp (progs_t *pr) */ static void -PF_strlen (progs_t *pr) +PF_strlen (progs_t *pr, void *data) { const char *st; @@ -313,7 +313,7 @@ KK_Match_Str2 (const char *substr) entity(string st) getclient */ static void -PF_getclient (progs_t *pr) +PF_getclient (progs_t *pr, void *data) { edict_t *ent; const char *st; @@ -353,7 +353,7 @@ float(entity client) mutedtime */ static void -PF_mutedtime (progs_t *pr) +PF_mutedtime (progs_t *pr, void *data) { edict_t *client_ent; int e_num; @@ -382,7 +382,7 @@ float(string st) validatefile */ static void -PF_validatefile (progs_t *pr) +PF_validatefile (progs_t *pr, void *data) { float retval; QFile *f; @@ -410,7 +410,7 @@ PF_validatefile (progs_t *pr) extern int fp_messages, fp_persecond, fp_secondsdead; static void -PF_putsaytime (progs_t *pr) +PF_putsaytime (progs_t *pr, void *data) { edict_t *client_ent; int e_num, tmp; @@ -444,7 +444,7 @@ PF_putsaytime (progs_t *pr) */ static void -PF_makestr (progs_t *pr) +PF_makestr (progs_t *pr, void *data) { pr_string_t res = PR_NewMutableString (pr); dstring_t *dst = PR_GetMutableString (pr, res); @@ -461,7 +461,7 @@ PF_makestr (progs_t *pr) */ static void -PF_delstr (progs_t *pr) +PF_delstr (progs_t *pr, void *data) { PR_FreeString (pr, P_STRING (pr, 0)); } @@ -548,7 +548,7 @@ GetLinearWave (float inputnum) #define GWAVE_USESHAPE 8 static void -PF_getwave (progs_t *pr) +PF_getwave (progs_t *pr, void *data) { float retval, inputnum, minnum, maxnum, balance, offset, shape; float temp; @@ -625,7 +625,7 @@ PF_getwave (progs_t *pr) */ static void -PF_clientsound (progs_t *pr) +PF_clientsound (progs_t *pr, void *data) { const char *sample; int channel; @@ -700,7 +700,7 @@ PF_clientsound (progs_t *pr) */ static void -PF_touchworld (progs_t *pr) +PF_touchworld (progs_t *pr, void *data) { edict_t *self; pr_int_t oself; @@ -729,7 +729,7 @@ PF_touchworld (progs_t *pr) #define TL_EVERYTHING 4 // scan for anything static void -PF_traceline (progs_t *pr) +PF_traceline (progs_t *pr, void *data) { float *v1, *v2; edict_t *ent; diff --git a/qw/source/sv_pr_qwe.c b/qw/source/sv_pr_qwe.c index eb7322800..329cea360 100644 --- a/qw/source/sv_pr_qwe.c +++ b/qw/source/sv_pr_qwe.c @@ -64,7 +64,7 @@ typedef struct { static qwe_funcs_t qwe_funcs; static void -PF_executecmd (progs_t *pr) +PF_executecmd (progs_t *pr, void *data) { int old_other, old_self; // mod_consolecmd will be executed, so // we need to store these @@ -87,7 +87,7 @@ PF_executecmd (progs_t *pr) */ static void -PF_tokanize (progs_t *pr) +PF_tokanize (progs_t *pr, void *data) { const char *str; @@ -105,7 +105,7 @@ PF_tokanize (progs_t *pr) */ static void -PF_argc (progs_t *pr) +PF_argc (progs_t *pr, void *data) { R_FLOAT (pr) = (float) Cmd_Argc (); } @@ -119,7 +119,7 @@ PF_argc (progs_t *pr) */ static void -PF_argv (progs_t *pr) +PF_argv (progs_t *pr, void *data) { int num; @@ -140,7 +140,7 @@ PF_argv (progs_t *pr) */ static void -PF_teamfield (progs_t *pr) +PF_teamfield (progs_t *pr, void *data) { sv_fields.team_str = P_INT (pr, 0); } @@ -152,7 +152,7 @@ PF_teamfield (progs_t *pr) */ static void -PF_substr (progs_t *pr) +PF_substr (progs_t *pr, void *data) { const char *s; char *tmp; @@ -188,7 +188,7 @@ PF_substr (progs_t *pr) */ static void -PF_strcat (progs_t *pr) +PF_strcat (progs_t *pr, void *data) { RETURN_STRING (pr, PF_VarString (pr, 0, pr->pr_argc)); } @@ -200,7 +200,7 @@ PF_strcat (progs_t *pr) */ static void -PF_strlen (progs_t *pr) +PF_strlen (progs_t *pr, void *data) { R_FLOAT (pr) = (float) strlen (P_GSTRING (pr, 0)); } @@ -212,7 +212,7 @@ PF_strlen (progs_t *pr) */ static void -PF_str2byte (progs_t *pr) +PF_str2byte (progs_t *pr, void *data) { R_FLOAT (pr) = (float) *P_GSTRING (pr, 0); } @@ -224,7 +224,7 @@ PF_str2byte (progs_t *pr) */ static void -PF_str2short (progs_t *pr) +PF_str2short (progs_t *pr, void *data) { const byte *str = (byte *) P_GSTRING (pr, 0); @@ -239,7 +239,7 @@ PF_str2short (progs_t *pr) The new string will be at least as big as size, if given. */ static void -PF_newstr (progs_t *pr) +PF_newstr (progs_t *pr, void *data) { const char *s; dstring_t *dstr; @@ -269,7 +269,7 @@ PF_newstr (progs_t *pr) */ static void -PF_freestr (progs_t *pr) +PF_freestr (progs_t *pr, void *data) { PR_FreeString (pr, P_STRING (pr, 0)); } @@ -281,7 +281,7 @@ PF_freestr (progs_t *pr) */ static void -PF_readcmd (progs_t *pr) +PF_readcmd (progs_t *pr, void *data) { const char *s; redirect_t old; @@ -311,7 +311,7 @@ PF_readcmd (progs_t *pr) */ static void -PF_redirectcmd (progs_t *pr) +PF_redirectcmd (progs_t *pr, void *data) { const char *s; int entnum; @@ -334,7 +334,7 @@ PF_redirectcmd (progs_t *pr) } static void -PF_calltimeofday (progs_t *pr) +PF_calltimeofday (progs_t *pr, void *data) { date_t date; dfunction_t *f; @@ -368,7 +368,7 @@ PF_calltimeofday (progs_t *pr) */ static void -PF_forcedemoframe (progs_t *pr) +PF_forcedemoframe (progs_t *pr, void *data) { SVR_ForceFrame (); if (P_FLOAT (pr, 0) == 1) @@ -383,7 +383,7 @@ PF_forcedemoframe (progs_t *pr) */ static void -PF_strcpy (progs_t *pr) +PF_strcpy (progs_t *pr, void *data) { dstring_copystr (P_DSTRING (pr, 0), P_GSTRING (pr, 1)); } @@ -395,7 +395,7 @@ PF_strcpy (progs_t *pr) */ static void -PF_strncpy (progs_t *pr) +PF_strncpy (progs_t *pr, void *data) { dstring_t *dst = P_DSTRING (pr, 0); const char *src = P_GSTRING (pr, 1); @@ -414,7 +414,7 @@ PF_strncpy (progs_t *pr) */ static void -PF_strstr (progs_t *pr) +PF_strstr (progs_t *pr, void *data) { const char *str, *sub, *p; @@ -445,7 +445,7 @@ clean_text (char *text) */ static void -PF_log (progs_t *pr) +PF_log (progs_t *pr, void *data) { const char *name; char *text; @@ -473,7 +473,7 @@ PF_log (progs_t *pr) PF_conprint */ static void -PF_conprint (progs_t *pr) +PF_conprint (progs_t *pr, void *data) { Sys_Printf ("%s", PF_VarString (pr, 0, pr->pr_argc)); } diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 126c84ef8..0e10bec27 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -1422,7 +1422,7 @@ SV_RemoveUserCommand (void *cmd) } static void -PF_SV_AddUserCommand (progs_t *pr) +PF_SV_AddUserCommand (progs_t *pr, void *data) { const char *name = P_GSTRING (pr, 0); ucmd_t *cmd; diff --git a/ruamoko/qwaq/builtins/curses.c b/ruamoko/qwaq/builtins/curses.c index 504939543..e82b37a5f 100644 --- a/ruamoko/qwaq/builtins/curses.c +++ b/ruamoko/qwaq/builtins/curses.c @@ -762,9 +762,9 @@ bi_shutdown (void *_pr) } static void -bi_syncprintf (progs_t *pr) +bi_syncprintf (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int string_id = qwaq_pipe_acquire_string (&res->commands); dstring_t *print_buffer = qwaq_cmd_string (res, string_id); int command[] = { qwaq_cmd_syncprint, 0, string_id }; @@ -778,9 +778,9 @@ bi_syncprintf (progs_t *pr) } static void -bi_create_window (progs_t *pr) +bi_create_window (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int xpos = P_INT (pr, 0); int ypos = P_INT (pr, 1); int xlen = P_INT (pr, 2); @@ -799,9 +799,9 @@ bi_create_window (progs_t *pr) } static void -bi_destroy_window (progs_t *pr) +bi_destroy_window (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); if (get_window (res, __FUNCTION__, window_id)) { @@ -812,9 +812,9 @@ bi_destroy_window (progs_t *pr) } static void -qwaq_getwrect (progs_t *pr, int window_id) +qwaq_getwrect (qwaq_resources_t *res, int window_id) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + progs_t *pr = res->pr; if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_getwrect, 0, window_id, }; @@ -832,15 +832,16 @@ qwaq_getwrect (progs_t *pr, int window_id) } } static void -bi_getwrect (progs_t *pr) +bi_getwrect (progs_t *pr, void *_res) { - qwaq_getwrect (pr, P_INT (pr, 0)); + qwaq_resources_t *res = _res; + qwaq_getwrect (res, P_INT (pr, 0)); } static void -bi_create_panel (progs_t *pr) +bi_create_panel (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); if (get_window (res, __FUNCTION__, window_id)) { @@ -856,9 +857,8 @@ bi_create_panel (progs_t *pr) } static void -panel_command (progs_t *pr, qwaq_commands cmd) +panel_command (progs_t *pr, qwaq_resources_t *res, qwaq_commands cmd) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); int panel_id = P_INT (pr, 0); if (get_panel (res, __FUNCTION__, panel_id)) { @@ -869,39 +869,44 @@ panel_command (progs_t *pr, qwaq_commands cmd) } static void -bi_destroy_panel (progs_t *pr) +bi_destroy_panel (progs_t *pr, void *_res) { - panel_command (pr, qwaq_cmd_del_panel); + qwaq_resources_t *res = _res; + panel_command (pr, res, qwaq_cmd_del_panel); } static void -bi_hide_panel (progs_t *pr) +bi_hide_panel (progs_t *pr, void *_res) { - panel_command (pr, qwaq_cmd_hide_panel); + qwaq_resources_t *res = _res; + panel_command (pr, res, qwaq_cmd_hide_panel); } static void -bi_show_panel (progs_t *pr) +bi_show_panel (progs_t *pr, void *_res) { - panel_command (pr, qwaq_cmd_show_panel); + qwaq_resources_t *res = _res; + panel_command (pr, res, qwaq_cmd_show_panel); } static void -bi_top_panel (progs_t *pr) +bi_top_panel (progs_t *pr, void *_res) { - panel_command (pr, qwaq_cmd_top_panel); + qwaq_resources_t *res = _res; + panel_command (pr, res, qwaq_cmd_top_panel); } static void -bi_bottom_panel (progs_t *pr) +bi_bottom_panel (progs_t *pr, void *_res) { - panel_command (pr, qwaq_cmd_bottom_panel); + qwaq_resources_t *res = _res; + panel_command (pr, res, qwaq_cmd_bottom_panel); } static void -bi_move_panel (progs_t *pr) +bi_move_panel (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int panel_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); @@ -914,9 +919,9 @@ bi_move_panel (progs_t *pr) } static void -bi_panel_window (progs_t *pr) +bi_panel_window (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int panel_id = P_INT (pr, 0); if (get_panel (res, __FUNCTION__, panel_id)) { @@ -932,9 +937,9 @@ bi_panel_window (progs_t *pr) } static void -bi_replace_panel (progs_t *pr) +bi_replace_panel (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int panel_id = P_INT (pr, 0); int window_id = P_INT (pr, 1); @@ -948,40 +953,40 @@ bi_replace_panel (progs_t *pr) } static void -qwaq_update_panels (progs_t *pr) +qwaq_update_panels (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int command[] = { qwaq_cmd_update_panels, 0, }; command[1] = CMD_SIZE(command); qwaq_pipe_submit (&res->commands, command, command[1]); } static void -bi_update_panels (progs_t *pr) +bi_update_panels (progs_t *pr, void *_res) { - qwaq_update_panels (pr); + qwaq_resources_t *res = _res; + qwaq_update_panels (pr, res); } static void -qwaq_doupdate (progs_t *pr) +qwaq_doupdate (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; int command[] = { qwaq_cmd_doupdate, 0, }; command[1] = CMD_SIZE(command); qwaq_pipe_submit (&res->commands, command, command[1]); } static void -bi_doupdate (progs_t *pr) +bi_doupdate (progs_t *pr, void *_res) { - qwaq_doupdate (pr); + qwaq_resources_t *res = _res; + qwaq_doupdate (pr, res); } static void -qwaq_waddstr (progs_t *pr, int window_id, const char *str) +qwaq_waddstr (qwaq_resources_t *res, int window_id, const char *str) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int string_id = qwaq_pipe_acquire_string (&res->commands); dstring_t *print_buffer = qwaq_cmd_string (res, string_id); @@ -997,19 +1002,18 @@ qwaq_waddstr (progs_t *pr, int window_id, const char *str) } } static void -bi_waddstr (progs_t *pr) +bi_waddstr (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); const char *str = P_GSTRING (pr, 1); - qwaq_waddstr (pr, window_id, str); + qwaq_waddstr (res, window_id, str); } static void -qwaq_wresize (progs_t *pr, int window_id, int width, int height) +qwaq_wresize (qwaq_resources_t *res, int window_id, int width, int height) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_wresize, 0, @@ -1021,39 +1025,38 @@ qwaq_wresize (progs_t *pr, int window_id, int width, int height) } } static void -bi_wresize (progs_t *pr) +bi_wresize (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; int width = P_INT (pr, 1); int height = P_INT (pr, 2); - qwaq_wresize (pr, window_id, width, height); + qwaq_wresize (res, window_id, width, height); } static void -qwaq_resizeterm (progs_t *pr, int width, int height) +qwaq_resizeterm (qwaq_resources_t *res, int width, int height) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - int command[] = { qwaq_cmd_resizeterm, 0, width, height }; command[1] = CMD_SIZE(command); qwaq_pipe_submit (&res->commands, command, command[1]); } static void -bi_resizeterm (progs_t *pr) +bi_resizeterm (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int width = P_INT (pr, 0); int height = P_INT (pr, 1); - qwaq_resizeterm (pr, width, height); + qwaq_resizeterm (res, width, height); } static void -qwaq_mvwhline (progs_t *pr, int window_id, int x, int y, int ch, int n) +qwaq_mvwhline (qwaq_resources_t *res, int window_id, + int x, int y, int ch, int n) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_mvwhline, 0, @@ -1065,22 +1068,22 @@ qwaq_mvwhline (progs_t *pr, int window_id, int x, int y, int ch, int n) } } static void -bi_mvwhline (progs_t *pr) +bi_mvwhline (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; int x = P_INT (pr, 1); int y = P_INT (pr, 2); int ch = P_INT (pr, 3); int n = P_INT (pr, 4); - qwaq_mvwhline (pr, window_id, x, y, ch, n); + qwaq_mvwhline (res, window_id, x, y, ch, n); } static void -qwaq_mvwvline (progs_t *pr, int window_id, int x, int y, int ch, int n) +qwaq_mvwvline (qwaq_resources_t *res, int window_id, + int x, int y, int ch, int n) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_mvwvline, 0, @@ -1092,22 +1095,22 @@ qwaq_mvwvline (progs_t *pr, int window_id, int x, int y, int ch, int n) } } static void -bi_mvwvline (progs_t *pr) +bi_mvwvline (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; int x = P_INT (pr, 1); int y = P_INT (pr, 2); int ch = P_INT (pr, 3); int n = P_INT (pr, 4); - qwaq_mvwvline (pr, window_id, x, y, ch, n); + qwaq_mvwvline (res, window_id, x, y, ch, n); } static void -qwaq_mvwaddstr (progs_t *pr, int window_id, int x, int y, const char *str) +qwaq_mvwaddstr (qwaq_resources_t *res, int window_id, + int x, int y, const char *str) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int string_id = qwaq_pipe_acquire_string (&res->commands); dstring_t *print_buffer = qwaq_cmd_string (res, string_id); @@ -1123,20 +1126,22 @@ qwaq_mvwaddstr (progs_t *pr, int window_id, int x, int y, const char *str) } } static void -bi_mvwaddstr (progs_t *pr) +bi_mvwaddstr (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); const char *str = P_GSTRING (pr, 3); - qwaq_mvwaddstr (pr, window_id, x, y, str); + qwaq_mvwaddstr (res, window_id, x, y, str); } static void -qwaq_mvwprintf (progs_t *pr, int window_id, int x, int y, int fmt_arg) +qwaq_mvwprintf (qwaq_resources_t *res, int window_id, + int x, int y, int fmt_arg) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + progs_t *pr = res->pr; if (get_window (res, __FUNCTION__, window_id)) { int string_id = qwaq_pipe_acquire_string (&res->commands); @@ -1155,19 +1160,20 @@ qwaq_mvwprintf (progs_t *pr, int window_id, int x, int y, int fmt_arg) } } static void -bi_mvwprintf (progs_t *pr) +bi_mvwprintf (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); - qwaq_mvwprintf (pr, window_id, x, y, 3); + qwaq_mvwprintf (res, window_id, x, y, 3); } static void -qwaq_wprintf (progs_t *pr, int window_id, int fmt_arg) +qwaq_wprintf (qwaq_resources_t *res, int window_id, int fmt_arg) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + progs_t *pr = res->pr; if (get_window (res, __FUNCTION__, window_id)) { int string_id = qwaq_pipe_acquire_string (&res->commands); @@ -1186,17 +1192,19 @@ qwaq_wprintf (progs_t *pr, int window_id, int fmt_arg) } } static void -bi_wprintf (progs_t *pr) +bi_wprintf (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); - qwaq_wprintf (pr, window_id, 1); + qwaq_wprintf (res, window_id, 1); } static void -qwaq_wvprintf (progs_t *pr, int window_id, const char *fmt, pr_va_list_t *args) +qwaq_wvprintf (qwaq_resources_t *res, int window_id, + const char *fmt, pr_va_list_t *args) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + progs_t *pr = res->pr; pr_type_t *list_start = PR_GetPointer (pr, args->list); pr_type_t **list = alloca (args->count * sizeof (*list)); @@ -1221,20 +1229,19 @@ qwaq_wvprintf (progs_t *pr, int window_id, const char *fmt, pr_va_list_t *args) } } static void -bi_wvprintf (progs_t *pr) +bi_wvprintf (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); const char *fmt = P_GSTRING (pr, 1); __auto_type args = (pr_va_list_t *) &P_POINTER (pr, 2); - qwaq_wvprintf (pr, window_id, fmt, args); + qwaq_wvprintf (res, window_id, fmt, args); } static void -qwaq_waddch (progs_t *pr, int window_id, int ch) +qwaq_waddch (qwaq_resources_t *res, int window_id, int ch) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_waddch, 0, window_id, ch }; @@ -1243,19 +1250,20 @@ qwaq_waddch (progs_t *pr, int window_id, int ch) } } static void -bi_waddch (progs_t *pr) +bi_waddch (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int ch = P_INT (pr, 0); - qwaq_waddch (pr, window_id, ch); + qwaq_waddch (res, window_id, ch); } static void -qwaq_mvwvprintf (progs_t *pr, int window_id, int x, int y, +qwaq_mvwvprintf (qwaq_resources_t *res, int window_id, int x, int y, const char *fmt, pr_va_list_t *args) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + progs_t *pr = res->pr; pr_type_t *list_start = PR_GetPointer (pr, args->list); pr_type_t **list = alloca (args->count * sizeof (*list)); @@ -1280,22 +1288,21 @@ qwaq_mvwvprintf (progs_t *pr, int window_id, int x, int y, } } static void -bi_mvwvprintf (progs_t *pr) +bi_mvwvprintf (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); const char *fmt = P_GSTRING (pr, 2); __auto_type args = (pr_va_list_t *) &P_POINTER (pr, 3); - qwaq_mvwvprintf (pr, window_id, x, y, fmt, args); + qwaq_mvwvprintf (res, window_id, x, y, fmt, args); } static void -qwaq_mvwaddch (progs_t *pr, int window_id, int x, int y, int ch) +qwaq_mvwaddch (qwaq_resources_t *res, int window_id, int x, int y, int ch) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_mvwaddch, 0, @@ -1306,21 +1313,20 @@ qwaq_mvwaddch (progs_t *pr, int window_id, int x, int y, int ch) } } static void -bi_mvwaddch (progs_t *pr) +bi_mvwaddch (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); int ch = P_INT (pr, 3); - qwaq_mvwaddch (pr, window_id, x, y, ch); + qwaq_mvwaddch (res, window_id, x, y, ch); } static void -qwaq_wrefresh (progs_t *pr, int window_id) +qwaq_wrefresh (qwaq_resources_t *res, int window_id) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_wrefresh, 0, window_id, }; command[1] = CMD_SIZE(command); @@ -1328,49 +1334,48 @@ qwaq_wrefresh (progs_t *pr, int window_id) } } static void -bi_wrefresh (progs_t *pr) +bi_wrefresh (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); - qwaq_wrefresh (pr, window_id); + qwaq_wrefresh (res, window_id); } static void -bi_max_colors (progs_t *pr) +bi_max_colors (progs_t *pr, void *_res) { R_INT (pr) = COLORS; } static void -bi_max_color_pairs (progs_t *pr) +bi_max_color_pairs (progs_t *pr, void *_res) { R_INT (pr) = COLOR_PAIRS; } static void -qwaq_init_pair (progs_t *pr, int pair, int f, int b) +qwaq_init_pair (qwaq_resources_t *res, int pair, int f, int b) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); int command[] = { qwaq_cmd_init_pair, 0, pair, f, b, }; command[1] = CMD_SIZE(command); qwaq_pipe_submit (&res->commands, command, command[1]); } static void -bi_init_pair (progs_t *pr) +bi_init_pair (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int pair = P_INT (pr, 0); int f = P_INT (pr, 1); int b = P_INT (pr, 2); - qwaq_init_pair (pr, pair, f, b); + qwaq_init_pair (res, pair, f, b); } static void -qwaq_wbkgd (progs_t *pr, int window_id, int ch) +qwaq_wbkgd (qwaq_resources_t *res, int window_id, int ch) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_wbkgd, 0, window_id, ch, }; command[1] = CMD_SIZE(command); @@ -1378,19 +1383,18 @@ qwaq_wbkgd (progs_t *pr, int window_id, int ch) } } static void -bi_wbkgd (progs_t *pr) +bi_wbkgd (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int ch = P_INT (pr, 1); - qwaq_wbkgd (pr, window_id, ch); + qwaq_wbkgd (res, window_id, ch); } static void -qwaq_werase (progs_t *pr, int window_id, int ch) +qwaq_werase (qwaq_resources_t *res, int window_id, int ch) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_werase, 0, window_id, }; command[1] = CMD_SIZE(command); @@ -1398,19 +1402,18 @@ qwaq_werase (progs_t *pr, int window_id, int ch) } } static void -bi_werase (progs_t *pr) +bi_werase (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int ch = P_INT (pr, 1); - qwaq_werase (pr, window_id, ch); + qwaq_werase (res, window_id, ch); } static void -qwaq_scrollok (progs_t *pr, int window_id, int flag) +qwaq_scrollok (qwaq_resources_t *res, int window_id, int flag) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_scrollok, 0, window_id, flag, }; command[1] = CMD_SIZE(command); @@ -1418,19 +1421,18 @@ qwaq_scrollok (progs_t *pr, int window_id, int flag) } } static void -bi_scrollok (progs_t *pr) +bi_scrollok (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int flag = P_INT (pr, 1); - qwaq_scrollok (pr, window_id, flag); + qwaq_scrollok (res, window_id, flag); } static void -qwaq_wmove (progs_t *pr, int window_id, int x, int y) +qwaq_wmove (qwaq_resources_t *res, int window_id, int x, int y) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_wmove, 0, window_id, x, y, }; command[1] = CMD_SIZE(command); @@ -1438,13 +1440,14 @@ qwaq_wmove (progs_t *pr, int window_id, int x, int y) } } static void -bi_wmove (progs_t *pr) +bi_wmove (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); - qwaq_wmove (pr, window_id, x, y); + qwaq_wmove (res, window_id, x, y); } static const char qwaq_acs_char_map[] = "lmkjtuvwqxnos`afg~,+.-hi0pryz{|}"; @@ -1460,7 +1463,7 @@ qwaq_acs_char (progs_t *pr, unsigned acs) } } static void -bi_acs_char (progs_t *pr) +bi_acs_char (progs_t *pr, void *_res) { int acs = P_INT (pr, 0); @@ -1468,46 +1471,42 @@ bi_acs_char (progs_t *pr) } static void -qwaq_move (progs_t *pr, int x, int y) +qwaq_move (qwaq_resources_t *res, int x, int y) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - int command[] = { qwaq_cmd_move, 0, x, y, }; command[1] = CMD_SIZE(command); qwaq_pipe_submit (&res->commands, command, command[1]); } static void -bi_move (progs_t *pr) +bi_move (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int x = P_INT (pr, 0); int y = P_INT (pr, 1); - qwaq_move (pr, x, y); + qwaq_move (res, x, y); } static void -qwaq_curs_set (progs_t *pr, int visibility) +qwaq_curs_set (qwaq_resources_t *res, int visibility) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - int command[] = { qwaq_cmd_curs_set, 0, visibility, }; command[1] = CMD_SIZE(command); qwaq_pipe_submit (&res->commands, command, command[1]); } static void -bi_curs_set (progs_t *pr) +bi_curs_set (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int visibility = P_INT (pr, 0); - qwaq_curs_set (pr, visibility); + qwaq_curs_set (res, visibility); } static void -qwaq_wborder (progs_t *pr, int window_id, +qwaq_wborder (qwaq_resources_t *res, int window_id, box_sides_t sides, box_corners_t corns) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int command[] = { qwaq_cmd_wborder, 0, window_id, sides.ls, sides.rs, sides.ts, sides.bs, @@ -1517,21 +1516,20 @@ qwaq_wborder (progs_t *pr, int window_id, } } static void -bi_wborder (progs_t *pr) +bi_wborder (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); __auto_type sides = P_PACKED (pr, box_sides_t, 1); __auto_type corns = P_PACKED (pr, box_corners_t, 2); - qwaq_wborder (pr, window_id, sides, corns); + qwaq_wborder (res, window_id, sides, corns); } static void -qwaq__mvwblit_line (progs_t *pr, int window_id, int x, int y, +qwaq__mvwblit_line (qwaq_resources_t *res, int window_id, int x, int y, int *chs, int len) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); - if (get_window (res, __FUNCTION__, window_id)) { int chs_id = qwaq_pipe_acquire_string (&res->commands); dstring_t *chs_buf = qwaq_cmd_string (res, chs_id); @@ -1548,14 +1546,15 @@ qwaq__mvwblit_line (progs_t *pr, int window_id, int x, int y, } } static void -bi_mvwblit_line (progs_t *pr) +bi_mvwblit_line (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_INT (pr, 0); int x = P_INT (pr, 1); int y = P_INT (pr, 2); int *chs = (int *) P_GPOINTER (pr, 3); int len = P_INT (pr, 4); - qwaq__mvwblit_line (pr, window_id, x, y, chs, len); + qwaq__mvwblit_line (res, window_id, x, y, chs, len); } static void * @@ -1571,7 +1570,7 @@ qwaq_curses_thread (qwaq_thread_t *thread) } static void -bi_initialize (progs_t *pr) +bi_initialize (progs_t *pr, void *data) { qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); @@ -1595,36 +1594,39 @@ bi_initialize (progs_t *pr) } static void -bi__c_TextContext__is_initialized (progs_t *pr) +bi__c_TextContext__is_initialized (progs_t *pr, void *_res) { - qwaq_resources_t *res = PR_Resources_Find (pr, "curses"); + qwaq_resources_t *res = _res; R_INT (pr) = res->initialized; } static void -bi__c_TextContext__max_colors (progs_t *pr) +bi__c_TextContext__max_colors (progs_t *pr, void *_res) { - bi_max_colors (pr); + qwaq_resources_t *res = _res; + bi_max_colors (pr, res); } static void -bi__c_TextContext__max_color_pairs (progs_t *pr) +bi__c_TextContext__max_color_pairs (progs_t *pr, void *_res) { - bi_max_color_pairs (pr); + qwaq_resources_t *res = _res; + bi_max_color_pairs (pr, res); } static void -bi__c_TextContext__init_pair_ (progs_t *pr) +bi__c_TextContext__init_pair_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int pair = P_INT (pr, 2); int f = P_INT (pr, 3); int b = P_INT (pr, 4); - qwaq_init_pair (pr, pair, f, b); + qwaq_init_pair (res, pair, f, b); } static void -bi__c_TextContext__acs_char_ (progs_t *pr) +bi__c_TextContext__acs_char_ (progs_t *pr, void *_res) { int acs = P_INT (pr, 2); @@ -1632,203 +1634,223 @@ bi__c_TextContext__acs_char_ (progs_t *pr) } static void -bi__c_TextContext__move_ (progs_t *pr) +bi__c_TextContext__move_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; Point *pos = &P_PACKED (pr, Point, 2); - qwaq_move (pr, pos->x, pos->y); + qwaq_move (res, pos->x, pos->y); } static void -bi__c_TextContext__curs_set_ (progs_t *pr) +bi__c_TextContext__curs_set_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int visibility = P_INT (pr, 2); - qwaq_curs_set (pr, visibility); + qwaq_curs_set (res, visibility); } static void -bi__c_TextContext__doupdate (progs_t *pr) +bi__c_TextContext__doupdate (progs_t *pr, void *_res) { - bi_doupdate (pr); + qwaq_resources_t *res = _res; + bi_doupdate (pr, res); } static void -bi__i_TextContext__mvprintf_ (progs_t *pr) +bi__i_TextContext__mvprintf_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; Point *pos = &P_PACKED (pr, Point, 2); - qwaq_mvwprintf (pr, window_id, pos->x, pos->y, 3); + qwaq_mvwprintf (res, window_id, pos->x, pos->y, 3); } static void -bi__i_TextContext__printf_ (progs_t *pr) +bi__i_TextContext__printf_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; - qwaq_wprintf (pr, window_id, 2); + qwaq_wprintf (res, window_id, 2); } static void -bi__i_TextContext__vprintf_ (progs_t *pr) +bi__i_TextContext__vprintf_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; const char *fmt = P_GSTRING (pr, 2); __auto_type args = (pr_va_list_t *) &P_POINTER (pr, 3); - qwaq_wvprintf (pr, window_id, fmt, args); + qwaq_wvprintf (res, window_id, fmt, args); } static void -bi__i_TextContext__addch_ (progs_t *pr) +bi__i_TextContext__addch_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; int ch = P_INT (pr, 2); - qwaq_waddch (pr, window_id, ch); + qwaq_waddch (res, window_id, ch); } static void -bi__i_TextContext__addstr_ (progs_t *pr) +bi__i_TextContext__addstr_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; const char *str = P_GSTRING (pr, 2); - qwaq_waddstr (pr, window_id, str); + qwaq_waddstr (res, window_id, str); } static void -bi__i_TextContext__mvvprintf_ (progs_t *pr) +bi__i_TextContext__mvvprintf_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; Point *pos = &P_PACKED (pr, Point, 2); const char *fmt = P_GSTRING (pr, 3); __auto_type args = &P_PACKED (pr, pr_va_list_t, 4); - qwaq_mvwvprintf (pr, window_id, pos->x, pos->y, fmt, args); + qwaq_mvwvprintf (res, window_id, pos->x, pos->y, fmt, args); } static void -bi__i_TextContext__resizeTo_ (progs_t *pr) +bi__i_TextContext__resizeTo_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0); int window_id = self->window; self->size = P_PACKED (pr, Extent, 2); - qwaq_wresize (pr, window_id, self->size.width, self->size.height); + qwaq_wresize (res, window_id, self->size.width, self->size.height); if (window_id == 1) { - qwaq_wbkgd (pr, window_id, self->background); + qwaq_wbkgd (res, window_id, self->background); } } static void -bi__c_TextContext__refresh (progs_t *pr) +bi__c_TextContext__refresh (progs_t *pr, void *_res) { - qwaq_update_panels (pr); - qwaq_doupdate (pr); + qwaq_resources_t *res = _res; + qwaq_update_panels (pr, res); + qwaq_doupdate (pr, res); } static void -bi__i_TextContext__refresh (progs_t *pr) +bi__i_TextContext__refresh (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; - qwaq_update_panels (pr); + qwaq_update_panels (pr, res); if (window_id == 1) { - qwaq_wrefresh (pr, window_id); - qwaq_doupdate (pr); + qwaq_wrefresh (res, window_id); + qwaq_doupdate (pr, res); } } static void -bi__i_TextContext__mvaddch_ (progs_t *pr) +bi__i_TextContext__mvaddch_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; Point *pos = &P_PACKED (pr, Point, 2); int ch = P_INT (pr, 3); - qwaq_mvwaddch (pr, window_id, pos->x, pos->y, ch); + qwaq_mvwaddch (res, window_id, pos->x, pos->y, ch); } static void -bi__i_TextContext__mvaddstr_ (progs_t *pr) +bi__i_TextContext__mvaddstr_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; Point *pos = &P_PACKED (pr, Point, 2); const char *str = P_GSTRING (pr, 3); - qwaq_mvwaddstr (pr, window_id, pos->x, pos->y, str); + qwaq_mvwaddstr (res, window_id, pos->x, pos->y, str); } static void -bi__i_TextContext__bkgd_ (progs_t *pr) +bi__i_TextContext__bkgd_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0); int window_id = self->window; int ch = P_INT (pr, 2); self->background = ch; - qwaq_wbkgd (pr, window_id, ch); + qwaq_wbkgd (res, window_id, ch); } static void -bi__i_TextContext__clear (progs_t *pr) +bi__i_TextContext__clear (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0); int window_id = self->window; int ch = self->background; - qwaq_werase (pr, window_id, ch); + qwaq_werase (res, window_id, ch); } static void -bi__i_TextContext__scrollok_ (progs_t *pr) +bi__i_TextContext__scrollok_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; int flag = P_INT (pr, 2); - qwaq_scrollok (pr, window_id, flag); + qwaq_scrollok (res, window_id, flag); } static void -bi__i_TextContext__border_ (progs_t *pr) +bi__i_TextContext__border_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window; __auto_type sides = P_PACKED (pr, box_sides_t, 2); __auto_type corns = P_PACKED (pr, box_corners_t, 3); - qwaq_wborder (pr, window_id, sides, corns); + qwaq_wborder (res, window_id, sides, corns); } static void -bi__i_TextContext__mvhline_ (progs_t *pr) +bi__i_TextContext__mvhline_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0); int window_id = self->window; __auto_type pos = &P_PACKED (pr, Point, 2); int ch = P_INT (pr, 3); int n = P_INT (pr, 4); - qwaq_mvwhline (pr, window_id, pos->x, pos->y, ch, n); + qwaq_mvwhline (res, window_id, pos->x, pos->y, ch, n); } static void -bi__i_TextContext__mvvline_ (progs_t *pr) +bi__i_TextContext__mvvline_ (progs_t *pr, void *_res) { + qwaq_resources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0); int window_id = self->window; __auto_type pos = &P_PACKED (pr, Point, 2); int ch = P_INT (pr, 3); int n = P_INT (pr, 4); - qwaq_mvwvline (pr, window_id, pos->x, pos->y, ch, n); + qwaq_mvwvline (res, window_id, pos->x, pos->y, ch, n); } static void -bi_curses_clear (progs_t *pr, void *data) +bi_curses_clear (progs_t *pr, void *_res) { - __auto_type res = (qwaq_resources_t *) data; + __auto_type res = (qwaq_resources_t *) _res; if (res->initialized) { qwaq_input_disable_mouse (); diff --git a/ruamoko/qwaq/builtins/debug.c b/ruamoko/qwaq/builtins/debug.c index 9b1d2b45e..49b5f5ba7 100644 --- a/ruamoko/qwaq/builtins/debug.c +++ b/ruamoko/qwaq/builtins/debug.c @@ -147,7 +147,7 @@ static qwaq_debug_t *qwaq_debug_data; static int qwaq_debug_load (progs_t *pr) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) PR_Resources_Find (pr, "qwaq-debug"); pthread_mutex_lock (&debug_data_mutex); qwaq_debug_data = debug; // FIXME ? see decl @@ -158,14 +158,14 @@ qwaq_debug_load (progs_t *pr) } static void -qwaq_debug_clear (progs_t *pr, void *data) +qwaq_debug_clear (progs_t *pr, void *_res) { - __auto_type debug = (qwaq_debug_t *) data; + __auto_type debug = (qwaq_debug_t *) _res; target_reset (debug); } static void -qwaq_target_clear (progs_t *pr, void *data) +qwaq_target_clear (progs_t *pr, void *_res) { qwaq_target_t *target = pr->debug_data; if (target) { @@ -201,9 +201,9 @@ qwaq_target_load (progs_t *pr) } static void -qdb_set_trace (progs_t *pr) +qdb_set_trace (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); int state = P_INT (pr, 1); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); @@ -213,9 +213,9 @@ qdb_set_trace (progs_t *pr) } static void -qdb_set_breakpoint (progs_t *pr) +qdb_set_breakpoint (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); unsigned staddr = P_INT (pr, 1); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); @@ -231,9 +231,9 @@ qdb_set_breakpoint (progs_t *pr) } static void -qdb_clear_breakpoint (progs_t *pr) +qdb_clear_breakpoint (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); unsigned staddr = P_UINT (pr, 1); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); @@ -248,9 +248,9 @@ qdb_clear_breakpoint (progs_t *pr) } static void -qdb_set_watchpoint (progs_t *pr) +qdb_set_watchpoint (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); pr_ptr_t offset = P_UINT (pr, 1); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); @@ -265,9 +265,9 @@ qdb_set_watchpoint (progs_t *pr) } static void -qdb_clear_watchpoint (progs_t *pr) +qdb_clear_watchpoint (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -277,9 +277,9 @@ qdb_clear_watchpoint (progs_t *pr) } static void -qdb_continue (progs_t *pr) +qdb_continue (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); @@ -290,9 +290,9 @@ qdb_continue (progs_t *pr) } static void -qdb_get_state (progs_t *pr) +qdb_get_state (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -328,9 +328,9 @@ qdb_get_state (progs_t *pr) } static void -qdb_get_stack_depth (progs_t *pr) +qdb_get_stack_depth (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -339,9 +339,9 @@ qdb_get_stack_depth (progs_t *pr) } static void -qdb_get_stack (progs_t *pr) +qdb_get_stack (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -363,9 +363,9 @@ qdb_get_stack (progs_t *pr) } static void -qdb_get_event (progs_t *pr) +qdb_get_event (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); __auto_type event = &P_STRUCT (pr, qdb_event_t, 1); @@ -397,9 +397,9 @@ qdb_get_event (progs_t *pr) } static void -qdb_get_data (progs_t *pr) +qdb_get_data (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -423,9 +423,9 @@ qdb_get_data (progs_t *pr) } static void -qdb_get_string (progs_t *pr) +qdb_get_string (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -438,9 +438,9 @@ qdb_get_string (progs_t *pr) } static void -qdb_get_file_path (progs_t *pr) +qdb_get_file_path (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -463,9 +463,9 @@ qdb_get_file_path (progs_t *pr) } static void -qdb_find_string (progs_t *pr) +qdb_find_string (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -475,9 +475,9 @@ qdb_find_string (progs_t *pr) } static void -qdb_find_global (progs_t *pr) +qdb_find_global (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -495,9 +495,9 @@ qdb_find_global (progs_t *pr) } static void -qdb_find_field (progs_t *pr) +qdb_find_field (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -533,9 +533,9 @@ return_function (progs_t *pr, dfunction_t *func) } static void -qdb_find_function (progs_t *pr) +qdb_find_function (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -546,9 +546,9 @@ qdb_find_function (progs_t *pr) } static void -qdb_get_function (progs_t *pr) +qdb_get_function (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -580,9 +580,9 @@ return_auxfunction (progs_t *pr, pr_auxfunction_t *auxfunc) } static void -qdb_find_auxfunction (progs_t *pr) +qdb_find_auxfunction (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -598,9 +598,9 @@ qdb_find_auxfunction (progs_t *pr) } static void -qdb_get_auxfunction (progs_t *pr) +qdb_get_auxfunction (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -611,9 +611,9 @@ qdb_get_auxfunction (progs_t *pr) } static void -qdb_get_local_defs (progs_t *pr) +qdb_get_local_defs (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -637,9 +637,9 @@ qdb_get_local_defs (progs_t *pr) } static void -qdb_get_source_line_addr (progs_t *pr) +qdb_get_source_line_addr (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -650,9 +650,9 @@ qdb_get_source_line_addr (progs_t *pr) } static void -qdb_has_data_stack (progs_t *pr) +qdb_has_data_stack (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; @@ -661,9 +661,9 @@ qdb_has_data_stack (progs_t *pr) } static void -qdb_get_frame_addr (progs_t *pr) +qdb_get_frame_addr (progs_t *pr, void *_res) { - __auto_type debug = PR_Resources_Find (pr, "qwaq-debug"); + __auto_type debug = (qwaq_debug_t *) _res; pr_ptr_t handle = P_INT (pr, 0); qwaq_target_t *target = get_target (debug, __FUNCTION__, handle); progs_t *tpr = target->pr; diff --git a/ruamoko/qwaq/builtins/editbuffer.c b/ruamoko/qwaq/builtins/editbuffer.c index 3a8fbdf3a..3bc6b2a26 100644 --- a/ruamoko/qwaq/builtins/editbuffer.c +++ b/ruamoko/qwaq/builtins/editbuffer.c @@ -575,11 +575,12 @@ formatLine (txtbuffer_t *buffer, unsigned linePtr, unsigned xpos, //=== static void -bi__i_EditBuffer__init (progs_t *pr) +bi__i_EditBuffer__init (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_editbuffer_t, 0); - RUA_obj_increment_retaincount (pr);// [super init]; + // [super init]; + RUA_obj_increment_retaincount (pr, pr->pr_objective_resources); txtbuffer_t *txtbuffer = TextBuffer_Create (); editbuffer_t *buffer = editbuffer_new (res); @@ -591,11 +592,12 @@ bi__i_EditBuffer__init (progs_t *pr) } static void -bi__i_EditBuffer__initWithFile_ (progs_t *pr) +bi__i_EditBuffer__initWithFile_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_editbuffer_t, 0); - RUA_obj_increment_retaincount (pr);// [super init]; + // [super init]; + RUA_obj_increment_retaincount (pr, pr->pr_objective_resources); const char *filename = P_GSTRING (pr, 2); txtbuffer_t *txtbuffer = TextBuffer_Create (); editbuffer_t *buffer = editbuffer_new (res); @@ -610,9 +612,9 @@ bi__i_EditBuffer__initWithFile_ (progs_t *pr) } static void -bi__i_EditBuffer__dealloc (progs_t *pr) +bi__i_EditBuffer__dealloc (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; __auto_type self = &P_STRUCT (pr, qwaq_editbuffer_t, 0); int buffer_id = self->buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); @@ -622,9 +624,9 @@ bi__i_EditBuffer__dealloc (progs_t *pr) } static void -bi__i_EditBuffer__nextChar_ (progs_t *pr) +bi__i_EditBuffer__nextChar_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -633,9 +635,9 @@ bi__i_EditBuffer__nextChar_ (progs_t *pr) } static void -bi__i_EditBuffer__prevChar_ (progs_t *pr) +bi__i_EditBuffer__prevChar_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -644,9 +646,9 @@ bi__i_EditBuffer__prevChar_ (progs_t *pr) } static void -bi__i_EditBuffer__nextNonSpace_ (progs_t *pr) +bi__i_EditBuffer__nextNonSpace_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -655,9 +657,9 @@ bi__i_EditBuffer__nextNonSpace_ (progs_t *pr) } static void -bi__i_EditBuffer__prevNonSpace_ (progs_t *pr) +bi__i_EditBuffer__prevNonSpace_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -666,9 +668,9 @@ bi__i_EditBuffer__prevNonSpace_ (progs_t *pr) } static void -bi__i_EditBuffer__isWord_ (progs_t *pr) +bi__i_EditBuffer__isWord_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -677,9 +679,9 @@ bi__i_EditBuffer__isWord_ (progs_t *pr) } static void -bi__i_EditBuffer__nextWord_ (progs_t *pr) +bi__i_EditBuffer__nextWord_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -688,9 +690,9 @@ bi__i_EditBuffer__nextWord_ (progs_t *pr) } static void -bi__i_EditBuffer__prevWord_ (progs_t *pr) +bi__i_EditBuffer__prevWord_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -699,9 +701,9 @@ bi__i_EditBuffer__prevWord_ (progs_t *pr) } static void -bi__i_EditBuffer__nextLine_ (progs_t *pr) +bi__i_EditBuffer__nextLine_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -710,9 +712,9 @@ bi__i_EditBuffer__nextLine_ (progs_t *pr) } static void -bi__i_EditBuffer__prevLine_ (progs_t *pr) +bi__i_EditBuffer__prevLine_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -721,9 +723,9 @@ bi__i_EditBuffer__prevLine_ (progs_t *pr) } static void -bi__i_EditBuffer__nextLine__ (progs_t *pr) +bi__i_EditBuffer__nextLine__ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -742,9 +744,9 @@ bi__i_EditBuffer__nextLine__ (progs_t *pr) } static void -bi__i_EditBuffer__prevLine__ (progs_t *pr) +bi__i_EditBuffer__prevLine__ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -757,9 +759,9 @@ bi__i_EditBuffer__prevLine__ (progs_t *pr) } static void -bi__i_EditBuffer__charPos_at_ (progs_t *pr) +bi__i_EditBuffer__charPos_at_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -770,9 +772,9 @@ bi__i_EditBuffer__charPos_at_ (progs_t *pr) } static void -bi__i_EditBuffer__charPtr_at_ (progs_t *pr) +bi__i_EditBuffer__charPtr_at_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -783,9 +785,9 @@ bi__i_EditBuffer__charPtr_at_ (progs_t *pr) } static void -bi__i_EditBuffer__getWord_ (progs_t *pr) +bi__i_EditBuffer__getWord_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -797,9 +799,9 @@ bi__i_EditBuffer__getWord_ (progs_t *pr) } static void -bi__i_EditBuffer__getLine_ (progs_t *pr) +bi__i_EditBuffer__getLine_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -811,9 +813,9 @@ bi__i_EditBuffer__getLine_ (progs_t *pr) } static void -bi__i_EditBuffer__getBOL_ (progs_t *pr) +bi__i_EditBuffer__getBOL_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -822,9 +824,9 @@ bi__i_EditBuffer__getBOL_ (progs_t *pr) } static void -bi__i_EditBuffer__getEOL_ (progs_t *pr) +bi__i_EditBuffer__getEOL_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -833,9 +835,9 @@ bi__i_EditBuffer__getEOL_ (progs_t *pr) } static void -bi__i_EditBuffer__getBOT (progs_t *pr) +bi__i_EditBuffer__getBOT (progs_t *pr, void *_res) { - //qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + //qwaq_ebresources_t *res = _res; //int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; //editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); @@ -843,9 +845,9 @@ bi__i_EditBuffer__getBOT (progs_t *pr) } static void -bi__i_EditBuffer__getEOT (progs_t *pr) +bi__i_EditBuffer__getEOT (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); @@ -853,9 +855,9 @@ bi__i_EditBuffer__getEOT (progs_t *pr) } static void -bi__i_EditBuffer__readString_ (progs_t *pr) +bi__i_EditBuffer__readString_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); __auto_type selection = &P_PACKED (pr, eb_sel_t, 2); @@ -868,9 +870,9 @@ bi__i_EditBuffer__readString_ (progs_t *pr) } static void -bi__i_EditBuffer__getChar_ (progs_t *pr) +bi__i_EditBuffer__getChar_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned ptr = P_UINT (pr, 2); @@ -882,9 +884,9 @@ bi__i_EditBuffer__getChar_ (progs_t *pr) } static void -bi__i_EditBuffer__putChar_at_ (progs_t *pr) +bi__i_EditBuffer__putChar_at_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); int chr = P_UINT (pr, 2); @@ -897,9 +899,9 @@ bi__i_EditBuffer__putChar_at_ (progs_t *pr) } static void -bi__i_EditBuffer__insertChar_at_ (progs_t *pr) +bi__i_EditBuffer__insertChar_at_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); char chr = P_UINT (pr, 2); @@ -912,9 +914,9 @@ bi__i_EditBuffer__insertChar_at_ (progs_t *pr) } static void -bi__i_EditBuffer__countLines_ (progs_t *pr) +bi__i_EditBuffer__countLines_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); __auto_type selection = &P_PACKED (pr, eb_sel_t, 2); @@ -924,9 +926,9 @@ bi__i_EditBuffer__countLines_ (progs_t *pr) } static void -bi__i_EditBuffer__search_for_direction_ (progs_t *pr) +bi__i_EditBuffer__search_for_direction_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); __auto_type selection = &P_PACKED (pr, eb_sel_t, 2); @@ -938,9 +940,9 @@ bi__i_EditBuffer__search_for_direction_ (progs_t *pr) } static void -bi__i_EditBuffer__isearch_for_direction_ (progs_t *pr) +bi__i_EditBuffer__isearch_for_direction_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); __auto_type selection = &P_PACKED (pr, eb_sel_t, 2); @@ -952,9 +954,9 @@ bi__i_EditBuffer__isearch_for_direction_ (progs_t *pr) } static void -bi__i_EditBuffer__formatLine_from_into_width_highlight_colors_ (progs_t *pr) +bi__i_EditBuffer__formatLine_from_into_width_highlight_colors_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); unsigned linePtr = P_UINT (pr, 2); @@ -972,27 +974,27 @@ bi__i_EditBuffer__formatLine_from_into_width_highlight_colors_ (progs_t *pr) } static void -bi__i_EditBuffer__modified (progs_t *pr) +bi__i_EditBuffer__modified (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); R_INT (pr) = buffer->modified; } static void -bi__i_EditBuffer__textSize (progs_t *pr) +bi__i_EditBuffer__textSize (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); R_INT (pr) = buffer->txtbuffer->textSize; } static void -bi__i_EditBuffer__saveFile_ (progs_t *pr) +bi__i_EditBuffer__saveFile_ (progs_t *pr, void *_res) { - qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer"); + qwaq_ebresources_t *res = _res; int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer; editbuffer_t *buffer = get_editbuffer (res, __FUNCTION__, buffer_id); const char *filename = P_GSTRING (pr, 2); @@ -1003,9 +1005,9 @@ bi__i_EditBuffer__saveFile_ (progs_t *pr) } static void -qwaq_ebresources_clear (progs_t *pr, void *data) +qwaq_ebresources_clear (progs_t *pr, void *_res) { - __auto_type res = (qwaq_ebresources_t *) data; + __auto_type res = (qwaq_ebresources_t *) _res; for (editbuffer_t *buffer = res->buffer_list; buffer; buffer = buffer->next) { diff --git a/ruamoko/qwaq/builtins/graphics.c b/ruamoko/qwaq/builtins/graphics.c index 746332cc4..a53275a13 100644 --- a/ruamoko/qwaq/builtins/graphics.c +++ b/ruamoko/qwaq/builtins/graphics.c @@ -100,7 +100,7 @@ static SCR_Func bi_2dfuncs[] = { }; static void -bi_refresh (progs_t *pr) +bi_refresh (progs_t *pr, void *_res) { con_realtime = Sys_DoubleTime () - basetime; con_frametime = con_realtime - old_conrealtime; @@ -114,13 +114,13 @@ bi_refresh (progs_t *pr) } static void -bi_refresh_2d (progs_t *pr) +bi_refresh_2d (progs_t *pr, void *_res) { qc2d = P_FUNCTION (pr, 0); } static void -bi_shutdown (progs_t *pr) +bi_shutdown (progs_t *pr, void *_res) { Sys_Shutdown (); } diff --git a/ruamoko/qwaq/builtins/main.c b/ruamoko/qwaq/builtins/main.c index 9bb4d838f..4c51edae0 100644 --- a/ruamoko/qwaq/builtins/main.c +++ b/ruamoko/qwaq/builtins/main.c @@ -146,7 +146,7 @@ init_qf (void) } static void -bi_printf (progs_t *pr) +bi_printf (progs_t *pr, void *_res) { dstring_t *dstr = dstring_new (); @@ -158,14 +158,14 @@ bi_printf (progs_t *pr) } static void -bi_traceon (progs_t *pr) +bi_traceon (progs_t *pr, void *_res) { pr->pr_trace = true; pr->pr_trace_depth = pr->pr_depth; } static void -bi_traceoff (progs_t *pr) +bi_traceoff (progs_t *pr, void *_res) { pr->pr_trace = false; } diff --git a/ruamoko/qwaq/builtins/term-input.c b/ruamoko/qwaq/builtins/term-input.c index 8b34a22e5..4e725a431 100644 --- a/ruamoko/qwaq/builtins/term-input.c +++ b/ruamoko/qwaq/builtins/term-input.c @@ -639,9 +639,9 @@ qwaq_input_shutdown (qwaq_input_resources_t *res) } static void -bi_send_connected_devices (progs_t *pr) +bi_send_connected_devices (progs_t *pr, void *_res) { - qwaq_input_resources_t *res = PR_Resources_Find (pr, "input"); + qwaq_input_resources_t *res = _res; int command[] = { qwaq_cmd_send_connected_devices, 0, @@ -652,9 +652,9 @@ bi_send_connected_devices (progs_t *pr) } static void -bi_get_device_info (progs_t *pr) +bi_get_device_info (progs_t *pr, void *_res) { - qwaq_input_resources_t *res = PR_Resources_Find (pr, "input"); + qwaq_input_resources_t *res = _res; int devid = P_INT (pr, 0); int command[] = { @@ -737,9 +737,9 @@ get_event (qwaq_input_resources_t *res, qwaq_event_t *event) } static void -bi_get_event (progs_t *pr) +bi_get_event (progs_t *pr, void *_res) { - qwaq_input_resources_t *res = PR_Resources_Find (pr, "input"); + qwaq_input_resources_t *res = _res; qwaq_event_t *event = &P_STRUCT (pr, qwaq_event_t, 0); R_INT (pr) = get_event (res, event); @@ -854,9 +854,9 @@ qwaq_input_thread (qwaq_thread_t *thread) } static void -bi_init_input (progs_t *pr) +bi_init_input (progs_t *pr, void *_res) { - qwaq_input_resources_t *res = PR_Resources_Find (pr, "input"); + qwaq_input_resources_t *res = _res; qwaq_input_init (res); res->initialized = 1; create_thread (qwaq_input_thread, res); @@ -880,9 +880,9 @@ static builtin_t builtins[] = { }; static void -bi_input_clear (progs_t *pr, void *data) +bi_input_clear (progs_t *pr, void *_res) { - __auto_type res = (qwaq_input_resources_t *) data; + __auto_type res = (qwaq_input_resources_t *) _res; if (res->initialized) { qwaq_input_shutdown (res); diff --git a/tools/qfcc/test/test-bi.c b/tools/qfcc/test/test-bi.c index 1965db082..a13cf9ee7 100644 --- a/tools/qfcc/test/test-bi.c +++ b/tools/qfcc/test/test-bi.c @@ -44,7 +44,7 @@ #include "test-bi.h" static void -bi_printf (progs_t *pr) +bi_printf (progs_t *pr, void *data) { static dstring_t *dstr; @@ -62,26 +62,26 @@ bi_printf (progs_t *pr) } static void -bi_errno (progs_t *pr) +bi_errno (progs_t *pr, void *data) { R_INT (pr) = errno; } static void -bi_strerror (progs_t *pr) +bi_strerror (progs_t *pr, void *data) { int err = P_INT (pr, 0); RETURN_STRING (pr, strerror (err)); } static void -bi_exit (progs_t *pr) +bi_exit (progs_t *pr, void *data) { exit (P_INT (pr, 0)); } static void -bi_spawn (progs_t *pr) +bi_spawn (progs_t *pr, void *data) { edict_t *ed; ed = ED_Alloc (pr); @@ -89,7 +89,7 @@ bi_spawn (progs_t *pr) } static void -bi_remove (progs_t *pr) +bi_remove (progs_t *pr, void *data) { edict_t *ed; ed = P_EDICT (pr, 0);