/**Function******************************************************************** Synopsis [Deinitializes the wff2nff conversion system] Description [Deinitializes the wff2nff conversion system] SideEffects [] SeeAlso [] ******************************************************************************/ void w2w_quit_wff2nnf() { if (wff2nnf_hash != (hash_ptr) NULL) { free_assoc(wff2nnf_hash); wff2nnf_hash = (hash_ptr) NULL; } }
/**Function******************************************************************** Synopsis [Inline caching private service] Description [] SideEffects [] SeeAlso [] ******************************************************************************/ void rbc_inlining_cache_quit() { if (inlining_cache != (hash_ptr) NULL) { clear_assoc_and_free_entries(inlining_cache, _destroy_cache_entry); free_assoc(inlining_cache); inlining_cache = (hash_ptr) NULL; } }
static void reset_list(assoc_list_t *assoc_list) { int i; for(i = 0; i < assoc_list->count; i++) { free_assoc(&assoc_list->list[i]); } reset_list_head(assoc_list); }
/*! \brief Private method called by the destructor Called by the destructor */ static void symb_layer_deinit(SymbLayer_ptr self, boolean clean_cache) { nusmv_assert(self->committed_to_encs == 0); /* not in use by encs */ /* frees the name */ if (self->name != (char*) NULL) { FREE(self->name); } if (clean_cache) { SymbCache_remove_symbols(self->cache, self->symbols, self->symbols_index); } free_assoc(self->symbol2position); FREE(self->symbols); }
void Be_Cnf_RemoveDuplicateLiterals(Be_Cnf_ptr self) { int i, j; Siter iter; int * clause = (int *)NULL; hash_ptr lits = (hash_ptr)NULL; nusmv_assert(self != NULL); lits = new_assoc(); for (iter = Slist_first(Be_Cnf_GetClausesList(self)); !Siter_is_end(iter); iter = Siter_next(iter)) { clause = (int*) Siter_element(iter); i = 0; while (clause[i] != 0) { if (Nil != find_assoc(lits, NODE_FROM_INT(clause[i]))) { j = i+1; while (clause[j] != 0) { clause[j-1] = clause[j]; j++; } } else { insert_assoc(lits, NODE_FROM_INT(clause[i]), NODE_FROM_INT(1)); } i++; } /* this clear the hash */ clear_assoc(lits); } free_assoc(lits); }
int trace_explainer_action(const TracePlugin_ptr self) { const Trace_ptr trace = self->trace; const SymbTable_ptr symb_table = Trace_get_symb_table(trace); const NuSMVEnv_ptr env = EnvObject_get_environment(ENV_OBJECT(symb_table)); TraceIter start_iter; TraceIter stop_iter; TraceIter step; TraceIteratorType input_iter_type; TraceIteratorType state_iter_type; TraceIteratorType combo_iter_type; hash_ptr changed_states; int i; OStream_ptr out = TraceOpt_output_stream(self->opt); start_iter = (0 != TraceOpt_from_here(self->opt)) ? trace_ith_iter(trace, TraceOpt_from_here(self->opt)) : trace_first_iter(trace); stop_iter = (0 != TraceOpt_to_here(self->opt)) ? trace_ith_iter(trace, 1 + TraceOpt_to_here(self->opt)) : TRACE_END_ITER; input_iter_type = TraceOpt_show_defines(self->opt) ? TRACE_ITER_I_SYMBOLS : TRACE_ITER_I_VARS; state_iter_type = TraceOpt_show_defines(self->opt) ? TRACE_ITER_SF_SYMBOLS : TRACE_ITER_SF_VARS; combo_iter_type = TraceOpt_show_defines(self->opt) ? (TraceOpt_show_defines_with_next(self->opt) ? TRACE_ITER_COMBINATORIAL : TRACE_ITER_SI_DEFINES) : TRACE_ITER_NONE; OStream_printf(out, "Trace Description: %s \n", Trace_get_desc(trace)); OStream_printf(out, "Trace Type: %s \n", TraceType_to_string(env, Trace_get_type(trace))); /* indent */ OStream_inc_indent_size(out); changed_states = new_assoc(); nusmv_assert(changed_states != (hash_ptr)NULL); i = MAX(1, TraceOpt_from_here(self->opt)); step = start_iter; while (stop_iter != step) { TraceStepIter iter; node_ptr symb; node_ptr val; boolean input_header = false; /* lazy defines evaluation */ if (TraceOpt_show_defines(self->opt)) { trace_step_evaluate_defines(trace, step); } /* COMBINATORIAL SECTION (optional) */ TRACE_STEP_FOREACH(trace, step, combo_iter_type, iter, symb, val) { /* skip non-visible symbols */ if (!trace_plugin_is_visible_symbol(self, symb)) continue; /* if required, print only symbols with changed values */ if (TRACE_EXPLAINER(self)->changes_only) { if (val == find_assoc(changed_states, symb)) { continue; } insert_assoc(changed_states, symb, val); } TracePlugin_print_assignment(self, symb, val); } /* foreach SI_DEFINES */ /* INPUT SECTION (optional) */ TRACE_STEP_FOREACH(trace, step, input_iter_type, iter, symb, val) { if (false == input_header) { OStream_printf(out, "-> Input: %d.%d <-\n", Trace_get_id(trace), i); input_header = true; } /* skip non-visible symbols */ if (!trace_plugin_is_visible_symbol(self, symb)) continue; /* if required, print only symbols with changed values */ if (TRACE_EXPLAINER(self)->changes_only) { if (val == find_assoc(changed_states, symb)) { continue; } insert_assoc(changed_states, symb, val); } TracePlugin_print_assignment(self, symb, val); } /* foreach I_SYMBOLS */ if (Trace_step_is_loopback(trace, step)) { OStream_printf(out, "-- Loop starts here\n"); } /* STATE SECTION (mandatory) */ OStream_printf(out, "-> State: %d.%d <-\n", Trace_get_id(trace), i); TRACE_STEP_FOREACH(trace, step, state_iter_type, iter, symb, val) { /* skip non-visible symbols */ if (!trace_plugin_is_visible_symbol(self, symb)) continue; /* if required, print only symbols with changed values */ if (TRACE_EXPLAINER(self)->changes_only) { if (val == find_assoc(changed_states, symb)) { continue; } insert_assoc(changed_states, symb, val); } TracePlugin_print_assignment(self, symb, val); } /* foreach SF_SYMBOLS */ ++ i; step = TraceIter_get_next(step); } /* while */ free_assoc(changed_states); /* deindent */ OStream_dec_indent_size(out); return 0; }