- fprintf(F, "\n"); /* a separator */
-}
-
-/**
- * open a vcg file
- *
- * @param irg The graph to be dumped
- * @param suffix1 first filename suffix
- * @param suffix2 second filename suffix
- */
-FILE *vcg_open(ir_graph *irg, const char *suffix1, const char *suffix2) {
- FILE *F;
- const char *nm = get_irg_dump_name(irg);
- int len = strlen(nm), i, j;
- char *fname; /* filename to put the vcg information in */
-
- if (!suffix1) suffix1 = "";
- if (!suffix2) suffix2 = "";
-
- /* open file for vcg graph */
- fname = XMALLOCN(char, len * 2 + strlen(suffix1) + strlen(suffix2) + 5);
-
- /* strncpy (fname, nm, len); */ /* copy the filename */
- j = 0;
- for (i = 0; i < len; ++i) { /* replace '/' in the name: escape by @. */
- if (nm[i] == '/') {
- fname[j] = '@'; j++; fname[j] = '1'; j++;
- } else if (nm[i] == '@') {
- fname[j] = '@'; j++; fname[j] = '2'; j++;
- } else {
- fname[j] = nm[i]; j++;
- }
- }
- fname[j] = '\0';
- strcat(fname, suffix1); /* append file suffix */
- strcat(fname, suffix2); /* append file suffix */
- strcat(fname, ".vcg"); /* append the .vcg suffix */
-
- /* vcg really expect only a <CR> at end of line, so
- * the "b"inary mode is what you mean (and even needed for Win32)
- */
- F = fopen(fname, "wb"); /* open file for writing */
- if (!F) {
- perror(fname);
- }
- xfree(fname);
-
- return F;
-}
-
-/**
- * open a vcg file
- *
- * @param name prefix file name
- * @param suffix filename suffix
- */
-FILE *vcg_open_name(const char *name, const char *suffix) {
- FILE *F;
- char *fname; /* filename to put the vcg information in */
- int i, j, len = strlen(name);
-
- if (!suffix) suffix = "";
-
- /** open file for vcg graph */
- fname = XMALLOCN(char, len * 2 + 5 + strlen(suffix));
- /* strcpy (fname, name);*/ /* copy the filename */
- j = 0;
- for (i = 0; i < len; ++i) { /* replace '/' in the name: escape by @. */
- if (name[i] == '/') {
- fname[j] = '@'; j++; fname[j] = '1'; j++;
- } else if (name[i] == '@') {
- fname[j] = '@'; j++; fname[j] = '2'; j++;
- } else {
- fname[j] = name[i]; j++;
- }
- }
- fname[j] = '\0';
- strcat(fname, suffix);
- strcat(fname, ".vcg"); /* append the .vcg suffix */
-
- /* vcg really expect only a <CR> at end of line, so
- * the "b"inary mode is what you mean (and even needed for Win32)
- */
- F = fopen(fname, "wb"); /* open file for writing */
- if (!F) {
- perror(fname);
- }
- xfree(fname);
-
- return F;