mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-21 00:07:12 +02:00
Expand the host plug-in API and not just the Squirrel API.
Extend the host plug-in API with a few more date/time functions. Update some of the plugins to use the expanded functions of the host plug-in API.
This commit is contained in:
202
shared/SqMod.inl
202
shared/SqMod.inl
@@ -590,3 +590,205 @@ void sq_api_collapse()
|
||||
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
|
||||
//primitive functions
|
||||
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;
|
||||
|
||||
//script loading
|
||||
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;
|
||||
|
||||
//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;
|
||||
|
||||
//stack utilities
|
||||
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;
|
||||
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQRESULT sqmod_api_expand(HSQEXPORTS sqmodapi)
|
||||
{
|
||||
if (!sqmodapi)
|
||||
{
|
||||
return SQ_ERROR;
|
||||
}
|
||||
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
|
||||
//primitive functions
|
||||
SqMod_GetSquirrelAPI = sqmodapi->GetSquirrelAPI;
|
||||
SqMod_GetSquirrelVM = sqmodapi->GetSquirrelVM;
|
||||
|
||||
//logging utilities
|
||||
SqMod_LogDbg = sqmodapi->LogDbg;
|
||||
SqMod_LogUsr = sqmodapi->LogUsr;
|
||||
SqMod_LogScs = sqmodapi->LogScs;
|
||||
SqMod_LogInf = sqmodapi->LogInf;
|
||||
SqMod_LogWrn = sqmodapi->LogWrn;
|
||||
SqMod_LogErr = sqmodapi->LogErr;
|
||||
SqMod_LogFtl = sqmodapi->LogFtl;
|
||||
SqMod_LogSDbg = sqmodapi->LogSDbg;
|
||||
SqMod_LogSUsr = sqmodapi->LogSUsr;
|
||||
SqMod_LogSScs = sqmodapi->LogSScs;
|
||||
SqMod_LogSInf = sqmodapi->LogSInf;
|
||||
SqMod_LogSWrn = sqmodapi->LogSWrn;
|
||||
SqMod_LogSErr = sqmodapi->LogSErr;
|
||||
SqMod_LogSFtl = sqmodapi->LogSFtl;
|
||||
|
||||
//script loading
|
||||
SqMod_LoadScript = sqmodapi->LoadScript;
|
||||
|
||||
//numeric utilities
|
||||
SqMod_GetSLongValue = sqmodapi->GetSLongValue;
|
||||
SqMod_PushSLongObject = sqmodapi->PushSLongObject;
|
||||
SqMod_GetULongValue = sqmodapi->GetULongValue;
|
||||
SqMod_PushULongObject = sqmodapi->PushULongObject;
|
||||
|
||||
//time utilities
|
||||
SqMod_GetCurrentSysTime = sqmodapi->GetCurrentSysTime;
|
||||
SqMod_GetEpochTimeMicro = sqmodapi->GetEpochTimeMicro;
|
||||
SqMod_GetEpochTimeMilli = sqmodapi->GetEpochTimeMilli;
|
||||
SqMod_ValidDate = sqmodapi->ValidDate;
|
||||
SqMod_IsLeapYear = sqmodapi->IsLeapYear;
|
||||
SqMod_DaysInYear = sqmodapi->DaysInYear;
|
||||
SqMod_DaysInMonth = sqmodapi->DaysInMonth;
|
||||
SqMod_DayOfYear = sqmodapi->DayOfYear;
|
||||
SqMod_DateRangeToSeconds = sqmodapi->DateRangeToSeconds;
|
||||
SqMod_GetTimestamp = sqmodapi->GetTimestamp;
|
||||
SqMod_PushTimestamp = sqmodapi->PushTimestamp;
|
||||
SqMod_GetDate = sqmodapi->GetDate;
|
||||
SqMod_PushDate = sqmodapi->PushDate;
|
||||
SqMod_GetTime = sqmodapi->GetTime;
|
||||
SqMod_PushTime = sqmodapi->PushTime;
|
||||
SqMod_GetDatetime = sqmodapi->GetDatetime;
|
||||
SqMod_PushDatetime = sqmodapi->PushDatetime;
|
||||
|
||||
//stack utilities
|
||||
SqMod_PopStackInteger = sqmodapi->PopStackInteger;
|
||||
SqMod_PopStackFloat = sqmodapi->PopStackFloat;
|
||||
SqMod_PopStackSLong = sqmodapi->PopStackSLong;
|
||||
SqMod_PopStackULong = sqmodapi->PopStackULong;
|
||||
|
||||
//buffer utilities
|
||||
SqMod_PushBuffer = sqmodapi->PushBuffer;
|
||||
SqMod_PushBufferData = sqmodapi->PushBufferData;
|
||||
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void sqmod_api_collapse()
|
||||
{
|
||||
#ifdef SQMOD_PLUGIN_API
|
||||
|
||||
//primitive functions
|
||||
SqMod_GetSquirrelAPI = NULL;
|
||||
SqMod_GetSquirrelVM = NULL;
|
||||
|
||||
//logging utilities
|
||||
SqMod_LogDbg = NULL;
|
||||
SqMod_LogUsr = NULL;
|
||||
SqMod_LogScs = NULL;
|
||||
SqMod_LogInf = NULL;
|
||||
SqMod_LogWrn = NULL;
|
||||
SqMod_LogErr = NULL;
|
||||
SqMod_LogFtl = NULL;
|
||||
SqMod_LogSDbg = NULL;
|
||||
SqMod_LogSUsr = NULL;
|
||||
SqMod_LogSScs = NULL;
|
||||
SqMod_LogSInf = NULL;
|
||||
SqMod_LogSWrn = NULL;
|
||||
SqMod_LogSErr = NULL;
|
||||
SqMod_LogSFtl = NULL;
|
||||
|
||||
//script loading
|
||||
SqMod_LoadScript = NULL;
|
||||
|
||||
//numeric utilities
|
||||
SqMod_GetSLongValue = NULL;
|
||||
SqMod_PushSLongObject = NULL;
|
||||
SqMod_GetULongValue = NULL;
|
||||
SqMod_PushULongObject = NULL;
|
||||
|
||||
//time utilities
|
||||
SqMod_GetCurrentSysTime = NULL;
|
||||
SqMod_GetEpochTimeMicro = NULL;
|
||||
SqMod_GetEpochTimeMilli = NULL;
|
||||
SqMod_ValidDate = NULL;
|
||||
SqMod_IsLeapYear = NULL;
|
||||
SqMod_DaysInYear = NULL;
|
||||
SqMod_DaysInMonth = NULL;
|
||||
SqMod_DayOfYear = NULL;
|
||||
SqMod_DateRangeToSeconds = NULL;
|
||||
SqMod_GetTimestamp = NULL;
|
||||
SqMod_PushTimestamp = NULL;
|
||||
SqMod_GetDate = NULL;
|
||||
SqMod_PushDate = NULL;
|
||||
SqMod_GetTime = NULL;
|
||||
SqMod_PushTime = NULL;
|
||||
SqMod_GetDatetime = NULL;
|
||||
SqMod_PushDatetime = NULL;
|
||||
|
||||
//stack utilities
|
||||
SqMod_PopStackInteger = NULL;
|
||||
SqMod_PopStackFloat = NULL;
|
||||
SqMod_PopStackSLong = NULL;
|
||||
SqMod_PopStackULong = NULL;
|
||||
|
||||
//buffer utilities
|
||||
SqMod_PushBuffer = NULL;
|
||||
SqMod_PushBufferData = NULL;
|
||||
|
||||
#endif // SQMOD_PLUGIN_API
|
||||
}
|
||||
|
Reference in New Issue
Block a user