[gamecode] Provide builtins with information about their parameters

This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
This commit is contained in:
Bill Currie 2022-01-23 21:54:03 +09:00
parent e746e39738
commit a6b932025c
41 changed files with 1012 additions and 850 deletions

View file

@ -33,6 +33,7 @@
\image latex vm-mem.eps "VM memory map"
*/
#include "QF/math/bitop.h"
#include "QF/progs/pr_comp.h"
#include "QF/progs/pr_debug.h"
@ -1193,8 +1194,27 @@ typedef struct {
/// The number of the builtin for \#N in QC. -1 for automatic allocation.
/// 0 or >= ::PR_AUTOBUILTIN is invalid.
pr_int_t binum;
/// The number of parameters the builtin takes. Negative numbers mean
/// varargs with ~num_params (-num_params - 1) being the number of real
/// parameters.
pr_int_t num_params;
/// Parameter size specificiation.
///
/// Up to 8 parameters are supported for automatic parameter setup because
/// that's all that v6p progs can pass. Builtins taking more than 8
/// parameters are already Ruamoko-only and thus know how to deal with the
/// parameters being on the data stack.
///
/// The encoding is the same as for progs functions, with 3:5 for
/// alignment:size (size 0 means 32 words).
dparmsize_t params[PR_MAX_PARAMS];
} builtin_t;
#define PR_PARAM(type) { \
.size = PR_SIZEOF(type) & 0x1f, \
.alignment = BITOP_LOG2(PR_ALIGNOF(type)), \
}
/** Duplicate the dfunction_t descriptor with the addition of a pointer to the
builtin function. Avoids a level of indirection when calling a builtin
function.

View file

@ -47,8 +47,10 @@ bi_S_LocalSound (progs_t *pr)
S_LocalSound (sound);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"S_LocalSound", bi_S_LocalSound, -1},
bi(S_LocalSound, 1, p(string)),
{0}
};

View file

@ -302,21 +302,23 @@ bi_InputLine_Draw (progs_t *pr)
line->line->draw (line->line);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"InputLine_Create", bi_InputLine_Create, -1},
{"InputLine_SetPos", bi_InputLine_SetPos, -1},
{"InputLine_SetCursor", bi_InputLine_SetCursor, -1},
bi(InputLine_Create, 3, p(int), p(int), p(int)),
bi(InputLine_SetPos, 3, p(ptr), p(int), p(int)),
bi(InputLine_SetCursor, 2, p(ptr), p(int)),
{"InputLine_SetEnter|^{tag _inputline_t=}(v*^v)^v",
bi_InputLine_SetEnter, -1},
bi_InputLine_SetEnter, -1, 3, {p(ptr), p(func), p(ptr)}},
{"InputLine_SetEnter|^{tag _inputline_t=}(@@:.)@:",
bi_InputLine_SetEnter, -1},
{"InputLine_SetWidth", bi_InputLine_SetWidth, -1},
{"InputLine_SetText", bi_InputLine_SetText, -1},
{"InputLine_GetText", bi_InputLine_GetText, -1},
{"InputLine_Destroy", bi_InputLine_Destroy, -1},
{"InputLine_Clear", bi_InputLine_Clear, -1},
{"InputLine_Process", bi_InputLine_Process, -1},
{"InputLine_Draw", bi_InputLine_Draw, -1},
bi_InputLine_SetEnter, -1, 4, {p(ptr), p(func), p(ptr), p(ptr)}},
bi(InputLine_SetWidth, 2, p(ptr), p(int)),
bi(InputLine_SetText, 2, p(ptr), p(string)),
bi(InputLine_GetText, 1, p(ptr)),
bi(InputLine_Destroy, 1, p(ptr)),
bi(InputLine_Clear, 2, p(ptr), p(int)),
bi(InputLine_Process, 2, p(ptr), p(int)),
bi(InputLine_Draw, 1, p(ptr)),
{0}
};

View file

@ -513,29 +513,33 @@ menu_load_file (progs_t *pr, const char *path, off_t *size)
return data;
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"Menu_Begin", bi_Menu_Begin, -1},
{"Menu_FadeScreen", bi_Menu_FadeScreen, -1},
{"Menu_Draw", bi_Menu_Draw, -1},
{"Menu_EnterHook", bi_Menu_EnterHook, -1},
{"Menu_LeaveHook", bi_Menu_LeaveHook, -1},
{"Menu_Pic", bi_Menu_Pic, -1},
{"Menu_SubPic", bi_Menu_SubPic, -1},
{"Menu_CenterPic", bi_Menu_CenterPic, -1},
{"Menu_CenterSubPic", bi_Menu_CenterSubPic, -1},
{"Menu_Item", bi_Menu_Item, -1},
{"Menu_Cursor", bi_Menu_Cursor, -1},
{"Menu_KeyEvent", bi_Menu_KeyEvent, -1},
{"Menu_End", bi_Menu_End, -1},
{"Menu_TopMenu", bi_Menu_TopMenu, -1},
{"Menu_SelectMenu", bi_Menu_SelectMenu, -1},
{"Menu_SetQuit", bi_Menu_SetQuit, -1},
{"Menu_Quit", bi_Menu_Quit, -1},
{"Menu_GetIndex", bi_Menu_GetIndex, -1},
{"Menu_Next", bi_Menu_Next, -1},
{"Menu_Prev", bi_Menu_Prev, -1},
{"Menu_Enter", bi_Menu_Enter, -1},
{"Menu_Leave", bi_Menu_Leave, -1},
bi(Menu_Begin, 3, p(int), p(int), p(string)),
bi(Menu_FadeScreen, 1, p(int)),
bi(Menu_Draw, 2, p(int), p(int)),
bi(Menu_EnterHook, 1, p(func)),
bi(Menu_LeaveHook, 1, p(func)),
bi(Menu_Pic, 3, p(int), p(int), p(string)),
bi(Menu_SubPic, 7, p(int), p(int), p(string),
p(int), p(int), p(int), p(int)),
bi(Menu_CenterPic, 3, p(int), p(int), p(string)),
bi(Menu_CenterSubPic, 7, p(int), p(int), p(string),
p(int), p(int), p(int), p(int)),
bi(Menu_Item, 5, p(int), p(int), p(string), p(func), p(int)),
bi(Menu_Cursor, 1, p(func)),
bi(Menu_KeyEvent, 1, p(func)),
bi(Menu_End, 0),
bi(Menu_TopMenu, 1, p(string)),
bi(Menu_SelectMenu, 1, p(string)),
bi(Menu_SetQuit, 1, p(func)),
bi(Menu_Quit, 0),
bi(Menu_GetIndex, 0),
bi(Menu_Next, 0),
bi(Menu_Prev, 0),
bi(Menu_Enter, 0),
bi(Menu_Leave, 0),
{0},
};

View file

@ -175,12 +175,15 @@ bi_GIB_Handle_Get (progs_t *pr)
// R_INT (pr) = 0;
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"GIB_Builtin_Add", bi_GIB_Builtin_Add, -1},
{"GIB_Return", bi_GIB_Return, -1},
{"GIB_Handle_New", bi_GIB_Handle_New, -1},
{"GIB_Handle_Free", bi_GIB_Handle_Free, -1},
{"GIB_Handle_Get", bi_GIB_Handle_Get, -1},
bi(GIB_Builtin_Add, 2, p(string), p(func)),
bi(GIB_Return, 1, p(string)),
bi(GIB_Handle_New, 0),//FIXME
bi(GIB_Handle_Free, 0),//FIXME
bi(GIB_Handle_Get, 0),//FIXME
{0}
};

View file

@ -249,7 +249,7 @@ PF_fabs (progs_t *pr)
entity (entity start, .(...) fld, ... match) find
*/
static void
PF_Find (progs_t *pr)
PF_find (progs_t *pr)
{
const char *s = 0, *t; // ev_string
int i; // ev_vector
@ -557,7 +557,7 @@ PF_charcount (progs_t *pr)
string () gametype
*/
static void
PR_gametype (progs_t *pr)
PF_gametype (progs_t *pr)
{
RETURN_STRING (pr, pr_gametype);
}
@ -585,41 +585,43 @@ PF_PR_FindFunction (progs_t *pr)
#define QF (PR_RANGE_QF << PR_RANGE_SHIFT) |
#define bi(x,n,np,params...) {#x, PF_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"break", PF_break, 6},
{"random", PF_random, 7},
{"normalize", PF_normalize, 9},
{"vlen", PF_vlen, 12},
{"vectoyaw", PF_vectoyaw, 13},
{"find", PF_Find, 18},
{"dprint", PF_dprint, 25},
{"ftos", PF_ftos, 26},
{"vtos", PF_vtos, 27},
{"coredump", PF_coredump, 28},
{"traceon", PF_traceon, 29},
{"traceoff", PF_traceoff, 30},
{"eprint", PF_eprint, 31},
{"rint", PF_rint, 36},
{"floor", PF_floor, 37},
{"ceil", PF_ceil, 38},
{"fabs", PF_fabs, 43},
{"cvar", PF_cvar, 45},
{"nextent", PF_nextent, 47},
{"vectoangles", PF_vectoangles, 51},
{"cvar_set", PF_cvar_set, 72},
{"stof", PF_stof, 81},
bi(break, 6, 0),
bi(random, 7, 0),
bi(normalize, 9, 1, p(vector)),
bi(vlen, 12, 1, p(vector)),
bi(vectoyaw, 13, 1, p(vector)),
bi(find, 18, -3, p(entity), p(field)),
bi(dprint, 25, -1),
bi(ftos, 26, 1, p(float)),
bi(vtos, 27, 1, p(vector)),
bi(coredump, 28, 0),
bi(traceon, 29, 0),
bi(traceoff, 30, 0),
bi(eprint, 31, 1, p(entity)),
bi(rint, 36, 1, p(float)),
bi(floor, 37, 1, p(float)),
bi(ceil, 38, 1, p(float)),
bi(fabs, 43, 1, p(float)),
bi(cvar, 45, 1, p(string)),
bi(nextent, 47, 1, p(entity)),
bi(vectoangles, 51, 1, p(vector)),
bi(cvar_set, 72, 2, p(string), p(string)),
bi(stof, 81, 1, p(string)),
{"charcount", PF_charcount, QF 101},
{"ftoi", PF_ftoi, QF 110},
{"itof", PF_itof, QF 111},
{"itos", PF_itos, QF 112},
{"stoi", PF_stoi, QF 113},
{"stov", PF_stov, QF 114},
{"gametype", PR_gametype, QF 115},
bi(charcount, QF 101, 2, p(string), p(string)),
bi(ftoi, QF 110, 1, p(float)),
bi(itof, QF 111, 1, p(int)),
bi(itos, QF 112, 1, p(int)),
bi(stoi, QF 113, 1, p(string)),
bi(stov, QF 114, 1, p(string)),
bi(gametype, QF 115, 0),
{"PR_SetField", PF_PR_SetField, -1},
{"PR_FindFunction", PF_PR_FindFunction, -1},
bi(PR_SetField, -1, 3, p(entity), p(string), p(string)),
bi(PR_FindFunction, -1, 1, p(string)),
{0}
};

View file

@ -93,11 +93,14 @@ bi_cbuf_clear (progs_t *pr, void *data)
{
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"Cbuf_AddText", bi_Cbuf_AddText, -1},
{"Cbuf_InsertText", bi_Cbuf_InsertText, -1},
{"Cbuf_Execute", bi_Cbuf_Execute, -1},
{"Cbuf_Execute_Sets", bi_Cbuf_Execute_Sets, -1},
bi(Cbuf_AddText, 1, p(string)),
bi(Cbuf_InsertText, 1, p(string)),
bi(Cbuf_Execute, 0),
bi(Cbuf_Execute_Sets, 0),
{0}
};

View file

@ -145,11 +145,13 @@ bi_Cmd_Args (progs_t *pr)
//Cmd_ExecuteString
//Cmd_ForwardToServer
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"Cmd_AddCommand", bi_Cmd_AddCommand, -1},
{"Cmd_Argc", bi_Cmd_Argc, -1},
{"Cmd_Argv", bi_Cmd_Argv, -1},
{"Cmd_Args", bi_Cmd_Args, -1},
bi(Cmd_AddCommand, 2, p(string), p(func)),
bi(Cmd_Argc, 0),
bi(Cmd_Argv, 1, p(int)),
bi(Cmd_Args, 1, p(int)),
{0}
};

View file

@ -232,18 +232,21 @@ bi_Cvar_Toggle (progs_t *pr)
Cvar_Set (var, var->int_val ? "0" : "1");
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"Cvar_MakeAlias", bi_Cvar_MakeAlias, -1},
{"Cvar_RemoveAlias", bi_Cvar_RemoveAlias, -1},
{"Cvar_SetFloat", bi_Cvar_SetFloat, -1},
{"Cvar_SetInteger", bi_Cvar_SetInteger, -1},
{"Cvar_SetVector", bi_Cvar_SetVector, -1},
{"Cvar_SetString", bi_Cvar_SetString, -1},
{"Cvar_GetFloat", bi_Cvar_GetFloat, -1},
{"Cvar_GetInteger", bi_Cvar_GetInteger, -1},
{"Cvar_GetVector", bi_Cvar_GetVector, -1},
{"Cvar_GetString", bi_Cvar_GetString, -1},
{"Cvar_Toggle", bi_Cvar_Toggle, -1},
bi(Cvar_MakeAlias, 2, p(string), p(string)),
bi(Cvar_RemoveAlias, 1, p(string)),
bi(Cvar_SetFloat, 2, p(string), p(float)),
bi(Cvar_SetInteger, 2, p(string), p(int)),
bi(Cvar_SetVector, 2, p(string), p(vector)),
bi(Cvar_SetString, 2, p(string), p(string)),
bi(Cvar_GetFloat, 1, p(string)),
bi(Cvar_GetInteger, 1, p(string)),
bi(Cvar_GetVector, 1, p(string)),
bi(Cvar_GetString, 1, p(string)),
bi(Cvar_Toggle, 1, p(string)),
{0}
};

View file

@ -359,24 +359,26 @@ bi_hash_clear (progs_t *pr, void *data)
table_reset (res);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"Hash_NewTable", bi_Hash_NewTable, -1},
{"Hash_SetHashCompare", bi_Hash_SetHashCompare, -1},
{"Hash_DelTable", bi_Hash_DelTable, -1},
{"Hash_FlushTable", bi_Hash_FlushTable, -1},
{"Hash_Add", bi_Hash_Add, -1},
{"Hash_AddElement", bi_Hash_AddElement, -1},
{"Hash_Find", bi_Hash_Find, -1},
{"Hash_FindElement", bi_Hash_FindElement, -1},
{"Hash_FindList", bi_Hash_FindList, -1},
{"Hash_FindElementList", bi_Hash_FindElementList, -1},
{"Hash_Del", bi_Hash_Del, -1},
{"Hash_DelElement", bi_Hash_DelElement, -1},
{"Hash_Free", bi_Hash_Free, -1},
{"Hash_String", bi_Hash_String, -1},
{"Hash_Buffer", bi_Hash_Buffer, -1},
{"Hash_GetList", bi_Hash_GetList, -1},
{"Hash_Stats", bi_Hash_Stats, -1},
bi(Hash_NewTable, 4, p(int), p(func), p(func), p(ptr)),
bi(Hash_SetHashCompare, 3, p(ptr), p(func), p(func)),
bi(Hash_DelTable, 1, p(ptr)),
bi(Hash_FlushTable, 1, p(ptr)),
bi(Hash_Add, 2, p(ptr), p(ptr)),
bi(Hash_AddElement, 2, p(ptr), p(ptr)),
bi(Hash_Find, 2, p(ptr), p(string)),
bi(Hash_FindElement, 2, p(ptr), p(ptr)),
bi(Hash_FindList, 2, p(ptr), p(string)),
bi(Hash_FindElementList, 2, p(ptr), p(ptr)),
bi(Hash_Del, 2, p(ptr), p(string)),
bi(Hash_DelElement, 2, p(ptr), p(ptr)),
bi(Hash_Free, 2, p(ptr), p(ptr)),
bi(Hash_String, 1, p(string)),
bi(Hash_Buffer, 2, p(ptr), p(int)),
bi(Hash_GetList, 1, p(ptr)),
bi(Hash_Stats, 1, p(ptr)),
{0}
};

