/* see copyright notice in squirrel.h */
#include <squirrel.h>
#include <sqstdaux.h>
+#include <assert.h>
void sqstd_printcallstack(HSQUIRRELVM v)
{
SQInteger i;
SQFloat f;
const SQChar *s;
- int level=1; //1 is to skip this function that is level 0
+ SQInteger level=1; //1 is to skip this function that is level 0
const SQChar *name=0;
- int seq=0;
+ SQInteger seq=0;
pf(v,_SC("\nCALLSTACK\n"));
while(SQ_SUCCEEDED(sq_stackinfos(v,level,&si)))
{
for(level=0;level<10;level++){
seq=0;
- while(name=sq_getlocal(v,level,seq))
+ while((name = sq_getlocal(v,level,seq)))
{
seq++;
switch(sq_gettype(v,-1))
case OT_NATIVECLOSURE:
pf(v,_SC("[%s] NATIVECLOSURE\n"),name);
break;
+ case OT_GENERATOR:
+ pf(v,_SC("[%s] GENERATOR\n"),name);
+ break;
case OT_USERDATA:
pf(v,_SC("[%s] USERDATA\n"),name);
break;
case OT_INSTANCE:
pf(v,_SC("[%s] INSTANCE\n"),name);
break;
+ case OT_WEAKREF:
+ pf(v,_SC("[%s] WEAKREF\n"),name);
+ break;
+ case OT_BOOL:{
+ sq_getinteger(v,-1,&i);
+ pf(v,_SC("[%s] %s\n"),name,i?_SC("true"):_SC("false"));
+ }
+ break;
+ default: assert(0); break;
}
sq_pop(v,1);
}
}
}
-static int _sqstd_aux_printerror(HSQUIRRELVM v)
+static SQInteger _sqstd_aux_printerror(HSQUIRRELVM v)
{
SQPRINTFUNCTION pf = sq_getprintfunc(v);
if(pf) {
return 0;
}
-void _sqstd_compiler_error(HSQUIRRELVM v,const SQChar *sErr,const SQChar *sSource,int line,int column)
+void _sqstd_compiler_error(HSQUIRRELVM v,const SQChar *sErr,const SQChar *sSource,SQInteger line,SQInteger column)
{
SQPRINTFUNCTION pf = sq_getprintfunc(v);
if(pf) {
- pf(v,_SC("ERROR %s line=(%d) column=(%d) [%s]\n"),sErr,line,column,sSource);
+ pf(v,_SC("%s line = (%d) column = (%d) : error %s\n"),sSource,line,column,sErr);
}
}