#define MY_SIZE 1024 /* Size of an array that actually should be computed. */
-/* Just opens a file, mangling a file name.
+/**
+ * Just opens a file, mangling a file name.
*
- * The name consists of the following parts:
- *
- * @arg basename The basis of the name telling about the content.
- * @arg
+ * The file name results from the concatenation of the following parts:
*
+ * @param basename The basis of the name telling about the content.
+ * @param suffix1 The first suffix.
+ * @param suffix2 The second suffix.
+ * @param suffix3 The third suffix.
*/
-static FILE *text_open (const char *basename, const char * suffix1, const char *suffix2, const char *suffix3) {
+static FILE *text_open(const char *basename, const char * suffix1, const char *suffix2, const char *suffix3) {
FILE *F;
int len = strlen(basename), i, j;
char *fname; /* filename to put the vcg information in */
if (!suffix3) suffix3 = ".txt";
/* open file for vcg graph */
- fname = xmalloc (strlen(basename)*2 + strlen(suffix1) + strlen(suffix2) + 5); /* *2: space for excapes. */
+ fname = xmalloc(strlen(basename)*2 + strlen(suffix1) + strlen(suffix2) + 5); /* *2: space for escapes. */
j = 0;
for (i = 0; i < len; ++i) { /* replace '/' in the name: escape by @. */
}
}
fname[j] = '\0';
- strcat (fname, suffix1); /* append file suffix */
- strcat (fname, suffix2); /* append file suffix */
- strcat (fname, suffix3); /* append the .txt suffix */
+ strcat(fname, suffix1); /* append file suffix */
+ strcat(fname, suffix2); /* append file suffix */
+ strcat(fname, suffix3); /* append the .txt suffix */
- F = fopen (fname, "w"); /* open file for writing */
+ F = fopen(fname, "w"); /* open file for writing */
if (!F) {
+ perror(fname);
assert(0);
}
free(fname);
fprintf(F, "%s %s (%d):", prefix, name, n_nodes);
for (i = 0; i < n_nodes; ++i) {
int rem;
- if (i > 7 && !(i & 7)) { /* line break every eigth node. */
+ if (i > 7 && !(i & 7)) { /* line break every eight node. */
fprintf(F, ",\n%s ", prefix);
comma = "";
}
fprintf(F, "%s %s (%d):", prefix, name, n_nodes);
for (i = 0; i < n_nodes; ++i) {
- if (i > 7 && !(i & 7)) { /* line break every eigth node. */
+ if (i > 7 && !(i & 7)) { /* line break every eight node. */
fprintf(F, ",\n%s ", prefix);
comma = "";
}
}
}
-/* A fast hack to dump a csv. */
+/* A fast hack to dump a CSV-file. */
void dump_typecsv_to_file(FILE *F, ir_type *tp, dump_verbosity verbosity, const char *comma) {
int i;
char buf[1024 + 10];