1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Updated the Squirrel and Sqrat libraries to the latest development versions.

This commit is contained in:
Sandu Liviu Catalin 2016-05-22 22:51:59 +03:00
parent 40a2ba46f5
commit 6822172f6a
18 changed files with 283 additions and 219 deletions

View File

@ -165,6 +165,7 @@
<Add option="-fno-rtti" /> <Add option="-fno-rtti" />
<Add option="-fno-strict-aliasing" /> <Add option="-fno-strict-aliasing" />
<Add option="-Wno-unused-variable" /> <Add option="-Wno-unused-variable" />
<Add option="-Wno-unused-but-set-variable" />
<Add option="-DGARBAGE_COLLECTOR" /> <Add option="-DGARBAGE_COLLECTOR" />
<Add directory="../include" /> <Add directory="../include" />
<Add directory="../config/common" /> <Add directory="../config/common" />

View File

@ -1,4 +1,4 @@
Copyright (c) 2003-2015 Alberto Demichelis Copyright (c) 2003-2016 Alberto Demichelis
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -103,10 +103,10 @@ static SQInteger _sqstd_aux_printerror(HSQUIRRELVM v)
const SQChar *sErr = 0; const SQChar *sErr = 0;
if(sq_gettop(v)>=1) { if(sq_gettop(v)>=1) {
if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr))) { if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr))) {
pf(v,_SC("\nAN ERROR HAS OCCURED [%s]\n"),sErr); pf(v,_SC("\nAN ERROR HAS OCCURRED [%s]\n"),sErr);
} }
else{ else{
pf(v,_SC("\nAN ERROR HAS OCCURED [unknown]\n")); pf(v,_SC("\nAN ERROR HAS OCCURRED [unknown]\n"));
} }
sqstd_printcallstack(v); sqstd_printcallstack(v);
} }

View File

