Example #1
0
/* print */
void print_poly(const char* msg, ap_abstract0_t* p)
{
  fprintf(stderr,"%s (%s) = ",msg,p->man->library);
  ap_abstract0_fprint(stderr,p->man,p,NULL);
  ap_abstract0_fdump(stderr,p->man,p);
  fprintf(stderr,"\n");
}
Example #2
0
/**
 * @brief Print the abstract value using the DOT format.
 * 
 * Use the DOT 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_dot (FILE * stream, mset_internal_t * pr, mset_t * a,
                 char **name_of_dim)
{
  fprintf (stream,
           "\n\tsubgraph cluster_mset_%zu {\n\tnode [shape=record] ;\n",
           ushape_number);
  if (!a)
    fprintf (stream, "\tlabel=\"mset %zu EMPTY\" ;\n}\n", ushape_number);
  else
    {
      fprintf (stream,
               "\tlabel=\"mset %zu of (datadim=%zu, segmdim=%zu)\" ;\n",
               ushape_number, a->datadim, a->segmdim);
      if (!name_of_dim)
        shape_init_name_of_dim (a->datadim, a->segmdim);
      if (!a->dcons)
        fprintf (stream, "\tmset_dcons_%zu [label=\"bot\"] ;\n",
                 ushape_number);
      else
        {
          char **dname = mset_init_name_data (a, name_of_dim);
          fprintf (stream, "\tmset_dcons_%zu [label=<<table><tr><td>dcons: ",
                   ushape_number);
          ap_abstract0_fprint (stream, pr->man_dcons, a->dcons, dname);
          fprintf (stream, "</td></tr></table>> ] ;\n");
          mset_free_name (a, dname);
        }
      if (!a->mscons)
        fprintf (stream, "\tmset_mscons_%zu [label=\"bot\"] ;\n",
                 ushape_number);
      else
        {
          char **dname = mset_init_name_mset (a, name_of_dim);
          fprintf (stream,
                   "\tmset_mscons_%zu [label=<<table><tr><td>mscons: ",
                   ushape_number);
          ap_abstract0_fprint (stream, pr->man_mscons, a->mscons, dname);
          fprintf (stream, "</td></tr></table>> ] ;\n");
          mset_free_name (a, dname);
        }
      fprintf (stream, "\t}\n");
    }
}
Example #3
0
void ucons_fprint_dcons(FILE * stream, ap_manager_t * man, ucons_t * a,
		char **name_of_dim, pattern_key_t *key) {
	ucons_internal_t *pr = ucons_init_from_manager(man, AP_FUNID_FPRINT, 0);
	size_t i;
	fprintf(stream,
			"\n\tsubgraph cluster_ucons_%zu {\n\tnode [shape=Mrecord] ;\n",
			ushape_number);
	if (!a)
		//fprintf (stream, "ucons EMPTY\n");
		fprintf(stream, "\tlabel = \"ucons %zu EMPTY\" ;\n }\n", ushape_number);
	else {
		if (!a->econs)
			fprintf(stream, "\tucons_dcons_%zu [label=\"bot\"] ;\n",
					ushape_number);
		else {
			char **dname, **name;
			size_t i, size;
			if (!name_of_dim)
				shape_init_name_of_dim(a->datadim, a->segmentdim);
			fprintf(stream,
					"\tlabel = \"ucons %zu of (datadim=%zu, segmdim=%zu)\" ;\n",
					ushape_number, a->datadim, a->segmentdim);
			//fprintf (stream, "ucons of [datadim=%zu, ptrdim=%zu] \n", a->datadim, a->segmentdim);
			// prepare names for the domain
			size = (a->datadim + 2 * a->segmentdim + 2 * 3); /* TODO: max 3 universally quantified vars */
			dname = (char **) malloc(size * sizeof(char *));
			for (i = 0; i < a->datadim; i++)
				dname[i] =
						(name_of_dim) ? name_of_dim[i] : shape_name_of_dim(i);

			name = (char **) malloc(size * sizeof(char *));
			for (i = 0; i < a->segmentdim; i++) {

				char *n =
						(name_of_dim) ?
								name_of_dim[a->datadim + i] :
								shape_name_of_dim(a->datadim + i);
				size_t lsize = (4 + strlen(n));
				name[a->datadim + i] = (char *) malloc(lsize * sizeof(char));
				snprintf(name[a->datadim + i], lsize, "%s", n);
				dname[a->datadim + i] = (char *) malloc(lsize * sizeof(char));
				snprintf(dname[a->datadim + i], lsize, "d(%s)", n);
				dname[a->datadim + a->segmentdim + i] = (char *) malloc(
						lsize * sizeof(char));
				snprintf(dname[a->datadim + a->segmentdim + i], lsize, "l[%s]",
						n);
			}
			for (i = 0; i < 6; i++) // TODO: max 6
				dname[a->datadim + 2 * a->segmentdim + i] = (char *) malloc(
						8 * sizeof(char));

			fprintf(stream,
					"\n\tsubgraph cluster_formulas_%zu{\n\tnode [shape=Mrecord] ;\n",
					ushape_number);
			// print the universal constraints
			pattern_t * r = NULL;

			unsigned keylen = (pr->PI[key->type].u_seg) * sizeof(size_t)
					+ sizeof(pattern_key_t);
			HASH_FIND(hh, a->udcons, key, keylen, r);
			size_t ii = 0;
			if (r != NULL) {
				//fprintf(stream, "\n\tsubgraph cluster_ucons %zu{\n\tnode [shape=Mrecord] ;\n", ii);
				ii += 1;

				fprintf(stream, "\tpattern_%zu%zu [label=<<table><tr><td> ", ii,
						ushape_number);
				dot_pattern_key_fprint(stream, pr, &r->key, &name[a->datadim]);
				//fprintf(stream, " ==> ");
				fprintf(stream, "</td></tr></table>> ] ;\n");
				fprintf(stream,
						"\tucons_%zu%zu [label=<<table><tr><td>ucons%zu%zu: ",
						ii, ushape_number, ii, ushape_number);
				if (r->dcons) {
					// prepare dname for this pattern
					for (i = 0; i < pr->PI[r->key.type].nr_y && i < 3; i++) // TODO: max 3
							{
						snprintf(dname[a->datadim + 2 * a->segmentdim + i], 8,
								"y%zu", (i + 1));
						snprintf(
								dname[a->datadim + 2 * a->segmentdim
										+ pr->PI[r->key.type].nr_y + i], 8,
								"d(y%zu)", (i + 1));
					}
					// print with the names
					ap_abstract0_fprint(stream, pr->man_dcons, r->dcons, dname);
				} else
					fprintf(stream, "true");
				r = r->hh.next;
				fprintf(stream, "</td></tr></table>> ] ;\n");

				fprintf(stream,
						"\tpattern_%zu%zu -> ucons_%zu%zu [label = implies ];\n",
						ii, ushape_number, ii, ushape_number);
				//fprintf(stream, "\t}\n");
			}
			fprintf(stream, "\t}\n");

		}
	} //end !a->econs
	fprintf(stream, "\t}\n");
}
Example #4
0
void ucons_fprint_econs(FILE * stream, ap_manager_t * man, ucons_t * a,
		char **name_of_dim) {
	ucons_internal_t *pr = ucons_init_from_manager(man, AP_FUNID_FPRINT, 0);
	size_t i;
	fprintf(stream,
			"\n\tsubgraph cluster_ucons_%zu {\n\tnode [shape=Mrecord] ;\n",
			ushape_number);
	if (!a)
		//fprintf (stream, "ucons EMPTY\n");
		fprintf(stream, "\tlabel = \"ucons %zu EMPTY\" ;\n }\n", ushape_number);
	else {
		if (!a->econs)
			fprintf(stream, "\tucons_dcons_%zu [label=\"bot\"] ;\n",
					ushape_number);
		else {
			char **dname, **name;
			size_t i, size;
			if (!name_of_dim)
				shape_init_name_of_dim(a->datadim, a->segmentdim);
			fprintf(stream,
					"\tlabel = \"ucons %zu of (datadim=%zu, segmdim=%zu)\" ;\n",
					ushape_number, a->datadim, a->segmentdim);
			//fprintf (stream, "ucons of [datadim=%zu, ptrdim=%zu] \n", a->datadim, a->segmentdim);
			// prepare names for the domain
			size = (a->datadim + 2 * a->segmentdim + 2 * 3); /* TODO: max 3 universally quantified vars */
			dname = (char **) malloc(size * sizeof(char *));
			for (i = 0; i < a->datadim; i++)
				dname[i] =
						(name_of_dim) ? name_of_dim[i] : shape_name_of_dim(i);

			name = (char **) malloc(size * sizeof(char *));
			for (i = 0; i < a->segmentdim; i++) {

				char *n =
						(name_of_dim) ?
								name_of_dim[a->datadim + i] :
								shape_name_of_dim(a->datadim + i);
				size_t lsize = (4 + strlen(n));
				name[a->datadim + i] = (char *) malloc(lsize * sizeof(char));
				snprintf(name[a->datadim + i], lsize, "%s", n);
				dname[a->datadim + i] = (char *) malloc(lsize * sizeof(char));
				snprintf(dname[a->datadim + i], lsize, "d(%s)", n);
				dname[a->datadim + a->segmentdim + i] = (char *) malloc(
						lsize * sizeof(char));
				snprintf(dname[a->datadim + a->segmentdim + i], lsize, "l[%s]",
						n);
			}
			for (i = 0; i < 6; i++) // TODO: max 6
				dname[a->datadim + 2 * a->segmentdim + i] = (char *) malloc(
						8 * sizeof(char));
			// print the existential constraints
			fprintf(stream,
					"\n\tsubgraph cluster_econs_%zu {\n\tnode [shape=Mrecord] ;\n",
					ushape_number);
			fprintf(stream, "\t ucons_econs_%zu [label=<<table><tr><td>econs: ",
					ushape_number);
			ap_abstract0_fprint(stream, pr->man_dcons, a->econs, dname);
			fprintf(stream, "</td></tr></table>> ] ;\n");
			fprintf(stream, "\t}\n");

		}
	} //end !a->econs
	fprintf(stream, "\t}\n");
}