本文整理汇总了C++中SQVM类的典型用法代码示例。如果您正苦于以下问题:C++ SQVM类的具体用法?C++ SQVM怎么用?C++ SQVM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SQVM类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sq_open
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;
}
示例2: sq_newthread
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;
}
}
示例3: _thread
SQInteger SQSharedState::CollectGarbage(SQVM *vm)
{
SQInteger n=0;
SQCollectable *tchain=NULL;
SQVM *vms = _thread(_root_vm);
vms->Mark(&tchain);
SQInteger x = _table(_thread(_root_vm)->_roottable)->CountUsed();
_refs_table.Mark(&tchain);
MarkObject(_registry,&tchain);
MarkObject(_consts,&tchain);
MarkObject(_metamethodsmap,&tchain);
MarkObject(_table_default_delegate,&tchain);
MarkObject(_array_default_delegate,&tchain);
MarkObject(_string_default_delegate,&tchain);
MarkObject(_number_default_delegate,&tchain);
MarkObject(_generator_default_delegate,&tchain);
MarkObject(_thread_default_delegate,&tchain);
MarkObject(_closure_default_delegate,&tchain);
MarkObject(_class_default_delegate,&tchain);
MarkObject(_instance_default_delegate,&tchain);
MarkObject(_weakref_default_delegate,&tchain);
SQCollectable *t = _gc_chain;
SQCollectable *nx = NULL;
while(t) {
t->_uiRef++;
t->Finalize();
nx = t->_next;
if(--t->_uiRef == 0)
t->Release();
t = nx;
n++;
}
t = tchain;
while(t) {
t->UnMark();
t = t->_next;
}
_gc_chain = tchain;
SQInteger z = _table(_thread(_root_vm)->_roottable)->CountUsed();
assert(z == x);
return n;
}
示例4: _thread
void SQSharedState::RunMark(SQVM *vm,SQCollectable **tchain)
{
SQVM *vms = _thread(_root_vm);
vms->Mark(tchain);
_refs_table.Mark(tchain);
MarkObject(_registry,tchain);
MarkObject(_consts,tchain);
MarkObject(_metamethodsmap,tchain);
MarkObject(_table_default_delegate,tchain);
MarkObject(_array_default_delegate,tchain);
MarkObject(_string_default_delegate,tchain);
MarkObject(_number_default_delegate,tchain);
MarkObject(_generator_default_delegate,tchain);
MarkObject(_thread_default_delegate,tchain);
MarkObject(_closure_default_delegate,tchain);
MarkObject(_class_default_delegate,tchain);
MarkObject(_instance_default_delegate,tchain);
MarkObject(_weakref_default_delegate,tchain);
}