View file

@ -407,56 +407,58 @@ secured (progs_t *pr)
PR_RunError (pr, "Secured function called");
}
#define bi(x) {#x, secured, -1}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
#define bi(x,np,params...) {#x, secured, -1, np, {params}}
static builtin_t secure_builtins[] = {
bi(IN_CreateButton),
bi(IN_CreateAxis),
bi(IN_LoadConfig),
bi(IN_CreateButton, 2, p(string), p(string)),
bi(IN_CreateAxis, 2, p(string), p(string)),
bi(IN_LoadConfig, 1, p(ptr)),
{0}
};
#undef bi
#define bi(x) {#x, bi_##x, -1}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
static builtin_t insecure_builtins[] = {
bi(IN_CreateButton),
bi(IN_CreateAxis),
bi(IN_LoadConfig),
bi(IN_CreateButton, 2, p(string), p(string)),
bi(IN_CreateAxis, 2, p(string), p(string)),
bi(IN_LoadConfig, 1, p(ptr)),
{0}
};
static builtin_t builtins[] = {
bi(IN_FindDeviceId),
bi(IN_GetDeviceName),
bi(IN_GetDeviceId),
bi(IN_AxisInfo),
bi(IN_ButtonInfo),
bi(IN_GetAxisName),
bi(IN_GetButtonName),
bi(IN_GetAxisNumber),
bi(IN_GetButtonNumber),
bi(IN_ProcessEvents),
bi(IN_ClearStates),
bi(IN_GetAxisInfo),
bi(IN_GetButtonInfo),
bi(IN_FindDeviceId, 1, p(string)),
bi(IN_GetDeviceName, 1, p(int)),
bi(IN_GetDeviceId, 1, p(int)),
bi(IN_AxisInfo, 0), //FIXME
bi(IN_ButtonInfo, 0), //FIXME
bi(IN_GetAxisName, 2, p(int), p(int)),
bi(IN_GetButtonName, 2, p(int), p(int)),
bi(IN_GetAxisNumber, 2, p(int), p(string)),
bi(IN_GetButtonNumber, 2, p(int), p(string)),
bi(IN_ProcessEvents, 0),
bi(IN_ClearStates, 0),
bi(IN_GetAxisInfo, 3, p(int), p(int), p(ptr)),
bi(IN_GetButtonInfo, 3, p(int), p(int), p(ptr)),
{"IN_ButtonAddListener|^{tag in_button_s=}^(v^v^{tag in_button_s=})^v",
rua_IN_ButtonAddListener_func, -1},
rua_IN_ButtonAddListener_func, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_ButtonRemoveListener|^{tag in_button_s=}^(v^v^{tag in_button_s=})^v",
rua_IN_ButtonRemoveListener_func, -1},
rua_IN_ButtonRemoveListener_func, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_AxisAddListener|^{tag in_axis_s=}^(v^v^{tag in_axis_s=})^v",
rua_IN_AxisAddListener_func, -1},
rua_IN_AxisAddListener_func, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_AxisRemoveListener|^{tag in_axis_s=}^(v^v^{tag in_axis_s=})^v",
rua_IN_AxisRemoveListener_func, -1},
rua_IN_AxisRemoveListener_func, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_ButtonAddListener|^{tag in_button_s=}(@@:.)@",
rua_IN_ButtonAddListener_method, -1},
rua_IN_ButtonAddListener_method, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_ButtonRemoveListener|^{tag in_button_s=}(@@:.)@",
rua_IN_ButtonRemoveListener_method, -1},
rua_IN_ButtonRemoveListener_method, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_AxisAddListener|^{tag in_axis_s=}(@@:.)@",
rua_IN_AxisAddListener_method, -1},
rua_IN_AxisAddListener_method, -1, 3, {p(ptr), p(func), p(ptr)}},
{"IN_AxisRemoveListener|^{tag in_axis_s=}(@@:.)@",
rua_IN_AxisRemoveListener_method, -1},
rua_IN_AxisRemoveListener_method, -1, 3, {p(ptr), p(func), p(ptr)}},
bi(IMT_CreateContext),
bi(IMT_GetContext),
bi(IMT_SetContext),
bi(IMT_CreateContext, 1, p(string)),
bi(IMT_GetContext, 0),
bi(IMT_SetContext, 1, p(int)),
{0}
};

View file

@ -165,13 +165,16 @@ bi_Key_StringToKeynum (progs_t *pr)
R_INT (pr) = Key_StringToKeynum (keyname);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"Key_keydown", bi_Key_keydown, -1},
{"Key_SetBinding", bi_Key_SetBinding, -1},
{"Key_LookupBinding", bi_Key_LookupBinding, -1},
{"Key_CountBinding", bi_Key_CountBinding, -1},
{"Key_KeynumToString", bi_Key_KeynumToString, -1},
{"Key_StringToKeynum", bi_Key_StringToKeynum, -1},
bi(Key_keydown, 1, p(int)),
bi(Key_SetBinding, 3, p(string), p(int), p(string)),
bi(Key_LookupBinding, 3, p(string), p(int), p(string)),
bi(Key_CountBinding, 2, p(string), p(string)),
bi(Key_KeynumToString, 1, p(int)),
bi(Key_StringToKeynum, 1, p(string)),
{0}
};

View file

@ -321,52 +321,54 @@ bi_atanh (progs_t *pr)
R_DOUBLE (pr) = log ((1 + y) / (1 - y)) / 2;
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"sin|f", bi_sinf, -1},
{"cos|f", bi_cosf, -1},
{"tan|f", bi_tanf, -1},
{"asin|f", bi_asinf, -1},
{"acos|f", bi_acosf, -1},
{"atan|f", bi_atanf, -1},
{"atan2|ff",bi_atan2f, -1},
{"exp|f", bi_expf, -1},
{"log|f", bi_logf, -1},
{"log2|f", bi_log2f, -1},
{"log10|f", bi_log10f, -1},
{"pow|ff", bi_powf, -1},
{"sqrt|f", bi_sqrtf, -1},
{"cbrt|f", bi_cbrtf, -1},
{"hypot|ff",bi_hypotf, -1},
{"sinh|f", bi_sinhf, -1},
{"cosh|f", bi_coshf, -1},
{"tanh|f", bi_tanhf, -1},
{"asinh|f", bi_asinhf, -1},
{"acosh|f", bi_acoshf, -1},
{"atanh|f", bi_atanhf, -1},
{"floor|d", bi_floor, -1}, // float version in pr_cmds
{"ceil|d", bi_ceil, -1}, // float version in pr_cmds
{"fabs|d", bi_fabs, -1}, // float version in pr_cmds
{"sin|d", bi_sin, -1},
{"cos|d", bi_cos, -1},
{"tan|d", bi_tan, -1},
{"asin|d", bi_asin, -1},
{"acos|d", bi_acos, -1},
{"atan|d", bi_atan, -1},
{"atan2|dd",bi_atan2, -1},
{"exp|d", bi_exp, -1},
{"log|d", bi_log, -1},
{"log2|d", bi_log2, -1},
{"log10|d", bi_log10, -1},
{"pow|dd", bi_pow, -1},
{"sqrt|d", bi_sqrt, -1},
{"cbrt|d", bi_cbrt, -1},
{"hypot|dd",bi_hypot, -1},
{"sinh|d", bi_sinh, -1},
{"cosh|d", bi_cosh, -1},
{"tanh|d", bi_tanh, -1},
{"asinh|d", bi_asinh, -1},
{"acosh|d", bi_acosh, -1},
{"atanh|d", bi_atanh, -1},
{"sin|f", bi_sinf, -1, 1, {p(float)}},
{"cos|f", bi_cosf, -1, 1, {p(float)}},
{"tan|f", bi_tanf, -1, 1, {p(float)}},
{"asin|f", bi_asinf, -1, 1, {p(float)}},
{"acos|f", bi_acosf, -1, 1, {p(float)}},
{"atan|f", bi_atanf, -1, 1, {p(float)}},
{"atan2|ff",bi_atan2f, -1, 2, {p(float), p(float)}},
{"exp|f", bi_expf, -1, 1, {p(float)}},
{"log|f", bi_logf, -1, 1, {p(float)}},
{"log2|f", bi_log2f, -1, 1, {p(float)}},
{"log10|f", bi_log10f, -1, 1, {p(float)}},
{"pow|ff", bi_powf, -1, 2, {p(float), p(float)}},
{"sqrt|f", bi_sqrtf, -1, 1, {p(float)}},
{"cbrt|f", bi_cbrtf, -1, 1, {p(float)}},
{"hypot|ff",bi_hypotf, -1, 2, {p(float), p(float)}},
{"sinh|f", bi_sinhf, -1, 1, {p(float)}},
{"cosh|f", bi_coshf, -1, 1, {p(float)}},
{"tanh|f", bi_tanhf, -1, 1, {p(float)}},
{"asinh|f", bi_asinhf, -1, 1, {p(float)}},
{"acosh|f", bi_acoshf, -1, 1, {p(float)}},
{"atanh|f", bi_atanhf, -1, 1, {p(float)}},
{"floor|d", bi_floor, -1, 1, {p(double)}}, // float version in pr_cmds
{"ceil|d", bi_ceil, -1, 1, {p(double)}}, // float version in pr_cmds
{"fabs|d", bi_fabs, -1, 1, {p(double)}}, // float version in pr_cmds
{"sin|d", bi_sin, -1, 1, {p(double)}},
{"cos|d", bi_cos, -1, 1, {p(double)}},
{"tan|d", bi_tan, -1, 1, {p(double)}},
{"asin|d", bi_asin, -1, 1, {p(double)}},
{"acos|d", bi_acos, -1, 1, {p(double)}},
{"atan|d", bi_atan, -1, 1, {p(double)}},
{"atan2|dd",bi_atan2, -1, 2, {p(double), p(double)}},
{"exp|d", bi_exp, -1, 1, {p(double)}},
{"log|d", bi_log, -1, 1, {p(double)}},
{"log2|d", bi_log2, -1, 1, {p(double)}},
{"log10|d", bi_log10, -1, 1, {p(double)}},
{"pow|dd", bi_pow, -1, 2, {p(double), p(double)}},
{"sqrt|d", bi_sqrt, -1, 1, {p(double)}},
{"cbrt|d", bi_cbrt, -1, 1, {p(double)}},
{"hypot|dd",bi_hypot, -1, 2, {p(double), p(double)}},
{"sinh|d", bi_sinh, -1, 1, {p(double)}},
{"cosh|d", bi_cosh, -1, 1, {p(double)}},
{"tanh|d", bi_tanh, -1, 1, {p(double)}},
{"asinh|d", bi_asinh, -1, 1, {p(double)}},
{"acosh|d", bi_acosh, -1, 1, {p(double)}},
{"atanh|d", bi_atanh, -1, 1, {p(double)}},
{0}
};

View file

@ -145,14 +145,15 @@ bi_mtwist_clear (progs_t *pr, void *data)
state_reset (res);
}
#define bi(x) {#x, bi_##x, -1}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
bi(mtwist_new),
bi(mtwist_delete),
bi(mtwist_seed),
bi(mtwist_rand),
bi(mtwist_rand_0_1),
bi(mtwist_rand_m1_1),
bi(mtwist_new, 1, p(int)),
bi(mtwist_delete, 1, p(ptr)),
bi(mtwist_seed, 2, p(ptr), p(int)),
bi(mtwist_rand, 1, p(ptr)),
bi(mtwist_rand_0_1, 1, p(ptr)),
bi(mtwist_rand_m1_1, 1, p(ptr)),
{0}
};

View file

@ -396,46 +396,49 @@ bi_MsgBuf_ReadUTF8 (progs_t *pr)
R_INT (pr) = MSG_ReadUTF8 (&mb->msg);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"MsgBuf_New", bi_MsgBuf_New, -1},
{"MsgBuf_Delete", bi_MsgBuf_Delete, -1},
{"MsgBuf_FromFile", bi_MsgBuf_FromFile, -1},
{"MsgBuf_MaxSize", bi_MsgBuf_MaxSize, -1},
{"MsgBuf_CurSize", bi_MsgBuf_CurSize, -1},
{"MsgBuf_ReadCount", bi_MsgBuf_ReadCount, -1},
{"MsgBuf_DataPtr", bi_MsgBuf_DataPtr, -1},
bi(MsgBuf_New, 1, p(int)),
bi(MsgBuf_Delete, 1, p(ptr)),
bi(MsgBuf_FromFile, 2, p(ptr), p(ptr)),
bi(MsgBuf_MaxSize, 1, p(ptr)),
bi(MsgBuf_CurSize, 1, p(ptr)),
bi(MsgBuf_ReadCount, 1, p(ptr)),
bi(MsgBuf_DataPtr, 1, p(ptr)),
{"MsgBuf_Clear", bi_MsgBuf_Clear, -1},
{"MsgBuf_WriteByte", bi_MsgBuf_WriteByte, -1},
{"MsgBuf_WriteShort", bi_MsgBuf_WriteShort, -1},
{"MsgBuf_WriteLong", bi_MsgBuf_WriteLong, -1},
{"MsgBuf_WriteFloat", bi_MsgBuf_WriteFloat, -1},
{"MsgBuf_WriteString", bi_MsgBuf_WriteString, -1},
// {"MsgBuf_WriteBytes", bi_MsgBuf_WriteBytes, -1},
{"MsgBuf_WriteCoord", bi_MsgBuf_WriteCoord, -1},
{"MsgBuf_WriteCoordV", bi_MsgBuf_WriteCoordV, -1},
{"MsgBuf_WriteCoordAngleV", bi_MsgBuf_WriteCoordAngleV, -1},
{"MsgBuf_WriteAngle", bi_MsgBuf_WriteAngle, -1},
{"MsgBuf_WriteAngleV", bi_MsgBuf_WriteAngleV, -1},
{"MsgBuf_WriteAngle16", bi_MsgBuf_WriteAngle16, -1},
{"MsgBuf_WriteAngle16V", bi_MsgBuf_WriteAngle16V, -1},
{"MsgBuf_WriteUTF8", bi_MsgBuf_WriteUTF8, -1},
bi(MsgBuf_Clear, 1, p(ptr)),
bi(MsgBuf_WriteByte, 2, p(ptr), p(int)),
bi(MsgBuf_WriteShort, 2, p(ptr), p(int)),
bi(MsgBuf_WriteLong, 2, p(ptr), p(int)),
bi(MsgBuf_WriteFloat, 2, p(ptr), p(float)),
bi(MsgBuf_WriteString, 2, p(ptr), p(string)),
// bi(MsgBuf_WriteBytes, _, _),
bi(MsgBuf_WriteCoord, 2, p(ptr), p(float)),
bi(MsgBuf_WriteCoordV, 2, p(ptr), p(vector)),
bi(MsgBuf_WriteCoordAngleV, 2, p(ptr), p(vector)),
bi(MsgBuf_WriteAngle, 2, p(ptr), p(float)),
bi(MsgBuf_WriteAngleV, 2, p(ptr), p(vector)),
bi(MsgBuf_WriteAngle16, 2, p(ptr), p(float)),
bi(MsgBuf_WriteAngle16V, 2, p(ptr), p(vector)),
bi(MsgBuf_WriteUTF8, 2, p(ptr), p(int)),
{"MsgBuf_BeginReading", bi_MsgBuf_BeginReading, -1},
{"MsgBuf_ReadByte", bi_MsgBuf_ReadByte, -1},
{"MsgBuf_ReadShort", bi_MsgBuf_ReadShort, -1},
{"MsgBuf_ReadLong", bi_MsgBuf_ReadLong, -1},
{"MsgBuf_ReadFloat", bi_MsgBuf_ReadFloat, -1},
{"MsgBuf_ReadString", bi_MsgBuf_ReadString, -1},
// {"MsgBuf_ReadBytes", bi_MsgBuf_ReadBytes, -1},
{"MsgBuf_ReadCoord", bi_MsgBuf_ReadCoord, -1},
{"MsgBuf_ReadCoordV", bi_MsgBuf_ReadCoordV, -1},
{"MsgBuf_ReadCoordAngleV", bi_MsgBuf_ReadCoordAngleV, -1},
{"MsgBuf_ReadAngle", bi_MsgBuf_ReadAngle, -1},
{"MsgBuf_ReadAngleV", bi_MsgBuf_ReadAngleV, -1},
{"MsgBuf_ReadAngle16", bi_MsgBuf_ReadAngle16, -1},
{"MsgBuf_ReadAngle16V", bi_MsgBuf_ReadAngle16V, -1},
{"MsgBuf_ReadUTF8", bi_MsgBuf_ReadUTF8, -1},
bi(MsgBuf_BeginReading, 1, p(ptr)),
bi(MsgBuf_ReadByte, 1, p(ptr)),
bi(MsgBuf_ReadShort, 1, p(ptr)),
bi(MsgBuf_ReadLong, 1, p(ptr)),
bi(MsgBuf_ReadFloat, 1, p(ptr)),
bi(MsgBuf_ReadString, 1, p(ptr)),
// bi(MsgBuf_ReadBytes, _, _),
bi(MsgBuf_ReadCoord, 1, p(ptr)),
bi(MsgBuf_ReadCoordV, 1, p(ptr)),
bi(MsgBuf_ReadCoordAngleV, 2, p(ptr), p(ptr)),
bi(MsgBuf_ReadAngle, 1, p(ptr)),
bi(MsgBuf_ReadAngleV, 1, p(ptr)),
bi(MsgBuf_ReadAngle16, 1, p(ptr)),
bi(MsgBuf_ReadAngle16V, 1, p(ptr)),
bi(MsgBuf_ReadUTF8, 1, p(ptr)),
{0}
};

