Ejemplo n.º 1
0
void
noll_graph_fprint (FILE * f, noll_graph_t * g)
{
  assert (f);
  if (!g)
    {
      fprintf (f, "\tnull graph\n");
      return;
    }
  fprintf (f, "Graph nodes size: %d\n", g->nodes_size);
  fprintf (f, "Graph nodes labels:\n");
  for (uint_t i = 0; i < noll_vector_size (g->lvars); i++)
    fprintf (f, "%s(n%d),",
             noll_var_name (g->lvars, i, NOLL_TYP_RECORD), g->var2node[i]);
  fprintf (f, "\n");
  fprintf (f, "Graph difference edges: \n");
  assert (g->diff != NULL);
  // low-diagonal matrix
  for (uint_t i = 0; i < g->nodes_size; i++)
    for (uint_t j = 0; j <= i; j++)
      if (g->diff[i][j] == true)
        fprintf (f, "\t\tn%d != n%d\n", i, j);
  fprintf (f, "Graph edges: \n");
  assert (g->edges);
  for (uint_t eid = 0; eid < noll_vector_size (g->edges); eid++)
    {
      noll_edge_fprint (f, g->svars, noll_vector_at (g->edges, eid));
      fprintf (f, "\n");
    }
#ifndef NDEBUG
  fprintf (f, "Matrices: mat = [");
  for (uint_t vi = 0; vi < g->nodes_size; vi++)
    {
      if (g->mat[vi] != NULL)
        {
          fprintf (f, "\n\tn%d --> ", vi);
          for (uint_t i = 0; i < noll_vector_size (g->mat[vi]); i++)
            fprintf (f, "e%d, ", noll_vector_at (g->mat[vi], i));
        }
      if (g->rmat[vi] != NULL)
        {
          fprintf (f, "\n\tn%d <-- ", vi);
          for (uint_t i = 0; i < noll_vector_size (g->rmat[vi]); i++)
            fprintf (f, "e%d, ", noll_vector_at (g->rmat[vi], i));
        }
    }
  fprintf (f, "\n");
#endif
  fprintf (f, "Graph sharing constraints: \n");
  if (g->share)
    {
      noll_share_fprint (f, g->lvars, g->svars, g->share);
    }
  else
    fprintf (f, "\t\tnull\n");
}
Ejemplo n.º 2
0
void
noll_form_fprint (FILE * f, noll_form_t * phi)
{
  assert (f != NULL);
  if (!phi)
    {
      fprintf (stdout, "null\n");
      return;
    }

  switch (phi->kind)
    {
    case NOLL_FORM_UNSAT:
      fprintf (f, "unsat\n");
      break;
    case NOLL_FORM_SAT:
      fprintf (f, "sat\n");
      break;
    case NOLL_FORM_VALID:
      fprintf (f, "valid\n");
      break;
    default:
      fprintf (f, "error\n");
      break;
    }
  fprintf (f, "\n\t lvars: ");
  noll_var_array_fprint (f, phi->lvars, "lvars");
  fprintf (f, "\n\t svars: ");
  noll_var_array_fprint (f, phi->svars, "svars");
  fprintf (f, "\n\t pure part: ");
  noll_pure_fprint (f, phi->lvars, phi->pure);
  fprintf (f, "\n\t shape part: ");
  noll_space_fprint (f, phi->lvars, phi->svars, phi->space);
  fprintf (f, "\n\t share part: ");
  noll_share_fprint (f, phi->lvars, phi->svars, phi->share);
}