Example #1
0
/**
 * osl_body_idump function:
 * this function displays an osl_body_t structure (*body) into a
 * file (file, possibly stdout) in a way that trends to be understandable.
 * It includes an indentation level (level) in order to work with others
 * dumping functions.
 * \param[in] file  File where informations are printed.
 * \param[in] body  The body whose information has to be printed.
 * \param[in] level Number of spaces before printing, for each line.
 */
void osl_body_idump(FILE * file, osl_body_p body, int level) {
  int j;

  // Go to the right level.
  for (j = 0; j < level; j++)
    fprintf(file, "|\t");

  if (body != NULL) {
    fprintf(file, "+-- osl_body_t\n");

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

    // Print the iterators
    osl_strings_idump(file, body->iterators, level + 1);

    // Print the original body expression.
    osl_strings_idump(file, body->expression, level + 1);
  }
  else {
    fprintf(file, "+-- NULL body\n");
  }
  
  // The last line.
  for (j = 0; j <= level; j++)
    fprintf(file, "|\t");
  fprintf(file, "\n");
}
Example #2
0
/**
 * osl_scatnames_idump function:
 * this function displays an osl_scatnames_t structure (*scatnames) into a
 * file (file, possibly stdout) in a way that trends to be understandable. It
 * includes an indentation level (level) in order to work with others
 * idump functions.
 * \param[in] file      The file where the information has to be printed.
 * \param[in] scatnames Scatnames structure to print.
 * \param[in] level     Number of spaces before printing, for each line.
 */
void osl_scatnames_idump(FILE * file, osl_scatnames_p scatnames, int level) {
  int j;

  // Go to the right level.
  for (j = 0; j < level; j++)
    fprintf(file, "|\t");

  if (scatnames != NULL)
    fprintf(file, "+-- osl_scatnames_t\n");
  else
    fprintf(file, "+-- NULL scatnames\n");

  if (scatnames != NULL) {
    // Go to the right level.
    for(j = 0; j <= level + 1; j++)
      fprintf(file, "|\t");
    fprintf(file, "\n");
  
    // Display the list of scattering names.
    osl_strings_idump(file, scatnames->names, level + 1);
  }

  // The last line.
  for (j = 0; j <= level; j++)
    fprintf(file, "|\t");
  fprintf(file, "\n");
}
Example #3
0
/**
 * osl_strings_dump function:
 * this function prints the content of an osl_strings_t structure
 * (*strings) into a file (file, possibly stdout).
 * \param[in] file    The file where the information has to be printed.
 * \param[in] strings The strings structure which has to be printed.
 */
void osl_strings_dump(FILE * file, osl_strings_p strings) {
  osl_strings_idump(file, strings, 0);
}