本文整理汇总了C++中VMExecutionContext::invokeFunc方法的典型用法代码示例。如果您正苦于以下问题:C++ VMExecutionContext::invokeFunc方法的具体用法?C++ VMExecutionContext::invokeFunc怎么用?C++ VMExecutionContext::invokeFunc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VMExecutionContext
的用法示例。
在下文中一共展示了VMExecutionContext::invokeFunc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFromMap
AutoloadHandler::Result AutoloadHandler::loadFromMap(const String& name,
const String& kind,
bool toLower,
const T &checkExists) {
assert(!m_map.isNull());
while (true) {
CVarRef &type_map = m_map.get()->get(kind);
auto const typeMapCell = type_map.asCell();
if (typeMapCell->m_type != KindOfArray) return Failure;
String canonicalName = toLower ? f_strtolower(name) : name;
CVarRef &file = typeMapCell->m_data.parr->get(canonicalName);
bool ok = false;
if (file.isString()) {
String fName = file.toCStrRef().get();
if (fName.get()->data()[0] != '/') {
if (!m_map_root.empty()) {
fName = m_map_root + fName;
}
}
try {
Transl::VMRegAnchor _;
bool initial;
VMExecutionContext* ec = g_vmContext;
Unit* u = ec->evalInclude(fName.get(), nullptr, &initial);
if (u) {
if (initial) {
TypedValue retval;
ec->invokeFunc(&retval, u->getMain(), null_array,
nullptr, nullptr, nullptr, nullptr,
ExecutionContext::InvokePseudoMain);
tvRefcountedDecRef(&retval);
}
ok = true;
}
} catch (...) {}
}
if (ok && checkExists(name)) {
return Success;
}
CVarRef &func = m_map.get()->get(s_failure);
if (func.isNull()) return Failure;
// can throw, otherwise
// - true means the map was updated. try again
// - false means we should stop applying autoloaders (only affects classes)
// - anything else means keep going
Variant action = vm_call_user_func(func, make_packed_array(kind, name));
auto const actionCell = action.asCell();
if (actionCell->m_type == KindOfBoolean) {
if (actionCell->m_data.num) continue;
return StopAutoloading;
}
return ContinueAutoloading;
}
}