Improve const-correctness.

This avoids some pedantic compiler warnings and also removes any
non-shared data from the squirrel core.

Before:

  size --totals sqstdlib/*.o squirrel/*.o
     text    data     bss     dec     hex filename
   261270    3776       0  265046   40b56 (TOTALS)

After:

  size --totals sqstdlib/*.o squirrel/*.o
     text    data     bss     dec     hex filename
   265046       0       0  265046   40b56 (TOTALS)
This commit is contained in:
Markus F.X.J. Oberhumer 2016-02-22 22:04:10 +01:00
parent 0378c7016f
commit ec36322140
11 changed files with 49 additions and 49 deletions

View File

@ -162,7 +162,7 @@ static SQInteger _blob__cloned(HSQUIRRELVM v)
} }
#define _DECL_BLOB_FUNC(name,nparams,typecheck) {_SC(#name),_blob_##name,nparams,typecheck} #define _DECL_BLOB_FUNC(name,nparams,typecheck) {_SC(#name),_blob_##name,nparams,typecheck}
static SQRegFunction _blob_methods[] = { static const SQRegFunction _blob_methods[] = {
_DECL_BLOB_FUNC(constructor,-1,_SC("xn")), _DECL_BLOB_FUNC(constructor,-1,_SC("xn")),
_DECL_BLOB_FUNC(resize,2,_SC("xn")), _DECL_BLOB_FUNC(resize,2,_SC("xn")),
_DECL_BLOB_FUNC(swap2,1,_SC("x")), _DECL_BLOB_FUNC(swap2,1,_SC("x")),
@ -183,7 +183,7 @@ static SQInteger _g_blob_casti2f(HSQUIRRELVM v)
{ {
SQInteger i; SQInteger i;
sq_getinteger(v,2,&i); sq_getinteger(v,2,&i);
sq_pushfloat(v,*((SQFloat *)&i)); sq_pushfloat(v,*((const SQFloat *)&i));
return 1; return 1;
} }
@ -191,7 +191,7 @@ static SQInteger _g_blob_castf2i(HSQUIRRELVM v)
{ {
SQFloat f; SQFloat f;
sq_getfloat(v,2,&f); sq_getfloat(v,2,&f);
sq_pushinteger(v,*((SQInteger *)&f)); sq_pushinteger(v,*((const SQInteger *)&f));
return 1; return 1;
} }
@ -224,7 +224,7 @@ static SQInteger _g_blob_swapfloat(HSQUIRRELVM v)
} }
#define _DECL_GLOBALBLOB_FUNC(name,nparams,typecheck) {_SC(#name),_g_blob_##name,nparams,typecheck} #define _DECL_GLOBALBLOB_FUNC(name,nparams,typecheck) {_SC(#name),_g_blob_##name,nparams,typecheck}
static SQRegFunction bloblib_funcs[]={ static const SQRegFunction bloblib_funcs[]={
_DECL_GLOBALBLOB_FUNC(casti2f,2,_SC(".n")), _DECL_GLOBALBLOB_FUNC(casti2f,2,_SC(".n")),
_DECL_GLOBALBLOB_FUNC(castf2i,2,_SC(".n")), _DECL_GLOBALBLOB_FUNC(castf2i,2,_SC(".n")),
_DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")), _DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),

View File

@ -164,7 +164,7 @@ static SQInteger _file_close(HSQUIRRELVM v)
//bindings //bindings
#define _DECL_FILE_FUNC(name,nparams,typecheck) {_SC(#name),_file_##name,nparams,typecheck} #define _DECL_FILE_FUNC(name,nparams,typecheck) {_SC(#name),_file_##name,nparams,typecheck}
static SQRegFunction _file_methods[] = { static const SQRegFunction _file_methods[] = {
_DECL_FILE_FUNC(constructor,3,_SC("x")), _DECL_FILE_FUNC(constructor,3,_SC("x")),
_DECL_FILE_FUNC(_typeof,1,_SC("x")), _DECL_FILE_FUNC(_typeof,1,_SC("x")),
_DECL_FILE_FUNC(close,1,_SC("x")), _DECL_FILE_FUNC(close,1,_SC("x")),
@ -241,7 +241,7 @@ SQInteger _read_two_bytes(IOBuffer *iobuffer)
{ {
if(iobuffer->ptr < iobuffer->size) { if(iobuffer->ptr < iobuffer->size) {
if(iobuffer->size < 2) return 0; if(iobuffer->size < 2) return 0;
SQInteger ret = *((wchar_t*)&iobuffer->buffer[iobuffer->ptr]); SQInteger ret = *((const wchar_t*)&iobuffer->buffer[iobuffer->ptr]);
iobuffer->ptr += 2; iobuffer->ptr += 2;
return ret; return ret;
} }
@ -249,7 +249,7 @@ SQInteger _read_two_bytes(IOBuffer *iobuffer)
if( (iobuffer->size = sqstd_fread(iobuffer->buffer,1,IO_BUFFER_SIZE,iobuffer->file )) > 0 ) if( (iobuffer->size = sqstd_fread(iobuffer->buffer,1,IO_BUFFER_SIZE,iobuffer->file )) > 0 )
{ {
if(iobuffer->size < 2) return 0; if(iobuffer->size < 2) return 0;
SQInteger ret = *((wchar_t*)&iobuffer->buffer[0]); SQInteger ret = *((const wchar_t*)&iobuffer->buffer[0]);
iobuffer->ptr = 2; iobuffer->ptr = 2;
return ret; return ret;
} }
@ -281,7 +281,7 @@ static SQInteger _io_file_lexfeed_UTF8(SQUserPointer iobuf)
3, /* 1110 : 3 bytes */ 3, /* 1110 : 3 bytes */
4 /* 1111 :4 bytes */ 4 /* 1111 :4 bytes */
}; };
static unsigned char byte_masks[5] = {0,0,0x1f,0x0f,0x07}; static const unsigned char byte_masks[5] = {0,0,0x1f,0x0f,0x07};
unsigned char inchar; unsigned char inchar;
SQInteger c = 0; SQInteger c = 0;
READ(iobuffer); READ(iobuffer);
@ -459,7 +459,7 @@ SQInteger _g_io_dofile(HSQUIRRELVM v)
} }
#define _DECL_GLOBALIO_FUNC(name,nparams,typecheck) {_SC(#name),_g_io_##name,nparams,typecheck} #define _DECL_GLOBALIO_FUNC(name,nparams,typecheck) {_SC(#name),_g_io_##name,nparams,typecheck}
static SQRegFunction iolib_funcs[]={ static const SQRegFunction iolib_funcs[]={
_DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")), _DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")),
_DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")), _DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")),
_DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")), _DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")),

