예제 #1
0
파일: sqwrap.cpp 프로젝트: comarius/pizu
void SqEnv::_init(size_t sz)
{

   // AutoLock a(&_m);
    __vm = sq_open(sz);
    _vm= &__vm;

    assert( *_vm );

    Sqrat::DefaultVM::Set(*_vm);
    sq_setprintfunc(*_vm, SqEnv::print_func, SqEnv::print_func);
    sq_newclosure(*_vm, SqEnv::error_handler,0);
    sq_seterrorhandler(*_vm);
    //sq
    sq_pushroottable(*_vm);
    sqstd_register_iolib(*_vm);
    sqstd_register_bloblib(*_vm);
    sqstd_register_mathlib(*_vm);
    sqstd_register_stringlib(*_vm);
    sqstd_register_systemlib(*_vm);

    sqstd_seterrorhandlers(*_vm);
    sqstd_printcallstack(*_vm);

//    setnativedebughook(_vmsys,debug_hook);
    sq_notifyallexceptions(*_vm, true);
}
예제 #2
0
static SQInteger notifyAllExceptions(HSQUIRRELVM v)
{
	SQBool enable;
	sq_tobool(v, 1, &enable);
	sq_notifyallexceptions(v, enable != SQFalse);
	return SQ_OK;
}
예제 #3
0
SQInteger SquirrelStd::notifyallexceptions(HSQUIRRELVM vm)
{
	SQBool b;

	if (sq_gettop(vm) >= 1) {
		if (SQ_SUCCEEDED(sq_getbool(vm, -1, &b))) {
			sq_notifyallexceptions(vm, b);
			return 0;
		}
	}

	return SQ_ERROR;
}
예제 #4
0
파일: squirrel.cpp 프로젝트: jemmyw/openttd
Squirrel::Squirrel()
{
	this->vm = sq_open(1024);
	this->print_func = NULL;
	this->global_pointer = NULL;
	this->crashed = false;

	/* Handle compile-errors ourself, so we can display it nicely */
	sq_setcompilererrorhandler(this->vm, &Squirrel::CompileError);
	sq_notifyallexceptions(this->vm, SQTrue);
	/* Set a good print-function */
	sq_setprintfunc(this->vm, &Squirrel::PrintFunc);
	/* Handle runtime-errors ourself, so we can display it nicely */
	sq_newclosure(this->vm, &Squirrel::_RunError, 0);
	sq_seterrorhandler(this->vm);

	/* Set the foreigh pointer, so we can always find this instance from within the VM */
	sq_setforeignptr(this->vm, this);

	sq_pushroottable(this->vm);
	squirrel_register_global_std(this);
}