mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-22 04:37:13 +01:00
Backport Squirrel changes.
This commit is contained in:
parent
60c53a5d0e
commit
8da1d76453
2
external/Squirrel/Lib/sqstdstring.cpp
vendored
2
external/Squirrel/Lib/sqstdstring.cpp
vendored
@ -181,7 +181,7 @@ static SQInteger _string_printf(HSQUIRRELVM v)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
SQPRINTFUNCTION printfunc = sq_getprintfunc(v);
|
SQPRINTFUNCTION printfunc = sq_getprintfunc(v);
|
||||||
if(printfunc) printfunc(v,dest);
|
if(printfunc) printfunc(v,_SC("%s"),dest);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
10
external/Squirrel/Lib/sqstdsystem.cpp
vendored
10
external/Squirrel/Lib/sqstdsystem.cpp
vendored
@ -19,6 +19,10 @@
|
|||||||
#define scremove remove
|
#define scremove remove
|
||||||
#define screname rename
|
#define screname rename
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IOS
|
||||||
|
#include <spawn.h>
|
||||||
|
extern char **environ;
|
||||||
|
#endif
|
||||||
|
|
||||||
static SQInteger _system_getenv(HSQUIRRELVM v)
|
static SQInteger _system_getenv(HSQUIRRELVM v)
|
||||||
{
|
{
|
||||||
@ -35,7 +39,13 @@ static SQInteger _system_system(HSQUIRRELVM v)
|
|||||||
{
|
{
|
||||||
const SQChar *s;
|
const SQChar *s;
|
||||||
if(SQ_SUCCEEDED(sq_getstring(v,2,&s))){
|
if(SQ_SUCCEEDED(sq_getstring(v,2,&s))){
|
||||||
|
#ifdef IOS
|
||||||
|
pid_t pid;
|
||||||
|
posix_spawn(&pid, s, NULL, NULL, NULL, environ);
|
||||||
|
sq_pushinteger(v, 0);
|
||||||
|
#else
|
||||||
sq_pushinteger(v,scsystem(s));
|
sq_pushinteger(v,scsystem(s));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return sq_throwerror(v,_SC("wrong param"));
|
return sq_throwerror(v,_SC("wrong param"));
|
||||||
|
2
external/Squirrel/sqcompiler.cpp
vendored
2
external/Squirrel/sqcompiler.cpp
vendored
@ -635,7 +635,7 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _SC('['):
|
case _SC('['):
|
||||||
if(_lex._prevtoken == _SC('\n')) Error(_SC("cannot brake deref/or comma needed after [exp]=exp slot declaration"));
|
if(_lex._prevtoken == _SC('\n')) Error(_SC("cannot break deref/or comma needed after [exp]=exp slot declaration"));
|
||||||
Lex(); Expression(); Expect(_SC(']'));
|
Lex(); Expression(); Expect(_SC(']'));
|
||||||
pos = -1;
|
pos = -1;
|
||||||
if(_es.etype==BASE) {
|
if(_es.etype==BASE) {
|
||||||
|
8
external/Squirrel/sqvm.cpp
vendored
8
external/Squirrel/sqvm.cpp
vendored
@ -296,6 +296,9 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
|
|||||||
case OT_BOOL:
|
case OT_BOOL:
|
||||||
scsprintf(_sp(sq_rsl(6)),sq_rsl(6),_integer(o)?_SC("true"):_SC("false"));
|
scsprintf(_sp(sq_rsl(6)),sq_rsl(6),_integer(o)?_SC("true"):_SC("false"));
|
||||||
break;
|
break;
|
||||||
|
case OT_NULL:
|
||||||
|
scsprintf(_sp(sq_rsl(5)),sq_rsl(5),_SC("null"));
|
||||||
|
break;
|
||||||
case OT_TABLE:
|
case OT_TABLE:
|
||||||
case OT_USERDATA:
|
case OT_USERDATA:
|
||||||
case OT_INSTANCE:
|
case OT_INSTANCE:
|
||||||
@ -668,7 +671,7 @@ bool SQVM::IsFalse(SQObjectPtr &o)
|
|||||||
#if !defined(SQUSEDOUBLE) || (defined(SQUSEDOUBLE) && defined(_SQ64))
|
#if !defined(SQUSEDOUBLE) || (defined(SQUSEDOUBLE) && defined(_SQ64))
|
||||||
|| (_integer(o) == 0) ) //OT_NULL|OT_INTEGER|OT_BOOL
|
|| (_integer(o) == 0) ) //OT_NULL|OT_INTEGER|OT_BOOL
|
||||||
#else
|
#else
|
||||||
|| (((type(o) != OT_FLOAT) && (_integer(o) == 0))) ) //OT_NULL|OT_INTEGER|OT_BOOL
|
|| (((sq_type(o) != OT_FLOAT) && (_integer(o) == 0))) ) //OT_NULL|OT_INTEGER|OT_BOOL
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -1602,6 +1605,7 @@ SQInteger prevstackbase = _stackbase;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Raise_Error(_SC("attempt to call '%s'"), GetTypeName(closure));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -1772,7 +1776,7 @@ void SQVM::dumpstack(SQInteger stackbase,bool dumpall)
|
|||||||
case OT_USERPOINTER: scprintf(_SC("USERPOINTER %p"),_userpointer(obj));break;
|
case OT_USERPOINTER: scprintf(_SC("USERPOINTER %p"),_userpointer(obj));break;
|
||||||
case OT_CLASS: scprintf(_SC("CLASS %p"),_class(obj));break;
|
case OT_CLASS: scprintf(_SC("CLASS %p"),_class(obj));break;
|
||||||
case OT_INSTANCE: scprintf(_SC("INSTANCE %p"),_instance(obj));break;
|
case OT_INSTANCE: scprintf(_SC("INSTANCE %p"),_instance(obj));break;
|
||||||
case OT_WEAKREF: scprintf(_SC("WEAKERF %p"),_weakref(obj));break;
|
case OT_WEAKREF: scprintf(_SC("WEAKREF %p"),_weakref(obj));break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user