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

Updated the Squirrel library to include the latest changes straight from the repository.

This commit is contained in:
Sandu Liviu Catalin 2016-08-03 16:39:37 +03:00
parent c5192399e2
commit e0cd48e639
7 changed files with 26 additions and 10 deletions

View File

@ -510,7 +510,7 @@ SQRESULT sq_setclosureroot(HSQUIRRELVM v,SQInteger idx)
v->Pop();
return SQ_OK;
}
return sq_throwerror(v, _SC("ivalid type"));
return sq_throwerror(v, _SC("invalid type"));
}
SQRESULT sq_getclosureroot(HSQUIRRELVM v,SQInteger idx)
@ -558,7 +558,7 @@ SQRESULT sq_setroottable(HSQUIRRELVM v)
v->Pop();
return SQ_OK;
}
return sq_throwerror(v, _SC("ivalid type"));
return sq_throwerror(v, _SC("invalid type"));
}
SQRESULT sq_setconsttable(HSQUIRRELVM v)
@ -569,7 +569,7 @@ SQRESULT sq_setconsttable(HSQUIRRELVM v)
v->Pop();
return SQ_OK;
}
return sq_throwerror(v, _SC("ivalid type, expected table"));
return sq_throwerror(v, _SC("invalid type, expected table"));
}
void sq_setforeignptr(HSQUIRRELVM v,SQUserPointer p)
@ -657,6 +657,10 @@ SQRESULT sq_getinteger(HSQUIRRELVM v,SQInteger idx,SQInteger *i)
*i = tointeger(o);
return SQ_OK;
}
if(sq_isbool(o)) {
*i = SQVM::IsFalse(o)?SQFalse:SQTrue;
return SQ_OK;
}
return SQ_ERROR;
}
@ -1164,7 +1168,7 @@ SQRESULT sq_call(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror)
if(v->Call(v->GetUp(-(params+1)),params,v->_top-params,res,raiseerror?true:false)){
if(!v->_suspended) {
v->Pop(params);//pop closure and args
v->Pop(params);//pop args
}
if(retval){
v->Push(res); return SQ_OK;
@ -1239,7 +1243,7 @@ SQRESULT sq_writeclosure(HSQUIRRELVM v,SQWRITEFUNC w,SQUserPointer up)
_GETSAFE_OBJ(v, -1, OT_CLOSURE,o);
unsigned short tag = SQ_BYTECODE_STREAM_TAG;
if(_closure(*o)->_function->_noutervalues)
return sq_throwerror(v,_SC("a closure with free valiables bound it cannot be serialized"));
return sq_throwerror(v,_SC("a closure with free variables bound cannot be serialized"));
if(w(up,&tag,2) != 2)
return sq_throwerror(v,_SC("io error"));
if(!_closure(*o)->Save(v,up,w))

View File

@ -189,7 +189,7 @@ SQInstance::~SQInstance()
if(_class){ Finalize(); } //if _class is null it was already finalized by the GC
}
bool SQInstance::GetMetaMethod(SQVM SQ_UNUSED_ARG(*v),SQMetaMethod mm,SQObjectPtr &res)
bool SQInstance::GetMetaMethod(SQVM* SQ_UNUSED_ARG(v),SQMetaMethod mm,SQObjectPtr &res)
{
if(type(_class->_metamethods[mm]) != OT_NULL) {
res = _class->_metamethods[mm];

View File

@ -859,6 +859,7 @@ public:
case TK_TYPEOF : Lex() ;UnaryOP(_OP_TYPEOF); break;
case TK_RESUME : Lex(); UnaryOP(_OP_RESUME); break;
case TK_CLONE : Lex(); UnaryOP(_OP_CLONE); break;
case TK_RAWCALL: Lex(); Expect('('); FunctionCallArgs(true); break;
case TK_MINUSMINUS :
case TK_PLUSPLUS :PrefixIncDec(_token); break;
case TK_DELETE : DeleteExpr(); break;
@ -915,7 +916,7 @@ public:
}
return (!_es.donot_get || ( _es.donot_get && (_token == _SC('.') || _token == _SC('['))));
}
void FunctionCallArgs()
void FunctionCallArgs(bool rawcall = false)
{
SQInteger nargs = 1;//this
while(_token != _SC(')')) {
@ -928,6 +929,10 @@ public:
}
}
Lex();
if (rawcall) {
if (nargs < 3) Error(_SC("rawcall requires at least 2 parameters (callee and this)"));
nargs -= 2; //removes callee and this from count
}
for(SQInteger i = 0; i < (nargs - 1); i++) _fs->PopTarget();
SQInteger stackbase = _fs->PopTarget();
SQInteger closure = _fs->PopTarget();
@ -1337,11 +1342,11 @@ public:
val._unVal.fFloat = -_lex._fvalue;
break;
default:
Error(_SC("scalar expected : integer,float"));
Error(_SC("scalar expected : integer, float"));
}
break;
default:
Error(_SC("scalar expected : integer,float or string"));
Error(_SC("scalar expected : integer, float, or string"));
}
Lex();
return val;

View File

@ -70,6 +70,7 @@ struct SQVM;
#define TK_STATIC 322
#define TK_ENUM 323
#define TK_CONST 324
#define TK_RAWCALL 325

View File

@ -67,6 +67,8 @@ void SQLexer::Init(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up,Compile
ADD_KEYWORD(const,TK_CONST);
ADD_KEYWORD(__LINE__,TK___LINE__);
ADD_KEYWORD(__FILE__,TK___FILE__);
ADD_KEYWORD(rawcall, TK_RAWCALL);
_readf = rg;
_up = up;

View File

@ -241,7 +241,7 @@ void SQSharedState::MarkObject(SQObjectPtr &o,SQCollectable **chain)
}
}
void SQSharedState::RunMark(SQVM SQ_UNUSED_ARG(*vm),SQCollectable **tchain)
void SQSharedState::RunMark(SQVM* SQ_UNUSED_ARG(vm),SQCollectable **tchain)
{
SQVM *vms = _thread(_root_vm);

View File

@ -22,6 +22,10 @@ THE SOFTWARE.
#ifndef _SQUIRREL_H_
#define _SQUIRREL_H_
#ifdef _SQ_CONFIG_INCLUDE
#include _SQ_CONFIG_INCLUDE
#endif
#ifdef __cplusplus
extern "C" {
#endif