View file

@ -2078,73 +2078,76 @@ rua_PR_FindGlobal (progs_t *pr)
//====================================================================
#define bi(x,np,params...) {#x, rua_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t obj_methods [] = {
{"__obj_exec_class", rua___obj_exec_class, -1},
{"__obj_forward", rua___obj_forward, -1},
{"__obj_responds_to", rua___obj_responds_to, -1},
bi(__obj_exec_class, 1, p(ptr)),
bi(__obj_forward, -3, p(ptr), p(ptr)),
bi(__obj_responds_to, 2, p(ptr), p(ptr)),
{"obj_error", rua_obj_error, -1},
{"obj_verror", rua_obj_verror, -1},
{"obj_set_error_handler", rua_obj_set_error_handler, -1},
{"obj_msg_lookup", rua_obj_msg_lookup, -1},
{"obj_msg_lookup_super", rua_obj_msg_lookup_super, -1},
{"obj_msg_sendv", rua_obj_msg_sendv, -1},
{"obj_increment_retaincount", rua_obj_increment_retaincount, -1},
{"obj_decrement_retaincount", rua_obj_decrement_retaincount, -1},
{"obj_get_retaincount", rua_obj_get_retaincount, -1},
{"obj_malloc", rua_obj_malloc, -1},
{"obj_atomic_malloc", rua_obj_atomic_malloc, -1},
{"obj_valloc", rua_obj_valloc, -1},
{"obj_realloc", rua_obj_realloc, -1},
{"obj_calloc", rua_obj_calloc, -1},
{"obj_free", rua_obj_free, -1},
{"obj_get_uninstalled_dtable", rua_obj_get_uninstalled_dtable, -1},
{"obj_msgSend", rua_obj_msgSend, -1},
{"obj_msgSend_super", rua_obj_msgSend_super, -1},
bi(obj_error, -4, p(ptr), p(int), p(string)),
bi(obj_verror, 4, p(ptr), p(int), p(string), P(1, 2)),
bi(obj_set_error_handler, 1, p(func)),
bi(obj_msg_lookup, 2, p(ptr), p(ptr)),
bi(obj_msg_lookup_super, 2, p(ptr), p(ptr)),
bi(obj_msg_sendv, 3, p(ptr), p(ptr), P(1, 2)),
bi(obj_increment_retaincount, 1, p(ptr)),
bi(obj_decrement_retaincount, 1, p(ptr)),
bi(obj_get_retaincount, 1, p(ptr)),
bi(obj_malloc, 1, p(int)),
bi(obj_atomic_malloc, 1, p(int)),
bi(obj_valloc, 1, p(int)),
bi(obj_realloc, 2, p(ptr), p(int)),
bi(obj_calloc, 2, p(int), p(int)),
bi(obj_free, 1, p(ptr)),
bi(obj_get_uninstalled_dtable, 0),
bi(obj_msgSend, 2, p(ptr), p(ptr)),//magic
bi(obj_msgSend_super, 2, p(ptr), p(ptr)),//magic
{"obj_get_class", rua_obj_get_class, -1},
{"obj_lookup_class", rua_obj_lookup_class, -1},
{"obj_next_class", rua_obj_next_class, -1},
bi(obj_get_class, 1, p(string)),
bi(obj_lookup_class, 1, p(string)),
bi(obj_next_class, 1, p(ptr)),
{"sel_get_name", rua_sel_get_name, -1},
{"sel_get_type", rua_sel_get_type, -1},
{"sel_get_uid", rua_sel_get_uid, -1},
{"sel_register_name", rua_sel_register_name, -1},
{"sel_is_mapped", rua_sel_is_mapped, -1},
bi(sel_get_name, 1, p(ptr)),
bi(sel_get_type, 1, p(ptr)),
bi(sel_get_uid, 1, p(string)),
bi(sel_register_name, 1, p(string)),
bi(sel_is_mapped, 1, p(ptr)),
{"class_get_class_method", rua_class_get_class_method, -1},
{"class_get_instance_method", rua_class_get_instance_method, -1},
{"class_pose_as", rua_class_pose_as, -1},
{"class_create_instance", rua_class_create_instance, -1},
{"class_get_class_name", rua_class_get_class_name, -1},
{"class_get_instance_size", rua_class_get_instance_size, -1},
{"class_get_meta_class", rua_class_get_meta_class, -1},
{"class_get_super_class", rua_class_get_super_class, -1},
{"class_get_version", rua_class_get_version, -1},
{"class_is_class", rua_class_is_class, -1},
{"class_is_meta_class", rua_class_is_meta_class, -1},
{"class_set_version", rua_class_set_version, -1},
{"class_get_gc_object_type", rua_class_get_gc_object_type, -1},
{"class_ivar_set_gcinvisible", rua_class_ivar_set_gcinvisible, -1},
bi(class_get_class_method, 2, p(ptr), p(ptr)),
bi(class_get_instance_method, 2, p(ptr), p(ptr)),
bi(class_pose_as, 2, p(ptr), p(ptr)),
bi(class_create_instance, 1, p(ptr)),
bi(class_get_class_name, 1, p(ptr)),
bi(class_get_instance_size, 1, p(ptr)),
bi(class_get_meta_class, 1, p(ptr)),
bi(class_get_super_class, 1, p(ptr)),
bi(class_get_version, 1, p(ptr)),
bi(class_is_class, 1, p(ptr)),
bi(class_is_meta_class, 1, p(ptr)),
bi(class_set_version, 2, p(ptr), p(int)),
bi(class_get_gc_object_type, 1, p(ptr)),
bi(class_ivar_set_gcinvisible, 3, p(ptr), p(string), p(int)),
{"method_get_imp", rua_method_get_imp, -1},
{"get_imp", rua_get_imp, -1},
bi(method_get_imp, 1, p(ptr)),
bi(get_imp, 1, p(ptr), p(ptr)),
{"object_copy", rua_object_copy, -1},
{"object_dispose", rua_object_dispose, -1},
{"object_get_class", rua_object_get_class, -1},
{"object_get_class_name", rua_object_get_class_name, -1},
{"object_get_meta_class", rua_object_get_meta_class, -1},
{"object_get_super_class", rua_object_get_super_class, -1},
{"object_is_class", rua_object_is_class, -1},
{"object_is_instance", rua_object_is_instance, -1},
{"object_is_meta_class", rua_object_is_meta_class, -1},
bi(object_copy, 1, p(ptr)),
bi(object_dispose, 1, p(ptr)),
bi(object_get_class, 1, p(ptr)),
bi(object_get_class_name, 1, p(ptr)),
bi(object_get_meta_class, 1, p(ptr)),
bi(object_get_super_class, 1, p(ptr)),
bi(object_is_class, 1, p(ptr)),
bi(object_is_instance, 1, p(ptr)),
bi(object_is_meta_class, 1, p(ptr)),
{"_i_Object__hash", rua__i_Object__hash, -1},
{"_i_Object_error_error_", rua__i_Object_error_error_, -1},
{"_c_Object__conformsToProtocol_", rua__c_Object__conformsToProtocol_, -1},
bi(_i_Object__hash, 2, p(ptr), p(ptr)),
bi(_i_Object_error_error_, -4, p(ptr), p(ptr), p(string)),
bi(_c_Object__conformsToProtocol_, 3, p(ptr), p(ptr), p(ptr)),
{"PR_FindGlobal", rua_PR_FindGlobal, -1},//FIXME
bi(PR_FindGlobal, 1, p(string)),//FIXME
{0}
};

View file

@ -444,28 +444,30 @@ plist_compare (const void *k1, const void *k2, void *unused)
return pl1->plitem == pl2->plitem;
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"PL_GetFromFile", bi_PL_GetFromFile, -1},
{"PL_GetPropertyList", bi_PL_GetPropertyList, -1},
{"PL_WritePropertyList", bi_PL_WritePropertyList, -1},
{"PL_Type", bi_PL_Type, -1},
{"PL_Line", bi_PL_Line, -1},
{"PL_String", bi_PL_String, -1},
{"PL_ObjectForKey", bi_PL_ObjectForKey, -1},
{"PL_RemoveObjectForKey", bi_PL_RemoveObjectForKey, -1},
{"PL_ObjectAtIndex", bi_PL_ObjectAtIndex, -1},
{"PL_D_AllKeys", bi_PL_D_AllKeys, -1},
{"PL_D_NumKeys", bi_PL_D_NumKeys, -1},
{"PL_D_AddObject", bi_PL_D_AddObject, -1},
{"PL_A_AddObject", bi_PL_A_AddObject, -1},
{"PL_A_NumObjects", bi_PL_A_NumObjects, -1},
{"PL_A_InsertObjectAtIndex", bi_PL_A_InsertObjectAtIndex, -1},
{"PL_RemoveObjectAtIndex", bi_PL_RemoveObjectAtIndex, -1},
{"PL_NewDictionary", bi_PL_NewDictionary, -1},
{"PL_NewArray", bi_PL_NewArray, -1},
{"PL_NewData", bi_PL_NewData, -1},
{"PL_NewString", bi_PL_NewString, -1},
{"PL_Free", bi_PL_Free, -1},
bi(PL_GetFromFile, 1, p(ptr)),
bi(PL_GetPropertyList, 1, p(string)),
bi(PL_WritePropertyList, 1, p(ptr)),
bi(PL_Type, 1, p(ptr)),
bi(PL_Line, 1, p(ptr)),
bi(PL_String, 1, p(ptr)),
bi(PL_ObjectForKey, 2, p(ptr), p(string)),
bi(PL_RemoveObjectForKey, 2, p(ptr), p(string)),
bi(PL_ObjectAtIndex, 2, p(ptr), p(int)),
bi(PL_D_AllKeys, 1, p(ptr)),
bi(PL_D_NumKeys, 1, p(ptr)),
bi(PL_D_AddObject, 3, p(ptr), p(string), p(ptr)),
bi(PL_A_AddObject, 2, p(ptr), p(ptr)),
bi(PL_A_NumObjects, 1, p(ptr)),
bi(PL_A_InsertObjectAtIndex, 3, p(ptr), p(ptr), p(int)),
bi(PL_RemoveObjectAtIndex, 2, p(ptr), p(int)),
bi(PL_NewDictionary, 0),
bi(PL_NewArray, 0),
bi(PL_NewData, 2, p(ptr), p(int)),
bi(PL_NewString, 1, p(string)),
bi(PL_Free, 1, p(ptr)),
{0}
};

View file

@ -346,35 +346,40 @@ bi_Qfilesize (progs_t *pr)
R_INT (pr) = Qfilesize (h->file);
}
#define bi(x,np,params...) {#x, secured, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t secure_builtins[] = {
{"Qrename", secured, -1},
{"Qremove", secured, -1},
{"Qopen", secured, -1},
bi(Qrename, 2, p(string), p(string)),
bi(Qremove, 1, p(string)),
bi(Qopen, 2, p(string), p(string)),
{0}
};
#undef bi
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
static builtin_t insecure_builtins[] = {
{"Qrename", bi_Qrename, -1},
{"Qremove", bi_Qremove, -1},
{"Qopen", bi_Qopen, -1},
bi(Qrename, 2, p(string), p(string)),
bi(Qremove, 1, p(string)),
bi(Qopen, 2, p(string), p(string)),
{0}
};
static builtin_t builtins[] = {
{"Qclose", bi_Qclose, -1},
{"Qgetline", bi_Qgetline, -1},
{"Qreadstring", bi_Qreadstring, -1},
{"Qread", bi_Qread, -1},
{"Qwrite", bi_Qwrite, -1},
{"Qputs", bi_Qputs, -1},
// {"Qgets", bi_Qgets, -1},
{"Qgetc", bi_Qgetc, -1},
{"Qputc", bi_Qputc, -1},
{"Qseek", bi_Qseek, -1},
{"Qtell", bi_Qtell, -1},
{"Qflush", bi_Qflush, -1},
{"Qeof", bi_Qeof, -1},
{"Qfilesize", bi_Qfilesize, -1},
bi(Qclose, 1, p(ptr)),
bi(Qgetline, 1, p(ptr)),
bi(Qreadstring, 2, p(ptr), p(int)),
bi(Qread, 3, p(ptr), p(ptr), p(int)),
bi(Qwrite, 3, p(ptr), p(ptr), p(int)),
bi(Qputs, 2, p(ptr), p(string)),
// bi(Qgets, _, _),
bi(Qgetc, 1, p(ptr)),
bi(Qputc, 2, p(ptr), p(int)),
bi(Qseek, 3, p(ptr), p(int), p(int)),
bi(Qtell, 1, p(ptr)),
bi(Qflush, 1, p(ptr)),
bi(Qeof, 1, p(ptr)),
bi(Qfilesize, 1, p(ptr)),
{0}
};

View file

@ -188,16 +188,18 @@ bi_QFS_GetDirectory (progs_t *pr)
RETURN_STRING (pr, qfs_gamedir->dir.def);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"QFS_Open", bi_QFS_Open, -1},
{"QFS_WOpen", bi_QFS_WOpen, -1},
{"QFS_Rename", bi_QFS_Rename, -1},
{"QFS_LoadFile", bi_QFS_LoadFile, -1},
{"QFS_OpenFile", bi_QFS_OpenFile, -1},
{"QFS_WriteFile", bi_QFS_WriteFile, -1},
{"QFS_Filelist", bi_QFS_Filelist, -1},
{"QFS_FilelistFree", bi_QFS_FilelistFree, -1},
{"QFS_GetDirectory", bi_QFS_GetDirectory, -1},
bi(QFS_Open, 2, p(string), p(string)),
bi(QFS_WOpen, 2, p(string), p(int)),
bi(QFS_Rename, 2, p(string), p(string)),
bi(QFS_LoadFile, 1, p(string)),
bi(QFS_OpenFile, 1, p(string)),
bi(QFS_WriteFile, 3, p(string), p(ptr), p(int)),
bi(QFS_Filelist, 3, p(string), p(string), p(int)),
bi(QFS_FilelistFree, 1, p(ptr)),
bi(QFS_GetDirectory, 0),
{0}
};

View file

@ -69,8 +69,11 @@ bi_va_copy (progs_t *pr)
R_PACKED (pr, pr_va_list_t).list = PR_SetPointer (pr, dst_list);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"va_copy", bi_va_copy, -1},
bi(va_copy, 1, P(1, 2)),
{0}
};

