summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-06 17:46:56 +0000
committerrubidium <rubidium@openttd.org>2014-09-06 17:46:56 +0000
commit33ab50556760a84d6754235e553c68ada2f35a63 (patch)
tree4dba0c52f8fac85916ccdfabb29457a1d36d25e1
parentc96026cd1fcd771017f43e897fc90dea81558941 (diff)
downloadopenttd-33ab50556760a84d6754235e553c68ada2f35a63.tar.xz
(svn r26774) -Cleanup [Squirrel]: remove _SC macro
-rw-r--r--src/3rdparty/squirrel/etc/minimal.c6
-rw-r--r--src/3rdparty/squirrel/include/squirrel.h11
-rw-r--r--src/3rdparty/squirrel/sq/sq.c62
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp52
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp48
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdio.cpp46
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp42
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp48
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp48
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdstream.h2
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp54
-rw-r--r--src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp36
-rw-r--r--src/3rdparty/squirrel/squirrel/sqapi.cpp94
-rw-r--r--src/3rdparty/squirrel/squirrel/sqbaselib.cpp268
-rw-r--r--src/3rdparty/squirrel/squirrel/sqcompiler.cpp252
-rw-r--r--src/3rdparty/squirrel/squirrel/sqdebug.cpp22
-rw-r--r--src/3rdparty/squirrel/squirrel/sqfuncstate.cpp194
-rw-r--r--src/3rdparty/squirrel/squirrel/sqlexer.cpp178
-rw-r--r--src/3rdparty/squirrel/squirrel/sqlexer.h2
-rw-r--r--src/3rdparty/squirrel/squirrel/sqobject.cpp50
-rw-r--r--src/3rdparty/squirrel/squirrel/sqobject.h36
-rw-r--r--src/3rdparty/squirrel/squirrel/sqstate.cpp34
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp150
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.h2
-rw-r--r--src/ai/ai_info.cpp2
-rw-r--r--src/game/game_info.cpp2
-rw-r--r--src/game/game_text.cpp2
-rw-r--r--src/script/api/script_admin.cpp4
-rw-r--r--src/script/api/script_controller.cpp2
-rw-r--r--src/script/api/script_list.cpp10
-rw-r--r--src/script/api/script_text.cpp8
-rw-r--r--src/script/script_info_dummy.cpp4
-rw-r--r--src/script/squirrel.cpp22
-rw-r--r--src/script/squirrel_helper.hpp12
34 files changed, 902 insertions, 903 deletions
diff --git a/src/3rdparty/squirrel/etc/minimal.c b/src/3rdparty/squirrel/etc/minimal.c
index e6bdd0e89..dfbff0cc1 100644
--- a/src/3rdparty/squirrel/etc/minimal.c
+++ b/src/3rdparty/squirrel/etc/minimal.c
@@ -24,7 +24,7 @@ void call_foo(HSQUIRRELVM v, int n,float f,const SQChar *s)
{
SQInteger top = sq_gettop(v); //saves the stack size before the call
sq_pushroottable(v); //pushes the global table
- sq_pushstring(v,_SC("foo"),-1);
+ sq_pushstring(v,"foo",-1);
if(SQ_SUCCEEDED(sq_get(v,-2))) { //gets the field 'foo' from the global table
sq_pushroottable(v); //push the 'this' (in this case is the global table)
sq_pushinteger(v,n);
@@ -47,9 +47,9 @@ int main(int argc, char* argv[])
sq_setprintfunc(v, printfunc); //sets the print function
sq_pushroottable(v); //push the root table(were the globals of the script will be stored)
- if(SQ_SUCCEEDED(sqstd_dofile(v, _SC("test.nut"), SQFalse, SQTrue))) // also prints syntax errors if any
+ if(SQ_SUCCEEDED(sqstd_dofile(v, "test.nut", SQFalse, SQTrue))) // also prints syntax errors if any
{
- call_foo(v,1,2.5,_SC("teststring"));
+ call_foo(v,1,2.5,"teststring");
}
sq_pop(v,1); //pops the root table
diff --git a/src/3rdparty/squirrel/include/squirrel.h b/src/3rdparty/squirrel/include/squirrel.h
index 84f34dea9..9ed0e550c 100644
--- a/src/3rdparty/squirrel/include/squirrel.h
+++ b/src/3rdparty/squirrel/include/squirrel.h
@@ -90,7 +90,6 @@ struct SQInstance;
struct SQDelegable;
typedef char SQChar;
-#define _SC(a) a
#define scstrcmp strcmp
#define scsprintf sprintf
#define scsnprintf snprintf
@@ -118,14 +117,14 @@ typedef char SQChar;
#define MAX_CHAR 0xFFFF
#if defined(_MSC_VER) || defined(__MINGW32__)
- #define SQ_PRINTF64 _SC("%I64d")
+ #define SQ_PRINTF64 "%I64d"
#else
- #define SQ_PRINTF64 _SC("%lld")
+ #define SQ_PRINTF64 "%lld"
#endif
-#define SQUIRREL_VERSION _SC("Squirrel 2.2.5 stable - With custom OpenTTD modifications")
-#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2010 Alberto Demichelis")
-#define SQUIRREL_AUTHOR _SC("Alberto Demichelis")
+#define SQUIRREL_VERSION "Squirrel 2.2.5 stable - With custom OpenTTD modifications"
+#define SQUIRREL_COPYRIGHT "Copyright (C) 2003-2010 Alberto Demichelis"
+#define SQUIRREL_AUTHOR "Alberto Demichelis"
#define SQUIRREL_VERSION_NUMBER 225
#define SQ_VMSTATE_IDLE 0
diff --git a/src/3rdparty/squirrel/sq/sq.c b/src/3rdparty/squirrel/sq/sq.c
index c1c3e501e..5044025cf 100644
--- a/src/3rdparty/squirrel/sq/sq.c
+++ b/src/3rdparty/squirrel/sq/sq.c
@@ -52,22 +52,22 @@ void printfunc(HSQUIRRELVM v,const SQChar *s,...)
void PrintVersionInfos()
{
- scfprintf(stdout,_SC("%s %s (%d bits)\n"),SQUIRREL_VERSION,SQUIRREL_COPYRIGHT,sizeof(SQInteger)*8);
+ scfprintf(stdout,"%s %s (%d bits)\n",SQUIRREL_VERSION,SQUIRREL_COPYRIGHT,sizeof(SQInteger)*8);
if(sizeof(SQFloat) != sizeof(float)) {
- scfprintf(stdout,_SC("[%d bits floats]\n"),sizeof(SQFloat)*8);
+ scfprintf(stdout,"[%d bits floats]\n",sizeof(SQFloat)*8);
}
}
void PrintUsage()
{
- scfprintf(stderr,_SC("usage: sq <options> <scriptpath [args]>.\n")
- _SC("Available options are:\n")
- _SC(" -c compiles the file to bytecode(default output 'out.cnut')\n")
- _SC(" -o specifies output file for the -c option\n")
- _SC(" -c compiles only\n")
- _SC(" -d generates debug infos\n")
- _SC(" -v displays version infos\n")
- _SC(" -h prints help\n"));
+ scfprintf(stderr,"usage: sq <options> <scriptpath [args]>.\n"
+ "Available options are:\n"
+ " -c compiles the file to bytecode(default output 'out.cnut')\n"
+ " -o specifies output file for the -c option\n"
+ " -c compiles only\n"
+ " -d generates debug infos\n"
+ " -v displays version infos\n"
+ " -h prints help\n");
}
#define _INTERACTIVE 0
@@ -113,7 +113,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
return _DONE;
default:
PrintVersionInfos();
- scprintf(_SC("unknown prameter '-%c'\n"),argv[arg][1]);
+ scprintf("unknown prameter '-%c'\n",argv[arg][1]);
PrintUsage();
return _DONE;
}
@@ -129,7 +129,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
arg++;
sq_pushroottable(v);
- sq_pushstring(v,_SC("ARGS"),-1);
+ sq_pushstring(v,"ARGS",-1);
sq_newarray(v,0);
for(i=arg;i<argc;i++)
{
@@ -143,7 +143,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
sq_pop(v,1);
if(compiles_only) {
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){
- SQChar *outfile = _SC("out.cnut");
+ SQChar *outfile = "out.cnut";
if(output) {
outfile = output;
}
@@ -161,7 +161,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
const SQChar *err;
sq_getlasterror(v);
if(SQ_SUCCEEDED(sq_getstring(v,-1,&err))) {
- scprintf(_SC("Error [%s]\n"),err);
+ scprintf("Error [%s]\n",err);
return _DONE;
}
}
@@ -184,7 +184,7 @@ void Interactive(HSQUIRRELVM v)
PrintVersionInfos();
sq_pushroottable(v);
- sq_pushstring(v,_SC("quit"),-1);
+ sq_pushstring(v,"quit",-1);
sq_pushuserpointer(v,&done);
sq_newclosure(v,quit,1);
sq_setparamscheck(v,1,NULL);
@@ -194,58 +194,58 @@ void Interactive(HSQUIRRELVM v)
while (!done)
{
SQInteger i = 0;
- scprintf(_SC("\nsq>"));
+ scprintf("\nsq>");
for(;;) {
int c;
if(done)return;
c = getchar();
- if (c == _SC('\n')) {
- if (i>0 && buffer[i-1] == _SC('\\'))
+ if (c == '\n') {
+ if (i>0 && buffer[i-1] == '\\')
{
- buffer[i-1] = _SC('\n');
+ buffer[i-1] = '\n';
}
else if(blocks==0)break;
- buffer[i++] = _SC('\n');
+ buffer[i++] = '\n';
}
- else if (c==_SC('}')) {blocks--; buffer[i++] = (SQChar)c;}
- else if(c==_SC('{') && !string){
+ else if (c=='}') {blocks--; buffer[i++] = (SQChar)c;}
+ else if(c=='{' && !string){
blocks++;
buffer[i++] = (SQChar)c;
}
- else if(c==_SC('"') || c==_SC('\'')){
+ else if(c=='"' || c=='\''){
string=!string;
buffer[i++] = (SQChar)c;
}
else if (i >= MAXINPUT-1) {
- scfprintf(stderr, _SC("sq : input line too long\n"));
+ scfprintf(stderr, "sq : input line too long\n");
break;
}
else{
buffer[i++] = (SQChar)c;
}
}
- buffer[i] = _SC('\0');
+ buffer[i] = '\0';
- if(buffer[0]==_SC('=')){
- scsprintf(sq_getscratchpad(v,MAXINPUT),_SC("return (%s)"),&buffer[1]);
+ if(buffer[0]=='='){
+ scsprintf(sq_getscratchpad(v,MAXINPUT),"return (%s)",&buffer[1]);
memcpy(buffer,sq_getscratchpad(v,-1),(scstrlen(sq_getscratchpad(v,-1))+1)*sizeof(SQChar));
retval=1;
}
i=scstrlen(buffer);
if(i>0){
SQInteger oldtop=sq_gettop(v);
- if(SQ_SUCCEEDED(sq_compilebuffer(v,buffer,i,_SC("interactive console"),SQTrue))){
+ if(SQ_SUCCEEDED(sq_compilebuffer(v,buffer,i,"interactive console",SQTrue))){
sq_pushroottable(v);
if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue)) && retval){
- scprintf(_SC("\n"));
+ scprintf("\n");
sq_pushroottable(v);
- sq_pushstring(v,_SC("print"),-1);
+ sq_pushstring(v,"print",-1);
sq_get(v,-2);
sq_pushroottable(v);
sq_push(v,-4);
sq_call(v,2,SQFalse,SQTrue);
retval=0;
- scprintf(_SC("\n"));
+ scprintf("\n");
}
}
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
index 78b8a9c60..e4c266362 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp
@@ -16,30 +16,30 @@ void sqstd_printcallstack(HSQUIRRELVM v)
SQInteger level=1; //1 is to skip this function that is level 0
const SQChar *name=0;
SQInteger seq=0;
- pf(v,_SC("\nCALLSTACK\n"));
+ pf(v,"\nCALLSTACK\n");
while(SQ_SUCCEEDED(sq_stackinfos(v,level,&si)))
{
- const SQChar *fn=_SC("unknown");
- const SQChar *src=_SC("unknown");
+ const SQChar *fn="unknown";
+ const SQChar *src="unknown";
if(si.funcname)fn=si.funcname;
if(si.source) {
/* We don't want to bother users with absolute paths to all AI files.
* Since the path only reaches NoAI code in a formatted string we have
* to strip it here. Let's hope nobody installs openttd in a subdirectory
* of a directory named /ai/. */
- src = scstrstr(si.source, _SC("\\ai\\"));
- if (!src) src = scstrstr(si.source, _SC("/ai/"));
+ src = scstrstr(si.source, "\\ai\\");
+ if (!src) src = scstrstr(si.source, "/ai/");
if (src) {
src += 4;
} else {
src = si.source;
}
}
- pf(v,_SC("*FUNCTION [%s()] %s line [%d]\n"),fn,src,si.line);
+ pf(v,"*FUNCTION [%s()] %s line [%d]\n",fn,src,si.line);
level++;
}
level=0;
- pf(v,_SC("\nLOCALS\n"));
+ pf(v,"\nLOCALS\n");
for(level=0;level<10;level++){
seq=0;
@@ -49,56 +49,56 @@ void sqstd_printcallstack(HSQUIRRELVM v)
switch(sq_gettype(v,-1))
{
case OT_NULL:
- pf(v,_SC("[%s] NULL\n"),name);
+ pf(v,"[%s] NULL\n",name);
break;
case OT_INTEGER:
sq_getinteger(v,-1,&i);
- pf(v,_SC("[%s] %d\n"),name,i);
+ pf(v,"[%s] %d\n",name,i);
break;
case OT_FLOAT:
sq_getfloat(v,-1,&f);
- pf(v,_SC("[%s] %.14g\n"),name,f);
+ pf(v,"[%s] %.14g\n",name,f);
break;
case OT_USERPOINTER:
- pf(v,_SC("[%s] USERPOINTER\n"),name);
+ pf(v,"[%s] USERPOINTER\n",name);
break;
case OT_STRING:
sq_getstring(v,-1,&s);
- pf(v,_SC("[%s] \"%s\"\n"),name,s);
+ pf(v,"[%s] \"%s\"\n",name,s);
break;
case OT_TABLE:
- pf(v,_SC("[%s] TABLE\n"),name);
+ pf(v,"[%s] TABLE\n",name);
break;
case OT_ARRAY:
- pf(v,_SC("[%s] ARRAY\n"),name);
+ pf(v,"[%s] ARRAY\n",name);
break;
case OT_CLOSURE:
- pf(v,_SC("[%s] CLOSURE\n"),name);
+ pf(v,"[%s] CLOSURE\n",name);
break;
case OT_NATIVECLOSURE:
- pf(v,_SC("[%s] NATIVECLOSURE\n"),name);
+ pf(v,"[%s] NATIVECLOSURE\n",name);
break;
case OT_GENERATOR:
- pf(v,_SC("[%s] GENERATOR\n"),name);
+ pf(v,"[%s] GENERATOR\n",name);
break;
case OT_USERDATA:
- pf(v,_SC("[%s] USERDATA\n"),name);
+ pf(v,"[%s] USERDATA\n",name);
break;
case OT_THREAD:
- pf(v,_SC("[%s] THREAD\n"),name);
+ pf(v,"[%s] THREAD\n",name);
break;
case OT_CLASS:
- pf(v,_SC("[%s] CLASS\n"),name);
+ pf(v,"[%s] CLASS\n",name);
break;
case OT_INSTANCE:
- pf(v,_SC("[%s] INSTANCE\n"),name);
+ pf(v,"[%s] INSTANCE\n",name);
break;
case OT_WEAKREF:
- pf(v,_SC("[%s] WEAKREF\n"),name);
+ pf(v,"[%s] WEAKREF\n",name);
break;
case OT_BOOL:{
sq_getbool(v,-1,&b);
- pf(v,_SC("[%s] %s\n"),name,b?_SC("true"):_SC("false"));
+ pf(v,"[%s] %s\n",name,b?"true":"false");
}
break;
default: assert(0); break;
@@ -116,10 +116,10 @@ static SQInteger _sqstd_aux_printerror(HSQUIRRELVM v)
const SQChar *sErr = 0;
if(sq_gettop(v)>=1) {
if(SQ_SUCCEEDED(sq_getstring(v,2,&sErr))) {
- pf(v,_SC("\nAN ERROR HAS OCCURED [%s]\n"),sErr);
+ pf(v,"\nAN ERROR HAS OCCURED [%s]\n",sErr);
}
else{
- pf(v,_SC("\nAN ERROR HAS OCCURED [unknown]\n"));
+ pf(v,"\nAN ERROR HAS OCCURED [unknown]\n");
}
sqstd_printcallstack(v);
}
@@ -131,7 +131,7 @@ void _sqstd_compiler_error(HSQUIRRELVM v,const SQChar *sErr,const SQChar *sSourc
{
SQPRINTFUNCTION pf = sq_getprintfunc(v);
if(pf) {
- pf(v,_SC("%s line = (%d) column = (%d) : error %s\n"),sSource,line,column,sErr);
+ pf(v,"%s line = (%d) column = (%d) : error %s\n",sSource,line,column,sErr);
}
}
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp
index 23842ba6f..fb9a51b60 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp
@@ -24,7 +24,7 @@ static SQInteger _blob_resize(HSQUIRRELVM v)
SQInteger size;
sq_getinteger(v,2,&size);
if(!self->Resize(size))
- return sq_throwerror(v,_SC("resize failed"));
+ return sq_throwerror(v,"resize failed");
return 0;
}
@@ -70,7 +70,7 @@ static SQInteger _blob__set(HSQUIRRELVM v)
sq_getinteger(v,2,&idx);
sq_getinteger(v,3,&val);
if(idx < 0 || idx >= self->Len())
- return sq_throwerror(v,_SC("index out of range"));
+ return sq_throwerror(v,"index out of range");
((unsigned char *)self->GetBuf())[idx] = (unsigned char) val;
sq_push(v,3);
return 1;
@@ -82,7 +82,7 @@ static SQInteger _blob__get(HSQUIRRELVM v)
SQInteger idx;
sq_getinteger(v,2,&idx);
if(idx < 0 || idx >= self->Len())
- return sq_throwerror(v,_SC("index out of range"));
+ return sq_throwerror(v,"index out of range");
sq_pushinteger(v,((unsigned char *)self->GetBuf())[idx]);
return 1;
}
@@ -103,12 +103,12 @@ static SQInteger _blob__nexti(HSQUIRRELVM v)
sq_pushnull(v);
return 1;
}
- return sq_throwerror(v,_SC("internal error (_nexti) wrong argument type"));
+ return sq_throwerror(v,"internal error (_nexti) wrong argument type");
}
static SQInteger _blob__typeof(HSQUIRRELVM v)
{
- sq_pushstring(v,_SC("blob"),-1);
+ sq_pushstring(v,"blob",-1);
return 1;
}
@@ -126,26 +126,26 @@ static SQInteger _blob_constructor(HSQUIRRELVM v)
if(nparam == 2) {
sq_getinteger(v, 2, &size);
}
- if(size < 0) return sq_throwerror(v, _SC("cannot create blob with negative size"));
+ if(size < 0) return sq_throwerror(v, "cannot create blob with negative size");
SQBlob *b = new SQBlob(size);
if(SQ_FAILED(sq_setinstanceup(v,1,b))) {
delete b;
- return sq_throwerror(v, _SC("cannot create blob with negative size"));
+ return sq_throwerror(v, "cannot create blob with negative size");
}
sq_setreleasehook(v,1,_blob_releasehook);
return 0;
}
-#define _DECL_BLOB_FUNC(name,nparams,typecheck) {_SC(#name),_blob_##name,nparams,typecheck}
+#define _DECL_BLOB_FUNC(name,nparams,typecheck) {#name,_blob_##name,nparams,typecheck}
static SQRegFunction _blob_methods[] = {
- _DECL_BLOB_FUNC(constructor,-1,_SC("xn")),
- _DECL_BLOB_FUNC(resize,2,_SC("xn")),
- _DECL_BLOB_FUNC(swap2,1,_SC("x")),
- _DECL_BLOB_FUNC(swap4,1,_SC("x")),
- _DECL_BLOB_FUNC(_set,3,_SC("xnn")),
- _DECL_BLOB_FUNC(_get,2,_SC("xn")),
- _DECL_BLOB_FUNC(_typeof,1,_SC("x")),
- _DECL_BLOB_FUNC(_nexti,2,_SC("x")),
+ _DECL_BLOB_FUNC(constructor,-1,"xn"),
+ _DECL_BLOB_FUNC(resize,2,"xn"),
+ _DECL_BLOB_FUNC(swap2,1,"x"),
+ _DECL_BLOB_FUNC(swap4,1,"x"),
+ _DECL_BLOB_FUNC(_set,3,"xnn"),
+ _DECL_BLOB_FUNC(_get,2,"xn"),
+ _DECL_BLOB_FUNC(_typeof,1,"x"),
+ _DECL_BLOB_FUNC(_nexti,2,"x"),
{0,0,0,0}
};
@@ -197,13 +197,13 @@ static SQInteger _g_blob_swapfloat(HSQUIRRELVM v)
return 1;
}
-#define _DECL_GLOBALBLOB_FUNC(name,nparams,typecheck) {_SC(#name),_g_blob_##name,nparams,typecheck}
+#define _DECL_GLOBALBLOB_FUNC(name,nparams,typecheck) {#name,_g_blob_##name,nparams,typecheck}
static SQRegFunction bloblib_funcs[]={
- _DECL_GLOBALBLOB_FUNC(casti2f,2,_SC(".n")),
- _DECL_GLOBALBLOB_FUNC(castf2i,2,_SC(".n")),
- _DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),
- _DECL_GLOBALBLOB_FUNC(swap4,2,_SC(".n")),
- _DECL_GLOBALBLOB_FUNC(swapfloat,2,_SC(".n")),
+ _DECL_GLOBALBLOB_FUNC(casti2f,2,".n"),
+ _DECL_GLOBALBLOB_FUNC(castf2i,2,".n"),
+ _DECL_GLOBALBLOB_FUNC(swap2,2,".n"),
+ _DECL_GLOBALBLOB_FUNC(swap4,2,".n"),
+ _DECL_GLOBALBLOB_FUNC(swapfloat,2,".n"),
{0,0,0,0}
};
@@ -228,7 +228,7 @@ SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size)
{
SQInteger top = sq_gettop(v);
sq_pushregistrytable(v);
- sq_pushstring(v,_SC("std_blob"),-1);
+ sq_pushstring(v,"std_blob",-1);
if(SQ_SUCCEEDED(sq_get(v,-2))) {
sq_remove(v,-2); //removes the registry
sq_push(v,1); // push the this
@@ -246,6 +246,6 @@ SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size)
SQRESULT sqstd_register_bloblib(HSQUIRRELVM v)
{
- return declare_stream(v,_SC("blob"),(SQUserPointer)SQSTD_BLOB_TYPE_TAG,_SC("std_blob"),_blob_methods,bloblib_funcs);
+ return declare_stream(v,"blob",(SQUserPointer)SQSTD_BLOB_TYPE_TAG,"std_blob",_blob_methods,bloblib_funcs);
}
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdio.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdio.cpp
index 28b3503e2..0a05c4c9e 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdio.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdio.cpp
@@ -106,7 +106,7 @@ private:
static SQInteger _file__typeof(HSQUIRRELVM v)
{
- sq_pushstring(v,_SC("file"),-1);
+ sq_pushstring(v,"file",-1);
return 1;
}
@@ -127,27 +127,27 @@ static SQInteger _file_constructor(HSQUIRRELVM v)
sq_getstring(v, 2, &filename);
sq_getstring(v, 3, &mode);
newf = sqstd_fopen(filename, mode);
- if(!newf) return sq_throwerror(v, _SC("cannot open file"));
+ if(!newf) return sq_throwerror(v, "cannot open file");
} else if(sq_gettype(v,2) == OT_USERPOINTER) {
owns = !(sq_gettype(v,3) == OT_NULL);
sq_getuserpointer(v,2,&newf);
} else {
- return sq_throwerror(v,_SC("wrong parameter"));
+ return sq_throwerror(v,"wrong parameter");
}
f = new SQFile(newf,owns);
if(SQ_FAILED(sq_setinstanceup(v,1,f))) {
delete f;
- return sq_throwerror(v, _SC("cannot create blob with negative size"));
+ return sq_throwerror(v, "cannot create blob with negative size");
}
sq_setreleasehook(v,1,_file_releasehook);
return 0;
}
//bindings
-#define _DECL_FILE_FUNC(name,nparams,typecheck) {_SC(#name),_file_##name,nparams,typecheck}
+#define _DECL_FILE_FUNC(name,nparams,typecheck) {#name,_file_##name,nparams,typecheck}
static SQRegFunction _file_methods[] = {
- _DECL_FILE_FUNC(constructor,3,_SC("x")),
- _DECL_FILE_FUNC(_typeof,1,_SC("x")),
+ _DECL_FILE_FUNC(constructor,3,"x"),
+ _DECL_FILE_FUNC(_typeof,1,"x"),
{0,0,0,0},
};
@@ -157,7 +157,7 @@ SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own)
{
SQInteger top = sq_gettop(v);
sq_pushregistrytable(v);
- sq_pushstring(v,_SC("std_file"),-1);
+ sq_pushstring(v,"std_file",-1);
if(SQ_SUCCEEDED(sq_get(v,-2))) {
sq_remove(v,-2); //removes the registry
sq_pushroottable(v); // push the this
@@ -184,7 +184,7 @@ SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file)
*file = fileobj->GetHandle();
return SQ_OK;
}
- return sq_throwerror(v,_SC("not a file"));
+ return sq_throwerror(v,"not a file");
}
@@ -269,7 +269,7 @@ SQInteger file_write(SQUserPointer file,SQUserPointer p,SQInteger size)
SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
{
- SQFILE file = sqstd_fopen(filename,_SC("rb"));
+ SQFILE file = sqstd_fopen(filename,"rb");
SQInteger ret;
unsigned short us;
unsigned char uc;
@@ -296,11 +296,11 @@ SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
case 0xBBEF:
if(sqstd_fread(&uc,1,sizeof(uc),file) == 0) {
sqstd_fclose(file);
- return sq_throwerror(v,_SC("io error"));
+ return sq_throwerror(v,"io error");
}
if(uc != 0xBF) {
sqstd_fclose(file);
- return sq_throwerror(v,_SC("Unrecognozed ecoding"));
+ return sq_throwerror(v,"Unrecognozed ecoding");
}
func = _io_file_lexfeed_UTF8;
break;//UTF-8 ;
@@ -315,7 +315,7 @@ SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
sqstd_fclose(file);
return SQ_ERROR;
}
- return sq_throwerror(v,_SC("cannot open the file"));
+ return sq_throwerror(v,"cannot open the file");
}
SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror)
@@ -333,8 +333,8 @@ SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool
SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename)
{
- SQFILE file = sqstd_fopen(filename,_SC("wb+"));
- if(!file) return sq_throwerror(v,_SC("cannot open the file"));
+ SQFILE file = sqstd_fopen(filename,"wb+");
+ if(!file) return sq_throwerror(v,"cannot open the file");
if(SQ_SUCCEEDED(sq_writeclosure(v,file_write,file))) {
sqstd_fclose(file);
return SQ_OK;
@@ -379,11 +379,11 @@ SQInteger _g_io_dofile(HSQUIRRELVM v)
return SQ_ERROR; //propagates the error
}
-#define _DECL_GLOBALIO_FUNC(name,nparams,typecheck) {_SC(#name),_g_io_##name,nparams,typecheck}
+#define _DECL_GLOBALIO_FUNC(name,nparams,typecheck) {#name,_g_io_##name,nparams,typecheck}
static SQRegFunction iolib_funcs[]={
- _DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")),
- _DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")),
- _DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")),
+ _DECL_GLOBALIO_FUNC(loadfile,-2,".sb"),
+ _DECL_GLOBALIO_FUNC(dofile,-2,".sb"),
+ _DECL_GLOBALIO_FUNC(writeclosuretofile,3,".sc"),
{0,0,0,0}
};
@@ -391,14 +391,14 @@ SQRESULT sqstd_register_iolib(HSQUIRRELVM v)
{
SQInteger top = sq_gettop(v);
//create delegate
- declare_stream(v,_SC("file"),(SQUserPointer)SQSTD_FILE_TYPE_TAG,_SC("std_file"),_file_methods,iolib_funcs);
- sq_pushstring(v,_SC("stdout"),-1);
+ declare_stream(v,"file",(SQUserPointer)SQSTD_FILE_TYPE_TAG,"std_file",_file_methods,iolib_funcs);
+ sq_pushstring(v,"stdout",-1);
sqstd_createfile(v,stdout,SQFalse);
sq_createslot(v,-3);
- sq_pushstring(v,_SC("stdin"),-1);
+ sq_pushstring(v,"stdin",-1);
sqstd_createfile(v,stdin,SQFalse);
sq_createslot(v,-3);
- sq_pushstring(v,_SC("stderr"),-1);
+ sq_pushstring(v,"stderr",-1);
sqstd_createfile(v,stderr,SQFalse);
sq_createslot(v,-3);
sq_settop(v,top);
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
index 132f341f2..0f5d65194 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
@@ -26,7 +26,7 @@ static SQInteger math_srand(HSQUIRRELVM v)
{
SQInteger i;
if(SQ_FAILED(sq_getinteger(v,2,&i)))
- return sq_throwerror(v,_SC("invalid param"));
+ return sq_throwerror(v,"invalid param");
srand((unsigned int)i);
return 0;
}
@@ -62,28 +62,28 @@ SINGLE_ARG_FUNC(floor, 1)
SINGLE_ARG_FUNC(ceil, 1)
SINGLE_ARG_FUNC(exp, 100)
-#define _DECL_FUNC(name,nparams,tycheck) {_SC(#name),math_##name,nparams,tycheck}
+#define _DECL_FUNC(name,nparams,tycheck) {#name,math_##name,nparams,tycheck}
static SQRegFunction mathlib_funcs[] = {
- _DECL_FUNC(sqrt,2,_SC(".n")),
- _DECL_FUNC(sin,2,_SC(".n")),
- _DECL_FUNC(cos,2,_SC(".n")),
- _DECL_FUNC(asin,2,_SC(".n")),
- _DECL_FUNC(acos,2,_SC(".n")),
- _DECL_FUNC(log,2,_SC(".n")),
- _DECL_FUNC(log10,2,_SC(".n")),
- _DECL_FUNC(tan,2,_SC(".n")),
- _DECL_FUNC(atan,2,_SC(".n")),
- _DECL_FUNC(atan2,3,_SC(".nn")),
- _DECL_FUNC(pow,3,_SC(".nn")),
- _DECL_FUNC(floor,2,_SC(".n")),
- _DECL_FUNC(ceil,2,_SC(".n")),
- _DECL_FUNC(exp,2,_SC(".n")),
+ _DECL_FUNC(sqrt,2,".n"),
+ _DECL_FUNC(sin,2,".n"),
+ _DECL_FUNC(cos,2,".n"),
+ _DECL_FUNC(asin,2,".n"),
+ _DECL_FUNC(acos,2,".n"),
+ _DECL_FUNC(log,2,".n"),
+ _DECL_FUNC(log10,2,".n"),
+ _DECL_FUNC(tan,2,".n"),
+ _DECL_FUNC(atan,2,".n"),
+ _DECL_FUNC(atan2,3,".nn"),
+ _DECL_FUNC(pow,3,".nn"),
+ _DECL_FUNC(floor,2,".n"),
+ _DECL_FUNC(ceil,2,".n"),
+ _DECL_FUNC(exp,2,".n"),
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
- _DECL_FUNC(srand,2,_SC(".n")),
+ _DECL_FUNC(srand,2,".n"),
_DECL_FUNC(rand,1,NULL),
#endif /* EXPORT_DEFAULT_SQUIRREL_FUNCTIONS */
- _DECL_FUNC(fabs,2,_SC(".n")),
- _DECL_FUNC(abs,2,_SC(".n")),
+ _DECL_FUNC(fabs,2,".n"),
+ _DECL_FUNC(abs,2,".n"),
{0,0,0,0},
};
@@ -103,11 +103,11 @@ SQRESULT sqstd_register_mathlib(HSQUIRRELVM v)
i++;
}
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
- sq_pushstring(v,_SC("RAND_MAX"),-1);
+ sq_pushstring(v,"RAND_MAX",-1);
sq_pushinteger(v,RAND_MAX);
sq_createslot(v,-3);
#endif /* EXPORT_DEFAULT_SQUIRREL_FUNCTIONS */
- sq_pushstring(v,_SC("PI"),-1);
+ sq_pushstring(v,"PI",-1);
sq_pushfloat(v,(SQFloat)M_PI);
sq_createslot(v,-3);
return SQ_OK;
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp
index 90d980e10..a7aa5303d 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp
@@ -16,10 +16,10 @@
static const SQChar *g_nnames[] =
{
- _SC("NONE"),_SC("OP_GREEDY"), _SC("OP_OR"),
- _SC("OP_EXPR"),_SC("OP_NOCAPEXPR"),_SC("OP_DOT"), _SC("OP_CLASS"),
- _SC("OP_CCLASS"),_SC("OP_NCLASS"),_SC("OP_RANGE"),_SC("OP_CHAR"),
- _SC("OP_EOL"),_SC("OP_BOL"),_SC("OP_WB")
+ "NONE","OP_GREEDY", "OP_OR",
+ "OP_EXPR","OP_NOCAPEXPR","OP_DOT", "OP_CLASS",
+ "OP_CCLASS","OP_NCLASS","OP_RANGE","OP_CHAR",
+ "OP_EOL","OP_BOL","OP_WB"
};
#endif
@@ -99,7 +99,7 @@ static void sqstd_rex_error(SQRex *exp,const SQChar *error)
static void sqstd_rex_expect(SQRex *exp, SQChar n){
if((*exp->_p) != n)
- sqstd_rex_error(exp, _SC("expected paren"));
+ sqstd_rex_error(exp, "expected paren");
exp->_p++;
}
@@ -115,7 +115,7 @@ static SQChar sqstd_rex_escapechar(SQRex *exp)
case 'f': exp->_p++; return '\f';
default: return (*exp->_p++);
}
- } else if(!scisprint(*exp->_p)) sqstd_rex_error(exp,_SC("letter expected"));
+ } else if(!scisprint(*exp->_p)) sqstd_rex_error(exp,"letter expected");
return (*exp->_p++);
}
@@ -159,7 +159,7 @@ static SQInteger sqstd_rex_charnode(SQRex *exp,SQBool isclass)
}
else if(!scisprint(*exp->_p)) {
- sqstd_rex_error(exp,_SC("letter expected"));
+ sqstd_rex_error(exp,"letter expected");
}
t = *exp->_p; exp->_p++;
return sqstd_rex_newnode(exp,t);
@@ -173,15 +173,15 @@ static SQInteger sqstd_rex_class(SQRex *exp)
exp->_p++;
}else ret = sqstd_rex_newnode(exp,OP_CLASS);
- if(*exp->_p == ']') sqstd_rex_error(exp,_SC("empty class"));
+ if(*exp->_p == ']') sqstd_rex_error(exp,"empty class");
chain = ret;
while(*exp->_p != ']' && exp->_p != exp->_eol) {
if(*exp->_p == '-' && first != -1){
SQInteger r;
- if(*exp->_p++ == ']') sqstd_rex_error(exp,_SC("unfinished range"));
+ if(*exp->_p++ == ']') sqstd_rex_error(exp,"unfinished range");
r = sqstd_rex_newnode(exp,OP_RANGE);
- if(exp->_nodes[first].type>*exp->_p) sqstd_rex_error(exp,_SC("invalid range"));
- if(exp->_nodes[first].type == OP_CCLASS) sqstd_rex_error(exp,_SC("cannot use character classes in ranges"));
+ if(exp->_nodes[first].type>*exp->_p) sqstd_rex_error(exp,"invalid range");
+ if(exp->_nodes[first].type == OP_CCLASS) sqstd_rex_error(exp,"cannot use character classes in ranges");
exp->_nodes[r].left = exp->_nodes[first].type;
SQInteger t = sqstd_rex_escapechar(exp);
exp->_nodes[r].right = t;
@@ -220,7 +220,7 @@ static SQInteger sqstd_rex_parsenumber(SQRex *exp)
exp->_p++;
while(isdigit(*exp->_p)) {
ret = ret*10+(*exp->_p++-'0');
- if(positions==1000000000) sqstd_rex_error(exp,_SC("overflow in numeric constant"));
+ if(positions==1000000000) sqstd_rex_error(exp,"overflow in numeric constant");
positions *= 10;
};
return ret;
@@ -238,7 +238,7 @@ static SQInteger sqstd_rex_element(SQRex *exp)
if(*exp->_p =='?') {
exp->_p++;
- sqstd_rex_expect(exp,_SC(':'));
+ sqstd_rex_expect(exp,':');
expr = sqstd_rex_newnode(exp,OP_NOCAPEXPR);
}
else
@@ -246,13 +246,13 @@ static SQInteger sqstd_rex_element(SQRex *exp)
SQInteger newn = sqstd_rex_list(exp);
exp->_nodes[expr].left = newn;
ret = expr;
- sqstd_rex_expect(exp,_SC(')'));
+ sqstd_rex_expect(exp,')');
}
break;
case '[':
exp->_p++;
ret = sqstd_rex_class(exp);
- sqstd_rex_expect(exp,_SC(']'));
+ sqstd_rex_expect(exp,']');
break;
case SQREX_SYMBOL_END_OF_STRING: exp->_p++; ret = sqstd_rex_newnode(exp,OP_EOL);break;
case SQREX_SYMBOL_ANY_CHAR: exp->_p++; ret = sqstd_rex_newnode(exp,OP_DOT);break;
@@ -271,7 +271,7 @@ static SQInteger sqstd_rex_element(SQRex *exp)
case SQREX_SYMBOL_GREEDY_ZERO_OR_ONE: p0 = 0; p1 = 1; exp->_p++; isgreedy = SQTrue; break;
case '{':
exp->_p++;
- if(!isdigit(*exp->_p)) sqstd_rex_error(exp,_SC("number expected"));
+ if(!isdigit(*exp->_p)) sqstd_rex_error(exp,"number expected");
p0 = (unsigned short)sqstd_rex_parsenumber(exp);
/*******************************/
switch(*exp->_p) {
@@ -284,10 +284,10 @@ static SQInteger sqstd_rex_element(SQRex *exp)
if(isdigit(*exp->_p)){
p1 = (unsigned short)sqstd_rex_parsenumber(exp);
}
- sqstd_rex_expect(exp,_SC('}'));
+ sqstd_rex_expect(exp,'}');
break;
default:
- sqstd_rex_error(exp,_SC(", or } expected"));
+ sqstd_rex_error(exp,", or } expected");
}
/*******************************/
isgreedy = SQTrue;
@@ -537,23 +537,23 @@ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error)
SQInteger res = sqstd_rex_list(exp);
exp->_nodes[exp->_first].left = res;
if(*exp->_p!='\0')
- sqstd_rex_error(exp,_SC("unexpected character"));
+ sqstd_rex_error(exp,"unexpected character");
#ifdef _DEBUG
{
SQInteger nsize,i;
SQRexNode *t;
nsize = exp->_nsize;
t = &exp->_nodes[0];
- scprintf(_SC("\n"));
+ scprintf("\n");
/* XXX -- The (int) casts are needed to silent warnings on 64bit systems (SQInteger is 64bit, %d assumes 32bit, (int) is 32bit) */
for(i = 0;i < nsize; i++) {
if(exp->_nodes[i].type>MAX_CHAR)
- scprintf(_SC("[%02d] %10s "),(int)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]);
+ scprintf("[%02d] %10s ",(int)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]);
else
- scprintf(_SC("[%02d] %10c "),(int)i,exp->_nodes[i].type);
- scprintf(_SC("left %02d right %02d next %02d\n"),(int)exp->_nodes[i].left,(int)exp->_nodes[i].right,(int)exp->_nodes[i].next);
+ scprintf("[%02d] %10c ",(int)i,exp->_nodes[i].type);
+ scprintf("left %02d right %02d next %02d\n",(int)exp->_nodes[i].left,(int)exp->_nodes[i].right,(int)exp->_nodes[i].next);
}
- scprintf(_SC("\n"));
+ scprintf("\n");
}
#endif
exp->_matches = (SQRexMatch *) sq_malloc(exp->_nsubexpr * sizeof(SQRexMatch));
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp
index 147fc66ca..8c37e8939 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp
@@ -12,9 +12,9 @@
#define SETUP_STREAM(v) \
SQStream *self = NULL; \
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_STREAM_TYPE_TAG))) \
- return sq_throwerror(v,_SC("invalid type tag")); \
+ return sq_throwerror(v,"invalid type tag"); \
if(!self->IsValid()) \
- return sq_throwerror(v,_SC("the stream is invalid"));
+ return sq_throwerror(v,"the stream is invalid");
SQInteger _stream_readblob(HSQUIRRELVM v)
{
@@ -28,14 +28,14 @@ SQInteger _stream_readblob(HSQUIRRELVM v)
data = sq_getscratchpad(v,size);
res = self->Read(data,size);
if(res <= 0)
- return sq_throwerror(v,_SC("no data left to read"));
+ return sq_throwerror(v,"no data left to read");
blobp = sqstd_createblob(v,res);
memcpy(blobp,data,res);
return 1;
}
#define SAFE_READN(ptr,len) { \
- if(self->Read(ptr,len) != len) return sq_throwerror(v,_SC("io error")); \
+ if(self->Read(ptr,len) != len) return sq_throwerror(v,"io error"); \
}
SQInteger _stream_readn(HSQUIRRELVM v)
{
@@ -92,7 +92,7 @@ SQInteger _stream_readn(HSQUIRRELVM v)
}
break;
default:
- return sq_throwerror(v, _SC("invalid format"));
+ return sq_throwerror(v, "invalid format");
}
return 1;
}
@@ -103,10 +103,10 @@ SQInteger _stream_writeblob(HSQUIRRELVM v)
SQInteger size;
SETUP_STREAM(v);
if(SQ_FAILED(sqstd_getblob(v,2,&data)))
- return sq_throwerror(v,_SC("invalid parameter"));
+ return sq_throwerror(v,"invalid parameter");
size = sqstd_getblobsize(v,2);
if(self->Write(data,size) != size)
- return sq_throwerror(v,_SC("io error"));
+ return sq_throwerror(v,"io error");
sq_pushinteger(v,size);
return 1;
}
@@ -175,7 +175,7 @@ SQInteger _stream_writen(HSQUIRRELVM v)
}
break;
default:
- return sq_throwerror(v, _SC("invalid format"));
+ return sq_throwerror(v, "invalid format");
}
return 0;
}
@@ -192,7 +192,7 @@ SQInteger _stream_seek(HSQUIRRELVM v)
case 'b': origin = SQ_SEEK_SET; break;
case 'c': origin = SQ_SEEK_CUR; break;
case 'e': origin = SQ_SEEK_END; break;
- default: return sq_throwerror(v,_SC("invalid origin"));
+ default: return sq_throwerror(v,"invalid origin");
}
}
sq_pushinteger(v, self->Seek(offset, origin));
@@ -234,24 +234,24 @@ SQInteger _stream_eos(HSQUIRRELVM v)
}
static SQRegFunction _stream_methods[] = {
- _DECL_STREAM_FUNC(readblob,2,_SC("xn")),
- _DECL_STREAM_FUNC(readn,2,_SC("xn")),
- _DECL_STREAM_FUNC(writeblob,-2,_SC("xx")),
- _DECL_STREAM_FUNC(writen,3,_SC("xnn")),
- _DECL_STREAM_FUNC(seek,-2,_SC("xnn")),
- _DECL_STREAM_FUNC(tell,1,_SC("x")),
- _DECL_STREAM_FUNC(len,1,_SC("x")),
- _DECL_STREAM_FUNC(eos,1,_SC("x")),
- _DECL_STREAM_FUNC(flush,1,_SC("x")),
+ _DECL_STREAM_FUNC(readblob,2,"xn"),
+ _DECL_STREAM_FUNC(readn,2,"xn"),
+ _DECL_STREAM_FUNC(writeblob,-2,"xx"),
+ _DECL_STREAM_FUNC(writen,3,"xnn"),
+ _DECL_STREAM_FUNC(seek,-2,"xnn"),
+ _DECL_STREAM_FUNC(tell,1,"x"),
+ _DECL_STREAM_FUNC(len,1,"x"),
+ _DECL_STREAM_FUNC(eos,1,"x"),
+ _DECL_STREAM_FUNC(flush,1,"x"),
{0,0,0,0}
};
void init_streamclass(HSQUIRRELVM v)
{
sq_pushregistrytable(v);
- sq_pushstring(v,_SC("std_stream"),-1);
+ sq_pushstring(v,"std_stream",-1);
if(SQ_FAILED(sq_get(v,-2))) {
- sq_pushstring(v,_SC("std_stream"),-1);
+ sq_pushstring(v,"std_stream",-1);
sq_newclass(v,SQFalse);
sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG);
SQInteger i = 0;
@@ -265,8 +265,8 @@ void init_streamclass(HSQUIRRELVM v)
}
sq_createslot(v,-3);
sq_pushroottable(v);
- sq_pushstring(v,_SC("stream"),-1);
- sq_pushstring(v,_SC("std_stream"),-1);
+ sq_pushstring(v,"stream",-1);
+ sq_pushstring(v,"std_stream",-1);
sq_get(v,-4);
sq_createslot(v,-3);
sq_pop(v,1);
@@ -280,13 +280,13 @@ void init_streamclass(HSQUIRRELVM v)
SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals)
{
if(sq_gettype(v,-1) != OT_TABLE)
- return sq_throwerror(v,_SC("table expected"));
+ return sq_throwerror(v,"table expected");
SQInteger top = sq_gettop(v);
//create delegate
init_streamclass(v);
sq_pushregistrytable(v);
sq_pushstring(v,reg_name,-1);
- sq_pushstring(v,_SC("std_stream"),-1);
+ sq_pushstring(v,"std_stream",-1);
if(SQ_SUCCEEDED(sq_get(v,-3))) {
sq_newclass(v,SQTrue);
sq_settypetag(v,-1,typetag);
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdstream.h b/src/3rdparty/squirrel/sqstdlib/sqstdstream.h
index 4dcc00054..d87cf7ac8 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdstream.h
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdstream.h
@@ -13,6 +13,6 @@ SQInteger _stream_len(HSQUIRRELVM v);
SQInteger _stream_eos(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) {#name,_stream_##name,nparams,typecheck}
SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals);
#endif /*_SQSTD_STREAM_H_*/
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp
index 8ec264906..1671f0b1a 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp
@@ -21,13 +21,13 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
SQInteger wc = 0;
SQInteger start = n;
fmt[0] = '%';
- while (scstrchr(_SC("-+ #0"), src[n])) n++;
+ while (scstrchr("-+ #0", src[n])) n++;
while (scisdigit(src[n])) {
swidth[wc] = src[n];
n++;
wc++;
if(wc>=MAX_WFORMAT_LEN)
- return sq_throwerror(v,_SC("width format too long"));
+ return sq_throwerror(v,"width format too long");
}
swidth[wc] = '\0';
if(wc > 0) {
@@ -44,7 +44,7 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
n++;
wc++;
if(wc>=MAX_WFORMAT_LEN)
- return sq_throwerror(v,_SC("precision format too long"));
+ return sq_throwerror(v,"precision format too long");
}
swidth[wc] = '\0';
if(wc > 0) {
@@ -52,7 +52,7 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
}
}
if (n-start > MAX_FORMAT_LEN )
- return sq_throwerror(v,_SC("format too long"));
+ return sq_throwerror(v,"format too long");
memcpy(&fmt[1],&src[start],((n-start)+1)*sizeof(SQChar));
fmt[(n-start)+2] = '\0';
return n;
@@ -96,7 +96,7 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
else {
n++;
if( nparam > sq_gettop(v) )
- return sq_throwerror(v,_SC("not enough paramters for the given format string"));
+ return sq_throwerror(v,"not enough paramters for the given format string");
n = validate_format(v,fmt,format,n,w);
if(n < 0) return -1;
SQInteger addlen = 0;
@@ -107,24 +107,24 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
switch(format[n]) {
case 's':
if(SQ_FAILED(sq_getstring(v,nparam,&ts)))
- return sq_throwerror(v,_SC("string expected for the specified format"));
+ return sq_throwerror(v,"string expected for the specified format");
addlen = (sq_getsize(v,nparam)*sizeof(SQChar))+((w+1)*sizeof(SQChar));
valtype = 's';
break;
case 'i': case 'd': case 'c':case 'o': case 'u': case 'x': case 'X':
if(SQ_FAILED(sq_getinteger(v,nparam,&ti)))
- return sq_throwerror(v,_SC("integer expected for the specified format"));
+ return sq_throwerror(v,"integer expected for the specified format");
addlen = (ADDITIONAL_FORMAT_SPACE)+((w+1)*sizeof(SQChar));
valtype = 'i';
break;
case 'f': case 'g': case 'G': case 'e': case 'E':
if(SQ_FAILED(sq_getfloat(v,nparam,&tf)))
- return sq_throwerror(v,_SC("float expected for the specified format"));
+ return sq_throwerror(v,"float expected for the specified format");
addlen = (ADDITIONAL_FORMAT_SPACE)+((w+1)*sizeof(SQChar));
valtype = 'f';
break;
default:
- return sq_throwerror(v,_SC("invalid format"));
+ return sq_throwerror(v,"invalid format");
}
n++;
allocated += addlen + sizeof(SQChar);
@@ -207,7 +207,7 @@ static SQInteger _string_split(HSQUIRRELVM v)
SQChar *stemp,*tok;
sq_getstring(v,2,&str);
sq_getstring(v,3,&seps);
- if(sq_getsize(v,3) == 0) return sq_throwerror(v,_SC("empty separators string"));
+ if(sq_getsize(v,3) == 0) return sq_throwerror(v,"empty separators string");
SQInteger memsize = (sq_getsize(v,2)+1)*sizeof(SQChar);
stemp = sq_getscratchpad(v,memsize);
memcpy(stemp,str,memsize);
@@ -249,10 +249,10 @@ static SQInteger _regexp_match(HSQUIRRELVM v)
static void _addrexmatch(HSQUIRRELVM v,const SQChar *str,const SQChar *begin,const SQChar *end)
{
sq_newtable(v);
- sq_pushstring(v,_SC("begin"),-1);
+ sq_pushstring(v,"begin",-1);
sq_pushinteger(v,begin - str);
sq_rawset(v,-3);
- sq_pushstring(v,_SC("end"),-1);
+ sq_pushstring(v,"end",-1);
sq_pushinteger(v,end - str);
sq_rawset(v,-3);
}
@@ -315,35 +315,35 @@ static SQInteger _regexp_constructor(HSQUIRRELVM v)
static SQInteger _regexp__typeof(HSQUIRRELVM v)
{
- sq_pushstring(v,_SC("regexp"),-1);
+ sq_pushstring(v,"regexp",-1);
return 1;
}
-#define _DECL_REX_FUNC(name,nparams,pmask) {_SC(#name),_regexp_##name,nparams,pmask}
+#define _DECL_REX_FUNC(name,nparams,pmask) {#name,_regexp_##name,nparams,pmask}
static SQRegFunction rexobj_funcs[]={
- _DECL_REX_FUNC(constructor,2,_SC(".s")),
- _DECL_REX_FUNC(search,-2,_SC("xsn")),
- _DECL_REX_FUNC(match,2,_SC("xs")),
- _DECL_REX_FUNC(capture,-2,_SC("xsn")),
- _DECL_REX_FUNC(subexpcount,1,_SC("x")),
- _DECL_REX_FUNC(_typeof,1,_SC("x")),
+ _DECL_REX_FUNC(constructor,2,".s"),
+ _DECL_REX_FUNC(search,-2,"xsn"),
+ _DECL_REX_FUNC(match,2,"xs"),
+ _DECL_REX_FUNC(capture,-2,"xsn"),
+ _DECL_REX_FUNC(subexpcount,1,"x"),
+ _DECL_REX_FUNC(_typeof,1,"x"),
{0,0,0,0}
};
-#define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_string_##name,nparams,pmask}
+#define _DECL_FUNC(name,nparams,pmask) {#name,_string_##name,nparams,pmask}
static SQRegFunction stringlib_funcs[]={
- _DECL_FUNC(format,-2,_SC(".s")),
- _DECL_FUNC(strip,2,_SC(".s")),
- _DECL_FUNC(lstrip,2,_SC(".s")),
- _DECL_FUNC(rstrip,2,_SC(".s")),
- _DECL_FUNC(split,3,_SC(".ss")),
+ _DECL_FUNC(format,-2,".s"),
+ _DECL_FUNC(strip,2,".s"),
+ _DECL_FUNC(lstrip,2,".s"),
+ _DECL_FUNC(rstrip,2,".s"),
+ _DECL_FUNC(split,3,".ss"),
{0,0,0,0}
};
SQInteger sqstd_register_stringlib(HSQUIRRELVM v)
{
- sq_pushstring(v,_SC("regexp"),-1);
+ sq_pushstring(v,"regexp",-1);
sq_newclass(v,SQFalse);
SQInteger i = 0;
while(rexobj_funcs[i].name != 0) {
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp
index 70bc097be..c30f98766 100644
--- a/src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp
+++ b/src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp
@@ -29,7 +29,7 @@ static SQInteger _system_system(HSQUIRRELVM v)
sq_pushinteger(v,scsystem(s));
return 1;
}
- return sq_throwerror(v,_SC("wrong param"));
+ return sq_throwerror(v,"wrong param");
}
@@ -52,7 +52,7 @@ static SQInteger _system_remove(HSQUIRRELVM v)
const SQChar *s;
sq_getstring(v,2,&s);
if(scremove(s)==-1)
- return sq_throwerror(v,_SC("remove() failed"));
+ return sq_throwerror(v,"remove() failed");
return 0;
}
@@ -62,7 +62,7 @@ static SQInteger _system_rename(HSQUIRRELVM v)
sq_getstring(v,2,&oldn);
sq_getstring(v,3,&newn);
if(screname(oldn,newn)==-1)
- return sq_throwerror(v,_SC("rename() failed"));
+ return sq_throwerror(v,"rename() failed");
return 0;
}
@@ -94,30 +94,30 @@ static SQInteger _system_date(HSQUIRRELVM v)
else
date = localtime(&t);
if(!date)
- return sq_throwerror(v,_SC("crt api failure"));
+ return sq_throwerror(v,"crt api failure");
sq_newtable(v);
- _set_integer_slot(v, _SC("sec"), date->tm_sec);
- _set_integer_slot(v, _SC("min"), date->tm_min);
- _set_integer_slot(v, _SC("hour"), date->tm_hour);
- _set_integer_slot(v, _SC("day"), date->tm_mday);
- _set_integer_slot(v, _SC("month"), date->tm_mon);
- _set_integer_slot(v, _SC("year"), date->tm_year+1900);
- _set_integer_slot(v, _SC("wday"), date->tm_wday);
- _set_integer_slot(v, _SC("yday"), date->tm_yday);
+ _set_integer_slot(v, "sec", date->tm_sec);
+ _set_integer_slot(v, "min", date->tm_min);
+ _set_integer_slot(v, "hour", date->tm_hour);
+ _set_integer_slot(v, "day", date->tm_mday);
+ _set_integer_slot(v, "month", date->tm_mon);
+ _set_integer_slot(v, "year", date->tm_year+1900);
+ _set_integer_slot(v, "wday", date->tm_wday);
+ _set_integer_slot(v, "yday", date->tm_yday);
return 1;
}
-#define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_system_##name,nparams,pmask}
+#define _DECL_FUNC(name,nparams,pmask) {#name,_system_##name,nparams,pmask}
static SQRegFunction systemlib_funcs[]={
- _DECL_FUNC(getenv,2,_SC(".s")),
- _DECL_FUNC(system,2,_SC(".s")),
+ _DECL_FUNC(getenv,2,".s"),
+ _DECL_FUNC(system,2,".s"),
_DECL_FUNC(clock,1,NULL),
_DECL_FUNC(time,1,NULL),
- _DECL_FUNC(date,-1,_SC(".nn")),
- _DECL_FUNC(remove,2,_SC(".s")),
- _DECL_FUNC(rename,3,_SC(".ss")),
+ _DECL_FUNC(date,-1,".nn"),
+ _DECL_FUNC(remove,2,".s"),
+ _DECL_FUNC(rename,3,".ss"),
{0,0,0,0}
};
diff --git a/src/3rdparty/squirrel/squirrel/sqapi.cpp b/src/3rdparty/squirrel/squirrel/sqapi.cpp
index 3447e5762..6dc3def6e 100644
--- a/src/3rdparty/squirrel/squirrel/sqapi.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqapi.cpp
@@ -19,7 +19,7 @@ bool sq_aux_gettypedarg(HSQUIRRELVM v,SQInteger idx,SQObjectType type,SQObjectPt
*o = &stack_get(v,idx);
if(type(**o) != type){
SQObjectPtr oval = v->PrintObjVal(**o);
- v->Raise_Error(_SC("wrong argument type, expected '%s' got '%.50s'"),IdType2Name(type),_stringval(oval));
+ v->Raise_Error("wrong argument type, expected '%s' got '%.50s'",IdType2Name(type),_stringval(oval));
return false;
}
return true;
@@ -29,7 +29,7 @@ bool sq_aux_gettypedarg(HSQUIRRELVM v,SQInteger idx,SQObjectType type,SQObjectPt
#define sq_aux_paramscheck(v,count) \
{ \
- if(sq_gettop(v) < count){ v->Raise_Error(_SC("not enough params in the stack")); return SQ_ERROR; }\
+ if(sq_gettop(v) < count){ v->Raise_Error("not enough params in the stack"); return SQ_ERROR; }\
}
SQInteger sq_aux_throwobject(HSQUIRRELVM v,SQObjectPtr &e)
@@ -40,7 +40,7 @@ SQInteger sq_aux_throwobject(HSQUIRRELVM v,SQObjectPtr &e)
SQInteger sq_aux_invalidtype(HSQUIRRELVM v,SQObjectType type)
{
- scsprintf(_ss(v)->GetScratchPad(100), _SC("unexpected type %s"), IdType2Name(type));
+ scsprintf(_ss(v)->GetScratchPad(100), "unexpected type %s", IdType2Name(type));
return sq_throwerror(v, _ss(v)->GetScratchPad(-1));
}
@@ -253,7 +253,7 @@ SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase)
if(hasbase) {
SQObjectPtr &base = stack_get(v,-1);
if(type(base) != OT_CLASS)
- return sq_throwerror(v,_SC("invalid base type"));
+ return sq_throwerror(v,"invalid base type");
baseclass = _class(base);
}
SQClass *newclass = SQClass::Create(_ss(v), baseclass);
@@ -267,7 +267,7 @@ SQBool sq_instanceof(HSQUIRRELVM v)
SQObjectPtr &inst = stack_get(v,-1);
SQObjectPtr &cl = stack_get(v,-2);
if(type(inst) != OT_INSTANCE || type(cl) != OT_CLASS)
- return sq_throwerror(v,_SC("invalid param type"));
+ return sq_throwerror(v,"invalid param type");
return _instance(inst)->InstanceOf(_class(cl))?SQTrue:SQFalse;
}
@@ -291,7 +291,7 @@ SQRESULT sq_arraypop(HSQUIRRELVM v,SQInteger idx,SQBool pushval)
_array(*arr)->Pop();
return SQ_OK;
}
- return sq_throwerror(v, _SC("empty array"));
+ return sq_throwerror(v, "empty array");
}
SQRESULT sq_arrayresize(HSQUIRRELVM v,SQInteger idx,SQInteger newsize)
@@ -303,7 +303,7 @@ SQRESULT sq_arrayresize(HSQUIRRELVM v,SQInteger idx,SQInteger newsize)
_array(*arr)->Resize(newsize);
return SQ_OK;
}
- return sq_throwerror(v,_SC("negative size"));
+ return sq_throwerror(v,"negative size");
}
@@ -332,7 +332,7 @@ SQRESULT sq_arrayremove(HSQUIRRELVM v,SQInteger idx,SQInteger itemidx)
sq_aux_paramscheck(v, 1);
SQObjectPtr *arr;
_GETSAFE_OBJ(v, idx, OT_ARRAY,arr);
- return _array(*arr)->Remove(itemidx) ? SQ_OK : sq_throwerror(v,_SC("index out of range"));
+ return _array(*arr)->Remove(itemidx) ? SQ_OK : sq_throwerror(v,"index out of range");
}
SQRESULT sq_arrayinsert(HSQUIRRELVM v,SQInteger idx,SQInteger destpos)
@@ -340,7 +340,7 @@ SQRESULT sq_arrayinsert(HSQUIRRELVM v,SQInteger idx,SQInteger destpos)
sq_aux_paramscheck(v, 1);
SQObjectPtr *arr;
_GETSAFE_OBJ(v, idx, OT_ARRAY,arr);
- SQRESULT ret = _array(*arr)->Insert(destpos, v->GetUp(-1)) ? SQ_OK : sq_throwerror(v,_SC("index out of range"));
+ SQRESULT ret = _array(*arr)->Insert(destpos, v->GetUp(-1)) ? SQ_OK : sq_throwerror(v,"index out of range");
v->Pop();
return ret;
}
@@ -367,7 +367,7 @@ SQRESULT sq_getclosureinfo(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger *nparam
*nfreevars = (SQUnsignedInteger)c->_outervalues.size();
return SQ_OK;
}
- return sq_throwerror(v,_SC("the object is not a closure"));
+ return sq_throwerror(v,"the object is not a closure");
}
SQRESULT sq_setnativeclosurename(HSQUIRRELVM v,SQInteger idx,const SQChar *name)
@@ -378,20 +378,20 @@ SQRESULT sq_setnativeclosurename(HSQUIRRELVM v,SQInteger idx,const SQChar *name)
nc->_name = SQString::Create(_ss(v),name);
return SQ_OK;
}
- return sq_throwerror(v,_SC("the object is not a nativeclosure"));
+ return sq_throwerror(v,"the object is not a nativeclosure");
}
SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask)
{
SQObject o = stack_get(v, -1);
if(!sq_isnativeclosure(o))
- return sq_throwerror(v, _SC("native closure expected"));
+ return sq_throwerror(v, "native closure expected");
SQNativeClosure *nc = _nativeclosure(o);
nc->_nparamscheck = nparamscheck;
if(typemask) {
SQIntVec res;
if(!CompileTypemask(res, typemask))
- return sq_throwerror(v, _SC("invalid typemask"));
+ return sq_throwerror(v, "invalid typemask");
nc->_typecheck.copy(res);
}
else {
@@ -408,12 +408,12 @@ SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx)
SQObjectPtr &o = stack_get(v,idx);
if(!sq_isnativeclosure(o) &&
!sq_isclosure(o))
- return sq_throwerror(v,_SC("the target is not a closure"));
+ return sq_throwerror(v,"the target is not a closure");
SQObjectPtr &env = stack_get(v,-1);
if(!sq_istable(env) &&
!sq_isclass(env) &&
!sq_isinstance(env))
- return sq_throwerror(v,_SC("invalid environment"));
+ return sq_throwerror(v,"invalid environment");
SQObjectPtr w = _refcounted(env)->GetWeakRef(type(env));
SQObjectPtr ret;
if(sq_isclosure(o)) {
@@ -438,7 +438,7 @@ SQRESULT sq_clear(HSQUIRRELVM v,SQInteger idx)
case OT_TABLE: _table(o)->Clear(); break;
case OT_ARRAY: _array(o)->Resize(0); break;
default:
- return sq_throwerror(v, _SC("clear only works on table and array"));
+ return sq_throwerror(v, "clear only works on table and array");
break;
}
@@ -468,7 +468,7 @@ SQRESULT sq_setroottable(HSQUIRRELVM v)
v->Pop();
return SQ_OK;
}
- return sq_throwerror(v, _SC("ivalid type"));
+ return sq_throwerror(v, "ivalid type");
}
SQRESULT sq_setconsttable(HSQUIRRELVM v)
@@ -479,7 +479,7 @@ SQRESULT sq_setconsttable(HSQUIRRELVM v)
v->Pop();
return SQ_OK;
}
- return sq_throwerror(v, _SC("ivalid type, expected table"));
+ return sq_throwerror(v, "ivalid type, expected table");
}
void sq_setforeignptr(HSQUIRRELVM v,SQUserPointer p)
@@ -605,7 +605,7 @@ SQRESULT sq_settypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer typetag)
switch(type(o)) {
case OT_USERDATA: _userdata(o)->_typetag = typetag; break;
case OT_CLASS: _class(o)->_typetag = typetag; break;
- default: return sq_throwerror(v,_SC("invalid object type"));
+ default: return sq_throwerror(v,"invalid object type");
}
return SQ_OK;
}
@@ -625,7 +625,7 @@ SQRESULT sq_gettypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer *typetag)
{
SQObjectPtr &o = stack_get(v,idx);
if(SQ_FAILED(sq_getobjtypetag(&o,typetag)))
- return sq_throwerror(v,_SC("invalid object type"));
+ return sq_throwerror(v,"invalid object type");
return SQ_OK;
}
@@ -640,7 +640,7 @@ SQRESULT sq_getuserpointer(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p)
SQRESULT sq_setinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer p)
{
SQObjectPtr &o = stack_get(v,idx);
- if(type(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance"));
+ if(type(o) != OT_INSTANCE) return sq_throwerror(v,"the object is not a class instance");
_instance(o)->_userpointer = p;
return SQ_OK;
}
@@ -648,8 +648,8 @@ SQRESULT sq_setinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer p)
SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize)
{
SQObjectPtr &o = stack_get(v,idx);
- if(type(o) != OT_CLASS) return sq_throwerror(v,_SC("the object is not a class"));
- if(_class(o)->_locked) return sq_throwerror(v,_SC("the class is locked"));
+ if(type(o) != OT_CLASS) return sq_throwerror(v,"the object is not a class");
+ if(_class(o)->_locked) return sq_throwerror(v,"the class is locked");
_class(o)->_udsize = udsize;
return SQ_OK;
}
@@ -658,7 +658,7 @@ SQRESULT sq_setclassudsize(HSQUIRRELVM v, SQInteger idx, SQInteger udsize)
SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserPointer typetag)
{
SQObjectPtr &o = stack_get(v,idx);
- if(type(o) != OT_INSTANCE) return sq_throwerror(v,_SC("the object is not a class instance"));
+ if(type(o) != OT_INSTANCE) return sq_throwerror(v,"the object is not a class instance");
(*p) = _instance(o)->_userpointer;
if(typetag != 0) {
SQClass *cl = _instance(o)->_class;
@@ -667,7 +667,7 @@ SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p,SQUserP
return SQ_OK;
cl = cl->_base;
}while(cl != NULL);
- return sq_throwerror(v,_SC("invalid type tag"));
+ return sq_throwerror(v,"invalid type tag");
}
return SQ_OK;
}
@@ -717,7 +717,7 @@ SQRESULT sq_newslot(HSQUIRRELVM v, SQInteger idx, SQBool bstatic)
SQObjectPtr &self = stack_get(v, idx);
if(type(self) == OT_TABLE || type(self) == OT_CLASS) {
SQObjectPtr &key = v->GetUp(-2);
- if(type(key) == OT_NULL) return sq_throwerror(v, _SC("null is not a valid key"));
+ if(type(key) == OT_NULL) return sq_throwerror(v, "null is not a valid key");
v->NewSlot(self, key, v->GetUp(-1),bstatic?true:false);
v->Pop(2);
}
@@ -730,7 +730,7 @@ SQRESULT sq_deleteslot(HSQUIRRELVM v,SQInteger idx,SQBool pushval)
SQObjectPtr *self;
_GETSAFE_OBJ(v, idx, OT_TABLE,self);
SQObjectPtr &key = v->GetUp(-1);
- if(type(key) == OT_NULL) return sq_throwerror(v, _SC("null is not a valid key"));
+ if(type(key) == OT_NULL) return sq_throwerror(v, "null is not a valid key");
SQObjectPtr res;
if(!v->DeleteSlot(*self, key, res)){
return SQ_ERROR;
@@ -753,7 +753,7 @@ SQRESULT sq_set(HSQUIRRELVM v,SQInteger idx)
SQRESULT sq_rawset(HSQUIRRELVM v,SQInteger idx)
{
SQObjectPtr &self = stack_get(v, idx);
- if(type(v->GetUp(-2)) == OT_NULL) return sq_throwerror(v, _SC("null key"));
+ if(type(v->GetUp(-2)) == OT_NULL) return sq_throwerror(v, "null key");
switch(type(self)) {
case OT_TABLE:
_table(self)->NewSlot(v->GetUp(-2), v->GetUp(-1));
@@ -779,7 +779,7 @@ SQRESULT sq_rawset(HSQUIRRELVM v,SQInteger idx)
break;
default:
v->Pop(2);
- return sq_throwerror(v, _SC("rawset works only on array/table/class and instance"));
+ return sq_throwerror(v, "rawset works only on array/table/class and instance");
}
v->Raise_IdxError(v->GetUp(-2));return SQ_ERROR;
}
@@ -792,7 +792,7 @@ SQRESULT sq_setdelegate(HSQUIRRELVM v,SQInteger idx)
switch(type) {
case OT_TABLE:
if(type(mt) == OT_TABLE) {
- if(!_table(self)->SetDelegate(_table(mt))) return sq_throwerror(v, _SC("delagate cycle")); v->Pop();}
+ 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(); }
else return sq_aux_invalidtype(v,type);
@@ -841,7 +841,7 @@ SQRESULT sq_getdelegate(HSQUIRRELVM v,SQInteger idx)
}
v->Push(SQObjectPtr(_delegable(self)->_delegate));
break;
- default: return sq_throwerror(v,_SC("wrong type")); break;
+ default: return sq_throwerror(v,"wrong type"); break;
}
return SQ_OK;
@@ -853,7 +853,7 @@ SQRESULT sq_get(HSQUIRRELVM v,SQInteger idx)
if(v->Get(self,v->GetUp(-1),v->GetUp(-1),false,false))
return SQ_OK;
v->Pop(1);
- return sq_throwerror(v,_SC("the index doesn't exist"));
+ return sq_throwerror(v,"the index doesn't exist");
}
SQRESULT sq_rawget(HSQUIRRELVM v,SQInteger idx)
@@ -878,10 +878,10 @@ SQRESULT sq_rawget(HSQUIRRELVM v,SQInteger idx)
break;
default:
v->Pop(1);
- return sq_throwerror(v,_SC("rawget works only on array/table/instance and class"));
+ return sq_throwerror(v,"rawget works only on array/table/instance and class");
}
v->Pop(1);
- return sq_throwerror(v,_SC("the index doesn't exist"));
+ return sq_throwerror(v,"the index doesn't exist");
}
SQRESULT sq_getstackobj(HSQUIRRELVM v,SQInteger idx,HSQOBJECT *po)
@@ -959,7 +959,7 @@ SQRESULT sq_resume(HSQUIRRELVM v,SQBool retval,SQBool raiseerror)
v->Pop();
return SQ_OK;
}
- return sq_throwerror(v,_SC("only generators can be resumed"));
+ return sq_throwerror(v,"only generators can be resumed");
}
SQRESULT sq_call(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror, int suspend)
@@ -983,7 +983,7 @@ SQRESULT sq_call(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror,
}
if(!v->_suspended)
v->Pop(params);
- return sq_throwerror(v,_SC("call failed"));
+ return sq_throwerror(v,"call failed");
}
SQRESULT sq_suspendvm(HSQUIRRELVM v)
@@ -995,7 +995,7 @@ SQRESULT sq_wakeupvm(HSQUIRRELVM v,SQBool wakeupret,SQBool retval,SQBool raiseer
{
SQObjectPtr ret;
if(!v->_suspended)
- return sq_throwerror(v,_SC("cannot resume a vm that is not running any code"));
+ return sq_throwerror(v,"cannot resume a vm that is not running any code");
if(wakeupret) {
v->GetAt(v->_stackbase+v->_suspended_target)=v->GetUp(-1); //retval
v->Pop();
@@ -1051,7 +1051,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(w(up,&tag,2) != 2)
- return sq_throwerror(v,_SC("io error"));
+ return sq_throwerror(v,"io error");
if(!_closure(*o)->Save(v,up,w))
return SQ_ERROR;
return SQ_OK;
@@ -1063,9 +1063,9 @@ SQRESULT sq_readclosure(HSQUIRRELVM v,SQREADFUNC r,SQUserPointer up)
unsigned short tag;
if(r(up,&tag,2) != 2)
- return sq_throwerror(v,_SC("io error"));
+ return sq_throwerror(v,"io error");
if(tag != SQ_BYTECODE_STREAM_TAG)
- return sq_throwerror(v,_SC("invalid stream"));
+ return sq_throwerror(v,"invalid stream");
if(!SQClosure::Load(v,up,r,closure))
return SQ_ERROR;
v->Push(closure);
@@ -1110,13 +1110,13 @@ SQRESULT sq_setfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval)
if(_closure(self)->_outervalues.size()>nval){
_closure(self)->_outervalues[nval]=stack_get(v,-1);
}
- else return sq_throwerror(v,_SC("invalid free var index"));
+ else return sq_throwerror(v,"invalid free var index");
break;
case OT_NATIVECLOSURE:
if(_nativeclosure(self)->_outervalues.size()>nval){
_nativeclosure(self)->_outervalues[nval]=stack_get(v,-1);
}
- else return sq_throwerror(v,_SC("invalid free var index"));
+ else return sq_throwerror(v,"invalid free var index");
break;
default:
return sq_aux_invalidtype(v,type(self));
@@ -1144,7 +1144,7 @@ SQRESULT sq_setattributes(HSQUIRRELVM v,SQInteger idx)
v->Push(attrs);
return SQ_OK;
}
- return sq_throwerror(v,_SC("wrong index"));
+ return sq_throwerror(v,"wrong index");
}
SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
@@ -1164,7 +1164,7 @@ SQRESULT sq_getattributes(HSQUIRRELVM v,SQInteger idx)
v->Push(attrs);
return SQ_OK;
}
- return sq_throwerror(v,_SC("wrong index"));
+ return sq_throwerror(v,"wrong index");
}
SQRESULT sq_getbase(HSQUIRRELVM v,SQInteger idx)
@@ -1208,7 +1208,7 @@ SQRESULT sq_getweakrefval(HSQUIRRELVM v,SQInteger idx)
{
SQObjectPtr &o = stack_get(v,idx);
if(type(o) != OT_WEAKREF) {
- return sq_throwerror(v,_SC("the object must be a weakref"));
+ return sq_throwerror(v,"the object must be a weakref");
}
v->Push(_weakref(o)->_obj);
return SQ_OK;
@@ -1228,7 +1228,7 @@ SQRESULT sq_getdefaultdelegate(HSQUIRRELVM v,SQObjectType t)
case OT_CLASS: v->Push(ss->_class_default_delegate); break;
case OT_INSTANCE: v->Push(ss->_instance_default_delegate); break;
case OT_WEAKREF: v->Push(ss->_weakref_default_delegate); break;
- default: return sq_throwerror(v,_SC("the type doesn't have a default delegate"));
+ default: return sq_throwerror(v,"the type doesn't have a default delegate");
}
return SQ_OK;
}
@@ -1237,7 +1237,7 @@ SQRESULT sq_next(HSQUIRRELVM v,SQInteger idx)
{
SQObjectPtr o=stack_get(v,idx),&refpos = stack_get(v,-1),realkey,val;
if(type(o) == OT_GENERATOR) {
- return sq_throwerror(v,_SC("cannot iterate a generator"));
+ return sq_throwerror(v,"cannot iterate a generator");
}
int faketojump;
if(!v->FOREACH_OP(o,realkey,val,refpos,0,666,faketojump))
diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
index 66a81edb4..e952a6081 100644
--- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
@@ -19,7 +19,7 @@
bool str2num(const SQChar *s,SQObjectPtr &res)
{
SQChar *end;
- if(scstrstr(s,_SC("."))){
+ if(scstrstr(s,".")){
SQFloat r = SQFloat(scstrtod(s,&end));
if(s == end) return false;
res = r;
@@ -104,21 +104,21 @@ static SQInteger base_getstackinfos(HSQUIRRELVM v)
sq_getinteger(v, -1, &level);
if (SQ_SUCCEEDED(sq_stackinfos(v, level, &si)))
{
- const SQChar *fn = _SC("unknown");
- const SQChar *src = _SC("unknown");
+ const SQChar *fn = "unknown";
+ const SQChar *src = "unknown";
if(si.funcname)fn = si.funcname;
if(si.source)src = si.source;
sq_newtable(v);
- sq_pushstring(v, _SC("func"), -1);
+ sq_pushstring(v, "func", -1);
sq_pushstring(v, fn, -1);
sq_createslot(v, -3);
- sq_pushstring(v, _SC("src"), -1);
+ sq_pushstring(v, "src", -1);
sq_pushstring(v, src, -1);
sq_createslot(v, -3);
- sq_pushstring(v, _SC("line"), -1);
+ sq_pushstring(v, "line", -1);
sq_pushinteger(v, si.line);
sq_createslot(v, -3);
- sq_pushstring(v, _SC("locals"), -1);
+ sq_pushstring(v, "locals", -1);
sq_newtable(v);
seq=0;
while ((name = sq_getlocal(v, level, seq))) {
@@ -139,7 +139,7 @@ static SQInteger base_getstackinfos(HSQUIRRELVM v)
static SQInteger base_assert(HSQUIRRELVM v)
{
if(v->IsFalse(stack_get(v,2))){
- return sq_throwerror(v,_SC("assertion failed"));
+ return sq_throwerror(v,"assertion failed");
}
return 0;
}
@@ -171,7 +171,7 @@ 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);
+ if(_ss(v)->_printfunc) _ss(v)->_printfunc(v,"%s",str);
return 0;
}
@@ -179,7 +179,7 @@ static SQInteger base_print(HSQUIRRELVM v)
static SQInteger base_compilestring(HSQUIRRELVM v)
{
SQInteger nargs=sq_gettop(v);
- const SQChar *src=NULL,*name=_SC("unnamedbuffer");
+ const SQChar *src=NULL,*name="unnamedbuffer";
SQInteger size;
sq_getstring(v,2,&src);
size=sq_getsize(v,2);
@@ -213,7 +213,7 @@ static SQInteger base_array(HSQUIRRELVM v)
SQInteger nInitialSize = tointeger(stack_get(v,2));
SQInteger ret = 1;
if (nInitialSize < 0) {
- v->Raise_Error(_SC("can't create/resize array with/to size %d"), nInitialSize);
+ v->Raise_Error("can't create/resize array with/to size %d", nInitialSize);
nInitialSize = 0;
ret = -1;
}
@@ -238,28 +238,28 @@ static SQInteger base_type(HSQUIRRELVM v)
static SQRegFunction base_funcs[]={
//generic
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
- {_SC("seterrorhandler"),base_seterrorhandler,2, NULL},
- {_SC("setdebughook"),base_setdebughook,2, NULL},
- {_SC("enabledebuginfo"),base_enabledebuginfo,2, NULL},
- {_SC("getstackinfos"),base_getstackinfos,2, _SC(".n")},
- {_SC("getroottable"),base_getroottable,1, NULL},
- {_SC("setroottable"),base_setroottable,2, NULL},
- {_SC("getconsttable"),base_getconsttable,1, NULL},
- {_SC("setconsttable"),base_setconsttable,2, NULL},
+ {"seterrorhandler",base_seterrorhandler,2, NULL},
+ {"setdebughook",base_setdebughook,2, NULL},
+ {"enabledebuginfo",base_enabledebuginfo,2, NULL},
+ {"getstackinfos",base_getstackinfos,2, ".n"},
+ {"getroottable",base_getroottable,1, NULL},
+ {"setroottable",base_setroottable,2, NULL},
+ {"getconsttable",base_getconsttable,1, NULL},
+ {"setconsttable",base_setconsttable,2, NULL},
#endif
- {_SC("assert"),base_assert,2, NULL},
- {_SC("print"),base_print,2, NULL},
+ {"assert",base_assert,2, NULL},
+ {"print",base_print,2, NULL},
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
- {_SC("compilestring"),base_compilestring,-2, _SC(".ss")},
- {_SC("newthread"),base_newthread,2, _SC(".c")},
- {_SC("suspend"),base_suspend,-1, NULL},
+ {"compilestring",base_compilestring,-2, ".ss"},
+ {"newthread",base_newthread,2, ".c"},
+ {"suspend",base_suspend,-1, NULL},
#endif
- {_SC("array"),base_array,-2, _SC(".n")},
- {_SC("type"),base_type,2, NULL},
+ {"array",base_array,-2, ".n"},
+ {"type",base_type,2, NULL},
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
- {_SC("dummy"),base_dummy,0,NULL},
+ {"dummy",base_dummy,0,NULL},
#ifndef NO_GARBAGE_COLLECTOR
- {_SC("collectgarbage"),base_collectgarbage,1, _SC("t")},
+ {"collectgarbage",base_collectgarbage,1, "t"},
#endif
#endif
{0,0,0,0}
@@ -277,16 +277,16 @@ void sq_base_register(HSQUIRRELVM v)
sq_createslot(v,-3);
i++;
}
- sq_pushstring(v,_SC("_version_"),-1);
+ sq_pushstring(v,"_version_",-1);
sq_pushstring(v,SQUIRREL_VERSION,-1);
sq_createslot(v,-3);
- sq_pushstring(v,_SC("_charsize_"),-1);
+ sq_pushstring(v,"_charsize_",-1);
sq_pushinteger(v,sizeof(SQChar));
sq_createslot(v,-3);
- sq_pushstring(v,_SC("_intsize_"),-1);
+ sq_pushstring(v,"_intsize_",-1);
sq_pushinteger(v,sizeof(SQInteger));
sq_createslot(v,-3);
- sq_pushstring(v,_SC("_floatsize_"),-1);
+ sq_pushstring(v,"_floatsize_",-1);
sq_pushinteger(v,sizeof(SQFloat));
sq_createslot(v,-3);
sq_pop(v,1);
@@ -308,7 +308,7 @@ static SQInteger default_delegate_tofloat(HSQUIRRELVM v)
v->Push(SQObjectPtr(tofloat(res)));
break;
}}
- return sq_throwerror(v, _SC("cannot convert the string"));
+ return sq_throwerror(v, "cannot convert the string");
break;
case OT_INTEGER:case OT_FLOAT:
v->Push(SQObjectPtr(tofloat(o)));
@@ -333,7 +333,7 @@ static SQInteger default_delegate_tointeger(HSQUIRRELVM v)
v->Push(SQObjectPtr(tointeger(res)));
break;
}}
- return sq_throwerror(v, _SC("cannot convert the string"));
+ return sq_throwerror(v, "cannot convert the string");
break;
case OT_INTEGER:case OT_FLOAT:
v->Push(SQObjectPtr(tointeger(o)));
@@ -409,14 +409,14 @@ static SQInteger table_rawget(HSQUIRRELVM v)
SQRegFunction SQSharedState::_table_default_delegate_funcz[]={
- {_SC("len"),default_delegate_len,1, _SC("t")},
- {_SC("rawget"),table_rawget,2, _SC("t")},
- {_SC("rawset"),table_rawset,3, _SC("t")},
- {_SC("rawdelete"),table_rawdelete,2, _SC("t")},
- {_SC("rawin"),container_rawexists,2, _SC("t")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
- {_SC("clear"),obj_clear,1, _SC(".")},
+ {"len",default_delegate_len,1, "t"},
+ {"rawget",table_rawget,2, "t"},
+ {"rawset",table_rawset,3, "t"},
+ {"rawdelete",table_rawdelete,2, "t"},
+ {"rawin",container_rawexists,2, "t"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
+ {"clear",obj_clear,1, "."},
{0,0,0,0}
};
@@ -450,7 +450,7 @@ static SQInteger array_top(HSQUIRRELVM v)
v->Push(_array(o)->Top());
return 1;
}
- else return sq_throwerror(v,_SC("top() on a empty array"));
+ else return sq_throwerror(v,"top() on a empty array");
}
static SQInteger array_insert(HSQUIRRELVM v)
@@ -459,7 +459,7 @@ static SQInteger array_insert(HSQUIRRELVM v)
SQObject &idx=stack_get(v,2);
SQObject &val=stack_get(v,3);
if(!_array(o)->Insert(tointeger(idx),val))
- return sq_throwerror(v,_SC("index out of range"));
+ return sq_throwerror(v,"index out of range");
return 0;
}
@@ -467,14 +467,14 @@ static SQInteger array_remove(HSQUIRRELVM v)
{
SQObject &o = stack_get(v, 1);
SQObject &idx = stack_get(v, 2);
- if(!sq_isnumeric(idx)) return sq_throwerror(v, _SC("wrong type"));
+ if(!sq_isnumeric(idx)) return sq_throwerror(v, "wrong type");
SQObjectPtr val;
if(_array(o)->Get(tointeger(idx), val)) {
_array(o)->Remove(tointeger(idx));
v->Push(val);
return 1;
}
- return sq_throwerror(v, _SC("idx out of range"));
+ return sq_throwerror(v, "idx out of range");
}
static SQInteger array_resize(HSQUIRRELVM v)
@@ -488,7 +488,7 @@ static SQInteger array_resize(HSQUIRRELVM v)
_array(o)->Resize(tointeger(nsize),fill);
return 0;
}
- return sq_throwerror(v, _SC("size must be a number"));
+ return sq_throwerror(v, "size must be a number");
}
@@ -505,11 +505,11 @@ bool _sort_compare(HSQUIRRELVM v,SQObjectPtr &a,SQObjectPtr &b,SQInteger func,SQ
v->Push(b);
if(SQ_FAILED(sq_call(v, 3, SQTrue, SQFalse))) {
if(!sq_isstring( v->_lasterror))
- v->Raise_Error(_SC("compare func failed"));
+ v->Raise_Error("compare func failed");
return false;
}
if(SQ_FAILED(sq_getinteger(v, -1, &ret))) {
- v->Raise_Error(_SC("numeric value expected as return value of the compare function"));
+ v->Raise_Error("numeric value expected as return value of the compare function");
return false;
}
sq_settop(v, top);
@@ -545,7 +545,7 @@ bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteger bott
return false;
if (ret < 0) {
if (root == maxChild) {
- v->Raise_Error(_SC("inconsistent compare function"));
+ v->Raise_Error("inconsistent compare function");
return false; // We'd be swapping ourselve. The compare function is incorrect
}
_Swap(arr->_values[root],arr->_values[maxChild]);
@@ -596,8 +596,8 @@ static SQInteger array_slice(HSQUIRRELVM v)
SQInteger alen = _array(o)->Size();
if(sidx < 0)sidx = alen + sidx;
if(eidx < 0)eidx = alen + eidx;
- if(eidx < sidx)return sq_throwerror(v,_SC("wrong indexes"));
- if(eidx > alen)return sq_throwerror(v,_SC("slice out of range"));
+ if(eidx < sidx)return sq_throwerror(v,"wrong indexes");
+ if(eidx > alen)return sq_throwerror(v,"slice out of range");
SQArray *arr=SQArray::Create(_ss(v),eidx-sidx);
SQObjectPtr t;
SQInteger count=0;
@@ -611,21 +611,21 @@ static SQInteger array_slice(HSQUIRRELVM v)
}
SQRegFunction SQSharedState::_array_default_delegate_funcz[]={
- {_SC("len"),default_delegate_len,1, _SC("a")},
- {_SC("append"),array_append,2, _SC("a")},
- {_SC("extend"),array_extend,2, _SC("aa")},
- {_SC("push"),array_append,2, _SC("a")},
- {_SC("pop"),array_pop,1, _SC("a")},
- {_SC("top"),array_top,1, _SC("a")},
- {_SC("insert"),array_insert,3, _SC("an")},
- {_SC("remove"),array_remove,2, _SC("an")},
- {_SC("resize"),array_resize,-2, _SC("an")},
- {_SC("reverse"),array_reverse,1, _SC("a")},
- {_SC("sort"),array_sort,-1, _SC("ac")},
- {_SC("slice"),array_slice,-1, _SC("ann")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
- {_SC("clear"),obj_clear,1, _SC(".")},
+ {"len",default_delegate_len,1, "a"},
+ {"append",array_append,2, "a"},
+ {"extend",array_extend,2, "aa"},
+ {"push",array_append,2, "a"},
+ {"pop",array_pop,1, "a"},
+ {"top",array_top,1, "a"},
+ {"insert",array_insert,3, "an"},
+ {"remove",array_remove,2, "an"},
+ {"resize",array_resize,-2, "an"},
+ {"reverse",array_reverse,1, "a"},
+ {"sort",array_sort,-1, "ac"},
+ {"slice",array_slice,-1, "ann"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
+ {"clear",obj_clear,1, "."},
{0,0,0,0}
};
@@ -638,8 +638,8 @@ static SQInteger string_slice(HSQUIRRELVM v)
SQInteger slen = _string(o)->_len;
if(sidx < 0)sidx = slen + sidx;
if(eidx < 0)eidx = slen + eidx;
- if(eidx < sidx) return sq_throwerror(v,_SC("wrong indexes"));
- if(eidx > slen) return sq_throwerror(v,_SC("slice out of range"));
+ if(eidx < sidx) return sq_throwerror(v,"wrong indexes");
+ if(eidx > slen) return sq_throwerror(v,"slice out of range");
v->Push(SQString::Create(_ss(v),&_stringval(o)[sidx],eidx-sidx));
return 1;
}
@@ -659,7 +659,7 @@ static SQInteger string_find(HSQUIRRELVM v)
}
return 0;
}
- return sq_throwerror(v,_SC("invalid param"));
+ return sq_throwerror(v,"invalid param");
}
#define STRING_TOFUNCZ(func) static SQInteger string_##func(HSQUIRRELVM v) \
@@ -678,25 +678,25 @@ STRING_TOFUNCZ(tolower)
STRING_TOFUNCZ(toupper)
SQRegFunction SQSharedState::_string_default_delegate_funcz[]={
- {_SC("len"),default_delegate_len,1, _SC("s")},
- {_SC("tointeger"),default_delegate_tointeger,1, _SC("s")},
- {_SC("tofloat"),default_delegate_tofloat,1, _SC("s")},
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
- {_SC("slice"),string_slice,-1, _SC(" s n n")},
- {_SC("find"),string_find,-2, _SC("s s n ")},
- {_SC("tolower"),string_tolower,1, _SC("s")},
- {_SC("toupper"),string_toupper,1, _SC("s")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
+ {"len",default_delegate_len,1, "s"},
+ {"tointeger",default_delegate_tointeger,1, "s"},
+ {"tofloat",default_delegate_tofloat,1, "s"},
+ {"tostring",default_delegate_tostring,1, "."},
+ {"slice",string_slice,-1, " s n n"},
+ {"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}
};
//INTEGER DEFAULT DELEGATE//////////////////////////
SQRegFunction SQSharedState::_number_default_delegate_funcz[]={
- {_SC("tointeger"),default_delegate_tointeger,1, _SC("n|b")},
- {_SC("tofloat"),default_delegate_tofloat,1, _SC("n|b")},
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
- {_SC("tochar"),number_delegate_tochar,1, _SC("n|b")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
+ {"tointeger",default_delegate_tointeger,1, "n|b"},
+ {"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}
};
@@ -748,19 +748,19 @@ static SQInteger closure_getinfos(HSQUIRRELVM v) {
_array(params)->Set((SQInteger)n,f->_parameters[n]);
}
if(f->_varparams) {
- _array(params)->Set(nparams-1,SQString::Create(_ss(v),_SC("..."),-1));
+ _array(params)->Set(nparams-1,SQString::Create(_ss(v),"...",-1));
}
- res->NewSlot(SQString::Create(_ss(v),_SC("native"),-1),false);
- res->NewSlot(SQString::Create(_ss(v),_SC("name"),-1),f->_name);
- res->NewSlot(SQString::Create(_ss(v),_SC("src"),-1),f->_sourcename);
- res->NewSlot(SQString::Create(_ss(v),_SC("parameters"),-1),params);
- res->NewSlot(SQString::Create(_ss(v),_SC("varargs"),-1),f->_varparams);
+ res->NewSlot(SQString::Create(_ss(v),"native",-1),false);
+ res->NewSlot(SQString::Create(_ss(v),"name",-1),f->_name);
+ res->NewSlot(SQString::Create(_ss(v),"src",-1),f->_sourcename);
+ res->NewSlot(SQString::Create(_ss(v),"parameters",-1),params);
+ res->NewSlot(SQString::Create(_ss(v),"varargs",-1),f->_varparams);
}
else { //OT_NATIVECLOSURE
SQNativeClosure *nc = _nativeclosure(o);
- res->NewSlot(SQString::Create(_ss(v),_SC("native"),-1),true);
- res->NewSlot(SQString::Create(_ss(v),_SC("name"),-1),nc->_name);
- res->NewSlot(SQString::Create(_ss(v),_SC("paramscheck"),-1),nc->_nparamscheck);
+ res->NewSlot(SQString::Create(_ss(v),"native",-1),true);
+ res->NewSlot(SQString::Create(_ss(v),"name",-1),nc->_name);
+ res->NewSlot(SQString::Create(_ss(v),"paramscheck",-1),nc->_nparamscheck);
SQObjectPtr typecheck;
if(nc->_typecheck.size() > 0) {
typecheck =
@@ -769,7 +769,7 @@ static SQInteger closure_getinfos(HSQUIRRELVM v) {
_array(typecheck)->Set((SQInteger)n,nc->_typecheck[n]);
}
}
- res->NewSlot(SQString::Create(_ss(v),_SC("typecheck"),-1),typecheck);
+ res->NewSlot(SQString::Create(_ss(v),"typecheck",-1),typecheck);
}
v->Push(res);
return 1;
@@ -777,14 +777,14 @@ static SQInteger closure_getinfos(HSQUIRRELVM v) {
SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={
- {_SC("call"),closure_call,-1, _SC("c")},
- {_SC("pcall"),closure_pcall,-1, _SC("c")},
- {_SC("acall"),closure_acall,2, _SC("ca")},
- {_SC("pacall"),closure_pacall,2, _SC("ca")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
- {_SC("bindenv"),closure_bindenv,2, _SC("c x|y|t")},
- {_SC("getinfos"),closure_getinfos,1, _SC("c")},
+ {"call",closure_call,-1, "c"},
+ {"pcall",closure_pcall,-1, "c"},
+ {"acall",closure_acall,2, "ca"},
+ {"pacall",closure_pacall,2, "ca"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
+ {"bindenv",closure_bindenv,2, "c x|y|t"},
+ {"getinfos",closure_getinfos,1, "c"},
{0,0,0,0}
};
@@ -793,17 +793,17 @@ static SQInteger generator_getstatus(HSQUIRRELVM v)
{
SQObject &o=stack_get(v,1);
switch(_generator(o)->_state){
- case SQGenerator::eSuspended:v->Push(SQString::Create(_ss(v),_SC("suspended")));break;
- case SQGenerator::eRunning:v->Push(SQString::Create(_ss(v),_SC("running")));break;
- case SQGenerator::eDead:v->Push(SQString::Create(_ss(v),_SC("dead")));break;
+ case SQGenerator::eSuspended:v->Push(SQString::Create(_ss(v),"suspended"));break;
+ case SQGenerator::eRunning:v->Push(SQString::Create(_ss(v),"running"));break;
+ case SQGenerator::eDead:v->Push(SQString::Create(_ss(v),"dead"));break;
}
return 1;
}
SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={
- {_SC("getstatus"),generator_getstatus,1, _SC("g")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
+ {"getstatus",generator_getstatus,1, "g"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
{0,0,0,0}
};
@@ -826,7 +826,7 @@ static SQInteger thread_call(HSQUIRRELVM v)
v->_lasterror = _thread(o)->_lasterror;
return SQ_ERROR;
}
- return sq_throwerror(v,_SC("wrong parameter"));
+ return sq_throwerror(v,"wrong parameter");
}
static SQInteger thread_wakeup(HSQUIRRELVM v)
@@ -838,10 +838,10 @@ static SQInteger thread_wakeup(HSQUIRRELVM v)
if(state != SQ_VMSTATE_SUSPENDED) {
switch(state) {
case SQ_VMSTATE_IDLE:
- return sq_throwerror(v,_SC("cannot wakeup a idle thread"));
+ return sq_throwerror(v,"cannot wakeup a idle thread");
break;
case SQ_VMSTATE_RUNNING:
- return sq_throwerror(v,_SC("cannot wakeup a running thread"));
+ return sq_throwerror(v,"cannot wakeup a running thread");
break;
}
}
@@ -862,7 +862,7 @@ static SQInteger thread_wakeup(HSQUIRRELVM v)
v->_lasterror = thread->_lasterror;
return SQ_ERROR;
}
- return sq_throwerror(v,_SC("wrong parameter"));
+ return sq_throwerror(v,"wrong parameter");
}
static SQInteger thread_getstatus(HSQUIRRELVM v)
@@ -870,26 +870,26 @@ static SQInteger thread_getstatus(HSQUIRRELVM v)
SQObjectPtr &o = stack_get(v,1);
switch(sq_getvmstate(_thread(o))) {
case SQ_VMSTATE_IDLE:
- sq_pushstring(v,_SC("idle"),-1);
+ sq_pushstring(v,"idle",-1);
break;
case SQ_VMSTATE_RUNNING:
- sq_pushstring(v,_SC("running"),-1);
+ sq_pushstring(v,"running",-1);
break;
case SQ_VMSTATE_SUSPENDED:
- sq_pushstring(v,_SC("suspended"),-1);
+ sq_pushstring(v,"suspended",-1);
break;
default:
- return sq_throwerror(v,_SC("internal VM error"));
+ return sq_throwerror(v,"internal VM error");
}
return 1;
}
SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = {
- {_SC("call"), thread_call, -1, _SC("v")},
- {_SC("wakeup"), thread_wakeup, -1, _SC("v")},
- {_SC("getstatus"), thread_getstatus, 1, _SC("v")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
+ {"call", thread_call, -1, "v"},
+ {"wakeup", thread_wakeup, -1, "v"},
+ {"getstatus", thread_getstatus, 1, "v"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
{0,0,0,0},
};
@@ -915,12 +915,12 @@ static SQInteger class_instance(HSQUIRRELVM v)
}
SQRegFunction SQSharedState::_class_default_delegate_funcz[] = {
- {_SC("getattributes"), class_getattributes, 2, _SC("y.")},
- {_SC("setattributes"), class_setattributes, 3, _SC("y..")},
- {_SC("rawin"),container_rawexists,2, _SC("y")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
- {_SC("instance"),class_instance,1, _SC("y")},
+ {"getattributes", class_getattributes, 2, "y."},
+ {"setattributes", class_setattributes, 3, "y.."},
+ {"rawin",container_rawexists,2, "y"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
+ {"instance",class_instance,1, "y"},
{0,0,0,0}
};
@@ -932,10 +932,10 @@ static SQInteger instance_getclass(HSQUIRRELVM v)
}
SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = {
- {_SC("getclass"), instance_getclass, 1, _SC("x")},
- {_SC("rawin"),container_rawexists,2, _SC("x")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
+ {"getclass", instance_getclass, 1, "x"},
+ {"rawin",container_rawexists,2, "x"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
{0,0,0,0}
};
@@ -947,9 +947,9 @@ static SQInteger weakref_ref(HSQUIRRELVM v)
}
SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = {
- {_SC("ref"),weakref_ref,1, _SC("r")},
- {_SC("weakref"),obj_delegate_weakref,1, NULL },
- {_SC("tostring"),default_delegate_tostring,1, _SC(".")},
+ {"ref",weakref_ref,1, "r"},
+ {"weakref",obj_delegate_weakref,1, NULL },
+ {"tostring",default_delegate_tostring,1, "."},
{0,0,0,0}
};
diff --git a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
index 35fcc9e49..f0b8536ce 100644
--- a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
@@ -75,7 +75,7 @@ public:
bool IsDerefToken(SQInteger tok)
{
switch(tok){
- case _SC('='): case _SC('('): case TK_NEWSLOT:
+ case '=': case '(': case TK_NEWSLOT:
case TK_MODEQ: case TK_MULEQ: case TK_DIVEQ: case TK_MINUSEQ: case TK_PLUSEQ: case TK_PLUSPLUS: case TK_MINUSMINUS: return true;
}
return false;
@@ -91,7 +91,7 @@ public:
if(_token != tok) {
if(_token == TK_CONSTRUCTOR && tok == TK_IDENTIFIER) {
- //ret = SQString::Create(_ss(_vm),_SC("constructor"));
+ //ret = SQString::Create(_ss(_vm),"constructor");
//do nothing
}
else {
@@ -100,23 +100,23 @@ public:
switch(tok)
{
case TK_IDENTIFIER:
- etypename = _SC("IDENTIFIER");
+ etypename = "IDENTIFIER";
break;
case TK_STRING_LITERAL:
- etypename = _SC("STRING_LITERAL");
+ etypename = "STRING_LITERAL";
break;
case TK_INTEGER:
- etypename = _SC("INTEGER");
+ etypename = "INTEGER";
break;
case TK_FLOAT:
- etypename = _SC("FLOAT");
+ etypename = "FLOAT";
break;
default:
etypename = _lex.Tok2Str(tok);
}
- Error(_SC("expected '%s'"), etypename);
+ Error("expected '%s'", etypename);
}
- Error(_SC("expected '%c'"), tok);
+ Error("expected '%c'", tok);
}
}
SQObjectPtr ret;
@@ -138,12 +138,12 @@ public:
Lex();
return ret;
}
- bool IsEndOfStatement() { return ((_lex._prevtoken == _SC('\n')) || (_token == SQUIRREL_EOB) || (_token == _SC('}')) || (_token == _SC(';'))); }
+ bool IsEndOfStatement() { return ((_lex._prevtoken == '\n') || (_token == SQUIRREL_EOB) || (_token == '}') || (_token == ';')); }
void OptionalSemicolon()
{
- if(_token == _SC(';')) { Lex(); return; }
+ if(_token == ';') { Lex(); return; }
if(!IsEndOfStatement()) {
- Error(_SC("end of statement expected (; or lf)"));
+ Error("end of statement expected (; or lf)");
}
}
void MoveIfCurrentTargetIsLocal() {
@@ -159,16 +159,16 @@ public:
_debugop = 0;
SQFuncState funcstate(_ss(_vm), NULL,ThrowError,this);
- funcstate._name = SQString::Create(_ss(_vm), _SC("main"));
+ funcstate._name = SQString::Create(_ss(_vm), "main");
_fs = &funcstate;
- _fs->AddParameter(_fs->CreateString(_SC("this")));
+ _fs->AddParameter(_fs->CreateString("this"));
_fs->_sourcename = _sourcename;
SQInteger stacksize = _fs->GetStackSize();
try {
Lex();
while(_token > 0){
Statement();
- if(_lex._prevtoken != _SC('}')) OptionalSemicolon();
+ if(_lex._prevtoken != '}') OptionalSemicolon();
}
CleanStack(stacksize);
_fs->AddLineInfos(_lex._currentline, _lineinfo, true);
@@ -182,7 +182,7 @@ public:
}
catch (SQChar *compilererror) {
if(_raiseerror && _ss(_vm)->_compilererrorhandler) {
- _ss(_vm)->_compilererrorhandler(_vm, compilererror, type(_sourcename) == OT_STRING?_stringval(_sourcename):_SC("unknown"),
+ _ss(_vm)->_compilererrorhandler(_vm, compilererror, type(_sourcename) == OT_STRING?_stringval(_sourcename):"unknown",
_lex._currentline, _lex._currentcolumn);
}
_vm->_lasterror = SQString::Create(_ss(_vm), compilererror, -1);
@@ -191,16 +191,16 @@ public:
}
void Statements()
{
- while(_token != _SC('}') && _token != TK_DEFAULT && _token != TK_CASE) {
+ while(_token != '}' && _token != TK_DEFAULT && _token != TK_CASE) {
Statement();
- if(_lex._prevtoken != _SC('}') && _lex._prevtoken != _SC(';')) OptionalSemicolon();
+ if(_lex._prevtoken != '}' && _lex._prevtoken != ';') OptionalSemicolon();
}
}
void Statement()
{
_fs->AddLineInfos(_lex._currentline, _lineinfo);
switch(_token){
- case _SC(';'): Lex(); break;
+ case ';': Lex(); break;
case TK_IF: IfStatement(); break;
case TK_WHILE: WhileStatement(); break;
case TK_DO: DoWhileStatement(); break;
@@ -236,7 +236,7 @@ public:
}
break;}
case TK_BREAK:
- if(_fs->_breaktargets.size() <= 0)Error(_SC("'break' has to be in a loop block"));
+ if(_fs->_breaktargets.size() <= 0)Error("'break' has to be in a loop block");
if(_fs->_breaktargets.top() > 0){
_fs->AddInstruction(_OP_POPTRAP, _fs->_breaktargets.top(), 0);
}
@@ -246,7 +246,7 @@ public:
Lex();
break;
case TK_CONTINUE:
- if(_fs->_continuetargets.size() <= 0)Error(_SC("'continue' has to be in a loop block"));
+ if(_fs->_continuetargets.size() <= 0)Error("'continue' has to be in a loop block");
if(_fs->_continuetargets.top() > 0) {
_fs->AddInstruction(_OP_POPTRAP, _fs->_continuetargets.top(), 0);
}
@@ -264,11 +264,11 @@ public:
case TK_ENUM:
EnumStatement();
break;
- case _SC('{'):{
+ case '{':{
SQInteger stacksize = _fs->GetStackSize();
Lex();
Statements();
- Expect(_SC('}'));
+ Expect('}');
_fs->AddInstruction(_OP_SCOPE_END, stacksize, _fs->GetStackSize());
_fs->SetStackSize(stacksize);
}
@@ -348,7 +348,7 @@ public:
_exst._funcarg = funcarg;
LogicalOrExp();
switch(_token) {
- case _SC('='):
+ case '=':
case TK_NEWSLOT:
case TK_MINUSEQ:
case TK_PLUSEQ:
@@ -359,19 +359,19 @@ public:
SQInteger op = _token;
SQInteger ds = _exst._deref;
bool freevar = _exst._freevar;
- if(ds == DEREF_NO_DEREF) Error(_SC("can't assign expression"));
+ if(ds == DEREF_NO_DEREF) Error("can't assign expression");
Lex(); Expression();
switch(op){
case TK_NEWSLOT:
- if(freevar) Error(_SC("free variables cannot be modified"));
+ if(freevar) Error("free variables cannot be modified");
if(ds == DEREF_FIELD)
EmitDerefOp(_OP_NEWSLOT);
else //if _derefstate != DEREF_NO_DEREF && DEREF_FIELD so is the index of a local
- Error(_SC("can't 'create' a local slot"));
+ Error("can't 'create' a local slot");
break;
- case _SC('='): //ASSIGN
- if(freevar) Error(_SC("free variables cannot be modified"));
+ case '=': //ASSIGN
+ if(freevar) Error("free variables cannot be modified");
if(ds == DEREF_FIELD)
EmitDerefOp(_OP_SET);
else {//if _derefstate != DEREF_NO_DEREF && DEREF_FIELD so is the index of a local
@@ -390,7 +390,7 @@ public:
}
}
break;
- case _SC('?'): {
+ case '?': {
Lex();
_fs->AddInstruction(_OP_JZ, _fs->PopTarget());
SQInteger jzpos = _fs->GetCurrentPos();
@@ -400,7 +400,7 @@ public:
if(trg != first_exp) _fs->AddInstruction(_OP_MOVE, trg, first_exp);
SQInteger endfirstexp = _fs->GetCurrentPos();
_fs->AddInstruction(_OP_JMP, 0, 0);
- Expect(_SC(':'));
+ Expect(':');
SQInteger jmppos = _fs->GetCurrentPos();
Expression();
SQInteger second_exp = _fs->PopTarget();
@@ -464,21 +464,21 @@ public:
void BitwiseOrExp()
{
BitwiseXorExp();
- for(;;) if(_token == _SC('|'))
+ for(;;) if(_token == '|')
{BIN_EXP(_OP_BITW, &SQCompiler::BitwiseXorExp,BW_OR);
}else return;
}
void BitwiseXorExp()
{
BitwiseAndExp();
- for(;;) if(_token == _SC('^'))
+ for(;;) if(_token == '^')
{BIN_EXP(_OP_BITW, &SQCompiler::BitwiseAndExp,BW_XOR);
}else return;
}
void BitwiseAndExp()
{
CompExp();
- for(;;) if(_token == _SC('&'))
+ for(;;) if(_token == '&')
{BIN_EXP(_OP_BITW, &SQCompiler::CompExp,BW_AND);
}else return;
}
@@ -487,8 +487,8 @@ public:
ShiftExp();
for(;;) switch(_token) {
case TK_EQ: BIN_EXP(_OP_EQ, &SQCompiler::ShiftExp); break;
- case _SC('>'): BIN_EXP(_OP_CMP, &SQCompiler::ShiftExp,CMP_G); break;
- case _SC('<'): BIN_EXP(_OP_CMP, &SQCompiler::ShiftExp,CMP_L); break;
+ case '>': BIN_EXP(_OP_CMP, &SQCompiler::ShiftExp,CMP_G); break;
+ case '<': BIN_EXP(_OP_CMP, &SQCompiler::ShiftExp,CMP_L); break;
case TK_GE: BIN_EXP(_OP_CMP, &SQCompiler::ShiftExp,CMP_GE); break;
case TK_LE: BIN_EXP(_OP_CMP, &SQCompiler::ShiftExp,CMP_LE); break;
case TK_NE: BIN_EXP(_OP_NE, &SQCompiler::ShiftExp); break;
@@ -509,7 +509,7 @@ public:
{
MultExp();
for(;;) switch(_token) {
- case _SC('+'): case _SC('-'):
+ case '+': case '-':
BIN_EXP(_OP_ARITH, &SQCompiler::MultExp,_token); break;
default: return;
}
@@ -519,7 +519,7 @@ public:
{
PrefixedExpr();
for(;;) switch(_token) {
- case _SC('*'): case _SC('/'): case _SC('%'):
+ case '*': case '/': case '%':
BIN_EXP(_OP_ARITH, &SQCompiler::PrefixedExpr,_token); break;
default: return;
}
@@ -531,13 +531,13 @@ public:
for(;;) {
switch(_token) {
- case _SC('.'): {
+ case '.': {
pos = -1;
Lex();
if(_token == TK_PARENT) {
Lex();
if(!NeedGet())
- Error(_SC("parent cannot be set"));
+ Error("parent cannot be set");
SQInteger src = _fs->PopTarget();
_fs->AddInstruction(_OP_GETPARENT, _fs->PushTarget(), src);
}
@@ -549,9 +549,9 @@ public:
_exst._freevar = false;
}
break;
- case _SC('['):
- if(_lex._prevtoken == _SC('\n')) Error(_SC("cannot brake deref/or comma needed after [exp]=exp slot declaration"));
- Lex(); Expression(); Expect(_SC(']'));
+ case '[':
+ if(_lex._prevtoken == '\n') Error("cannot brake deref/or comma needed after [exp]=exp slot declaration");
+ Lex(); Expression(); Expect(']');
pos = -1;
if(NeedGet()) Emit2ArgsOP(_OP_GET);
_exst._deref = DEREF_FIELD;
@@ -571,7 +571,7 @@ public:
}
return;
break;
- case _SC('('):
+ case '(':
{
if(_exst._deref != DEREF_NO_DEREF) {
if(pos<0) {
@@ -609,9 +609,9 @@ public:
break;
case TK_VARGC: Lex(); _fs->AddInstruction(_OP_VARGC, _fs->PushTarget()); break;
case TK_VARGV: { Lex();
- Expect(_SC('['));
+ Expect('[');
Expression();
- Expect(_SC(']'));
+ Expect(']');
SQInteger src = _fs->PopTarget();
_fs->AddInstruction(_OP_GETVARGV, _fs->PushTarget(), src);
}
@@ -624,8 +624,8 @@ public:
SQObject constant;
switch(_token) {
case TK_IDENTIFIER: id = _fs->CreateString(_lex._svalue); break;
- case TK_THIS: id = _fs->CreateString(_SC("this")); break;
- case TK_CONSTRUCTOR: id = _fs->CreateString(_SC("constructor")); break;
+ case TK_THIS: id = _fs->CreateString("this"); break;
+ case TK_CONSTRUCTOR: id = _fs->CreateString("constructor"); break;
}
SQInteger pos = -1;
Lex();
@@ -643,7 +643,7 @@ public:
Expect('.'); constid = Expect(TK_IDENTIFIER);
if(!_table(constant)->Get(constid,constval)) {
constval.Null();
- Error(_SC("invalid constant [%s.%s]"), _stringval(id),_stringval(constid));
+ Error("invalid constant [%s.%s]", _stringval(id),_stringval(constid));
}
}
else {
@@ -683,7 +683,7 @@ public:
case TK_DOUBLE_COLON: // "::"
_fs->AddInstruction(_OP_LOADROOTTABLE, _fs->PushTarget());
_exst._deref = DEREF_FIELD;
- _token = _SC('.'); //hack
+ _token = '.'; //hack
return -1;
break;
case TK_NULL:
@@ -713,13 +713,13 @@ public:
_fs->AddInstruction(_OP_LOADBOOL, _fs->PushTarget(),_token == TK_TRUE?1:0);
Lex();
break;
- case _SC('['): {
+ case '[': {
_fs->AddInstruction(_OP_NEWARRAY, _fs->PushTarget());
SQInteger apos = _fs->GetCurrentPos(),key = 0;
Lex();
- while(_token != _SC(']')) {
+ while(_token != ']') {
Expression();
- if(_token == _SC(',')) Lex();
+ if(_token == ',') Lex();
SQInteger val = _fs->PopTarget();
SQInteger array = _fs->TopTarget();
_fs->AddInstruction(_OP_APPENDARRAY, array, val);
@@ -729,16 +729,16 @@ public:
Lex();
}
break;
- case _SC('{'):{
+ case '{':{
_fs->AddInstruction(_OP_NEWTABLE, _fs->PushTarget());
- Lex();ParseTableOrClass(_SC(','));
+ Lex();ParseTableOrClass(',');
}
break;
case TK_FUNCTION: FunctionExp(_token);break;
case TK_CLASS: Lex(); ClassExp();break;
- case _SC('-'): UnaryOP(_OP_NEG); break;
- case _SC('!'): UnaryOP(_OP_NOT); break;
- case _SC('~'): UnaryOP(_OP_BWNOT); break;
+ case '-': UnaryOP(_OP_NEG); break;
+ case '!': UnaryOP(_OP_NOT); break;
+ case '~': UnaryOP(_OP_BWNOT); break;
case TK_TYPEOF : UnaryOP(_OP_TYPEOF); break;
case TK_RESUME : UnaryOP(_OP_RESUME); break;
case TK_CLONE : UnaryOP(_OP_CLONE); break;
@@ -746,9 +746,9 @@ public:
case TK_PLUSPLUS :PrefixIncDec(_token); break;
case TK_DELETE : DeleteExpr(); break;
case TK_DELEGATE : DelegateExpr(); break;
- case _SC('('): Lex(); CommaExpr(); Expect(_SC(')'));
+ case '(': Lex(); CommaExpr(); Expect(')');
break;
- default: Error(_SC("expression expected"));
+ default: Error("expression expected");
}
return -1;
}
@@ -761,23 +761,23 @@ public:
bool NeedGet()
{
switch(_token) {
- case _SC('='): case _SC('('): case TK_NEWSLOT: case TK_PLUSPLUS: case TK_MINUSMINUS:
+ case '=': case '(': case TK_NEWSLOT: case TK_PLUSPLUS: case TK_MINUSMINUS:
case TK_PLUSEQ: case TK_MINUSEQ: case TK_MULEQ: case TK_DIVEQ: case TK_MODEQ:
return false;
}
- return (!_exst._class_or_delete) || (_exst._class_or_delete && (_token == _SC('.') || _token == _SC('[')));
+ return (!_exst._class_or_delete) || (_exst._class_or_delete && (_token == '.' || _token == '['));
}
void FunctionCallArgs()
{
SQInteger nargs = 1;//this
- while(_token != _SC(')')) {
+ while(_token != ')') {
Expression(true);
MoveIfCurrentTargetIsLocal();
nargs++;
- if(_token == _SC(',')){
+ if(_token == ','){
Lex();
- if(_token == ')') Error(_SC("expression expected, found ')'"));
+ if(_token == ')') Error("expression expected, found ')'");
}
}
Lex();
@@ -810,20 +810,20 @@ public:
case TK_CONSTRUCTOR:{
SQInteger tk = _token;
Lex();
- SQObject id = tk == TK_FUNCTION ? Expect(TK_IDENTIFIER) : _fs->CreateString(_SC("constructor"));
- Expect(_SC('('));
+ SQObject id = tk == TK_FUNCTION ? Expect(TK_IDENTIFIER) : _fs->CreateString("constructor");
+ Expect('(');
_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(id));
CreateFunction(id);
_fs->AddInstruction(_OP_CLOSURE, _fs->PushTarget(), _fs->_functions.size() - 1, 0);
}
break;
- case _SC('['):
- Lex(); CommaExpr(); Expect(_SC(']'));
- Expect(_SC('=')); Expression();
+ case '[':
+ Lex(); CommaExpr(); Expect(']');
+ Expect('='); Expression();
break;
default :
_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(Expect(TK_IDENTIFIER)));
- Expect(_SC('=')); Expression();
+ Expect('='); Expression();
}
if(_token == separator) Lex();//optional comma/semicolon
@@ -837,7 +837,7 @@ public:
_fs->AddInstruction(_OP_NEWSLOTA, flags, table, key, val);
//_fs->PopTarget();
}
- if(separator == _SC(',')) //hack recognizes a table from the separator
+ if(separator == ',') //hack recognizes a table from the separator
_fs->SetIntructionParam(tpos, 1, nkeys);
Lex();
}
@@ -846,7 +846,7 @@ public:
SQObject varname;
do {
Lex(); varname = Expect(TK_IDENTIFIER);
- if(_token == _SC('=')) {
+ if(_token == '=') {
Lex(); Expression();
SQInteger src = _fs->PopTarget();
SQInteger dest = _fs->PushTarget();
@@ -858,20 +858,20 @@ public:
_fs->PopTarget();
_fs->PushLocalVariable(varname);
- } while(_token == _SC(','));
+ } while(_token == ',');
}
void IfStatement()
{
SQInteger jmppos;
bool haselse = false;
- Lex(); Expect(_SC('(')); CommaExpr(); Expect(_SC(')'));
+ Lex(); Expect('('); CommaExpr(); Expect(')');
_fs->AddInstruction(_OP_JZ, _fs->PopTarget());
SQInteger jnepos = _fs->GetCurrentPos();
SQInteger stacksize = _fs->GetStackSize();
Statement();
//
- if(_token != _SC('}') && _token != TK_ELSE) OptionalSemicolon();
+ if(_token != '}' && _token != TK_ELSE) OptionalSemicolon();
CleanStack(stacksize);
SQInteger endifblock = _fs->GetCurrentPos();
@@ -892,7 +892,7 @@ public:
SQInteger jzpos, jmppos;
SQInteger stacksize = _fs->GetStackSize();
jmppos = _fs->GetCurrentPos();
- Lex(); Expect(_SC('(')); CommaExpr(); Expect(_SC(')'));
+ Lex(); Expect('('); CommaExpr(); Expect(')');
BEGIN_BREAKBLE_BLOCK();
_fs->AddInstruction(_OP_JZ, _fs->PopTarget());
@@ -920,7 +920,7 @@ public:
_fs->AddLineInfos(_lex._currentline, _lineinfo, true);
Expect(TK_WHILE);
SQInteger continuetrg = _fs->GetCurrentPos();
- Expect(_SC('(')); CommaExpr(); Expect(_SC(')'));
+ Expect('('); CommaExpr(); Expect(')');
_fs->AddInstruction(_OP_JNZ, _fs->PopTarget(), jzpos - _fs->GetCurrentPos() - 1);
END_BREAKBLE_BLOCK(continuetrg);
}
@@ -928,25 +928,25 @@ public:
{
Lex();
SQInteger stacksize = _fs->GetStackSize();
- Expect(_SC('('));
+ Expect('(');
if(_token == TK_LOCAL) LocalDeclStatement();
- else if(_token != _SC(';')){
+ else if(_token != ';'){
CommaExpr();
_fs->PopTarget();
}
- Expect(_SC(';'));
+ Expect(';');
_fs->SnoozeOpt();
SQInteger jmppos = _fs->GetCurrentPos();
SQInteger jzpos = -1;
- if(_token != _SC(';')) { CommaExpr(); _fs->AddInstruction(_OP_JZ, _fs->PopTarget()); jzpos = _fs->GetCurrentPos(); }
- Expect(_SC(';'));
+ if(_token != ';') { CommaExpr(); _fs->AddInstruction(_OP_JZ, _fs->PopTarget()); jzpos = _fs->GetCurrentPos(); }
+ Expect(';');
_fs->SnoozeOpt();
SQInteger expstart = _fs->GetCurrentPos() + 1;
- if(_token != _SC(')')) {
+ if(_token != ')') {
CommaExpr();
_fs->PopTarget();
}
- Expect(_SC(')'));
+ Expect(')');
_fs->SnoozeOpt();
SQInteger expend = _fs->GetCurrentPos();
SQInteger expsize = (expend - expstart) + 1;
@@ -973,20 +973,20 @@ public:
void ForEachStatement()
{
SQObject idxname, valname;
- Lex(); Expect(_SC('(')); valname = Expect(TK_IDENTIFIER);
- if(_token == _SC(',')) {
+ Lex(); Expect('('); valname = Expect(TK_IDENTIFIER);
+ if(_token == ',') {
idxname = valname;
Lex(); valname = Expect(TK_IDENTIFIER);
}
else{
- idxname = _fs->CreateString(_SC("@INDEX@"));
+ idxname = _fs->CreateString("@INDEX@");
}
Expect(TK_IN);
//save the stack size
SQInteger stacksize = _fs->GetStackSize();
//put the table in the stack(evaluate the table expression)
- Expression(); Expect(_SC(')'));
+ Expression(); Expect(')');
SQInteger container = _fs->TopTarget();
//push the index local var
SQInteger indexpos = _fs->PushLocalVariable(idxname);
@@ -995,7 +995,7 @@ public:
SQInteger valuepos = _fs->PushLocalVariable(valname);
_fs->AddInstruction(_OP_LOADNULLS, valuepos,1);
//push reference index
- SQInteger itrpos = _fs->PushLocalVariable(_fs->CreateString(_SC("@ITERATOR@"))); //use invalid id to make it inaccessible
+ SQInteger itrpos = _fs->PushLocalVariable(_fs->CreateString("@ITERATOR@")); //use invalid id to make it inaccessible
_fs->AddInstruction(_OP_LOADNULLS, itrpos,1);
SQInteger jmppos = _fs->GetCurrentPos();
_fs->AddInstruction(_OP_FOREACH, container, 0, indexpos);
@@ -1014,8 +1014,8 @@ public:
}
void SwitchStatement()
{
- Lex(); Expect(_SC('(')); CommaExpr(); Expect(_SC(')'));
- Expect(_SC('{'));
+ Lex(); Expect('('); CommaExpr(); Expect(')');
+ Expect('{');
SQInteger expr = _fs->TopTarget();
bool bfirst = true;
SQInteger tonextcondjmp = -1;
@@ -1030,7 +1030,7 @@ public:
_fs->SetIntructionParam(tonextcondjmp, 1, _fs->GetCurrentPos() - tonextcondjmp);
}
//condition
- Lex(); Expression(); Expect(_SC(':'));
+ Lex(); Expression(); Expect(':');
SQInteger trg = _fs->PopTarget();
_fs->AddInstruction(_OP_EQ, trg, trg, expr);
_fs->AddInstruction(_OP_JZ, trg, 0);
@@ -1049,13 +1049,13 @@ public:
_fs->SetIntructionParam(tonextcondjmp, 1, _fs->GetCurrentPos() - tonextcondjmp);
if(_token == TK_DEFAULT) {
// _fs->AddLineInfos(_lex._currentline, _lineinfo);
- Lex(); Expect(_SC(':'));
+ Lex(); Expect(':');
SQInteger stacksize = _fs->GetStackSize();
_last_stacksize = _fs->GetStackSize();
Statements();
_fs->SetStackSize(stacksize);
}
- Expect(_SC('}'));
+ Expect('}');
_fs->PopTarget();
__nbreaks__ = _fs->_unresolvedbreaks.size() - __nbreaks__;
if(__nbreaks__ > 0)ResolveBreaks(_fs, __nbreaks__);
@@ -1076,7 +1076,7 @@ public:
_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(id));
if(_token == TK_DOUBLE_COLON) Emit2ArgsOP(_OP_GET);
}
- Expect(_SC('('));
+ Expect('(');
CreateFunction(id);
_fs->AddInstruction(_OP_CLOSURE, _fs->PushTarget(), _fs->_functions.size() - 1, 0);
EmitDerefOp(_OP_NEWSLOT);
@@ -1090,13 +1090,13 @@ public:
_exst._funcarg = false;
PrefixedExpr();
es = PopExpState();
- if(es._deref == DEREF_NO_DEREF) Error(_SC("invalid class name"));
+ if(es._deref == DEREF_NO_DEREF) Error("invalid class name");
if(es._deref == DEREF_FIELD) {
ClassExp();
EmitDerefOp(_OP_NEWSLOT);
_fs->PopTarget();
}
- else Error(_SC("cannot create a class in a local with the syntax(class <local>)"));
+ else Error("cannot create a class in a local with the syntax(class <local>)");
}
SQObject ExpectScalar()
{
@@ -1126,12 +1126,12 @@ public:
val._unVal.fFloat = -_lex._fvalue;
break;
default:
- Error(_SC("scalar expected : integer,float"));
+ Error("scalar expected : integer,float");
val._type = OT_NULL; // Silent compile-warning
}
break;
default:
- Error(_SC("scalar expected : integer,float or string"));
+ Error("scalar expected : integer,float or string");
val._type = OT_NULL; // Silent compile-warning
}
Lex();
@@ -1142,14 +1142,14 @@ public:
Lex();
SQObject id = Expect(TK_IDENTIFIER);
- Expect(_SC('{'));
+ Expect('{');
SQObject table = _fs->CreateTable();
SQInteger nval = 0;
- while(_token != _SC('}')) {
+ while(_token != '}') {
SQObject key = Expect(TK_IDENTIFIER);
SQObject val;
- if(_token == _SC('=')) {
+ if(_token == '=') {
Lex();
val = ExpectScalar();
}
@@ -1165,7 +1165,7 @@ public:
/*SQObjectPtr dummy;
if(enums->Get(strongid,dummy)) {
dummy.Null(); strongid.Null();
- Error(_SC("enumeration already exists"));
+ Error("enumeration already exists");
}*/
enums->NewSlot(SQObjectPtr(strongid),SQObjectPtr(table));
strongid.Null();
@@ -1189,7 +1189,7 @@ public:
_fs->AddInstruction(_OP_JMP, 0, 0);
SQInteger jmppos = _fs->GetCurrentPos();
_fs->SetIntructionParam(trappos, 1, (_fs->GetCurrentPos() - trappos));
- Expect(TK_CATCH); Expect(_SC('(')); exid = Expect(TK_IDENTIFIER); Expect(_SC(')'));
+ Expect(TK_CATCH); Expect('('); exid = Expect(TK_IDENTIFIER); Expect(')');
SQInteger stacksize = _fs->GetStackSize();
SQInteger ex_target = _fs->PushLocalVariable(exid);
_fs->SetIntructionParam(trappos, 0, ex_target);
@@ -1199,7 +1199,7 @@ public:
}
void FunctionExp(SQInteger ftype)
{
- Lex(); Expect(_SC('('));
+ Lex(); Expect('(');
CreateFunction(_null_);
_fs->AddInstruction(_OP_CLOSURE, _fs->PushTarget(), _fs->_functions.size() - 1, ftype == TK_FUNCTION?0:1);
}
@@ -1214,19 +1214,19 @@ public:
if(_token == TK_ATTR_OPEN) {
Lex();
_fs->AddInstruction(_OP_NEWTABLE, _fs->PushTarget());
- ParseTableOrClass(_SC(','),TK_ATTR_CLOSE);
+ ParseTableOrClass(',',TK_ATTR_CLOSE);
attrs = _fs->TopTarget();
}
- Expect(_SC('{'));
+ Expect('{');
if(attrs != -1) _fs->PopTarget();
if(base != -1) _fs->PopTarget();
_fs->AddInstruction(_OP_CLASS, _fs->PushTarget(), base, attrs);
- ParseTableOrClass(_SC(';'));
+ ParseTableOrClass(';');
}
void DelegateExpr()
{
Lex(); CommaExpr();
- Expect(_SC(':'));
+ Expect(':');
CommaExpr();
SQInteger table = _fs->PopTarget(), delegate = _fs->PopTarget();
_fs->AddInstruction(_OP_DELEGATE, _fs->PushTarget(), table, delegate);
@@ -1239,9 +1239,9 @@ public:
_exst._funcarg = false;
PrefixedExpr();
es = PopExpState();
- if(es._deref == DEREF_NO_DEREF) Error(_SC("can't delete an expression"));
+ if(es._deref == DEREF_NO_DEREF) Error("can't delete an expression");
if(es._deref == DEREF_FIELD) Emit2ArgsOP(_OP_DELETE);
- else Error(_SC("cannot delete a local"));
+ else Error("cannot delete a local");
}
void PrefixIncDec(SQInteger token)
{
@@ -1263,46 +1263,46 @@ public:
SQFuncState *funcstate = _fs->PushChildState(_ss(_vm));
funcstate->_name = name;
SQObject paramname;
- funcstate->AddParameter(_fs->CreateString(_SC("this")));
+ funcstate->AddParameter(_fs->CreateString("this"));
funcstate->_sourcename = _sourcename;
SQInteger defparams = 0;
- while(_token!=_SC(')')) {
+ while(_token!=')') {
if(_token == TK_VARPARAMS) {
- if(defparams > 0) Error(_SC("function with default parameters cannot have variable number of parameters"));
+ if(defparams > 0) Error("function with default parameters cannot have variable number of parameters");
funcstate->_varparams = true;
Lex();
- if(_token != _SC(')')) Error(_SC("expected ')'"));
+ if(_token != ')') Error("expected ')'");
break;
}
else {
paramname = Expect(TK_IDENTIFIER);
funcstate->AddParameter(paramname);
- if(_token == _SC('=')) {
+ if(_token == '=') {
Lex();
Expression();
funcstate->AddDefaultParam(_fs->TopTarget());
defparams++;
}
else {
- if(defparams > 0) Error(_SC("expected '='"));
+ if(defparams > 0) Error("expected '='");
}
- if(_token == _SC(',')) Lex();
- else if(_token != _SC(')')) Error(_SC("expected ')' or ','"));
+ if(_token == ',') Lex();
+ else if(_token != ')') Error("expected ')' or ','");
}
}
- Expect(_SC(')'));
+ Expect(')');
for(SQInteger n = 0; n < defparams; n++) {
_fs->PopTarget();
}
//outer values
- if(_token == _SC(':')) {
- Lex(); Expect(_SC('('));
- while(_token != _SC(')')) {
+ if(_token == ':') {
+ Lex(); Expect('(');
+ while(_token != ')') {
paramname = Expect(TK_IDENTIFIER);
//outers are treated as implicit local variables
funcstate->AddOuterValue(paramname);
- if(_token == _SC(',')) Lex();
- else if(_token != _SC(')')) Error(_SC("expected ')' or ','"));
+ if(_token == ',') Lex();
+ else if(_token != ')') Error("expected ')' or ','");
}
Lex();
}
@@ -1310,7 +1310,7 @@ public:
SQFuncState *currchunk = _fs;
_fs = funcstate;
Statement();
- funcstate->AddLineInfos(_lex._prevtoken == _SC('\n')?_lex._lasttokenline:_lex._currentline, _lineinfo, true);
+ funcstate->AddLineInfos(_lex._prevtoken == '\n'?_lex._lasttokenline:_lex._currentline, _lineinfo, true);
funcstate->AddInstruction(_OP_RETURN, -1);
funcstate->SetStackSize(0);
//_fs->->_stacksize = _fs->_stacksize;
diff --git a/src/3rdparty/squirrel/squirrel/sqdebug.cpp b/src/3rdparty/squirrel/squirrel/sqdebug.cpp
index 77f88d1c4..43bf7df04 100644
--- a/src/3rdparty/squirrel/squirrel/sqdebug.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqdebug.cpp
@@ -18,12 +18,12 @@ SQRESULT sq_getfunctioninfo(HSQUIRRELVM v,SQInteger level,SQFunctionInfo *fi)
SQClosure *c = _closure(ci._closure);
SQFunctionProto *proto = _funcproto(c->_function);
fi->funcid = proto;
- fi->name = type(proto->_name) == OT_STRING?_stringval(proto->_name):_SC("unknown");
- fi->source = type(proto->_name) == OT_STRING?_stringval(proto->_sourcename):_SC("unknown");
+ fi->name = type(proto->_name) == OT_STRING?_stringval(proto->_name):"unknown";
+ fi->source = type(proto->_name) == OT_STRING?_stringval(proto->_sourcename):"unknown";
return SQ_OK;
}
}
- return sq_throwerror(v,_SC("the object is not a closure"));
+ return sq_throwerror(v,"the object is not a closure");
}
SQRESULT sq_stackinfos(HSQUIRRELVM v, SQInteger level, SQStackInfos *si)
@@ -43,8 +43,8 @@ SQRESULT sq_stackinfos(HSQUIRRELVM v, SQInteger level, SQStackInfos *si)
}
break;
case OT_NATIVECLOSURE:
- si->source = _SC("NATIVE");
- si->funcname = _SC("unknown");
+ si->source = "NATIVE";
+ si->funcname = "unknown";
if(type(_nativeclosure(ci._closure)->_name) == OT_STRING)
si->funcname = _stringval(_nativeclosure(ci._closure)->_name);
si->line = -1;
@@ -79,7 +79,7 @@ SQString *SQVM::PrintObjVal(const SQObject &o)
return SQString::Create(_ss(this), _spval);
break;
case OT_FLOAT:
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%.14g"), _float(o));
+ scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), "%.14g", _float(o));
return SQString::Create(_ss(this), _spval);
break;
default:
@@ -90,28 +90,28 @@ SQString *SQVM::PrintObjVal(const SQObject &o)
void SQVM::Raise_IdxError(const SQObject &o)
{
SQObjectPtr oval = PrintObjVal(o);
- Raise_Error(_SC("the index '%.50s' does not exist"), _stringval(oval));
+ Raise_Error("the index '%.50s' does not exist", _stringval(oval));
}
void SQVM::Raise_CompareError(const SQObject &o1, const SQObject &o2)
{
SQObjectPtr oval1 = PrintObjVal(o1), oval2 = PrintObjVal(o2);
- Raise_Error(_SC("comparsion between '%.50s' and '%.50s'"), _stringval(oval1), _stringval(oval2));
+ Raise_Error("comparsion between '%.50s' and '%.50s'", _stringval(oval1), _stringval(oval2));
}
void SQVM::Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger type)
{
- SQObjectPtr exptypes = SQString::Create(_ss(this), _SC(""), -1);
+ SQObjectPtr exptypes = SQString::Create(_ss(this), "", -1);
SQInteger found = 0;
for(SQInteger i=0; i<16; i++)
{
SQInteger mask = 0x00000001 << i;
if(typemask & (mask)) {
- if(found>0) StringCat(exptypes,SQString::Create(_ss(this), _SC("|"), -1), exptypes);
+ if(found>0) StringCat(exptypes,SQString::Create(_ss(this), "|", -1), exptypes);
found ++;
StringCat(exptypes,SQString::Create(_ss(this), IdType2Name((SQObjectType)mask), -1), exptypes);
}
}
- Raise_Error(_SC("parameter %d has an invalid type '%s' ; expected: '%s'"), nparam, IdType2Name((SQObjectType)type), _stringval(exptypes));
+ Raise_Error("parameter %d has an invalid type '%s' ; expected: '%s'", nparam, IdType2Name((SQObjectType)type), _stringval(exptypes));
}
diff --git a/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp b/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
index fd8caf2e4..760624fba 100644
--- a/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
@@ -11,78 +11,78 @@
#ifdef _DEBUG_DUMP
SQInstructionDesc g_InstrDesc[]={
- {_SC("_OP_LINE")},
- {_SC("_OP_LOAD")},
- {_SC("_OP_LOADINT")},
- {_SC("_OP_LOADFLOAT")},
- {_SC("_OP_DLOAD")},
- {_SC("_OP_TAILCALL")},
- {_SC("_OP_CALL")},
- {_SC("_OP_PREPCALL")},
- {_SC("_OP_PREPCALLK")},
- {_SC("_OP_GETK")},
- {_SC("_OP_MOVE")},
- {_SC("_OP_NEWSLOT")},
- {_SC("_OP_DELETE")},
- {_SC("_OP_SET")},
- {_SC("_OP_GET")},
- {_SC("_OP_EQ")},
- {_SC("_OP_NE")},
- {_SC("_OP_ARITH")},
- {_SC("_OP_BITW")},
- {_SC("_OP_RETURN")},
- {_SC("_OP_LOADNULLS")},
- {_SC("_OP_LOADROOTTABLE")},
- {_SC("_OP_LOADBOOL")},
- {_SC("_OP_DMOVE")},
- {_SC("_OP_JMP")},
- {_SC("_OP_JNZ")},
- {_SC("_OP_JZ")},
- {_SC("_OP_LOADFREEVAR")},
- {_SC("_OP_VARGC")},
- {_SC("_OP_GETVARGV")},
- {_SC("_OP_NEWTABLE")},
- {_SC("_OP_NEWARRAY")},
- {_SC("_OP_APPENDARRAY")},
- {_SC("_OP_GETPARENT")},
- {_SC("_OP_COMPARITH")},
- {_SC("_OP_COMPARITHL")},
- {_SC("_OP_INC")},
- {_SC("_OP_INCL")},
- {_SC("_OP_PINC")},
- {_SC("_OP_PINCL")},
- {_SC("_OP_CMP")},
- {_SC("_OP_EXISTS")},
- {_SC("_OP_INSTANCEOF")},
- {_SC("_OP_AND")},
- {_SC("_OP_OR")},
- {_SC("_OP_NEG")},
- {_SC("_OP_NOT")},
- {_SC("_OP_BWNOT")},
- {_SC("_OP_CLOSURE")},
- {_SC("_OP_YIELD")},
- {_SC("_OP_RESUME")},
- {_SC("_OP_FOREACH")},
- {_SC("_OP_POSTFOREACH")},
- {_SC("_OP_DELEGATE")},
- {_SC("_OP_CLONE")},
- {_SC("_OP_TYPEOF")},
- {_SC("_OP_PUSHTRAP")},
- {_SC("_OP_POPTRAP")},
- {_SC("_OP_THROW")},
- {_SC("_OP_CLASS")},
- {_SC("_OP_NEWSLOTA")},
- {_SC("_OP_SCOPE_END")}
+ {"_OP_LINE"},
+ {"_OP_LOAD"},
+ {"_OP_LOADINT"},
+ {"_OP_LOADFLOAT"},
+ {"_OP_DLOAD"},
+ {"_OP_TAILCALL"},
+ {"_OP_CALL"},
+ {"_OP_PREPCALL"},
+ {"_OP_PREPCALLK"},
+ {"_OP_GETK"},
+ {"_OP_MOVE"},
+ {"_OP_NEWSLOT"},
+ {"_OP_DELETE"},
+ {"_OP_SET"},
+ {"_OP_GET"},
+ {"_OP_EQ"},
+ {"_OP_NE"},
+ {"_OP_ARITH"},
+ {"_OP_BITW"},
+ {"_OP_RETURN"},
+ {"_OP_LOADNULLS"},
+ {"_OP_LOADROOTTABLE"},
+ {"_OP_LOADBOOL"},
+ {"_OP_DMOVE"},
+ {"_OP_JMP"},
+ {"_OP_JNZ"},
+ {"_OP_JZ"},
+ {"_OP_LOADFREEVAR"},
+ {"_OP_VARGC"},
+ {"_OP_GETVARGV"},
+ {"_OP_NEWTABLE"},
+ {"_OP_NEWARRAY"},
+ {"_OP_APPENDARRAY"},
+ {"_OP_GETPARENT"},
+ {"_OP_COMPARITH"},
+ {"_OP_COMPARITHL"},
+ {"_OP_INC"},
+ {"_OP_INCL"},
+ {"_OP_PINC"},
+ {"_OP_PINCL"},
+ {"_OP_CMP"},
+ {"_OP_EXISTS"},
+ {"_OP_INSTANCEOF"},
+ {"_OP_AND"},
+ {"_OP_OR"},
+ {"_OP_NEG"},
+ {"_OP_NOT"},
+ {"_OP_BWNOT"},
+ {"_OP_CLOSURE"},
+ {"_OP_YIELD"},
+ {"_OP_RESUME"},
+ {"_OP_FOREACH"},
+ {"_OP_POSTFOREACH"},
+ {"_OP_DELEGATE"},
+ {"_OP_CLONE"},
+ {"_OP_TYPEOF"},
+ {"_OP_PUSHTRAP"},
+ {"_OP_POPTRAP"},
+ {"_OP_THROW"},
+ {"_OP_CLASS"},
+ {"_OP_NEWSLOTA"},
+ {"_OP_SCOPE_END"}
};
#endif
void DumpLiteral(SQObjectPtr &o)
{
switch(type(o)){
- case OT_STRING: scprintf(_SC("\"%s\""),_stringval(o));break;
- case OT_FLOAT: scprintf(_SC("{%f}"),_float(o));break;
- case OT_INTEGER: scprintf(_SC("{") SQ_PRINTF64 _SC("}"),_integer(o));break;
- case OT_BOOL: scprintf(_SC("%s"),_integer(o)?_SC("true"):_SC("false"));break;
- default: scprintf(_SC("(%s %p)"),GetTypeName(o),(void*)_rawval(o));break; break; //shut up compiler
+ case OT_STRING: scprintf("\"%s\"",_stringval(o));break;
+ case OT_FLOAT: scprintf("{%f}",_float(o));break;
+ case OT_INTEGER: scprintf("{" SQ_PRINTF64 "}",_integer(o));break;
+ case OT_BOOL: scprintf("%s",_integer(o)?"true":"false");break;
+ default: scprintf("(%s %p)",GetTypeName(o),(void*)_rawval(o));break; break; //shut up compiler
}
}
@@ -115,11 +115,11 @@ void SQFuncState::Dump(SQFunctionProto *func)
{
SQUnsignedInteger n=0,i;
SQInteger si;
- scprintf(_SC("SQInstruction sizeof %d\n"),sizeof(SQInstruction));
- scprintf(_SC("SQObject sizeof %d\n"),sizeof(SQObject));
- scprintf(_SC("--------------------------------------------------------------------\n"));
- scprintf(_SC("*****FUNCTION [%s]\n"),type(func->_name)==OT_STRING?_stringval(func->_name):_SC("unknown"));
- scprintf(_SC("-----LITERALS\n"));
+ scprintf("SQInstruction sizeof %d\n",sizeof(SQInstruction));
+ scprintf("SQObject sizeof %d\n",sizeof(SQObject));
+ scprintf("--------------------------------------------------------------------\n");
+ scprintf("*****FUNCTION [%s]\n",type(func->_name)==OT_STRING?_stringval(func->_name):"unknown");
+ scprintf("-----LITERALS\n");
SQObjectPtr refidx,key,val;
SQInteger idx;
SQObjectPtrVec templiterals;
@@ -129,43 +129,43 @@ void SQFuncState::Dump(SQFunctionProto *func)
templiterals[_integer(val)]=key;
}
for(i=0;i<templiterals.size();i++){
- scprintf(_SC("[%d] "),n);
+ scprintf("[%d] ",n);
DumpLiteral(templiterals[i]);
- scprintf(_SC("\n"));
+ scprintf("\n");
n++;
}
- scprintf(_SC("-----PARAMS\n"));
+ scprintf("-----PARAMS\n");
if(_varparams)
- scprintf(_SC("<<VARPARAMS>>\n"));
+ scprintf("<<VARPARAMS>>\n");
n=0;
for(i=0;i<_parameters.size();i++){
- scprintf(_SC("[%d] "),n);
+ scprintf("[%d] ",n);
DumpLiteral(_parameters[i]);
- scprintf(_SC("\n"));
+ scprintf("\n");
n++;
}
- scprintf(_SC("-----LOCALS\n"));
+ scprintf("-----LOCALS\n");
for(si=0;si<func->_nlocalvarinfos;si++){
SQLocalVarInfo lvi=func->_localvarinfos[si];
- scprintf(_SC("[%d] %s \t%d %d\n"),lvi._pos,_stringval(lvi._name),lvi._start_op,lvi._end_op);
+ scprintf("[%d] %s \t%d %d\n",lvi._pos,_stringval(lvi._name),lvi._start_op,lvi._end_op);
n++;
}
- scprintf(_SC("-----LINE INFO\n"));
+ scprintf("-----LINE INFO\n");
for(i=0;i<_lineinfos.size();i++){
SQLineInfo li=_lineinfos[i];
- scprintf(_SC("op [%d] line [%d] \n"),li._op,li._line);
+ scprintf("op [%d] line [%d] \n",li._op,li._line);
n++;
}
- scprintf(_SC("-----dump\n"));
+ scprintf("-----dump\n");
n=0;
for(i=0;i<_instructions.size();i++){
SQInstruction &inst=_instructions[i];
if(inst.op==_OP_LOAD || inst.op==_OP_DLOAD || inst.op==_OP_PREPCALLK || inst.op==_OP_GETK ){
SQInteger lidx = inst._arg1;
- scprintf(_SC("[%03d] %15s %d "),n,g_InstrDesc[inst.op].name,inst._arg0);
+ scprintf("[%03d] %15s %d ",n,g_InstrDesc[inst.op].name,inst._arg0);
if(lidx >= 0xFFFFFFFF)
- scprintf(_SC("null"));
+ scprintf("null");
else {
SQInteger refidx;
SQObjectPtr val,key,refo;
@@ -175,13 +175,13 @@ void SQFuncState::Dump(SQFunctionProto *func)
DumpLiteral(key);
}
if(inst.op != _OP_DLOAD) {
- scprintf(_SC(" %d %d \n"),inst._arg2,inst._arg3);
+ scprintf(" %d %d \n",inst._arg2,inst._arg3);
}
else {
- scprintf(_SC(" %d "),inst._arg2);
+ scprintf(" %d ",inst._arg2);
lidx = inst._arg3;
if(lidx >= 0xFFFFFFFF)
- scprintf(_SC("null"));
+ scprintf("null");
else {
SQInteger refidx;
SQObjectPtr val,key,refo;
@@ -189,23 +189,23 @@ void SQFuncState::Dump(SQFunctionProto *func)
refo = refidx;
}
DumpLiteral(key);
- scprintf(_SC("\n"));
+ scprintf("\n");
}
}
}
else if(inst.op==_OP_LOADFLOAT) {
- scprintf(_SC("[%03d] %15s %d %f %d %d\n"),n,g_InstrDesc[inst.op].name,inst._arg0,*((SQFloat*)&inst._arg1),inst._arg2,inst._arg3);
+ scprintf("[%03d] %15s %d %f %d %d\n",n,g_InstrDesc[inst.op].name,inst._arg0,*((SQFloat*)&inst._arg1),inst._arg2,inst._arg3);
}
else if(inst.op==_OP_ARITH){
- scprintf(_SC("[%03d] %15s %d %d %d %c\n"),n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3);
+ scprintf("[%03d] %15s %d %d %d %c\n",n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3);
}
else
- scprintf(_SC("[%03d] %15s %d %d %d %d\n"),n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3);
+ scprintf("[%03d] %15s %d %d %d %d\n",n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3);
n++;
}
- scprintf(_SC("-----\n"));
- scprintf(_SC("stack size[%d]\n"),func->_stacksize);
- scprintf(_SC("--------------------------------------------------------------------\n\n"));
+ scprintf("-----\n");
+ scprintf("stack size[%d]\n",func->_stacksize);
+ scprintf("--------------------------------------------------------------------\n\n");
}
#endif
@@ -229,7 +229,7 @@ SQInteger SQFuncState::GetConstant(const SQObject &cons)
_nliterals++;
if(_nliterals > MAX_LITERALS) {
val.Null();
- Error(_SC("internal compiler error: too many literals"));
+ Error("internal compiler error: too many literals");
}
}
return _integer(val);
@@ -258,7 +258,7 @@ SQInteger SQFuncState::AllocStackPos()
SQInteger npos=_vlocals.size();
_vlocals.push_back(SQLocalVarInfo());
if(_vlocals.size()>((SQUnsignedInteger)_stacksize)) {
- if(_stacksize>MAX_FUNC_STACKSIZE) Error(_SC("internal compiler error: too many locals"));
+ if(_stacksize>MAX_FUNC_STACKSIZE) Error("internal compiler error: too many locals");
_stacksize=_vlocals.size();
}
return npos;
diff --git a/src/3rdparty/squirrel/squirrel/sqlexer.cpp b/src/3rdparty/squirrel/squirrel/sqlexer.cpp
index 2f6e84cdc..5d91fa888 100644
--- a/src/3rdparty/squirrel/squirrel/sqlexer.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqlexer.cpp
@@ -16,7 +16,7 @@
#define RETURN_TOKEN(t) { _prevtoken = _curtoken; _curtoken = t; return t;}
#define IS_EOB() (CUR_CHAR <= SQUIRREL_EOB)
#define NEXT() {Next();_currentcolumn++;}
-#define ADD_KEYWORD(key,id) _keywords->NewSlot( SQString::Create(ss, _SC(#key)) ,SQInteger(id))
+#define ADD_KEYWORD(key,id) _keywords->NewSlot( SQString::Create(ss, #key) ,SQInteger(id))
SQLexer::SQLexer(){}
SQLexer::~SQLexer()
@@ -94,7 +94,7 @@ void SQLexer::Error(const SQChar *err)
void SQLexer::Next()
{
SQInteger t = _readf(_up);
- if(t > MAX_CHAR) Error(_SC("Invalid character"));
+ if(t > MAX_CHAR) Error("Invalid character");
if(t != 0) {
_currdata = (LexChar)t;
return;
@@ -119,9 +119,9 @@ void SQLexer::LexBlockComment()
bool done = false;
while(!done) {
switch(CUR_CHAR) {
- case _SC('*'): { NEXT(); if(CUR_CHAR == _SC('/')) { done = true; NEXT(); }}; continue;
- case _SC('\n'): _currentline++; NEXT(); continue;
- case SQUIRREL_EOB: Error(_SC("missing \"*/\" in comment"));
+ case '*': { NEXT(); if(CUR_CHAR == '/') { done = true; NEXT(); }}; continue;
+ case '\n': _currentline++; NEXT(); continue;
+ case SQUIRREL_EOB: Error("missing \"*/\" in comment");
default: NEXT();
}
}
@@ -132,121 +132,121 @@ SQInteger SQLexer::Lex()
_lasttokenline = _currentline;
while(CUR_CHAR != SQUIRREL_EOB) {
switch(CUR_CHAR){
- case _SC('\t'): case _SC('\r'): case _SC(' '): NEXT(); continue;
- case _SC('\n'):
+ case '\t': case '\r': case ' ': NEXT(); continue;
+ case '\n':
_currentline++;
_prevtoken=_curtoken;
- _curtoken=_SC('\n');
+ _curtoken='\n';
NEXT();
_currentcolumn=1;
continue;
- case _SC('/'):
+ case '/':
NEXT();
switch(CUR_CHAR){
- case _SC('*'):
+ case '*':
NEXT();
LexBlockComment();
continue;
- case _SC('/'):
- do { NEXT(); } while (CUR_CHAR != _SC('\n') && (!IS_EOB()));
+ case '/':
+ do { NEXT(); } while (CUR_CHAR != '\n' && (!IS_EOB()));
continue;
- case _SC('='):
+ case '=':
NEXT();
RETURN_TOKEN(TK_DIVEQ);
continue;
- case _SC('>'):
+ case '>':
NEXT();
RETURN_TOKEN(TK_ATTR_CLOSE);
continue;
default:
RETURN_TOKEN('/');
}
- case _SC('='):
+ case '=':
NEXT();
- if (CUR_CHAR != _SC('=')){ RETURN_TOKEN('=') }
+ if (CUR_CHAR != '='){ RETURN_TOKEN('=') }
else { NEXT(); RETURN_TOKEN(TK_EQ); }
- case _SC('<'):
+ case '<':
NEXT();
- if ( CUR_CHAR == _SC('=') ) { NEXT(); RETURN_TOKEN(TK_LE) }
- else if ( CUR_CHAR == _SC('-') ) { NEXT(); RETURN_TOKEN(TK_NEWSLOT); }
- else if ( CUR_CHAR == _SC('<') ) { NEXT(); RETURN_TOKEN(TK_SHIFTL); }
- else if ( CUR_CHAR == _SC('/') ) { NEXT(); RETURN_TOKEN(TK_ATTR_OPEN); }
- //else if ( CUR_CHAR == _SC('[') ) { NEXT(); ReadMultilineString(); RETURN_TOKEN(TK_STRING_LITERAL); }
+ if ( CUR_CHAR == '=' ) { NEXT(); RETURN_TOKEN(TK_LE) }
+ else if ( CUR_CHAR == '-' ) { NEXT(); RETURN_TOKEN(TK_NEWSLOT); }
+ else if ( CUR_CHAR == '<' ) { NEXT(); RETURN_TOKEN(TK_SHIFTL); }
+ else if ( CUR_CHAR == '/' ) { NEXT(); RETURN_TOKEN(TK_ATTR_OPEN); }
+ //else if ( CUR_CHAR == '[' ) { NEXT(); ReadMultilineString(); RETURN_TOKEN(TK_STRING_LITERAL); }
else { RETURN_TOKEN('<') }
- case _SC('>'):
+ case '>':
NEXT();
- if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_GE);}
- else if(CUR_CHAR == _SC('>')){
+ if (CUR_CHAR == '='){ NEXT(); RETURN_TOKEN(TK_GE);}
+ else if(CUR_CHAR == '>'){
NEXT();
- if(CUR_CHAR == _SC('>')){
+ if(CUR_CHAR == '>'){
NEXT();
RETURN_TOKEN(TK_USHIFTR);
}
RETURN_TOKEN(TK_SHIFTR);
}
else { RETURN_TOKEN('>') }
- case _SC('!'):
+ case '!':
NEXT();
- if (CUR_CHAR != _SC('=')){ RETURN_TOKEN('!')}
+ if (CUR_CHAR != '='){ RETURN_TOKEN('!')}
else { NEXT(); RETURN_TOKEN(TK_NE); }
- case _SC('@'): {
+ case '@': {
SQInteger stype;
NEXT();
- if(CUR_CHAR != _SC('"'))
- Error(_SC("string expected"));
- if((stype=ReadString(_SC('"'),true))!=-1) {
+ if(CUR_CHAR != '"')
+ Error("string expected");
+ if((stype=ReadString('"',true))!=-1) {
RETURN_TOKEN(stype);
}
- Error(_SC("error parsing the string"));
+ Error("error parsing the string");
}
- case _SC('"'):
- case _SC('\''): {
+ case '"':
+ case '\'': {
SQInteger stype;
if((stype=ReadString(CUR_CHAR,false))!=-1){
RETURN_TOKEN(stype);
}
- Error(_SC("error parsing the string"));
+ Error("error parsing the string");
}
- case _SC('{'): case _SC('}'): case _SC('('): case _SC(')'): case _SC('['): case _SC(']'):
- case _SC(';'): case _SC(','): case _SC('?'): case _SC('^'): case _SC('~'):
+ case '{': case '}': case '(': case ')': case '[': case ']':
+ case ';': case ',': case '?': case '^': case '~':
{SQInteger ret = CUR_CHAR;
NEXT(); RETURN_TOKEN(ret); }
- case _SC('.'):
+ case '.':
NEXT();
- if (CUR_CHAR != _SC('.')){ RETURN_TOKEN('.') }
+ if (CUR_CHAR != '.'){ RETURN_TOKEN('.') }
NEXT();
- if (CUR_CHAR != _SC('.')){ Error(_SC("invalid token '..'")); }
+ if (CUR_CHAR != '.'){ Error("invalid token '..'"); }
NEXT();
RETURN_TOKEN(TK_VARPARAMS);
- case _SC('&'):
+ case '&':
NEXT();
- if (CUR_CHAR != _SC('&')){ RETURN_TOKEN('&') }
+ if (CUR_CHAR != '&'){ RETURN_TOKEN('&') }
else { NEXT(); RETURN_TOKEN(TK_AND); }
- case _SC('|'):
+ case '|':
NEXT();
- if (CUR_CHAR != _SC('|')){ RETURN_TOKEN('|') }
+ if (CUR_CHAR != '|'){ RETURN_TOKEN('|') }
else { NEXT(); RETURN_TOKEN(TK_OR); }
- case _SC(':'):
+ case ':':
NEXT();
- if (CUR_CHAR != _SC(':')){ RETURN_TOKEN(':') }
+ if (CUR_CHAR != ':'){ RETURN_TOKEN(':') }
else { NEXT(); RETURN_TOKEN(TK_DOUBLE_COLON); }
- case _SC('*'):
+ case '*':
NEXT();
- if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_MULEQ);}
+ if (CUR_CHAR == '='){ NEXT(); RETURN_TOKEN(TK_MULEQ);}
else RETURN_TOKEN('*');
- case _SC('%'):
+ case '%':
NEXT();
- if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_MODEQ);}
+ if (CUR_CHAR == '='){ NEXT(); RETURN_TOKEN(TK_MODEQ);}
else RETURN_TOKEN('%');
- case _SC('-'):
+ case '-':
NEXT();
- if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_MINUSEQ);}
- else if (CUR_CHAR == _SC('-')){ NEXT(); RETURN_TOKEN(TK_MINUSMINUS);}
+ if (CUR_CHAR == '='){ NEXT(); RETURN_TOKEN(TK_MINUSEQ);}
+ else if (CUR_CHAR == '-'){ NEXT(); RETURN_TOKEN(TK_MINUSMINUS);}
else RETURN_TOKEN('-');
- case _SC('+'):
+ case '+':
NEXT();
- if (CUR_CHAR == _SC('=')){ NEXT(); RETURN_TOKEN(TK_PLUSEQ);}
- else if (CUR_CHAR == _SC('+')){ NEXT(); RETURN_TOKEN(TK_PLUSPLUS);}
+ if (CUR_CHAR == '='){ NEXT(); RETURN_TOKEN(TK_PLUSEQ);}
+ else if (CUR_CHAR == '+'){ NEXT(); RETURN_TOKEN(TK_PLUSPLUS);}
else RETURN_TOKEN('+');
case SQUIRREL_EOB:
return 0;
@@ -255,13 +255,13 @@ SQInteger SQLexer::Lex()
SQInteger ret = ReadNumber();
RETURN_TOKEN(ret);
}
- else if (scisalpha(CUR_CHAR) || CUR_CHAR == _SC('_')) {
+ else if (scisalpha(CUR_CHAR) || CUR_CHAR == '_') {
SQInteger t = ReadID();
RETURN_TOKEN(t);
}
else {
SQInteger c = CUR_CHAR;
- if (sciscntrl((int)c)) Error(_SC("unexpected character(control)"));
+ if (sciscntrl((int)c)) Error("unexpected character(control)");
NEXT();
RETURN_TOKEN(c);
}
@@ -291,22 +291,22 @@ SQInteger SQLexer::ReadString(LexChar ndelim,bool verbatim)
while(CUR_CHAR != ndelim) {
switch(CUR_CHAR) {
case SQUIRREL_EOB:
- Error(_SC("unfinished string"));
+ Error("unfinished string");
return -1;
- case _SC('\n'):
- if(!verbatim) Error(_SC("newline in a constant"));
+ case '\n':
+ if(!verbatim) Error("newline in a constant");
APPEND_CHAR(CUR_CHAR); NEXT();
_currentline++;
break;
- case _SC('\\'):
+ case '\\':
if(verbatim) {
APPEND_CHAR('\\'); NEXT();
}
else {
NEXT();
switch(CUR_CHAR) {
- case _SC('x'): NEXT(); {
- if(!isxdigit(CUR_CHAR)) Error(_SC("hexadecimal number expected"));
+ case 'x': NEXT(); {
+ if(!isxdigit(CUR_CHAR)) Error("hexadecimal number expected");
const SQInteger maxdigits = 4;
SQChar temp[maxdigits+1];
SQInteger n = 0;
@@ -320,19 +320,19 @@ SQInteger SQLexer::ReadString(LexChar ndelim,bool verbatim)
APPEND_CHAR((SQChar)scstrtoul(temp,&sTemp,16));
}
break;
- case _SC('t'): APPEND_CHAR(_SC('\t')); NEXT(); break;
- case _SC('a'): APPEND_CHAR(_SC('\a')); NEXT(); break;
- case _SC('b'): APPEND_CHAR(_SC('\b')); NEXT(); break;
- case _SC('n'): APPEND_CHAR(_SC('\n')); NEXT(); break;
- case _SC('r'): APPEND_CHAR(_SC('\r')); NEXT(); break;
- case _SC('v'): APPEND_CHAR(_SC('\v')); NEXT(); break;
- case _SC('f'): APPEND_CHAR(_SC('\f')); NEXT(); break;
- case _SC('0'): APPEND_CHAR(_SC('\0')); NEXT(); break;
- case _SC('\\'): APPEND_CHAR(_SC('\\')); NEXT(); break;
- case _SC('"'): APPEND_CHAR(_SC('"')); NEXT(); break;
- case _SC('\''): APPEND_CHAR(_SC('\'')); NEXT(); break;
+ case 't': APPEND_CHAR('\t'); NEXT(); break;
+ case 'a': APPEND_CHAR('\a'); NEXT(); break;
+ case 'b': APPEND_CHAR('\b'); NEXT(); break;
+ case 'n': APPEND_CHAR('\n'); NEXT(); break;
+ case 'r': APPEND_CHAR('\r'); NEXT(); break;
+ case 'v': APPEND_CHAR('\v'); NEXT(); break;
+ case 'f': APPEND_CHAR('\f'); NEXT(); break;
+ case '0': APPEND_CHAR('\0'); NEXT(); break;
+ case '\\': APPEND_CHAR('\\'); NEXT(); break;
+ case '"': APPEND_CHAR('"'); NEXT(); break;
+ case '\'': APPEND_CHAR('\''); NEXT(); break;
default:
- Error(_SC("unrecognised escaper char"));
+ Error("unrecognised escaper char");
break;
}
}
@@ -353,9 +353,9 @@ SQInteger SQLexer::ReadString(LexChar ndelim,bool verbatim)
}
TERMINATE_BUFFER();
SQInteger len = _longstr.size()-1;
- if(ndelim == _SC('\'')) {
- if(len == 0) Error(_SC("empty constant"));
- if(len > 1) Error(_SC("constant too long"));
+ if(ndelim == '\'') {
+ if(len == 0) Error("empty constant");
+ if(len > 1) Error("constant too long");
_nvalue = _longstr[0];
return TK_INTEGER;
}
@@ -383,7 +383,7 @@ void LexInteger(const SQChar *s,SQUnsignedInteger *res)
}
}
-SQInteger scisodigit(SQChar c) { return c >= _SC('0') && c <= _SC('7'); }
+SQInteger scisodigit(SQChar c) { return c >= '0' && c <= '7'; }
void LexOctal(const SQChar *s,SQUnsignedInteger *res)
{
@@ -410,14 +410,14 @@ SQInteger SQLexer::ReadNumber()
SQChar *sTemp;
INIT_TEMP_STRING();
NEXT();
- if(firstchar == _SC('0') && (toupper(CUR_CHAR) == _SC('X') || scisodigit(CUR_CHAR)) ) {
+ if(firstchar == '0' && (toupper(CUR_CHAR) == 'X' || scisodigit(CUR_CHAR)) ) {
if(scisodigit(CUR_CHAR)) {
type = TOCTAL;
while(scisodigit(CUR_CHAR)) {
APPEND_CHAR(CUR_CHAR);
NEXT();
}
- if(scisdigit(CUR_CHAR)) Error(_SC("invalid octal number"));
+ if(scisdigit(CUR_CHAR)) Error("invalid octal number");
}
else {
NEXT();
@@ -426,15 +426,15 @@ SQInteger SQLexer::ReadNumber()
APPEND_CHAR(CUR_CHAR);
NEXT();
}
- if(_longstr.size() > MAX_HEX_DIGITS) Error(_SC("too many digits for an Hex number"));
+ if(_longstr.size() > MAX_HEX_DIGITS) Error("too many digits for an Hex number");
}
}
else {
APPEND_CHAR((int)firstchar);
- while (CUR_CHAR == _SC('.') || scisdigit(CUR_CHAR) || isexponent(CUR_CHAR)) {
- if(CUR_CHAR == _SC('.') || isexponent(CUR_CHAR)) type = TFLOAT;
+ while (CUR_CHAR == '.' || scisdigit(CUR_CHAR) || isexponent(CUR_CHAR)) {
+ if(CUR_CHAR == '.' || isexponent(CUR_CHAR)) type = TFLOAT;
if(isexponent(CUR_CHAR)) {
- if(type != TFLOAT) Error(_SC("invalid numeric format"));
+ if(type != TFLOAT) Error("invalid numeric format");
type = TSCIENTIFIC;
APPEND_CHAR(CUR_CHAR);
NEXT();
@@ -442,7 +442,7 @@ SQInteger SQLexer::ReadNumber()
APPEND_CHAR(CUR_CHAR);
NEXT();
}
- if(!scisdigit(CUR_CHAR)) Error(_SC("exponent expected"));
+ if(!scisdigit(CUR_CHAR)) Error("exponent expected");
}
APPEND_CHAR(CUR_CHAR);
@@ -475,7 +475,7 @@ SQInteger SQLexer::ReadID()
do {
APPEND_CHAR(CUR_CHAR);
NEXT();
- } while(scisalnum(CUR_CHAR) || CUR_CHAR == _SC('_'));
+ } while(scisalnum(CUR_CHAR) || CUR_CHAR == '_');
TERMINATE_BUFFER();
res = GetIDType(&_longstr[0]);
if(res == TK_IDENTIFIER || res == TK_CONSTRUCTOR) {
diff --git a/src/3rdparty/squirrel/squirrel/sqlexer.h b/src/3rdparty/squirrel/squirrel/sqlexer.h
index 232c29cc0..7145dce90 100644
--- a/src/3rdparty/squirrel/squirrel/sqlexer.h
+++ b/src/3rdparty/squirrel/squirrel/sqlexer.h
@@ -23,7 +23,7 @@ private:
SQTable *_keywords;
void INIT_TEMP_STRING() { _longstr.resize(0); }
void APPEND_CHAR(LexChar c);
- void TERMINATE_BUFFER() { _longstr.push_back(_SC('\0')); }
+ void TERMINATE_BUFFER() { _longstr.push_back('\0'); }
public:
SQInteger _prevtoken;
diff --git a/src/3rdparty/squirrel/squirrel/sqobject.cpp b/src/3rdparty/squirrel/squirrel/sqobject.cpp
index c19e71fa9..1983e937b 100644
--- a/src/3rdparty/squirrel/squirrel/sqobject.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqobject.cpp
@@ -16,25 +16,25 @@ const SQChar *IdType2Name(SQObjectType type)
{
switch(_RAW_TYPE(type))
{
- case _RT_NULL:return _SC("null");
- case _RT_INTEGER:return _SC("integer");
- case _RT_FLOAT:return _SC("float");
- case _RT_BOOL:return _SC("bool");
- case _RT_STRING:return _SC("string");
- case _RT_TABLE:return _SC("table");
- case _RT_ARRAY:return _SC("array");
- case _RT_GENERATOR:return _SC("generator");
+ case _RT_NULL:return "null";
+ case _RT_INTEGER:return "integer";
+ case _RT_FLOAT:return "float";
+ case _RT_BOOL:return "bool";
+ case _RT_STRING:return "string";
+ case _RT_TABLE:return "table";
+ case _RT_ARRAY:return "array";
+ case _RT_GENERATOR:return "generator";
case _RT_CLOSURE:
case _RT_NATIVECLOSURE:
- return _SC("function");
+ return "function";
case _RT_USERDATA:
case _RT_USERPOINTER:
- return _SC("userdata");
- case _RT_THREAD: return _SC("thread");
- case _RT_FUNCPROTO: return _SC("function");
- case _RT_CLASS: return _SC("class");
- case _RT_INSTANCE: return _SC("instance");
- case _RT_WEAKREF: return _SC("weakref");
+ return "userdata";
+ case _RT_THREAD: return "thread";
+ case _RT_FUNCPROTO: return "function";
+ case _RT_CLASS: return "class";
+ case _RT_INSTANCE: return "instance";
+ case _RT_WEAKREF: return "weakref";
default:
return NULL;
}
@@ -130,8 +130,8 @@ bool SQDelegable::SetDelegate(SQTable *mt)
bool SQGenerator::Yield(SQVM *v)
{
- if(_state==eSuspended) { v->Raise_Error(_SC("internal vm error, yielding dead generator")); return false;}
- if(_state==eDead) { v->Raise_Error(_SC("internal vm error, yielding a dead generator")); return false; }
+ if(_state==eSuspended) { v->Raise_Error("internal vm error, yielding dead generator"); return false;}
+ if(_state==eDead) { v->Raise_Error("internal vm error, yielding a dead generator"); return false; }
SQInteger size = v->_top-v->_stackbase;
_ci=*v->ci;
_stack.resize(size);
@@ -156,8 +156,8 @@ bool SQGenerator::Yield(SQVM *v)
bool SQGenerator::Resume(SQVM *v,SQInteger target)
{
SQInteger size=_stack.size();
- if(_state==eDead){ v->Raise_Error(_SC("resuming dead generator")); return false; }
- if(_state==eRunning){ v->Raise_Error(_SC("resuming active generator")); return false; }
+ if(_state==eDead){ v->Raise_Error("resuming dead generator"); return false; }
+ if(_state==eRunning){ v->Raise_Error("resuming active generator"); return false; }
SQInteger prevtop=v->_top-v->_stackbase;
PUSH_CALLINFO(v,_ci);
SQInteger oldstackbase=v->_stackbase;
@@ -184,7 +184,7 @@ bool SQGenerator::Resume(SQVM *v,SQInteger target)
v->ci->_prevstkbase = (SQInt32)(v->_stackbase - oldstackbase);
_state=eRunning;
if (type(v->_debughook) != OT_NULL && _rawval(v->_debughook) != _rawval(v->ci->_closure))
- v->CallDebugHook(_SC('c'));
+ v->CallDebugHook('c');
return true;
}
@@ -232,7 +232,7 @@ SQInteger SQFunctionProto::GetLine(SQInstruction *curr)
bool SafeWrite(HSQUIRRELVM v,SQWRITEFUNC write,SQUserPointer up,SQUserPointer dest,SQInteger size)
{
if(write(up,dest,size) != size) {
- v->Raise_Error(_SC("io error (write function failure)"));
+ v->Raise_Error("io error (write function failure)");
return false;
}
return true;
@@ -241,7 +241,7 @@ bool SafeWrite(HSQUIRRELVM v,SQWRITEFUNC write,SQUserPointer up,SQUserPointer de
bool SafeRead(HSQUIRRELVM v,SQWRITEFUNC read,SQUserPointer up,SQUserPointer dest,SQInteger size)
{
if(size && read(up,dest,size) != size) {
- v->Raise_Error(_SC("io error, read function failure, the origin stream could be corrupted/trucated"));
+ v->Raise_Error("io error, read function failure, the origin stream could be corrupted/trucated");
return false;
}
return true;
@@ -257,7 +257,7 @@ bool CheckTag(HSQUIRRELVM v,SQWRITEFUNC read,SQUserPointer up,SQInteger tag)
SQInteger t;
_CHECK_IO(SafeRead(v,read,up,&t,sizeof(t)));
if(t != tag){
- v->Raise_Error(_SC("invalid or corrupted closure stream"));
+ v->Raise_Error("invalid or corrupted closure stream");
return false;
}
return true;
@@ -278,7 +278,7 @@ bool WriteObject(HSQUIRRELVM v,SQUserPointer up,SQWRITEFUNC write,SQObjectPtr &o
case OT_NULL:
break;
default:
- v->Raise_Error(_SC("cannot serialize a %s"),GetTypeName(o));
+ v->Raise_Error("cannot serialize a %s",GetTypeName(o));
return false;
}
return true;
@@ -308,7 +308,7 @@ bool ReadObject(HSQUIRRELVM v,SQUserPointer up,SQREADFUNC read,SQObjectPtr &o)
o=_null_;
break;
default:
- v->Raise_Error(_SC("cannot serialize a %s"),IdType2Name(t));
+ v->Raise_Error("cannot serialize a %s",IdType2Name(t));
return false;
}
return true;
diff --git a/src/3rdparty/squirrel/squirrel/sqobject.h b/src/3rdparty/squirrel/squirrel/sqobject.h
index ac367ae02..d71e515a8 100644
--- a/src/3rdparty/squirrel/squirrel/sqobject.h
+++ b/src/3rdparty/squirrel/squirrel/sqobject.h
@@ -32,24 +32,24 @@ enum SQMetaMethod{
MT_LAST = 18
};
-#define MM_ADD _SC("_add")
-#define MM_SUB _SC("_sub")
-#define MM_MUL _SC("_mul")
-#define MM_DIV _SC("_div")
-#define MM_UNM _SC("_unm")
-#define MM_MODULO _SC("_modulo")
-#define MM_SET _SC("_set")
-#define MM_GET _SC("_get")
-#define MM_TYPEOF _SC("_typeof")
-#define MM_NEXTI _SC("_nexti")
-#define MM_CMP _SC("_cmp")
-#define MM_CALL _SC("_call")
-#define MM_CLONED _SC("_cloned")
-#define MM_NEWSLOT _SC("_newslot")
-#define MM_DELSLOT _SC("_delslot")
-#define MM_TOSTRING _SC("_tostring")
-#define MM_NEWMEMBER _SC("_newmember")
-#define MM_INHERITED _SC("_inherited")
+#define MM_ADD "_add"
+#define MM_SUB "_sub"
+#define MM_MUL "_mul"
+#define MM_DIV "_div"
+#define MM_UNM "_unm"
+#define MM_MODULO "_modulo"
+#define MM_SET "_set"
+#define MM_GET "_get"
+#define MM_TYPEOF "_typeof"
+#define MM_NEXTI "_nexti"
+#define MM_CMP "_cmp"
+#define MM_CALL "_call"
+#define MM_CLONED "_cloned"
+#define MM_NEWSLOT "_newslot"
+#define MM_DELSLOT "_delslot"
+#define MM_TOSTRING "_tostring"
+#define MM_NEWMEMBER "_newmember"
+#define MM_INHERITED "_inherited"
#define MINPOWER2 4
diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp
index 659d59c17..1bc5efd6b 100644
--- a/src/3rdparty/squirrel/squirrel/sqstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp
@@ -108,21 +108,21 @@ void SQSharedState::Init()
_metamethodsmap = SQTable::Create(this,MT_LAST-1);
//adding type strings to avoid memory trashing
//types names
- newsysstring(_SC("null"));
- newsysstring(_SC("table"));
- newsysstring(_SC("array"));
- newsysstring(_SC("closure"));
- newsysstring(_SC("string"));
- newsysstring(_SC("userdata"));
- newsysstring(_SC("integer"));
- newsysstring(_SC("float"));
- newsysstring(_SC("userpointer"));
- newsysstring(_SC("function"));
- newsysstring(_SC("generator"));
- newsysstring(_SC("thread"));
- newsysstring(_SC("class"));
- newsysstring(_SC("instance"));
- newsysstring(_SC("bool"));
+ newsysstring("null");
+ newsysstring("table");
+ newsysstring("array");
+ newsysstring("closure");
+ newsysstring("string");
+ newsysstring("userdata");
+ newsysstring("integer");
+ newsysstring("float");
+ newsysstring("userpointer");
+ newsysstring("function");
+ newsysstring("generator");
+ newsysstring("thread");
+ newsysstring("class");
+ newsysstring("instance");
+ newsysstring("bool");
//meta methods
newmetamethod(MM_ADD);
newmetamethod(MM_SUB);
@@ -143,7 +143,7 @@ void SQSharedState::Init()
newmetamethod(MM_NEWMEMBER);
newmetamethod(MM_INHERITED);
- _constructoridx = SQString::Create(this,_SC("constructor"));
+ _constructoridx = SQString::Create(this,"constructor");
_registry = SQTable::Create(this,0);
_consts = SQTable::Create(this,0);
_table_default_delegate = CreateDefaultDelegate(this,_table_default_delegate_funcz);
@@ -524,7 +524,7 @@ SQString *SQStringTable::Add(const SQChar *news,SQInteger len)
SQString *t=(SQString *)SQ_MALLOC(rsl(len)+sizeof(SQString));
new (t) SQString;
memcpy(t->_val,news,(size_t)rsl(len));
- t->_val[len] = _SC('\0');
+ t->_val[len] = '\0';
t->_len = len;
t->_hash = ::_hashstr(news,(size_t)len);
t->_next = _strings[h];
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index 6f2894774..b1ff8e5f5 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -45,10 +45,10 @@ bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,con
case BW_SHIFTL: res = i1 << i2; break;
case BW_SHIFTR: res = i1 >> i2; break;
case BW_USHIFTR:res = (SQInteger)(*((SQUnsignedInteger*)&i1) >> i2); break;
- default: { Raise_Error(_SC("internal vm error bitwise op failed")); return false; }
+ default: { Raise_Error("internal vm error bitwise op failed"); return false; }
}
}
- else { Raise_Error(_SC("bitwise op between '%s' and '%s'"),GetTypeName(o1),GetTypeName(o2)); return false;}
+ else { Raise_Error("bitwise op between '%s' and '%s'",GetTypeName(o1),GetTypeName(o2)); return false;}
trg = res;
return true;
}
@@ -61,11 +61,11 @@ bool SQVM::ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,
switch(op) {
case '+': res = i1 + i2; break;
case '-': res = i1 - i2; break;
- case '/': if(i2 == 0) { Raise_Error(_SC("division by zero")); return false; }
+ case '/': if(i2 == 0) { Raise_Error("division by zero"); return false; }
res = i1 / i2;
break;
case '*': res = i1 * i2; break;
- case '%': if(i2 == 0) { Raise_Error(_SC("modulo by zero")); return false; }
+ case '%': if(i2 == 0) { Raise_Error("modulo by zero"); return false; }
res = i1 % i2;
break;
default: res = 0xDEADBEEF;
@@ -88,7 +88,7 @@ bool SQVM::ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,
if(!StringCat(o1, o2, trg)) return false;
}
else if(!ArithMetaMethod(op,o1,o2,trg)) {
- Raise_Error(_SC("arith op %c on between '%s' and '%s'"),op,GetTypeName(o1),GetTypeName(o2)); return false;
+ Raise_Error("arith op %c on between '%s' and '%s'",op,GetTypeName(o1),GetTypeName(o2)); return false;
}
}
return true;
@@ -137,11 +137,11 @@ bool SQVM::ArithMetaMethod(SQInteger op,const SQObjectPtr &o1,const SQObjectPtr
{
SQMetaMethod mm;
switch(op){
- case _SC('+'): mm=MT_ADD; break;
- case _SC('-'): mm=MT_SUB; break;
- case _SC('/'): mm=MT_DIV; break;
- case _SC('*'): mm=MT_MUL; break;
- case _SC('%'): mm=MT_MODULO; break;
+ case '+': mm=MT_ADD; break;
+ case '-': mm=MT_SUB; break;
+ case '/': mm=MT_DIV; break;
+ case '*': mm=MT_MUL; break;
+ case '%': mm=MT_MODULO; break;
default: mm = MT_ADD; assert(0); break; //shutup compiler
}
if(is_delegable(o1) && _delegable(o1)->_delegate) {
@@ -173,7 +173,7 @@ bool SQVM::NEG_OP(SQObjectPtr &trg,const SQObjectPtr &o)
}
default:break; //shutup compiler
}
- Raise_Error(_SC("attempt to negate a %s"), GetTypeName(o));
+ Raise_Error("attempt to negate a %s", GetTypeName(o));
return false;
}
@@ -198,7 +198,7 @@ bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObjectPtr &o2,SQInteger &result)
Push(o1);Push(o2);
if(CallMetaMethod(_delegable(o1),MT_CMP,2,res)) {
if(type(res) != OT_INTEGER) {
- Raise_Error(_SC("_cmp must return an integer"));
+ Raise_Error("_cmp must return an integer");
return false;
}
_RET_SUCCEED(_integer(res))
@@ -256,13 +256,13 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
res = o;
return;
case OT_FLOAT:
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%g"),_float(o));
+ scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),"%g",_float(o));
break;
case OT_INTEGER:
scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),SQ_PRINTF64,_integer(o));
break;
case OT_BOOL:
- scsprintf(_sp(rsl(6)),_integer(o)?_SC("true"):_SC("false"));
+ scsprintf(_sp(rsl(6)),_integer(o)?"true":"false");
break;
case OT_TABLE:
case OT_USERDATA:
@@ -276,7 +276,7 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
}
}
default:
- scsprintf(_sp(rsl(sizeof(void*)+20)),_SC("(%s : 0x%p)"),GetTypeName(o),(void*)_rawval(o));
+ scsprintf(_sp(rsl(sizeof(void*)+20)),"(%s : 0x%p)",GetTypeName(o),(void*)_rawval(o));
}
res = SQString::Create(_ss(this),_spval);
}
@@ -346,7 +346,7 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
else if(func->_varparams)
{
if (nargs < paramssize) {
- Raise_Error(_SC("wrong number of parameters"));
+ Raise_Error("wrong number of parameters");
return false;
}
for(SQInteger n = 0; n < nargs - paramssize; n++) {
@@ -355,7 +355,7 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
}
}
else {
- Raise_Error(_SC("wrong number of parameters"));
+ Raise_Error("wrong number of parameters");
return false;
}
}
@@ -392,7 +392,7 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
_top = newtop;
_stackbase = stackbase;
if (type(_debughook) != OT_NULL && _rawval(_debughook) != _rawval(ci->_closure))
- CallDebugHook(_SC('c'));
+ CallDebugHook('c');
return true;
}
@@ -400,7 +400,7 @@ bool SQVM::Return(SQInteger _arg0, SQInteger _arg1, SQObjectPtr &retval)
{
if (type(_debughook) != OT_NULL && _rawval(_debughook) != _rawval(ci->_closure))
for(SQInteger i=0;i<ci->_ncalls;i++)
- CallDebugHook(_SC('r'));
+ CallDebugHook('r');
SQBool broot = ci->_root;
SQInteger last_top = _top;
@@ -466,9 +466,9 @@ bool SQVM::DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjec
SQRESULT SQVM::Suspend()
{
if (_suspended)
- return sq_throwerror(this, _SC("cannot suspend an already suspended vm"));
+ return sq_throwerror(this, "cannot suspend an already suspended vm");
if (_nnativecalls!=2)
- return sq_throwerror(this, _SC("cannot suspend through native calls/metamethods"));
+ return sq_throwerror(this, "cannot suspend through native calls/metamethods");
return SQ_SUSPEND_FLAG;
}
@@ -506,12 +506,12 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
o4 = o2 = itr;
if(type(itr) == OT_NULL) _FINISH(exitpos);
if(!Get(o1, itr, o3, false,false)) {
- Raise_Error(_SC("_nexti returned an invalid idx"));
+ Raise_Error("_nexti returned an invalid idx");
return false;
}
_FINISH(1);
}
- Raise_Error(_SC("_nexti failed"));
+ Raise_Error("_nexti failed");
return false;
}
break;
@@ -528,18 +528,18 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
_FINISH(0);
}
default:
- Raise_Error(_SC("cannot iterate %s"), GetTypeName(o1));
+ Raise_Error("cannot iterate %s", GetTypeName(o1));
}
return false; //cannot be hit(just to avoid warnings)
}
bool SQVM::DELEGATE_OP(SQObjectPtr &trg,SQObjectPtr &o1,SQObjectPtr &o2)
{
- if(type(o1) != OT_TABLE) { Raise_Error(_SC("delegating a '%s'"), GetTypeName(o1)); return false; }
+ if(type(o1) != OT_TABLE) { Raise_Error("delegating a '%s'", GetTypeName(o1)); return false; }
switch(type(o2)) {
case OT_TABLE:
if(!_table(o1)->SetDelegate(_table(o2))){
- Raise_Error(_SC("delegate cycle detected"));
+ Raise_Error("delegate cycle detected");
return false;
}
break;
@@ -547,7 +547,7 @@ bool SQVM::DELEGATE_OP(SQObjectPtr &trg,SQObjectPtr &o1,SQObjectPtr &o2)
_table(o1)->SetDelegate(NULL);
break;
default:
- Raise_Error(_SC("using '%s' as delegate"), GetTypeName(o2));
+ Raise_Error("using '%s' as delegate", GetTypeName(o2));
return false;
break;
}
@@ -599,15 +599,15 @@ bool SQVM::CLOSURE_OP(SQObjectPtr &target, SQFunctionProto *func)
bool SQVM::GETVARGV_OP(SQObjectPtr &target,SQObjectPtr &index,CallInfo *ci)
{
if(ci->_vargs.size == 0) {
- Raise_Error(_SC("the function doesn't have var args"));
+ Raise_Error("the function doesn't have var args");
return false;
}
if(!sq_isnumeric(index)){
- Raise_Error(_SC("indexing 'vargv' with %s"),GetTypeName(index));
+ Raise_Error("indexing 'vargv' with %s",GetTypeName(index));
return false;
}
SQInteger idx = tointeger(index);
- if(idx < 0 || idx >= ci->_vargs.size){ Raise_Error(_SC("vargv index out of range")); return false; }
+ if(idx < 0 || idx >= ci->_vargs.size){ Raise_Error("vargv index out of range"); return false; }
target = _vargsstack[ci->_vargs.base+idx];
return true;
}
@@ -617,7 +617,7 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes
SQClass *base = NULL;
SQObjectPtr attrs;
if(baseclass != -1) {
- if(type(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error(_SC("trying to inherit from a %s"),GetTypeName(_stack._vals[_stackbase+baseclass])); return false; }
+ if(type(_stack._vals[_stackbase+baseclass]) != OT_CLASS) { Raise_Error("trying to inherit from a %s",GetTypeName(_stack._vals[_stackbase+baseclass])); return false; }
base = _class(_stack._vals[_stackbase + baseclass]);
}
if(attributes != MAX_FUNC_STACKSIZE) {
@@ -672,7 +672,7 @@ bool SQVM::GETPARENT_OP(SQObjectPtr &o,SQObjectPtr &target)
case OT_CLASS: target = _class(o)->_base?_class(o)->_base:_null_;
break;
default:
- Raise_Error(_SC("the %s type doesn't have a parent slot"), GetTypeName(o));
+ Raise_Error("the %s type doesn't have a parent slot", GetTypeName(o));
return false;
}
return true;
@@ -680,7 +680,7 @@ bool SQVM::GETPARENT_OP(SQObjectPtr &o,SQObjectPtr &target)
bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQInteger stackbase,SQObjectPtr &outres, SQBool raiseerror,ExecutionType et)
{
- if ((_nnativecalls + 1) > MAX_NATIVE_CALLS) { Raise_Error(_SC("Native stack overflow")); return false; }
+ if ((_nnativecalls + 1) > MAX_NATIVE_CALLS) { Raise_Error("Native stack overflow"); return false; }
_nnativecalls++;
AutoDec ad(&_nnativecalls);
SQInteger traps = 0;
@@ -740,7 +740,7 @@ exception_restore:
{
case _OP_LINE:
if(type(_debughook) != OT_NULL && _rawval(_debughook) != _rawval(ci->_closure))
- CallDebugHook(_SC('l'),arg1);
+ CallDebugHook('l',arg1);
continue;
case _OP_LOAD: TARGET = ci->_literals[arg1]; continue;
case _OP_LOADINT: TARGET = (SQInteger)arg1; continue;
@@ -825,11 +825,11 @@ common_call:
STK(ct_target) = clo;
break;
}
- Raise_Error(_SC("attempt to call '%s'"), GetTypeName(clo));
+ Raise_Error("attempt to call '%s'", GetTypeName(clo));
SQ_THROW();
}
default:
- Raise_Error(_SC("attempt to call '%s'"), GetTypeName(clo));
+ Raise_Error("attempt to call '%s'", GetTypeName(clo));
SQ_THROW();
}
}
@@ -931,7 +931,7 @@ common_call:
case _OP_EXISTS: TARGET = Get(STK(arg1), STK(arg2), temp_reg, true,false)?_true_:_false_;continue;
case _OP_INSTANCEOF:
if(type(STK(arg1)) != OT_CLASS || type(STK(arg2)) != OT_INSTANCE)
- {Raise_Error(_SC("cannot apply instanceof between a %s and a %s"),GetTypeName(STK(arg1)),GetTypeName(STK(arg2))); SQ_THROW();}
+ {Raise_Error("cannot apply instanceof between a %s and a %s",GetTypeName(STK(arg1)),GetTypeName(STK(arg2))); SQ_THROW();}
TARGET = _instance(STK(arg2))->InstanceOf(_class(STK(arg1)))?_true_:_false_;
continue;
case _OP_AND:
@@ -954,7 +954,7 @@ common_call:
TARGET = SQInteger(~t);
continue;
}
- Raise_Error(_SC("attempt to perform a bitwise op on a %s"), GetTypeName(STK(arg1)));
+ Raise_Error("attempt to perform a bitwise op on a %s", GetTypeName(STK(arg1)));
SQ_THROW();
case _OP_CLOSURE: {
SQClosure *c = ci->_closure._unVal.pClosure;
@@ -969,7 +969,7 @@ common_call:
traps -= ci->_etraps;
if(sarg1 != MAX_FUNC_STACKSIZE) STK(arg1) = temp_reg;
}
- else { Raise_Error(_SC("trying to yield a '%s',only genenerator can be yielded"), GetTypeName(ci->_closure)); SQ_THROW();}
+ else { Raise_Error("trying to yield a '%s',only genenerator can be yielded", GetTypeName(ci->_closure)); SQ_THROW();}
if(Return(arg0, arg1, temp_reg)){
assert(traps == 0);
outres = temp_reg;
@@ -979,7 +979,7 @@ common_call:
}
continue;
case _OP_RESUME:
- if(type(STK(arg1)) != OT_GENERATOR){ Raise_Error(_SC("trying to resume a '%s',only genenerator can be resumed"), GetTypeName(STK(arg1))); SQ_THROW();}
+ if(type(STK(arg1)) != OT_GENERATOR){ Raise_Error("trying to resume a '%s',only genenerator can be resumed", GetTypeName(STK(arg1))); SQ_THROW();}
_GUARD(_generator(STK(arg1))->Resume(this, arg0));
traps += ci->_etraps;
continue;
@@ -995,7 +995,7 @@ common_call:
case _OP_DELEGATE: _GUARD(DELEGATE_OP(TARGET,STK(arg1),STK(arg2))); continue;
case _OP_CLONE:
if(!Clone(STK(arg1), TARGET))
- { Raise_Error(_SC("cloning a %s"), GetTypeName(STK(arg1))); SQ_THROW();}
+ { Raise_Error("cloning a %s", GetTypeName(STK(arg1))); SQ_THROW();}
continue;
case _OP_TYPEOF: TypeOf(STK(arg1), TARGET); continue;
case _OP_PUSHTRAP:{
@@ -1121,11 +1121,11 @@ void SQVM::CallDebugHook(SQInteger type,SQInteger forcedline)
bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackbase,SQObjectPtr &retval,bool &suspend)
{
- if (_nnativecalls + 1 > MAX_NATIVE_CALLS) { Raise_Error(_SC("Native stack overflow")); return false; }
+ if (_nnativecalls + 1 > MAX_NATIVE_CALLS) { Raise_Error("Native stack overflow"); return false; }
SQInteger nparamscheck = nclosure->_nparamscheck;
if(((nparamscheck > 0) && (nparamscheck != nargs))
|| ((nparamscheck < 0) && (nargs < (-nparamscheck)))) {
- Raise_Error(_SC("wrong number of parameters"));
+ Raise_Error("wrong number of parameters");
return false;
}
@@ -1333,10 +1333,10 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr
}
break;
case OT_ARRAY:
- if(!sq_isnumeric(key)) {Raise_Error(_SC("indexing %s with %s"),GetTypeName(self),GetTypeName(key)); return false; }
+ if(!sq_isnumeric(key)) {Raise_Error("indexing %s with %s",GetTypeName(self),GetTypeName(key)); return false; }
return _array(self)->Set(tointeger(key),val);
default:
- Raise_Error(_SC("trying to set '%s'"),GetTypeName(self));
+ Raise_Error("trying to set '%s'",GetTypeName(self));
return false;
}
if(fetchroot) {
@@ -1375,7 +1375,7 @@ cloned_mt:
bool SQVM::NewSlot(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr &val,bool bstatic)
{
- if(type(key) == OT_NULL) { Raise_Error(_SC("null cannot be used as index")); return false; }
+ if(type(key) == OT_NULL) { Raise_Error("null cannot be used as index"); return false; }
switch(type(self)) {
case OT_TABLE: {
bool rawcall = true;
@@ -1393,25 +1393,25 @@ bool SQVM::NewSlot(const SQObjectPtr &self,const SQObjectPtr &key,const SQObject
SQObjectPtr res;
Push(self);Push(key);Push(val);
if(!CallMetaMethod(_instance(self),MT_NEWSLOT,3,res)) {
- Raise_Error(_SC("class instances do not support the new slot operator"));
+ Raise_Error("class instances do not support the new slot operator");
return false;
}
break;}
case OT_CLASS:
if(!_class(self)->NewSlot(_ss(this),key,val,bstatic)) {
if(_class(self)->_locked) {
- Raise_Error(_SC("trying to modify a class that has already been instantiated"));
+ Raise_Error("trying to modify a class that has already been instantiated");
return false;
}
else {
SQObjectPtr oval = PrintObjVal(key);
- Raise_Error(_SC("the property '%s' already exists"),_stringval(oval));
+ Raise_Error("the property '%s' already exists",_stringval(oval));
return false;
}
}
break;
default:
- Raise_Error(_SC("indexing %s with %s"),GetTypeName(self),GetTypeName(key));
+ Raise_Error("indexing %s with %s",GetTypeName(self),GetTypeName(key));
return false;
break;
}
@@ -1442,7 +1442,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
}
}
else {
- Raise_Error(_SC("cannot delete a slot from %s"),GetTypeName(self));
+ Raise_Error("cannot delete a slot from %s",GetTypeName(self));
return false;
}
}
@@ -1450,7 +1450,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
}
break;
default:
- Raise_Error(_SC("attempt to delete a slot from a %s"),GetTypeName(self));
+ Raise_Error("attempt to delete a slot from a %s",GetTypeName(self));
return false;
}
return true;
@@ -1554,37 +1554,37 @@ void SQVM::dumpstack(SQInteger stackbase,bool dumpall)
{
SQInteger size=dumpall?_stack.size():_top;
SQInteger n=0;
- scprintf(_SC("\n>>>>stack dump<<<<\n"));
+ scprintf("\n>>>>stack dump<<<<\n");
CallInfo &ci=_callsstack[_callsstacksize-1];
- scprintf(_SC("IP: %p\n"),ci._ip);
- scprintf(_SC("prev stack base: %d\n"),ci._prevstkbase);
- scprintf(_SC("prev top: %d\n"),ci._prevtop);
+ scprintf("IP: %p\n",ci._ip);
+ scprintf("prev stack base: %d\n",ci._prevstkbase);
+ scprintf("prev top: %d\n",ci._prevtop);
for(SQInteger i=0;i<size;i++){
SQObjectPtr &obj=_stack[i];
- if(stackbase==i)scprintf(_SC(">"));else scprintf(_SC(" "));
- scprintf(_SC("[%d]:"),n);
+ if(stackbase==i)scprintf(">");else scprintf(" ");
+ scprintf("[%d]:",n);
switch(type(obj)){
- case OT_FLOAT: scprintf(_SC("FLOAT %.3f"),_float(obj));break;
- case OT_INTEGER: scprintf(_SC("INTEGER %d"),_integer(obj));break;
- case OT_BOOL: scprintf(_SC("BOOL %s"),_integer(obj)?"true":"false");break;
- case OT_STRING: scprintf(_SC("STRING %s"),_stringval(obj));break;
- case OT_NULL: scprintf(_SC("NULL")); break;
- case OT_TABLE: scprintf(_SC("TABLE %p[%p]"),_table(obj),_table(obj)->_delegate);break;
- case OT_ARRAY: scprintf(_SC("ARRAY %p"),_array(obj));break;
- case OT_CLOSURE: scprintf(_SC("CLOSURE [%p]"),_closure(obj));break;
- case OT_NATIVECLOSURE: scprintf(_SC("NATIVECLOSURE"));break;
- case OT_USERDATA: scprintf(_SC("USERDATA %p[%p]"),_userdataval(obj),_userdata(obj)->_delegate);break;
- case OT_GENERATOR: scprintf(_SC("GENERATOR %p"),_generator(obj));break;
- case OT_THREAD: scprintf(_SC("THREAD [%p]"),_thread(obj));break;
- case OT_USERPOINTER: scprintf(_SC("USERPOINTER %p"),_userpointer(obj));break;
- case OT_CLASS: scprintf(_SC("CLASS %p"),_class(obj));break;
- case OT_INSTANCE: scprintf(_SC("INSTANCE %p"),_instance(obj));break;
- case OT_WEAKREF: scprintf(_SC("WEAKERF %p"),_weakref(obj));break;
+ case OT_FLOAT: scprintf("FLOAT %.3f",_float(obj));break;
+ case OT_INTEGER: scprintf("INTEGER %d",_integer(obj));break;
+ case OT_BOOL: scprintf("BOOL %s",_integer(obj)?"true":"false");break;
+ case OT_STRING: scprintf("STRING %s",_stringval(obj));break;
+ case OT_NULL: scprintf("NULL"); break;
+ case OT_TABLE: scprintf("TABLE %p[%p]",_table(obj),_table(obj)->_delegate);break;
+ case OT_ARRAY: scprintf("ARRAY %p",_array(obj));break;
+ case OT_CLOSURE: scprintf("CLOSURE [%p]",_closure(obj));break;
+ case OT_NATIVECLOSURE: scprintf("NATIVECLOSURE");break;
+ case OT_USERDATA: scprintf("USERDATA %p[%p]",_userdataval(obj),_userdata(obj)->_delegate);break;
+ case OT_GENERATOR: scprintf("GENERATOR %p",_generator(obj));break;
+ case OT_THREAD: scprintf("THREAD [%p]",_thread(obj));break;
+ case OT_USERPOINTER: scprintf("USERPOINTER %p",_userpointer(obj));break;
+ case OT_CLASS: scprintf("CLASS %p",_class(obj));break;
+ case OT_INSTANCE: scprintf("INSTANCE %p",_instance(obj));break;
+ case OT_WEAKREF: scprintf("WEAKERF %p",_weakref(obj));break;
default:
assert(0);
break;
};
- scprintf(_SC("\n"));
+ scprintf("\n");
++n;
}
}
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h
index d272d152e..89a592e13 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.h
+++ b/src/3rdparty/squirrel/squirrel/sqvm.h
@@ -203,7 +203,7 @@ inline SQObjectPtr &stack_get(HSQUIRRELVM v,SQInteger idx){return ((idx>=0)?(v->
if(v->_callsstacksize == v->_alloccallsstacksize) { \
if (v->_callsstacksize > 65535 && !v->_in_stackoverflow) {\
v->_in_stackoverflow = true; \
- v->Raise_Error(_SC("stack overflow"));\
+ v->Raise_Error("stack overflow");\
v->CallErrorHandler(v->_lasterror);\
return false;\
}\
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index e048a5457..017a168f4 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -65,7 +65,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
{
/* Get the AIInfo */
SQUserPointer instance = NULL;
- if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == NULL) return sq_throwerror(vm, _SC("Pass an instance of a child class of AIInfo to RegisterAI"));
+ if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == NULL) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI");
AIInfo *info = (AIInfo *)instance;
SQInteger res = ScriptInfo::Constructor(vm, info);
diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp
index e6ec3657b..e0a6027fc 100644
--- a/src/game/game_info.cpp
+++ b/src/game/game_info.cpp
@@ -55,7 +55,7 @@ template <> const char *GetClassName<GameInfo, ST_GS>() { return "GSInfo"; }
{
/* Get the GameInfo */
SQUserPointer instance = NULL;
- if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == NULL) return sq_throwerror(vm, _SC("Pass an instance of a child class of GameInfo to RegisterGame"));
+ if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == NULL) return sq_throwerror(vm, "Pass an instance of a child class of GameInfo to RegisterGame");
GameInfo *info = (GameInfo *)instance;
SQInteger res = ScriptInfo::Constructor(vm, info);
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp
index 691577cbd..42ced2008 100644
--- a/src/game/game_text.cpp
+++ b/src/game/game_text.cpp
@@ -356,7 +356,7 @@ void RegisterGameTranslation(Squirrel *engine)
HSQUIRRELVM vm = engine->GetVM();
sq_pushroottable(vm);
- sq_pushstring(vm, _SC("GSText"), -1);
+ sq_pushstring(vm, "GSText", -1);
if (SQ_FAILED(sq_get(vm, -2))) return;
int idx = 0;
diff --git a/src/script/api/script_admin.cpp b/src/script/api/script_admin.cpp
index f6c41387b..f66d9fc8a 100644
--- a/src/script/api/script_admin.cpp
+++ b/src/script/api/script_admin.cpp
@@ -126,10 +126,10 @@
/* static */ SQInteger ScriptAdmin::Send(HSQUIRRELVM vm)
{
- if (sq_gettop(vm) - 1 != 1) return sq_throwerror(vm, _SC("wrong number of parameters"));
+ if (sq_gettop(vm) - 1 != 1) return sq_throwerror(vm, "wrong number of parameters");
if (sq_gettype(vm, 2) != OT_TABLE) {
- return sq_throwerror(vm, _SC("ScriptAdmin::Send requires a table as first parameter. No data sent."));
+ return sq_throwerror(vm, "ScriptAdmin::Send requires a table as first parameter. No data sent.");
}
std::string json;
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index aca645c05..a42c8ede9 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -161,7 +161,7 @@ ScriptController::~ScriptController()
sq_pushroottable(vm);
sq_pushstring(vm, fake_class, -1);
if (SQ_FAILED(sq_get(vm, -2))) {
- throw sq_throwerror(vm, _SC("internal error assigning library class"));
+ throw sq_throwerror(vm, "internal error assigning library class");
}
sq_pushstring(vm, lib->GetInstanceName(), -1);
if (SQ_FAILED(sq_get(vm, -2))) {
diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp
index a185e0d89..cd605a509 100644
--- a/src/script/api/script_list.cpp
+++ b/src/script/api/script_list.cpp
@@ -758,7 +758,7 @@ SQInteger ScriptList::_set(HSQUIRRELVM vm)
{
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
if (sq_gettype(vm, 3) != OT_INTEGER && sq_gettype(vm, 3) != OT_NULL) {
- return sq_throwerror(vm, _SC("you can only assign integers to this list"));
+ return sq_throwerror(vm, "you can only assign integers to this list");
}
SQInteger idx, val;
@@ -810,7 +810,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
int nparam = sq_gettop(vm) - 1;
if (nparam < 1) {
- return sq_throwerror(vm, _SC("You need to give a least a Valuator as parameter to ScriptList::Valuate"));
+ return sq_throwerror(vm, "You need to give a least a Valuator as parameter to ScriptList::Valuate");
}
/* Make sure the valuator function is really a function, and not any
@@ -818,7 +818,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
* first parameter they give. */
SQObjectType valuator_type = sq_gettype(vm, 2);
if (valuator_type != OT_CLOSURE && valuator_type != OT_NATIVECLOSURE) {
- return sq_throwerror(vm, _SC("parameter 1 has an invalid type (expected function)"));
+ return sq_throwerror(vm, "parameter 1 has an invalid type (expected function)");
}
/* Don't allow docommand from a Valuator, as we can't resume in
@@ -867,7 +867,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
sq_pop(vm, nparam + 4);
ScriptObject::SetAllowDoCommand(backup_allow);
- return sq_throwerror(vm, _SC("return value of valuator is not valid (not integer/bool)"));
+ return sq_throwerror(vm, "return value of valuator is not valid (not integer/bool)");
}
}
@@ -877,7 +877,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
sq_pop(vm, nparam + 4);
ScriptObject::SetAllowDoCommand(backup_allow);
- return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function"));
+ return sq_throwerror(vm, "modifying valuated list outside of valuator function");
}
this->SetValue((*iter).first, value);
diff --git a/src/script/api/script_text.cpp b/src/script/api/script_text.cpp
index 0c2c0516b..51fc19863 100644
--- a/src/script/api/script_text.cpp
+++ b/src/script/api/script_text.cpp
@@ -34,13 +34,13 @@ ScriptText::ScriptText(HSQUIRRELVM vm) :
{
int nparam = sq_gettop(vm) - 1;
if (nparam < 1) {
- throw sq_throwerror(vm, _SC("You need to pass at least a StringID to the constructor"));
+ throw sq_throwerror(vm, "You need to pass at least a StringID to the constructor");
}
/* First resolve the StringID. */
SQInteger sqstring;
if (SQ_FAILED(sq_getinteger(vm, 2, &sqstring))) {
- throw sq_throwerror(vm, _SC("First argument must be a valid StringID"));
+ throw sq_throwerror(vm, "First argument must be a valid StringID");
}
this->string = sqstring;
@@ -51,7 +51,7 @@ ScriptText::ScriptText(HSQUIRRELVM vm) :
if (SQ_FAILED(this->_SetParam(i, vm))) {
this->~ScriptText();
- throw sq_throwerror(vm, _SC("Invalid parameter"));
+ throw sq_throwerror(vm, "Invalid parameter");
}
/* Pop the parameter again. */
@@ -104,7 +104,7 @@ SQInteger ScriptText::_SetParam(int parameter, HSQUIRRELVM vm)
/* Validate if it is a GSText instance */
sq_pushroottable(vm);
- sq_pushstring(vm, _SC("GSText"), -1);
+ sq_pushstring(vm, "GSText", -1);
sq_get(vm, -2);
sq_pushobject(vm, instance);
if (sq_instanceof(vm) != SQTrue) return SQ_ERROR;
diff --git a/src/script/script_info_dummy.cpp b/src/script/script_info_dummy.cpp
index 79190c82d..049e59342 100644
--- a/src/script/script_info_dummy.cpp
+++ b/src/script/script_info_dummy.cpp
@@ -46,7 +46,7 @@ void Script_CreateDummyInfo(HSQUIRRELVM vm, const char *type, const char *dir)
sq_pushroottable(vm);
/* Load and run the script */
- if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), _SC("dummy"), SQTrue))) {
+ if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), "dummy", SQTrue))) {
sq_push(vm, -2);
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
sq_pop(vm, 1);
@@ -101,7 +101,7 @@ void Script_CreateDummy(HSQUIRRELVM vm, StringID string, const char *type)
/* And finally we load and run the script */
sq_pushroottable(vm);
- if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), _SC("dummy"), SQTrue))) {
+ if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), "dummy", SQTrue))) {
sq_push(vm, -2);
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
sq_pop(vm, 1);
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index 44ae52348..dc71d1ef4 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -56,7 +56,7 @@ void Squirrel::ErrorPrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
/* Check if we have a custom print function */
SQPrintFunc *func = ((Squirrel *)sq_getforeignptr(vm))->print_func;
if (func == NULL) {
- scfprintf(stderr, _SC("%s"), buf);
+ scfprintf(stderr, "%s", buf);
} else {
(*func)(true, buf);
}
@@ -74,7 +74,7 @@ void Squirrel::RunError(HSQUIRRELVM vm, const SQChar *error)
Squirrel *engine = (Squirrel *)sq_getforeignptr(vm);
SQPrintFunc *func = engine->print_func;
if (func == NULL) {
- scfprintf(stderr, _SC("%s"), buf);
+ scfprintf(stderr, "%s", buf);
} else {
(*func)(true, buf);
}
@@ -96,7 +96,7 @@ SQInteger Squirrel::_RunError(HSQUIRRELVM vm)
}
}
- Squirrel::RunError(vm, _SC("unknown error"));
+ Squirrel::RunError(vm, "unknown error");
return 0;
}
@@ -108,12 +108,12 @@ void Squirrel::PrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
va_start(arglist, s);
scvsnprintf(buf, lengthof(buf) - 2, s, arglist);
va_end(arglist);
- scstrcat(buf, _SC("\n"));
+ scstrcat(buf, "\n");
/* Check if we have a custom print function */
SQPrintFunc *func = ((Squirrel *)sq_getforeignptr(vm))->print_func;
if (func == NULL) {
- scprintf(_SC("%s"), buf);
+ scprintf("%s", buf);
} else {
(*func)(false, buf);
}
@@ -478,14 +478,14 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
case SQ_BYTECODE_STREAM_TAG: { // BYTECODE
if (fseek(file, -2, SEEK_CUR) < 0) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("cannot seek the file"));
+ return sq_throwerror(vm, "cannot seek the file");
}
if (SQ_SUCCEEDED(sq_readclosure(vm, _io_file_read, &f))) {
FioFCloseFile(file);
return SQ_OK;
}
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("Couldn't read bytecode"));
+ return sq_throwerror(vm, "Couldn't read bytecode");
}
case 0xFFFE:
/* Either this file is encoded as big-endian and we're on a little-endian
@@ -498,11 +498,11 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
case 0xEFBB: // UTF-8 on big-endian machine
if (fread(&uc, 1, sizeof(uc), file) == 0) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("I/O error"));
+ return sq_throwerror(vm, "I/O error");
}
if (uc != 0xBF) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("Unrecognized encoding"));
+ return sq_throwerror(vm, "Unrecognized encoding");
}
func = _io_file_lexfeed_UTF8;
break;
@@ -510,7 +510,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
func = _io_file_lexfeed_ASCII;
if (fseek(file, -2, SEEK_CUR) < 0) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("cannot seek the file"));
+ return sq_throwerror(vm, "cannot seek the file");
}
break;
}
@@ -522,7 +522,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
FioFCloseFile(file);
return SQ_ERROR;
}
- return sq_throwerror(vm, _SC("cannot open the file"));
+ return sq_throwerror(vm, "cannot open the file");
}
bool Squirrel::LoadScript(HSQUIRRELVM vm, const char *script, bool in_root)
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp
index 7a4bf7e08..22d738d4f 100644
--- a/src/script/squirrel_helper.hpp
+++ b/src/script/squirrel_helper.hpp
@@ -125,7 +125,7 @@ namespace SQConvert {
template <> inline Array *GetParam(ForceType<Array *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
{
/* Sanity check of the size. */
- if (sq_getsize(vm, index) > UINT16_MAX) throw sq_throwerror(vm, _SC("an array used as parameter to a function is too large"));
+ if (sq_getsize(vm, index) > UINT16_MAX) throw sq_throwerror(vm, "an array used as parameter to a function is too large");
SQObject obj;
sq_getstackobj(vm, index, &obj);
@@ -140,7 +140,7 @@ namespace SQConvert {
*data.Append() = (int32)tmp;
} else {
sq_pop(vm, 4);
- throw sq_throwerror(vm, _SC("a member of an array used as parameter to a function is not numeric"));
+ throw sq_throwerror(vm, "a member of an array used as parameter to a function is not numeric");
}
sq_pop(vm, 2);
@@ -752,14 +752,14 @@ namespace SQConvert {
sq_pushstring(vm, className, -1);
sq_get(vm, -2);
sq_pushobject(vm, instance);
- if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static"));
+ if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static");
sq_pop(vm, 3);
/* Get the 'real' instance of this class */
sq_getinstanceup(vm, 1, &real_instance, 0);
/* Get the real function pointer */
sq_getuserdata(vm, nparam, &ptr, 0);
- if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));
+ if (real_instance == NULL) return sq_throwerror(vm, "couldn't detect real instance of class for non-static call");
/* Remove the userdata from the stack */
sq_pop(vm, 1);
@@ -794,14 +794,14 @@ namespace SQConvert {
sq_pushstring(vm, className, -1);
sq_get(vm, -2);
sq_pushobject(vm, instance);
- if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static"));
+ if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static");
sq_pop(vm, 3);
/* Get the 'real' instance of this class */
sq_getinstanceup(vm, 1, &real_instance, 0);
/* Get the real function pointer */
sq_getuserdata(vm, nparam, &ptr, 0);
- if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));
+ if (real_instance == NULL) return sq_throwerror(vm, "couldn't detect real instance of class for non-static call");
/* Remove the userdata from the stack */
sq_pop(vm, 1);