void sh_push (sh_formula_t* f, bool sign) { sh_formula_t** sh = (sign == true) ? &sh_pos : &sh_neg; if (!f) { fprintf (stderr, "Sh_push: NULL formula of sign %d pushed.\n", sign); return; } if (!(*sh)) { (*sh) = f; } else if (ap_environment_is_eq ((*sh)->env, f->env)) { /* TODO: check f->dw */ sh_push2 ((*sh), f); /* free f->form */ ap_environment_free (f->env); free (f); } else fprintf (stderr, "Sh_push: formula with different environments.\n"); return; }
void sh_univform_fprint (FILE* stream, ap_environment_t* env, sh_univform_t* f, size_t size) { if (f && size > 0) { size_t i, j; for (i = 0; i < size; i++) { // print f[i] // the new environement contains f[i].y ap_environment_t* nenv = ap_environment_add (env, f[i].y, f[i].length_y, NULL, 0); fprintf (stream, "\n\t\t(forall "); for (j = 0; j < f[i].length_y; j++) fprintf (stream, "%s, ", ap_var_operations->to_string (f[i].y[j])); fprintf (stream, " .\n\t\t\t("); sh_guardform_fprint (stream, nenv, f[i].guard); fprintf (stream, "\n\t\t\t==>\n\t\t\t"); sh_dataform_fprint (stream, nenv, f[i].data, f[i].length_data); fprintf (stream, "\n\t\t\t)\n\t\t)"); ap_environment_free (nenv); } } else fprintf (stream, "empty"); }
void sh_shadform_free (sh_shadform_t* a) { ap_environment_free (a->nodes); if (a->eform) free (a->eform); if (a->pform) free (a->pform); if (a->dform) sh_dataform_free (a->dform, a->length_dform); if (a->uform) sh_univform_free (a->uform, a->length_uform); return; }
~Variables() { if (env) ap_environment_free(env); for (std::map<char *, int>::iterator it=array2size.begin(); it != array2size.end(); ++it) { if (char *key = it->first) free(key); } for (std::set<char *>::iterator it=numerics.begin(); it != numerics.end(); ++it) { free(*it); } }
void sh_formula_free (sh_formula_t* a) { if (a->env) ap_environment_free (a->env); a->env = NULL; if (a->size > 0) { size_t i; for (i = 0; i < a->size; i++) { sh_shadform_free (a->form[i]); } free (a->form); a->form = NULL; } free (a); }
/* Special constructor 2: Build a new abstract value level 1 from the old one, a new value level 0 and a new environment, depending on destructive. */ static ap_abstract1_t ap_abstract1_consres2(bool destructive, ap_abstract1_t* a, ap_abstract0_t* value, ap_environment_t* env) { ap_abstract1_t res; if (destructive){ if (value==a->abstract0 && env==a->env) res = *a; else { res.abstract0 = value; res.env = env; ap_environment_free(a->env); } } else { res.abstract0 = value; res.env = env; } return res; }