diff --git a/shared/Base/Utility.hpp b/shared/Base/Utility.hpp index 3a5cec32..8edb2861 100644 --- a/shared/Base/Utility.hpp +++ b/shared/Base/Utility.hpp @@ -1096,7 +1096,7 @@ template <> struct ConvTo< CCStr > /* ------------------------------------------------------------------------------------------------ * Force a value to be within a certain range. */ -template< typename T > inline T Clamp(T val, T min, T max) +template< typename T, typename U, typename V > inline T Clamp(T val, U min, V max) { // Is the specified value bellow the minimum? if (val < min) @@ -1115,7 +1115,7 @@ template< typename T > inline T Clamp(T val, T min, T max) /* ------------------------------------------------------------------------------------------------ * Force a value to be higher then than the imposed limit. */ -template< typename T > inline T ClampMin(T val, T min) +template< typename T, typename U > inline T ClampMin(T val, U min) { // Is the specified value bellow the minimum? if (val < min) @@ -1129,7 +1129,7 @@ template< typename T > inline T ClampMin(T val, T min) /* ------------------------------------------------------------------------------------------------ * Force a value to be smaller then than the imposed limit. */ -template< typename T > inline T ClampMax(T val, T max) +template< typename T, typename U > inline T ClampMax(T val, U max) { // Is the specified value above the maximum? if (val > max) @@ -1436,54 +1436,86 @@ template < typename T > Object MakeObject(HSQUIRRELVM vm, const T & v) } /* ------------------------------------------------------------------------------------------------ - * Create a script string object from a buffer. + * Create a script string instance from a buffer. */ Object BufferToStrObj(const Buffer & b); /* ------------------------------------------------------------------------------------------------ - * Create a script string object from a portion of a buffer. + * Create a script string instance from a portion of a buffer. */ Object BufferToStrObj(const Buffer & b, Uint32 size); /* ------------------------------------------------------------------------------------------------ - * Create a signed long integer object from an integer. + * Create a signed long integer instance from an integer. */ -Object MakeSLongObj(Int64 val); +Object MakeSLongObj(Int64 value); /* ------------------------------------------------------------------------------------------------ - * Create a unsigned long integer object from an integer. + * Create a unsigned long integer instance from an integer. */ -Object MakeULongObj(Uint64 val); +Object MakeULongObj(Uint64 value); /* ------------------------------------------------------------------------------------------------ - * Create a signed long integer object from an integer. + * Create a signed long integer instance from an integer. */ -Object MakeSLongObj(HSQUIRRELVM vm, Int64 val); +Object MakeSLongObj(HSQUIRRELVM vm, Int64 value); /* ------------------------------------------------------------------------------------------------ - * Create a unsigned long integer object from an integer. + * Create a unsigned long integer instance from an integer. */ -Object MakeULongObj(HSQUIRRELVM vm, Uint64 val); +Object MakeULongObj(HSQUIRRELVM vm, Uint64 value); /* ------------------------------------------------------------------------------------------------ - * Retrieve a signed 64 bit integer from an signed long integer object. + * Retrieve a signed 64 bit integer from an signed long integer instance. */ -Int64 FetchSLongObjVal(const Object & val); +Int64 FetchSLongObjVal(const Object & value); /* ------------------------------------------------------------------------------------------------ - * Retrieve a unsigned 64 bit integer from an unsigned long integer object. + * Retrieve a unsigned 64 bit integer from an unsigned long integer instance. */ -Uint64 FetchULongObjVal(const Object & val); +Uint64 FetchULongObjVal(const Object & value); /* ------------------------------------------------------------------------------------------------ - * Retrieve a signed 64 bit integer from an signed long integer object. + * Retrieve the date components from a date instance. */ -Int64 FetchSLongObjVal(HSQUIRRELVM vm, const Object & val); +SQRESULT FetchDateObjVal(const Object & value, Uint16 & year, Uint8 & month, Uint8 & day); /* ------------------------------------------------------------------------------------------------ - * Retrieve a unsigned 64 bit integer from an unsigned long integer object. + * Retrieve the date components from a date instance as a string. */ -Uint64 FetchULongObjVal(HSQUIRRELVM vm, const Object & val); +CSStr FetchDateObjStr(const Object & value); + +/* ------------------------------------------------------------------------------------------------ + * Retrieve the time components from a date instance. +*/ +SQRESULT FetchTimeObjVal(const Object & value, Uint8 & hour, Uint8 & minute, Uint8 & second); + +/* ------------------------------------------------------------------------------------------------ + * Retrieve the time components from a date instance. +*/ +SQRESULT FetchTimeObjVal(const Object & value, Uint8 & hour, Uint8 & minute, Uint8 & second, Uint16 & millisecond); + +/* ------------------------------------------------------------------------------------------------ + * Retrieve the time components from a date instance as a string. +*/ +CSStr FetchTimeObjStr(const Object & value); + +/* ------------------------------------------------------------------------------------------------ + * Retrieve the date-time components from a date-time instance. +*/ +SQRESULT FetchDatetimeObjVal(const Object & value, Uint16 & year, Uint8 & month, Uint8 & day, Uint8 & hour, + Uint8 & minute, Uint8 & second); + +/* ------------------------------------------------------------------------------------------------ + * Retrieve the date-time components from a date-time instance. +*/ +SQRESULT FetchDatetimeObjVal(const Object & value, Uint16 & year, Uint8 & month, Uint8 & day, Uint8 & hour, + Uint8 & minute, Uint8 & second, Uint16 & millisecond); + +/* ------------------------------------------------------------------------------------------------ + * Retrieve the date-time components from a date-time instance as a string. +*/ +CSStr FetchDatetimeObjStr(const Object & value); /* ------------------------------------------------------------------------------------------------ * Attempt to pop the value at the specified index on the stack as a native integer. diff --git a/shared/Base/Utility.inl b/shared/Base/Utility.inl index 6ec9b8da..cc6ce3dc 100644 --- a/shared/Base/Utility.inl +++ b/shared/Base/Utility.inl @@ -739,7 +739,7 @@ Object BufferToStrObj(const Buffer & b, Uint32 size) } // ------------------------------------------------------------------------------------------------ -Object MakeSLongObj(Int64 val) +Object MakeSLongObj(Int64 value) { // Obtain the default virtual machine HSQUIRRELVM vm = DefaultVM::Get(); @@ -747,17 +747,17 @@ Object MakeSLongObj(Int64 val) const StackGuard sg(vm); #ifdef SQMOD_PLUGIN_API // Push a long integer instance with the requested value on the stack - SqMod_PushSLongObject(vm, val); + SqMod_PushSLongObject(vm, value); #else // Transform the specified value into a script object - PushVar< SLongInt >(vm, SLongInt(val)); + PushVar< SLongInt >(vm, SLongInt(value)); #endif // SQMOD_PLUGIN_API // Obtain the object from the stack and return it return Var< Object >(vm, -1).value; } // ------------------------------------------------------------------------------------------------ -Object MakeULongObj(Uint64 val) +Object MakeULongObj(Uint64 value) { // Obtain the default virtual machine HSQUIRRELVM vm = DefaultVM::Get(); @@ -765,91 +765,297 @@ Object MakeULongObj(Uint64 val) const StackGuard sg(vm); #ifdef SQMOD_PLUGIN_API // Push a long integer instance with the requested value on the stack - SqMod_PushULongObject(vm, val); + SqMod_PushULongObject(vm, value); #else // Transform the specified value into a script object - PushVar< ULongInt >(vm, ULongInt(val)); + PushVar< ULongInt >(vm, ULongInt(value)); #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) +Object MakeSLongObj(HSQUIRRELVM vm, Int64 value) { // 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); + SqMod_PushSLongObject(vm, value); #else // Transform the specified value into a script object - PushVar< SLongInt >(vm, SLongInt(val)); + PushVar< SLongInt >(vm, SLongInt(value)); #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) +Object MakeULongObj(HSQUIRRELVM vm, Uint64 value) { // 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); + SqMod_PushULongObject(vm, value); #else // Transform the specified value into a script object - PushVar< ULongInt >(vm, ULongInt(val)); + PushVar< ULongInt >(vm, ULongInt(value)); #endif // SQMOD_PLUGIN_API // Obtain the object from the stack and return it return Var< Object >(vm, -1).value; } // ------------------------------------------------------------------------------------------------ -Int64 FetchSLongObjVal(const Object & val) -{ - // Obtain the initial stack size - const StackGuard sg(DefaultVM::Get()); - // Push the specified object onto the stack - Var< const Object & >::push(DefaultVM::Get(), val); - // Retrieve and return the object value from the stack - return PopStackSLong(DefaultVM::Get(), -1); -} - -// ------------------------------------------------------------------------------------------------ -Uint64 FetchULongObjVal(const Object & val) -{ - // Obtain the initial stack size - const StackGuard sg(DefaultVM::Get()); - // Push the specified object onto the stack - Var< const Object & >::push(DefaultVM::Get(), val); - // Retrieve and return the object value from the stack - return PopStackSLong(DefaultVM::Get(), -1); -} - -// ------------------------------------------------------------------------------------------------ -Int64 FetchSLongObjVal(HSQUIRRELVM vm, const Object & val) +Int64 FetchSLongObjVal(const Object & value) { + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); // Obtain the initial stack size const StackGuard sg(vm); // Push the specified object onto the stack - Var< const Object & >::push(vm, val); + Var< const Object & >::push(vm, value); // Retrieve and return the object value from the stack return PopStackSLong(vm, -1); } // ------------------------------------------------------------------------------------------------ -Uint64 FetchULongObjVal(HSQUIRRELVM vm, const Object & val) +Uint64 FetchULongObjVal(const Object & value) { + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); // Obtain the initial stack size const StackGuard sg(vm); // Push the specified object onto the stack - Var< const Object & >::push(vm, val); + Var< const Object & >::push(vm, value); // Retrieve and return the object value from the stack return PopStackSLong(vm, -1); } +// ------------------------------------------------------------------------------------------------ +SQRESULT FetchDateObjVal(const Object & value, Uint16 & year, Uint8 & month, Uint8 & day) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date components from the date instance + return SqMod_GetDate(vm, -1, &year, &month, &day); +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return SQ_ERROR; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); + SQMOD_UNUSED_VAR(year); + SQMOD_UNUSED_VAR(month); + SQMOD_UNUSED_VAR(day); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +CSStr FetchDateObjStr(const Object & value) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date instance as a string + const StackStrF val(vm, -1, false); + // Validate the result + if (SQ_FAILED(val.mRes)) + { + return _SC("1000-01-01"); + } + // Copy the string into the common buffer + std::strncpy(g_Buffer, val.mPtr, sizeof(g_Buffer)); + // Return the obtained string + return g_Buffer; +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return nullptr; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +SQRESULT FetchTimeObjVal(const Object & value, Uint8 & hour, Uint8 & minute, Uint8 & second) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date components from the date instance + return SqMod_GetTime(vm, -1, &hour, &minute, &second, nullptr); +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return SQ_ERROR; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); + SQMOD_UNUSED_VAR(hour); + SQMOD_UNUSED_VAR(minute); + SQMOD_UNUSED_VAR(second); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +SQRESULT FetchTimeObjVal(const Object & value, Uint8 & hour, Uint8 & minute, Uint8 & second, Uint16 & millisecond) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date components from the date instance + return SqMod_GetTime(vm, -1, &hour, &minute, &second, &millisecond); +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return SQ_ERROR; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); + SQMOD_UNUSED_VAR(hour); + SQMOD_UNUSED_VAR(minute); + SQMOD_UNUSED_VAR(second); + SQMOD_UNUSED_VAR(millisecond); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +CSStr FetchTimeObjStr(const Object & value) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the time instance as a string + const StackStrF val(vm, -1, false); + // Validate the result + if (SQ_FAILED(val.mRes)) + { + return _SC("00:00:00"); + } + // Copy the string into the common buffer + std::strncpy(g_Buffer, val.mPtr, sizeof(g_Buffer)); + // Remove the millisecond part from the string, if any + g_Buffer[8] = '\0'; + // Return the obtained string + return g_Buffer; +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return nullptr; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +SQRESULT FetchDatetimeObjVal(const Object & value, Uint16 & year, Uint8 & month, Uint8 & day, Uint8 & hour, + Uint8 & minute, Uint8 & second) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date components from the date instance + return SqMod_GetDatetime(vm, -1, &year, &month, &day, &hour, &minute, &second, nullptr); +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return SQ_ERROR; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); + SQMOD_UNUSED_VAR(year); + SQMOD_UNUSED_VAR(month); + SQMOD_UNUSED_VAR(day); + SQMOD_UNUSED_VAR(hour); + SQMOD_UNUSED_VAR(minute); + SQMOD_UNUSED_VAR(second); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +SQRESULT FetchDatetimeObjVal(const Object & value, Uint16 & year, Uint8 & month, Uint8 & day, Uint8 & hour, + Uint8 & minute, Uint8 & second, Uint16 & millisecond) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date components from the date instance + return SqMod_GetDatetime(vm, -1, &year, &month, &day, &hour, &minute, &second, &millisecond); +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return SQ_ERROR; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); + SQMOD_UNUSED_VAR(year); + SQMOD_UNUSED_VAR(month); + SQMOD_UNUSED_VAR(day); + SQMOD_UNUSED_VAR(hour); + SQMOD_UNUSED_VAR(minute); + SQMOD_UNUSED_VAR(second); + SQMOD_UNUSED_VAR(millisecond); +#endif // SQMOD_PLUGIN_API +} + +// ------------------------------------------------------------------------------------------------ +CSStr FetchDatetimeObjStr(const Object & value) +{ +#ifdef SQMOD_PLUGIN_API + // Grab the associated object virtual machine + HSQUIRRELVM vm = value.GetVM(); + // Remember the current stack size + const StackGuard sg(vm); + // Push the specified object onto the stack + Var< const Object & >::push(vm, value); + // Grab the date-time instance as a string + const StackStrF val(vm, -1, false); + // Validate the result + if (SQ_FAILED(val.mRes)) + { + return _SC("1000-01-01 00:00:00"); + } + // Copy the string into the common buffer + std::strncpy(g_Buffer, val.mPtr, sizeof(g_Buffer)); + // Remove the millisecond part from the string, if any + g_Buffer[19] = '\0'; + // Return the obtained string + return g_Buffer; +#else + STHROWF("This method is only available in modules"); + // Should not reach this point + return nullptr; + // Avoid unused parameter warnings + SQMOD_UNUSED_VAR(value); +#endif // SQMOD_PLUGIN_API +} + // ------------------------------------------------------------------------------------------------ SQInteger PopStackInteger(HSQUIRRELVM vm, SQInteger idx) { diff --git a/shared/SqMod.inl b/shared/SqMod.inl index 53c440d2..12fe7397 100644 --- a/shared/SqMod.inl +++ b/shared/SqMod.inl @@ -595,62 +595,66 @@ void sq_api_collapse() #ifdef SQMOD_PLUGIN_API //primitive functions -SqEx_GetSquirrelAPI SqMod_GetSquirrelAPI = NULL; -SqEx_GetSquirrelVM SqMod_GetSquirrelVM = NULL; +SqEx_GetSquirrelAPI SqMod_GetSquirrelAPI = NULL; +SqEx_GetSquirrelVM SqMod_GetSquirrelVM = NULL; //logging utilities -SqEx_LogMessage SqMod_LogDbg = NULL; -SqEx_LogMessage SqMod_LogUsr = NULL; -SqEx_LogMessage SqMod_LogScs = NULL; -SqEx_LogMessage SqMod_LogInf = NULL; -SqEx_LogMessage SqMod_LogWrn = NULL; -SqEx_LogMessage SqMod_LogErr = NULL; -SqEx_LogMessage SqMod_LogFtl = NULL; -SqEx_LogMessage SqMod_LogSDbg = NULL; -SqEx_LogMessage SqMod_LogSUsr = NULL; -SqEx_LogMessage SqMod_LogSScs = NULL; -SqEx_LogMessage SqMod_LogSInf = NULL; -SqEx_LogMessage SqMod_LogSWrn = NULL; -SqEx_LogMessage SqMod_LogSErr = NULL; -SqEx_LogMessage SqMod_LogSFtl = NULL; +SqEx_LogMessage SqMod_LogDbg = NULL; +SqEx_LogMessage SqMod_LogUsr = NULL; +SqEx_LogMessage SqMod_LogScs = NULL; +SqEx_LogMessage SqMod_LogInf = NULL; +SqEx_LogMessage SqMod_LogWrn = NULL; +SqEx_LogMessage SqMod_LogErr = NULL; +SqEx_LogMessage SqMod_LogFtl = NULL; +SqEx_LogMessage SqMod_LogSDbg = NULL; +SqEx_LogMessage SqMod_LogSUsr = NULL; +SqEx_LogMessage SqMod_LogSScs = NULL; +SqEx_LogMessage SqMod_LogSInf = NULL; +SqEx_LogMessage SqMod_LogSWrn = NULL; +SqEx_LogMessage SqMod_LogSErr = NULL; +SqEx_LogMessage SqMod_LogSFtl = NULL; //script loading -SqEx_LoadScript SqMod_LoadScript = NULL; +SqEx_LoadScript SqMod_LoadScript = NULL; //numeric utilities -SqEx_GetSLongValue SqMod_GetSLongValue = NULL; -SqEx_PushSLongObject SqMod_PushSLongObject = NULL; -SqEx_GetULongValue SqMod_GetULongValue = NULL; -SqEx_PushULongObject SqMod_PushULongObject = NULL; +SqEx_GetSLongValue SqMod_GetSLongValue = NULL; +SqEx_PushSLongObject SqMod_PushSLongObject = NULL; +SqEx_GetULongValue SqMod_GetULongValue = NULL; +SqEx_PushULongObject SqMod_PushULongObject = NULL; //time utilities -SqEx_GetCurrentSysTime SqMod_GetCurrentSysTime = NULL; -SqEx_GetEpochTimeMicro SqMod_GetEpochTimeMicro = NULL; -SqEx_GetEpochTimeMilli SqMod_GetEpochTimeMilli = NULL; -SqEx_ValidDate SqMod_ValidDate = NULL; -SqEx_IsLeapYear SqMod_IsLeapYear = NULL; -SqEx_DaysInYear SqMod_DaysInYear = NULL; -SqEx_DaysInMonth SqMod_DaysInMonth = NULL; -SqEx_DayOfYear SqMod_DayOfYear = NULL; -SqEx_DateRangeToSeconds SqMod_DateRangeToSeconds = NULL; -SqEx_GetTimestamp SqMod_GetTimestamp = NULL; -SqEx_PushTimestamp SqMod_PushTimestamp = NULL; -SqEx_GetDate SqMod_GetDate = NULL; -SqEx_PushDate SqMod_PushDate = NULL; -SqEx_GetTime SqMod_GetTime = NULL; -SqEx_PushTime SqMod_PushTime = NULL; -SqEx_GetDatetime SqMod_GetDatetime = NULL; -SqEx_PushDatetime SqMod_PushDatetime = NULL; +SqEx_GetCurrentSysTime SqMod_GetCurrentSysTime = NULL; +SqEx_GetEpochTimeMicro SqMod_GetEpochTimeMicro = NULL; +SqEx_GetEpochTimeMilli SqMod_GetEpochTimeMilli = NULL; +SqEx_ValidDate SqMod_ValidDate = NULL; +SqEx_IsLeapYear SqMod_IsLeapYear = NULL; +SqEx_DaysInYear SqMod_DaysInYear = NULL; +SqEx_DaysInMonth SqMod_DaysInMonth = NULL; +SqEx_DayOfYear SqMod_DayOfYear = NULL; +SqEx_DateRangeToSeconds SqMod_DateRangeToSeconds = NULL; +SqEx_GetTimestamp SqMod_GetTimestamp = NULL; +SqEx_PushTimestamp SqMod_PushTimestamp = NULL; +SqEx_GetDate SqMod_GetDate = NULL; +SqEx_PushDate SqMod_PushDate = NULL; +SqEx_GetTime SqMod_GetTime = NULL; +SqEx_PushTime SqMod_PushTime = NULL; +SqEx_GetDatetime SqMod_GetDatetime = NULL; +SqEx_PushDatetime SqMod_PushDatetime = NULL; //stack utilities -SqEx_PopStackInteger SqMod_PopStackInteger = NULL; -SqEx_PopStackFloat SqMod_PopStackFloat = NULL; -SqEx_PopStackSLong SqMod_PopStackSLong = NULL; -SqEx_PopStackULong SqMod_PopStackULong = NULL; +SqEx_PopStackInteger SqMod_PopStackInteger = NULL; +SqEx_PopStackFloat SqMod_PopStackFloat = NULL; +SqEx_PopStackSLong SqMod_PopStackSLong = NULL; +SqEx_PopStackULong SqMod_PopStackULong = NULL; //buffer utilities -SqEx_PushBuffer SqMod_PushBuffer = NULL; -SqEx_PushBufferData SqMod_PushBufferData = NULL; +SqEx_PushBuffer SqMod_PushBuffer = NULL; +SqEx_PushBufferData SqMod_PushBufferData = NULL; +SqEx_GetBufferInfo SqMod_GetBufferInfo = NULL; +SqEx_GetBufferData SqMod_GetBufferData = NULL; +SqEx_GetBufferSize SqMod_GetBufferSize = NULL; +SqEx_GetBufferCursor SqMod_GetBufferCursor = NULL; #endif // SQMOD_PLUGIN_API diff --git a/source/Base/Shared.cpp b/source/Base/Shared.cpp index 7dc0729c..2f668b52 100644 --- a/source/Base/Shared.cpp +++ b/source/Base/Shared.cpp @@ -904,12 +904,12 @@ void Register_Base(HSQUIRRELVM vm) .Func(_SC("EpsGt"), &EpsGt< SQFloat >) .Func(_SC("EpsLtEq"), &EpsLtEq< SQFloat >) .Func(_SC("EpsGtEq"), &EpsGtEq< SQFloat >) - .Func(_SC("ClampI"), &Clamp< SQInteger >) - .Func(_SC("ClampF"), &Clamp< SQFloat >) - .Func(_SC("ClampMinI"), &ClampMin< SQInteger >) - .Func(_SC("ClampMinF"), &ClampMin< SQFloat >) - .Func(_SC("ClampMaxI"), &ClampMax< SQInteger >) - .Func(_SC("ClampMaxF"), &ClampMax< SQFloat >) + .Func(_SC("ClampI"), &Clamp< SQInteger, SQInteger, SQInteger >) + .Func(_SC("ClampF"), &Clamp< SQFloat, SQFloat, SQFloat >) + .Func(_SC("ClampMinI"), &ClampMin< SQInteger, SQInteger >) + .Func(_SC("ClampMinF"), &ClampMin< SQFloat, SQFloat >) + .Func(_SC("ClampMaxI"), &ClampMax< SQInteger, SQInteger >) + .Func(_SC("ClampMaxF"), &ClampMax< SQFloat, SQFloat >) .Func(_SC("NextPow2"), &NextPow2) .Func(_SC("SToB"), &SToB) .Func(_SC("PackRGB"), &SqPackRGB)