mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Update squirrel to the latest version straight from the official repository.
This commit is contained in:
parent
cdfc3f58bc
commit
033150b4f1
2
external/Squirrel/Lib/sqstdblob.cpp
vendored
2
external/Squirrel/Lib/sqstdblob.cpp
vendored
@ -7,7 +7,7 @@
|
||||
#include "sqstdstream.h"
|
||||
#include "sqstdblobimpl.h"
|
||||
|
||||
#define SQSTD_BLOB_TYPE_TAG (SQSTD_STREAM_TYPE_TAG | 0x00000002)
|
||||
#define SQSTD_BLOB_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000002))
|
||||
|
||||
//Blob
|
||||
|
||||
|
4
external/Squirrel/Lib/sqstdio.cpp
vendored
4
external/Squirrel/Lib/sqstdio.cpp
vendored
@ -5,7 +5,7 @@
|
||||
#include <sqstdio.h>
|
||||
#include "sqstdstream.h"
|
||||
|
||||
#define SQSTD_FILE_TYPE_TAG (SQSTD_STREAM_TYPE_TAG | 0x00000001)
|
||||
#define SQSTD_FILE_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000001))
|
||||
//basic API
|
||||
SQFILE sqstd_fopen(const SQChar *filename ,const SQChar *mode)
|
||||
{
|
||||
@ -401,7 +401,7 @@ SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool
|
||||
{
|
||||
//at least one entry must exist in order for us to push it as the environment
|
||||
if(sq_gettop(v) == 0)
|
||||
return sq_throwerror(v,_SC("environment table expected"));
|
||||
return sq_throwerror(v,_SC("environment table expected"));
|
||||
|
||||
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,printerror))) {
|
||||
sq_push(v,-2);
|
||||
|
6
external/Squirrel/Lib/sqstdrex.cpp
vendored
6
external/Squirrel/Lib/sqstdrex.cpp
vendored
@ -155,7 +155,7 @@ static SQInteger sqstd_rex_charnode(SQRex *exp,SQBool isclass)
|
||||
}
|
||||
case 0:
|
||||
sqstd_rex_error(exp,_SC("letter expected for argument of escape sequence"));
|
||||
break;
|
||||
break;
|
||||
case 'b':
|
||||
case 'B':
|
||||
if(!isclass) {
|
||||
@ -578,9 +578,9 @@ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error)
|
||||
scprintf(_SC("\n"));
|
||||
for(i = 0;i < nsize; i++) {
|
||||
if(exp->_nodes[i].type>MAX_CHAR)
|
||||
scprintf(_SC("[%02d] %10s "),i,g_nnames[exp->_nodes[i].type-MAX_CHAR]);
|
||||
scprintf(_SC("[%02d] %10s "), (SQInt32)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]);
|
||||
else
|
||||
scprintf(_SC("[%02d] %10c "),i,exp->_nodes[i].type);
|
||||
scprintf(_SC("[%02d] %10c "), (SQInt32)i,exp->_nodes[i].type);
|
||||
scprintf(_SC("left %02d right %02d next %02d\n"), (SQInt32)exp->_nodes[i].left, (SQInt32)exp->_nodes[i].right, (SQInt32)exp->_nodes[i].next);
|
||||
}
|
||||
scprintf(_SC("\n"));
|
||||
|
4
external/Squirrel/Lib/sqstdstream.cpp
vendored
4
external/Squirrel/Lib/sqstdstream.cpp
vendored
@ -11,7 +11,7 @@
|
||||
|
||||
#define SETUP_STREAM(v) \
|
||||
SQStream *self = NULL; \
|
||||
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_STREAM_TYPE_TAG))) \
|
||||
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG)))) \
|
||||
return sq_throwerror(v,_SC("invalid type tag")); \
|
||||
if(!self || !self->IsValid()) \
|
||||
return sq_throwerror(v,_SC("the stream is invalid"));
|
||||
@ -259,7 +259,7 @@ void init_streamclass(HSQUIRRELVM v)
|
||||
if(SQ_FAILED(sq_get(v,-2))) {
|
||||
sq_pushstring(v,_SC("std_stream"),-1);
|
||||
sq_newclass(v,SQFalse);
|
||||
sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG);
|
||||
sq_settypetag(v,-1,(SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG));
|
||||
SQInteger i = 0;
|
||||
while(_stream_methods[i].name != 0) {
|
||||
const SQRegFunction &f = _stream_methods[i];
|
||||
|
2
external/Squirrel/Lib/sqstdstring.cpp
vendored
2
external/Squirrel/Lib/sqstdstring.cpp
vendored
@ -159,7 +159,7 @@ static SQInteger _string_printf(HSQUIRRELVM v)
|
||||
SQInteger length = 0;
|
||||
if(SQ_FAILED(sqstd_format(v,2,&length,&dest)))
|
||||
return -1;
|
||||
|
||||
|
||||
SQPRINTFUNCTION printfunc = sq_getprintfunc(v);
|
||||
if(printfunc) printfunc(v,dest);
|
||||
|
||||
|
11
external/Squirrel/sqapi.cpp
vendored
11
external/Squirrel/sqapi.cpp
vendored
@ -776,8 +776,8 @@ SQRESULT sq_getobjtypetag(const HSQOBJECT *o,SQUserPointer * typetag)
|
||||
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"));
|
||||
if (SQ_FAILED(sq_getobjtypetag(&o, typetag)))
|
||||
return SQ_ERROR;// this is not an error it should be a bool but would break backward compatibility
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
@ -971,8 +971,11 @@ 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, _SC("delagate cycle"));
|
||||
}
|
||||
v->Pop();
|
||||
}
|
||||
else if(type(mt)==OT_NULL) {
|
||||
_table(self)->SetDelegate(NULL); v->Pop(); }
|
||||
else return sq_aux_invalidtype(v,type);
|
||||
|
3
external/Squirrel/sqcompiler.cpp
vendored
3
external/Squirrel/sqcompiler.cpp
vendored
@ -466,6 +466,7 @@ public:
|
||||
INVOKE_EXP(f);
|
||||
SQInteger op1 = _fs->PopTarget();SQInteger op2 = _fs->PopTarget();
|
||||
_fs->AddInstruction(op, _fs->PushTarget(), op1, op2, op3);
|
||||
_es.etype = EXPR;
|
||||
}
|
||||
void LogicalOrExp()
|
||||
{
|
||||
@ -482,6 +483,7 @@ public:
|
||||
if(trg != second_exp) _fs->AddInstruction(_OP_MOVE, trg, second_exp);
|
||||
_fs->SnoozeOpt();
|
||||
_fs->SetIntructionParam(jpos, 1, (_fs->GetCurrentPos() - jpos));
|
||||
_es.etype = EXPR;
|
||||
break;
|
||||
}else return;
|
||||
}
|
||||
@ -501,6 +503,7 @@ public:
|
||||
if(trg != second_exp) _fs->AddInstruction(_OP_MOVE, trg, second_exp);
|
||||
_fs->SnoozeOpt();
|
||||
_fs->SetIntructionParam(jpos, 1, (_fs->GetCurrentPos() - jpos));
|
||||
_es.etype = EXPR;
|
||||
break;
|
||||
}
|
||||
|
||||
|
2
external/Squirrel/sqdebug.cpp
vendored
2
external/Squirrel/sqdebug.cpp
vendored
@ -107,7 +107,7 @@ void SQVM::Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger ty
|
||||
SQInteger found = 0;
|
||||
for(SQInteger i=0; i<16; i++)
|
||||
{
|
||||
SQInteger mask = 0x00000001 << i;
|
||||
SQInteger mask = ((SQInteger)1) << i;
|
||||
if(typemask & (mask)) {
|
||||
if(found>0) StringCat(exptypes,SQString::Create(_ss(this), _SC("|"), -1), exptypes);
|
||||
found ++;
|
||||
|
20
external/Squirrel/sqfuncstate.cpp
vendored
20
external/Squirrel/sqfuncstate.cpp
vendored
@ -117,8 +117,8 @@ 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("SQInstruction sizeof %d\n"),(SQInt32)sizeof(SQInstruction));
|
||||
scprintf(_SC("SQObject sizeof %d\n"), (SQInt32)sizeof(SQObject));
|
||||
scprintf(_SC("--------------------------------------------------------------------\n"));
|
||||
scprintf(_SC("*****FUNCTION [%s]\n"),type(func->_name)==OT_STRING?_stringval(func->_name):_SC("unknown"));
|
||||
scprintf(_SC("-----LITERALS\n"));
|
||||
@ -131,7 +131,7 @@ void SQFuncState::Dump(SQFunctionProto *func)
|
||||
templiterals[_integer(val)]=key;
|
||||
}
|
||||
for(i=0;i<templiterals.size();i++){
|
||||
scprintf(_SC("[%d] "),n);
|
||||
scprintf(_SC("[%d] "), (SQInt32)n);
|
||||
DumpLiteral(templiterals[i]);
|
||||
scprintf(_SC("\n"));
|
||||
n++;
|
||||
@ -141,7 +141,7 @@ void SQFuncState::Dump(SQFunctionProto *func)
|
||||
scprintf(_SC("<<VARPARAMS>>\n"));
|
||||
n=0;
|
||||
for(i=0;i<_parameters.size();i++){
|
||||
scprintf(_SC("[%d] "),n);
|
||||
scprintf(_SC("[%d] "), (SQInt32)n);
|
||||
DumpLiteral(_parameters[i]);
|
||||
scprintf(_SC("\n"));
|
||||
n++;
|
||||
@ -149,13 +149,13 @@ void SQFuncState::Dump(SQFunctionProto *func)
|
||||
scprintf(_SC("-----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(_SC("[%d] %s \t%d %d\n"), (SQInt32)lvi._pos,_stringval(lvi._name), (SQInt32)lvi._start_op, (SQInt32)lvi._end_op);
|
||||
n++;
|
||||
}
|
||||
scprintf(_SC("-----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(_SC("op [%d] line [%d] \n"), (SQInt32)li._op, (SQInt32)li._line);
|
||||
n++;
|
||||
}
|
||||
scprintf(_SC("-----dump\n"));
|
||||
@ -165,7 +165,7 @@ void SQFuncState::Dump(SQFunctionProto *func)
|
||||
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(_SC("[%03d] %15s %d "), (SQInt32)n,g_InstrDesc[inst.op].name,inst._arg0);
|
||||
if(lidx >= 0xFFFFFFFF)
|
||||
scprintf(_SC("null"));
|
||||
else {
|
||||
@ -196,18 +196,18 @@ void SQFuncState::Dump(SQFunctionProto *func)
|
||||
}
|
||||
}
|
||||
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(_SC("[%03d] %15s %d %f %d %d\n"), (SQInt32)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);
|
||||
}*/
|
||||
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(_SC("[%03d] %15s %d %d %d %d\n"), (SQInt32)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("stack size[%d]\n"), (SQInt32)func->_stacksize);
|
||||
scprintf(_SC("--------------------------------------------------------------------\n\n"));
|
||||
}
|
||||
#endif
|
||||
|
2
external/Squirrel/sqlexer.cpp
vendored
2
external/Squirrel/sqlexer.cpp
vendored
@ -68,7 +68,7 @@ void SQLexer::Init(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up,Compile
|
||||
ADD_KEYWORD(__LINE__,TK___LINE__);
|
||||
ADD_KEYWORD(__FILE__,TK___FILE__);
|
||||
ADD_KEYWORD(rawcall, TK_RAWCALL);
|
||||
|
||||
|
||||
|
||||
_readf = rg;
|
||||
_up = up;
|
||||
|
10
external/Squirrel/sqvm.cpp
vendored
10
external/Squirrel/sqvm.cpp
vendored
@ -726,9 +726,13 @@ exception_restore:
|
||||
if (type(t) == OT_CLOSURE
|
||||
&& (!_closure(t)->_function->_bgenerator)){
|
||||
SQObjectPtr clo = t;
|
||||
SQInteger last_top = _top;
|
||||
if(_openouters) CloseOuters(&(_stack._vals[_stackbase]));
|
||||
for (SQInteger i = 0; i < arg3; i++) STK(i) = STK(arg2 + i);
|
||||
_GUARD(StartCall(_closure(clo), ci->_target, arg3, _stackbase, true));
|
||||
if (last_top >= _top) {
|
||||
_top = last_top;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1093,7 +1097,6 @@ exception_trap:
|
||||
return false;
|
||||
}
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SQVM::CreateClassInstance(SQClass *theclass, SQObjectPtr &inst, SQObjectPtr &constructor)
|
||||
@ -1331,6 +1334,7 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OT_USERDATA: break; // must fall back
|
||||
default:
|
||||
Raise_Error(_SC("trying to set '%s'"),GetTypeName(self));
|
||||
return false;
|
||||
@ -1718,10 +1722,10 @@ void SQVM::dumpstack(SQInteger stackbase,bool dumpall)
|
||||
for(SQInteger i=0;i<size;i++){
|
||||
SQObjectPtr &obj=_stack[i];
|
||||
if(stackbase==i)scprintf(_SC(">"));else scprintf(_SC(" "));
|
||||
scprintf(_SC("[%d]:"),n);
|
||||
scprintf(_SC("[" _PRINT_INT_FMT "]:"),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_INTEGER: scprintf(_SC("INTEGER " _PRINT_INT_FMT),_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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user