Alternatively, you could use xs stock library's weird task system - if it still works on today's releases of the Small compiler. (I wrote it more than a year ago [don't expect it to be bug-free =P ] ).
Code:
#include <xs>
// somewhere:
xs_task_begin(1.5, "my_task", -1); // id=-1 means to auto-choose a free id
xs_task_pushint(0xdeadbeef);
xs_task_pushfl(123.456);
xs_task_pushstr("Hello BAIL!");
new id = xs_task_end();
// id now contains the id!
// on global scope:
XS_MAKE_TASKFUNC(my_task)
{
new id = xs_task_readid(); // What else would it do
new pcount = xs_task_paramcount();
log_amx("my_task called; id=%d", id);
for (new i = 0; i < pcount; ++i)
{
new ptype = xs_task_paramtype(i);
if (ptype == xs_int)
log_amx("Param%d: int: %d", i, xs_task_paramint(i));
else if (ptype == xs_float)
log_amx("Param%d: float: %f", i, xs_task_paramfl(i));
else if (ptype == xs_string)
{
new str[256];
xs_task_paramstr(i, str, 255);
log_amx("Param%d: string: %s", i, str);
}
}
}
You get the idea. The definitions of all these functions (and macros) are in xs.inc, if you are interested. Note that it might represent measurable overhead to use these functions, so better don't use it in really heavily used and performacne critical stuff.
(I'm tired so sorry for any mistakes)
__________________