-Copyright (c) 2003-2014 Alberto Demichelis\r
+Copyright (c) 2003-2015 Alberto Demichelis\r
\r
Permission is hereby granted, free of charge, to any person obtaining a copy\r
of this software and associated documentation files (the "Software"), to deal\r
+***version 3.0.7 stable***\r
+-newthread and sq_newthread() no longer resets the base lib function in the root table(thx Lucas Cardellini)\r
+-exceptions in the _inherited metamethod are propagated(thx Lucas Cardellini)\r
+-'in' operator performance improvement(thx unagipai and mingodad)\r
+-fixed bug in print()(thx Lucas Cardellini)\r
+-fixed some documentation bug\r
+\r
+***2014-04-02 ***\r
***version 3.0.6 stable***\r
-fixed compiler bug that can cause memory corruption, the bug was introduced in 3.0.5(thx Alex95)\r
\r
/*\r
-Copyright (c) 2003-2014 Alberto Demichelis\r
+Copyright (c) 2003-2015 Alberto Demichelis\r
\r
Permission is hereby granted, free of charge, to any person obtaining a copy\r
of this software and associated documentation files (the "Software"), to deal\r
#endif\r
#define scatoi atoi\r
#define scstrtoul strtoul\r
-#define scvsprintf vsprintf\r
+#define scvsprintf vsnprintf\r
#define scstrstr strstr\r
#define scisspace isspace\r
#define scisdigit isdigit\r
#define _PRINT_INT_FMT _SC("%d")\r
#endif\r
\r
-#define SQUIRREL_VERSION _SC("Squirrel 3.0.6 stable")\r
-#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2014 Alberto Demichelis")\r
+#define SQUIRREL_VERSION _SC("Squirrel 3.0.7 stable")\r
+#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2015 Alberto Demichelis")\r
#define SQUIRREL_AUTHOR _SC("Alberto Demichelis")\r
-#define SQUIRREL_VERSION_NUMBER 306\r
+#define SQUIRREL_VERSION_NUMBER 307\r
\r
#define SQ_VMSTATE_IDLE 0\r
#define SQ_VMSTATE_RUNNING 1\r
exp->_matches[capture].begin = cur;\r
exp->_currsubexp++;\r
}\r
- int tempcap = exp->_currsubexp;\r
+ SQInteger tempcap = exp->_currsubexp;\r
do {\r
SQRexNode *subnext = NULL;\r
if(n->next != -1) {\r
static SQInteger base_print(HSQUIRRELVM v)\r
{\r
const SQChar *str;\r
- sq_tostring(v,2);\r
- sq_getstring(v,-1,&str);\r
- if(_ss(v)->_printfunc) _ss(v)->_printfunc(v,_SC("%s"),str);\r
- return 0;\r
+ if(SQ_SUCCEEDED(sq_tostring(v,2)))\r
+ {\r
+ if(SQ_SUCCEEDED(sq_getstring(v,-1,&str))) {\r
+ if(_ss(v)->_printfunc) _ss(v)->_printfunc(v,_SC("%s"),str);\r
+ return 0;\r
+ }\r
+ }\r
+ return SQ_ERROR;\r
}\r
\r
static SQInteger base_error(HSQUIRRELVM v)\r
{\r
const SQChar *str;\r
- sq_tostring(v,2);\r
- sq_getstring(v,-1,&str);\r
- if(_ss(v)->_errorfunc) _ss(v)->_errorfunc(v,_SC("%s"),str);\r
- return 0;\r
+ if(SQ_SUCCEEDED(sq_tostring(v,2)))\r
+ {\r
+ if(SQ_SUCCEEDED(sq_getstring(v,-1,&str))) {\r
+ if(_ss(v)->_errorfunc) _ss(v)->_errorfunc(v,_SC("%s"),str);\r
+ return 0;\r
+ }\r
+ }\r
+ return SQ_ERROR;\r
}\r
\r
static SQInteger base_compilestring(HSQUIRRELVM v)\r
\r
static SQInteger default_delegate_tostring(HSQUIRRELVM v)\r
{\r
- sq_tostring(v,1);\r
+ if(SQ_FAILED(sq_tostring(v,1))) \r
+ return SQ_ERROR;\r
return 1;\r
}\r
\r
_lineinfo = lineinfo;_raiseerror = raiseerror;\r
_scope.outers = 0;\r
_scope.stacksize = 0;\r
- _compilererror[0] = '\0';\r
+ _compilererror[0] = _SC('\0');\r
}\r
static void ThrowError(void *ud, const SQChar *s) {\r
SQCompiler *c = (SQCompiler *)ud;\r
{\r
va_list vl;\r
va_start(vl, s);\r
- scvsprintf(_compilererror, s, vl);\r
+ scvsprintf(_compilererror, MAX_COMPILER_ERROR_LEN, s, vl);\r
va_end(vl);\r
longjmp(_errorjmp,1);\r
}\r
{\r
va_list vl;\r
va_start(vl, s);\r
- scvsprintf(_sp(rsl((SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2))), s, vl);\r
+ SQInteger buffersize = (SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2);\r
+ scvsprintf(_sp(rsl(buffersize)),buffersize, s, vl);\r
va_end(vl);\r
_lasterror = SQString::Create(_ss(this),_spval,-1);\r
}\r
_callsstack = &_callstackdata[0];\r
_stackbase = 0;\r
_top = 0;\r
- if(!friendvm) \r
+ if(!friendvm) {\r
_roottable = SQTable::Create(_ss(this), 0);\r
+ sq_base_register(this);\r
+ }\r
else {\r
_roottable = friendvm->_roottable;\r
_errorhandler = friendvm->_errorhandler;\r
_debughook_native = friendvm->_debughook_native;\r
_debughook_closure = friendvm->_debughook_closure;\r
}\r
- \r
- sq_base_register(this);\r
return true;\r
}\r
\r
int nparams = 2;\r
SQObjectPtr ret;\r
Push(target); Push(attrs);\r
- Call(_class(target)->_metamethods[MT_INHERITED],nparams,_top - nparams, ret, false);\r
+ if(!Call(_class(target)->_metamethods[MT_INHERITED],nparams,_top - nparams, ret, false)) {\r
+ Pop(nparams);\r
+ return false;\r
+ }\r
Pop(nparams);\r
}\r
_class(target)->_attributes = attrs;\r
if(_table(self)->Get(key,dest))return true;\r
break;\r
case OT_ARRAY:\r
- if(sq_isnumeric(key)) { if(_array(self)->Get(tointeger(key),dest)) { return true; } Raise_IdxError(key); return false; }\r
+ if(sq_isnumeric(key)) { if(_array(self)->Get(tointeger(key),dest)) { return true; } if(selfidx != EXISTS_FALL_BACK) Raise_IdxError(key); return false; }\r
break;\r
case OT_INSTANCE:\r
if(_instance(self)->Get(key,dest)) return true;\r
dest = SQInteger(_stringval(self)[n]);\r
return true;\r
}\r
- Raise_IdxError(key);\r
+ if(selfidx != EXISTS_FALL_BACK) Raise_IdxError(key);\r
return false;\r
}\r
break;\r
if(_table(_roottable)->Get(key,dest)) return true;\r
}\r
//#endif\r
- Raise_IdxError(key);\r
+ if(selfidx != EXISTS_FALL_BACK) Raise_IdxError(key);\r
return false;\r
}\r
\r
\r
#define SQ_SUSPEND_FLAG -666\r
#define DONT_FALL_BACK 666\r
+#define EXISTS_FALL_BACK -1\r
//base lib\r
void sq_base_register(HSQUIRRELVM v);\r
\r