From: Tobias Markus Date: Wed, 21 Jan 2015 18:07:46 +0000 (+0100) Subject: Update to Squirrel 3.0.7 stable X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d9ff00962d744950131e233f556c6304eb6333c5;p=supertux.git Update to Squirrel 3.0.7 stable --- diff --git a/external/squirrel/COPYRIGHT b/external/squirrel/COPYRIGHT index 8e0c12fb1..0c6722370 100644 --- a/external/squirrel/COPYRIGHT +++ b/external/squirrel/COPYRIGHT @@ -1,4 +1,4 @@ -Copyright (c) 2003-2014 Alberto Demichelis +Copyright (c) 2003-2015 Alberto Demichelis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/external/squirrel/HISTORY b/external/squirrel/HISTORY index 53c09bdce..d5d32329e 100644 --- a/external/squirrel/HISTORY +++ b/external/squirrel/HISTORY @@ -1,3 +1,11 @@ +***version 3.0.7 stable*** +-newthread and sq_newthread() no longer resets the base lib function in the root table(thx Lucas Cardellini) +-exceptions in the _inherited metamethod are propagated(thx Lucas Cardellini) +-'in' operator performance improvement(thx unagipai and mingodad) +-fixed bug in print()(thx Lucas Cardellini) +-fixed some documentation bug + +***2014-04-02 *** ***version 3.0.6 stable*** -fixed compiler bug that can cause memory corruption, the bug was introduced in 3.0.5(thx Alex95) diff --git a/external/squirrel/include/squirrel.h b/external/squirrel/include/squirrel.h index d4fc8fb22..2532c5ba2 100644 --- a/external/squirrel/include/squirrel.h +++ b/external/squirrel/include/squirrel.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2014 Alberto Demichelis +Copyright (c) 2003-2015 Alberto Demichelis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -162,7 +162,7 @@ typedef char SQChar; #endif #define scatoi atoi #define scstrtoul strtoul -#define scvsprintf vsprintf +#define scvsprintf vsnprintf #define scstrstr strstr #define scisspace isspace #define scisdigit isdigit @@ -181,10 +181,10 @@ typedef char SQChar; #define _PRINT_INT_FMT _SC("%d") #endif -#define SQUIRREL_VERSION _SC("Squirrel 3.0.6 stable") -#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2014 Alberto Demichelis") +#define SQUIRREL_VERSION _SC("Squirrel 3.0.7 stable") +#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2015 Alberto Demichelis") #define SQUIRREL_AUTHOR _SC("Alberto Demichelis") -#define SQUIRREL_VERSION_NUMBER 306 +#define SQUIRREL_VERSION_NUMBER 307 #define SQ_VMSTATE_IDLE 0 #define SQ_VMSTATE_RUNNING 1 diff --git a/external/squirrel/sqstdlib/sqstdrex.cpp b/external/squirrel/sqstdlib/sqstdrex.cpp index 20aa57d9b..5444d27fa 100644 --- a/external/squirrel/sqstdlib/sqstdrex.cpp +++ b/external/squirrel/sqstdlib/sqstdrex.cpp @@ -459,7 +459,7 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar exp->_matches[capture].begin = cur; exp->_currsubexp++; } - int tempcap = exp->_currsubexp; + SQInteger tempcap = exp->_currsubexp; do { SQRexNode *subnext = NULL; if(n->next != -1) { diff --git a/external/squirrel/squirrel/sqbaselib.cpp b/external/squirrel/squirrel/sqbaselib.cpp index 4a7d39d88..e5520bbde 100644 --- a/external/squirrel/squirrel/sqbaselib.cpp +++ b/external/squirrel/squirrel/sqbaselib.cpp @@ -185,19 +185,27 @@ static SQInteger get_slice_params(HSQUIRRELVM v,SQInteger &sidx,SQInteger &eidx, static SQInteger base_print(HSQUIRRELVM v) { const SQChar *str; - sq_tostring(v,2); - sq_getstring(v,-1,&str); - if(_ss(v)->_printfunc) _ss(v)->_printfunc(v,_SC("%s"),str); - return 0; + if(SQ_SUCCEEDED(sq_tostring(v,2))) + { + if(SQ_SUCCEEDED(sq_getstring(v,-1,&str))) { + if(_ss(v)->_printfunc) _ss(v)->_printfunc(v,_SC("%s"),str); + return 0; + } + } + return SQ_ERROR; } static SQInteger base_error(HSQUIRRELVM v) { const SQChar *str; - sq_tostring(v,2); - sq_getstring(v,-1,&str); - if(_ss(v)->_errorfunc) _ss(v)->_errorfunc(v,_SC("%s"),str); - return 0; + if(SQ_SUCCEEDED(sq_tostring(v,2))) + { + if(SQ_SUCCEEDED(sq_getstring(v,-1,&str))) { + if(_ss(v)->_errorfunc) _ss(v)->_errorfunc(v,_SC("%s"),str); + return 0; + } + } + return SQ_ERROR; } static SQInteger base_compilestring(HSQUIRRELVM v) @@ -378,7 +386,8 @@ static SQInteger default_delegate_tointeger(HSQUIRRELVM v) static SQInteger default_delegate_tostring(HSQUIRRELVM v) { - sq_tostring(v,1); + if(SQ_FAILED(sq_tostring(v,1))) + return SQ_ERROR; return 1; } diff --git a/external/squirrel/squirrel/sqcompiler.cpp b/external/squirrel/squirrel/sqcompiler.cpp index fbd2993a9..add1a2877 100644 --- a/external/squirrel/squirrel/sqcompiler.cpp +++ b/external/squirrel/squirrel/sqcompiler.cpp @@ -80,7 +80,7 @@ public: _lineinfo = lineinfo;_raiseerror = raiseerror; _scope.outers = 0; _scope.stacksize = 0; - _compilererror[0] = '\0'; + _compilererror[0] = _SC('\0'); } static void ThrowError(void *ud, const SQChar *s) { SQCompiler *c = (SQCompiler *)ud; @@ -90,7 +90,7 @@ public: { va_list vl; va_start(vl, s); - scvsprintf(_compilererror, s, vl); + scvsprintf(_compilererror, MAX_COMPILER_ERROR_LEN, s, vl); va_end(vl); longjmp(_errorjmp,1); } diff --git a/external/squirrel/squirrel/sqdebug.cpp b/external/squirrel/squirrel/sqdebug.cpp index 6f392318a..ef82dd629 100644 --- a/external/squirrel/squirrel/sqdebug.cpp +++ b/external/squirrel/squirrel/sqdebug.cpp @@ -59,7 +59,8 @@ void SQVM::Raise_Error(const SQChar *s, ...) { va_list vl; va_start(vl, s); - scvsprintf(_sp(rsl((SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2))), s, vl); + SQInteger buffersize = (SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2); + scvsprintf(_sp(rsl(buffersize)),buffersize, s, vl); va_end(vl); _lasterror = SQString::Create(_ss(this),_spval,-1); } diff --git a/external/squirrel/squirrel/sqvm.cpp b/external/squirrel/squirrel/sqvm.cpp index 77e5eefb4..de0927f9d 100644 --- a/external/squirrel/squirrel/sqvm.cpp +++ b/external/squirrel/squirrel/sqvm.cpp @@ -349,8 +349,10 @@ bool SQVM::Init(SQVM *friendvm, SQInteger stacksize) _callsstack = &_callstackdata[0]; _stackbase = 0; _top = 0; - if(!friendvm) + if(!friendvm) { _roottable = SQTable::Create(_ss(this), 0); + sq_base_register(this); + } else { _roottable = friendvm->_roottable; _errorhandler = friendvm->_errorhandler; @@ -358,8 +360,6 @@ bool SQVM::Init(SQVM *friendvm, SQInteger stacksize) _debughook_native = friendvm->_debughook_native; _debughook_closure = friendvm->_debughook_closure; } - - sq_base_register(this); return true; } @@ -619,7 +619,10 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes int nparams = 2; SQObjectPtr ret; Push(target); Push(attrs); - Call(_class(target)->_metamethods[MT_INHERITED],nparams,_top - nparams, ret, false); + if(!Call(_class(target)->_metamethods[MT_INHERITED],nparams,_top - nparams, ret, false)) { + Pop(nparams); + return false; + } Pop(nparams); } _class(target)->_attributes = attrs; @@ -1190,7 +1193,7 @@ bool SQVM::Get(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &dest, if(_table(self)->Get(key,dest))return true; break; case OT_ARRAY: - if(sq_isnumeric(key)) { if(_array(self)->Get(tointeger(key),dest)) { return true; } Raise_IdxError(key); return false; } + if(sq_isnumeric(key)) { if(_array(self)->Get(tointeger(key),dest)) { return true; } if(selfidx != EXISTS_FALL_BACK) Raise_IdxError(key); return false; } break; case OT_INSTANCE: if(_instance(self)->Get(key,dest)) return true; @@ -1206,7 +1209,7 @@ bool SQVM::Get(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &dest, dest = SQInteger(_stringval(self)[n]); return true; } - Raise_IdxError(key); + if(selfidx != EXISTS_FALL_BACK) Raise_IdxError(key); return false; } break; @@ -1227,7 +1230,7 @@ bool SQVM::Get(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &dest, if(_table(_roottable)->Get(key,dest)) return true; } //#endif - Raise_IdxError(key); + if(selfidx != EXISTS_FALL_BACK) Raise_IdxError(key); return false; } diff --git a/external/squirrel/squirrel/sqvm.h b/external/squirrel/squirrel/sqvm.h index 13b370681..011a24d35 100644 --- a/external/squirrel/squirrel/sqvm.h +++ b/external/squirrel/squirrel/sqvm.h @@ -9,6 +9,7 @@ #define SQ_SUSPEND_FLAG -666 #define DONT_FALL_BACK 666 +#define EXISTS_FALL_BACK -1 //base lib void sq_base_register(HSQUIRRELVM v);