Esempio n. 1
0
// -------------------------------------------------
sc_bool initialize_keynodes()
{
    RESOLVE_KEYNODE(s_default_ctx, keynode_user);
    RESOLVE_KEYNODE(s_default_ctx, keynode_question_nrel_answer);
    RESOLVE_KEYNODE(s_default_ctx, keynode_question_finished);
    RESOLVE_KEYNODE(s_default_ctx, keynode_command_translate_from_sc);
    RESOLVE_KEYNODE(s_default_ctx, keynode_nrel_authors);
    RESOLVE_KEYNODE(s_default_ctx, keynode_nrel_user_answer_formats);
    RESOLVE_KEYNODE(s_default_ctx, keynode_rrel_source_sc_construction);
    RESOLVE_KEYNODE(s_default_ctx, keynode_rrel_output_format);
    RESOLVE_KEYNODE(s_default_ctx, keynode_nrel_translation);
    RESOLVE_KEYNODE(s_default_ctx, keynode_nrel_format);

    RESOLVE_KEYNODE(s_default_ctx, keynode_command_generate_instance);
    RESOLVE_KEYNODE(s_default_ctx, keynode_command_initiated);
	RESOLVE_KEYNODE(s_default_ctx, keynode_command_failed);
    RESOLVE_KEYNODE(s_default_ctx, keynode_command_finished);
    RESOLVE_KEYNODE(s_default_ctx, keynode_rrel_command_arguments);
    RESOLVE_KEYNODE(s_default_ctx, keynode_rrel_command);
    RESOLVE_KEYNODE(s_default_ctx, keynode_nrel_command_template);
    RESOLVE_KEYNODE(s_default_ctx, keynode_nrel_command_result);
    RESOLVE_KEYNODE(s_default_ctx, keynode_displayed_answer);

    RESOLVE_KEYNODE(s_default_ctx, keynode_format_scs_json);
    RESOLVE_KEYNODE(s_default_ctx, keynode_format_scg_json);
    RESOLVE_KEYNODE(s_default_ctx, keynode_format_scn_json);

    RESOLVE_KEYNODE(s_default_ctx, keynode_system_element);

    for (sc_uint32 i = 0; i < RREL_ORDER_COUNT; ++i)
    {
        std::stringstream ss;
        ss << "rrel_" << (i + 1);
        if (sc_helper_resolve_system_identifier(s_default_ctx, ss.str().c_str(), &(ui_keynode_rrel_order[i])) == SC_FALSE)
        {
            ui_keynode_rrel_order[i] = sc_memory_node_new(s_default_ctx, 0);
            if (sc_helper_set_system_identifier(s_default_ctx, ui_keynode_rrel_order[i], ss.str().c_str(), (sc_uint32)ss.str().size()) != SC_RESULT_OK)
                return SC_FALSE;
        }
    }

    for (sc_uint32 i = 0; i < UI_ARG_COUNT; ++i)
    {
        std::stringstream ss;
        ss << "ui_arg_" << (i + 1);
        if (sc_helper_resolve_system_identifier(s_default_ctx, ss.str().c_str(), &(ui_keynode_arg[i])) == SC_FALSE)
        {
            ui_keynode_rrel_order[i] = sc_memory_node_new(s_default_ctx, 0);
            if (sc_helper_set_system_identifier(s_default_ctx, ui_keynode_rrel_order[i], ss.str().c_str(), (sc_uint32)ss.str().size()) != SC_RESULT_OK)
                return SC_FALSE;
        }
    }

    return SC_TRUE;
}
Esempio n. 2
0
// --------------------- Module ------------------------
sc_result initialize()
{

    if (sc_helper_resolve_system_identifier(q_keynode_question_initiated_str, &q_keynode_question_initiated) == SC_FALSE)
        return SC_RESULT_ERROR;

    if (sc_helper_resolve_system_identifier(q_keynode_question_finished_str, &q_keynode_question_finished) == SC_FALSE)
        return SC_FALSE;

    if (sc_helper_resolve_system_identifier(q_keynode_question_nrel_answer_str, &q_keynode_question_nrel_answer) == SC_FALSE)
        return SC_RESULT_ERROR;


   /* event_question_search_all_output_arcs = sc_event_new(q_keynode_question_initiated, SC_EVENT_ADD_OUTPUT_ARC, 0, question_search_all_output_arcs, 0);
    if (event_question_search_all_output_arcs == nullptr)
        return SC_RESULT_ERROR;*/

    return SC_RESULT_OK;
}
Esempio n. 3
0
sc_result sc_common_resolve_keynode(sc_memory_context const * ctx, char const * sys_idtf, sc_addr * keynode)
{
    if (sc_helper_resolve_system_identifier(ctx, sys_idtf, keynode) == SC_FALSE)
    {
        *keynode = sc_memory_node_new(ctx, 0);
        if (sc_helper_set_system_identifier(ctx, *keynode, sys_idtf, (sc_uint32)strlen(sys_idtf)) != SC_RESULT_OK)
            return SC_RESULT_ERROR;
        g_message("Created element with system identifier: %s", sys_idtf);
    }
    return SC_RESULT_OK;
}
scp_result scp_lib_resolve_system_identifier(const char *idtf, scp_operand *param)
{
    if (SC_TRUE == sc_helper_resolve_system_identifier(idtf, &(param->addr)))
    {
        return SCP_RESULT_TRUE;
    }
    else
    {
        return SCP_RESULT_ERROR;
    }
}