summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
authorRubidium <rubidium@openttd.org>2021-06-16 21:15:40 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-06-17 16:18:30 +0200
commita9774f3e341812d43427b9e0166b0def08202477 (patch)
tree817319fa28a81cf204e93e7bef946ca8c67ba181 /src/3rdparty
parent3237e97b3592d4f3920dab556d551da65a465b8d (diff)
downloadopenttd-a9774f3e341812d43427b9e0166b0def08202477.tar.xz
Cleanup: [Squirrel] Use nullptr instead of 0 or NULL
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp4
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp4
-rw-r--r--src/3rdparty/squirrel/squirrel/sqapi.cpp46
-rw-r--r--src/3rdparty/squirrel/squirrel/sqbaselib.cpp50
-rw-r--r--src/3rdparty/squirrel/squirrel/sqclass.cpp10
-rw-r--r--src/3rdparty/squirrel/squirrel/sqclosure.h2
-rw-r--r--src/3rdparty/squirrel/squirrel/sqcompiler.cpp4
-rw-r--r--src/3rdparty/squirrel/squirrel/sqlexer.cpp4
-rw-r--r--src/3rdparty/squirrel/squirrel/sqobject.cpp10
-rw-r--r--src/3rdparty/squirrel/squirrel/sqobject.h6
-rw-r--r--src/3rdparty/squirrel/squirrel/sqstate.cpp44
-rw-r--r--src/3rdparty/squirrel/squirrel/sqtable.cpp12
-rw-r--r--src/3rdparty/squirrel/squirrel/sqtable.h8
-rw-r--r--src/3rdparty/squirrel/squirrel/squserdata.h6
-rw-r--r--src/3rdparty/squirrel/squirrel/squtils.h2
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp18
16 files changed, 115 insertions, 115 deletions
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
index a4f4e21c3..4eaa2cb3c 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
@@ -17,7 +17,7 @@ void sqstd_printcallstack(HSQUIRRELVM v)
SQFloat f;
const SQChar *s;
SQInteger level=1; //1 is to skip this function that is level 0
- const SQChar *name=0;
+ const SQChar *name=nullptr;
SQInteger seq=0;
pf(v,"\nCALLSTACK\n");
while(SQ_SUCCEEDED(sq_stackinfos(v,level,&si)))
@@ -116,7 +116,7 @@ static SQInteger _sqstd_aux_printerror(HSQUIRRELVM v)
{
SQPRINTFUNCTION pf = sq_getprintfunc(v);
if(pf) {
- const SQChar *sErr = 0;
+ const SQChar *sErr = nullptr;
if(sq_gettop(v)>=1) {
if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr))) {
pf(v,"\nAN ERROR HAS OCCURRED [%s]\n",sErr);
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
index 0ff009020..3ba6811a6 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
@@ -88,7 +88,7 @@ static SQRegFunction mathlib_funcs[] = {
#endif /* EXPORT_DEFAULT_SQUIRREL_FUNCTIONS */
_DECL_FUNC(fabs,2,".n"),
_DECL_FUNC(abs,2,".n"),
- {0,0,0,0},
+ {nullptr,nullptr,0,nullptr},
};
#ifndef M_PI
@@ -98,7 +98,7 @@ static SQRegFunction mathlib_funcs[] = {
SQRESULT sqstd_register_mathlib(HSQUIRRELVM v)
{
SQInteger i=0;
- while(mathlib_funcs[i].name!=0) {
+ while(mathlib_funcs[i].name!=nullptr) {
sq_pushstring(v,mathlib_funcs[i].name,-1);
sq_newclosure(v,mathlib_funcs[i].f,0);
sq_setparamscheck(v,mathlib_funcs[i].nparamscheck,mathlib_funcs[i].typemask);
diff --git a/src/3rdparty/squirrel/squirrel/sqapi.cpp b/src/3rdparty/squirrel/squirrel/sqapi.cpp
index 0d769bf1f..aeef3779b 100644
--- a/src/3rdparty/squirrel/squirrel/sqapi.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqapi.cpp
@@ -60,11 +60,11 @@ HSQUIRRELVM sq_open(SQInteger initialstacksize)
v = (SQVM *)SQ_MALLOC(sizeof(SQVM));
new (v) SQVM(ss);
ss->_root_vm = v;
- if(v->Init(NULL, initialstacksize)) {
+ if(v->Init(nullptr, initialstacksize)) {
return v;
} else {
sq_delete(v, SQVM);
- return NULL;
+ return nullptr;
}
return v;
}
@@ -83,7 +83,7 @@ HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize)
return v;
} else {
sq_delete(v, SQVM);
- return NULL;
+ return nullptr;
}
}
@@ -178,7 +178,7 @@ const SQChar *sq_objtostring(HSQOBJECT *o)
if(sq_type(*o) == OT_STRING) {
return _stringval(*o);
}
- return NULL;
+ return nullptr;
}
SQInteger sq_objtointeger(HSQOBJECT *o)
@@ -256,7 +256,7 @@ void sq_newarray(HSQUIRRELVM v,SQInteger size)
SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase)
{
- SQClass *baseclass = NULL;
+ SQClass *baseclass = nullptr;
if(hasbase) {
SQObjectPtr &base = stack_get(v,-1);
if(type(base) != OT_CLASS)
@@ -555,7 +555,7 @@ SQRESULT sq_getbool(HSQUIRRELVM v,SQInteger idx,SQBool *b)
SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_STRING,o);
*c = _stringval(*o);
return SQ_OK;
@@ -563,7 +563,7 @@ SQRESULT sq_getstring(HSQUIRRELVM v,SQInteger idx,const SQChar **c)
SQRESULT sq_getthread(HSQUIRRELVM v,SQInteger idx,HSQUIRRELVM *thread)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_THREAD,o);
*thread = _thread(*o);
return SQ_OK;
@@ -598,7 +598,7 @@ SQInteger sq_getsize(HSQUIRRELVM v, SQInteger idx)
SQRESULT sq_getuserdata(HSQUIRRELVM v,SQInteger idx,SQUserPointer *p,SQUserPointer *typetag)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_USERDATA,o);
(*p) = _userdataval(*o);
if(typetag) *typetag = _userdata(*o)->_typetag;
@@ -637,7 +637,7 @@ SQRESULT sq_gettypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer *typetag)
SQRESULT sq_getuserpointer(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_USERPOINTER,o);
(*p) = _userpointer(*o);
return SQ_OK;
@@ -666,13 +666,13 @@ SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserP
SQObjectPtr &o = stack_get(v,idx);
if(type(o) != OT_INSTANCE) return sq_throwerror(v,"the object is not a class instance");
(*p) = _instance(o)->_userpointer;
- if(typetag != 0) {
+ if(typetag != nullptr) {
SQClass *cl = _instance(o)->_class;
do{
if(cl->_typetag == typetag)
return SQ_OK;
cl = cl->_base;
- }while(cl != NULL);
+ }while(cl != nullptr);
return sq_throwerror(v,"invalid type tag");
}
return SQ_OK;
@@ -801,14 +801,14 @@ SQRESULT sq_setdelegate(HSQUIRRELVM v,SQInteger idx)
if(!_table(self)->SetDelegate(_table(mt))) return sq_throwerror(v, "delagate cycle");
v->Pop();}
else if(type(mt)==OT_NULL) {
- _table(self)->SetDelegate(NULL); v->Pop(); }
+ _table(self)->SetDelegate(nullptr); v->Pop(); }
else return sq_aux_invalidtype(v,type);
break;
case OT_USERDATA:
if(type(mt)==OT_TABLE) {
_userdata(self)->SetDelegate(_table(mt)); v->Pop(); }
else if(type(mt)==OT_NULL) {
- _userdata(self)->SetDelegate(NULL); v->Pop(); }
+ _userdata(self)->SetDelegate(nullptr); v->Pop(); }
else return sq_aux_invalidtype(v, type);
break;
default:
@@ -909,7 +909,7 @@ const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedIntege
}
SQVM::CallInfo &ci=v->_callsstack[lvl];
if(type(ci._closure)!=OT_CLOSURE)
- return NULL;
+ return nullptr;
SQClosure *c=_closure(ci._closure);
SQFunctionProto *func=_funcproto(c->_function);
if(func->_noutervalues > (SQInteger)idx) {
@@ -919,7 +919,7 @@ const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedIntege
idx -= func->_noutervalues;
return func->GetLocal(v,stackbase,idx,(SQInteger)(ci._ip-func->_instructions)-1);
}
- return NULL;
+ return nullptr;
}
void sq_pushobject(HSQUIRRELVM v,HSQOBJECT obj)
@@ -929,7 +929,7 @@ void sq_pushobject(HSQUIRRELVM v,HSQOBJECT obj)
void sq_resetobject(HSQOBJECT *po)
{
- po->_unVal.pUserPointer=NULL;po->_type=OT_NULL;
+ po->_unVal.pUserPointer=nullptr;po->_type=OT_NULL;
}
SQRESULT sq_throwerror(HSQUIRRELVM v,const SQChar *err)
@@ -1051,7 +1051,7 @@ void sq_setcompilererrorhandler(HSQUIRRELVM v,SQCOMPILERERROR f)
SQRESULT sq_writeclosure(HSQUIRRELVM v,SQWRITEFUNC w,SQUserPointer up)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, -1, OT_CLOSURE,o);
unsigned short tag = SQ_BYTECODE_STREAM_TAG;
if(w(up,&tag,2) != 2)
@@ -1093,7 +1093,7 @@ SQInteger sq_collectgarbage(HSQUIRRELVM v)
const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval)
{
SQObjectPtr &self = stack_get(v,idx);
- const SQChar *name = NULL;
+ const SQChar *name = nullptr;
if(type(self) == OT_CLOSURE) {
if(_closure(self)->_outervalues.size()>nval) {
v->Push(_closure(self)->_outervalues[nval]);
@@ -1131,7 +1131,7 @@ SQRESULT sq_setfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval)
SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
SQObjectPtr &key = stack_get(v,-2);
SQObjectPtr &val = stack_get(v,-1);
@@ -1153,7 +1153,7 @@ SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx)
SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
SQObjectPtr &key = stack_get(v,-1);
SQObjectPtr attrs;
@@ -1173,7 +1173,7 @@ SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
if(_class(*o)->_base)
v->Push(SQObjectPtr(_class(*o)->_base));
@@ -1184,7 +1184,7 @@ SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx)
SQRESULT sq_getclass(HSQUIRRELVM v,SQInteger idx)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_INSTANCE,o);
v->Push(SQObjectPtr(_instance(*o)->_class));
return SQ_OK;
@@ -1192,7 +1192,7 @@ SQRESULT sq_getclass(HSQUIRRELVM v,SQInteger idx)
SQRESULT sq_createinstance(HSQUIRRELVM v,SQInteger idx)
{
- SQObjectPtr *o = NULL;
+ SQObjectPtr *o = nullptr;
_GETSAFE_OBJ(v, idx, OT_CLASS,o);
v->Push(_class(*o)->CreateInstance());
return SQ_OK;
diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
index 232c27d2b..c542ee5a4 100644
--- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
@@ -248,29 +248,29 @@ static SQRegFunction base_funcs[]={
{"getconsttable",base_getconsttable,1, NULL},
{"setconsttable",base_setconsttable,2, NULL},
#endif
- {"assert",base_assert,2, NULL},
- {"print",base_print,2, NULL},
+ {"assert",base_assert,2, nullptr},
+ {"print",base_print,2, nullptr},
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
{"compilestring",base_compilestring,-2, ".ss"},
{"newthread",base_newthread,2, ".c"},
{"suspend",base_suspend,-1, NULL},
#endif
{"array",base_array,-2, ".n"},
- {"type",base_type,2, NULL},
+ {"type",base_type,2, nullptr},
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
{"dummy",base_dummy,0,NULL},
#ifndef NO_GARBAGE_COLLECTOR
{"collectgarbage",base_collectgarbage,1, "t"},
#endif
#endif
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
void sq_base_register(HSQUIRRELVM v)
{
SQInteger i=0;
sq_pushroottable(v);
- while(base_funcs[i].name!=0) {
+ while(base_funcs[i].name!=nullptr) {
sq_pushstring(v,base_funcs[i].name,-1);
sq_newclosure(v,base_funcs[i].f,0);
sq_setnativeclosurename(v,-1,base_funcs[i].name);
@@ -415,10 +415,10 @@ SQRegFunction SQSharedState::_table_default_delegate_funcz[]={
{"rawset",table_rawset,3, "t"},
{"rawdelete",table_rawdelete,2, "t"},
{"rawin",container_rawexists,2, "t"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
{"clear",obj_clear,1, "."},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
//ARRAY DEFAULT DELEGATE///////////////////////////////////////
@@ -624,10 +624,10 @@ SQRegFunction SQSharedState::_array_default_delegate_funcz[]={
{"reverse",array_reverse,1, "a"},
{"sort",array_sort,-1, "ac"},
{"slice",array_slice,-1, "ann"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
{"clear",obj_clear,1, "."},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
//STRING DEFAULT DELEGATE//////////////////////////
@@ -687,8 +687,8 @@ SQRegFunction SQSharedState::_string_default_delegate_funcz[]={
{"find",string_find,-2, "s s n "},
{"tolower",string_tolower,1, "s"},
{"toupper",string_toupper,1, "s"},
- {"weakref",obj_delegate_weakref,1, NULL },
- {0,0,0,0}
+ {"weakref",obj_delegate_weakref,1, nullptr },
+ {nullptr,nullptr,0,nullptr}
};
//INTEGER DEFAULT DELEGATE//////////////////////////
@@ -697,8 +697,8 @@ SQRegFunction SQSharedState::_number_default_delegate_funcz[]={
{"tofloat",default_delegate_tofloat,1, "n|b"},
{"tostring",default_delegate_tostring,1, "."},
{"tochar",number_delegate_tochar,1, "n|b"},
- {"weakref",obj_delegate_weakref,1, NULL },
- {0,0,0,0}
+ {"weakref",obj_delegate_weakref,1, nullptr },
+ {nullptr,nullptr,0,nullptr}
};
//CLOSURE DEFAULT DELEGATE//////////////////////////
@@ -782,11 +782,11 @@ SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={
{"pcall",closure_pcall,-1, "c"},
{"acall",closure_acall,2, "ca"},
{"pacall",closure_pacall,2, "ca"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
{"bindenv",closure_bindenv,2, "c x|y|t"},
{"getinfos",closure_getinfos,1, "c"},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
//GENERATOR DEFAULT DELEGATE
@@ -803,9 +803,9 @@ static SQInteger generator_getstatus(HSQUIRRELVM v)
SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={
{"getstatus",generator_getstatus,1, "g"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
//THREAD DEFAULT DELEGATE
@@ -889,9 +889,9 @@ SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = {
{"call", thread_call, -1, "v"},
{"wakeup", thread_wakeup, -1, "v"},
{"getstatus", thread_getstatus, 1, "v"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
- {0,0,0,0},
+ {nullptr,nullptr,0,nullptr},
};
static SQInteger class_getattributes(HSQUIRRELVM v)
@@ -919,10 +919,10 @@ SQRegFunction SQSharedState::_class_default_delegate_funcz[] = {
{"getattributes", class_getattributes, 2, "y."},
{"setattributes", class_setattributes, 3, "y.."},
{"rawin",container_rawexists,2, "y"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
{"instance",class_instance,1, "y"},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
static SQInteger instance_getclass(HSQUIRRELVM v)
@@ -935,9 +935,9 @@ static SQInteger instance_getclass(HSQUIRRELVM v)
SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = {
{"getclass", instance_getclass, 1, "x"},
{"rawin",container_rawexists,2, "x"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
static SQInteger weakref_ref(HSQUIRRELVM v)
@@ -949,9 +949,9 @@ static SQInteger weakref_ref(HSQUIRRELVM v)
SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = {
{"ref",weakref_ref,1, "r"},
- {"weakref",obj_delegate_weakref,1, NULL },
+ {"weakref",obj_delegate_weakref,1, nullptr },
{"tostring",default_delegate_tostring,1, "."},
- {0,0,0,0}
+ {nullptr,nullptr,0,nullptr}
};
diff --git a/src/3rdparty/squirrel/squirrel/sqclass.cpp b/src/3rdparty/squirrel/squirrel/sqclass.cpp
index 71743f464..643685c9e 100644
--- a/src/3rdparty/squirrel/squirrel/sqclass.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqclass.cpp
@@ -15,8 +15,8 @@
SQClass::SQClass(SQSharedState *ss,SQClass *base)
{
_base = base;
- _typetag = 0;
- _hook = NULL;
+ _typetag = nullptr;
+ _hook = nullptr;
_udsize = 0;
_metamethods.resize(MT_LAST); //size it to max size
if(_base) {
@@ -139,8 +139,8 @@ bool SQClass::GetAttributes(const SQObjectPtr &key,SQObjectPtr &outval)
///////////////////////////////////////////////////////////////////////
void SQInstance::Init(SQSharedState *ss)
{
- _userpointer = NULL;
- _hook = NULL;
+ _userpointer = nullptr;
+ _hook = nullptr;
__ObjAddRef(_class);
_delegate = _class->_members;
INIT_CHAIN();
@@ -196,7 +196,7 @@ bool SQInstance::GetMetaMethod(SQVM *v,SQMetaMethod mm,SQObjectPtr &res)
bool SQInstance::InstanceOf(SQClass *trg)
{
SQClass *parent = _class;
- while(parent != NULL) {
+ while(parent != nullptr) {
if(parent == trg)
return true;
parent = parent->_base;
diff --git a/src/3rdparty/squirrel/squirrel/sqclosure.h b/src/3rdparty/squirrel/squirrel/sqclosure.h
index 8480fb8af..49a84b792 100644
--- a/src/3rdparty/squirrel/squirrel/sqclosure.h
+++ b/src/3rdparty/squirrel/squirrel/sqclosure.h
@@ -45,7 +45,7 @@ struct SQGenerator : public CHAINABLE_OBJ
{
enum SQGeneratorState{eRunning,eSuspended,eDead};
private:
- SQGenerator(SQSharedState *ss,SQClosure *closure){_closure=closure;_state=eRunning;_ci._generator=NULL;INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);}
+ SQGenerator(SQSharedState *ss,SQClosure *closure){_closure=closure;_state=eRunning;_ci._generator=nullptr;INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);}
public:
static SQGenerator *Create(SQSharedState *ss,SQClosure *closure){
SQGenerator *nc=(SQGenerator*)SQ_MALLOC(sizeof(SQGenerator));
diff --git a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
index a80e08639..3af111a28 100644
--- a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
@@ -57,7 +57,7 @@ typedef sqvector<ExpState> ExpStateVec;
class SQCompiler
{
public:
- SQCompiler(SQVM *v, SQLEXREADFUNC rg, SQUserPointer up, const SQChar* sourcename, bool raiseerror, bool lineinfo) : _token(0), _fs(NULL), _lex(_ss(v), rg, up, ThrowError, this), _debugline(0), _debugop(0)
+ SQCompiler(SQVM *v, SQLEXREADFUNC rg, SQUserPointer up, const SQChar* sourcename, bool raiseerror, bool lineinfo) : _token(0), _fs(nullptr), _lex(_ss(v), rg, up, ThrowError, this), _debugline(0), _debugop(0)
{
_vm=v;
_sourcename = SQString::Create(_ss(v), sourcename);
@@ -164,7 +164,7 @@ public:
_debugline = 1;
_debugop = 0;
- SQFuncState funcstate(_ss(_vm), NULL,ThrowError,this);
+ SQFuncState funcstate(_ss(_vm), nullptr,ThrowError,this);
funcstate._name = SQString::Create(_ss(_vm), "main");
_fs = &funcstate;
_fs->AddParameter(_fs->CreateString("this"));
diff --git a/src/3rdparty/squirrel/squirrel/sqlexer.cpp b/src/3rdparty/squirrel/squirrel/sqlexer.cpp
index 77c487a26..a4bac8227 100644
--- a/src/3rdparty/squirrel/squirrel/sqlexer.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqlexer.cpp
@@ -87,7 +87,7 @@ SQLexer::SQLexer(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up,CompilerE
_prevtoken = -1;
_curtoken = -1;
- _svalue = NULL;
+ _svalue = nullptr;
_nvalue = 0;
_fvalue = 0;
@@ -119,7 +119,7 @@ const SQChar *SQLexer::Tok2Str(SQInteger tok)
if(((SQInteger)_integer(val)) == tok)
return _stringval(key);
}
- return NULL;
+ return nullptr;
}
void SQLexer::LexBlockComment()
diff --git a/src/3rdparty/squirrel/squirrel/sqobject.cpp b/src/3rdparty/squirrel/squirrel/sqobject.cpp
index a113f316d..298efe610 100644
--- a/src/3rdparty/squirrel/squirrel/sqobject.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqobject.cpp
@@ -41,7 +41,7 @@ const SQChar *IdType2Name(SQObjectType type)
case _RT_INSTANCE: return "instance";
case _RT_WEAKREF: return "weakref";
default:
- return NULL;
+ return nullptr;
}
}
@@ -101,13 +101,13 @@ SQRefCounted::~SQRefCounted()
{
if(_weakref) {
_weakref->_obj._type = OT_NULL;
- _weakref->_obj._unVal.pRefCounted = NULL;
+ _weakref->_obj._unVal.pRefCounted = nullptr;
}
}
void SQWeakRef::Release() {
if(ISREFCOUNTED(_obj._type)) {
- _obj._unVal.pRefCounted->_weakref = NULL;
+ _obj._unVal.pRefCounted->_weakref = nullptr;
}
sq_delete(this,SQWeakRef);
}
@@ -149,7 +149,7 @@ bool SQGenerator::Yield(SQVM *v)
for(SQInteger j = nvargs - 1; j >= 0; j--) {
_vargsstack.push_back(v->_vargsstack[vargsbase+j]);
}
- _ci._generator=NULL;
+ _ci._generator=nullptr;
for(SQInteger i=0;i<_ci._etraps;i++) {
_etraps.push_back(v->_etraps.top());
v->_etraps.pop_back();
@@ -204,7 +204,7 @@ void SQArray::Extend(const SQArray *a){
const SQChar* SQFunctionProto::GetLocal(SQVM *vm,SQUnsignedInteger stackbase,SQUnsignedInteger nseq,SQUnsignedInteger nop)
{
SQUnsignedInteger nvars=_nlocalvarinfos;
- const SQChar *res=NULL;
+ const SQChar *res=nullptr;
if(nvars>=nseq){
for(SQUnsignedInteger i=0;i<nvars;i++){
if(_localvarinfos[i]._start_op<=nop && _localvarinfos[i]._end_op>=nop)
diff --git a/src/3rdparty/squirrel/squirrel/sqobject.h b/src/3rdparty/squirrel/squirrel/sqobject.h
index 9212766ee..129674b5a 100644
--- a/src/3rdparty/squirrel/squirrel/sqobject.h
+++ b/src/3rdparty/squirrel/squirrel/sqobject.h
@@ -56,7 +56,7 @@ enum SQMetaMethod{
struct SQRefCounted
{
- SQRefCounted() { _uiRef = 0; _weakref = NULL; }
+ SQRefCounted() { _uiRef = 0; _weakref = nullptr; }
virtual ~SQRefCounted();
SQWeakRef *GetWeakRef(SQObjectType type);
SQUnsignedInteger _uiRef;
@@ -134,7 +134,7 @@ struct SQObjectPtr : public SQObject
{
SQ_OBJECT_RAWINIT()
_type=OT_NULL;
- _unVal.pUserPointer=NULL;
+ _unVal.pUserPointer=nullptr;
}
SQObjectPtr(const SQObjectPtr &o)
{
@@ -281,7 +281,7 @@ struct SQObjectPtr : public SQObject
tOldType = _type;
unOldVal = _unVal;
_type = OT_NULL;
- _unVal.pUserPointer = NULL;
+ _unVal.pUserPointer = nullptr;
__Release(tOldType,unOldVal);
}
inline SQObjectPtr& operator=(SQInteger i)
diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp
index 31345d664..0f95c396c 100644
--- a/src/3rdparty/squirrel/squirrel/sqstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp
@@ -79,12 +79,12 @@ SQTable *CreateDefaultDelegate(SQSharedState *ss,SQRegFunction *funcz)
{
SQInteger i=0;
SQTable *t=SQTable::Create(ss,0);
- while(funcz[i].name!=0){
+ while(funcz[i].name!=nullptr){
SQNativeClosure *nc = SQNativeClosure::Create(ss,funcz[i].f);
nc->_nparamscheck = funcz[i].nparamscheck;
nc->_name = SQString::Create(ss,funcz[i].name);
if(funcz[i].typemask && !CompileTypemask(nc->_typecheck,funcz[i].typemask))
- return NULL;
+ return nullptr;
t->NewSlot(SQString::Create(ss,funcz[i].name),nc);
i++;
}
@@ -93,15 +93,15 @@ SQTable *CreateDefaultDelegate(SQSharedState *ss,SQRegFunction *funcz)
SQSharedState::SQSharedState()
{
- _compilererrorhandler = NULL;
- _printfunc = NULL;
+ _compilererrorhandler = nullptr;
+ _printfunc = nullptr;
_debuginfo = false;
_notifyallexceptions = false;
- _scratchpad=NULL;
+ _scratchpad=nullptr;
_scratchpadsize=0;
_collectable_free_processing = false;
#ifndef NO_GARBAGE_COLLECTOR
- _gc_chain=NULL;
+ _gc_chain=nullptr;
#endif
sq_new(_stringtable,SQStringTable);
sq_new(_metamethods,SQObjectPtrVec);
@@ -189,7 +189,7 @@ SQSharedState::~SQSharedState()
_refs_table.Finalize();
#ifndef NO_GARBAGE_COLLECTOR
SQCollectable *t = _gc_chain;
- SQCollectable *nx = NULL;
+ SQCollectable *nx = nullptr;
if(t) {
t->_uiRef++;
while(t) {
@@ -299,7 +299,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
EnqueueMarkObject(_instance_default_delegate,queue);
EnqueueMarkObject(_weakref_default_delegate,queue);
- SQCollectable *tchain=NULL;
+ SQCollectable *tchain=nullptr;
while (!queue.IsEmpty()) {
SQCollectable *q = queue.Pop();
@@ -309,7 +309,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
}
SQCollectable *t = _gc_chain;
- SQCollectable *nx = NULL;
+ SQCollectable *nx = nullptr;
if(t) {
t->_uiRef++;
while(t) {
@@ -340,7 +340,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
#ifndef NO_GARBAGE_COLLECTOR
void SQCollectable::AddToChain(SQCollectable **chain,SQCollectable *c)
{
- c->_prev = NULL;
+ c->_prev = nullptr;
c->_next = *chain;
if(*chain) (*chain)->_prev = c;
*chain = c;
@@ -352,8 +352,8 @@ void SQCollectable::RemoveFromChain(SQCollectable **chain,SQCollectable *c)
else *chain = c->_next;
if(c->_next)
c->_next->_prev = c->_prev;
- c->_next = NULL;
- c->_prev = NULL;
+ c->_next = nullptr;
+ c->_prev = nullptr;
}
#endif
@@ -483,16 +483,16 @@ RefTable::RefNode *RefTable::Get(SQObject &obj,SQHash &mainpos,RefNode **prev,bo
{
RefNode *ref;
mainpos = ::HashObj(obj)&(_numofslots-1);
- *prev = NULL;
+ *prev = nullptr;
for (ref = _buckets[mainpos]; ref; ) {
if(_rawval(ref->obj) == _rawval(obj) && type(ref->obj) == type(obj))
break;
*prev = ref;
ref = ref->next;
}
- if(ref == NULL && add) {
+ if(ref == nullptr && add) {
if(_numofslots == _slotused) {
- assert(_freelist == 0);
+ assert(_freelist == nullptr);
Resize(_numofslots*2);
mainpos = ::HashObj(obj)&(_numofslots-1);
}
@@ -510,16 +510,16 @@ void RefTable::AllocNodes(SQUnsignedInteger size)
RefNode *temp = nodes;
SQUnsignedInteger n;
for(n = 0; n < size - 1; n++) {
- bucks[n] = NULL;
+ bucks[n] = nullptr;
temp->refs = 0;
new (&temp->obj) SQObjectPtr;
temp->next = temp+1;
temp++;
}
- bucks[n] = NULL;
+ bucks[n] = nullptr;
temp->refs = 0;
new (&temp->obj) SQObjectPtr;
- temp->next = NULL;
+ temp->next = nullptr;
_freelist = nodes;
_nodes = nodes;
_buckets = bucks;
@@ -543,7 +543,7 @@ SQStringTable::SQStringTable()
SQStringTable::~SQStringTable()
{
SQ_FREE(_strings,sizeof(SQString*)*_numofslots);
- _strings = NULL;
+ _strings = nullptr;
}
void SQStringTable::AllocNodes(SQInteger size)
@@ -580,8 +580,8 @@ SQString::SQString(const SQChar *news, SQInteger len)
_val[len] = '\0';
_len = len;
_hash = ::_hashstr(news,(size_t)len);
- _next = NULL;
- _sharedstate = NULL;
+ _next = nullptr;
+ _sharedstate = nullptr;
}
void SQStringTable::Resize(SQInteger size)
@@ -605,7 +605,7 @@ void SQStringTable::Resize(SQInteger size)
void SQStringTable::Remove(SQString *bs)
{
SQString *s;
- SQString *prev=NULL;
+ SQString *prev=nullptr;
SQHash h = bs->_hash&(_numofslots - 1);
for (s = _strings[h]; s; ){
diff --git a/src/3rdparty/squirrel/squirrel/sqtable.cpp b/src/3rdparty/squirrel/squirrel/sqtable.cpp
index 60146fe73..6f466d686 100644
--- a/src/3rdparty/squirrel/squirrel/sqtable.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqtable.cpp
@@ -18,7 +18,7 @@ SQTable::SQTable(SQSharedState *ss,SQInteger nInitialSize)
while(nInitialSize>pow2size)pow2size=pow2size<<1;
AllocNodes(pow2size);
_usednodes = 0;
- _delegate = NULL;
+ _delegate = nullptr;
INIT_CHAIN();
ADD_TO_CHAIN(&_sharedstate->_gc_chain,this);
}
@@ -39,7 +39,7 @@ void SQTable::AllocNodes(SQInteger nSize)
_HashNode *nodes=(_HashNode *)SQ_MALLOC(sizeof(_HashNode)*nSize);
for(SQInteger i=0;i<nSize;i++){
new (&nodes[i]) _HashNode;
- nodes[i].next=NULL;
+ nodes[i].next=nullptr;
}
_numofnodes=nSize;
_nodes=nodes;
@@ -120,7 +120,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val)
if (mp > n && (othern = &_nodes[mph]) != mp){
/* yes; move colliding node into free position */
while (othern->next != mp){
- assert(othern->next != NULL);
+ assert(othern->next != nullptr);
othern = othern->next; /* find previous */
}
othern->next = n; /* redo the chain with `n' in place of `mp' */
@@ -129,7 +129,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val)
n->next = mp->next;
mp->key = _null_;
mp->val = _null_;
- mp->next = NULL; /* now `mp' is free */
+ mp->next = nullptr; /* now `mp' is free */
}
else{
/* new node will go into free position */
@@ -141,7 +141,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val)
mp->key = key;
for (;;) { /* correct `firstfree' */
- if (type(_firstfree->key) == OT_NULL && _firstfree->next == NULL) {
+ if (type(_firstfree->key) == OT_NULL && _firstfree->next == nullptr) {
mp->val = val;
_usednodes++;
return true; /* OK; table still has a free place */
@@ -190,7 +190,7 @@ void SQTable::_ClearNodes()
void SQTable::Finalize()
{
_ClearNodes();
- SetDelegate(NULL);
+ SetDelegate(nullptr);
}
void SQTable::Clear()
diff --git a/src/3rdparty/squirrel/squirrel/sqtable.h b/src/3rdparty/squirrel/squirrel/sqtable.h
index fad2fdc60..6bdda1577 100644
--- a/src/3rdparty/squirrel/squirrel/sqtable.h
+++ b/src/3rdparty/squirrel/squirrel/sqtable.h
@@ -27,7 +27,7 @@ struct SQTable : public SQDelegable
private:
struct _HashNode
{
- _HashNode() { next = NULL; }
+ _HashNode() { next = nullptr; }
SQObjectPtr val;
SQObjectPtr key;
_HashNode *next;
@@ -47,14 +47,14 @@ public:
{
SQTable *newtable = (SQTable*)SQ_MALLOC(sizeof(SQTable));
new (newtable) SQTable(ss, nInitialSize);
- newtable->_delegate = NULL;
+ newtable->_delegate = nullptr;
return newtable;
}
void Finalize() override;
SQTable *Clone();
~SQTable()
{
- SetDelegate(NULL);
+ SetDelegate(nullptr);
REMOVE_FROM_CHAIN(&_sharedstate->_gc_chain, this);
for (SQInteger i = 0; i < _numofnodes; i++) _nodes[i].~_HashNode();
SQ_FREE(_nodes, _numofnodes * sizeof(_HashNode));
@@ -70,7 +70,7 @@ public:
return n;
}
}while((n = n->next));
- return NULL;
+ return nullptr;
}
bool Get(const SQObjectPtr &key,SQObjectPtr &val);
void Remove(const SQObjectPtr &key);
diff --git a/src/3rdparty/squirrel/squirrel/squserdata.h b/src/3rdparty/squirrel/squirrel/squserdata.h
index ca4933de2..aed3e8349 100644
--- a/src/3rdparty/squirrel/squirrel/squserdata.h
+++ b/src/3rdparty/squirrel/squirrel/squserdata.h
@@ -4,12 +4,12 @@
struct SQUserData : SQDelegable
{
- SQUserData(SQSharedState *ss, SQInteger size){ _delegate = 0; _hook = NULL; INIT_CHAIN(); ADD_TO_CHAIN(&_ss(this)->_gc_chain, this); _size = size; _typetag = 0;
+ SQUserData(SQSharedState *ss, SQInteger size){ _delegate = nullptr; _hook = nullptr; INIT_CHAIN(); ADD_TO_CHAIN(&_ss(this)->_gc_chain, this); _size = size; _typetag = nullptr;
}
~SQUserData()
{
REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain, this);
- SetDelegate(NULL);
+ SetDelegate(nullptr);
}
static SQUserData* Create(SQSharedState *ss, SQInteger size)
{
@@ -19,7 +19,7 @@ struct SQUserData : SQDelegable
}
#ifndef NO_GARBAGE_COLLECTOR
void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue);
- void Finalize(){SetDelegate(NULL);}
+ void Finalize(){SetDelegate(nullptr);}
#endif
void Release() {
if (_hook) _hook(_val,_size);
diff --git a/src/3rdparty/squirrel/squirrel/squtils.h b/src/3rdparty/squirrel/squirrel/squtils.h
index b1138dcb1..d7d260dba 100644
--- a/src/3rdparty/squirrel/squirrel/squtils.h
+++ b/src/3rdparty/squirrel/squirrel/squtils.h
@@ -18,7 +18,7 @@ template<typename T> class sqvector
public:
sqvector()
{
- _vals = NULL;
+ _vals = nullptr;
_size = 0;
_allocated = 0;
}
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index 1987a3009..b6f2c526d 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -33,7 +33,7 @@ void SQVM::ClearStack(SQInteger last_top)
tOldType = o._type;
unOldVal = o._unVal;
o._type = OT_NULL;
- o._unVal.pUserPointer = NULL;
+ o._unVal.pUserPointer = nullptr;
__Release(tOldType,unOldVal);
}
}
@@ -107,7 +107,7 @@ SQVM::SQVM(SQSharedState *ss)
_suspended_target=-1;
_suspended_root = SQFalse;
_suspended_traps=0;
- _foreignptr=NULL;
+ _foreignptr=nullptr;
_nnativecalls=0;
_lasterror = _null_;
_errorhandler = _null_;
@@ -115,12 +115,12 @@ SQVM::SQVM(SQSharedState *ss)
_can_suspend = false;
_in_stackoverflow = false;
_ops_till_suspend = 0;
- _callsstack = NULL;
+ _callsstack = nullptr;
_callsstacksize = 0;
_alloccallsstacksize = 0;
_top = 0;
_stackbase = 0;
- ci = NULL;
+ ci = nullptr;
INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);
}
@@ -379,7 +379,7 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
if (!tailcall) {
CallInfo lc = {};
- lc._generator = NULL;
+ lc._generator = nullptr;
lc._etraps = 0;
lc._prevstkbase = (SQInt32) ( stackbase - _stackbase );
lc._target = (SQInt32) target;
@@ -557,7 +557,7 @@ bool SQVM::DELEGATE_OP(SQObjectPtr &trg,SQObjectPtr &o1,SQObjectPtr &o2)
}
break;
case OT_NULL:
- _table(o1)->SetDelegate(NULL);
+ _table(o1)->SetDelegate(nullptr);
break;
default:
Raise_Error("using '%s' as delegate", GetTypeName(o2));
@@ -627,7 +627,7 @@ bool SQVM::GETVARGV_OP(SQObjectPtr &target,SQObjectPtr &index,CallInfo *ci)
bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes)
{
- SQClass *base = NULL;
+ SQClass *base = nullptr;
SQObjectPtr attrs;
if(baseclass != -1) {
if(type(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error("trying to inherit from a %s",GetTypeName(_stack._vals[_stackbase+baseclass])); return false; }
@@ -708,7 +708,7 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQIn
temp_reg = closure;
if(!StartCall(_closure(temp_reg), _top - nargs, nargs, stackbase, false)) {
//call the handler if there are no calls in the stack, if not relies on the previous node
- if(ci == NULL) CallErrorHandler(_lasterror);
+ if(ci == nullptr) CallErrorHandler(_lasterror);
return false;
}
if (_funcproto(_closure(temp_reg)->_function)->_bgenerator) {
@@ -1160,7 +1160,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
_top = stackbase + nargs;
CallInfo lci = {};
lci._closure = nclosure;
- lci._generator = NULL;
+ lci._generator = nullptr;
lci._etraps = 0;
lci._prevstkbase = (SQInt32) (stackbase - _stackbase);
lci._ncalls = 1;