HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize) { SQSharedState *ss; SQVM *v; ss=_ss(friendvm); v= (SQVM *)SQ_MALLOC(sizeof(SQVM)); new (v) SQVM(ss); if(v->Init(friendvm, initialstacksize)) { friendvm->Push(v); return v; } else { sq_delete(v, SQVM); return NULL; } }
HSQUIRRELVM sq_open(SQInteger initialstacksize) { SQSharedState *ss; SQVM *v; sq_new(ss, SQSharedState); ss->Init(); v = (SQVM *)SQ_MALLOC(sizeof(SQVM)); new (v) SQVM(ss); ss->_root_vm = v; if(v->Init(NULL, initialstacksize)) { return v; } else { sq_delete(v, SQVM); return NULL; } return v; }