本文整理汇总了C++中Assembly::addReference方法的典型用法代码示例。如果您正苦于以下问题:C++ Assembly::addReference方法的具体用法?C++ Assembly::addReference怎么用?C++ Assembly::addReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assembly
的用法示例。
在下文中一共展示了Assembly::addReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lmAssert
Assembly *AssemblyReader::deserialize(LSLuaState *vm, const utString& sjson)
{
json_error_t jerror;
json_t *json = json_loadb(sjson.c_str(), sjson.size(), 0, &jerror);
lmAssert(json, "Error loading Assembly json: %s\n %s %i\n", jerror.source, jerror.text, jerror.line);
utString type = json_string_value(json_object_get(json, "type"));
utString name = json_string_value(json_object_get(json, "name"));
utString version = json_string_value(json_object_get(json, "version"));
utString loomconfig = json_string_value(json_object_get(json, "loomconfig"));
bool executable = false;
if (json_object_get(json, "executable") && json_is_true(json_object_get(json, "executable")))
{
executable = true;
parseLinkedAssemblies(json);
printf("Loading executable assembly: %s.loom\n", name.c_str());
}
if (type != "ASSEMBLY")
{
LSError("Assembly %s type string not found", name.c_str());
}
#ifdef LOOM_ENABLE_JIT
if (!json_is_true(json_object_get(json, "jit")))
{
LSError("Assembly %s.loom has interpreted bytecode, JIT required", name.c_str());
}
#else
if (json_is_true(json_object_get(json, "jit")))
{
LSError("Assembly %s.loom has JIT bytecode, interpreted required", name.c_str());
}
#endif
Assembly *assembly = Assembly::create(vm, name);
assembly->setLoomConfig(loomconfig);
if (json_is_false(json_object_get(json, "debugbuild")))
{
assembly->setDebugBuild(false);
}
else
{
assembly->setDebugBuild(true);
}
// load references
json_t *refArray = json_object_get(json, "references");
for (UTsize i = 0; i < json_array_size(refArray); i++)
{
Assembly *rasm = NULL;
json_t *ref = json_array_get(refArray, i);
utString refname = json_string_value(json_object_get(ref, "name"));
assembly->addReference(refname);
// if we've already loaded this assembly continue
if (vm->getAssembly(refname))
{
continue;
}
utString *sjson = linkedAssemblies.get(utHashedString(refname));
if (sjson)
{
rasm = vm->loadAssemblyJSON(*sjson);
}
else
{
utString fileJSON;
if (loadLibraryAssemblyJSON(refname, fileJSON))
{
rasm = vm->loadAssemblyJSON(fileJSON);
}
else
{
lmAssert(0, "Unable to load assembly '%s' as either a library or an executable!'", refname.c_str());
}
}
}
// modules
json_t *moduleArray = json_object_get(json, "modules");
// first pass is to declare module types
for (UTsize i = 0; i < json_array_size(moduleArray); i++)
{
json_t *jmodule = json_array_get(moduleArray, i);
ModuleReader::declareTypes(assembly, jmodule);
}
//.........这里部分代码省略.........