View file

@ -187,15 +187,17 @@ bi_Script_NoQuoteLines (progs_t *pr)
script->script.no_quote_lines = P_INT (pr, 1);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"Script_New", bi_Script_New, -1},
{"Script_Delete", bi_Script_Delete, -1},
{"Script_Start", bi_Script_Start, -1},
{"Script_TokenAvailable", bi_Script_TokenAvailable, -1},
{"Script_GetToken", bi_Script_GetToken, -1},
{"Script_UngetToken", bi_Script_UngetToken, -1},
{"Script_Error", bi_Script_Error, -1},
{"Script_NoQuoteLines", bi_Script_NoQuoteLines, -1},
bi(Script_New, 0),
bi(Script_Delete, 1, p(ptr)),
bi(Script_Start, 3, p(ptr), p(string), p(string)),
bi(Script_TokenAvailable, 2, p(ptr), p(int)),
bi(Script_GetToken, 2, p(ptr), p(int)),
bi(Script_UngetToken, 1, p(ptr)),
bi(Script_Error, 1, p(ptr)),
bi(Script_NoQuoteLines, 1, p(ptr)),
{0}
};

View file

@ -178,6 +178,15 @@ bi_set_del_iter (progs_t *pr)
del_set_iter (pr, set_iter);
}
static void
bi_set_iter_element (progs_t *pr)
{
bi_set_iter_t *set_iter = get_set_iter (pr, __FUNCTION__, P_INT (pr, 0));
R_INT (pr) = set_iter->iter->element;
}
static void
bi_set_new (progs_t *pr)
{
@ -421,7 +430,7 @@ bi_set_as_string (progs_t *pr)
}
static void
bi_i_SetIterator__element (progs_t *pr)
bi__i_SetIterator__element (progs_t *pr)
{
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);
@ -430,7 +439,7 @@ bi_i_SetIterator__element (progs_t *pr)
}
static void
bi_i_Set__add_ (progs_t *pr)
bi__i_Set__add_ (progs_t *pr)
{
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -443,7 +452,7 @@ bi_i_Set__add_ (progs_t *pr)
}
static void
bi_i_Set__remove_ (progs_t *pr)
bi__i_Set__remove_ (progs_t *pr)
{
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -456,7 +465,7 @@ bi_i_Set__remove_ (progs_t *pr)
}
static void
bi_i_Set__invert (progs_t *pr)
bi__i_Set__invert (progs_t *pr)
{
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -468,7 +477,7 @@ bi_i_Set__invert (progs_t *pr)
}
static void
bi_i_Set__union_ (progs_t *pr)
bi__i_Set__union_ (progs_t *pr)
{
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -482,7 +491,7 @@ bi_i_Set__union_ (progs_t *pr)
}
static void
bi_i_Set__intersection_ (progs_t *pr)
bi__i_Set__intersection_ (progs_t *pr)
{
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -496,7 +505,7 @@ bi_i_Set__intersection_ (progs_t *pr)
}
static void
bi_i_Set__difference_ (progs_t *pr)
bi__i_Set__difference_ (progs_t *pr)
{
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -510,7 +519,7 @@ bi_i_Set__difference_ (progs_t *pr)
}
static void
bi_i_Set__reverse_difference_ (progs_t *pr)
bi__i_Set__reverse_difference_ (progs_t *pr)
{
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -524,7 +533,7 @@ bi_i_Set__reverse_difference_ (progs_t *pr)
}
static void
bi_i_Set__assign_ (progs_t *pr)
bi__i_Set__assign_ (progs_t *pr)
{
pr_ptr_t dst_ptr = P_POINTER (pr, 0);
pr_set_t *dst_obj = &G_STRUCT (pr, pr_set_t, dst_ptr);
@ -538,7 +547,7 @@ bi_i_Set__assign_ (progs_t *pr)
}
static void
bi_i_Set__empty (progs_t *pr)
bi__i_Set__empty (progs_t *pr)
{
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -550,7 +559,7 @@ bi_i_Set__empty (progs_t *pr)
}
static void
bi_i_Set__everything (progs_t *pr)
bi__i_Set__everything (progs_t *pr)
{
pr_ptr_t set_ptr = P_POINTER (pr, 0);
pr_set_t *set_obj = &G_STRUCT (pr, pr_set_t, set_ptr);
@ -562,7 +571,7 @@ bi_i_Set__everything (progs_t *pr)
}
static void
bi_i_Set__is_empty (progs_t *pr)
bi__i_Set__is_empty (progs_t *pr)
{
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -572,7 +581,7 @@ bi_i_Set__is_empty (progs_t *pr)
}
static void
bi_i_Set__is_everything (progs_t *pr)
bi__i_Set__is_everything (progs_t *pr)
{
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -582,7 +591,7 @@ bi_i_Set__is_everything (progs_t *pr)
}
static void
bi_i_Set__is_disjoint_ (progs_t *pr)
bi__i_Set__is_disjoint_ (progs_t *pr)
{
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -594,7 +603,7 @@ bi_i_Set__is_disjoint_ (progs_t *pr)
}
static void
bi_i_Set__is_intersecting_ (progs_t *pr)
bi__i_Set__is_intersecting_ (progs_t *pr)
{
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -606,7 +615,7 @@ bi_i_Set__is_intersecting_ (progs_t *pr)
}
static void
bi_i_Set__is_equivalent_ (progs_t *pr)
bi__i_Set__is_equivalent_ (progs_t *pr)
{
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -618,7 +627,7 @@ bi_i_Set__is_equivalent_ (progs_t *pr)
}
static void
bi_i_Set__is_subset_ (progs_t *pr)
bi__i_Set__is_subset_ (progs_t *pr)
{
pr_set_t *s1_obj = &P_STRUCT (pr, pr_set_t, 0);
pr_set_t *s2_obj = &P_STRUCT (pr, pr_set_t, 2);
@ -630,7 +639,7 @@ bi_i_Set__is_subset_ (progs_t *pr)
}
static void
bi_i_Set__is_member_ (progs_t *pr)
bi__i_Set__is_member_ (progs_t *pr)
{
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -641,7 +650,7 @@ bi_i_Set__is_member_ (progs_t *pr)
}
static void
bi_i_Set__size (progs_t *pr)
bi__i_Set__size (progs_t *pr)
{
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -651,7 +660,7 @@ bi_i_Set__size (progs_t *pr)
}
static void
bi_i_Set__as_string (progs_t *pr)
bi__i_Set__as_string (progs_t *pr)
{
pr_set_t *set_obj = &P_STRUCT (pr, pr_set_t, 0);
@ -677,53 +686,56 @@ res_set_clear (progs_t *pr, void *data)
res_set_iter_reset (res);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"set_del_iter", bi_set_del_iter, -1},
{"set_new", bi_set_new, -1},
{"set_delete", bi_set_delete, -1},
{"set_add", bi_set_add, -1},
{"set_remove", bi_set_remove, -1},
{"set_invert", bi_set_invert, -1},
{"set_union", bi_set_union, -1},
{"set_intersection", bi_set_intersection, -1},
{"set_difference", bi_set_difference, -1},
{"set_reverse_difference", bi_set_reverse_difference, -1},
{"set_assign", bi_set_assign, -1},
{"set_empty", bi_set_empty, -1},
{"set_everything", bi_set_everything, -1},
{"set_is_empty", bi_set_is_empty, -1},
{"set_is_everything", bi_set_is_everything, -1},
{"set_is_disjoint", bi_set_is_disjoint, -1},
{"set_is_intersecting", bi_set_is_intersecting, -1},
{"set_is_equivalent", bi_set_is_equivalent, -1},
{"set_is_subset", bi_set_is_subset, -1},
{"set_is_member", bi_set_is_member, -1},
{"set_count", bi_set_count, -1},
{"set_first", bi_set_first, -1},
{"set_next", bi_set_next, -1},
{"set_as_string", bi_set_as_string, -1},
bi(set_del_iter, 1, p(ptr)),
bi(set_iter_element, 1, p(ptr)),
bi(set_new, 0),
bi(set_delete, 1, p(ptr)),
bi(set_add, 2, p(ptr), p(uint)),
bi(set_remove, 2, p(ptr), p(uint)),
bi(set_invert, 1, p(ptr)),
bi(set_union, 2, p(ptr), p(ptr)),
bi(set_intersection, 2, p(ptr), p(ptr)),
bi(set_difference, 2, p(ptr), p(ptr)),
bi(set_reverse_difference, 2, p(ptr), p(ptr)),
bi(set_assign, 2, p(ptr), p(ptr)),
bi(set_empty, 1, p(ptr)),
bi(set_everything, 1, p(ptr)),
bi(set_is_empty, 1, p(ptr)),
bi(set_is_everything, 1, p(ptr)),
bi(set_is_disjoint, 2, p(ptr), p(ptr)),
bi(set_is_intersecting, 2, p(ptr), p(ptr)),
bi(set_is_equivalent, 2, p(ptr), p(ptr)),
bi(set_is_subset, 2, p(ptr), p(ptr)),
bi(set_is_member, 2, p(ptr), p(uint)),
bi(set_count, 1, p(ptr)),
bi(set_first, 1, p(ptr)),
bi(set_next, 1, p(ptr)),
bi(set_as_string, 1, p(ptr)),
{"_i_SetIterator__element", bi_i_SetIterator__element, -1},
bi(_i_SetIterator__element, 2, p(ptr), p(ptr)),
{"_i_Set__add_", bi_i_Set__add_, -1},
{"_i_Set__remove_", bi_i_Set__remove_, -1},
{"_i_Set__invert", bi_i_Set__invert, -1},
{"_i_Set__union_", bi_i_Set__union_, -1},
{"_i_Set__intersection_", bi_i_Set__intersection_, -1},
{"_i_Set__difference_", bi_i_Set__difference_, -1},
{"_i_Set__reverse_difference_", bi_i_Set__reverse_difference_, -1},
{"_i_Set__assign_", bi_i_Set__assign_, -1},
{"_i_Set__empty", bi_i_Set__empty, -1},
{"_i_Set__everything", bi_i_Set__everything, -1},
{"_i_Set__is_empty", bi_i_Set__is_empty, -1},
{"_i_Set__is_everything", bi_i_Set__is_everything, -1},
{"_i_Set__is_disjoint_", bi_i_Set__is_disjoint_, -1},
{"_i_Set__is_intersecting_", bi_i_Set__is_intersecting_, -1},
{"_i_Set__is_equivalent_", bi_i_Set__is_equivalent_, -1},
{"_i_Set__is_subset_", bi_i_Set__is_subset_, -1},
{"_i_Set__is_member_", bi_i_Set__is_member_, -1},
{"_i_Set__size", bi_i_Set__size, -1},
{"_i_Set__as_string", bi_i_Set__as_string, -1},
bi(_i_Set__add_, 3, p(ptr), p(ptr), p(uint)),
bi(_i_Set__remove_, 3, p(ptr), p(ptr), p(uint)),
bi(_i_Set__invert, 2, p(ptr), p(ptr)),
bi(_i_Set__union_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__intersection_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__difference_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__reverse_difference_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__assign_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__empty, 2, p(ptr), p(ptr)),
bi(_i_Set__everything, 2, p(ptr), p(ptr)),
bi(_i_Set__is_empty, 2, p(ptr), p(ptr)),
bi(_i_Set__is_everything, 2, p(ptr), p(ptr)),
bi(_i_Set__is_disjoint_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__is_intersecting_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__is_equivalent_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__is_subset_, 3, p(ptr), p(ptr), p(ptr)),
bi(_i_Set__is_member_, 3, p(ptr), p(ptr), p(uint)),
bi(_i_Set__size, 2, p(ptr), p(ptr)),
bi(_i_Set__as_string, 2, p(ptr), p(ptr)),
{0}
};

View file

@ -156,12 +156,15 @@ bi_prefixsumf (progs_t *pr)
}
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"bsearch", bi_bsearch, -1},
{"fbsearch", bi_fbsearch, -1},
{"qsort", bi_qsort, -1},
{"prefixsum|^ii", bi_prefixsumi, -1},
{"prefixsum|^fi", bi_prefixsumf, -1},
bi(bsearch, 4, p(ptr), p(ptr), p(int), p(int), p(func)),
bi(fbsearch, 4, p(ptr), p(ptr), p(int), p(int), p(func)),
bi(qsort, 3, p(ptr), p(int), p(int), p(func)),
{"prefixsum|^ii", bi_prefixsumi, -1, 2, {p(ptr), p(int)}},
{"prefixsum|^fi", bi_prefixsumf, -1, 2, {p(ptr), p(int)}},
{0}
};

View file

@ -281,25 +281,28 @@ bi_str_upper (progs_t *pr)
RETURN_STRING (pr, upper);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"strlen", bi_strlen, -1},
{"sprintf", bi_sprintf, -1},
{"vsprintf", bi_vsprintf, -1},
{"str_new", bi_str_new, -1},
{"str_free", bi_str_free, -1},
{"str_hold", bi_str_hold, -1},
{"str_valid", bi_str_valid, -1},
{"str_mutable", bi_str_mutable, -1},
{"str_copy", bi_str_copy, -1},
{"str_cat", bi_str_cat, -1},
{"str_clear", bi_str_clear, -1},
{"str_mid|*i", bi_str_mid, -1},
{"str_mid|*ii", bi_str_mid, -1},
{"str_str", bi_str_str, -1},
{"str_char", bi_str_char, -1},
{"str_quote", bi_str_quote, -1},
{"str_lower", bi_str_lower, -1},
{"str_upper", bi_str_upper, -1},
bi(strlen, 1, p(string)),
bi(sprintf, -2, p(string)),
bi(vsprintf, 2, p(string), P(1, 2)),
bi(str_new, 0),
bi(str_free, 1, p(string)),
bi(str_hold, 1, p(string)),
bi(str_valid, 1, p(string)),
bi(str_mutable, 1, p(string)),
bi(str_copy, 2, p(string), p(string)),
bi(str_cat, 2, p(string), p(string)),
bi(str_clear, 1, p(string)),
{"str_mid|*i", bi_str_mid, -1, 2, {p(string), p(int)}},
{"str_mid|*ii", bi_str_mid, -1, 3, {p(string), p(int), p(int)}},
bi(str_str, 2, p(string), p(string)),
bi(str_char, 2, p(string), p(int)),
bi(str_quote, 1, p(string)),
bi(str_lower, 1, p(string)),
bi(str_upper, 1, p(string)),
{0}
};

View file

@ -324,20 +324,24 @@ bi_draw_clear (progs_t *pr, void *data)
Hash_FlushTable (res->pic_hash);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"Draw_FreePic", bi_Draw_FreePic, -1},
{"Draw_MakePic", bi_Draw_MakePic, -1},
{"Draw_CachePic", bi_Draw_CachePic, -1},
{"Draw_Pic", bi_Draw_Pic, -1},
{"Draw_Picf", bi_Draw_Picf, -1},
{"Draw_SubPic", bi_Draw_SubPic, -1},
{"Draw_CenterPic", bi_Draw_CenterPic, -1},
{"Draw_Character", bi_Draw_Character, -1},
{"Draw_String", bi_Draw_String, -1},
{"Draw_nString", bi_Draw_nString, -1},
{"Draw_AltString", bi_Draw_AltString, -1},
{"Draw_Fill", bi_Draw_Fill, -1},
{"Draw_Crosshair", bi_Draw_Crosshair, -1},
bi(Draw_FreePic, 1, p(ptr)),
bi(Draw_MakePic, 3, p(int), p(int), p(string)),
bi(Draw_CachePic, 2, p(string), p(int)),
bi(Draw_Pic, 3, p(int), p(int), p(ptr)),
bi(Draw_Picf, 3, p(float), p(float), p(ptr)),
bi(Draw_SubPic, 7, p(int), p(int), p(ptr),
p(int), p(int), p(int), p(int)),
bi(Draw_CenterPic, 3, p(int), p(int), p(ptr)),
bi(Draw_Character, 3, p(int), p(int), p(int)),
bi(Draw_String, 3, p(int), p(int), p(string)),
bi(Draw_nString, 4, p(int), p(int), p(string), p(int)),
bi(Draw_AltString, 3, p(int), p(int), p(string)),
bi(Draw_Fill, 5, p(int), p(int), p(int), p(int), p(int)),
bi(Draw_Crosshair, 5, p(int), p(int), p(int), p(int)),
{0}
};

