void delete_vars_from_relation(sc_memory_context *context, scp_operand *set, GHashTable *non_erasable_vars)
{
    scp_operand arc1, arc2, elem, rel_elem;
    scp_iterator5 *it;
    scp_iterator3 *it0;
    MAKE_DEFAULT_ARC_ASSIGN(arc1);
    MAKE_DEFAULT_ARC_ASSIGN(arc2);
    MAKE_DEFAULT_OPERAND_ASSIGN(elem);
    MAKE_DEFAULT_OPERAND_ASSIGN(rel_elem);
    elem.erase = SCP_TRUE;
    rel_elem.erase = SCP_TRUE;

    it0 = scp_iterator3_new(context, set, &arc1, &rel_elem);
    while (SCP_RESULT_TRUE == scp_iterator3_next(context, it0, set, &arc1, &rel_elem))
    {
        rel_elem.param_type = SCP_FIXED;
        it = scp_iterator5_new(context, &rel_elem, &arc1, &elem, &arc2, &rrel_scp_var);
        while (SCP_RESULT_TRUE == scp_iterator5_next(context, it, &rel_elem, &arc1, &elem, &arc2, &rrel_scp_var))
        {
            elem.param_type = SCP_FIXED;
            if (non_erasable_vars != nullptr && FALSE == g_hash_table_contains(non_erasable_vars, MAKE_HASH(elem)))
            {
                eraseEl(context, &elem);
            }
            elem.param_type = SCP_ASSIGN;
        }
        scp_iterator5_free(it);
        eraseEl(context, &rel_elem);
        rel_elem.param_type = SCP_ASSIGN;
    }
    scp_iterator3_free(it0);
}
Пример #2
0
scp_result find_breakpoints_set()
{
    scp_operand arc1, arc2;
    scp_operand breakpoints_set;
    MAKE_DEFAULT_OPERAND_ASSIGN(breakpoints_set);
    MAKE_COMMON_ARC_ASSIGN(arc1);
    MAKE_DEFAULT_ARC_ASSIGN(arc2);

    scp_iterator5 *breakpoints_set_finder = scp_iterator5_new(s_default_ctx,
                                                             current_scp_procedure, &arc1, &breakpoints_set, &arc2, &nrel_breakpoints);

    if (SCP_RESULT_TRUE != scp_iterator5_next(s_default_ctx,
                                              breakpoints_set_finder, &current_scp_procedure, &arc1, &breakpoints_set, &arc2, &nrel_breakpoints))
    {
        scp_iterator5_free(breakpoints_set_finder);
        printf("Breakpoints set is missing");
        return SCP_RESULT_FALSE;
    }

    current_breakpoints_set = &breakpoints_set;
    scp_iterator5_free(breakpoints_set_finder);
    return SCP_RESULT_TRUE;
}
Пример #3
0
void erase_var_set_values(sc_memory_context *context, scp_operand *set)
{
    scp_operand arc1, arc2, elem, value;
    scp_iterator5 *it;
    MAKE_DEFAULT_ARC_ASSIGN(arc1);
    arc1.erase = SCP_TRUE;
    MAKE_DEFAULT_ARC_ASSIGN(arc2);
    MAKE_DEFAULT_OPERAND_ASSIGN(elem);
    MAKE_DEFAULT_OPERAND_ASSIGN(value);
    it = scp_iterator5_new(context, set, &arc1, &elem, &arc2, &rrel_assign);
    while (SCP_RESULT_TRUE == scp_iterator5_next(context, it, set, &arc1, &elem, &arc2, &rrel_assign))
    {
        elem.param_type = SCP_FIXED;
        arc1.param_type = SCP_FIXED;
        if (SCP_RESULT_TRUE == searchElStr3(context, &rrel_scp_var, &arc2, &arc1))
        {
            arc1.param_type = SCP_ASSIGN;
            eraseSetStr5(context, &elem, &arc1, &value, &arc2, &nrel_value);
        }
        arc1.param_type = SCP_ASSIGN;
        elem.param_type = SCP_ASSIGN;
    }
    scp_iterator5_free(it);
}