diff --git a/modules/irc/Module.cpp b/modules/irc/Module.cpp index 7fe5c836..60903904 100644 --- a/modules/irc/Module.cpp +++ b/modules/irc/Module.cpp @@ -43,8 +43,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -61,7 +63,7 @@ void OnSquirrelLoad() return; // Unable to proceed! } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/irc/Session.cpp b/modules/irc/Session.cpp index 52351d7c..c101d4be 100644 --- a/modules/irc/Session.cpp +++ b/modules/irc/Session.cpp @@ -111,12 +111,12 @@ void Session::Update() else if (!irc_is_connected(m_Session)) { // Do we meet the condition to attempt to reconnect? - if (m_Reconnect && (m_LeftTries != 0) && (m_NextTry <= _SqMod->GetEpochTimeMicro())) + if (m_Reconnect && (m_LeftTries != 0) && (m_NextTry <= SqMod_GetEpochTimeMicro())) { // Take out one try --m_LeftTries; // Update the time-point for the next try - m_NextTry = (_SqMod->GetEpochTimeMicro() + (m_Wait * 1000LL)); + m_NextTry = (SqMod_GetEpochTimeMicro() + (m_Wait * 1000LL)); // Attempt to reconnect if (m_IPv6) { @@ -155,13 +155,13 @@ void Session::Update() // Call select() if (select(maxfd + 1, &in_set, &out_set, 0, &tv) < 0) { - _SqMod->LogErr("Unable to select() on IRC session"); + SqMod_LogErr("Unable to select() on IRC session"); } // Call irc_process_select_descriptors() for the session if (irc_process_select_descriptors (m_Session, &in_set, &out_set)) { // @TODO: The connection failed, or the server disconnected. Handle it! - _SqMod->LogWrn("The IRC connection failed, or the server disconnected."); + SqMod_LogWrn("The IRC connection failed, or the server disconnected."); } } @@ -256,7 +256,7 @@ bool Session::ValidateEventSession(Session * ptr) return true; } // We can't throw an error here so we simply log it - _SqMod->LogErr("Cannot forward IRC event without a session instance"); + SqMod_LogErr("Cannot forward IRC event without a session instance"); // Invalid session instance return false; } @@ -442,7 +442,7 @@ Object Session::GetNextTry() const // Obtain the initial stack size const StackGuard sg(_SqVM); // Attempt to push a time-stamp instance on the stack - _SqMod->PushTimestamp(_SqVM, m_NextTry); + SqMod_PushTimestamp(_SqVM, m_NextTry); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -457,7 +457,7 @@ void Session::SetNextTry(Object & tm) // The resulted times-tamp value Int64 microseconds = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetTimestamp(_SqVM, -1, µseconds))) + if (SQ_FAILED(SqMod_GetTimestamp(_SqVM, -1, µseconds))) { STHROWF("Invalid time-stamp specified"); } @@ -473,12 +473,12 @@ Object Session::GetSessionTime() const // Attempt to push a time-stamp instance on the stack if (m_SessionTime) { - _SqMod->PushTimestamp(_SqVM, _SqMod->GetEpochTimeMicro() - m_SessionTime); + SqMod_PushTimestamp(_SqVM, SqMod_GetEpochTimeMicro() - m_SessionTime); } // This session was not connected yet else { - _SqMod->PushTimestamp(_SqVM, 0); + SqMod_PushTimestamp(_SqVM, 0); } // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; @@ -506,7 +506,7 @@ Int32 Session::Connect() // Reset the number of tries m_LeftTries = m_Tries; // Set the time-point for the next try - m_NextTry = (_SqMod->GetEpochTimeMicro() + (m_Wait * 1000LL)); + m_NextTry = (SqMod_GetEpochTimeMicro() + (m_Wait * 1000LL)); // This is not an IPv6 connection m_IPv6 = false; // Attempt to connect the session and return the result @@ -557,7 +557,7 @@ Int32 Session::Connect(CSStr server, Uint32 port, CSStr nick, CSStr passwd, CSSt // Reset the number of tries m_LeftTries = m_Tries; // Set the time-point for the next connection try - m_NextTry = (_SqMod->GetEpochTimeMicro() + (m_Wait * 1000LL)); + m_NextTry = (SqMod_GetEpochTimeMicro() + (m_Wait * 1000LL)); // This is not an IPv6 connection m_IPv6 = false; // Attempt to connect the session and return the result @@ -591,7 +591,7 @@ Int32 Session::Connect6() // Reset the number of tries m_LeftTries = m_Tries; // Set the time-point for the next try - m_NextTry = (_SqMod->GetEpochTimeMicro() + (m_Wait * 1000LL)); + m_NextTry = (SqMod_GetEpochTimeMicro() + (m_Wait * 1000LL)); // This is an IPv6 connection m_IPv6 = true; // Attempt to connect the session and return the result @@ -642,7 +642,7 @@ Int32 Session::Connect6(CSStr server, Uint32 port, CSStr nick, CSStr passwd, CSS // Reset the number of tries m_LeftTries = m_Tries; // Set the time-point for the next connection try - m_NextTry = (_SqMod->GetEpochTimeMicro() + (m_Wait * 1000LL)); + m_NextTry = (SqMod_GetEpochTimeMicro() + (m_Wait * 1000LL)); // This is an IPv6 connection m_IPv6 = true; // Attempt to connect the session and return the result @@ -699,15 +699,15 @@ void Session::ForwardEvent(Function & listener, CCStr event, CCStr origin, CCStr } catch (const Sqrat::Exception & e) { - _SqMod->LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str()); + SqMod_LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str()); } catch (const std::exception & e) { - _SqMod->LogErr("IRC event [%s] => Program error [%s]", event, e.what()); + SqMod_LogErr("IRC event [%s] => Program error [%s]", event, e.what()); } catch (...) { - _SqMod->LogErr("IRC event [%s] => Unknown error", event); + SqMod_LogErr("IRC event [%s] => Unknown error", event); } } @@ -743,15 +743,15 @@ void Session::ForwardEvent(Function & listener, Uint32 event, } catch (const Sqrat::Exception & e) { - _SqMod->LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str()); + SqMod_LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str()); } catch (const std::exception & e) { - _SqMod->LogErr("IRC event [%s] => Program error [%s]", event, e.what()); + SqMod_LogErr("IRC event [%s] => Program error [%s]", event, e.what()); } catch (...) { - _SqMod->LogErr("IRC event [%s] => Unknown error", event); + SqMod_LogErr("IRC event [%s] => Unknown error", event); } } @@ -778,7 +778,7 @@ void Session::OnConnect(irc_session_t * session, CCStr event, CCStr origin, CCSt // Prevent any attempts to reconnect now inst->m_Reconnect = false; // Save the connection time-stamp to calculate session uptime - inst->m_SessionTime = _SqMod->GetEpochTimeMicro(); + inst->m_SessionTime = SqMod_GetEpochTimeMicro(); // Now forward event ForwardEvent(inst->m_OnConnect, event, origin, params, count); } diff --git a/modules/json/Module.cpp b/modules/json/Module.cpp index d567fbad..6d686acc 100644 --- a/modules/json/Module.cpp +++ b/modules/json/Module.cpp @@ -37,8 +37,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -55,7 +57,7 @@ void OnSquirrelLoad() return; // Unable to proceed. } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/mg/Handle/Connection.cpp b/modules/mg/Handle/Connection.cpp index 278cbb61..638c82d7 100644 --- a/modules/mg/Handle/Connection.cpp +++ b/modules/mg/Handle/Connection.cpp @@ -29,7 +29,7 @@ void ConnectionHnd::EvFwd(Pointer nc, Int32 ev_type, void * ev_data) { if (!nc->user_data) { - _SqMod->LogErr("Event dispatched without valid instance"); + SqMod_LogErr("Event dispatched without valid instance"); } else { diff --git a/modules/mg/Module.cpp b/modules/mg/Module.cpp index e9dcb8f5..007b1718 100644 --- a/modules/mg/Module.cpp +++ b/modules/mg/Module.cpp @@ -39,8 +39,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -57,7 +59,7 @@ void OnSquirrelLoad() return; // Unable to proceed. } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/mmdb/EntryDataList.cpp b/modules/mmdb/EntryDataList.cpp index 0ed7c0a9..2143d227 100644 --- a/modules/mmdb/EntryDataList.cpp +++ b/modules/mmdb/EntryDataList.cpp @@ -316,7 +316,7 @@ Object EntryDataList::GetLong() const // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushULongObject(_SqVM, longint); + SqMod_PushULongObject(_SqVM, longint); // Get the object from the stack and return it return Var< Object >(_SqVM, -1).value; } diff --git a/modules/mmdb/Module.cpp b/modules/mmdb/Module.cpp index 3a4843f0..c6b6eb15 100644 --- a/modules/mmdb/Module.cpp +++ b/modules/mmdb/Module.cpp @@ -37,8 +37,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -55,7 +57,7 @@ void OnSquirrelLoad() return; // Unable to proceed. } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/sample/Module.cpp b/modules/sample/Module.cpp index 783de322..02d69831 100644 --- a/modules/sample/Module.cpp +++ b/modules/sample/Module.cpp @@ -37,8 +37,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -55,7 +57,7 @@ void OnSquirrelLoad() return; // Unable to proceed. } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/sqlite/Column.cpp b/modules/sqlite/Column.cpp index 0b235ca7..22729c0f 100644 --- a/modules/sqlite/Column.cpp +++ b/modules/sqlite/Column.cpp @@ -195,7 +195,7 @@ Object Column::GetValue() const // Retrieve the the actual blob data that must be returned CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, m_Index)); // Attempt to create a buffer with the blob data on the stack - if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size))) + if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size))) { STHROWF("Unable to allocate buffer of at least (%d) bytes", size); } @@ -325,7 +325,7 @@ Object Column::GetBuffer() const // Retrieve the the actual blob data that must be returned CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, m_Index)); // Attempt to create a buffer with the blob data on the stack - if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size))) + if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size))) { STHROWF("Unable to allocate buffer of at least (%d) bytes", size); } diff --git a/modules/sqlite/Common.cpp b/modules/sqlite/Common.cpp index 7c7c14d9..bbe4d827 100644 --- a/modules/sqlite/Common.cpp +++ b/modules/sqlite/Common.cpp @@ -71,7 +71,7 @@ Object GetMemoryUsage() // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushSLongObject(_SqVM, sqlite3_memory_used()); + SqMod_PushSLongObject(_SqVM, sqlite3_memory_used()); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -82,7 +82,7 @@ Object GetMemoryHighwaterMark(bool reset) // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushSLongObject(_SqVM, sqlite3_memory_highwater(reset)); + SqMod_PushSLongObject(_SqVM, sqlite3_memory_highwater(reset)); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } diff --git a/modules/sqlite/Connection.cpp b/modules/sqlite/Connection.cpp index f4f1f2c6..37735aac 100644 --- a/modules/sqlite/Connection.cpp +++ b/modules/sqlite/Connection.cpp @@ -16,13 +16,13 @@ SQInteger Connection::Typename(HSQUIRRELVM vm) // ------------------------------------------------------------------------------------------------ void Connection::TraceOutput(void * /*ptr*/, CCStr sql) { - _SqMod->LogInf("SQLite Trace: %s", sql); + SqMod_LogInf("SQLite Trace: %s", sql); } // ------------------------------------------------------------------------------------------------ void Connection::ProfileOutput(void * /*ptr*/, CCStr sql, sqlite3_uint64 time) { - _SqMod->LogInf("SQLite profile (time: %llu): %s", time, sql); + SqMod_LogInf("SQLite profile (time: %llu): %s", time, sql); } // ------------------------------------------------------------------------------------------------ diff --git a/modules/sqlite/Handle/Connection.cpp b/modules/sqlite/Handle/Connection.cpp index 85e41f60..7349172b 100644 --- a/modules/sqlite/Handle/Connection.cpp +++ b/modules/sqlite/Handle/Connection.cpp @@ -31,7 +31,7 @@ ConnHnd::~ConnHnd() // Attempt to close the database if ((sqlite3_close(mPtr)) != SQLITE_OK) { - _SqMod->LogErr("Unable to close SQLite connection [%s]", sqlite3_errmsg(mPtr)); + SqMod_LogErr("Unable to close SQLite connection [%s]", sqlite3_errmsg(mPtr)); } } } @@ -127,15 +127,15 @@ Int32 ConnHnd::Flush(Uint32 num, Object & env, Function & func) } catch (const Sqrat::Exception & e) { - _SqMod->LogErr("Squirrel error caught in flush handler [%s]", e.Message().c_str()); + SqMod_LogErr("Squirrel error caught in flush handler [%s]", e.Message().c_str()); } catch (const std::exception & e) { - _SqMod->LogErr("Program error caught in flush handler [%s]", e.what()); + SqMod_LogErr("Program error caught in flush handler [%s]", e.what()); } catch (...) { - _SqMod->LogErr("Unknown error caught in flush handler"); + SqMod_LogErr("Unknown error caught in flush handler"); } } } diff --git a/modules/sqlite/Handle/Statement.cpp b/modules/sqlite/Handle/Statement.cpp index aefb970f..3952dcfc 100644 --- a/modules/sqlite/Handle/Statement.cpp +++ b/modules/sqlite/Handle/Statement.cpp @@ -29,7 +29,7 @@ StmtHnd::~StmtHnd() // Attempt to finalize the statement if ((sqlite3_finalize(mPtr)) != SQLITE_OK) { - _SqMod->LogErr("Unable to finalize SQLite statement [%s]", mConn->ErrMsg()); + SqMod_LogErr("Unable to finalize SQLite statement [%s]", mConn->ErrMsg()); } } } diff --git a/modules/sqlite/Module.cpp b/modules/sqlite/Module.cpp index 05854083..153e11a1 100644 --- a/modules/sqlite/Module.cpp +++ b/modules/sqlite/Module.cpp @@ -37,8 +37,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -55,7 +57,7 @@ void OnSquirrelLoad() return; // Unable to proceed! } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/sqlite/Statement.cpp b/modules/sqlite/Statement.cpp index 2215af25..d1184c6b 100644 --- a/modules/sqlite/Statement.cpp +++ b/modules/sqlite/Statement.cpp @@ -756,7 +756,7 @@ Object Statement::FetchColumnIndex(Int32 idx) const // Retrieve the the actual blob data that must be returned CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, idx)); // Attempt to create a buffer with the blob data on the stack - if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size))) + if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size))) { STHROWF("Unable to allocate buffer of at least (%d) bytes", size); } @@ -874,7 +874,7 @@ Array Statement::FetchArray(Int32 min, Int32 max) const // Retrieve the the actual blob data that must be returned CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, idx)); // Attempt to create a buffer with the blob data on the stack - if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size))) + if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size))) { STHROWF("Unable to allocate buffer of at least (%d) bytes", size); } @@ -981,7 +981,7 @@ Table Statement::FetchTable(Int32 min, Int32 max) const // Retrieve the the actual blob data that must be returned CCStr data = reinterpret_cast< CCStr >(sqlite3_column_blob(m_Handle->mPtr, idx)); // Attempt to create a buffer with the blob data on the stack - if (SQ_FAILED(_SqMod->PushBufferData(DefaultVM::Get(), data, size, size))) + if (SQ_FAILED(SqMod_PushBufferData(DefaultVM::Get(), data, size, size))) { STHROWF("Unable to allocate buffer of at least (%d) bytes", size); } diff --git a/modules/xml/Attribute.cpp b/modules/xml/Attribute.cpp index ed4ad814..4328773d 100644 --- a/modules/xml/Attribute.cpp +++ b/modules/xml/Attribute.cpp @@ -22,12 +22,12 @@ Object Attribute::AsLong(Object & def) const // The resulted long integer value Int64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetSLongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } // Push a long integer instance with the requested value on the stack - _SqMod->PushSLongObject(_SqVM, m_Attr.as_llong(longint)); + SqMod_PushSLongObject(_SqVM, m_Attr.as_llong(longint)); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -42,12 +42,12 @@ Object Attribute::AsUlong(Object & def) const // The resulted long integer value Uint64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetULongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } // Push a long integer instance with the requested value on the stack - _SqMod->PushULongObject(_SqVM, m_Attr.as_ullong(longint)); + SqMod_PushULongObject(_SqVM, m_Attr.as_ullong(longint)); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -62,7 +62,7 @@ bool Attribute::ApplyLong(Object & value) // The resulted long integer value Int64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetSLongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } @@ -80,7 +80,7 @@ bool Attribute::ApplyUlong(Object & value) // The resulted long integer value Uint64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetULongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } @@ -94,7 +94,7 @@ Object Attribute::GetLong() const // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushSLongObject(_SqVM, m_Attr.as_llong()); + SqMod_PushSLongObject(_SqVM, m_Attr.as_llong()); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -109,7 +109,7 @@ void Attribute::SetLong(Object & value) // The resulted long integer value Int64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetSLongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } @@ -123,7 +123,7 @@ Object Attribute::GetUlong() const // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushULongObject(_SqVM, m_Attr.as_ullong()); + SqMod_PushULongObject(_SqVM, m_Attr.as_ullong()); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -138,7 +138,7 @@ void Attribute::SetUlong(Object & value) // The resulted long integer value Uint64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetULongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } diff --git a/modules/xml/Module.cpp b/modules/xml/Module.cpp index 24fe8b9c..b23de8bf 100644 --- a/modules/xml/Module.cpp +++ b/modules/xml/Module.cpp @@ -42,8 +42,10 @@ void OnSquirrelInitialize() } else { + // Expand the Squirrel plug-in API into global functions + sqmod_api_expand(_SqMod); // Obtain the Squirrel API - _SqAPI = _SqMod->GetSquirrelAPI(); + _SqAPI = SqMod_GetSquirrelAPI(); // Expand the Squirrel API into global functions sq_api_expand(_SqAPI); } @@ -60,7 +62,7 @@ void OnSquirrelLoad() return; // Unable to proceed! } // Obtain the Squirrel API and VM - _SqVM = _SqMod->GetSquirrelVM(); + _SqVM = SqMod_GetSquirrelVM(); // Make sure that a valid virtual machine exists if (!_SqVM) { diff --git a/modules/xml/Text.cpp b/modules/xml/Text.cpp index a0d363e9..0a14cb7a 100644 --- a/modules/xml/Text.cpp +++ b/modules/xml/Text.cpp @@ -43,12 +43,12 @@ Object Text::AsLong(Object & def) const // The resulted long integer value Int64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetSLongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } // Push a long integer instance with the requested value on the stack - _SqMod->PushSLongObject(_SqVM, m_Text.as_llong(longint)); + SqMod_PushSLongObject(_SqVM, m_Text.as_llong(longint)); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -63,12 +63,12 @@ Object Text::AsUlong(Object & def) const // The resulted long integer value Uint64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetULongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } // Push a long integer instance with the requested value on the stack - _SqMod->PushULongObject(_SqVM, m_Text.as_ullong(longint)); + SqMod_PushULongObject(_SqVM, m_Text.as_ullong(longint)); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -83,7 +83,7 @@ bool Text::ApplyLong(Object & value) // The resulted long integer value Int64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetSLongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } @@ -101,7 +101,7 @@ bool Text::ApplyUlong(Object & value) // The resulted long integer value Uint64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetULongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } @@ -115,7 +115,7 @@ Object Text::GetLong() const // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushSLongObject(_SqVM, m_Text.as_llong()); + SqMod_PushSLongObject(_SqVM, m_Text.as_llong()); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -130,7 +130,7 @@ void Text::SetLong(Object & value) // The resulted long integer value Int64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetSLongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } @@ -144,7 +144,7 @@ Object Text::GetUlong() const // Obtain the initial stack size const StackGuard sg(_SqVM); // Push a long integer instance with the requested value on the stack - _SqMod->PushULongObject(_SqVM, m_Text.as_ullong()); + SqMod_PushULongObject(_SqVM, m_Text.as_ullong()); // Obtain the object from the stack and return it return Var< Object >(_SqVM, -1).value; } @@ -159,7 +159,7 @@ void Text::SetUlong(Object & value) // The resulted long integer value Uint64 longint = 0; // Attempt to get the numeric value inside the specified object - if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) + if (SQ_FAILED(SqMod_GetULongValue(_SqVM, -1, &longint))) { STHROWF("Invalid long integer specified"); } diff --git a/shared/Base/Utility.inl b/shared/Base/Utility.inl index 0acb5616..6ec9b8da 100644 --- a/shared/Base/Utility.inl +++ b/shared/Base/Utility.inl @@ -747,7 +747,7 @@ 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, val); #else // Transform the specified value into a script object PushVar< SLongInt >(vm, SLongInt(val)); @@ -765,7 +765,7 @@ 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, val); #else // Transform the specified value into a script object PushVar< ULongInt >(vm, ULongInt(val)); @@ -781,7 +781,7 @@ Object MakeSLongObj(HSQUIRRELVM vm, 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, val); #else // Transform the specified value into a script object PushVar< SLongInt >(vm, SLongInt(val)); @@ -797,7 +797,7 @@ Object MakeULongObj(HSQUIRRELVM vm, 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, val); #else // Transform the specified value into a script object PushVar< ULongInt >(vm, ULongInt(val)); @@ -854,7 +854,7 @@ Uint64 FetchULongObjVal(HSQUIRRELVM vm, const Object & val) SQInteger PopStackInteger(HSQUIRRELVM vm, SQInteger idx) { #ifdef SQMOD_PLUGIN_API - return _SqMod->PopStackInteger(vm, idx); + return SqMod_PopStackInteger(vm, idx); #else // Identify which type must be extracted switch (sq_gettype(vm, idx)) @@ -927,7 +927,7 @@ SQInteger PopStackInteger(HSQUIRRELVM vm, SQInteger idx) SQFloat PopStackFloat(HSQUIRRELVM vm, SQInteger idx) { #ifdef SQMOD_PLUGIN_API - return _SqMod->PopStackFloat(vm, idx); + return SqMod_PopStackFloat(vm, idx); #else // Identify which type must be extracted switch (sq_gettype(vm, idx)) @@ -1004,7 +1004,7 @@ SQFloat PopStackFloat(HSQUIRRELVM vm, SQInteger idx) Int64 PopStackSLong(HSQUIRRELVM vm, SQInteger idx) { #ifdef SQMOD_PLUGIN_API - return _SqMod->PopStackSLong(vm, idx); + return SqMod_PopStackSLong(vm, idx); #else // Identify which type must be extracted switch (sq_gettype(vm, idx)) @@ -1077,7 +1077,7 @@ Int64 PopStackSLong(HSQUIRRELVM vm, SQInteger idx) Uint64 PopStackULong(HSQUIRRELVM vm, SQInteger idx) { #ifdef SQMOD_PLUGIN_API - return _SqMod->PopStackULong(vm, idx); + return SqMod_PopStackULong(vm, idx); #else // Identify which type must be extracted switch (sq_gettype(vm, idx)) diff --git a/shared/SqMod.h b/shared/SqMod.h index 5a0590ae..13c7c8c9 100644 --- a/shared/SqMod.h +++ b/shared/SqMod.h @@ -77,6 +77,12 @@ extern "C" { typedef SqInt64 (*SqEx_GetCurrentSysTime) (void); typedef SqInt64 (*SqEx_GetEpochTimeMicro) (void); typedef SqInt64 (*SqEx_GetEpochTimeMilli) (void); + typedef SQBool (*SqEx_ValidDate) (uint16_t year, uint8_t month, uint8_t day); + typedef SQBool (*SqEx_IsLeapYear) (uint16_t year); + typedef uint16_t (*SqEx_DaysInYear) (uint16_t year); + typedef uint8_t (*SqEx_DaysInMonth) (uint16_t year, uint8_t month); + typedef uint16_t (*SqEx_DayOfYear) (uint16_t year, uint8_t month, uint8_t day); + typedef SqInt64 (*SqEx_DateRangeToSeconds) (uint16_t lyear, uint8_t lmonth, uint8_t lday, uint16_t ryear, uint8_t rmonth, uint8_t rday); typedef SQRESULT (*SqEx_GetTimestamp) (HSQUIRRELVM vm, SQInteger idx, SqInt64 * num); typedef SQRESULT (*SqEx_PushTimestamp) (HSQUIRRELVM vm, SqInt64 num); typedef SQRESULT (*SqEx_GetDate) (HSQUIRRELVM vm, SQInteger idx, uint16_t * year, uint8_t * month, uint8_t * day); @@ -129,6 +135,12 @@ extern "C" { SqEx_GetCurrentSysTime GetCurrentSysTime; SqEx_GetEpochTimeMicro GetEpochTimeMicro; SqEx_GetEpochTimeMilli GetEpochTimeMilli; + SqEx_ValidDate ValidDate; + SqEx_IsLeapYear IsLeapYear; + SqEx_DaysInYear DaysInYear; + SqEx_DaysInMonth DaysInMonth; + SqEx_DayOfYear DayOfYear; + SqEx_DateRangeToSeconds DateRangeToSeconds; SqEx_GetTimestamp GetTimestamp; SqEx_PushTimestamp PushTimestamp; SqEx_GetDate GetDate; @@ -147,6 +159,68 @@ extern "C" { SqEx_PushBufferData PushBufferData; } sq_exports, SQEXPORTS, *HSQEXPORTS; +#ifdef SQMOD_PLUGIN_API + + //primitive functions + extern SqEx_GetSquirrelAPI SqMod_GetSquirrelAPI; + extern SqEx_GetSquirrelVM SqMod_GetSquirrelVM; + + //logging utilities + extern SqEx_LogMessage SqMod_LogDbg; + extern SqEx_LogMessage SqMod_LogUsr; + extern SqEx_LogMessage SqMod_LogScs; + extern SqEx_LogMessage SqMod_LogInf; + extern SqEx_LogMessage SqMod_LogWrn; + extern SqEx_LogMessage SqMod_LogErr; + extern SqEx_LogMessage SqMod_LogFtl; + extern SqEx_LogMessage SqMod_LogSDbg; + extern SqEx_LogMessage SqMod_LogSUsr; + extern SqEx_LogMessage SqMod_LogSScs; + extern SqEx_LogMessage SqMod_LogSInf; + extern SqEx_LogMessage SqMod_LogSWrn; + extern SqEx_LogMessage SqMod_LogSErr; + extern SqEx_LogMessage SqMod_LogSFtl; + + //script loading + extern SqEx_LoadScript SqMod_LoadScript; + + //numeric utilities + extern SqEx_GetSLongValue SqMod_GetSLongValue; + extern SqEx_PushSLongObject SqMod_PushSLongObject; + extern SqEx_GetULongValue SqMod_GetULongValue; + extern SqEx_PushULongObject SqMod_PushULongObject; + + //time utilities + extern SqEx_GetCurrentSysTime SqMod_GetCurrentSysTime; + extern SqEx_GetEpochTimeMicro SqMod_GetEpochTimeMicro; + extern SqEx_GetEpochTimeMilli SqMod_GetEpochTimeMilli; + extern SqEx_ValidDate SqMod_ValidDate; + extern SqEx_IsLeapYear SqMod_IsLeapYear; + extern SqEx_DaysInYear SqMod_DaysInYear; + extern SqEx_DaysInMonth SqMod_DaysInMonth; + extern SqEx_DayOfYear SqMod_DayOfYear; + extern SqEx_DateRangeToSeconds SqMod_DateRangeToSeconds; + extern SqEx_GetTimestamp SqMod_GetTimestamp; + extern SqEx_PushTimestamp SqMod_PushTimestamp; + extern SqEx_GetDate SqMod_GetDate; + extern SqEx_PushDate SqMod_PushDate; + extern SqEx_GetTime SqMod_GetTime; + extern SqEx_PushTime SqMod_PushTime; + extern SqEx_GetDatetime SqMod_GetDatetime; + extern SqEx_PushDatetime SqMod_PushDatetime; + + //stack utilities + extern SqEx_PopStackInteger SqMod_PopStackInteger; + extern SqEx_PopStackFloat SqMod_PopStackFloat; + extern SqEx_PopStackSLong SqMod_PopStackSLong; + extern SqEx_PopStackULong SqMod_PopStackULong; + + //buffer utilities + extern SqEx_PushBuffer SqMod_PushBuffer; + extern SqEx_PushBufferData SqMod_PushBufferData; + +#endif // SQMOD_PLUGIN_API + /* -------------------------------------------------------------------------------------------- * Import the functions from the main squirrel plug-in. */ @@ -157,11 +231,21 @@ extern "C" { */ SQUIRREL_API SQRESULT sq_api_expand(HSQAPI sqapi); + /* -------------------------------------------------------------------------------------------- + * Assign the functions from the specified API structure into the global functions. + */ + SQUIRREL_API SQRESULT sqmod_api_expand(HSQEXPORTS sqmodapi); + /* -------------------------------------------------------------------------------------------- * Undo changes done by sq_api_expand. */ SQUIRREL_API void sq_api_collapse(); + /* -------------------------------------------------------------------------------------------- + * Undo changes done by sqmod_api_expand. + */ + SQUIRREL_API void sqmod_api_collapse(); + #ifdef __cplusplus } /*extern "C"*/ #endif diff --git a/shared/SqMod.inl b/shared/SqMod.inl index 3eb87489..71c5497a 100644 --- a/shared/SqMod.inl +++ b/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 +} diff --git a/source/Exports.cpp b/source/Exports.cpp index 5955ff27..2cb480b5 100644 --- a/source/Exports.cpp +++ b/source/Exports.cpp @@ -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;