1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-19 16:47:14 +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:
Sandu Liviu Catalin
2016-07-04 16:26:39 +03:00
parent 805251a6db
commit 87ab54d453
22 changed files with 396 additions and 78 deletions

View File

@ -199,6 +199,18 @@ static SQRESULT SqEx_PushULongObject(HSQUIRRELVM vm, Uint64 num)
return SQ_OK;
}
// ------------------------------------------------------------------------------------------------
SQBool SqEx_ValidDate(uint16_t year, uint8_t month, uint8_t day)
{
return Chrono::ValidDate(year, month, day);
}
// ------------------------------------------------------------------------------------------------
SQBool SqEx_IsLeapYear(uint16_t year)
{
return Chrono::IsLeapYear(year);
}
// ------------------------------------------------------------------------------------------------
static SQRESULT SqEx_GetTimestamp(HSQUIRRELVM vm, SQInteger idx, Int64 * num)
{
@ -551,6 +563,12 @@ void InitExports()
g_SqExports.GetCurrentSysTime = Chrono::GetCurrentSysTime;
g_SqExports.GetEpochTimeMicro = Chrono::GetEpochTimeMicro;
g_SqExports.GetEpochTimeMilli = Chrono::GetEpochTimeMilli;
g_SqExports.ValidDate = SqEx_ValidDate;
g_SqExports.IsLeapYear = SqEx_IsLeapYear;
g_SqExports.DaysInYear = Chrono::DaysInYear;
g_SqExports.DaysInMonth = Chrono::DaysInMonth;
g_SqExports.DayOfYear = Chrono::DayOfYear;
g_SqExports.DateRangeToSeconds = Chrono::DateRangeToSeconds;
g_SqExports.GetTimestamp = SqEx_GetTimestamp;
g_SqExports.PushTimestamp = SqEx_PushTimestamp;
g_SqExports.GetDate = SqEx_GetDate;