View file

@ -731,7 +731,7 @@ PF_findradius (progs_t *pr)
// entity () spawn
static void
PF_Spawn (progs_t *pr)
PF_spawn (progs_t *pr)
{
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)
{
edict_t *ed;
@ -798,6 +798,7 @@ PF_precache_file (progs_t *pr)
// precache_file is used only to copy files with qcc, it does nothing
R_INT (pr) = P_INT (pr, 0);
}
#define PF_precache_file2 PF_precache_file
// void (string s) precache_sound
// string (string s) precache_sound2
@ -808,6 +809,7 @@ PF_precache_sound (progs_t *pr)
"precache_sound");
R_INT (pr) = P_INT (pr, 0);
}
#define PF_precache_sound2 PF_precache_sound
// void (string s) precache_model
// string (string s) precache_model2
@ -821,6 +823,7 @@ PF_precache_model (progs_t *pr)
sv.models[ind] = Mod_ForName (mod, true);
R_INT (pr) = P_INT (pr, 0);
}
#define PF_precache_model2 PF_precache_model
/*
PF_walkmove
@ -1474,78 +1477,83 @@ PF_checkextension (progs_t *pr)
#define QF (PR_RANGE_QF << PR_RANGE_SHIFT) |
#define bi(x,n,np,params...) {#x, PF_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"makevectors", PF_makevectors, 1},
{"setorigin", PF_setorigin, 2},
{"setmodel", PF_setmodel, 3},
{"setsize", PF_setsize, 4},
bi(makevectors, 1, 1, p(vector)),
bi(setorigin, 2, 2, p(entity), p(vector)),
bi(setmodel, 3, 2, p(entity), p(string)),
bi(setsize, 4, 3, p(entity), p(vector), p(vector)),
{"sound", PF_sound, 8},
bi(sound, 8, 3, p(entity), p(float), p(string)),
{"error", PF_error, 10},
{"objerror", PF_objerror, 11},
{"spawn", PF_Spawn, 14},
{"remove", PF_Remove, 15},
{"traceline", PF_traceline, 16},
{"checkclient", PF_checkclient, 17},
bi(error, 10, -1), // (...)
bi(objerror, 11, -1), // (...)
bi(spawn, 14, 0), // (void)
bi(remove, 15, 1, p(entity)),
bi(traceline, 16, 3, p(vector), p(vector), p(float)),
bi(checkclient, 17, 0), // (void)
{"precache_sound", PF_precache_sound, 19},
{"precache_model", PF_precache_model, 20},
{"stuffcmd", PF_stuffcmd, 21},
{"findradius", PF_findradius, 22},
{"bprint", PF_bprint, 23},
{"sprint", PF_sprint, 24},
bi(precache_sound, 19, 1, p(string)),
bi(precache_model, 20, 1, p(string)),
bi(stuffcmd, 21, 2, p(entity), p(string)),
bi(findradius, 22, 2, p(vector), p(float)),
bi(bprint, 23, -1), // (...)
bi(sprint, 24, -2, p(entity)), // (entity, string...)
{"walkmove", PF_walkmove, 32},
bi(walkmove, 32, 2, p(float), p(float)),
{"droptofloor", PF_droptofloor, 34},
{"lightstyle", PF_lightstyle, 35},
bi(droptofloor, 34, 0), // (void)
bi(lightstyle, 35, 2, p(float), p(string)),
{"checkbottom", PF_checkbottom, 40},
{"pointcontents", PF_pointcontents, 41},
bi(checkbottom, 40, 1, p(entity)),
bi(pointcontents, 41, 1, p(vector)),
{"aim", PF_aim, 44},
bi(aim, 44, 2, p(entity), p(float)),
{"localcmd", PF_localcmd, 46},
bi(localcmd, 46, 1, p(string)),
{"particle", PF_particle, 48},
{"changeyaw", PF_changeyaw, 49},
bi(particle, 48, 4, p(vector), p(vector), p(float), p(float)),
bi(changeyaw, 49, 0), // (void)
{"writebyte", PF_WriteByte, 52},
{"WriteBytes", PF_WriteBytes, -1},
{"writechar", PF_WriteChar, 53},
{"writeshort", PF_WriteShort, 54},
{"writelong", PF_WriteLong, 55},
{"writecoord", PF_WriteCoord, 56},
{"writeangle", PF_WriteAngle, 57},
{"WriteCoordV", PF_WriteCoordV, -1},
{"WriteAngleV", PF_WriteAngleV, -1},
{"writestring", PF_WriteString, 58},
{"writeentity", PF_WriteEntity, 59},
bi(WriteByte, 52, 2, p(float), p(float)),
bi(WriteBytes, -1, -2, p(float)), // (float, float...)
bi(WriteChar, 53, 2, p(float), p(float)),
bi(WriteShort, 54, 2, p(float), p(float)),
bi(WriteLong, 55, 2, p(float), p(float)),
bi(WriteCoord, 56, 2, p(float), p(float)),
bi(WriteAngle, 57, 2, p(float), p(float)),
bi(WriteCoordV, -1, 2, p(float), p(vector)),
bi(WriteAngleV, -1, 2, p(float), p(vector)),
bi(WriteString, 58, 2, p(float), p(string)),
bi(WriteEntity, 59, 2, p(float), p(entity)),
#define PF_movetogoal SV_MoveToGoal
bi(movetogoal, 67, 0), // (void)
#undef PF_movetogoal
bi(precache_file, 68, 1, p(string)),
bi(makestatic, 69, 1, p(entity)),
bi(changelevel, 70, 1, p(string)),
{"movetogoal", SV_MoveToGoal, 67},
{"precache_file", PF_precache_file, 68},
{"makestatic", PF_makestatic, 69},
{"changelevel", PF_changelevel, 70},
{"centerprint", PF_centerprint, 73},
{"ambientsound", PF_ambientsound, 74},
{"precache_model2", PF_precache_model, 75},
{"precache_sound2", PF_precache_sound, 76},
{"precache_file2", PF_precache_file, 77},
{"setspawnparms", PF_setspawnparms, 78},
{"testentitypos", PF_testentitypos, QF 92},
{"hullpointcontents", PF_hullpointcontents, QF 93},
{"getboxbounds", PF_getboxbounds, QF 94},
{"getboxhull", PF_getboxhull, QF 95},
{"freeboxhull", PF_freeboxhull, QF 96},
{"rotate_bbox", PF_rotate_bbox, QF 97},
{"tracebox", PF_tracebox, QF 98},
{"checkextension", PF_checkextension, QF 99},
{"EntityParseFunction", ED_EntityParseFunction, -1},
bi(centerprint, 73, -1), // (...)
bi(ambientsound, 74, 4, p(vector), p(string), p(float), p(float)),
bi(precache_model2, 75, 1, p(string)),
bi(precache_sound2, 76, 1, p(string)),
bi(precache_file2, 77, 1, p(string)),
bi(setspawnparms, 78, 1, p(entity)),
bi(testentitypos, QF 92, 1, p(entity)),
bi(hullpointcontents, QF 93, 2, p(entity), p(vector)),
bi(getboxbounds, QF 94, 2, p(int), p(int)),
bi(getboxhull, QF 95, 0), // (void)
bi(freeboxhull, QF 96, 1, p(int)),
bi(rotate_bbox, QF 97, 6, p(int), p(vector), p(vector), p(vector),
p(vector), p(vector)),
bi(tracebox, QF 98, 6, p(vector), p(vector), p(vector), p(vector),
p(float), p(entity)),
bi(checkextension, QF 99, -1, {}), //FIXME correct params?
#define PF_EntityParseFunction ED_EntityParseFunction
bi(EntityParseFunction, -1, 1, p(func)),
#undef PF_EntityParseFunction
{0}
};

View file

@ -684,7 +684,7 @@ PF_findradius (progs_t *pr)
// entity () spawn
static void
PF_Spawn (progs_t *pr)
PF_spawn (progs_t *pr)
{
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)
{
edict_t *ed;
@ -767,6 +767,7 @@ PF_precache_file (progs_t *pr)
// precache_file is used only to copy files with qcc, it does nothing
R_INT (pr) = P_INT (pr, 0);
}
#define PF_precache_file2 PF_precache_file
// void (string s) precache_sound
// string (string s) precache_sound2
@ -777,6 +778,7 @@ PF_precache_sound (progs_t *pr)
"precache_sound");
R_INT (pr) = P_INT (pr, 0);
}
#define PF_precache_sound2 PF_precache_sound
// void (string s) precache_model
// string (string s) precache_model2
@ -787,6 +789,7 @@ PF_precache_model (progs_t *pr)
"precache_model");
R_INT (pr) = P_INT (pr, 0);
}
#define PF_precache_model2 PF_precache_model
/*
PF_walkmove
@ -1639,7 +1642,7 @@ PF_testentitypos (progs_t *pr)
#define MAX_PF_HULLS 64 // FIXME make dynamic?
clip_hull_t *pf_hull_list[MAX_PF_HULLS];
// integer (entity ent, vector point) hullpointcontents
// int (entity ent, vector point) hullpointcontents
static void
PF_hullpointcontents (progs_t *pr)
{
@ -1655,7 +1658,7 @@ PF_hullpointcontents (progs_t *pr)
R_INT (pr) = SV_HullPointContents (hull, 0, offset);
}
// vector (integer hull, integer max) getboxbounds
// vector (int hull, int max) getboxbounds
static void
PF_getboxbounds (progs_t *pr)
{
@ -1672,7 +1675,7 @@ PF_getboxbounds (progs_t *pr)
}
}
// integer () getboxhull
// int () getboxhull
static void
PF_getboxhull (progs_t *pr)
{
@ -1697,7 +1700,7 @@ PF_getboxhull (progs_t *pr)
}
}
// void (integer hull) freeboxhull
// void (int hull) freeboxhull
static void
PF_freeboxhull (progs_t *pr)
{
@ -1727,7 +1730,7 @@ calc_dist (vec3_t p, vec3_t n, vec3_t *offsets)
return DotProduct (v, n);
}
// void (integer hull, vector right, vector forward, vector up, vector mins, vector maxs) rotate_bbox
// void (int hull, vector right, vector forward, vector up, vector mins, vector maxs) rotate_bbox
static void
PF_rotate_bbox (progs_t *pr)
{
@ -1828,7 +1831,7 @@ PF_sv_cvar (progs_t *pr)
}
}
// int () SV_ClientNumber
// int (entity) SV_ClientNumber
// 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
@ -1898,9 +1901,9 @@ PF_SV_SetUserinfo (progs_t *pr)
SV_ExtractFromUserinfo (cl);
}
// void (entity cl, integer ping) SV_SetPing
// void (entity cl, int ping) SV_SetPing
static void
PR_SV_SetPing (progs_t *pr)
PF_SV_SetPing (progs_t *pr)
{
int entnum = P_EDICTNUM (pr, 0);
client_t *cl = svs.clients + entnum - 1;
@ -1910,9 +1913,9 @@ PR_SV_SetPing (progs_t *pr)
cl->ping = P_INT (pr, 1);
}
// void (entity cl, float secs, vector angles, vector move, integer buttons, integer impulse) SV_UserCmd
// void (entity cl, float secs, vector angles, vector move, int buttons, int impulse) SV_UserCmd
static void
PR_SV_UserCmd (progs_t *pr)
PF_SV_UserCmd (progs_t *pr)
{
usercmd_t ucmd;
int entnum = P_EDICTNUM (pr, 0);
@ -1938,7 +1941,7 @@ PR_SV_UserCmd (progs_t *pr)
// void (entity cl) SV_Spawn
static void
PR_SV_Spawn (progs_t *pr)
PF_SV_Spawn (progs_t *pr)
{
int entnum = P_EDICTNUM (pr, 0);
client_t *cl = svs.clients + entnum - 1;
@ -1951,96 +1954,106 @@ PR_SV_Spawn (progs_t *pr)
#define QF (PR_RANGE_QF << PR_RANGE_SHIFT) |
#define bi(x,n,np,params...) {#x, PF_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"makevectors", PF_makevectors, 1},
{"setorigin", PF_setorigin, 2},
{"setmodel", PF_setmodel, 3},
{"setsize", PF_setsize, 4},
bi(makevectors, 1, 1, p(vector)),
bi(setorigin, 2, 2, p(entity), p(vector)),
bi(setmodel, 3, 2, p(entity), p(string)),
bi(setsize, 4, 3, p(entity), p(vector), p(vector)),
{"sound", PF_sound, 8},
bi(sound, 8, 3, p(entity), p(float), p(string)),
{"error", PF_error, 10},
{"objerror", PF_objerror, 11},
{"spawn", PF_Spawn, 14},
{"remove", PF_Remove, 15},
{"traceline", PF_traceline, 16},
{"checkclient", PF_checkclient, 17},
bi(error, 10, -1), // (...)
bi(objerror, 11, -1), // (...)
bi(spawn, 14, 0), // (void)
bi(remove, 15, 1, p(entity)),
bi(traceline, 16, 3, p(vector), p(vector), p(float)),
bi(checkclient, 17, 0), // (void)
{"precache_sound", PF_precache_sound, 19},
{"precache_model", PF_precache_model, 20},
{"stuffcmd", PF_stuffcmd, 21},
{"findradius", PF_findradius, 22},
{"bprint", PF_bprint, 23},
{"sprint", PF_sprint, 24},
bi(precache_sound, 19, 1, p(string)),
bi(precache_model, 20, 1, p(string)),
bi(stuffcmd, 21, 2, p(entity), p(string)),
bi(findradius, 22, 2, p(vector), p(float)),
bi(bprint, 23, -1), // (...)
bi(sprint, 24, -2, p(entity)), // (entity, string...)
{"walkmove", PF_walkmove, 32},
bi(walkmove, 32, 2, p(float), p(float)),
{"droptofloor", PF_droptofloor, 34},
{"lightstyle", PF_lightstyle, 35},
bi(droptofloor, 34, 0), // (void)
bi(lightstyle, 35, 2, p(float), p(string)),
{"checkbottom", PF_checkbottom, 40},
{"pointcontents", PF_pointcontents, 41},
bi(checkbottom, 40, 1, p(entity)),
bi(pointcontents, 41, 1, p(vector)),
{"aim", PF_aim, 44},
bi(aim, 44, 2, p(entity), p(float)),
{"localcmd", PF_localcmd, 46},
bi(localcmd, 46, 1, p(string)),
{"changeyaw", PF_changeyaw, 49},
// bi(particle, 48, 4, p(vector), p(vector), p(float), p(float)),
bi(changeyaw, 49, 0), // (void)
{"writebyte", PF_WriteByte, 52},
{"WriteBytes", PF_WriteBytes, -1},
{"writechar", PF_WriteChar, 53},
{"writeshort", PF_WriteShort, 54},
{"writelong", PF_WriteLong, 55},
{"writecoord", PF_WriteCoord, 56},
{"writeangle", PF_WriteAngle, 57},
{"WriteCoordV", PF_WriteCoordV, -1},
{"WriteAngleV", PF_WriteAngleV, -1},
{"writestring", PF_WriteString, 58},
{"writeentity", PF_WriteEntity, 59},
bi(WriteByte, 52, 2, p(float), p(float)),
bi(WriteBytes, -1, -2, p(float)), // (float, float...)
bi(WriteChar, 53, 2, p(float), p(float)),
bi(WriteShort, 54, 2, p(float), p(float)),
bi(WriteLong, 55, 2, p(float), p(float)),
bi(WriteCoord, 56, 2, p(float), p(float)),
bi(WriteAngle, 57, 2, p(float), p(float)),
bi(WriteCoordV, -1, 2, p(float), p(vector)),
bi(WriteAngleV, -1, 2, p(float), p(vector)),
bi(WriteString, 58, 2, p(float), p(string)),
bi(WriteEntity, 59, 2, p(float), p(entity)),
#define PF_movetogoal SV_MoveToGoal
bi(movetogoal, 67, 0), // (void)
#undef PF_movetogoal
bi(precache_file, 68, 1, p(string)),
bi(makestatic, 69, 1, p(entity)),
bi(changelevel, 70, 1, p(string)),
{"movetogoal", SV_MoveToGoal, 67},
{"precache_file", PF_precache_file, 68},
{"makestatic", PF_makestatic, 69},
{"changelevel", PF_changelevel, 70},
bi(centerprint, 73, -1), // (...)
bi(ambientsound, 74, 4, p(vector), p(string), p(float), p(float)),
bi(precache_model2, 75, 1, p(string)),
bi(precache_sound2, 76, 1, p(string)),
bi(precache_file2, 77, 1, p(string)),
bi(setspawnparms, 78, 1, p(entity)),
{"centerprint", PF_centerprint, 73},
{"ambientsound", PF_ambientsound, 74},
{"precache_model2", PF_precache_model, 75},
{"precache_sound2", PF_precache_sound, 76},
{"precache_file2", PF_precache_file, 77},
{"setspawnparms", PF_setspawnparms, 78},
bi(logfrag, 79, 2, p(entity), p(entity)),
bi(infokey, 80, 2, p(entity), p(string)),
bi(multicast, 81, 2, p(vector), p(float)),
{"logfrag", PF_logfrag, 79},
{"infokey", PF_infokey, 80},
{"multicast", PF_multicast, 82},
bi(testentitypos, QF 92, 1, p(entity)),
bi(hullpointcontents, QF 93, 2, p(entity), p(vector)),
bi(getboxbounds, QF 94, 2, p(int), p(int)),
bi(getboxhull, QF 95, 0), // (void)
bi(freeboxhull, QF 96, 1, p(int)),
bi(rotate_bbox, QF 97, 6, p(int), p(vector), p(vector), p(vector),
p(vector), p(vector)),
bi(tracebox, QF 98, 6, p(vector), p(vector), p(vector), p(vector),
p(float), p(entity)),
bi(checkextension, QF 99, -1, {}), //FIXME correct params?
{"testentitypos", PF_testentitypos, QF 92},
{"hullpointcontents", PF_hullpointcontents, QF 93},
{"getboxbounds", PF_getboxbounds, QF 94},
{"getboxhull", PF_getboxhull, QF 95},
{"freeboxhull", PF_freeboxhull, QF 96},
{"rotate_bbox", PF_rotate_bbox, QF 97},
{"tracebox", PF_tracebox, QF 98},
{"checkextension", PF_checkextension, QF 99},
{"setinfokey", PF_setinfokey, QF 102},
{"cfopen", PF_cfopen, QF 103},
{"cfclose", PF_cfclose, QF 104},
{"cfread", PF_cfread, QF 105},
{"cfwrite", PF_cfwrite, QF 106},
{"cfeof", PF_cfeof, QF 107},
{"cfquota", PF_cfquota, QF 108},
bi(setinfokey, QF 102, 3, p(entity), p(string), p(string)),
bi(cfopen, QF 103, 2, p(string), p(string)),
bi(cfclose, QF 104, 1, p(float)),
bi(cfread, QF 105, 1, p(float)),
bi(cfwrite, QF 106, 2, p(float), p(string)),
bi(cfeof, QF 107, 1, p(float)),
bi(cfquota, QF 108, 0), // (void)
{"SV_ClientNumber", PF_SV_ClientNumber, -1},
{"SV_AllocClient", PF_SV_AllocClient, -1},
{"SV_FreeClient", PF_SV_FreeClient, -1},
{"SV_SetUserinfo", PF_SV_SetUserinfo, -1},
{"SV_SetPing", PR_SV_SetPing, -1},
{"SV_UserCmd", PR_SV_UserCmd, -1},
{"SV_Spawn", PR_SV_Spawn, -1},
bi(SV_ClientNumber, -1, 1, p(entity)),
bi(SV_AllocClient, -1, 0), // (void)
bi(SV_FreeClient, -1, 1, p(entity)),
bi(SV_SetUserinfo, -1, 2, p(entity), p(string)),
bi(SV_SetPing, -1, 2, p(entity), p(int)),
bi(SV_UserCmd, -1, 6, p(entity), p(float), p(vector), p(vector),
p(int), p(int)),
bi(SV_Spawn, -1, 1, p(entity)),
{"EntityParseFunction", ED_EntityParseFunction, -1},
#define PF_EntityParseFunction ED_EntityParseFunction
bi(EntityParseFunction, -1, 1, p(func)),
#undef PF_EntityParseFunction
{0}
};

View file

@ -729,7 +729,7 @@ PF_touchworld (progs_t *pr)
#define TL_EVERYTHING 4 // scan for anything
static void
CPQW_traceline (progs_t *pr)
PF_traceline (progs_t *pr)
{
float *v1, *v2;
edict_t *ent;
@ -774,23 +774,27 @@ CPQW_traceline (progs_t *pr)
#define CPQW (PR_RANGE_CPQW << PR_RANGE_SHIFT) |
#define bi(x,n,np,params...) {"CPCW:"#x, PF_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"CPCW:traceline", CPQW_traceline, CPQW 16},
{"CPQW:getuid", PF_getuid, CPQW 83},
{"CPQW:strcat", PF_strcat, CPQW 84},
{"CPQW:padstr", PF_padstr, CPQW 85},
{"CPQW:colstr", PF_colstr, CPQW 86},
{"CPQW:strcasecmp", PF_strcasecmp, CPQW 87},
{"CPQW:strlen", PF_strlen, CPQW 88},
{"CPQW:getclient", PF_getclient, CPQW 89},
{"CPQW:mutedtime", PF_mutedtime, CPQW 90},
{"CPQW:validatefile", PF_validatefile, CPQW 91},
{"CPQW:putsaytime", PF_putsaytime, CPQW 92},
{"CPQW:makestr", PF_makestr, CPQW 93},
{"CPQW:delstr", PF_delstr, CPQW 94},
{"CPQW:getwave", PF_getwave, CPQW 95},
{"CPQW:clientsound", PF_clientsound, CPQW 96},
{"CPQW:touchworld", PF_touchworld, CPQW 97},
bi(traceline, CPQW 16, 3, p(vector), p(vector), p(float)),
bi(getuid, CPQW 83, 1, p(entity)),
bi(strcat, CPQW 84, 2, p(string), p(string)),
bi(padstr, CPQW 85, 2, p(string), p(float)),
bi(colstr, CPQW 86, 2, p(string), p(float)),
bi(strcasecmp, CPQW 87, 2, p(string), p(string)),
bi(strlen, CPQW 88, 1, p(string)),
bi(getclient, CPQW 89, 1, p(string)),
bi(mutedtime, CPQW 90, 1, p(entity)),
bi(validatefile, CPQW 91, 1, p(string)),
bi(putsaytime, CPQW 92, 1, p(entity)),
bi(makestr, CPQW 93, 1, p(string)),
bi(delstr, CPQW 94, 1, p(string)),
bi(getwave, CPQW 95, 7, p(float), p(float), p(float), p(float),
p(float), p(float), p(float)),
bi(clientsound, CPQW 96, 1, p(entity)),
bi(touchworld, CPQW 97, 0),
{0}
};

View file

@ -480,28 +480,31 @@ PF_conprint (progs_t *pr)
#define QWE (PR_RANGE_QWE << PR_RANGE_SHIFT) |
#define bi(x,n,np,params...) {"QWE:"#x, PF_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"QWE:executecmd", PF_executecmd, QWE 83},
{"QWE:tokanize" /* sic */, PF_tokanize, QWE 84},
{"QWE:argc", PF_argc, QWE 85},
{"QWE:argv", PF_argv, QWE 86},
{"QWE:teamfield", PF_teamfield, QWE 87},
{"QWE:substr", PF_substr, QWE 88},
{"QWE:strcat", PF_strcat, QWE 89},
{"QWE:strlen", PF_strlen, QWE 90},
{"QWE:str2byte", PF_str2byte, QWE 91},
{"QWE:str2short", PF_str2short, QWE 92},
{"QWE:newstr", PF_newstr, QWE 93},
{"QWE:freestr", PF_freestr, QWE 94},
{"QWE:conprint", PF_conprint, QWE 95},
{"QWE:readcmd", PF_readcmd, QWE 96},
{"QWE:strcpy", PF_strcpy, QWE 97},
{"QWE:strstr", PF_strstr, QWE 98},
{"QWE:strncpy", PF_strncpy, QWE 99},
{"QWE:log", PF_log, QWE 100},
{"QWE:redirectcmd", PF_redirectcmd, QWE 101},
{"QWE:calltimeofday", PF_calltimeofday, QWE 102},
{"QWE:forceddemoframe", PF_forcedemoframe, QWE 103},
bi(executecmd, QWE 83, 0),
bi(tokanize, QWE 84, 1, p(string)), /* sic */
bi(argc, QWE 85, 0),
bi(argv, QWE 86, 1, p(float)),
bi(teamfield, QWE 87, 1, p(field)),
bi(substr, QWE 88, 3, p(string), p(float), p(float)),
bi(strcat, QWE 89, -1),
bi(strlen, QWE 90, 1, p(string)),
bi(str2byte, QWE 91, 1, p(string)),
bi(str2short, QWE 92, 1, p(string)),
bi(newstr, QWE 93, 2, p(string), p(float)),
bi(freestr, QWE 94, 1, p(string)),
bi(conprint, QWE 95, -1),
bi(readcmd, QWE 96, 1, p(string)),
bi(strcpy, QWE 97, 2, p(string), p(string)),
bi(strstr, QWE 98, 2, p(string), p(string)),
bi(strncpy, QWE 99, 3, p(string), p(string), p(float)),
bi(log, QWE 100, 3, p(string), p(float), p(string)),
bi(redirectcmd, QWE 101, 2, p(entity), p(string)),
bi(calltimeofday, QWE 102, 0),
bi(forcedemoframe, QWE 103, 1, p(float)),
{0}
};
#define LAST_QWE_BUILTIN 103

