Example #1
0
/**
 * candl_matrix_print function:
 * This function prints the content of a CandlMatrix structure (matrix) into a
 * file (file, possibly stdout).
 * - 09/12/2005: first version (from CLooG 0.14.0).
 */
void candl_matrix_print(FILE * file, CandlMatrix * matrix)
{ candl_matrix_print_structure(file,matrix,0) ;
}
Example #2
0
/**
 * candl_program_print_structure function:
 * Displays a candl_program_t structure (program) into a file (file,
 * possibly stdout) in a way that trends to be understandable without falling
 * in a deep depression or, for the lucky ones, getting a headache... It
 * includes an indentation level (level) in order to work with others
 * print_structure functions.
 * - 09/09/2003: first version.
 */
void candl_program_print_structure(FILE* file, candl_program_p program,
				   int level)
{
  int i, j;

  if (program != NULL)
  {
    /* Go to the right level. */
    for (j = 0; j < level; j++)
      fprintf(file,"|\t");
    fprintf(file,"+-- candl_program_t\n");

    /* A blank line. */
    for (j = 0; j <= level + 1; j++)
      fprintf(file,"|\t");
    fprintf(file,"\n");

    /* Print the context. */
    candl_matrix_print_structure(file, program->context, level+1);

    /* A blank line. */
    for (j = 0; j <= level+1; j++)
      fprintf(file, "|\t");
    fprintf(file, "\n");

    /* Go to the right level and print the statement number. */
    for (j = 0; j <= level; j++)
      fprintf(file, "|\t");
    fprintf(file, "Statement number: %d\n", program->nb_statements);

    /* A blank line. */
    for (j = 0; j <= level+1; j++)
      fprintf(file, "|\t");
    fprintf(file, "\n");

    /* Print the statements. */
    for (i = 0; i < program->nb_statements; ++i)
      candl_statement_print_structure(file, program->statement[i], level+1);

    /* Print the transformation candidate. */
    if (program->transformation != NULL)
      for (i = 0; i < program->nb_statements; i++)
	candl_matrix_print_structure(file, program->transformation[i], level+1);
    else
      {
	/* Go to the right level. */
	for (j = 0; j <= level; j++)
	  fprintf(file, "|\t");
	fprintf(file, "+-- No transformation candidate\n");

	/* A blank line. */
	for (j = 0; j <= level+1; j++)
	  fprintf(file, "|\t");
	fprintf(file, "\n");
      }
  }
  else
    {
      /* Go to the right level. */
      for (j = 0; j < level; j++)
	fprintf(file, "|\t");
      fprintf(file, "+-- NULL candl_program_t\n");
    }

  /* The last line. */
  for (j = 0; j <= level; j++)
    fprintf(file, "|\t");
  fprintf(file, "\n");
}