View File

@ -59,7 +59,7 @@ SINGLE_ARG_FUNC(ceil)
SINGLE_ARG_FUNC(exp) SINGLE_ARG_FUNC(exp)
#define _DECL_FUNC(name,nparams,tycheck) {_SC(#name),math_##name,nparams,tycheck} #define _DECL_FUNC(name,nparams,tycheck) {_SC(#name),math_##name,nparams,tycheck}
static SQRegFunction mathlib_funcs[] = { static const SQRegFunction mathlib_funcs[] = {
_DECL_FUNC(sqrt,2,_SC(".n")), _DECL_FUNC(sqrt,2,_SC(".n")),
_DECL_FUNC(sin,2,_SC(".n")), _DECL_FUNC(sin,2,_SC(".n")),
_DECL_FUNC(cos,2,_SC(".n")), _DECL_FUNC(cos,2,_SC(".n")),

View File

@ -238,7 +238,7 @@ SQInteger _stream_eos(HSQUIRRELVM v)
return sq_throwerror(v,_SC("this object cannot be cloned")); return sq_throwerror(v,_SC("this object cannot be cloned"));
} }
static SQRegFunction _stream_methods[] = { static const SQRegFunction _stream_methods[] = {
_DECL_STREAM_FUNC(readblob,2,_SC("xn")), _DECL_STREAM_FUNC(readblob,2,_SC("xn")),
_DECL_STREAM_FUNC(readn,2,_SC("xn")), _DECL_STREAM_FUNC(readn,2,_SC("xn")),
_DECL_STREAM_FUNC(writeblob,-2,_SC("xx")), _DECL_STREAM_FUNC(writeblob,-2,_SC("xx")),
@ -262,7 +262,7 @@ void init_streamclass(HSQUIRRELVM v)
sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG); sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG);
SQInteger i = 0; SQInteger i = 0;
while(_stream_methods[i].name != 0) { while(_stream_methods[i].name != 0) {
SQRegFunction &f = _stream_methods[i]; const SQRegFunction &f = _stream_methods[i];
sq_pushstring(v,f.name,-1); sq_pushstring(v,f.name,-1);
sq_newclosure(v,f.f,0); sq_newclosure(v,f.f,0);
sq_setparamscheck(v,f.nparamscheck,f.typemask); sq_setparamscheck(v,f.nparamscheck,f.typemask);
@ -283,7 +283,7 @@ void init_streamclass(HSQUIRRELVM v)
sq_pop(v,1); sq_pop(v,1);
} }
SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals) SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,const SQRegFunction *methods,const SQRegFunction *globals)
{ {
if(sq_gettype(v,-1) != OT_TABLE) if(sq_gettype(v,-1) != OT_TABLE)
return sq_throwerror(v,_SC("table expected")); return sq_throwerror(v,_SC("table expected"));
@ -298,7 +298,7 @@ SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,c
sq_settypetag(v,-1,typetag); sq_settypetag(v,-1,typetag);
SQInteger i = 0; SQInteger i = 0;
while(methods[i].name != 0) { while(methods[i].name != 0) {
SQRegFunction &f = methods[i]; const SQRegFunction &f = methods[i];
sq_pushstring(v,f.name,-1); sq_pushstring(v,f.name,-1);
sq_newclosure(v,f.f,0); sq_newclosure(v,f.f,0);
sq_setparamscheck(v,f.nparamscheck,f.typemask); sq_setparamscheck(v,f.nparamscheck,f.typemask);
@ -312,7 +312,7 @@ SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,c
i = 0; i = 0;
while(globals[i].name!=0) while(globals[i].name!=0)
{ {
SQRegFunction &f = globals[i]; const SQRegFunction &f = globals[i];
sq_pushstring(v,f.name,-1); sq_pushstring(v,f.name,-1);
sq_newclosure(v,f.f,0); sq_newclosure(v,f.f,0);
sq_setparamscheck(v,f.nparamscheck,f.typemask); sq_setparamscheck(v,f.nparamscheck,f.typemask);

View File

@ -14,5 +14,5 @@ SQInteger _stream_eos(HSQUIRRELVM v);
SQInteger _stream_flush(HSQUIRRELVM v); SQInteger _stream_flush(HSQUIRRELVM v);
#define _DECL_STREAM_FUNC(name,nparams,typecheck) {_SC(#name),_stream_##name,nparams,typecheck} #define _DECL_STREAM_FUNC(name,nparams,typecheck) {_SC(#name),_stream_##name,nparams,typecheck}
SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals); SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,const SQRegFunction *methods,const SQRegFunction *globals);
#endif /*_SQSTD_STREAM_H_*/ #endif /*_SQSTD_STREAM_H_*/

View File

@ -110,7 +110,7 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
size_t flen = scstrlen(fmt); size_t flen = scstrlen(fmt);
SQInteger fpos = flen - 1; SQInteger fpos = flen - 1;
SQChar f = fmt[fpos]; SQChar f = fmt[fpos];
SQChar *prec = (SQChar *)_PRINT_INT_PREC; const SQChar *prec = (const SQChar *)_PRINT_INT_PREC;
while(*prec != _SC('\0')) { while(*prec != _SC('\0')) {
fmt[fpos++] = *prec++; fmt[fpos++] = *prec++;
} }
@ -432,7 +432,7 @@ static SQInteger _regexp__typeof(HSQUIRRELVM v)
} }
#define _DECL_REX_FUNC(name,nparams,pmask) {_SC(#name),_regexp_##name,nparams,pmask} #define _DECL_REX_FUNC(name,nparams,pmask) {_SC(#name),_regexp_##name,nparams,pmask}
static SQRegFunction rexobj_funcs[]={ static const SQRegFunction rexobj_funcs[]={
_DECL_REX_FUNC(constructor,2,_SC(".s")), _DECL_REX_FUNC(constructor,2,_SC(".s")),
_DECL_REX_FUNC(search,-2,_SC("xsn")), _DECL_REX_FUNC(search,-2,_SC("xsn")),
_DECL_REX_FUNC(match,2,_SC("xs")), _DECL_REX_FUNC(match,2,_SC("xs")),
@ -444,7 +444,7 @@ static SQRegFunction rexobj_funcs[]={
#undef _DECL_REX_FUNC #undef _DECL_REX_FUNC
#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 SQRegFunction stringlib_funcs[]={ static const SQRegFunction stringlib_funcs[]={
_DECL_FUNC(format,-2,_SC(".s")), _DECL_FUNC(format,-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")),
@ -464,7 +464,7 @@ SQInteger sqstd_register_stringlib(HSQUIRRELVM v)
sq_newclass(v,SQFalse); sq_newclass(v,SQFalse);
SQInteger i = 0; SQInteger i = 0;
while(rexobj_funcs[i].name != 0) { while(rexobj_funcs[i].name != 0) {
SQRegFunction &f = rexobj_funcs[i]; const SQRegFunction &f = rexobj_funcs[i];
sq_pushstring(v,f.name,-1); sq_pushstring(v,f.name,-1);
sq_newclosure(v,f.f,0); sq_newclosure(v,f.f,0);
sq_setparamscheck(v,f.nparamscheck,f.typemask); sq_setparamscheck(v,f.nparamscheck,f.typemask);

View File

@ -118,7 +118,7 @@ static SQInteger _system_date(HSQUIRRELVM v)
#define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_system_##name,nparams,pmask} #define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_system_##name,nparams,pmask}
static SQRegFunction systemlib_funcs[]={ static const SQRegFunction systemlib_funcs[]={
_DECL_FUNC(getenv,2,_SC(".s")), _DECL_FUNC(getenv,2,_SC(".s")),
_DECL_FUNC(system,2,_SC(".s")), _DECL_FUNC(system,2,_SC(".s")),
_DECL_FUNC(clock,0,NULL), _DECL_FUNC(clock,0,NULL),

View File

@ -272,7 +272,7 @@ static SQInteger base_callee(HSQUIRRELVM v)
return sq_throwerror(v,_SC("no closure in the calls stack")); return sq_throwerror(v,_SC("no closure in the calls stack"));
} }
static SQRegFunction base_funcs[]={ static const SQRegFunction base_funcs[]={
//generic //generic
{_SC("seterrorhandler"),base_seterrorhandler,2, NULL}, {_SC("seterrorhandler"),base_seterrorhandler,2, NULL},
{_SC("setdebughook"),base_setdebughook,2, NULL}, {_SC("setdebughook"),base_setdebughook,2, NULL},
@ -464,7 +464,7 @@ static SQInteger table_getdelegate(HSQUIRRELVM v)
return SQ_SUCCEEDED(sq_getdelegate(v,-1))?1:SQ_ERROR; return SQ_SUCCEEDED(sq_getdelegate(v,-1))?1:SQ_ERROR;
} }
SQRegFunction SQSharedState::_table_default_delegate_funcz[]={ const SQRegFunction SQSharedState::_table_default_delegate_funcz[]={
{_SC("len"),default_delegate_len,1, _SC("t")}, {_SC("len"),default_delegate_len,1, _SC("t")},
{_SC("rawget"),container_rawget,2, _SC("t")}, {_SC("rawget"),container_rawget,2, _SC("t")},
{_SC("rawset"),container_rawset,3, _SC("t")}, {_SC("rawset"),container_rawset,3, _SC("t")},
@ -773,7 +773,7 @@ static SQInteger array_slice(HSQUIRRELVM v)
} }
SQRegFunction SQSharedState::_array_default_delegate_funcz[]={ const SQRegFunction SQSharedState::_array_default_delegate_funcz[]={
{_SC("len"),default_delegate_len,1, _SC("a")}, {_SC("len"),default_delegate_len,1, _SC("a")},
{_SC("append"),array_append,2, _SC("a")}, {_SC("append"),array_append,2, _SC("a")},
{_SC("extend"),array_extend,2, _SC("aa")}, {_SC("extend"),array_extend,2, _SC("aa")},
@ -853,7 +853,7 @@ static SQInteger string_find(HSQUIRRELVM v)
STRING_TOFUNCZ(tolower) STRING_TOFUNCZ(tolower)
STRING_TOFUNCZ(toupper) STRING_TOFUNCZ(toupper)
SQRegFunction SQSharedState::_string_default_delegate_funcz[]={ const SQRegFunction SQSharedState::_string_default_delegate_funcz[]={
{_SC("len"),default_delegate_len,1, _SC("s")}, {_SC("len"),default_delegate_len,1, _SC("s")},
{_SC("tointeger"),default_delegate_tointeger,-1, _SC("sn")}, {_SC("tointeger"),default_delegate_tointeger,-1, _SC("sn")},
{_SC("tofloat"),default_delegate_tofloat,1, _SC("s")}, {_SC("tofloat"),default_delegate_tofloat,1, _SC("s")},
@ -867,7 +867,7 @@ SQRegFunction SQSharedState::_string_default_delegate_funcz[]={
}; };
//INTEGER DEFAULT DELEGATE////////////////////////// //INTEGER DEFAULT DELEGATE//////////////////////////
SQRegFunction SQSharedState::_number_default_delegate_funcz[]={ const SQRegFunction SQSharedState::_number_default_delegate_funcz[]={
{_SC("tointeger"),default_delegate_tointeger,1, _SC("n|b")}, {_SC("tointeger"),default_delegate_tointeger,1, _SC("n|b")},
{_SC("tofloat"),default_delegate_tofloat,1, _SC("n|b")}, {_SC("tofloat"),default_delegate_tofloat,1, _SC("n|b")},
{_SC("tostring"),default_delegate_tostring,1, _SC(".")}, {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
@ -972,7 +972,7 @@ static SQInteger closure_getinfos(HSQUIRRELVM v) {
SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={ const SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={
{_SC("call"),closure_call,-1, _SC("c")}, {_SC("call"),closure_call,-1, _SC("c")},
{_SC("pcall"),closure_pcall,-1, _SC("c")}, {_SC("pcall"),closure_pcall,-1, _SC("c")},
{_SC("acall"),closure_acall,2, _SC("ca")}, {_SC("acall"),closure_acall,2, _SC("ca")},
@ -998,7 +998,7 @@ static SQInteger generator_getstatus(HSQUIRRELVM v)
return 1; return 1;
} }
SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={ const SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={
{_SC("getstatus"),generator_getstatus,1, _SC("g")}, {_SC("getstatus"),generator_getstatus,1, _SC("g")},
{_SC("weakref"),obj_delegate_weakref,1, NULL }, {_SC("weakref"),obj_delegate_weakref,1, NULL },
{_SC("tostring"),default_delegate_tostring,1, _SC(".")}, {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
@ -1154,7 +1154,7 @@ static SQInteger thread_getstackinfos(HSQUIRRELVM v)
return sq_throwerror(v,_SC("wrong parameter")); return sq_throwerror(v,_SC("wrong parameter"));
} }
SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = { const SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = {
{_SC("call"), thread_call, -1, _SC("v")}, {_SC("call"), thread_call, -1, _SC("v")},
{_SC("wakeup"), thread_wakeup, -1, _SC("v")}, {_SC("wakeup"), thread_wakeup, -1, _SC("v")},
{_SC("wakeupthrow"), thread_wakeupthrow, -2, _SC("v.b")}, {_SC("wakeupthrow"), thread_wakeupthrow, -2, _SC("v.b")},
@ -1217,7 +1217,7 @@ static SQInteger class_rawnewmember(HSQUIRRELVM v)
return SQ_SUCCEEDED(sq_rawnewmember(v,-4,bstatic))?1:SQ_ERROR; return SQ_SUCCEEDED(sq_rawnewmember(v,-4,bstatic))?1:SQ_ERROR;
} }
SQRegFunction SQSharedState::_class_default_delegate_funcz[] = { const SQRegFunction SQSharedState::_class_default_delegate_funcz[] = {
{_SC("getattributes"), class_getattributes, 2, _SC("y.")}, {_SC("getattributes"), class_getattributes, 2, _SC("y.")},
{_SC("setattributes"), class_setattributes, 3, _SC("y..")}, {_SC("setattributes"), class_setattributes, 3, _SC("y..")},
{_SC("rawget"),container_rawget,2, _SC("y")}, {_SC("rawget"),container_rawget,2, _SC("y")},
@ -1240,7 +1240,7 @@ static SQInteger instance_getclass(HSQUIRRELVM v)
return SQ_ERROR; return SQ_ERROR;
} }
SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = { const SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = {
{_SC("getclass"), instance_getclass, 1, _SC("x")}, {_SC("getclass"), instance_getclass, 1, _SC("x")},
{_SC("rawget"),container_rawget,2, _SC("x")}, {_SC("rawget"),container_rawget,2, _SC("x")},
{_SC("rawset"),container_rawset,3, _SC("x")}, {_SC("rawset"),container_rawset,3, _SC("x")},
@ -1257,7 +1257,7 @@ static SQInteger weakref_ref(HSQUIRRELVM v)
return 1; return 1;
} }
SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = { const SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = {
{_SC("ref"),weakref_ref,1, _SC("r")}, {_SC("ref"),weakref_ref,1, _SC("r")},
{_SC("weakref"),obj_delegate_weakref,1, NULL }, {_SC("weakref"),obj_delegate_weakref,1, NULL },
{_SC("tostring"),default_delegate_tostring,1, _SC(".")}, {_SC("tostring"),default_delegate_tostring,1, _SC(".")},

View File

@ -81,7 +81,7 @@ bool CompileTypemask(SQIntVec &res,const SQChar *typemask)
return true; return true;
} }
SQTable *CreateDefaultDelegate(SQSharedState *ss,SQRegFunction *funcz) SQTable *CreateDefaultDelegate(SQSharedState *ss,const SQRegFunction *funcz)
{ {
SQInteger i=0; SQInteger i=0;
SQTable *t=SQTable::Create(ss,0); SQTable *t=SQTable::Create(ss,0);

View File

@ -84,25 +84,25 @@ public:
#endif #endif
SQObjectPtr _root_vm; SQObjectPtr _root_vm;
SQObjectPtr _table_default_delegate; SQObjectPtr _table_default_delegate;
static SQRegFunction _table_default_delegate_funcz[]; static const SQRegFunction _table_default_delegate_funcz[];
SQObjectPtr _array_default_delegate; SQObjectPtr _array_default_delegate;
static SQRegFunction _array_default_delegate_funcz[]; static const SQRegFunction _array_default_delegate_funcz[];
SQObjectPtr _string_default_delegate; SQObjectPtr _string_default_delegate;
static SQRegFunction _string_default_delegate_funcz[]; static const SQRegFunction _string_default_delegate_funcz[];
SQObjectPtr _number_default_delegate; SQObjectPtr _number_default_delegate;
static SQRegFunction _number_default_delegate_funcz[]; static const SQRegFunction _number_default_delegate_funcz[];
SQObjectPtr _generator_default_delegate; SQObjectPtr _generator_default_delegate;
static SQRegFunction _generator_default_delegate_funcz[]; static const SQRegFunction _generator_default_delegate_funcz[];
SQObjectPtr _closure_default_delegate; SQObjectPtr _closure_default_delegate;
static SQRegFunction _closure_default_delegate_funcz[]; static const SQRegFunction _closure_default_delegate_funcz[];
SQObjectPtr _thread_default_delegate; SQObjectPtr _thread_default_delegate;
static SQRegFunction _thread_default_delegate_funcz[]; static const SQRegFunction _thread_default_delegate_funcz[];
SQObjectPtr _class_default_delegate; SQObjectPtr _class_default_delegate;
static SQRegFunction _class_default_delegate_funcz[]; static const SQRegFunction _class_default_delegate_funcz[];
SQObjectPtr _instance_default_delegate; SQObjectPtr _instance_default_delegate;
static SQRegFunction _instance_default_delegate_funcz[]; static const SQRegFunction _instance_default_delegate_funcz[];
SQObjectPtr _weakref_default_delegate; SQObjectPtr _weakref_default_delegate;
static SQRegFunction _weakref_default_delegate_funcz[]; static const SQRegFunction _weakref_default_delegate_funcz[];
SQCOMPILERERROR _compilererrorhandler; SQCOMPILERERROR _compilererrorhandler;
SQPRINTFUNCTION _printfunc; SQPRINTFUNCTION _printfunc;

View File

@ -495,12 +495,12 @@ bool SQVM::DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjec
} }
#define arg0 (_i_._arg0) #define arg0 (_i_._arg0)
#define sarg0 ((SQInteger)*((signed char *)&_i_._arg0)) #define sarg0 ((SQInteger)*((const signed char *)&_i_._arg0))
#define arg1 (_i_._arg1) #define arg1 (_i_._arg1)
#define sarg1 (*((SQInt32 *)&_i_._arg1)) #define sarg1 (*((const SQInt32 *)&_i_._arg1))
#define arg2 (_i_._arg2) #define arg2 (_i_._arg2)
#define arg3 (_i_._arg3) #define arg3 (_i_._arg3)
#define sarg3 ((SQInteger)*((signed char *)&_i_._arg3)) #define sarg3 ((SQInteger)*((const signed char *)&_i_._arg3))
SQRESULT SQVM::Suspend() SQRESULT SQVM::Suspend()
{ {
@ -717,7 +717,7 @@ exception_restore:
#else #else
TARGET = (SQInteger)((SQInt32)arg1); continue; TARGET = (SQInteger)((SQInt32)arg1); continue;
#endif #endif
case _OP_LOADFLOAT: TARGET = *((SQFloat *)&arg1); continue; case _OP_LOADFLOAT: TARGET = *((const SQFloat *)&arg1); continue;
case _OP_DLOAD: TARGET = ci->_literals[arg1]; STK(arg2) = ci->_literals[arg3];continue; case _OP_DLOAD: TARGET = ci->_literals[arg1]; STK(arg2) = ci->_literals[arg3];continue;
case _OP_TAILCALL:{ case _OP_TAILCALL:{
SQObjectPtr &t = STK(arg1); SQObjectPtr &t = STK(arg1);
@ -914,7 +914,7 @@ exception_restore:
break; break;
case AAT_FLOAT: case AAT_FLOAT:
val._type = OT_FLOAT; val._type = OT_FLOAT;
val._unVal.fFloat = *((SQFloat *)&arg1); val._unVal.fFloat = *((const SQFloat *)&arg1);
break; break;
case AAT_BOOL: case AAT_BOOL:
val._type = OT_BOOL; val._type = OT_BOOL;
@ -1516,7 +1516,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
_table(self)->Remove(key); _table(self)->Remove(key);
} }
else { else {
Raise_IdxError((SQObject &)key); Raise_IdxError((const SQObject &)key);
return false; return false;
} }
} }