View file

@ -1422,7 +1422,7 @@ SV_RemoveUserCommand (void *cmd)
}
static void
PF_AddUserCommand (progs_t *pr)
PF_SV_AddUserCommand (progs_t *pr)
{
const char *name = P_GSTRING (pr, 0);
ucmd_t *cmd;
@ -1999,8 +1999,11 @@ SV_ExecuteClientMessage (client_t *cl)
}
}
#define bi(x,np,params...) {#x, PF_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"SV_AddUserCommand", PF_AddUserCommand, -1},
bi(SV_AddUserCommand, 3, p(string), p(func), p(int)),
{0}
};

View file

@ -21,3 +21,4 @@ int () Menu_GetIndex = #0;
void (void) Menu_Next = #0;
void (void) Menu_Prev = #0;
void (void) Menu_Enter = #0;
void (void) Menu_Leave = #0;

View file

@ -12,7 +12,7 @@ void __obj_exec_class (struct obj_module *msg) = #0;
BOOL __obj_responds_to(id obj, SEL sel) = #0;
void (id object, int code, string fmt, ...) obj_error = #0;
void (id object, int code, string fmt, @va_list args) obj_verror = #0;
//obj_error_handler (objc_error_handler func) obj_set_error_handler = #0;
//obj_error_handler obj_set_error_handler (objc_error_handler func) = #0;
IMP (id receiver, SEL op) obj_msg_lookup = #0;
IMP (Super class, SEL op) obj_msg_lookup_super = #0;
id (id receiver, SEL op, ...) obj_msgSend = #0;
@ -27,11 +27,11 @@ void *obj_valloc (int size) = #0;
void *obj_realloc (void *mem, int size) = #0;
void *obj_calloc (int nelem, int size) = #0;
void obj_free (void *mem) = #0;
//(void *) (void) obj_get_uninstalled_dtable = #0;
void *obj_get_uninstalled_dtable (void) = #0;
Class (string name) obj_get_class = #0;
Class (string name) obj_lookup_class = #0;
//Class (void **enum_stage) obj_next_class = #0;
Class obj_get_class (string name) = #0;
Class obj_lookup_class (string name) = #0;
Class obj_next_class (void **enum_stage) = #0;
string (SEL selector) sel_get_name = #0;
string (SEL selector) sel_get_type = #0;

View file

@ -1,6 +1,7 @@
#include <Set.h>
void set_del_iter (set_iter_t *set_iter) = #0;
unsigned set_iter_element (set_iter_t *set_iter) = #0;
set_t *set_new (void) = #0;
void set_delete (set_t *set) = #0;
set_t *set_add (set_t *set, unsigned x) = #0;

View file

@ -5,3 +5,4 @@ string (string imt, int keynum, string binding) Key_SetBinding = #0;
int (string imt, int bindnum, string binding) Key_LookupBinding = #0;
int (string imt, string binding) Key_CountBinding = #0;
string (int keynum) Key_KeynumToString = #0;
int (string keyname) Key_StringToKeynum = #0;

View file

