mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Implement several helper functions to create long integer instances.
This commit is contained in:
parent
279479cddc
commit
125088c9e3
@ -682,6 +682,74 @@ Object BufferToStrObj(const Buffer & b, Uint32 size)
|
||||
return Var< Object >(DefaultVM::Get(), -1).value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object MakeSLongObj(Int64 val)
|
||||
{
|
||||
// Obtain the default virtual machine
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(vm);
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
// Push a long integer instance with the requested value on the stack
|
||||
_SqMod->PushSLongObject(vm, val);
|
||||
#else
|
||||
// Transform the specified value into a script object
|
||||
PushVar< SLongInt >(vm, SLongInt(val));
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
// Obtain the object from the stack and return it
|
||||
return Var< Object >(vm, -1).value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object MakeULongObj(Uint64 val)
|
||||
{
|
||||
// Obtain the default virtual machine
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(vm);
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
// Push a long integer instance with the requested value on the stack
|
||||
_SqMod->PushULongObject(vm, val);
|
||||
#else
|
||||
// Transform the specified value into a script object
|
||||
PushVar< ULongInt >(vm, ULongInt(val));
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
// Obtain the object from the stack and return it
|
||||
return Var< Object >(vm, -1).value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object MakeSLongObj(HSQUIRRELVM vm, Int64 val)
|
||||
{
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(vm);
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
// Push a long integer instance with the requested value on the stack
|
||||
_SqMod->PushSLongObject(vm, val);
|
||||
#else
|
||||
// Transform the specified value into a script object
|
||||
PushVar< SLongInt >(vm, SLongInt(val));
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
// Obtain the object from the stack and return it
|
||||
return Var< Object >(vm, -1).value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object MakeULongObj(HSQUIRRELVM vm, Uint64 val)
|
||||
{
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(vm);
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
// Push a long integer instance with the requested value on the stack
|
||||
_SqMod->PushULongObject(vm, val);
|
||||
#else
|
||||
// Transform the specified value into a script object
|
||||
PushVar< ULongInt >(vm, ULongInt(val));
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
// Obtain the object from the stack and return it
|
||||
return Var< Object >(vm, -1).value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger PopStackInteger(HSQUIRRELVM vm, SQInteger idx)
|
||||
{
|
||||
|
@ -1430,6 +1430,26 @@ Object BufferToStrObj(const Buffer & b);
|
||||
*/
|
||||
Object BufferToStrObj(const Buffer & b, Uint32 size);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Create a signed long integer object from an integer.
|
||||
*/
|
||||
Object MakeSLongObj(Int64 val);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Create a unsigned long integer object from an integer.
|
||||
*/
|
||||
Object MakeULongObj(Uint64 val);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Create a signed long integer object from an integer.
|
||||
*/
|
||||
Object MakeSLongObj(HSQUIRRELVM vm, Int64 val);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Create a unsigned long integer object from an integer.
|
||||
*/
|
||||
Object MakeULongObj(HSQUIRRELVM vm, Uint64 val);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to pop the value at the specified index on the stack as a native integer.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user