Exemplo n.º 1
0
/* convert to specified manager */
ap_abstract0_t* convert(ap_manager_t* man, ap_abstract0_t* a)
{
  ap_lincons0_array_t l;
  ap_dimension_t d = ap_abstract0_dimension(a->man,a);
  if (a->man==man) return a;
  l = ap_abstract0_to_lincons_array(a->man,a);
  a = ap_abstract0_of_lincons_array(man,d.intdim,d.realdim,&l);
  ap_lincons0_array_clear(&l);
  return a;
}
Exemplo n.º 2
0
void
mset_fprint_smtlib (FILE * stream, mset_internal_t * pr, mset_t * a,
                    char **name_of_dim)
{
  if (!a)
    {
      fprintf (stream, "\t\t;; mset constraints empty\n");
      return;
    }

  size_t i, size;
  size = (a->datadim + 2 * a->segmdim);
  // print data constraints
  // initialize data and len node names
  char **dname =
    ap_dimension_to_smt (size, a->datadim, a->segmdim, 0, name_of_dim);
  // print the list of constraints
  ap_lincons0_array_t arr =
    ap_abstract0_to_lincons_array (pr->man_dcons, a->dcons);
  ap_lincons0_array_fprint_smtlib (stream, &arr, dname);
  ap_lincons0_array_clear (&arr);

  // print the mset constraints
  // initialize mset node names
  for (i = 0; i < a->segmdim; i++)
    {
      char *name = shape_name_of_dim (a->datadim + i);
      size_t lsize = (8 + strlen (name));
      if (dname[a->datadim + a->segmdim + i])
        free (dname[a->datadim + a->segmdim + i]);
      dname[a->datadim + a->segmdim + i] =
        (char *) malloc (lsize * sizeof (char));
      snprintf (dname[a->datadim + a->segmdim + i], lsize, "(mset %s)", name);
    }

  // print the list of constraints
  arr = ap_abstract0_to_lincons_array (pr->man_mscons, a->mscons);
  ap_lincons0_array_fprint_smtlib (stream, &arr, dname);
  ap_lincons0_array_clear (&arr);

  mset_free_name (a, dname);
}
Exemplo n.º 3
0
/**
 * @brief Print the abstract value using the ACSL format.
 * 
 * Use the ACSL format to print the abstract value in the
 * file @p stream.
 * 
 * @param[in] stream   Output stream
 * @param[in] pr       Internal manager
 * @param[in] a        Abstract value to be print
 * @param[in] name_of_dim Names for the array represented
 */
void
mset_fprint_acsl (FILE * stream, mset_internal_t * pr, mset_t * a,
                  char **name_of_dim)
{
  if (!a)
    fprintf (stream, "EMPTY");
  else
    {
      if (!name_of_dim)
        shape_init_name_of_dim (a->datadim, a->segmdim);
      char **dname = mset_init_name_data (a, name_of_dim);
      ap_lincons0_array_t arr =
        ap_abstract0_to_lincons_array (pr->man_dcons, a->dcons);
      ap_lincons0_array_fprint_acsl (stream, &arr, dname);
      ap_lincons0_array_clear (&arr);
      mset_free_name (a, dname);

      dname = mset_init_name_mset (a, name_of_dim);
      arr = ap_abstract0_to_lincons_array (pr->man_mscons, a->mscons);
      ap_lincons0_array_fprint_acsl (stream, &arr, dname);
      ap_lincons0_array_clear (&arr);
      mset_free_name (a, dname);
    }
}