@ -779,7 +779,7 @@ bi_syncprintf (progs_t *pr)
}
static void
bi_newwin (progs_t *pr)
bi_create_window (progs_t *pr)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "curses");
int xpos = P_INT (pr, 0);
@ -800,7 +800,7 @@ bi_newwin (progs_t *pr)
}
static void
bi_delwin (progs_t *pr)
bi_destroy_window (progs_t *pr)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "curses");
int window_id = P_INT (pr, 0);
@ -839,7 +839,7 @@ bi_getwrect (progs_t *pr)
}
static void
bi_new_panel (progs_t *pr)
bi_create_panel (progs_t *pr)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "curses");
int window_id = P_INT (pr, 0);
@ -870,7 +870,7 @@ panel_command (progs_t *pr, qwaq_commands cmd)
}
static void
bi_del_panel (progs_t *pr)
bi_destroy_panel (progs_t *pr)
{
panel_command (pr, qwaq_cmd_del_panel);
}
@ -1604,26 +1604,26 @@ bi_initialize (progs_t *pr)
}
static void
bi_c_TextContext__is_initialized (progs_t *pr)
bi__c_TextContext__is_initialized (progs_t *pr)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "curses");
R_INT (pr) = res->initialized;
}
static void
bi_c_TextContext__max_colors (progs_t *pr)
bi__c_TextContext__max_colors (progs_t *pr)
{
bi_max_colors (pr);
}
static void
bi_c_TextContext__max_color_pairs (progs_t *pr)
bi__c_TextContext__max_color_pairs (progs_t *pr)
{
bi_max_color_pairs (pr);
}
static void
bi_c_TextContext__init_pair_ (progs_t *pr)
bi__c_TextContext__init_pair_ (progs_t *pr)
{
int pair = P_INT (pr, 2);
int f = P_INT (pr, 3);
@ -1633,7 +1633,7 @@ bi_c_TextContext__init_pair_ (progs_t *pr)
}
static void
bi_c_TextContext__acs_char_ (progs_t *pr)
bi__c_TextContext__acs_char_ (progs_t *pr)
{
int acs = P_INT (pr, 2);
@ -1641,7 +1641,7 @@ bi_c_TextContext__acs_char_ (progs_t *pr)
}
static void
bi_c_TextContext__move_ (progs_t *pr)
bi__c_TextContext__move_ (progs_t *pr)
{
Point *pos = &P_PACKED (pr, Point, 2);
@ -1649,7 +1649,7 @@ bi_c_TextContext__move_ (progs_t *pr)
}
static void
bi_c_TextContext__curs_set_ (progs_t *pr)
bi__c_TextContext__curs_set_ (progs_t *pr)
{
int visibility = P_INT (pr, 2);
@ -1657,13 +1657,13 @@ bi_c_TextContext__curs_set_ (progs_t *pr)
}
static void
bi_c_TextContext__doupdate (progs_t *pr)
bi__c_TextContext__doupdate (progs_t *pr)
{
bi_doupdate (pr);
}
static void
bi_i_TextContext__mvprintf_ (progs_t *pr)
bi__i_TextContext__mvprintf_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
Point *pos = &P_PACKED (pr, Point, 2);
@ -1675,7 +1675,7 @@ bi_i_TextContext__mvprintf_ (progs_t *pr)
}
static void
bi_i_TextContext__printf_ (progs_t *pr)
bi__i_TextContext__printf_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
const char *fmt = P_GSTRING (pr, 2);
@ -1686,7 +1686,7 @@ bi_i_TextContext__printf_ (progs_t *pr)
}
static void
bi_i_TextContext__vprintf_ (progs_t *pr)
bi__i_TextContext__vprintf_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
const char *fmt = P_GSTRING (pr, 2);
@ -1696,7 +1696,7 @@ bi_i_TextContext__vprintf_ (progs_t *pr)
}
static void
bi_i_TextContext__addch_ (progs_t *pr)
bi__i_TextContext__addch_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
int ch = P_INT (pr, 2);
@ -1705,7 +1705,7 @@ bi_i_TextContext__addch_ (progs_t *pr)
}
static void
bi_i_TextContext__addstr_ (progs_t *pr)
bi__i_TextContext__addstr_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
const char *str = P_GSTRING (pr, 2);
@ -1714,7 +1714,7 @@ bi_i_TextContext__addstr_ (progs_t *pr)
}
static void
bi_i_TextContext__mvvprintf_ (progs_t *pr)
bi__i_TextContext__mvvprintf_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
Point *pos = &P_PACKED (pr, Point, 2);
@ -1725,7 +1725,7 @@ bi_i_TextContext__mvvprintf_ (progs_t *pr)
}
static void
bi_i_TextContext__resizeTo_ (progs_t *pr)
bi__i_TextContext__resizeTo_ (progs_t *pr)
{
__auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0);
int window_id = self->window;
@ -1738,14 +1738,14 @@ bi_i_TextContext__resizeTo_ (progs_t *pr)
}
static void
bi_c_TextContext__refresh (progs_t *pr)
bi__c_TextContext__refresh (progs_t *pr)
{
qwaq_update_panels (pr);
qwaq_doupdate (pr);
}
static void
bi_i_TextContext__refresh (progs_t *pr)
bi__i_TextContext__refresh (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
@ -1757,7 +1757,7 @@ bi_i_TextContext__refresh (progs_t *pr)
}
static void
bi_i_TextContext__mvaddch_ (progs_t *pr)
bi__i_TextContext__mvaddch_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
Point *pos = &P_PACKED (pr, Point, 2);
@ -1767,7 +1767,7 @@ bi_i_TextContext__mvaddch_ (progs_t *pr)
}
static void
bi_i_TextContext__mvaddstr_ (progs_t *pr)
bi__i_TextContext__mvaddstr_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
Point *pos = &P_PACKED (pr, Point, 2);
@ -1777,7 +1777,7 @@ bi_i_TextContext__mvaddstr_ (progs_t *pr)
}
static void
bi_i_TextContext__bkgd_ (progs_t *pr)
bi__i_TextContext__bkgd_ (progs_t *pr)
{
__auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0);
int window_id = self->window;
@ -1788,7 +1788,7 @@ bi_i_TextContext__bkgd_ (progs_t *pr)
}
static void
bi_i_TextContext__clear (progs_t *pr)
bi__i_TextContext__clear (progs_t *pr)
{
__auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0);
int window_id = self->window;
@ -1798,7 +1798,7 @@ bi_i_TextContext__clear (progs_t *pr)
}
static void
bi_i_TextContext__scrollok_ (progs_t *pr)
bi__i_TextContext__scrollok_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
int flag = P_INT (pr, 2);
@ -1807,7 +1807,7 @@ bi_i_TextContext__scrollok_ (progs_t *pr)
}
static void
bi_i_TextContext__border_ (progs_t *pr)
bi__i_TextContext__border_ (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
__auto_type sides = P_PACKED (pr, box_sides_t, 2);
@ -1817,7 +1817,7 @@ bi_i_TextContext__border_ (progs_t *pr)
}
static void
bi_i_TextContext__mvhline_ (progs_t *pr)
bi__i_TextContext__mvhline_ (progs_t *pr)
{
__auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0);
int window_id = self->window;
@ -1829,7 +1829,7 @@ bi_i_TextContext__mvhline_ (progs_t *pr)
}
static void
bi_i_TextContext__mvvline_ (progs_t *pr)
bi__i_TextContext__mvvline_ (progs_t *pr)
{
__auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0);
int window_id = self->window;
@ -1854,74 +1854,95 @@ bi_curses_clear (progs_t *pr, void *data)
panel_reset (res);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"initialize", bi_initialize, -1},
{"syncprintf", bi_syncprintf, -1},
{"create_window", bi_newwin, -1},
{"destroy_window", bi_delwin, -1},
{"getwrect", bi_getwrect, -1},
{"create_panel", bi_new_panel, -1},
{"destroy_panel", bi_del_panel, -1},
{"hide_panel", bi_hide_panel, -1},
{"show_panel", bi_show_panel, -1},
{"top_panel", bi_top_panel, -1},
{"bottom_panel", bi_bottom_panel, -1},
{"move_panel", bi_move_panel, -1},
{"panel_window", bi_panel_window, -1},
{"replace_panel", bi_replace_panel, -1},
{"update_panels", bi_update_panels, -1},
{"doupdate", bi_doupdate, -1},
{"mvwprintf", bi_mvwprintf, -1},
{"wprintf", bi_wprintf, -1},
{"wvprintf", bi_wvprintf, -1},
{"mvwvprintf", bi_mvwvprintf, -1},
{"mvwaddch", bi_mvwaddch, -1},
{"waddch", bi_waddch, -1},
{"mvwaddstr", bi_mvwaddstr, -1},
{"waddstr", bi_waddstr, -1},
{"wrefresh", bi_wrefresh, -1},
{"max_colors", bi_max_colors, -1},
{"max_color_pairs", bi_max_color_pairs, -1},
{"init_pair", bi_init_pair, -1},
{"wbkgd", bi_wbkgd, -1},
{"werase", bi_werase, -1},
{"scrollok", bi_scrollok, -1},
{"wmove", bi_wmove, -1},
{"acs_char", bi_acs_char, -1},
{"move", bi_move, -1},
{"curs_set", bi_curs_set, -1},
{"wborder", bi_wborder, -1},
{"mvwblit_line", bi_mvwblit_line, -1},
{"wresize", bi_wresize, -1},
{"resizeterm", bi_resizeterm, -1},
{"mvwhline", bi_mvwhline, -1},
{"mvwvline", bi_mvwvline, -1},
bi(initialize, 0),
bi(syncprintf, -2, p(string)),
bi(create_window, 4, p(int), p(int), p(int), p(int)),
bi(destroy_window, 1, p(ptr)),
bi(getwrect, 1, p(ptr)),
bi(create_panel, 1, p(ptr)),
bi(destroy_panel, 1, p(ptr)),
bi(hide_panel, 1, p(ptr)),
bi(show_panel, 1, p(ptr)),
bi(top_panel, 1, p(ptr)),
bi(bottom_panel, 1, p(ptr)),
bi(move_panel, 3, p(ptr), p(int), p(int)),
bi(panel_window, 1, p(ptr)),
bi(replace_panel, 2, p(ptr), p(ptr)),
bi(update_panels, 0),
bi(doupdate, 0),
bi(mvwprintf, -5, p(ptr), p(int), p(int), p(string)),
bi(wprintf, -3, p(ptr), p(string)),
bi(wvprintf, 3, p(ptr), p(string), P(1, 2)),
bi(mvwvprintf, 5, p(ptr), p(int), p(int), p(string), P(1, 2)),
bi(mvwaddch, 4, p(ptr), p(int), p(int), p(int)),
bi(waddch, 2, p(ptr), p(int)),
bi(mvwaddstr, 4, p(ptr), p(int), p(int), p(string)),
bi(waddstr, 2, p(ptr), p(string)),
bi(wrefresh, 1, p(ptr)),
bi(max_colors, 0),
bi(max_color_pairs, 0),
bi(init_pair, 3, p(int), p(int), p(int)),
bi(wbkgd, 2, p(ptr), p(int)),
bi(werase, 1, p(ptr)),
bi(scrollok, 2, p(ptr), p(int)),
bi(wmove, 3, p(ptr), p(int), p(int), p(int)),
bi(acs_char, 1, p(int)),
bi(move, 2, p(int), p(int)),
bi(curs_set, 1, p(int)),
bi(wborder, 3, p(ptr), P(1, 4), P(1, 4)),
bi(mvwblit_line, 5, p(ptr), p(int), p(int), p(ptr), p(int)),
bi(wresize, 3, p(ptr), p(int), p(int)),
bi(resizeterm, 2, p(int), p(int)),
bi(mvwhline, 5, p(ptr), p(int), p(int), p(int), p(int)),
bi(mvwvline, 5, p(ptr), p(int), p(int), p(int), p(int)),
{"_c_TextContext__is_initialized", bi_c_TextContext__is_initialized, -1},
{"_c_TextContext__max_colors", bi_c_TextContext__max_colors, -1},
{"_c_TextContext__max_color_pairs", bi_c_TextContext__max_color_pairs, -1},
{"_c_TextContext__init_pair_", bi_c_TextContext__init_pair_, -1},
{"_c_TextContext__acs_char_", bi_c_TextContext__acs_char_, -1},
{"_c_TextContext__move_", bi_c_TextContext__move_, -1},
{"_c_TextContext__curs_set_", bi_c_TextContext__curs_set_, -1},
{"_c_TextContext__doupdate", bi_c_TextContext__doupdate, -1},
{"_i_TextContext__mvprintf_", bi_i_TextContext__mvprintf_, -1},
{"_i_TextContext__printf_", bi_i_TextContext__printf_, -1},
{"_i_TextContext__vprintf_", bi_i_TextContext__vprintf_, -1},
{"_i_TextContext__addch_", bi_i_TextContext__addch_, -1},
{"_i_TextContext__addstr_", bi_i_TextContext__addstr_, -1},
{"_i_TextContext__mvvprintf_", bi_i_TextContext__mvvprintf_, -1},
{"_i_TextContext__resizeTo_", bi_i_TextContext__resizeTo_, -1},
{"_c_TextContext__refresh", bi_c_TextContext__refresh, -1},
{"_i_TextContext__refresh", bi_i_TextContext__refresh, -1},
{"_i_TextContext__mvaddch_", bi_i_TextContext__mvaddch_, -1},
{"_i_TextContext__mvaddstr_", bi_i_TextContext__mvaddstr_, -1},
{"_i_TextContext__bkgd_", bi_i_TextContext__bkgd_, -1},
{"_i_TextContext__clear", bi_i_TextContext__clear, -1},
{"_i_TextContext__scrollok_", bi_i_TextContext__scrollok_, -1},
{"_i_TextContext__border_", bi_i_TextContext__border_, -1},
{"_i_TextContext__mvhline_", bi_i_TextContext__mvhline_, -1},
{"_i_TextContext__mvvline_", bi_i_TextContext__mvvline_, -1},
bi(_c_TextContext__is_initialized, 2, p(ptr), p(ptr)),
bi(_c_TextContext__max_colors, 2, p(ptr), p(ptr)),
bi(_c_TextContext__max_color_pairs, 2, p(ptr), p(ptr)),
bi(_c_TextContext__init_pair_, 5, p(ptr), p(ptr),
p(int), p(int), p(int)),
bi(_c_TextContext__acs_char_, 3, p(ptr), p(ptr),
p(int)),
bi(_c_TextContext__move_, 3, p(ptr), p(ptr),
P(1, 2)),
bi(_c_TextContext__curs_set_, 3, p(ptr), p(ptr),
p(int)),
bi(_c_TextContext__doupdate, 2, p(ptr), p(ptr)),
bi(_i_TextContext__mvprintf_, -5, p(ptr), p(ptr),
P(1, 2), p(string)),
bi(_i_TextContext__printf_, -4, p(ptr), p(ptr),
p(string)),
bi(_i_TextContext__vprintf_, 4, p(ptr), p(ptr),
p(string), P(1, 2)),
bi(_i_TextContext__addch_, 3, p(ptr), p(ptr),
p(int)),
bi(_i_TextContext__addstr_, 3, p(ptr), p(ptr),
p(string)),
bi(_i_TextContext__mvvprintf_, 5, p(ptr), p(ptr),
P(1, 2), p(string), P(1, 2)),
bi(_i_TextContext__resizeTo_, 3, p(ptr), p(ptr),
P(1, 2)),
bi(_c_TextContext__refresh, 2, p(ptr), p(ptr)),
bi(_i_TextContext__refresh, 2, p(ptr), p(ptr)),
bi(_i_TextContext__mvaddch_, 4, p(ptr), p(ptr),
P(1, 2), p(int)),
bi(_i_TextContext__mvaddstr_, 4, p(ptr), p(ptr),
P(1, 2), p(string)),
bi(_i_TextContext__bkgd_, 3, p(ptr), p(ptr),
p(int)),
bi(_i_TextContext__clear, 2, p(ptr), p(ptr)),
bi(_i_TextContext__scrollok_, 3, p(ptr), p(ptr),
p(int)),
bi(_i_TextContext__border_, 4, p(ptr), p(ptr),
P(1, 4), P(1, 4)),
bi(_i_TextContext__mvhline_, 5, p(ptr), p(ptr),
P(1, 2), p(int), p(int)),
bi(_i_TextContext__mvvline_, 5, p(ptr), p(ptr),
P(1, 2), p(int), p(int)),
{0}
};

View file

@ -649,30 +649,32 @@ qdb_get_source_line_addr (progs_t *pr)
R_UINT (pr) = PR_FindSourceLineAddr (tpr, file, line);
}
#define bi(x,np,params...) {#x, x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"qdb_set_trace", qdb_set_trace, -1},
{"qdb_set_breakpoint", qdb_set_breakpoint, -1},
{"qdb_clear_breakpoint", qdb_clear_breakpoint, -1},
{"qdb_set_watchpoint", qdb_set_watchpoint, -1},
{"qdb_clear_watchpoint", qdb_clear_watchpoint, -1},
{"qdb_continue", qdb_continue, -1},
{"qdb_get_state", qdb_get_state, -1},
{"qdb_get_stack_depth", qdb_get_stack_depth, -1},
{"qdb_get_stack", qdb_get_stack, -1},
{"qdb_get_event", qdb_get_event, -1},
{"qdb_get_data", qdb_get_data, -1},
{"qdb_get_string|{tag qdb_target_s=}I", qdb_get_string, -1},
{"qdb_get_string|{tag qdb_target_s=}*", qdb_get_string, -1},
{"qdb_get_file_path", qdb_get_file_path, -1},
{"qdb_find_string", qdb_find_string, -1},
{"qdb_find_global", qdb_find_global, -1},
{"qdb_find_field", qdb_find_field, -1},
{"qdb_find_function", qdb_find_function, -1},
{"qdb_get_function", qdb_get_function, -1},
{"qdb_find_auxfunction", qdb_find_auxfunction, -1},
{"qdb_get_auxfunction", qdb_get_auxfunction, -1},
{"qdb_get_local_defs", qdb_get_local_defs, -1},
{"qdb_get_source_line_addr", qdb_get_source_line_addr, -1},
bi(qdb_set_trace, 2, p(int), p(int)),
bi(qdb_set_breakpoint, 2, p(int), p(uint)),
bi(qdb_clear_breakpoint, 2, p(int), p(uint)),
bi(qdb_set_watchpoint, 2, p(int), p(uint)),
bi(qdb_clear_watchpoint, 1, p(int)),
bi(qdb_continue, 1, p(int)),
bi(qdb_get_state, 1, p(int)),
bi(qdb_get_stack_depth, 1, p(int)),
bi(qdb_get_stack, 1, p(int)),
bi(qdb_get_event, 2, p(int), p(ptr)),
bi(qdb_get_data, 4, p(int), p(uint), p(uint), p(ptr)),
{"qdb_get_string|{tag qdb_target_s=}I", qdb_get_string, -1, 1, {p(uint)}},
{"qdb_get_string|{tag qdb_target_s=}*", qdb_get_string, -1, 1, {p(string)}},
bi(qdb_get_file_path, 2, p(int), p(string)),
bi(qdb_find_string, 2, p(int), p(string)),
bi(qdb_find_global, 2, p(int), p(string)),
bi(qdb_find_field, 2, p(int), p(string)),
bi(qdb_find_function, 2, p(int), p(string)),
bi(qdb_get_function, 2, p(int), p(uint)),
bi(qdb_find_auxfunction, 2, p(int), p(string)),
bi(qdb_get_auxfunction, 2, p(int), p(uint)),
bi(qdb_get_local_defs, 2, p(int), p(uint)),
bi(qdb_get_source_line_addr, 3, p(int), p(string), p(uint)),
{}
};