@ -372,7 +372,7 @@ SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
} }
if(uc != 0xBF) { if(uc != 0xBF) {
sqstd_fclose(file); sqstd_fclose(file);
return sq_throwerror(v,_SC("Unrecognozed ecoding")); return sq_throwerror(v,_SC("Unrecognized encoding"));
} }
#ifdef SQUNICODE #ifdef SQUNICODE
func = _io_file_lexfeed_UTF8; func = _io_file_lexfeed_UTF8;
@ -399,6 +399,10 @@ SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror) SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror)
{ {
//at least one entry must exist in order for us to push it as the environment
if(sq_gettop(v) == 0)
return sq_throwerror(v,_SC("environment table expected"));
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,printerror))) { if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,printerror))) {
sq_push(v,-2); sq_push(v,-2);
if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue))) { if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue))) {

View File

@ -153,6 +153,9 @@ static SQInteger sqstd_rex_charnode(SQRex *exp,SQBool isclass)
exp->_nodes[node].right = ce; exp->_nodes[node].right = ce;
return node; return node;
} }
case 0:
sqstd_rex_error(exp,_SC("letter expected for argument of escape sequence"));
break;
case 'b': case 'b':
case 'B': case 'B':
if(!isclass) { if(!isclass) {

View File

@ -89,7 +89,7 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
else { else {
n++; n++;
if( nparam > sq_gettop(v) ) if( nparam > sq_gettop(v) )
return sq_throwerror(v,_SC("not enough paramters for the given format string")); return sq_throwerror(v,_SC("not enough parameters for the given format string"));
n = validate_format(v,fmt,format,n,w); n = validate_format(v,fmt,format,n,w);
if(n < 0) return -1; if(n < 0) return -1;
SQInteger addlen = 0; SQInteger addlen = 0;
@ -150,6 +150,19 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
return SQ_OK; return SQ_OK;
} }
static SQInteger _string_printf(HSQUIRRELVM v)
{
SQChar *dest = NULL;
SQInteger length = 0;
if(SQ_FAILED(sqstd_format(v,2,&length,&dest)))
return -1;
SQPRINTFUNCTION printfunc = sq_getprintfunc(v);
if(printfunc) printfunc(v,dest);
return 0;
}
static SQInteger _string_format(HSQUIRRELVM v) static SQInteger _string_format(HSQUIRRELVM v)
{ {
SQChar *dest = NULL; SQChar *dest = NULL;
@ -459,6 +472,7 @@ static const SQRegFunction rexobj_funcs[]={
#define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_string_##name,nparams,pmask} #define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_string_##name,nparams,pmask}
static const SQRegFunction stringlib_funcs[]={ static const SQRegFunction stringlib_funcs[]={
_DECL_FUNC(format,-2,_SC(".s")), _DECL_FUNC(format,-2,_SC(".s")),
_DECL_FUNC(printf,-2,_SC(".s")),
_DECL_FUNC(strip,2,_SC(".s")), _DECL_FUNC(strip,2,_SC(".s")),
_DECL_FUNC(lstrip,2,_SC(".s")), _DECL_FUNC(lstrip,2,_SC(".s")),
_DECL_FUNC(rstrip,2,_SC(".s")), _DECL_FUNC(rstrip,2,_SC(".s")),

View File

@ -680,6 +680,15 @@ SQRESULT sq_getbool(HSQUIRRELVM v,SQInteger idx,SQBool *b)
return SQ_ERROR; return SQ_ERROR;
} }
SQRESULT sq_getstringandsize(HSQUIRRELVM v,SQInteger idx,const SQChar **c,SQInteger *size)
{
SQObjectPtr *o = NULL;
_GETSAFE_OBJ(v, idx, OT_STRING,o);
*c = _stringval(*o);
*size = _string(*o)->_len;
return SQ_OK;
}
SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c) SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c)
{ {
SQObjectPtr *o = NULL; SQObjectPtr *o = NULL;
@ -1128,7 +1137,7 @@ SQRESULT sq_reservestack(HSQUIRRELVM v,SQInteger nsize)
{ {
if (((SQUnsignedInteger)v->_top + nsize) > v->_stack.size()) { if (((SQUnsignedInteger)v->_top + nsize) > v->_stack.size()) {
if(v->_nmetamethodscall) { if(v->_nmetamethodscall) {
return sq_throwerror(v,_SC("cannot resize stack while in a metamethod")); return sq_throwerror(v,_SC("cannot resize stack while in a metamethod"));
} }
v->_stack.resize(v->_stack.size() + ((v->_top + nsize) - v->_stack.size())); v->_stack.resize(v->_stack.size() + ((v->_top + nsize) - v->_stack.size()));
} }
@ -1199,29 +1208,24 @@ SQRESULT sq_wakeupvm(HSQUIRRELVM v,SQBool wakeupret,SQBool retval,SQBool raiseer
void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook) void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook)
{ {
if(sq_gettop(v) >= 1){ SQObjectPtr &ud=stack_get(v,idx);
SQObjectPtr &ud=stack_get(v,idx); switch( type(ud) ) {
switch( type(ud) ) { case OT_USERDATA: _userdata(ud)->_hook = hook; break;
case OT_USERDATA: _userdata(ud)->_hook = hook; break; case OT_INSTANCE: _instance(ud)->_hook = hook; break;
case OT_INSTANCE: _instance(ud)->_hook = hook; break; case OT_CLASS: _class(ud)->_hook = hook; break;
case OT_CLASS: _class(ud)->_hook = hook; break; default: return;
default: break; //shutup compiler
}
} }
} }
SQRELEASEHOOK sq_getreleasehook(HSQUIRRELVM v,SQInteger idx) SQRELEASEHOOK sq_getreleasehook(HSQUIRRELVM v,SQInteger idx)
{ {
if(sq_gettop(v) >= 1){ SQObjectPtr &ud=stack_get(v,idx);
SQObjectPtr &ud=stack_get(v,idx); switch( type(ud) ) {
switch( type(ud) ) { case OT_USERDATA: return _userdata(ud)->_hook; break;
case OT_USERDATA: return _userdata(ud)->_hook; break; case OT_INSTANCE: return _instance(ud)->_hook; break;
case OT_INSTANCE: return _instance(ud)->_hook; break; case OT_CLASS: return _class(ud)->_hook; break;
case OT_CLASS: return _class(ud)->_hook; break; default: return NULL;
default: break; //shutup compiler
}
} }
return NULL;
} }
void sq_setcompilererrorhandler(HSQUIRRELVM v,SQCOMPILERERROR f) void sq_setcompilererrorhandler(HSQUIRRELVM v,SQCOMPILERERROR f)

View File

@ -17,12 +17,13 @@ static bool str2num(const SQChar *s,SQObjectPtr &res,SQInteger base)
{ {
SQChar *end; SQChar *end;
const SQChar *e = s; const SQChar *e = s;
SQBool isfloat = SQFalse; bool iseintbase = base > 13; //to fix error converting hexadecimals with e like 56f0791e
bool isfloat = false;
SQChar c; SQChar c;
while((c = *e) != _SC('\0')) while((c = *e) != _SC('\0'))
{ {
if(c == _SC('.') || c == _SC('E')|| c == _SC('e')) { //e and E is for scientific notation if (c == _SC('.') || (!iseintbase && (c == _SC('E') || c == _SC('e')))) { //e and E is for scientific notation
isfloat = SQTrue; isfloat = true;
break; break;
} }
e++; e++;

View File

@ -389,7 +389,7 @@ SQInteger SQLexer::ReadString(SQInteger ndelim,bool verbatim)
#if WCHAR_SIZE == 2 #if WCHAR_SIZE == 2
AddUTF16(scstrtoul(temp, &stemp, 16)); AddUTF16(scstrtoul(temp, &stemp, 16));
#else #else
ADD_CHAR((SQChar)scstrtoul(temp, &stemp, 16)); APPEND_CHAR((SQChar)scstrtoul(temp, &stemp, 16));
#endif #endif
#else #else
AddUTF8(scstrtoul(temp, &stemp, 16)); AddUTF8(scstrtoul(temp, &stemp, 16));

View File

@ -12,12 +12,6 @@
#include "squserdata.h" #include "squserdata.h"
#include "sqclass.h" #include "sqclass.h"
//SQObjectPtr _null_;
//SQObjectPtr _true_(true);
//SQObjectPtr _false_(false);
//SQObjectPtr _one_((SQInteger)1);
//SQObjectPtr _minusone_((SQInteger)-1);
SQSharedState::SQSharedState() SQSharedState::SQSharedState()
{ {
_compilererrorhandler = NULL; _compilererrorhandler = NULL;
@ -41,31 +35,29 @@ SQSharedState::SQSharedState()
bool CompileTypemask(SQIntVec &res,const SQChar *typemask) bool CompileTypemask(SQIntVec &res,const SQChar *typemask)
{ {
SQInteger i = 0; SQInteger i = 0;
SQInteger mask = 0; SQInteger mask = 0;
while(typemask[i] != 0) { while(typemask[i] != 0) {
switch(typemask[i]) {
switch(typemask[i]){ case 'o': mask |= _RT_NULL; break;
case 'o': mask |= _RT_NULL; break; case 'i': mask |= _RT_INTEGER; break;
case 'i': mask |= _RT_INTEGER; break; case 'f': mask |= _RT_FLOAT; break;
case 'f': mask |= _RT_FLOAT; break; case 'n': mask |= (_RT_FLOAT | _RT_INTEGER); break;
case 'n': mask |= (_RT_FLOAT | _RT_INTEGER); break; case 's': mask |= _RT_STRING; break;
case 's': mask |= _RT_STRING; break; case 't': mask |= _RT_TABLE; break;
case 't': mask |= _RT_TABLE; break; case 'a': mask |= _RT_ARRAY; break;
case 'a': mask |= _RT_ARRAY; break; case 'u': mask |= _RT_USERDATA; break;
case 'u': mask |= _RT_USERDATA; break; case 'c': mask |= (_RT_CLOSURE | _RT_NATIVECLOSURE); break;
case 'c': mask |= (_RT_CLOSURE | _RT_NATIVECLOSURE); break; case 'b': mask |= _RT_BOOL; break;
case 'b': mask |= _RT_BOOL; break; case 'g': mask |= _RT_GENERATOR; break;
case 'g': mask |= _RT_GENERATOR; break; case 'p': mask |= _RT_USERPOINTER; break;
case 'p': mask |= _RT_USERPOINTER; break; case 'v': mask |= _RT_THREAD; break;
case 'v': mask |= _RT_THREAD; break; case 'x': mask |= _RT_INSTANCE; break;
case 'x': mask |= _RT_INSTANCE; break; case 'y': mask |= _RT_CLASS; break;
case 'y': mask |= _RT_CLASS; break; case 'r': mask |= _RT_WEAKREF; break;
case 'r': mask |= _RT_WEAKREF; break; case '.': mask = -1; res.push_back(mask); i++; mask = 0; continue;
case '.': mask = -1; res.push_back(mask); i++; mask = 0; continue; case ' ': i++; continue; //ignores spaces
case ' ': i++; continue; //ignores spaces default:
default: return false;
return false;
} }
i++; i++;
if(typemask[i] == '|') { if(typemask[i] == '|') {
@ -160,7 +152,6 @@ void SQSharedState::Init()
_class_default_delegate = CreateDefaultDelegate(this,_class_default_delegate_funcz); _class_default_delegate = CreateDefaultDelegate(this,_class_default_delegate_funcz);
_instance_default_delegate = CreateDefaultDelegate(this,_instance_default_delegate_funcz); _instance_default_delegate = CreateDefaultDelegate(this,_instance_default_delegate_funcz);
_weakref_default_delegate = CreateDefaultDelegate(this,_weakref_default_delegate_funcz); _weakref_default_delegate = CreateDefaultDelegate(this,_weakref_default_delegate_funcz);
} }
SQSharedState::~SQSharedState() SQSharedState::~SQSharedState()
@ -282,7 +273,6 @@ SQInteger SQSharedState::ResurrectUnreachable(SQVM *vm)
SQCollectable *resurrected = _gc_chain; SQCollectable *resurrected = _gc_chain;
SQCollectable *t = resurrected; SQCollectable *t = resurrected;
//SQCollectable *nx = NULL;
_gc_chain = tchain; _gc_chain = tchain;

View File

@ -15,6 +15,8 @@
#include "sqclass.h" #include "sqclass.h"
#define TOP() (_stack._vals[_top-1]) #define TOP() (_stack._vals[_top-1])
#define TARGET _stack._vals[_stackbase+arg0]
#define STK(a) _stack._vals[_stackbase+(a)]
bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2) bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2)
{ {
@ -301,7 +303,7 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
SQObjectPtr closure; SQObjectPtr closure;
if(_delegable(o)->GetMetaMethod(this, MT_TOSTRING, closure)) { if(_delegable(o)->GetMetaMethod(this, MT_TOSTRING, closure)) {
Push(o); Push(o);
if(CallMetaMethod(closure,MT_TOSTRING,1,res)) {; if(CallMetaMethod(closure,MT_TOSTRING,1,res)) {
if(type(res) == OT_STRING) if(type(res) == OT_STRING)
return true; return true;
} }
@ -1367,9 +1369,8 @@ SQInteger SQVM::FallBackSet(const SQObjectPtr &self,const SQObjectPtr &key,const
return FALLBACK_OK; return FALLBACK_OK;
} }
else { else {
Pop(3);
if(type(_lasterror) != OT_NULL) { //NULL means "clean failure" (not found) if(type(_lasterror) != OT_NULL) { //NULL means "clean failure" (not found)
//error
Pop(3);
return FALLBACK_ERROR; return FALLBACK_ERROR;
} }
} }
@ -1632,7 +1633,7 @@ bool SQVM::EnterFrame(SQInteger newbase, SQInteger newtop, bool tailcall)
_top = newtop; _top = newtop;
if(newtop + MIN_STACK_OVERHEAD > (SQInteger)_stack.size()) { if(newtop + MIN_STACK_OVERHEAD > (SQInteger)_stack.size()) {
if(_nmetamethodscall) { if(_nmetamethodscall) {
Raise_Error(_SC("stack overflow, cannot resize stack while in a metamethod")); Raise_Error(_SC("stack overflow, cannot resize stack while in a metamethod"));
return false; return false;
} }
_stack.resize(newtop + (MIN_STACK_OVERHEAD << 2)); _stack.resize(newtop + (MIN_STACK_OVERHEAD << 2));

View File

@ -28,9 +28,6 @@ struct SQExceptionTrap{
#define _INLINE #define _INLINE
#define STK(a) _stack._vals[_stackbase+(a)]
#define TARGET _stack._vals[_stackbase+arg0]
typedef sqvector<SQExceptionTrap> ExceptionsTraps; typedef sqvector<SQExceptionTrap> ExceptionsTraps;
struct SQVM : public CHAINABLE_OBJ struct SQVM : public CHAINABLE_OBJ

View File

@ -281,6 +281,44 @@ public:
#endif #endif
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Checks if the object has a slot with a specified key
///
/// \param key Name of the key
///
/// \return True if the Object has a value associated with key, otherwise false
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(const SQChar* key) const {
sq_pushobject(vm, GetObject());
sq_pushstring(vm, key, -1);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
return false;
}
sq_pop(vm, 2);
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Checks if the object has a slot with a specified index
///
/// \param index Index to check
///
/// \return True if the Object has a value associated with index, otherwise false
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(SQInteger index) const {
sq_pushobject(vm, GetObject());
sq_pushinteger(vm, index);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
return false;
}
sq_pop(vm, 2);
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Casts the object to a certain C++ type /// Casts the object to a certain C++ type
/// ///

View File

@ -7,6 +7,7 @@
#define SQSTD_STREAM_TYPE_TAG 0x80000000 #define SQSTD_STREAM_TYPE_TAG 0x80000000
struct SQStream { struct SQStream {
virtual ~SQStream() {}
virtual SQInteger Read(void *buffer, SQInteger size) = 0; virtual SQInteger Read(void *buffer, SQInteger size) = 0;
virtual SQInteger Write(void *buffer, SQInteger size) = 0; virtual SQInteger Write(void *buffer, SQInteger size) = 0;
virtual SQInteger Flush() = 0; virtual SQInteger Flush() = 0;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2003-2014 Alberto Demichelis Copyright (c) 2003-2016 Alberto Demichelis
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -62,7 +62,7 @@ struct SQOuter;
#include "sqconfig.h" #include "sqconfig.h"
#define SQUIRREL_VERSION _SC("Squirrel 3.1 stable") #define SQUIRREL_VERSION _SC("Squirrel 3.1 stable")
#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2015 Alberto Demichelis") #define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2016 Alberto Demichelis")
#define SQUIRREL_AUTHOR _SC("Alberto Demichelis") #define SQUIRREL_AUTHOR _SC("Alberto Demichelis")
#define SQUIRREL_VERSION_NUMBER 310 #define SQUIRREL_VERSION_NUMBER 310
@ -195,6 +195,7 @@ typedef struct tagSQFunctionInfo {
}SQFunctionInfo; }SQFunctionInfo;
#ifndef SQMOD_PLUGIN_API #ifndef SQMOD_PLUGIN_API
/*vm*/ /*vm*/
SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize); SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize);
SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize); SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize);
@ -259,6 +260,7 @@ SQUIRREL_API SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx);
SQUIRREL_API SQBool sq_instanceof(HSQUIRRELVM v); SQUIRREL_API SQBool sq_instanceof(HSQUIRRELVM v);
SQUIRREL_API SQRESULT sq_tostring(HSQUIRRELVM v,SQInteger idx); SQUIRREL_API SQRESULT sq_tostring(HSQUIRRELVM v,SQInteger idx);
SQUIRREL_API void sq_tobool(HSQUIRRELVM v, SQInteger idx, SQBool *b); SQUIRREL_API void sq_tobool(HSQUIRRELVM v, SQInteger idx, SQBool *b);
SQUIRREL_API SQRESULT sq_getstringandsize(HSQUIRRELVM v,SQInteger idx,const SQChar **c,SQInteger *size);
SQUIRREL_API SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c); SQUIRREL_API SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c);
SQUIRREL_API SQRESULT sq_getinteger(HSQUIRRELVM v,SQInteger idx,SQInteger *i); SQUIRREL_API SQRESULT sq_getinteger(HSQUIRRELVM v,SQInteger idx,SQInteger *i);
SQUIRREL_API SQRESULT sq_getfloat(HSQUIRRELVM v,SQInteger idx,SQFloat *f); SQUIRREL_API SQRESULT sq_getfloat(HSQUIRRELVM v,SQInteger idx,SQFloat *f);
@ -362,6 +364,7 @@ SQUIRREL_API void sq_free(void *p,SQUnsignedInteger size);
SQUIRREL_API SQRESULT sq_stackinfos(HSQUIRRELVM v,SQInteger level,SQStackInfos *si); SQUIRREL_API SQRESULT sq_stackinfos(HSQUIRRELVM v,SQInteger level,SQStackInfos *si);
SQUIRREL_API void sq_setdebughook(HSQUIRRELVM v); SQUIRREL_API void sq_setdebughook(HSQUIRRELVM v);
SQUIRREL_API void sq_setnativedebughook(HSQUIRRELVM v,SQDEBUGHOOK hook); SQUIRREL_API void sq_setnativedebughook(HSQUIRRELVM v,SQDEBUGHOOK hook);
#endif // SQMOD_PLUGIN_API #endif // SQMOD_PLUGIN_API
/*UTILITY MACRO*/ /*UTILITY MACRO*/

View File

@ -98,6 +98,7 @@ extern "C" {
typedef SQBool (*sqapi_instanceof)(HSQUIRRELVM v); typedef SQBool (*sqapi_instanceof)(HSQUIRRELVM v);
typedef SQRESULT (*sqapi_tostring)(HSQUIRRELVM v,SQInteger idx); typedef SQRESULT (*sqapi_tostring)(HSQUIRRELVM v,SQInteger idx);
typedef void (*sqapi_tobool)(HSQUIRRELVM v, SQInteger idx, SQBool *b); typedef void (*sqapi_tobool)(HSQUIRRELVM v, SQInteger idx, SQBool *b);
typedef SQRESULT (*sqapi_getstringandsize)(HSQUIRRELVM v,SQInteger idx,const SQChar **c,SQInteger *size);
typedef SQRESULT (*sqapi_getstring)(HSQUIRRELVM v,SQInteger idx,const SQChar **c); typedef SQRESULT (*sqapi_getstring)(HSQUIRRELVM v,SQInteger idx,const SQChar **c);
typedef SQRESULT (*sqapi_getinteger)(HSQUIRRELVM v,SQInteger idx,SQInteger *i); typedef SQRESULT (*sqapi_getinteger)(HSQUIRRELVM v,SQInteger idx,SQInteger *i);
typedef SQRESULT (*sqapi_getfloat)(HSQUIRRELVM v,SQInteger idx,SQFloat *f); typedef SQRESULT (*sqapi_getfloat)(HSQUIRRELVM v,SQInteger idx,SQFloat *f);
@ -285,6 +286,7 @@ extern "C" {
sqapi_instanceof instanceof; sqapi_instanceof instanceof;
sqapi_tostring tostring; sqapi_tostring tostring;
sqapi_tobool tobool; sqapi_tobool tobool;
sqapi_getstringandsize getstringandsize;
sqapi_getstring getstring; sqapi_getstring getstring;
sqapi_getinteger getinteger; sqapi_getinteger getinteger;
sqapi_getfloat getfloat; sqapi_getfloat getfloat;
@ -406,184 +408,185 @@ extern "C" {
#ifdef SQMOD_PLUGIN_API #ifdef SQMOD_PLUGIN_API
/*vm*/ /*vm*/
extern sqapi_open sq_open; extern sqapi_open sq_open;
extern sqapi_newthread sq_newthread; extern sqapi_newthread sq_newthread;
extern sqapi_seterrorhandler sq_seterrorhandler; extern sqapi_seterrorhandler sq_seterrorhandler;
extern sqapi_close sq_close; extern sqapi_close sq_close;
extern sqapi_setforeignptr sq_setforeignptr; extern sqapi_setforeignptr sq_setforeignptr;
extern sqapi_getforeignptr sq_getforeignptr; extern sqapi_getforeignptr sq_getforeignptr;
extern sqapi_setsharedforeignptr sq_setsharedforeignptr; extern sqapi_setsharedforeignptr sq_setsharedforeignptr;
extern sqapi_getsharedforeignptr sq_getsharedforeignptr; extern sqapi_getsharedforeignptr sq_getsharedforeignptr;
extern sqapi_setvmreleasehook sq_setvmreleasehook; extern sqapi_setvmreleasehook sq_setvmreleasehook;
extern sqapi_getvmreleasehook sq_getvmreleasehook; extern sqapi_getvmreleasehook sq_getvmreleasehook;
extern sqapi_setsharedreleasehook sq_setsharedreleasehook; extern sqapi_setsharedreleasehook sq_setsharedreleasehook;
extern sqapi_getsharedreleasehook sq_getsharedreleasehook; extern sqapi_getsharedreleasehook sq_getsharedreleasehook;
extern sqapi_setprintfunc sq_setprintfunc; extern sqapi_setprintfunc sq_setprintfunc;
extern sqapi_getprintfunc sq_getprintfunc; extern sqapi_getprintfunc sq_getprintfunc;
extern sqapi_geterrorfunc sq_geterrorfunc; extern sqapi_geterrorfunc sq_geterrorfunc;
extern sqapi_suspendvm sq_suspendvm; extern sqapi_suspendvm sq_suspendvm;
extern sqapi_wakeupvm sq_wakeupvm; extern sqapi_wakeupvm sq_wakeupvm;
extern sqapi_getvmstate sq_getvmstate; extern sqapi_getvmstate sq_getvmstate;
extern sqapi_getversion sq_getversion; extern sqapi_getversion sq_getversion;
/*compiler*/ /*compiler*/
extern sqapi_compile sq_compile; extern sqapi_compile sq_compile;
extern sqapi_compilebuffer sq_compilebuffer; extern sqapi_compilebuffer sq_compilebuffer;
extern sqapi_enabledebuginfo sq_enabledebuginfo; extern sqapi_enabledebuginfo sq_enabledebuginfo;
extern sqapi_notifyallexceptions sq_notifyallexceptions; extern sqapi_notifyallexceptions sq_notifyallexceptions;
extern sqapi_setcompilererrorhandler sq_setcompilererrorhandler; extern sqapi_setcompilererrorhandler sq_setcompilererrorhandler;
/*stack operations*/ /*stack operations*/
extern sqapi_push sq_push; extern sqapi_push sq_push;
extern sqapi_pop sq_pop; extern sqapi_pop sq_pop;
extern sqapi_poptop sq_poptop; extern sqapi_poptop sq_poptop;
extern sqapi_remove sq_remove; extern sqapi_remove sq_remove;
extern sqapi_gettop sq_gettop; extern sqapi_gettop sq_gettop;
extern sqapi_settop sq_settop; extern sqapi_settop sq_settop;
extern sqapi_reservestack sq_reservestack; extern sqapi_reservestack sq_reservestack;
extern sqapi_cmp sq_cmp; extern sqapi_cmp sq_cmp;
extern sqapi_move sq_move; extern sqapi_move sq_move;
/*object creation handling*/ /*object creation handling*/
extern sqapi_newuserdata sq_newuserdata; extern sqapi_newuserdata sq_newuserdata;
extern sqapi_newtable sq_newtable; extern sqapi_newtable sq_newtable;
extern sqapi_newtableex sq_newtableex; extern sqapi_newtableex sq_newtableex;
extern sqapi_newarray sq_newarray; extern sqapi_newarray sq_newarray;
extern sqapi_newclosure sq_newclosure; extern sqapi_newclosure sq_newclosure;
extern sqapi_setparamscheck sq_setparamscheck; extern sqapi_setparamscheck sq_setparamscheck;
extern sqapi_bindenv sq_bindenv; extern sqapi_bindenv sq_bindenv;
extern sqapi_setclosureroot sq_setclosureroot; extern sqapi_setclosureroot sq_setclosureroot;
extern sqapi_getclosureroot sq_getclosureroot; extern sqapi_getclosureroot sq_getclosureroot;
extern sqapi_pushstring sq_pushstring; extern sqapi_pushstring sq_pushstring;
extern sqapi_pushfloat sq_pushfloat; extern sqapi_pushfloat sq_pushfloat;
extern sqapi_pushinteger sq_pushinteger; extern sqapi_pushinteger sq_pushinteger;
extern sqapi_pushbool sq_pushbool; extern sqapi_pushbool sq_pushbool;
extern sqapi_pushuserpointer sq_pushuserpointer; extern sqapi_pushuserpointer sq_pushuserpointer;
extern sqapi_pushnull sq_pushnull; extern sqapi_pushnull sq_pushnull;
extern sqapi_pushthread sq_pushthread; extern sqapi_pushthread sq_pushthread;
extern sqapi_gettype sq_gettype; extern sqapi_gettype sq_gettype;
extern sqapi_typeof sq_typeof; extern sqapi_typeof sq_typeof;
extern sqapi_getsize sq_getsize; extern sqapi_getsize sq_getsize;
extern sqapi_gethash sq_gethash; extern sqapi_gethash sq_gethash;
extern sqapi_getbase sq_getbase; extern sqapi_getbase sq_getbase;
extern sqapi_instanceof sq_instanceof; extern sqapi_instanceof sq_instanceof;
extern sqapi_tostring sq_tostring; extern sqapi_tostring sq_tostring;
extern sqapi_tobool sq_tobool; extern sqapi_tobool sq_tobool;
extern sqapi_getstring sq_getstring; extern sqapi_getstringandsize sq_getstringandsize;
extern sqapi_getinteger sq_getinteger; extern sqapi_getstring sq_getstring;
extern sqapi_getfloat sq_getfloat; extern sqapi_getinteger sq_getinteger;
extern sqapi_getbool sq_getbool; extern sqapi_getfloat sq_getfloat;
extern sqapi_getthread sq_getthread; extern sqapi_getbool sq_getbool;
extern sqapi_getuserpointer sq_getuserpointer; extern sqapi_getthread sq_getthread;
extern sqapi_getuserdata sq_getuserdata; extern sqapi_getuserpointer sq_getuserpointer;
extern sqapi_settypetag sq_settypetag; extern sqapi_getuserdata sq_getuserdata;
extern sqapi_gettypetag sq_gettypetag; extern sqapi_settypetag sq_settypetag;
extern sqapi_setreleasehook sq_setreleasehook; extern sqapi_gettypetag sq_gettypetag;
extern sqapi_getreleasehook sq_getreleasehook; extern sqapi_setreleasehook sq_setreleasehook;
extern sqapi_getscratchpad sq_getscratchpad; extern sqapi_getreleasehook sq_getreleasehook;
extern sqapi_getfunctioninfo sq_getfunctioninfo; extern sqapi_getscratchpad sq_getscratchpad;
extern sqapi_getclosureinfo sq_getclosureinfo; extern sqapi_getfunctioninfo sq_getfunctioninfo;
extern sqapi_getclosurename sq_getclosurename; extern sqapi_getclosureinfo sq_getclosureinfo;
extern sqapi_setnativeclosurename sq_setnativeclosurename; extern sqapi_getclosurename sq_getclosurename;
extern sqapi_setinstanceup sq_setinstanceup; extern sqapi_setnativeclosurename sq_setnativeclosurename;
extern sqapi_getinstanceup sq_getinstanceup; extern sqapi_setinstanceup sq_setinstanceup;
extern sqapi_setclassudsize sq_setclassudsize; extern sqapi_getinstanceup sq_getinstanceup;
extern sqapi_newclass sq_newclass; extern sqapi_setclassudsize sq_setclassudsize;
extern sqapi_createinstance sq_createinstance; extern sqapi_newclass sq_newclass;
extern sqapi_setattributes sq_setattributes; extern sqapi_createinstance sq_createinstance;
extern sqapi_getattributes sq_getattributes; extern sqapi_setattributes sq_setattributes;
extern sqapi_getclass sq_getclass; extern sqapi_getattributes sq_getattributes;
extern sqapi_weakref sq_weakref; extern sqapi_getclass sq_getclass;
extern sqapi_getdefaultdelegate sq_getdefaultdelegate; extern sqapi_weakref sq_weakref;
extern sqapi_getmemberhandle sq_getmemberhandle; extern sqapi_getdefaultdelegate sq_getdefaultdelegate;
extern sqapi_getbyhandle sq_getbyhandle; extern sqapi_getmemberhandle sq_getmemberhandle;
extern sqapi_setbyhandle sq_setbyhandle; extern sqapi_getbyhandle sq_getbyhandle;
extern sqapi_setbyhandle sq_setbyhandle;
/*object manipulation*/ /*object manipulation*/
extern sqapi_pushroottable sq_pushroottable; extern sqapi_pushroottable sq_pushroottable;
extern sqapi_pushregistrytable sq_pushregistrytable; extern sqapi_pushregistrytable sq_pushregistrytable;
extern sqapi_pushconsttable sq_pushconsttable; extern sqapi_pushconsttable sq_pushconsttable;
extern sqapi_setroottable sq_setroottable; extern sqapi_setroottable sq_setroottable;
extern sqapi_setconsttable sq_setconsttable; extern sqapi_setconsttable sq_setconsttable;
extern sqapi_newslot sq_newslot; extern sqapi_newslot sq_newslot;
extern sqapi_deleteslot sq_deleteslot; extern sqapi_deleteslot sq_deleteslot;
extern sqapi_set sq_set; extern sqapi_set sq_set;
extern sqapi_get sq_get; extern sqapi_get sq_get;
extern sqapi_rawget sq_rawget; extern sqapi_rawget sq_rawget;
extern sqapi_rawset sq_rawset; extern sqapi_rawset sq_rawset;
extern sqapi_rawdeleteslot sq_rawdeleteslot; extern sqapi_rawdeleteslot sq_rawdeleteslot;
extern sqapi_newmember sq_newmember; extern sqapi_newmember sq_newmember;
extern sqapi_rawnewmember sq_rawnewmember; extern sqapi_rawnewmember sq_rawnewmember;
extern sqapi_arrayappend sq_arrayappend; extern sqapi_arrayappend sq_arrayappend;
extern sqapi_arraypop sq_arraypop; extern sqapi_arraypop sq_arraypop;
extern sqapi_arrayresize sq_arrayresize; extern sqapi_arrayresize sq_arrayresize;
extern sqapi_arrayreverse sq_arrayreverse; extern sqapi_arrayreverse sq_arrayreverse;
extern sqapi_arrayremove sq_arrayremove; extern sqapi_arrayremove sq_arrayremove;
extern sqapi_arrayinsert sq_arrayinsert; extern sqapi_arrayinsert sq_arrayinsert;
extern sqapi_setdelegate sq_setdelegate; extern sqapi_setdelegate sq_setdelegate;
extern sqapi_getdelegate sq_getdelegate; extern sqapi_getdelegate sq_getdelegate;
extern sqapi_clone sq_clone; extern sqapi_clone sq_clone;
extern sqapi_setfreevariable sq_setfreevariable; extern sqapi_setfreevariable sq_setfreevariable;
extern sqapi_next sq_next; extern sqapi_next sq_next;
extern sqapi_getweakrefval sq_getweakrefval; extern sqapi_getweakrefval sq_getweakrefval;
extern sqapi_clear sq_clear; extern sqapi_clear sq_clear;
/*calls*/ /*calls*/
extern sqapi_call sq_call; extern sqapi_call sq_call;
extern sqapi_resume sq_resume; extern sqapi_resume sq_resume;
extern sqapi_getlocal sq_getlocal; extern sqapi_getlocal sq_getlocal;
extern sqapi_getcallee sq_getcallee; extern sqapi_getcallee sq_getcallee;
extern sqapi_getfreevariable sq_getfreevariable; extern sqapi_getfreevariable sq_getfreevariable;
extern sqapi_throwerror sq_throwerror; extern sqapi_throwerror sq_throwerror;
extern sqapi_throwobject sq_throwobject; extern sqapi_throwobject sq_throwobject;
extern sqapi_reseterror sq_reseterror; extern sqapi_reseterror sq_reseterror;
extern sqapi_getlasterror sq_getlasterror; extern sqapi_getlasterror sq_getlasterror;
/*raw object handling*/ /*raw object handling*/
extern sqapi_getstackobj sq_getstackobj; extern sqapi_getstackobj sq_getstackobj;
extern sqapi_pushobject sq_pushobject; extern sqapi_pushobject sq_pushobject;
extern sqapi_addref sq_addref; extern sqapi_addref sq_addref;
extern sqapi_release sq_release; extern sqapi_release sq_release;
extern sqapi_getrefcount sq_getrefcount; extern sqapi_getrefcount sq_getrefcount;
extern sqapi_resetobject sq_resetobject; extern sqapi_resetobject sq_resetobject;
extern sqapi_objtostring sq_objtostring; extern sqapi_objtostring sq_objtostring;
extern sqapi_objtobool sq_objtobool; extern sqapi_objtobool sq_objtobool;
extern sqapi_objtointeger sq_objtointeger; extern sqapi_objtointeger sq_objtointeger;
extern sqapi_objtofloat sq_objtofloat; extern sqapi_objtofloat sq_objtofloat;
extern sqapi_objtouserpointer sq_objtouserpointer; extern sqapi_objtouserpointer sq_objtouserpointer;
extern sqapi_getobjtypetag sq_getobjtypetag; extern sqapi_getobjtypetag sq_getobjtypetag;
extern sqapi_getvmrefcount sq_getvmrefcount; extern sqapi_getvmrefcount sq_getvmrefcount;
/*GC*/ /*GC*/
extern sqapi_collectgarbage sq_collectgarbage; extern sqapi_collectgarbage sq_collectgarbage;
extern sqapi_resurrectunreachable sq_resurrectunreachable; extern sqapi_resurrectunreachable sq_resurrectunreachable;
/*serialization*/ /*serialization*/
extern sqapi_writeclosure sq_writeclosure; extern sqapi_writeclosure sq_writeclosure;
extern sqapi_readclosure sq_readclosure; extern sqapi_readclosure sq_readclosure;
/*mem allocation*/ /*mem allocation*/
extern sqapi_malloc sq_malloc; extern sqapi_malloc sq_malloc;
extern sqapi_realloc sq_realloc; extern sqapi_realloc sq_realloc;
extern sqapi_free sq_free; extern sqapi_free sq_free;
/*debug*/ /*debug*/
extern sqapi_stackinfos sq_stackinfos; extern sqapi_stackinfos sq_stackinfos;
extern sqapi_setdebughook sq_setdebughook; extern sqapi_setdebughook sq_setdebughook;
extern sqapi_setnativedebughook sq_setnativedebughook; extern sqapi_setnativedebughook sq_setnativedebughook;
/*compiler helpers*/ /*compiler helpers*/
extern sqapi_loadfile sqstd_loadfile; extern sqapi_loadfile sqstd_loadfile;
extern sqapi_dofile sqstd_dofile; extern sqapi_dofile sqstd_dofile;
extern sqapi_writeclosuretofile sqstd_writeclosuretofile; extern sqapi_writeclosuretofile sqstd_writeclosuretofile;
/*blob*/ /*blob*/
extern sqapi_createblob sqstd_createblob; extern sqapi_createblob sqstd_createblob;
extern sqapi_getblob sqstd_getblob; extern sqapi_getblob sqstd_getblob;
extern sqapi_getblobsize sqstd_getblobsize; extern sqapi_getblobsize sqstd_getblobsize;
/*string*/ /*string*/
extern sqapi_format sqstd_format; extern sqapi_format sqstd_format;
#endif // SQMOD_PLUGIN_API #endif // SQMOD_PLUGIN_API

View File

@ -65,6 +65,7 @@ sqapi_getbase sq_getbase = NULL;
sqapi_instanceof sq_instanceof = NULL; sqapi_instanceof sq_instanceof = NULL;
sqapi_tostring sq_tostring = NULL; sqapi_tostring sq_tostring = NULL;
sqapi_tobool sq_tobool = NULL; sqapi_tobool sq_tobool = NULL;
sqapi_getstringandsize sq_getstringandsize = NULL;
sqapi_getstring sq_getstring = NULL; sqapi_getstring sq_getstring = NULL;
sqapi_getinteger sq_getinteger = NULL; sqapi_getinteger sq_getinteger = NULL;
sqapi_getfloat sq_getfloat = NULL; sqapi_getfloat sq_getfloat = NULL;
@ -277,6 +278,7 @@ SQRESULT sq_api_expand(HSQAPI sqapi)
sq_instanceof = sqapi->instanceof; sq_instanceof = sqapi->instanceof;
sq_tostring = sqapi->tostring; sq_tostring = sqapi->tostring;
sq_tobool = sqapi->tobool; sq_tobool = sqapi->tobool;
sq_getstringandsize = sqapi->getstringandsize;
sq_getstring = sqapi->getstring; sq_getstring = sqapi->getstring;
sq_getinteger = sqapi->getinteger; sq_getinteger = sqapi->getinteger;
sq_getfloat = sqapi->getfloat; sq_getfloat = sqapi->getfloat;
@ -467,6 +469,7 @@ void sq_api_collapse()
sq_instanceof = NULL; sq_instanceof = NULL;
sq_tostring = NULL; sq_tostring = NULL;
sq_tobool = NULL; sq_tobool = NULL;
sq_getstringandsize = NULL;
sq_getstring = NULL; sq_getstring = NULL;
sq_getinteger = NULL; sq_getinteger = NULL;
sq_getfloat = NULL; sq_getfloat = NULL;

View File

@ -348,6 +348,7 @@ void InitExports()
g_SqAPI.instanceof = sq_instanceof; g_SqAPI.instanceof = sq_instanceof;
g_SqAPI.tostring = sq_tostring; g_SqAPI.tostring = sq_tostring;
g_SqAPI.tobool = sq_tobool; g_SqAPI.tobool = sq_tobool;
g_SqAPI.getstringandsize = sq_getstringandsize;
g_SqAPI.getstring = sq_getstring; g_SqAPI.getstring = sq_getstring;
g_SqAPI.getinteger = sq_getinteger; g_SqAPI.getinteger = sq_getinteger;
g_SqAPI.getfloat = sq_getfloat; g_SqAPI.getfloat = sq_getfloat;