m_query(const query[], const callback[] = "", const format[] = "", {Float, _}:...)
{
new
args = numargs();
if(args > 3)
{
switch(args)
{
case 4: mysql_tquery(gSQL, query, callback, format, getarg(3));
case 5: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4));
case 6: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5));
case 7: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5), getarg(6));
case 8: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5), getarg(6), getarg(7));
case 9: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5), getarg(6), getarg(7), getarg(8));
}
}
else
{
mysql_tquery(gSQL, query);
}
}
|
Why would you even need this? That's basically a function that calls another function.
|
|
So I actually rewrote y_va just yesterday! Doing what you want there has always been awkward and there were several solutions from macros up to y_va, but they all had downsides. I'll write a bit more about this later, but in short:
1) Macros are fragile and prone to breaking code without great care. They also bloat your code and have length limits. 2) Explicit assembly requires knowing assembly. 3) y_va needs wrappers for every function you would want - "format" was wrapped (as "va_format") but if you wanted something else you needed assembly again - "mysql_tquery" wasn't wrapped. 4) Your method I've not seen before, but it won't work with strings or arrays. As I said though, if you have the very newest version of YSI, I've written a new "___" macro (triple underscore, like the "..." triple dot (elipses)): PHP код:
|
CodeScanGetMatchDisasm(m, dctx, len); CodeScanGetMatchDisasm(m, dctx, -12);
stock CodeScanGetMatchDisasm(csm[CodeScanner], ctx[DisasmContext]) {
// Doesn't do any decompilation, just gets the information for decompiling
// the currently found match.
ctx[DisasmContext_end_ip] = 0,
ctx[DisasmContext_start_ip] = ctx[DisasmContext_nip] = ctx[DisasmContext_cip] = csm[CodeScanMatch_cip];
}