diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt deleted file mode 100644 index 7b24711f..00000000 --- a/sdk/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Create the SqSDK library -add_library(SqSDKAPI INTERFACE) -# Library includes -target_include_directories(SqSDKAPI INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) -# Link to required libraries -target_link_libraries(SqSDKAPI INTERFACE VCMP SquirrelAPI) -# Create the SqSDK library -add_library(SqSDK STATIC - include/SqConfSDK.h - include/SqAPI.h - include/SqMod.h - SqMod.cpp -) -# Library includes -target_include_directories(SqSDK PRIVATE ${CMAKE_CURRENT_LIST_DIR}) -target_include_directories(SqSDK PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) -# Link to required libraries -target_link_libraries(SqSDK PRIVATE VCMP SquirrelAPI) -# Switch to plugin-development mode -if(PLUGIN_DEVEL) - target_compile_definitions(SqSDK PUBLIC SQMOD_PLUGIN_API=1) -endif() \ No newline at end of file diff --git a/sdk/SqMod.c b/sdk/SqMod.c deleted file mode 100644 index 5e6295d3..00000000 --- a/sdk/SqMod.c +++ /dev/null @@ -1,5 +0,0 @@ -// //////////////////////////////////////////////////////////////////////////////////////////////// -#include "SqMod.h" - -// This method is used to avoid compilers warning about C++ flags on C files and vice-versa. -#include "SqMod.inl" diff --git a/sdk/SqMod.cpp b/sdk/SqMod.cpp deleted file mode 100644 index 5e6295d3..00000000 --- a/sdk/SqMod.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// //////////////////////////////////////////////////////////////////////////////////////////////// -#include "SqMod.h" - -// This method is used to avoid compilers warning about C++ flags on C files and vice-versa. -#include "SqMod.inl" diff --git a/sdk/SqMod.inl b/sdk/SqMod.inl deleted file mode 100644 index df47eede..00000000 --- a/sdk/SqMod.inl +++ /dev/null @@ -1,675 +0,0 @@ -// ------------------------------------------------------------------------------------------------ -#ifdef SQMOD_PLUGIN_API - -//primitive functions -SqModAPI_GetSquirrelVM SqMod_GetSquirrelVM = NULL; - -//logging utilities -SqModAPI_LogMessage SqMod_LogDbg = NULL; -SqModAPI_LogMessage SqMod_LogUsr = NULL; -SqModAPI_LogMessage SqMod_LogScs = NULL; -SqModAPI_LogMessage SqMod_LogInf = NULL; -SqModAPI_LogMessage SqMod_LogWrn = NULL; -SqModAPI_LogMessage SqMod_LogErr = NULL; -SqModAPI_LogMessage SqMod_LogFtl = NULL; -SqModAPI_LogMessage SqMod_LogSDbg = NULL; -SqModAPI_LogMessage SqMod_LogSUsr = NULL; -SqModAPI_LogMessage SqMod_LogSScs = NULL; -SqModAPI_LogMessage SqMod_LogSInf = NULL; -SqModAPI_LogMessage SqMod_LogSWrn = NULL; -SqModAPI_LogMessage SqMod_LogSErr = NULL; -SqModAPI_LogMessage SqMod_LogSFtl = NULL; - -//script loading -SqModAPI_LoadScript SqMod_LoadScript = NULL; - -#endif // SQMOD_PLUGIN_API - -// ------------------------------------------------------------------------------------------------ -uint8_t sqmod_api_expand(HSQMODAPI sqmodapi) -{ - if (!sqmodapi) - { - return 0; - } - -#ifdef SQMOD_PLUGIN_API - - //primitive functions - 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; - -#endif // SQMOD_PLUGIN_API - - return 1; -} - -// ------------------------------------------------------------------------------------------------ -void sqmod_api_collapse() -{ -#ifdef SQMOD_PLUGIN_API - - //primitive functions - 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; - -#endif // SQMOD_PLUGIN_API -} - -// ------------------------------------------------------------------------------------------------ -#ifdef SQMOD_PLUGIN_API - -//vm -SqLibAPI_open SqLib_open = NULL; -SqLibAPI_newthread SqLib_newthread = NULL; -SqLibAPI_seterrorhandler SqLib_seterrorhandler = NULL; -SqLibAPI_close SqLib_close = NULL; -SqLibAPI_setforeignptr SqLib_setforeignptr = NULL; -SqLibAPI_getforeignptr SqLib_getforeignptr = NULL; -SqLibAPI_setsharedforeignptr SqLib_setsharedforeignptr = NULL; -SqLibAPI_getsharedforeignptr SqLib_getsharedforeignptr = NULL; -SqLibAPI_setvmreleasehook SqLib_setvmreleasehook = NULL; -SqLibAPI_getvmreleasehook SqLib_getvmreleasehook = NULL; -SqLibAPI_setsharedreleasehook SqLib_setsharedreleasehook = NULL; -SqLibAPI_getsharedreleasehook SqLib_getsharedreleasehook = NULL; -SqLibAPI_setprintfunc SqLib_setprintfunc = NULL; -SqLibAPI_getprintfunc SqLib_getprintfunc = NULL; -SqLibAPI_geterrorfunc SqLib_geterrorfunc = NULL; -SqLibAPI_suspendvm SqLib_suspendvm = NULL; -SqLibAPI_wakeupvm SqLib_wakeupvm = NULL; -SqLibAPI_getvmstate SqLib_getvmstate = NULL; -SqLibAPI_getversion SqLib_getversion = NULL; - -//compiler -SqLibAPI_compile SqLib_compile = NULL; -SqLibAPI_compilebuffer SqLib_compilebuffer = NULL; -SqLibAPI_enabledebuginfo SqLib_enabledebuginfo = NULL; -SqLibAPI_notifyallexceptions SqLib_notifyallexceptions = NULL; -SqLibAPI_setcompilererrorhandler SqLib_setcompilererrorhandler = NULL; - -//stack operations -SqLibAPI_push SqLib_push = NULL; -SqLibAPI_pop SqLib_pop = NULL; -SqLibAPI_poptop SqLib_poptop = NULL; -SqLibAPI_remove SqLib_remove = NULL; -SqLibAPI_gettop SqLib_gettop = NULL; -SqLibAPI_settop SqLib_settop = NULL; -SqLibAPI_reservestack SqLib_reservestack = NULL; -SqLibAPI_cmp SqLib_cmp = NULL; -SqLibAPI_move SqLib_move = NULL; - -//object creation handling -SqLibAPI_newuserdata SqLib_newuserdata = NULL; -SqLibAPI_newtable SqLib_newtable = NULL; -SqLibAPI_newtableex SqLib_newtableex = NULL; -SqLibAPI_newarray SqLib_newarray = NULL; -SqLibAPI_newclosure SqLib_newclosure = NULL; -SqLibAPI_setparamscheck SqLib_setparamscheck = NULL; -SqLibAPI_bindenv SqLib_bindenv = NULL; -SqLibAPI_setclosureroot SqLib_setclosureroot = NULL; -SqLibAPI_getclosureroot SqLib_getclosureroot = NULL; -SqLibAPI_pushstring SqLib_pushstring = NULL; -SqLibAPI_pushstringf SqLib_pushstringf = NULL; -SqLibAPI_pushfloat SqLib_pushfloat = NULL; -SqLibAPI_pushinteger SqLib_pushinteger = NULL; -SqLibAPI_pushbool SqLib_pushbool = NULL; -SqLibAPI_pushuserpointer SqLib_pushuserpointer = NULL; -SqLibAPI_pushnull SqLib_pushnull = NULL; -SqLibAPI_pushthread SqLib_pushthread = NULL; -SqLibAPI_gettype SqLib_gettype = NULL; -SqLibAPI_typeof SqLib_typeof = NULL; -SqLibAPI_getsize SqLib_getsize = NULL; -SqLibAPI_gethash SqLib_gethash = NULL; -SqLibAPI_getbase SqLib_getbase = NULL; -SqLibAPI_instanceof SqLib_instanceof = NULL; -SqLibAPI_tostring SqLib_tostring = NULL; -SqLibAPI_tobool SqLib_tobool = NULL; -SqLibAPI_getstringandsize SqLib_getstringandsize = NULL; -SqLibAPI_getstring SqLib_getstring = NULL; -SqLibAPI_getinteger SqLib_getinteger = NULL; -SqLibAPI_getfloat SqLib_getfloat = NULL; -SqLibAPI_getbool SqLib_getbool = NULL; -SqLibAPI_getthread SqLib_getthread = NULL; -SqLibAPI_getuserpointer SqLib_getuserpointer = NULL; -SqLibAPI_getuserdata SqLib_getuserdata = NULL; -SqLibAPI_settypetag SqLib_settypetag = NULL; -SqLibAPI_gettypetag SqLib_gettypetag = NULL; -SqLibAPI_setreleasehook SqLib_setreleasehook = NULL; -SqLibAPI_getreleasehook SqLib_getreleasehook = NULL; -SqLibAPI_getscratchpad SqLib_getscratchpad = NULL; -SqLibAPI_getfunctioninfo SqLib_getfunctioninfo = NULL; -SqLibAPI_getclosureinfo SqLib_getclosureinfo = NULL; -SqLibAPI_getclosurename SqLib_getclosurename = NULL; -SqLibAPI_setnativeclosurename SqLib_setnativeclosurename = NULL; -SqLibAPI_getnativeclosurepointer SqLib_getnativeclosurepointer = NULL; -SqLibAPI_setinstanceup SqLib_setinstanceup = NULL; -SqLibAPI_getinstanceup SqLib_getinstanceup = NULL; -SqLibAPI_setclassudsize SqLib_setclassudsize = NULL; -SqLibAPI_newclass SqLib_newclass = NULL; -SqLibAPI_createinstance SqLib_createinstance = NULL; -SqLibAPI_setattributes SqLib_setattributes = NULL; -SqLibAPI_getattributes SqLib_getattributes = NULL; -SqLibAPI_getclass SqLib_getclass = NULL; -SqLibAPI_weakref SqLib_weakref = NULL; -SqLibAPI_getdefaultdelegate SqLib_getdefaultdelegate = NULL; -SqLibAPI_getmemberhandle SqLib_getmemberhandle = NULL; -SqLibAPI_getbyhandle SqLib_getbyhandle = NULL; -SqLibAPI_setbyhandle SqLib_setbyhandle = NULL; - -//object manipulation -SqLibAPI_pushroottable SqLib_pushroottable = NULL; -SqLibAPI_pushregistrytable SqLib_pushregistrytable = NULL; -SqLibAPI_pushconsttable SqLib_pushconsttable = NULL; -SqLibAPI_setroottable SqLib_setroottable = NULL; -SqLibAPI_setconsttable SqLib_setconsttable = NULL; -SqLibAPI_newslot SqLib_newslot = NULL; -SqLibAPI_deleteslot SqLib_deleteslot = NULL; -SqLibAPI_set SqLib_set = NULL; -SqLibAPI_get SqLib_get = NULL; -SqLibAPI_rawget SqLib_rawget = NULL; -SqLibAPI_rawset SqLib_rawset = NULL; -SqLibAPI_rawdeleteslot SqLib_rawdeleteslot = NULL; -SqLibAPI_newmember SqLib_newmember = NULL; -SqLibAPI_rawnewmember SqLib_rawnewmember = NULL; -SqLibAPI_arrayappend SqLib_arrayappend = NULL; -SqLibAPI_arraypop SqLib_arraypop = NULL; -SqLibAPI_arrayresize SqLib_arrayresize = NULL; -SqLibAPI_arrayreverse SqLib_arrayreverse = NULL; -SqLibAPI_arrayremove SqLib_arrayremove = NULL; -SqLibAPI_arrayinsert SqLib_arrayinsert = NULL; -SqLibAPI_setdelegate SqLib_setdelegate = NULL; -SqLibAPI_getdelegate SqLib_getdelegate = NULL; -SqLibAPI_clone SqLib_clone = NULL; -SqLibAPI_setfreevariable SqLib_setfreevariable = NULL; -SqLibAPI_next SqLib_next = NULL; -SqLibAPI_getweakrefval SqLib_getweakrefval = NULL; -SqLibAPI_clear SqLib_clear = NULL; - -//calls -SqLibAPI_call SqLib_call = NULL; -SqLibAPI_resume SqLib_resume = NULL; -SqLibAPI_getlocal SqLib_getlocal = NULL; -SqLibAPI_getcallee SqLib_getcallee = NULL; -SqLibAPI_getfreevariable SqLib_getfreevariable = NULL; -SqLibAPI_getonefreevariable SqLib_getonefreevariable = NULL; -SqLibAPI_throwerror SqLib_throwerror = NULL; -SqLibAPI_throwerrorf SqLib_throwerrorf = NULL; -SqLibAPI_throwobject SqLib_throwobject = NULL; -SqLibAPI_reseterror SqLib_reseterror = NULL; -SqLibAPI_getlasterror SqLib_getlasterror = NULL; - -//raw object handling -SqLibAPI_getstackobj SqLib_getstackobj = NULL; -SqLibAPI_pushobject SqLib_pushobject = NULL; -SqLibAPI_addref SqLib_addref = NULL; -SqLibAPI_release SqLib_release = NULL; -SqLibAPI_getrefcount SqLib_getrefcount = NULL; -SqLibAPI_resetobject SqLib_resetobject = NULL; -SqLibAPI_objtostring SqLib_objtostring = NULL; -SqLibAPI_objtobool SqLib_objtobool = NULL; -SqLibAPI_objtointeger SqLib_objtointeger = NULL; -SqLibAPI_objtofloat SqLib_objtofloat = NULL; -SqLibAPI_objtouserpointer SqLib_objtouserpointer = NULL; -SqLibAPI_getobjtypetag SqLib_getobjtypetag = NULL; -SqLibAPI_getvmrefcount SqLib_getvmrefcount = NULL; - -//GC -SqLibAPI_collectgarbage SqLib_collectgarbage = NULL; -SqLibAPI_resurrectunreachable SqLib_resurrectunreachable = NULL; - -//serialization -SqLibAPI_writeclosure SqLib_writeclosure = NULL; -SqLibAPI_readclosure SqLib_readclosure = NULL; - -//mem allocation -SqLibAPI_malloc SqLib_malloc = NULL; -SqLibAPI_realloc SqLib_realloc = NULL; -SqLibAPI_free SqLib_free = NULL; - -//debug -SqLibAPI_stackinfos SqLib_stackinfos = NULL; -SqLibAPI_setdebughook SqLib_setdebughook = NULL; -SqLibAPI_setnativedebughook SqLib_setnativedebughook = NULL; - -//compiler helpers -SqLibAPI_loadfile SqLib_loadfile = NULL; -SqLibAPI_dofile SqLib_dofile = NULL; -SqLibAPI_writeclosuretofile SqLib_writeclosuretofile = NULL; - -//blob -SqLibAPI_createblob SqLib_createblob = NULL; -SqLibAPI_getblob SqLib_getblob = NULL; -SqLibAPI_getblobsize SqLib_getblobsize = NULL; - -//string -SqLibAPI_format SqLib_format = NULL; -#endif // SQMOD_PLUGIN_API - -// ------------------------------------------------------------------------------------------------ -uint8_t sqlib_api_expand(HSQLIBAPI sqlibapi) -{ - if (!sqlibapi) - { - return 0; - } - -#ifdef SQMOD_PLUGIN_API - - //vm - SqLib_open = sqlibapi->open; - SqLib_newthread = sqlibapi->newthread; - SqLib_seterrorhandler = sqlibapi->seterrorhandler; - SqLib_close = sqlibapi->close; - SqLib_setforeignptr = sqlibapi->setforeignptr; - SqLib_getforeignptr = sqlibapi->getforeignptr; - SqLib_setsharedforeignptr = sqlibapi->setsharedforeignptr; - SqLib_getsharedforeignptr = sqlibapi->getsharedforeignptr; - SqLib_setvmreleasehook = sqlibapi->setvmreleasehook; - SqLib_getvmreleasehook = sqlibapi->getvmreleasehook; - SqLib_setsharedreleasehook = sqlibapi->setsharedreleasehook; - SqLib_getsharedreleasehook = sqlibapi->getsharedreleasehook; - SqLib_setprintfunc = sqlibapi->setprintfunc; - SqLib_getprintfunc = sqlibapi->getprintfunc; - SqLib_geterrorfunc = sqlibapi->geterrorfunc; - SqLib_suspendvm = sqlibapi->suspendvm; - SqLib_wakeupvm = sqlibapi->wakeupvm; - SqLib_getvmstate = sqlibapi->getvmstate; - SqLib_getversion = sqlibapi->getversion; - - //compiler - SqLib_compile = sqlibapi->compile; - SqLib_compilebuffer = sqlibapi->compilebuffer; - SqLib_enabledebuginfo = sqlibapi->enabledebuginfo; - SqLib_notifyallexceptions = sqlibapi->notifyallexceptions; - SqLib_setcompilererrorhandler = sqlibapi->setcompilererrorhandler; - - //stack operations - SqLib_push = sqlibapi->push; - SqLib_pop = sqlibapi->pop; - SqLib_poptop = sqlibapi->poptop; - SqLib_remove = sqlibapi->remove; - SqLib_gettop = sqlibapi->gettop; - SqLib_settop = sqlibapi->settop; - SqLib_reservestack = sqlibapi->reservestack; - SqLib_cmp = sqlibapi->cmp; - SqLib_move = sqlibapi->move; - - //object creation handling - SqLib_newuserdata = sqlibapi->newuserdata; - SqLib_newtable = sqlibapi->newtable; - SqLib_newtableex = sqlibapi->newtableex; - SqLib_newarray = sqlibapi->newarray; - SqLib_newclosure = sqlibapi->newclosure; - SqLib_setparamscheck = sqlibapi->setparamscheck; - SqLib_bindenv = sqlibapi->bindenv; - SqLib_setclosureroot = sqlibapi->setclosureroot; - SqLib_getclosureroot = sqlibapi->getclosureroot; - SqLib_pushstring = sqlibapi->pushstring; - SqLib_pushstringf = sqlibapi->pushstringf; - SqLib_pushfloat = sqlibapi->pushfloat; - SqLib_pushinteger = sqlibapi->pushinteger; - SqLib_pushbool = sqlibapi->pushbool; - SqLib_pushuserpointer = sqlibapi->pushuserpointer; - SqLib_pushnull = sqlibapi->pushnull; - SqLib_pushthread = sqlibapi->pushthread; - SqLib_gettype = sqlibapi->gettype; - SqLib_typeof = sqlibapi->typeof_; - SqLib_getsize = sqlibapi->getsize; - SqLib_gethash = sqlibapi->gethash; - SqLib_getbase = sqlibapi->getbase; - SqLib_instanceof = sqlibapi->instanceof; - SqLib_tostring = sqlibapi->tostring; - SqLib_tobool = sqlibapi->tobool; - SqLib_getstringandsize = sqlibapi->getstringandsize; - SqLib_getstring = sqlibapi->getstring; - SqLib_getinteger = sqlibapi->getinteger; - SqLib_getfloat = sqlibapi->getfloat; - SqLib_getbool = sqlibapi->getbool; - SqLib_getthread = sqlibapi->getthread; - SqLib_getuserpointer = sqlibapi->getuserpointer; - SqLib_getuserdata = sqlibapi->getuserdata; - SqLib_settypetag = sqlibapi->settypetag; - SqLib_gettypetag = sqlibapi->gettypetag; - SqLib_setreleasehook = sqlibapi->setreleasehook; - SqLib_getreleasehook = sqlibapi->getreleasehook; - SqLib_getscratchpad = sqlibapi->getscratchpad; - SqLib_getfunctioninfo = sqlibapi->getfunctioninfo; - SqLib_getclosureinfo = sqlibapi->getclosureinfo; - SqLib_getclosurename = sqlibapi->getclosurename; - SqLib_setnativeclosurename = sqlibapi->setnativeclosurename; - SqLib_getnativeclosurepointer = sqlibapi->getnativeclosurepointer; - SqLib_setinstanceup = sqlibapi->setinstanceup; - SqLib_getinstanceup = sqlibapi->getinstanceup; - SqLib_setclassudsize = sqlibapi->setclassudsize; - SqLib_newclass = sqlibapi->newclass; - SqLib_createinstance = sqlibapi->createinstance; - SqLib_setattributes = sqlibapi->setattributes; - SqLib_getattributes = sqlibapi->getattributes; - SqLib_getclass = sqlibapi->getclass; - SqLib_weakref = sqlibapi->weakref; - SqLib_getdefaultdelegate = sqlibapi->getdefaultdelegate; - SqLib_getmemberhandle = sqlibapi->getmemberhandle; - SqLib_getbyhandle = sqlibapi->getbyhandle; - SqLib_setbyhandle = sqlibapi->setbyhandle; - - //object manipulation - SqLib_pushroottable = sqlibapi->pushroottable; - SqLib_pushregistrytable = sqlibapi->pushregistrytable; - SqLib_pushconsttable = sqlibapi->pushconsttable; - SqLib_setroottable = sqlibapi->setroottable; - SqLib_setconsttable = sqlibapi->setconsttable; - SqLib_newslot = sqlibapi->newslot; - SqLib_deleteslot = sqlibapi->deleteslot; - SqLib_set = sqlibapi->set; - SqLib_get = sqlibapi->get; - SqLib_rawget = sqlibapi->rawget; - SqLib_rawset = sqlibapi->rawset; - SqLib_rawdeleteslot = sqlibapi->rawdeleteslot; - SqLib_newmember = sqlibapi->newmember; - SqLib_rawnewmember = sqlibapi->rawnewmember; - SqLib_arrayappend = sqlibapi->arrayappend; - SqLib_arraypop = sqlibapi->arraypop; - SqLib_arrayresize = sqlibapi->arrayresize; - SqLib_arrayreverse = sqlibapi->arrayreverse; - SqLib_arrayremove = sqlibapi->arrayremove; - SqLib_arrayinsert = sqlibapi->arrayinsert; - SqLib_setdelegate = sqlibapi->setdelegate; - SqLib_getdelegate = sqlibapi->getdelegate; - SqLib_clone = sqlibapi->clone; - SqLib_setfreevariable = sqlibapi->setfreevariable; - SqLib_next = sqlibapi->next; - SqLib_getweakrefval = sqlibapi->getweakrefval; - SqLib_clear = sqlibapi->clear; - - //calls - SqLib_call = sqlibapi->call; - SqLib_resume = sqlibapi->resume; - SqLib_getlocal = sqlibapi->getlocal; - SqLib_getcallee = sqlibapi->getcallee; - SqLib_getfreevariable = sqlibapi->getfreevariable; - SqLib_getonefreevariable = sqlibapi->getonefreevariable; - SqLib_throwerror = sqlibapi->throwerror; - SqLib_throwerrorf = sqlibapi->throwerrorf; - SqLib_throwobject = sqlibapi->throwobject; - SqLib_reseterror = sqlibapi->reseterror; - SqLib_getlasterror = sqlibapi->getlasterror; - - //raw object handling - SqLib_getstackobj = sqlibapi->getstackobj; - SqLib_pushobject = sqlibapi->pushobject; - SqLib_addref = sqlibapi->addref; - SqLib_release = sqlibapi->release; - SqLib_getrefcount = sqlibapi->getrefcount; - SqLib_resetobject = sqlibapi->resetobject; - SqLib_objtostring = sqlibapi->objtostring; - SqLib_objtobool = sqlibapi->objtobool; - SqLib_objtointeger = sqlibapi->objtointeger; - SqLib_objtofloat = sqlibapi->objtofloat; - SqLib_objtouserpointer = sqlibapi->objtouserpointer; - SqLib_getobjtypetag = sqlibapi->getobjtypetag; - SqLib_getvmrefcount = sqlibapi->getvmrefcount; - - //GC - SqLib_collectgarbage = sqlibapi->collectgarbage; - SqLib_resurrectunreachable = sqlibapi->resurrectunreachable; - - //serialization - SqLib_writeclosure = sqlibapi->writeclosure; - SqLib_readclosure = sqlibapi->readclosure; - - //mem allocation - SqLib_malloc = sqlibapi->malloc; - SqLib_realloc = sqlibapi->realloc; - SqLib_free = sqlibapi->free; - - //debug - SqLib_stackinfos = sqlibapi->stackinfos; - SqLib_setdebughook = sqlibapi->setdebughook; - SqLib_setnativedebughook = sqlibapi->setnativedebughook; - - //compiler helpers - SqLib_loadfile = sqlibapi->loadfile; - SqLib_dofile = sqlibapi->dofile; - SqLib_writeclosuretofile = sqlibapi->writeclosuretofile; - - //blob - SqLib_createblob = sqlibapi->createblob; - SqLib_getblob = sqlibapi->getblob; - SqLib_getblobsize = sqlibapi->getblobsize; - - //string - SqLib_format = sqlibapi->format; - -#endif // SQMOD_PLUGIN_API - - return 1; -} - -// ------------------------------------------------------------------------------------------------ -void sqlib_api_collapse() -{ -#ifdef SQMOD_PLUGIN_API - - //vm - SqLib_open = NULL; - SqLib_newthread = NULL; - SqLib_seterrorhandler = NULL; - SqLib_close = NULL; - SqLib_setforeignptr = NULL; - SqLib_getforeignptr = NULL; - SqLib_setsharedforeignptr = NULL; - SqLib_getsharedforeignptr = NULL; - SqLib_setvmreleasehook = NULL; - SqLib_getvmreleasehook = NULL; - SqLib_setsharedreleasehook = NULL; - SqLib_getsharedreleasehook = NULL; - SqLib_setprintfunc = NULL; - SqLib_getprintfunc = NULL; - SqLib_geterrorfunc = NULL; - SqLib_suspendvm = NULL; - SqLib_wakeupvm = NULL; - SqLib_getvmstate = NULL; - SqLib_getversion = NULL; - - //compiler - SqLib_compile = NULL; - SqLib_compilebuffer = NULL; - SqLib_enabledebuginfo = NULL; - SqLib_notifyallexceptions = NULL; - SqLib_setcompilererrorhandler = NULL; - - //stack operations - SqLib_push = NULL; - SqLib_pop = NULL; - SqLib_poptop = NULL; - SqLib_remove = NULL; - SqLib_gettop = NULL; - SqLib_settop = NULL; - SqLib_reservestack = NULL; - SqLib_cmp = NULL; - SqLib_move = NULL; - - //object creation handling - SqLib_newuserdata = NULL; - SqLib_newtable = NULL; - SqLib_newtableex = NULL; - SqLib_newarray = NULL; - SqLib_newclosure = NULL; - SqLib_setparamscheck = NULL; - SqLib_bindenv = NULL; - SqLib_setclosureroot = NULL; - SqLib_getclosureroot = NULL; - SqLib_pushstring = NULL; - SqLib_pushstringf = NULL; - SqLib_pushfloat = NULL; - SqLib_pushinteger = NULL; - SqLib_pushbool = NULL; - SqLib_pushuserpointer = NULL; - SqLib_pushnull = NULL; - SqLib_pushthread = NULL; - SqLib_gettype = NULL; - SqLib_typeof = NULL; - SqLib_getsize = NULL; - SqLib_gethash = NULL; - SqLib_getbase = NULL; - SqLib_instanceof = NULL; - SqLib_tostring = NULL; - SqLib_tobool = NULL; - SqLib_getstringandsize = NULL; - SqLib_getstring = NULL; - SqLib_getinteger = NULL; - SqLib_getfloat = NULL; - SqLib_getbool = NULL; - SqLib_getthread = NULL; - SqLib_getuserpointer = NULL; - SqLib_getuserdata = NULL; - SqLib_settypetag = NULL; - SqLib_gettypetag = NULL; - SqLib_setreleasehook = NULL; - SqLib_getreleasehook = NULL; - SqLib_getscratchpad = NULL; - SqLib_getfunctioninfo = NULL; - SqLib_getclosureinfo = NULL; - SqLib_getclosurename = NULL; - SqLib_setnativeclosurename = NULL; - SqLib_getnativeclosurepointer = NULL; - SqLib_setinstanceup = NULL; - SqLib_getinstanceup = NULL; - SqLib_setclassudsize = NULL; - SqLib_newclass = NULL; - SqLib_createinstance = NULL; - SqLib_setattributes = NULL; - SqLib_getattributes = NULL; - SqLib_getclass = NULL; - SqLib_weakref = NULL; - SqLib_getdefaultdelegate = NULL; - SqLib_getmemberhandle = NULL; - SqLib_getbyhandle = NULL; - SqLib_setbyhandle = NULL; - - //object manipulation - SqLib_pushroottable = NULL; - SqLib_pushregistrytable = NULL; - SqLib_pushconsttable = NULL; - SqLib_setroottable = NULL; - SqLib_setconsttable = NULL; - SqLib_newslot = NULL; - SqLib_deleteslot = NULL; - SqLib_set = NULL; - SqLib_get = NULL; - SqLib_rawget = NULL; - SqLib_rawset = NULL; - SqLib_rawdeleteslot = NULL; - SqLib_newmember = NULL; - SqLib_rawnewmember = NULL; - SqLib_arrayappend = NULL; - SqLib_arraypop = NULL; - SqLib_arrayresize = NULL; - SqLib_arrayreverse = NULL; - SqLib_arrayremove = NULL; - SqLib_arrayinsert = NULL; - SqLib_setdelegate = NULL; - SqLib_getdelegate = NULL; - SqLib_clone = NULL; - SqLib_setfreevariable = NULL; - SqLib_next = NULL; - SqLib_getweakrefval = NULL; - SqLib_clear = NULL; - - //calls - SqLib_call = NULL; - SqLib_resume = NULL; - SqLib_getlocal = NULL; - SqLib_getcallee = NULL; - SqLib_getfreevariable = NULL; - SqLib_getonefreevariable = NULL; - SqLib_throwerror = NULL; - SqLib_throwerrorf = NULL; - SqLib_throwobject = NULL; - SqLib_reseterror = NULL; - SqLib_getlasterror = NULL; - - //raw object handling - SqLib_getstackobj = NULL; - SqLib_pushobject = NULL; - SqLib_addref = NULL; - SqLib_release = NULL; - SqLib_getrefcount = NULL; - SqLib_resetobject = NULL; - SqLib_objtostring = NULL; - SqLib_objtobool = NULL; - SqLib_objtointeger = NULL; - SqLib_objtofloat = NULL; - SqLib_objtouserpointer = NULL; - SqLib_getobjtypetag = NULL; - SqLib_getvmrefcount = NULL; - - //GC - SqLib_collectgarbage = NULL; - SqLib_resurrectunreachable = NULL; - - //serialization - SqLib_writeclosure = NULL; - SqLib_readclosure = NULL; - - //mem allocation - SqLib_malloc = NULL; - SqLib_realloc = NULL; - SqLib_free = NULL; - - //debug - SqLib_stackinfos = NULL; - SqLib_setdebughook = NULL; - SqLib_setnativedebughook = NULL; - - //compiler helpers - SqLib_loadfile = NULL; - SqLib_dofile = NULL; - SqLib_writeclosuretofile = NULL; - - //blob - SqLib_createblob = NULL; - SqLib_getblob = NULL; - SqLib_getblobsize = NULL; - - //string - SqLib_format = NULL; - -#endif // SQMOD_PLUGIN_API -} diff --git a/sdk/include/SqAPI.h b/sdk/include/SqAPI.h deleted file mode 100644 index 08838552..00000000 --- a/sdk/include/SqAPI.h +++ /dev/null @@ -1,795 +0,0 @@ -// -// SqModule: API used to communicate with and register squirrel modules -// - -// -// Copyright (c) 2016 Sandu Liviu Catalin (aka. S.L.C) -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// - -#if !defined(_SQ_API_H_) -#define _SQ_API_H_ - -#include "squirrel.h" - -#ifdef __cplusplus -extern "C" { -#endif - - //vm - typedef HSQUIRRELVM (*SqLibAPI_open)(SQInteger initialstacksize); - typedef HSQUIRRELVM (*SqLibAPI_newthread)(HSQUIRRELVM friendvm, SQInteger initialstacksize); - typedef void (*SqLibAPI_seterrorhandler)(HSQUIRRELVM v); - typedef void (*SqLibAPI_close)(HSQUIRRELVM v); - typedef void (*SqLibAPI_setforeignptr)(HSQUIRRELVM v,SQUserPointer p); - typedef SQUserPointer (*SqLibAPI_getforeignptr)(HSQUIRRELVM v); - typedef void (*SqLibAPI_setsharedforeignptr)(HSQUIRRELVM v,SQUserPointer p); - typedef SQUserPointer (*SqLibAPI_getsharedforeignptr)(HSQUIRRELVM v); - typedef void (*SqLibAPI_setvmreleasehook)(HSQUIRRELVM v,SQRELEASEHOOK hook); - typedef SQRELEASEHOOK (*SqLibAPI_getvmreleasehook)(HSQUIRRELVM v); - typedef void (*SqLibAPI_setsharedreleasehook)(HSQUIRRELVM v,SQRELEASEHOOK hook); - typedef SQRELEASEHOOK (*SqLibAPI_getsharedreleasehook)(HSQUIRRELVM v); - typedef void (*SqLibAPI_setprintfunc)(HSQUIRRELVM v, SQPRINTFUNCTION printfunc,SQPRINTFUNCTION errfunc); - typedef SQPRINTFUNCTION (*SqLibAPI_getprintfunc)(HSQUIRRELVM v); - typedef SQPRINTFUNCTION (*SqLibAPI_geterrorfunc)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_suspendvm)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_wakeupvm)(HSQUIRRELVM v,SQBool resumedret,SQBool retval,SQBool raiseerror,SQBool throwerror); - typedef SQInteger (*SqLibAPI_getvmstate)(HSQUIRRELVM v); - typedef SQInteger (*SqLibAPI_getversion)(); - - //compiler - typedef SQRESULT (*SqLibAPI_compile)(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQChar *sourcename,SQBool raiseerror); - typedef SQRESULT (*SqLibAPI_compilebuffer)(HSQUIRRELVM v,const SQChar *s,SQInteger size,const SQChar *sourcename,SQBool raiseerror); - typedef void (*SqLibAPI_enabledebuginfo)(HSQUIRRELVM v, SQBool enable); - typedef void (*SqLibAPI_notifyallexceptions)(HSQUIRRELVM v, SQBool enable); - typedef void (*SqLibAPI_setcompilererrorhandler)(HSQUIRRELVM v,SQCOMPILERERROR f); - - //stack operations - typedef void (*SqLibAPI_push)(HSQUIRRELVM v,SQInteger idx); - typedef void (*SqLibAPI_pop)(HSQUIRRELVM v,SQInteger nelemstopop); - typedef void (*SqLibAPI_poptop)(HSQUIRRELVM v); - typedef void (*SqLibAPI_remove)(HSQUIRRELVM v,SQInteger idx); - typedef SQInteger (*SqLibAPI_gettop)(HSQUIRRELVM v); - typedef void (*SqLibAPI_settop)(HSQUIRRELVM v,SQInteger newtop); - typedef SQRESULT (*SqLibAPI_reservestack)(HSQUIRRELVM v,SQInteger nsize); - typedef SQInteger (*SqLibAPI_cmp)(HSQUIRRELVM v); - typedef void (*SqLibAPI_move)(HSQUIRRELVM dest,HSQUIRRELVM src,SQInteger idx); - - //object creation handling - typedef SQUserPointer (*SqLibAPI_newuserdata)(HSQUIRRELVM v,SQUnsignedInteger size); - typedef void (*SqLibAPI_newtable)(HSQUIRRELVM v); - typedef void (*SqLibAPI_newtableex)(HSQUIRRELVM v,SQInteger initialcapacity); - typedef void (*SqLibAPI_newarray)(HSQUIRRELVM v,SQInteger size); - typedef void (*SqLibAPI_newclosure)(HSQUIRRELVM v,SQFUNCTION func,SQUnsignedInteger nfreevars); - typedef SQRESULT (*SqLibAPI_setparamscheck)(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask); - typedef SQRESULT (*SqLibAPI_bindenv)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_setclosureroot)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_getclosureroot)(HSQUIRRELVM v,SQInteger idx); - typedef void (*SqLibAPI_pushstring)(HSQUIRRELVM v,const SQChar *s,SQInteger len); - typedef void (*SqLibAPI_pushstringf)(HSQUIRRELVM v,const SQChar *s,...); - typedef void (*SqLibAPI_pushfloat)(HSQUIRRELVM v,SQFloat f); - typedef void (*SqLibAPI_pushinteger)(HSQUIRRELVM v,SQInteger n); - typedef void (*SqLibAPI_pushbool)(HSQUIRRELVM v,SQBool b); - typedef void (*SqLibAPI_pushuserpointer)(HSQUIRRELVM v,SQUserPointer p); - typedef void (*SqLibAPI_pushnull)(HSQUIRRELVM v); - typedef void (*SqLibAPI_pushthread)(HSQUIRRELVM v, HSQUIRRELVM thread); - typedef SQObjectType (*SqLibAPI_gettype)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_typeof)(HSQUIRRELVM v,SQInteger idx); - typedef SQInteger (*SqLibAPI_getsize)(HSQUIRRELVM v,SQInteger idx); - typedef SQHash (*SqLibAPI_gethash)(HSQUIRRELVM v, SQInteger idx); - typedef SQRESULT (*SqLibAPI_getbase)(HSQUIRRELVM v,SQInteger idx); - typedef SQBool (*SqLibAPI_instanceof)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_tostring)(HSQUIRRELVM v,SQInteger idx); - typedef void (*SqLibAPI_tobool)(HSQUIRRELVM v, SQInteger idx, SQBool *b); - typedef SQRESULT (*SqLibAPI_getstringandsize)(HSQUIRRELVM v,SQInteger idx,const SQChar **c,SQInteger *size); - typedef SQRESULT (*SqLibAPI_getstring)(HSQUIRRELVM v,SQInteger idx,const SQChar **c); - typedef SQRESULT (*SqLibAPI_getinteger)(HSQUIRRELVM v,SQInteger idx,SQInteger *i); - typedef SQRESULT (*SqLibAPI_getfloat)(HSQUIRRELVM v,SQInteger idx,SQFloat *f); - typedef SQRESULT (*SqLibAPI_getbool)(HSQUIRRELVM v,SQInteger idx,SQBool *b); - typedef SQRESULT (*SqLibAPI_getthread)(HSQUIRRELVM v,SQInteger idx,HSQUIRRELVM *thread); - typedef SQRESULT (*SqLibAPI_getuserpointer)(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p); - typedef SQRESULT (*SqLibAPI_getuserdata)(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p,SQUserPointer *typetag); - typedef SQRESULT (*SqLibAPI_settypetag)(HSQUIRRELVM v,SQInteger idx,SQUserPointer typetag); - typedef SQRESULT (*SqLibAPI_gettypetag)(HSQUIRRELVM v,SQInteger idx,SQUserPointer *typetag); - typedef void (*SqLibAPI_setreleasehook)(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook); - typedef SQRELEASEHOOK (*SqLibAPI_getreleasehook)(HSQUIRRELVM v,SQInteger idx); - typedef SQChar* (*SqLibAPI_getscratchpad)(HSQUIRRELVM v,SQInteger minsize); - typedef SQRESULT (*SqLibAPI_getfunctioninfo)(HSQUIRRELVM v,SQInteger level,SQFunctionInfo *fi); - typedef SQRESULT (*SqLibAPI_getclosureinfo)(HSQUIRRELVM v,SQInteger idx,SQInteger *nparams,SQInteger *nfreevars); - typedef SQRESULT (*SqLibAPI_getclosurename)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_setnativeclosurename)(HSQUIRRELVM v,SQInteger idx,const SQChar *name); - typedef SQRESULT (*SqLibAPI_getnativeclosurepointer)(HSQUIRRELVM v,SQInteger idx,SQFUNCTION *f); - typedef SQRESULT (*SqLibAPI_setinstanceup)(HSQUIRRELVM v, SQInteger idx, SQUserPointer p); - typedef SQRESULT (*SqLibAPI_getinstanceup)(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag); - typedef SQRESULT (*SqLibAPI_setclassudsize)(HSQUIRRELVM v, SQInteger idx, SQInteger udsize); - typedef SQRESULT (*SqLibAPI_newclass)(HSQUIRRELVM v,SQBool hasbase); - typedef SQRESULT (*SqLibAPI_createinstance)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_setattributes)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_getattributes)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_getclass)(HSQUIRRELVM v,SQInteger idx); - typedef void (*SqLibAPI_weakref)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_getdefaultdelegate)(HSQUIRRELVM v,SQObjectType t); - typedef SQRESULT (*SqLibAPI_getmemberhandle)(HSQUIRRELVM v,SQInteger idx,HSQMEMBERHANDLE *handle); - typedef SQRESULT (*SqLibAPI_getbyhandle)(HSQUIRRELVM v,SQInteger idx,const HSQMEMBERHANDLE *handle); - typedef SQRESULT (*SqLibAPI_setbyhandle)(HSQUIRRELVM v,SQInteger idx,const HSQMEMBERHANDLE *handle); - - //object manipulation - typedef void (*SqLibAPI_pushroottable)(HSQUIRRELVM v); - typedef void (*SqLibAPI_pushregistrytable)(HSQUIRRELVM v); - typedef void (*SqLibAPI_pushconsttable)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_setroottable)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_setconsttable)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_newslot)(HSQUIRRELVM v, SQInteger idx, SQBool bstatic); - typedef SQRESULT (*SqLibAPI_deleteslot)(HSQUIRRELVM v,SQInteger idx,SQBool pushval); - typedef SQRESULT (*SqLibAPI_set)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_get)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_rawget)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_rawset)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_rawdeleteslot)(HSQUIRRELVM v,SQInteger idx,SQBool pushval); - typedef SQRESULT (*SqLibAPI_newmember)(HSQUIRRELVM v,SQInteger idx,SQBool bstatic); - typedef SQRESULT (*SqLibAPI_rawnewmember)(HSQUIRRELVM v,SQInteger idx,SQBool bstatic); - typedef SQRESULT (*SqLibAPI_arrayappend)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_arraypop)(HSQUIRRELVM v,SQInteger idx,SQBool pushval); - typedef SQRESULT (*SqLibAPI_arrayresize)(HSQUIRRELVM v,SQInteger idx,SQInteger newsize); - typedef SQRESULT (*SqLibAPI_arrayreverse)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_arrayremove)(HSQUIRRELVM v,SQInteger idx,SQInteger itemidx); - typedef SQRESULT (*SqLibAPI_arrayinsert)(HSQUIRRELVM v,SQInteger idx,SQInteger destpos); - typedef SQRESULT (*SqLibAPI_setdelegate)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_getdelegate)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_clone)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_setfreevariable)(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval); - typedef SQRESULT (*SqLibAPI_next)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_getweakrefval)(HSQUIRRELVM v,SQInteger idx); - typedef SQRESULT (*SqLibAPI_clear)(HSQUIRRELVM v,SQInteger idx); - - //calls - typedef SQRESULT (*SqLibAPI_call)(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror); - typedef SQRESULT (*SqLibAPI_resume)(HSQUIRRELVM v,SQBool retval,SQBool raiseerror); - typedef const SQChar* (*SqLibAPI_getlocal)(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedInteger idx); - typedef SQRESULT (*SqLibAPI_getcallee)(HSQUIRRELVM v); - typedef const SQChar* (*SqLibAPI_getfreevariable)(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval); - typedef const SQChar* (*SqLibAPI_getonefreevariable)(HSQUIRRELVM v,SQUnsignedInteger nval); - typedef SQRESULT (*SqLibAPI_throwerror)(HSQUIRRELVM v,const SQChar *err); - typedef SQRESULT (*SqLibAPI_throwerrorf)(HSQUIRRELVM v,const SQChar *err,...); - typedef SQRESULT (*SqLibAPI_throwobject)(HSQUIRRELVM v); - typedef void (*SqLibAPI_reseterror)(HSQUIRRELVM v); - typedef void (*SqLibAPI_getlasterror)(HSQUIRRELVM v); - - //raw object handling - typedef SQRESULT (*SqLibAPI_getstackobj)(HSQUIRRELVM v,SQInteger idx,HSQOBJECT *po); - typedef void (*SqLibAPI_pushobject)(HSQUIRRELVM v,HSQOBJECT obj); - typedef void (*SqLibAPI_addref)(HSQUIRRELVM v,HSQOBJECT *po); - typedef SQBool (*SqLibAPI_release)(HSQUIRRELVM v,HSQOBJECT *po); - typedef SQUnsignedInteger (*SqLibAPI_getrefcount)(HSQUIRRELVM v,HSQOBJECT *po); - typedef void (*SqLibAPI_resetobject)(HSQOBJECT *po); - typedef const SQChar* (*SqLibAPI_objtostring)(const HSQOBJECT *o); - typedef SQBool (*SqLibAPI_objtobool)(const HSQOBJECT *o); - typedef SQInteger (*SqLibAPI_objtointeger)(const HSQOBJECT *o); - typedef SQFloat (*SqLibAPI_objtofloat)(const HSQOBJECT *o); - typedef SQUserPointer (*SqLibAPI_objtouserpointer)(const HSQOBJECT *o); - typedef SQRESULT (*SqLibAPI_getobjtypetag)(const HSQOBJECT *o,SQUserPointer * typetag); - typedef SQUnsignedInteger (*SqLibAPI_getvmrefcount)(HSQUIRRELVM v, const HSQOBJECT *po); - - - //GC - typedef SQInteger (*SqLibAPI_collectgarbage)(HSQUIRRELVM v); - typedef SQRESULT (*SqLibAPI_resurrectunreachable)(HSQUIRRELVM v); - - //serialization - typedef SQRESULT (*SqLibAPI_writeclosure)(HSQUIRRELVM vm,SQWRITEFUNC writef,SQUserPointer up); - typedef SQRESULT (*SqLibAPI_readclosure)(HSQUIRRELVM vm,SQREADFUNC readf,SQUserPointer up); - - //mem allocation - typedef void* (*SqLibAPI_malloc)(SQUnsignedInteger size); - typedef void* (*SqLibAPI_realloc)(void* p,SQUnsignedInteger oldsize,SQUnsignedInteger newsize); - typedef void (*SqLibAPI_free)(void *p,SQUnsignedInteger size); - - //debug - typedef SQRESULT (*SqLibAPI_stackinfos)(HSQUIRRELVM v,SQInteger level,SQStackInfos *si); - typedef void (*SqLibAPI_setdebughook)(HSQUIRRELVM v); - typedef void (*SqLibAPI_setnativedebughook)(HSQUIRRELVM v,SQDEBUGHOOK hook); - - //compiler helpers - typedef SQRESULT (*SqLibAPI_loadfile)(HSQUIRRELVM v,const SQChar *filename,SQBool printerror); - typedef SQRESULT (*SqLibAPI_dofile)(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror); - typedef SQRESULT (*SqLibAPI_writeclosuretofile)(HSQUIRRELVM v,const SQChar *filename); - - //blob - typedef SQUserPointer (*SqLibAPI_createblob)(HSQUIRRELVM v, SQInteger size); - typedef SQRESULT (*SqLibAPI_getblob)(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr); - typedef SQInteger (*SqLibAPI_getblobsize)(HSQUIRRELVM v,SQInteger idx); - - //string - typedef SQRESULT (*SqLibAPI_format)(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen,SQChar **output); - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// @cond DEV - /// Allows modules to interface with Squirrel's C api without linking to the squirrel library. - /// If new functions are added to the Squirrel API, they should be added here too. - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - typedef struct - { - //vm - SqLibAPI_open open; - SqLibAPI_newthread newthread; - SqLibAPI_seterrorhandler seterrorhandler; - SqLibAPI_close close; - SqLibAPI_setforeignptr setforeignptr; - SqLibAPI_getforeignptr getforeignptr; - SqLibAPI_setsharedforeignptr setsharedforeignptr; - SqLibAPI_getsharedforeignptr getsharedforeignptr; - SqLibAPI_setvmreleasehook setvmreleasehook; - SqLibAPI_getvmreleasehook getvmreleasehook; - SqLibAPI_setsharedreleasehook setsharedreleasehook; - SqLibAPI_getsharedreleasehook getsharedreleasehook; - SqLibAPI_setprintfunc setprintfunc; - SqLibAPI_getprintfunc getprintfunc; - SqLibAPI_geterrorfunc geterrorfunc; - SqLibAPI_suspendvm suspendvm; - SqLibAPI_wakeupvm wakeupvm; - SqLibAPI_getvmstate getvmstate; - SqLibAPI_getversion getversion; - - //compiler - SqLibAPI_compile compile; - SqLibAPI_compilebuffer compilebuffer; - SqLibAPI_enabledebuginfo enabledebuginfo; - SqLibAPI_notifyallexceptions notifyallexceptions; - SqLibAPI_setcompilererrorhandler setcompilererrorhandler; - - //stack operations - SqLibAPI_push push; - SqLibAPI_pop pop; - SqLibAPI_poptop poptop; - SqLibAPI_remove remove; - SqLibAPI_gettop gettop; - SqLibAPI_settop settop; - SqLibAPI_reservestack reservestack; - SqLibAPI_cmp cmp; - SqLibAPI_move move; - - //object creation handling - SqLibAPI_newuserdata newuserdata; - SqLibAPI_newtable newtable; - SqLibAPI_newtableex newtableex; - SqLibAPI_newarray newarray; - SqLibAPI_newclosure newclosure; - SqLibAPI_setparamscheck setparamscheck; - SqLibAPI_bindenv bindenv; - SqLibAPI_setclosureroot setclosureroot; - SqLibAPI_getclosureroot getclosureroot; - SqLibAPI_pushstring pushstring; - SqLibAPI_pushstringf pushstringf; - SqLibAPI_pushfloat pushfloat; - SqLibAPI_pushinteger pushinteger; - SqLibAPI_pushbool pushbool; - SqLibAPI_pushuserpointer pushuserpointer; - SqLibAPI_pushnull pushnull; - SqLibAPI_pushthread pushthread; - SqLibAPI_gettype gettype; - SqLibAPI_typeof typeof_; - SqLibAPI_getsize getsize; - SqLibAPI_gethash gethash; - SqLibAPI_getbase getbase; - SqLibAPI_instanceof instanceof; - SqLibAPI_tostring tostring; - SqLibAPI_tobool tobool; - SqLibAPI_getstringandsize getstringandsize; - SqLibAPI_getstring getstring; - SqLibAPI_getinteger getinteger; - SqLibAPI_getfloat getfloat; - SqLibAPI_getbool getbool; - SqLibAPI_getthread getthread; - SqLibAPI_getuserpointer getuserpointer; - SqLibAPI_getuserdata getuserdata; - SqLibAPI_settypetag settypetag; - SqLibAPI_gettypetag gettypetag; - SqLibAPI_setreleasehook setreleasehook; - SqLibAPI_getreleasehook getreleasehook; - SqLibAPI_getscratchpad getscratchpad; - SqLibAPI_getfunctioninfo getfunctioninfo; - SqLibAPI_getclosureinfo getclosureinfo; - SqLibAPI_getclosurename getclosurename; - SqLibAPI_setnativeclosurename setnativeclosurename; - SqLibAPI_getnativeclosurepointer getnativeclosurepointer; - SqLibAPI_setinstanceup setinstanceup; - SqLibAPI_getinstanceup getinstanceup; - SqLibAPI_setclassudsize setclassudsize; - SqLibAPI_newclass newclass; - SqLibAPI_createinstance createinstance; - SqLibAPI_setattributes setattributes; - SqLibAPI_getattributes getattributes; - SqLibAPI_getclass getclass; - SqLibAPI_weakref weakref; - SqLibAPI_getdefaultdelegate getdefaultdelegate; - SqLibAPI_getmemberhandle getmemberhandle; - SqLibAPI_getbyhandle getbyhandle; - SqLibAPI_setbyhandle setbyhandle; - - //object manipulation - SqLibAPI_pushroottable pushroottable; - SqLibAPI_pushregistrytable pushregistrytable; - SqLibAPI_pushconsttable pushconsttable; - SqLibAPI_setroottable setroottable; - SqLibAPI_setconsttable setconsttable; - SqLibAPI_newslot newslot; - SqLibAPI_deleteslot deleteslot; - SqLibAPI_set set; - SqLibAPI_get get; - SqLibAPI_rawget rawget; - SqLibAPI_rawset rawset; - SqLibAPI_rawdeleteslot rawdeleteslot; - SqLibAPI_newmember newmember; - SqLibAPI_rawnewmember rawnewmember; - SqLibAPI_arrayappend arrayappend; - SqLibAPI_arraypop arraypop; - SqLibAPI_arrayresize arrayresize; - SqLibAPI_arrayreverse arrayreverse; - SqLibAPI_arrayremove arrayremove; - SqLibAPI_arrayinsert arrayinsert; - SqLibAPI_setdelegate setdelegate; - SqLibAPI_getdelegate getdelegate; - SqLibAPI_clone clone; - SqLibAPI_setfreevariable setfreevariable; - SqLibAPI_next next; - SqLibAPI_getweakrefval getweakrefval; - SqLibAPI_clear clear; - - //calls - SqLibAPI_call call; - SqLibAPI_resume resume; - SqLibAPI_getlocal getlocal; - SqLibAPI_getcallee getcallee; - SqLibAPI_getfreevariable getfreevariable; - SqLibAPI_getonefreevariable getonefreevariable; - SqLibAPI_throwerror throwerror; - SqLibAPI_throwerrorf throwerrorf; - SqLibAPI_throwobject throwobject; - SqLibAPI_reseterror reseterror; - SqLibAPI_getlasterror getlasterror; - - //raw object handling - SqLibAPI_getstackobj getstackobj; - SqLibAPI_pushobject pushobject; - SqLibAPI_addref addref; - SqLibAPI_release release; - SqLibAPI_getrefcount getrefcount; - SqLibAPI_resetobject resetobject; - SqLibAPI_objtostring objtostring; - SqLibAPI_objtobool objtobool; - SqLibAPI_objtointeger objtointeger; - SqLibAPI_objtofloat objtofloat; - SqLibAPI_objtouserpointer objtouserpointer; - SqLibAPI_getobjtypetag getobjtypetag; - SqLibAPI_getvmrefcount getvmrefcount; - - //GC - SqLibAPI_collectgarbage collectgarbage; - SqLibAPI_resurrectunreachable resurrectunreachable; - - //serialization - SqLibAPI_writeclosure writeclosure; - SqLibAPI_readclosure readclosure; - - //mem allocation - SqLibAPI_malloc malloc; - SqLibAPI_realloc realloc; - SqLibAPI_free free; - - //debug - SqLibAPI_stackinfos stackinfos; - SqLibAPI_setdebughook setdebughook; - SqLibAPI_setnativedebughook setnativedebughook; - - //compiler helpers - SqLibAPI_loadfile loadfile; - SqLibAPI_dofile dofile; - SqLibAPI_writeclosuretofile writeclosuretofile; - - //blob - SqLibAPI_createblob createblob; - SqLibAPI_getblob getblob; - SqLibAPI_getblobsize getblobsize; - - //string - SqLibAPI_format format; - } sqlib_api, SQLIBAPI, *HSQLIBAPI; - /// @endcond - -#ifdef SQMOD_PLUGIN_API - - //vm - extern SqLibAPI_open SqLib_open; - extern SqLibAPI_newthread SqLib_newthread; - extern SqLibAPI_seterrorhandler SqLib_seterrorhandler; - extern SqLibAPI_close SqLib_close; - extern SqLibAPI_setforeignptr SqLib_setforeignptr; - extern SqLibAPI_getforeignptr SqLib_getforeignptr; - extern SqLibAPI_setsharedforeignptr SqLib_setsharedforeignptr; - extern SqLibAPI_getsharedforeignptr SqLib_getsharedforeignptr; - extern SqLibAPI_setvmreleasehook SqLib_setvmreleasehook; - extern SqLibAPI_getvmreleasehook SqLib_getvmreleasehook; - extern SqLibAPI_setsharedreleasehook SqLib_setsharedreleasehook; - extern SqLibAPI_getsharedreleasehook SqLib_getsharedreleasehook; - extern SqLibAPI_setprintfunc SqLib_setprintfunc; - extern SqLibAPI_getprintfunc SqLib_getprintfunc; - extern SqLibAPI_geterrorfunc SqLib_geterrorfunc; - extern SqLibAPI_suspendvm SqLib_suspendvm; - extern SqLibAPI_wakeupvm SqLib_wakeupvm; - extern SqLibAPI_getvmstate SqLib_getvmstate; - extern SqLibAPI_getversion SqLib_getversion; - - //compiler - extern SqLibAPI_compile SqLib_compile; - extern SqLibAPI_compilebuffer SqLib_compilebuffer; - extern SqLibAPI_enabledebuginfo SqLib_enabledebuginfo; - extern SqLibAPI_notifyallexceptions SqLib_notifyallexceptions; - extern SqLibAPI_setcompilererrorhandler SqLib_setcompilererrorhandler; - - //stack operations - extern SqLibAPI_push SqLib_push; - extern SqLibAPI_pop SqLib_pop; - extern SqLibAPI_poptop SqLib_poptop; - extern SqLibAPI_remove SqLib_remove; - extern SqLibAPI_gettop SqLib_gettop; - extern SqLibAPI_settop SqLib_settop; - extern SqLibAPI_reservestack SqLib_reservestack; - extern SqLibAPI_cmp SqLib_cmp; - extern SqLibAPI_move SqLib_move; - - //object creation handling - extern SqLibAPI_newuserdata SqLib_newuserdata; - extern SqLibAPI_newtable SqLib_newtable; - extern SqLibAPI_newtableex SqLib_newtableex; - extern SqLibAPI_newarray SqLib_newarray; - extern SqLibAPI_newclosure SqLib_newclosure; - extern SqLibAPI_setparamscheck SqLib_setparamscheck; - extern SqLibAPI_bindenv SqLib_bindenv; - extern SqLibAPI_setclosureroot SqLib_setclosureroot; - extern SqLibAPI_getclosureroot SqLib_getclosureroot; - extern SqLibAPI_pushstring SqLib_pushstring; - extern SqLibAPI_pushstringf SqLib_pushstringf; - extern SqLibAPI_pushfloat SqLib_pushfloat; - extern SqLibAPI_pushinteger SqLib_pushinteger; - extern SqLibAPI_pushbool SqLib_pushbool; - extern SqLibAPI_pushuserpointer SqLib_pushuserpointer; - extern SqLibAPI_pushnull SqLib_pushnull; - extern SqLibAPI_pushthread SqLib_pushthread; - extern SqLibAPI_gettype SqLib_gettype; - extern SqLibAPI_typeof SqLib_typeof; - extern SqLibAPI_getsize SqLib_getsize; - extern SqLibAPI_gethash SqLib_gethash; - extern SqLibAPI_getbase SqLib_getbase; - extern SqLibAPI_instanceof SqLib_instanceof; - extern SqLibAPI_tostring SqLib_tostring; - extern SqLibAPI_tobool SqLib_tobool; - extern SqLibAPI_getstringandsize SqLib_getstringandsize; - extern SqLibAPI_getstring SqLib_getstring; - extern SqLibAPI_getinteger SqLib_getinteger; - extern SqLibAPI_getfloat SqLib_getfloat; - extern SqLibAPI_getbool SqLib_getbool; - extern SqLibAPI_getthread SqLib_getthread; - extern SqLibAPI_getuserpointer SqLib_getuserpointer; - extern SqLibAPI_getuserdata SqLib_getuserdata; - extern SqLibAPI_settypetag SqLib_settypetag; - extern SqLibAPI_gettypetag SqLib_gettypetag; - extern SqLibAPI_setreleasehook SqLib_setreleasehook; - extern SqLibAPI_getreleasehook SqLib_getreleasehook; - extern SqLibAPI_getscratchpad SqLib_getscratchpad; - extern SqLibAPI_getfunctioninfo SqLib_getfunctioninfo; - extern SqLibAPI_getclosureinfo SqLib_getclosureinfo; - extern SqLibAPI_getclosurename SqLib_getclosurename; - extern SqLibAPI_setnativeclosurename SqLib_setnativeclosurename; - extern SqLibAPI_getnativeclosurepointer SqLib_getnativeclosurepointer; - extern SqLibAPI_setinstanceup SqLib_setinstanceup; - extern SqLibAPI_getinstanceup SqLib_getinstanceup; - extern SqLibAPI_setclassudsize SqLib_setclassudsize; - extern SqLibAPI_newclass SqLib_newclass; - extern SqLibAPI_createinstance SqLib_createinstance; - extern SqLibAPI_setattributes SqLib_setattributes; - extern SqLibAPI_getattributes SqLib_getattributes; - extern SqLibAPI_getclass SqLib_getclass; - extern SqLibAPI_weakref SqLib_weakref; - extern SqLibAPI_getdefaultdelegate SqLib_getdefaultdelegate; - extern SqLibAPI_getmemberhandle SqLib_getmemberhandle; - extern SqLibAPI_getbyhandle SqLib_getbyhandle; - extern SqLibAPI_setbyhandle SqLib_setbyhandle; - - //object manipulation - extern SqLibAPI_pushroottable SqLib_pushroottable; - extern SqLibAPI_pushregistrytable SqLib_pushregistrytable; - extern SqLibAPI_pushconsttable SqLib_pushconsttable; - extern SqLibAPI_setroottable SqLib_setroottable; - extern SqLibAPI_setconsttable SqLib_setconsttable; - extern SqLibAPI_newslot SqLib_newslot; - extern SqLibAPI_deleteslot SqLib_deleteslot; - extern SqLibAPI_set SqLib_set; - extern SqLibAPI_get SqLib_get; - extern SqLibAPI_rawget SqLib_rawget; - extern SqLibAPI_rawset SqLib_rawset; - extern SqLibAPI_rawdeleteslot SqLib_rawdeleteslot; - extern SqLibAPI_newmember SqLib_newmember; - extern SqLibAPI_rawnewmember SqLib_rawnewmember; - extern SqLibAPI_arrayappend SqLib_arrayappend; - extern SqLibAPI_arraypop SqLib_arraypop; - extern SqLibAPI_arrayresize SqLib_arrayresize; - extern SqLibAPI_arrayreverse SqLib_arrayreverse; - extern SqLibAPI_arrayremove SqLib_arrayremove; - extern SqLibAPI_arrayinsert SqLib_arrayinsert; - extern SqLibAPI_setdelegate SqLib_setdelegate; - extern SqLibAPI_getdelegate SqLib_getdelegate; - extern SqLibAPI_clone SqLib_clone; - extern SqLibAPI_setfreevariable SqLib_setfreevariable; - extern SqLibAPI_next SqLib_next; - extern SqLibAPI_getweakrefval SqLib_getweakrefval; - extern SqLibAPI_clear SqLib_clear; - - //calls - extern SqLibAPI_call SqLib_call; - extern SqLibAPI_resume SqLib_resume; - extern SqLibAPI_getlocal SqLib_getlocal; - extern SqLibAPI_getcallee SqLib_getcallee; - extern SqLibAPI_getfreevariable SqLib_getfreevariable; - extern SqLibAPI_getonefreevariable SqLib_getonefreevariable; - extern SqLibAPI_throwerror SqLib_throwerror; - extern SqLibAPI_throwerrorf SqLib_throwerrorf; - extern SqLibAPI_throwobject SqLib_throwobject; - extern SqLibAPI_reseterror SqLib_reseterror; - extern SqLibAPI_getlasterror SqLib_getlasterror; - - //raw object handling - extern SqLibAPI_getstackobj SqLib_getstackobj; - extern SqLibAPI_pushobject SqLib_pushobject; - extern SqLibAPI_addref SqLib_addref; - extern SqLibAPI_release SqLib_release; - extern SqLibAPI_getrefcount SqLib_getrefcount; - extern SqLibAPI_resetobject SqLib_resetobject; - extern SqLibAPI_objtostring SqLib_objtostring; - extern SqLibAPI_objtobool SqLib_objtobool; - extern SqLibAPI_objtointeger SqLib_objtointeger; - extern SqLibAPI_objtofloat SqLib_objtofloat; - extern SqLibAPI_objtouserpointer SqLib_objtouserpointer; - extern SqLibAPI_getobjtypetag SqLib_getobjtypetag; - extern SqLibAPI_getvmrefcount SqLib_getvmrefcount; - - //GC - extern SqLibAPI_collectgarbage SqLib_collectgarbage; - extern SqLibAPI_resurrectunreachable SqLib_resurrectunreachable; - - //serialization - extern SqLibAPI_writeclosure SqLib_writeclosure; - extern SqLibAPI_readclosure SqLib_readclosure; - - //mem allocation - extern SqLibAPI_malloc SqLib_malloc; - extern SqLibAPI_realloc SqLib_realloc; - extern SqLibAPI_free SqLib_free; - - //debug - extern SqLibAPI_stackinfos SqLib_stackinfos; - extern SqLibAPI_setdebughook SqLib_setdebughook; - extern SqLibAPI_setnativedebughook SqLib_setnativedebughook; - - //compiler helpers - extern SqLibAPI_loadfile SqLib_loadfile; - extern SqLibAPI_dofile SqLib_dofile; - extern SqLibAPI_writeclosuretofile SqLib_writeclosuretofile; - - //blob - extern SqLibAPI_createblob SqLib_createblob; - extern SqLibAPI_getblob SqLib_getblob; - extern SqLibAPI_getblobsize SqLib_getblobsize; - - //string - extern SqLibAPI_format SqLib_format; - - //vm - #define sq_open SqLib_open - #define sq_newthread SqLib_newthread - #define sq_seterrorhandler SqLib_seterrorhandler - #define sq_close SqLib_close - #define sq_setforeignptr SqLib_setforeignptr - #define sq_getforeignptr SqLib_getforeignptr - #define sq_setsharedforeignptr SqLib_setsharedforeignptr - #define sq_getsharedforeignptr SqLib_getsharedforeignptr - #define sq_setvmreleasehook SqLib_setvmreleasehook - #define sq_getvmreleasehook SqLib_getvmreleasehook - #define sq_setsharedreleasehook SqLib_setsharedreleasehook - #define sq_getsharedreleasehook SqLib_getsharedreleasehook - #define sq_setprintfunc SqLib_setprintfunc - #define sq_getprintfunc SqLib_getprintfunc - #define sq_geterrorfunc SqLib_geterrorfunc - #define sq_suspendvm SqLib_suspendvm - #define sq_wakeupvm SqLib_wakeupvm - #define sq_getvmstate SqLib_getvmstate - #define sq_getversion SqLib_getversion - - //compiler - #define sq_compile SqLib_compile - #define sq_compilebuffer SqLib_compilebuffer - #define sq_enabledebuginfo SqLib_enabledebuginfo - #define sq_notifyallexceptions SqLib_notifyallexceptions - #define sq_setcompilererrorhandler SqLib_setcompilererrorhandler - - //stack operations - #define sq_push SqLib_push - #define sq_pop SqLib_pop - #define sq_poptop SqLib_poptop - #define sq_remove SqLib_remove - #define sq_gettop SqLib_gettop - #define sq_settop SqLib_settop - #define sq_reservestack SqLib_reservestack - #define sq_cmp SqLib_cmp - #define sq_move SqLib_move - - //object creation handling - #define sq_newuserdata SqLib_newuserdata - #define sq_newtable SqLib_newtable - #define sq_newtableex SqLib_newtableex - #define sq_newarray SqLib_newarray - #define sq_newclosure SqLib_newclosure - #define sq_setparamscheck SqLib_setparamscheck - #define sq_bindenv SqLib_bindenv - #define sq_setclosureroot SqLib_setclosureroot - #define sq_getclosureroot SqLib_getclosureroot - #define sq_pushstring SqLib_pushstring - #define sq_pushstringf SqLib_pushstringf - #define sq_pushfloat SqLib_pushfloat - #define sq_pushinteger SqLib_pushinteger - #define sq_pushbool SqLib_pushbool - #define sq_pushuserpointer SqLib_pushuserpointer - #define sq_pushnull SqLib_pushnull - #define sq_pushthread SqLib_pushthread - #define sq_gettype SqLib_gettype - #define sq_typeof SqLib_typeof - #define sq_getsize SqLib_getsize - #define sq_gethash SqLib_gethash - #define sq_getbase SqLib_getbase - #define sq_instanceof SqLib_instanceof - #define sq_tostring SqLib_tostring - #define sq_tobool SqLib_tobool - #define sq_getstringandsize SqLib_getstringandsize - #define sq_getstring SqLib_getstring - #define sq_getinteger SqLib_getinteger - #define sq_getfloat SqLib_getfloat - #define sq_getbool SqLib_getbool - #define sq_getthread SqLib_getthread - #define sq_getuserpointer SqLib_getuserpointer - #define sq_getuserdata SqLib_getuserdata - #define sq_settypetag SqLib_settypetag - #define sq_gettypetag SqLib_gettypetag - #define sq_setreleasehook SqLib_setreleasehook - #define sq_getreleasehook SqLib_getreleasehook - #define sq_getscratchpad SqLib_getscratchpad - #define sq_getfunctioninfo SqLib_getfunctioninfo - #define sq_getclosureinfo SqLib_getclosureinfo - #define sq_getclosurename SqLib_getclosurename - #define sq_setnativeclosurename SqLib_setnativeclosurename - #define sq_getnativeclosurepointer SqLib_getnativeclosurepointer - #define sq_setinstanceup SqLib_setinstanceup - #define sq_getinstanceup SqLib_getinstanceup - #define sq_setclassudsize SqLib_setclassudsize - #define sq_newclass SqLib_newclass - #define sq_createinstance SqLib_createinstance - #define sq_setattributes SqLib_setattributes - #define sq_getattributes SqLib_getattributes - #define sq_getclass SqLib_getclass - #define sq_weakref SqLib_weakref - #define sq_getdefaultdelegate SqLib_getdefaultdelegate - #define sq_getmemberhandle SqLib_getmemberhandle - #define sq_getbyhandle SqLib_getbyhandle - #define sq_setbyhandle SqLib_setbyhandle - - //object manipulation - #define sq_pushroottable SqLib_pushroottable - #define sq_pushregistrytable SqLib_pushregistrytable - #define sq_pushconsttable SqLib_pushconsttable - #define sq_setroottable SqLib_setroottable - #define sq_setconsttable SqLib_setconsttable - #define sq_newslot SqLib_newslot - #define sq_deleteslot SqLib_deleteslot - #define sq_set SqLib_set - #define sq_get SqLib_get - #define sq_rawget SqLib_rawget - #define sq_rawset SqLib_rawset - #define sq_rawdeleteslot SqLib_rawdeleteslot - #define sq_newmember SqLib_newmember - #define sq_rawnewmember SqLib_rawnewmember - #define sq_arrayappend SqLib_arrayappend - #define sq_arraypop SqLib_arraypop - #define sq_arrayresize SqLib_arrayresize - #define sq_arrayreverse SqLib_arrayreverse - #define sq_arrayremove SqLib_arrayremove - #define sq_arrayinsert SqLib_arrayinsert - #define sq_setdelegate SqLib_setdelegate - #define sq_getdelegate SqLib_getdelegate - #define sq_clone SqLib_clone - #define sq_setfreevariable SqLib_setfreevariable - #define sq_next SqLib_next - #define sq_getweakrefval SqLib_getweakrefval - #define sq_clear SqLib_clear - - //calls - #define sq_call SqLib_call - #define sq_resume SqLib_resume - #define sq_getlocal SqLib_getlocal - #define sq_getcallee SqLib_getcallee - #define sq_getfreevariable SqLib_getfreevariable - #define sq_getonefreevariable SqLib_getonefreevariable - #define sq_throwerror SqLib_throwerror - #define sq_throwerrorf SqLib_throwerrorf - #define sq_throwobject SqLib_throwobject - #define sq_reseterror SqLib_reseterror - #define sq_getlasterror SqLib_getlasterror - - //raw object handling - #define sq_getstackobj SqLib_getstackobj - #define sq_pushobject SqLib_pushobject - #define sq_addref SqLib_addref - #define sq_release SqLib_release - #define sq_getrefcount SqLib_getrefcount - #define sq_resetobject SqLib_resetobject - #define sq_objtostring SqLib_objtostring - #define sq_objtobool SqLib_objtobool - #define sq_objtointeger SqLib_objtointeger - #define sq_objtofloat SqLib_objtofloat - #define sq_objtouserpointer SqLib_objtouserpointer - #define sq_getobjtypetag SqLib_getobjtypetag - #define sq_getvmrefcount SqLib_getvmrefcount - - //GC - #define sq_collectgarbage SqLib_collectgarbage - #define sq_resurrectunreachable SqLib_resurrectunreachable - - //serialization - #define sq_writeclosure SqLib_writeclosure - #define sq_readclosure SqLib_readclosure - - //mem allocation - #define sq_malloc SqLib_malloc - #define sq_realloc SqLib_realloc - #define sq_free SqLib_free - - //debug - #define sq_stackinfos SqLib_stackinfos - #define sq_setdebughook SqLib_setdebughook - #define sq_setnativedebughook SqLib_setnativedebughook - - //compiler helpers - #define sqstd_loadfile SqLib_loadfile - #define sqstd_dofile SqLib_dofile - #define sqstd_writeclosuretofile SqLib_writeclosuretofile - - //blob - #define sqstd_createblob SqLib_createblob - #define sqstd_getblob SqLib_getblob - #define sqstd_getblobsize SqLib_getblobsize - - //string - #define sqstd_format SqLib_format - -#endif // SQMOD_PLUGIN_API - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*_SQ_API_H_*/ diff --git a/sdk/include/SqConfSDK.h b/sdk/include/SqConfSDK.h deleted file mode 100644 index ffd62f89..00000000 --- a/sdk/include/SqConfSDK.h +++ /dev/null @@ -1,354 +0,0 @@ -#ifndef _SQMODBASE_HPP_ -#define _SQMODBASE_HPP_ - -// ------------------------------------------------------------------------------------------------ -#include - -// ------------------------------------------------------------------------------------------------ -#include -#include -#include - -/* ------------------------------------------------------------------------------------------------ - * ARCHITECTURE IDENTIFIERS -*/ - -#define SQMOD_ARCH_ID_UNKNOWN 0 -#define SQMOD_ARCH_ID_32_BIT 1 -#define SQMOD_ARCH_ID_64_BIT 2 - -/* ------------------------------------------------------------------------------------------------ - * PLATFORM IDENTIFIERS -*/ - -#define SQMOD_PLAT_ID_UNKNOWN 0 -#define SQMOD_PLAT_ID_WINDOWS 1 -#define SQMOD_PLAT_ID_LINUX 2 -#define SQMOD_PLAT_ID_MACOS 3 -#define SQMOD_PLAT_ID_UNIX 4 - -/* ------------------------------------------------------------------------------------------------ - * OS IDENTIFICATION -*/ - -#if defined(_WIN32) || defined(__WIN32__) || defined(_WIN) || defined(__WIN__) - // Windows x32 - #define SQMOD_OS_WINDOWS - #define SQMOD_OS_32 - #define SQMOD_OS_WINDOWS32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 1 -#elif defined(_WIN64) || defined(__WIN64__) - // Windows x64 - #define SQMOD_OS_WINDOWS - #define SQMOD_OS_64 - #define SQMOD_OS_WINDOWS64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 1 -#elif defined(linux) || defined(__linux) || defined(__linux__) - // Linux - #define SQMOD_OS_LINUX - #if __GNUC__ - #if __x86_64__ || __ppc64__ - #define SQMOD_OS_64 - #define SQMOD_OS_LINUX64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 2 - #else - #define SQMOD_OS_32 - #define SQMOD_OS_LINUX32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 2 - #endif - #endif -#elif defined(__APPLE__) || defined(__MACH__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) - // MacOS - #define SQMOD_OS_MACOS - #if __GNUC__ - #if __x86_64__ || __ppc64__ - #define SQMOD_OS_64 - #define SQMOD_OS_MACOS64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 3 - #else - #define SQMOD_OS_32 - #define SQMOD_OS_MACOS32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 3 - #endif - #endif -#elif defined(__unix) || defined(__unix__) - // Unix - #define SQMOD_OS_UNIX - #if __GNUC__ - #if __x86_64__ || __ppc64__ - #define SQMOD_OS_64 - #define SQMOD_OS_UNIX64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 4 - #else - #define SQMOD_OS_32 - #define SQMOD_OS_UNIX32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 4 - #endif - #endif -#else - // Unsupported system - #error This operating system is not supported by the Squirrel Module -#endif - -#ifndef SQMOD_ARCHITECTURE - #define SQMOD_ARCHITECTURE 0 -#endif - -#ifndef SQMOD_PLATFORM - #define SQMOD_PLATFORM 0 -#endif - -/* ------------------------------------------------------------------------------------------------ - * SQUIRREL FORWARD DECLARATIONS -*/ - -extern "C" { - typedef struct tagSQObject SQObject; - struct SQVM; - typedef struct SQVM* HSQUIRRELVM; - typedef SQObject HSQOBJECT; -} /*extern "C"*/ - -/* ------------------------------------------------------------------------------------------------ - * SQRAT FORWARD DECLARATIONS -*/ - -namespace Sqrat { - class Array; - class Object; - class Table; - class Function; -} // Namespace:: Sqrat - -/* ------------------------------------------------------------------------------------------------ - * FUNDAMENTAL DATATYPES -*/ - -namespace SqMod { - -/**< 8 bits integer types */ -typedef char Int8, I8; -typedef unsigned char Uint8, U8; - -/**< 16 bits integer types */ -typedef short Int16, I16; -typedef unsigned short Uint16, U16; - -/**< 32 bits integer types */ -typedef int Int32, I32; -typedef unsigned int Uint32, U32; - -/**< 64 bits integer types */ -#if defined(_MSC_VER) - typedef __int64 Int64, I64; - typedef unsigned __int64 Uint64, U64; -#else - typedef long long Int64, I64; - typedef unsigned long long Uint64, U64; -#endif - -/**< integer type */ -#ifdef SQMOD_LONG - typedef Int64 Int, Integer; - typedef Uint64 Uint, Uinteger, UnisgnedInteger; -#else - typedef Int32 Int, Integer; - typedef Uint32 Uint, Uinteger, UnisgnedInteger; -#endif - -/**< long integer type */ -typedef long LongI; -typedef unsigned long Ulong; - -/**< 32 bits float types */ -typedef float Float32, Real32, F32; - -/**< 64 bits float types */ -typedef double Float64, Real64, F64; - -/**< boolean type */ -typedef Uint8 Boolean; - -/**< character type */ -typedef bool BoolT; - -/**< character types */ -typedef char CharT; - -/**< user type */ -typedef void * VoidP; - -/**< size type */ -typedef Uint32 SizeT; - -/* ------------------------------------------------------------------------------------------------ - * STRING TYPE -*/ - -typedef std::basic_string String; - -typedef char * CStr; -typedef const char * CCStr; - -typedef SQChar * SStr; -typedef const SQChar * CSStr; - -/* ------------------------------------------------------------------------------------------------ - * SHORT SQUIRREL TYPENAMES -*/ - -typedef SQUnsignedInteger32 SQUint32; -typedef SQUnsignedInteger SQUint; -typedef SQInteger SQInt; - -// ------------------------------------------------------------------------------------------------ -using namespace Sqrat; - -/* ------------------------------------------------------------------------------------------------ - * Squirrel compatible stl string. -*/ - -typedef std::basic_string< SQChar > String; - -/* ------------------------------------------------------------------------------------------------ - * FORWARD DECLARATIONS -*/ - -} // Namespace:: SqMod - -/* ------------------------------------------------------------------------------------------------ - * OS SPECIFFIC OPTIONS -*/ - -#if defined(SQMOD_OS_WINDOWS) - #define SQMOD_DIRSEP_CHAR '\\' - #define SQMOD_DIRSEP_STR "\\" -#else - #define SQMOD_DIRSEP_CHAR '/' - #define SQMOD_DIRSEP_STR "/" -#endif - -/* ------------------------------------------------------------------------------------------------ - * SYMBOL EXPORTING -*/ - -#if defined(_MSC_VER) - #define SQMOD_EXPORT __declspec(dllexport) - #define SQMOD_IMPORT __declspec(dllimport) -#elif defined(__GNUC__) - #define SQMOD_EXPORT __declspec(dllexport) - #define SQMOD_IMPORT __declspec(dllimport) -#endif - -#if defined(__cplusplus) - #define SQMOD_EXTERN_C extern "C" -#else - #define SQMOD_EXTERN_C /* */ -#endif - -#if defined(_MSC_VER) - #define SQMOD_API_EXPORT extern "C" __declspec(dllexport) -#elif defined(__GNUC__) - #define SQMOD_API_EXPORT extern "C" -#else - #define SQMOD_API_EXPORT extern "C" -#endif - -/* ------------------------------------------------------------------------------------------------ - * CALLING CONVENTIONS -*/ - -#if defined(_MSC_VER) - #define SQMOD_STDCALL __stdcall - #define SQMOD_CDECL __cdecl - #define SQMOD_FASTCALL __fastcall -#elif defined(__GNUC__) - #define SQMOD_STDCALL __attribute__((stdcall)) - #define SQMOD_CDECL /* */ - #define SQMOD_FASTCALL __attribute__((fastcall)) -#endif - -/* ------------------------------------------------------------------------------------------------ - * FUNCTION INLINING -*/ - -#if defined(_MSC_VER) - #define SQMOD_FORCEINLINE __forceinline -#elif defined(__GNUC__) - #define SQMOD_FORCEINLINE inline -#endif - -/* ------------------------------------------------------------------------------------------------ - * ATTRIBUTES -*/ -#if defined(__GNUC__) && __GNUC__ >= 7 - #define SQ_FALL_THROUGH __attribute__ ((fallthrough)) -#else - #define SQ_FALL_THROUGH ((void)0) -#endif // __GNUC__ >= 7 - -/* ------------------------------------------------------------------------------------------------ - * LOGGING LOCATION -*/ - -#define SQMOD_TRUESTRINGIZE(x) #x -#define SQMOD_STRINGIZEWRAP(x) SQMOD_TRUESTRINGIZE(x) - -#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC) - #define SQMOD_MSGLOC(m) (m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ") -#else - #define SQMOD_MSGLOC(m) (m) -#endif // _DEBUG - -/* ------------------------------------------------------------------------------------------------ - * EXCEPTION THROWING -*/ - -#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC) - #define STHROW(e, m, ...) throw e(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) - #define STHROWF(m, ...) SqThrowF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) -#else - #define STHROW(e, m, ...) throw e(m, ##__VA_ARGS__) - #define STHROWF(m, ...) SqThrowF(m, ##__VA_ARGS__) -#endif // _DEBUG - -/* ------------------------------------------------------------------------------------------------ - * VARIOUS DEFINES -*/ - -#define SQMOD_DECL_UNUSED_VAR(t, n, v) t n = v; (void)(n) -#define SQMOD_UNUSED_VAR(n) (void)(n) - -#define VALID_ENTITY(e) ((e) >= 0) -#define INVALID_ENTITY(e) ((e) < 0) - -#define VALID_ENTITYEX(e, m) (((e) >= 0) && ((e) < (m))) -#define INVALID_ENTITYEX(e, m) (((e) < 0) || ((e) >= (m))) - -#define VALID_ENTITYGET(e) (((e) >= 0) ? (e) : -1) -#define VALID_ENTITYGETEX(e, m) (((e) >= 0) && ((e) < (m)) ? (e) : -1) - -#define VALID_VEHCOL(e) (((e) >= 0) && ((e) <= 94)) -#define INVALID_VEHCOL(e) (((e) < 0) && ((e) > 94)) - -/* ------------------------------------------------------------------------------------------------ - * GENERAL RESPONSES -*/ - -#define SQMOD_SUCCESS 1 -#define SQMOD_FAILURE 0 -#define SQMOD_UNKNOWN (-1) -#define SQMOD_TRUE 1 -#define SQMOD_FALSE 0 -#define SQMOD_NULL NULL -#define SQMOD_BLANK 0 - -#endif // _SQMODBASE_HPP_ diff --git a/sdk/include/SqMod.h b/sdk/include/SqMod.h deleted file mode 100644 index 8e5701f9..00000000 --- a/sdk/include/SqMod.h +++ /dev/null @@ -1,257 +0,0 @@ -// -// SqModule: API used to communicate with and register squirrel modules -// - -// -// Copyright (c) 2016 Sandu Liviu Catalin (aka. S.L.C) -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// - -#if !defined(_SQ_MOD_H_) -#define _SQ_MOD_H_ - -#include - -#include "SqAPI.h" -#include "vcmp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - /* ------------------------------------------------------------------------------------------------ - * ARCHITECTURE IDENTIFIERS - */ - - #define SQMOD_ARCH_ID_UNKNOWN 0 - #define SQMOD_ARCH_ID_32_BIT 1 - #define SQMOD_ARCH_ID_64_BIT 2 - - /* ------------------------------------------------------------------------------------------------ - * PLATFORM IDENTIFIERS - */ - - #define SQMOD_PLAT_ID_UNKNOWN 0 - #define SQMOD_PLAT_ID_WINDOWS 1 - #define SQMOD_PLAT_ID_LINUX 2 - #define SQMOD_PLAT_ID_MACOS 3 - #define SQMOD_PLAT_ID_UNIX 4 - - /* ------------------------------------------------------------------------------------------------ - * OS IDENTIFICATION - */ - - #if defined(_WIN32) || defined(__WIN32__) || defined(_WIN) || defined(__WIN__) - // Windows x32 - #define SQMOD_OS_WINDOWS - #define SQMOD_OS_32 - #define SQMOD_OS_WINDOWS32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 1 - #elif defined(_WIN64) || defined(__WIN64__) - // Windows x64 - #define SQMOD_OS_WINDOWS - #define SQMOD_OS_64 - #define SQMOD_OS_WINDOWS64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 1 - #elif defined(linux) || defined(__linux) || defined(__linux__) - // Linux - #define SQMOD_OS_LINUX - #if __GNUC__ - #if __x86_64__ || __ppc64__ - #define SQMOD_OS_64 - #define SQMOD_OS_LINUX64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 2 - #else - #define SQMOD_OS_32 - #define SQMOD_OS_LINUX32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 2 - #endif - #endif - #elif defined(__APPLE__) || defined(__MACH__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) - // MacOS - #define SQMOD_OS_MACOS - #if __GNUC__ - #if __x86_64__ || __ppc64__ - #define SQMOD_OS_64 - #define SQMOD_OS_MACOS64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 3 - #else - #define SQMOD_OS_32 - #define SQMOD_OS_MACOS32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 3 - #endif - #endif - #elif defined(__unix) || defined(__unix__) - // Unix - #define SQMOD_OS_UNIX - #if __GNUC__ - #if __x86_64__ || __ppc64__ - #define SQMOD_OS_64 - #define SQMOD_OS_UNIX64 - #define SQMOD_ARCHITECTURE 2 - #define SQMOD_PLATFORM 4 - #else - #define SQMOD_OS_32 - #define SQMOD_OS_UNIX32 - #define SQMOD_ARCHITECTURE 1 - #define SQMOD_PLATFORM 4 - #endif - #endif - #else - // Unsupported system - #error This operating system is not supported by the Squirrel Module - #endif - - /* ------------------------------------------------------------------------------------------------ - * VCMP SDK VERSION CHECK. - */ - #define SQMOD_SDK_MATCH(MJR, MNR) ((PLUGIN_API_MAJOR == (MJR)) && (PLUGIN_API_MINOR == (MNR))) - #define SQMOD_SDK_LEAST(MJR, MNR) ((PLUGIN_API_MAJOR >= (MJR)) && (PLUGIN_API_MINOR >= (MNR))) - #define SQMOD_SDK_PRIOR(MJR, MNR) ((PLUGIN_API_MAJOR < (MJR)) && (PLUGIN_API_MINOR < (MNR))) - - #define SQMOD_DECL_UNUSED_VAR(t, n, v) t n = v; (void)(n) - #define SQMOD_UNUSED_VAR(n) (void)(n) - - /**< 64 bits integer types */ - #if defined(_MSC_VER) - typedef __int64 SqInt64; - typedef unsigned __int64 SqUint64; - #else - typedef long long SqInt64; - typedef unsigned long long SqUint64; - #endif - - #if defined(_MSC_VER) - #define SQMOD_API_EXPORT extern "C" __declspec(dllexport) - #elif defined(__GNUC__) - #define SQMOD_API_EXPORT extern "C" - #else - #define SQMOD_API_EXPORT extern "C" - #endif - - #define SQMOD_HOST_NAME "SqModHost" - #define SQMOD_INITIALIZE_CMD 0xDABBAD00 - #define SQMOD_LOAD_CMD 0xDEADBABE - #define SQMOD_TERMINATE_CMD 0xDEADC0DE - #define SQMOD_CLOSING_CMD 0xBAAAAAAD - #define SQMOD_RELEASED_CMD 0xDEADBEAF - #define SQMOD_API_VER 1 - - //primitive functions - typedef HSQUIRRELVM (*SqModAPI_GetSquirrelVM) (void); - //logging utilities - typedef void (*SqModAPI_LogMessage) (const SQChar * fmt, ...); - //script loading - typedef SQRESULT (*SqModAPI_LoadScript) (const SQChar * filepath, SQBool delay); - /* -------------------------------------------------------------------------------------------- - * Allows modules to interface with the plug-in API without linking of any sorts - */ - typedef struct - { - //primitive functions - SqModAPI_GetSquirrelVM GetSquirrelVM; - //logging utilities - SqModAPI_LogMessage LogDbg; - SqModAPI_LogMessage LogUsr; - SqModAPI_LogMessage LogScs; - SqModAPI_LogMessage LogInf; - SqModAPI_LogMessage LogWrn; - SqModAPI_LogMessage LogErr; - SqModAPI_LogMessage LogFtl; - SqModAPI_LogMessage LogSDbg; - SqModAPI_LogMessage LogSUsr; - SqModAPI_LogMessage LogSScs; - SqModAPI_LogMessage LogSInf; - SqModAPI_LogMessage LogSWrn; - SqModAPI_LogMessage LogSErr; - SqModAPI_LogMessage LogSFtl; - //script loading - SqModAPI_LoadScript LoadScript; - } sq_modapi, SQMODAPI, *HSQMODAPI; - -#ifdef SQMOD_PLUGIN_API - - //primitive functions - extern SqModAPI_GetSquirrelVM SqMod_GetSquirrelVM; - - //logging utilities - extern SqModAPI_LogMessage SqMod_LogDbg; - extern SqModAPI_LogMessage SqMod_LogUsr; - extern SqModAPI_LogMessage SqMod_LogScs; - extern SqModAPI_LogMessage SqMod_LogInf; - extern SqModAPI_LogMessage SqMod_LogWrn; - extern SqModAPI_LogMessage SqMod_LogErr; - extern SqModAPI_LogMessage SqMod_LogFtl; - extern SqModAPI_LogMessage SqMod_LogSDbg; - extern SqModAPI_LogMessage SqMod_LogSUsr; - extern SqModAPI_LogMessage SqMod_LogSScs; - extern SqModAPI_LogMessage SqMod_LogSInf; - extern SqModAPI_LogMessage SqMod_LogSWrn; - extern SqModAPI_LogMessage SqMod_LogSErr; - extern SqModAPI_LogMessage SqMod_LogSFtl; - - //script loading - extern SqModAPI_LoadScript SqMod_LoadScript; - -#endif // SQMOD_PLUGIN_API - - /* -------------------------------------------------------------------------------------------- - * The structure exported by the host plug-in to import the module and squirrel API. - */ - typedef struct - { - unsigned int StructSize; - //base functions - int32_t (*PopulateModuleAPI) (HSQMODAPI api, size_t size); - int32_t (*PopulateSquirrelAPI) (HSQLIBAPI api, size_t size); - } sq_modexports, SQMODEXPORTS, *HSQMODEXPORTS; - - /* -------------------------------------------------------------------------------------------- - * Assign the functions from the specified API structure into the global functions. - */ - SQUIRREL_API uint8_t sqmod_api_expand(HSQMODAPI sqmodapi); - - /* -------------------------------------------------------------------------------------------- - * Assign the functions from the specified API structure into the global functions. - */ - SQUIRREL_API uint8_t sqlib_api_expand(HSQLIBAPI sqlibapi); - - /* -------------------------------------------------------------------------------------------- - * Undo changes done by sqmod_api_expand. - */ - SQUIRREL_API void sqmod_api_collapse(); - - /* -------------------------------------------------------------------------------------------- - * Undo changes done by sq_api_expand. - */ - SQUIRREL_API void sqlib_api_collapse(); - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*_SQ_MOD_H_*/