1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 20:27:13 +01:00

Backport Squirrel changes.

This commit is contained in:
Sandu Liviu Catalin 2020-03-20 20:50:17 +02:00
parent 60c53a5d0e
commit 8da1d76453
4 changed files with 18 additions and 4 deletions

View File

@ -181,7 +181,7 @@ static SQInteger _string_printf(HSQUIRRELVM v)
return -1;
SQPRINTFUNCTION printfunc = sq_getprintfunc(v);
if(printfunc) printfunc(v,dest);
if(printfunc) printfunc(v,_SC("%s"),dest);
return 0;
}

View File

@ -19,6 +19,10 @@
#define scremove remove
#define screname rename
#endif
#ifdef IOS
#include <spawn.h>
extern char **environ;
#endif
static SQInteger _system_getenv(HSQUIRRELVM v)
{
@ -35,7 +39,13 @@ static SQInteger _system_system(HSQUIRRELVM v)
{
const SQChar *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));
#endif
return 1;
}
return sq_throwerror(v,_SC("wrong param"));

View File

@ -635,7 +635,7 @@ public:
}
break;
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(']'));
pos = -1;
if(_es.etype==BASE) {

View File

@ -296,6 +296,9 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
case OT_BOOL:
scsprintf(_sp(sq_rsl(6)),sq_rsl(6),_integer(o)?_SC("true"):_SC("false"));
break;
case OT_NULL:
scsprintf(_sp(sq_rsl(5)),sq_rsl(5),_SC("null"));
break;
case OT_TABLE:
case OT_USERDATA:
case OT_INSTANCE:
@ -668,7 +671,7 @@ bool SQVM::IsFalse(SQObjectPtr &o)
#if !defined(SQUSEDOUBLE) || (defined(SQUSEDOUBLE) && defined(_SQ64))
|| (_integer(o) == 0) ) //OT_NULL|OT_INTEGER|OT_BOOL
#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
{
return true;
@ -1602,6 +1605,7 @@ SQInteger prevstackbase = _stackbase;
}
break;
default:
Raise_Error(_SC("attempt to call '%s'"), GetTypeName(closure));
return false;
}
#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_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_WEAKREF: scprintf(_SC("WEAKREF %p"),_weakref(obj));break;
default:
assert(0);
break;