1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 07:07:13 +02:00

Massive code reduction in the binding utility by using variadic templates.

Extensive code refactoring surrounding the StackStrF helper to facilitate the new changes.
Various other miscellaneous changes and code refactoring to facilitate the new changes.
This commit is contained in:
Sandu Liviu Catalin
2018-07-30 00:58:27 +03:00
parent 199e9ac502
commit f300e7ff4a
20 changed files with 724 additions and 9507 deletions

View File

@ -36,9 +36,9 @@ template < class T > T BaseHash< T >::Algo;
template < class T > static SQInteger HashF(HSQUIRRELVM vm)
{
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}
@ -56,9 +56,9 @@ template < class T > static SQInteger HashF(HSQUIRRELVM vm)
static SQInteger WhirlpoolF(HSQUIRRELVM vm)
{
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}
@ -94,9 +94,9 @@ static SQInteger WhirlpoolF(HSQUIRRELVM vm)
static SQInteger EncodeBase64F(HSQUIRRELVM vm)
{
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}
@ -122,9 +122,9 @@ static SQInteger EncodeBase64F(HSQUIRRELVM vm)
static SQInteger DecodeBase64F(HSQUIRRELVM vm)
{
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}

View File

@ -153,9 +153,9 @@ static SQInteger SqNan(HSQUIRRELVM vm)
return sq_throwerror(vm, "Wrong number of arguments");
}
// Attempt to generate the string value
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}
@ -178,9 +178,9 @@ static SQInteger SqNanL(HSQUIRRELVM vm)
return sq_throwerror(vm, "Wrong number of arguments");
}
// Attempt to generate the string value
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}

View File

@ -490,9 +490,9 @@ static SQInteger SplitWhereCharImpl(HSQUIRRELVM vm, int(*fn)(int), bool neg)
}
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}
@ -612,9 +612,9 @@ static SQInteger SqStrExplode(HSQUIRRELVM vm)
return sq_throwerror(vm, _SC("Missing string value"));
}
// Attempt to generate the string value
StackStrF val(vm, 4, true);
StackStrF val(vm, 4);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}
@ -812,9 +812,9 @@ static CSStr FromArray(Array & arr)
static SQInteger StdPrintF(HSQUIRRELVM vm)
{
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}

View File

@ -21,9 +21,9 @@ extern void Register_SysPath(HSQUIRRELVM vm);
static SQInteger SqSysExec(HSQUIRRELVM vm)
{
// Attempt to retrieve the value from the stack as a string
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}

View File

@ -22,9 +22,9 @@ static SQInteger SqExtractIPv4(HSQUIRRELVM vm)
return sq_throwerror(vm, "Missing IP address string");
}
// Attempt to generate the string value
StackStrF val(vm, 2, true);
StackStrF val(vm, 2);
// Have we failed to retrieve the string?
if (SQ_FAILED(val.mRes))
if (SQ_FAILED(val.Proc(true)))
{
return val.mRes; // Propagate the error!
}