当前位置: 首页>>代码示例>>C++>>正文


C++ Assembly::addReference方法代码示例

本文整理汇总了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);
    }

//.........这里部分代码省略.........
开发者ID:24BitGames,项目名称:LoomSDK,代码行数:101,代码来源:lsAssemblyReader.cpp


注:本文中的Assembly::addReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。