View file

@ -575,7 +575,7 @@ formatLine (txtbuffer_t *buffer, unsigned linePtr, unsigned xpos,
//===
static void
bi_i_EditBuffer__init (progs_t *pr)
bi__i_EditBuffer__init (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
__auto_type self = &P_STRUCT (pr, qwaq_editbuffer_t, 0);
@ -591,7 +591,7 @@ bi_i_EditBuffer__init (progs_t *pr)
}
static void
bi_i_EditBuffer__initWithFile_ (progs_t *pr)
bi__i_EditBuffer__initWithFile_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
__auto_type self = &P_STRUCT (pr, qwaq_editbuffer_t, 0);
@ -610,7 +610,7 @@ bi_i_EditBuffer__initWithFile_ (progs_t *pr)
}
static void
bi_i_EditBuffer__dealloc (progs_t *pr)
bi__i_EditBuffer__dealloc (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
__auto_type self = &P_STRUCT (pr, qwaq_editbuffer_t, 0);
@ -622,7 +622,7 @@ bi_i_EditBuffer__dealloc (progs_t *pr)
}
static void
bi_i_EditBuffer__nextChar_ (progs_t *pr)
bi__i_EditBuffer__nextChar_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -633,7 +633,7 @@ bi_i_EditBuffer__nextChar_ (progs_t *pr)
}
static void
bi_i_EditBuffer__prevChar_ (progs_t *pr)
bi__i_EditBuffer__prevChar_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -644,7 +644,7 @@ bi_i_EditBuffer__prevChar_ (progs_t *pr)
}
static void
bi_i_EditBuffer__nextNonSpace_ (progs_t *pr)
bi__i_EditBuffer__nextNonSpace_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -655,7 +655,7 @@ bi_i_EditBuffer__nextNonSpace_ (progs_t *pr)
}
static void
bi_i_EditBuffer__prevNonSpace_ (progs_t *pr)
bi__i_EditBuffer__prevNonSpace_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -666,7 +666,7 @@ bi_i_EditBuffer__prevNonSpace_ (progs_t *pr)
}
static void
bi_i_EditBuffer__isWord_ (progs_t *pr)
bi__i_EditBuffer__isWord_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -677,7 +677,7 @@ bi_i_EditBuffer__isWord_ (progs_t *pr)
}
static void
bi_i_EditBuffer__nextWord_ (progs_t *pr)
bi__i_EditBuffer__nextWord_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -688,7 +688,7 @@ bi_i_EditBuffer__nextWord_ (progs_t *pr)
}
static void
bi_i_EditBuffer__prevWord_ (progs_t *pr)
bi__i_EditBuffer__prevWord_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -699,7 +699,7 @@ bi_i_EditBuffer__prevWord_ (progs_t *pr)
}
static void
bi_i_EditBuffer__nextLine_ (progs_t *pr)
bi__i_EditBuffer__nextLine_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -710,7 +710,7 @@ bi_i_EditBuffer__nextLine_ (progs_t *pr)
}
static void
bi_i_EditBuffer__prevLine_ (progs_t *pr)
bi__i_EditBuffer__prevLine_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -721,7 +721,7 @@ bi_i_EditBuffer__prevLine_ (progs_t *pr)
}
static void
bi_i_EditBuffer__nextLine__ (progs_t *pr)
bi__i_EditBuffer__nextLine__ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -742,7 +742,7 @@ bi_i_EditBuffer__nextLine__ (progs_t *pr)
}
static void
bi_i_EditBuffer__prevLine__ (progs_t *pr)
bi__i_EditBuffer__prevLine__ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -757,7 +757,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -770,7 +770,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -783,7 +783,7 @@ bi_i_EditBuffer__charPtr_at_ (progs_t *pr)
}
static void
bi_i_EditBuffer__getWord_ (progs_t *pr)
bi__i_EditBuffer__getWord_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -797,7 +797,7 @@ bi_i_EditBuffer__getWord_ (progs_t *pr)
}
static void
bi_i_EditBuffer__getLine_ (progs_t *pr)
bi__i_EditBuffer__getLine_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -811,7 +811,7 @@ bi_i_EditBuffer__getLine_ (progs_t *pr)
}
static void
bi_i_EditBuffer__getBOL_ (progs_t *pr)
bi__i_EditBuffer__getBOL_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -822,7 +822,7 @@ bi_i_EditBuffer__getBOL_ (progs_t *pr)
}
static void
bi_i_EditBuffer__getEOL_ (progs_t *pr)
bi__i_EditBuffer__getEOL_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -833,7 +833,7 @@ bi_i_EditBuffer__getEOL_ (progs_t *pr)
}
static void
bi_i_EditBuffer__getBOT (progs_t *pr)
bi__i_EditBuffer__getBOT (progs_t *pr)
{
//qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
//int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -843,7 +843,7 @@ bi_i_EditBuffer__getBOT (progs_t *pr)
}
static void
bi_i_EditBuffer__getEOT (progs_t *pr)
bi__i_EditBuffer__getEOT (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -853,7 +853,7 @@ bi_i_EditBuffer__getEOT (progs_t *pr)
}
static void
bi_i_EditBuffer__readString_ (progs_t *pr)
bi__i_EditBuffer__readString_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -868,7 +868,7 @@ bi_i_EditBuffer__readString_ (progs_t *pr)
}
static void
bi_i_EditBuffer__getChar_ (progs_t *pr)
bi__i_EditBuffer__getChar_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -882,7 +882,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -897,7 +897,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -912,7 +912,7 @@ bi_i_EditBuffer__insertChar_at_ (progs_t *pr)
}
static void
bi_i_EditBuffer__countLines_ (progs_t *pr)
bi__i_EditBuffer__countLines_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -924,7 +924,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -938,7 +938,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -952,7 +952,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -972,7 +972,7 @@ 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)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -981,7 +981,7 @@ bi_i_EditBuffer__modified (progs_t *pr)
}
static void
bi_i_EditBuffer__textSize (progs_t *pr)
bi__i_EditBuffer__textSize (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -990,7 +990,7 @@ bi_i_EditBuffer__textSize (progs_t *pr)
}
static void
bi_i_EditBuffer__saveFile_ (progs_t *pr)
bi__i_EditBuffer__saveFile_ (progs_t *pr)
{
qwaq_ebresources_t *res = PR_Resources_Find (pr, "qwaq-editbuffer");
int buffer_id = P_STRUCT (pr, qwaq_editbuffer_t, 0).buffer;
@ -1015,43 +1015,47 @@ qwaq_ebresources_clear (progs_t *pr, void *data)
editbuffer_reset (res);
}
#define bi(x,n,np,params...) {#x, bi_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
#define P(a, s) { .size = (s), .alignment = BITOP_LOG2 (a), }
static builtin_t builtins[] = {
{"_i_EditBuffer__init", bi_i_EditBuffer__init, -1},
{"_i_EditBuffer__initWithFile_", bi_i_EditBuffer__initWithFile_, -1},
{"_i_EditBuffer__dealloc", bi_i_EditBuffer__dealloc, -1},
{"_i_EditBuffer__nextChar_", bi_i_EditBuffer__nextChar_, -1},
{"_i_EditBuffer__prevChar_", bi_i_EditBuffer__prevChar_, -1},
{"_i_EditBuffer__nextNonSpace_", bi_i_EditBuffer__nextNonSpace_, -1},
{"_i_EditBuffer__prevNonSpace_", bi_i_EditBuffer__prevNonSpace_, -1},
{"_i_EditBuffer__isWord_", bi_i_EditBuffer__isWord_, -1},
{"_i_EditBuffer__nextWord_", bi_i_EditBuffer__nextWord_, -1},
{"_i_EditBuffer__prevWord_", bi_i_EditBuffer__prevWord_, -1},
{"_i_EditBuffer__nextLine_", bi_i_EditBuffer__nextLine_, -1},
{"_i_EditBuffer__prevLine_", bi_i_EditBuffer__prevLine_, -1},
{"_i_EditBuffer__nextLine__", bi_i_EditBuffer__nextLine__, -1},
{"_i_EditBuffer__prevLine__", bi_i_EditBuffer__prevLine__, -1},
{"_i_EditBuffer__charPos_at_", bi_i_EditBuffer__charPos_at_, -1},
{"_i_EditBuffer__charPtr_at_", bi_i_EditBuffer__charPtr_at_, -1},
{"_i_EditBuffer__getWord_", bi_i_EditBuffer__getWord_, -1},
{"_i_EditBuffer__getLine_", bi_i_EditBuffer__getLine_, -1},
{"_i_EditBuffer__getBOL_", bi_i_EditBuffer__getBOL_, -1},
{"_i_EditBuffer__getEOL_", bi_i_EditBuffer__getEOL_, -1},
{"_i_EditBuffer__getBOT", bi_i_EditBuffer__getBOT, -1},
{"_i_EditBuffer__getEOT", bi_i_EditBuffer__getEOT, -1},
{"_i_EditBuffer__readString_", bi_i_EditBuffer__readString_, -1},
{"_i_EditBuffer__getChar_", bi_i_EditBuffer__getChar_, -1},
{"_i_EditBuffer__putChar_at_", bi_i_EditBuffer__putChar_at_, -1},
{"_i_EditBuffer__insertChar_at_", bi_i_EditBuffer__insertChar_at_,-1},
{"_i_EditBuffer__countLines_", bi_i_EditBuffer__countLines_, -1},
{"_i_EditBuffer__search_for_direction_",
bi_i_EditBuffer__search_for_direction_, -1},
{"_i_EditBuffer__isearch_for_direction_",
bi_i_EditBuffer__isearch_for_direction_,-1},
{"_i_EditBuffer__formatLine_from_into_width_highlight_colors_",
bi_i_EditBuffer__formatLine_from_into_width_highlight_colors_, -1},
{"_i_EditBuffer__modified", bi_i_EditBuffer__modified, -1},
{"_i_EditBuffer__textSize", bi_i_EditBuffer__textSize, -1},
{"_i_EditBuffer__saveFile_", bi_i_EditBuffer__saveFile_, -1},
bi(_i_EditBuffer__init, -1, 2, p(ptr), p(ptr)),
bi(_i_EditBuffer__initWithFile_, -1, 3, p(ptr), p(ptr), p(string)),
bi(_i_EditBuffer__dealloc, -1, 2, p(ptr), p(ptr)),
bi(_i_EditBuffer__nextChar_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__prevChar_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__nextNonSpace_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__prevNonSpace_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__isWord_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__nextWord_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__prevWord_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__nextLine_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__prevLine_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__nextLine__, -1, 4, p(ptr), p(ptr), p(uint), p(uint)),
bi(_i_EditBuffer__prevLine__, -1, 4, p(ptr), p(ptr), p(uint), p(uint)),
bi(_i_EditBuffer__charPos_at_, -1, 4, p(ptr), p(ptr), p(uint), p(uint)),
bi(_i_EditBuffer__charPtr_at_, -1, 4, p(ptr), p(ptr), p(uint), p(uint)),
bi(_i_EditBuffer__getWord_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__getLine_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__getBOL_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__getEOL_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__getBOT, -1, 2, p(ptr), p(ptr)),
bi(_i_EditBuffer__getEOT, -1, 2, p(ptr), p(ptr)),
bi(_i_EditBuffer__readString_, -1, 3, p(ptr), p(ptr), P(1, 2)),
bi(_i_EditBuffer__getChar_, -1, 3, p(ptr), p(ptr), p(uint)),
bi(_i_EditBuffer__putChar_at_, -1, 4, p(ptr), p(ptr), p(int), p(uint)),
bi(_i_EditBuffer__insertChar_at_, -1, 4, p(ptr), p(ptr), p(int), p(uint)),
bi(_i_EditBuffer__countLines_, -1, 3, p(ptr), p(ptr), P(1, 2)),
bi(_i_EditBuffer__search_for_direction_, -1,
5, p(ptr), p(ptr), P(1, 2), p(string), p(int)),
bi(_i_EditBuffer__isearch_for_direction_,-1,
5, p(ptr), p(ptr), P(1, 2), p(string), p(int)),
bi(_i_EditBuffer__formatLine_from_into_width_highlight_colors_, -1,
8, p(ptr), p(ptr),
p(uint), p(uint), p(ptr), p(uint), P(1, 2), P(1, 2)),
bi(_i_EditBuffer__modified, -1, 2, p(ptr), p(ptr)),
bi(_i_EditBuffer__textSize, -1, 2, p(ptr), p(ptr)),
bi(_i_EditBuffer__saveFile_, -1, 3, p(ptr), p(ptr), p(string)),
{}
};

View file

@ -120,15 +120,17 @@ bi_refresh_2d (progs_t *pr)
}
static void
bi_shutdown_ (progs_t *pr)
bi_shutdown (progs_t *pr)
{
Sys_Shutdown ();
}
#define bi(x,n,np,params...) {#x, bi_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"refresh", bi_refresh, -1},
{"refresh_2d", bi_refresh_2d, -1},
{"shutdown", bi_shutdown_, -1},
bi(refresh, -1, 0),
bi(refresh_2d, -1, 1, p(func)),
bi(shutdown, -1, 0),
{0}
};
@ -139,7 +141,7 @@ event_handler (const IE_event_t *ie_event, void *_pr)
}
static void
bi_shutdown (void *data)
BI_shutdown (void *data)
{
}
@ -155,7 +157,7 @@ BI_Graphics_Init (progs_t *pr)
PI_Init ();
PI_RegisterPlugins (client_plugin_list);
Sys_RegisterShutdown (bi_shutdown, pr);
Sys_RegisterShutdown (BI_shutdown, pr);
VID_Init_Cvars ();
IN_Init_Cvars ();

View file

@ -172,10 +172,12 @@ bi_traceoff (progs_t *pr)
pr->pr_trace = false;
}
#define bi(x,n,np,params...) {#x, bi_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t common_builtins[] = {
{"printf", bi_printf, -1},
{"traceon", bi_traceon, -1},
{"traceoff", bi_traceoff, -1},
bi(printf, -1, -2, p(string)),
bi(traceon, -1, 0),
bi(traceoff, -1, 0),
{},
};

View file

@ -868,11 +868,13 @@ bi_init_input (progs_t *pr)
IE_Send_Event (&event);
}
#define bi(x,n,np,params...) {#x, bi_##x, n, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"send_connected_devices", bi_send_connected_devices, -1},
{"get_device_info", bi_get_device_info, -1},
{"get_event", bi_get_event, -1},
{"init_input", bi_init_input, -1},
bi(send_connected_devices, -1, 0),
bi(get_device_info, -1, 1, p(int)),
bi(get_event, -1, 1, p(ptr)),
bi(init_input, -1, 0),
{0}
};

View file

@ -95,13 +95,15 @@ bi_remove (progs_t *pr)
ED_Free (pr, ed);
}
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
#define p(type) PR_PARAM(type)
static builtin_t builtins[] = {
{"printf", bi_printf, -1},
{"errno", bi_errno, -1},
{"strerror", bi_strerror, -1},
{"exit", bi_exit, -1},
{"spawn", bi_spawn, -1},
{"remove", bi_remove, -1},
bi(printf, -2, p(string)),
bi(errno, 0),
bi(strerror, 1, p(int)),
bi(exit, 1, p(int)),
bi(spawn, 0),
bi(remove, 1, p(entity)),
{0}
};