本文整理汇总了C++中Executable::primitive方法的典型用法代码示例。如果您正苦于以下问题:C++ Executable::primitive方法的具体用法?C++ Executable::primitive怎么用?C++ Executable::primitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Executable
的用法示例。
在下文中一共展示了Executable::primitive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hookup_prim
static void hookup_prim(STATE, Symbol* meth, Symbol* prim) {
MethodTable* tbl = G(rubinius)->metaclass(state)->method_table();
Executable* oc = Executable::allocate(state, Qnil);
oc->primitive(state, prim);
assert(oc->resolve_primitive(state));
tbl->store(state, meth, oc, G(sym_public));
}
示例2: allocate
Executable* Executable::allocate(STATE, Object* self) {
Executable* executable = state->new_object<Executable>(G(executable));
executable->primitive(state, (Symbol*)Qnil);
executable->serial(state, Fixnum::from(0));
executable->set_executor(Executable::default_executor);
if(kind_of<Class>(self)) {
state->om->set_class(executable, self);
}
return executable;
}
示例3: allocate
Executable* Executable::allocate(STATE, Object* self) {
Executable* executable = state->new_object<Executable>(G(executable));
executable->primitive(state, nil<Symbol>());
executable->serial(state, Fixnum::from(0));
executable->inliners_ = 0;
executable->prim_index_ = -1;
executable->set_executor(Executable::default_executor);
if(Class* cls = try_as<Class>(self)) {
executable->klass(state, cls);
}
return executable;
}
示例4: attach_primitive
void System::attach_primitive(STATE, Module* mod, bool meta, Symbol* name, Symbol* prim) {
MethodTable* tbl;
if(meta) {
tbl = mod->singleton_class(state)->method_table();
} else {
tbl = mod->method_table();
}
Executable* oc = Executable::allocate(state, Qnil);
oc->primitive(state, prim);
oc->resolve_primitive(state);
tbl->store(state, name, oc, G(sym_public));
}