]> git.draconx.ca Git - gob-dx.git/blobdiff - src/out.c
Release 2.0.15
[gob-dx.git] / src / out.c
index 77dabd1b752be2e049878612fa2bc3ae72afabbb..b6371f6ad1c63e936ad10d1e0135d122708e9326 100644 (file)
--- a/src/out.c
+++ b/src/out.c
@@ -13,6 +13,8 @@ static gboolean in_outh = TRUE;
 int outphline = 1;
 static gboolean in_outph = TRUE;
 
+extern char file_sep;
+
 static int
 strchrcnt(char *s, char c)
 {
@@ -24,31 +26,37 @@ strchrcnt(char *s, char c)
 }
 
 void
-out_printf(FILE *fp,char *format,...)
+out_printf(FILE *fp, const char *format,...)
 {
        va_list ap;
        char *s;
 
-       va_start(ap,format);
-       s = g_strdup_vprintf(format,ap);
+       if (no_write)
+               return;
+
+       va_start(ap, format);
+       s = g_strdup_vprintf(format, ap);
        va_end(ap);
 
        if(fp == out)
-               outline += strchrcnt(s,'\n');
+               outline += strchrcnt(s, '\n');
        else if(fp == outh)
-               outhline += strchrcnt(s,'\n');
+               outhline += strchrcnt(s, '\n');
        else if(fp == outph)
-               outphline += strchrcnt(s,'\n');
+               outphline += strchrcnt(s, '\n');
        else
                g_assert_not_reached();
 
-       fprintf(fp,"%s",s);
+       fprintf(fp, "%s", s);
        g_free(s);
 }
 
 void
 out_addline_infile(FILE *fp, int line)
 {
+       if(no_lines || no_write)
+               return;
+
        if(fp == out) {
                outline++;
                in_out = FALSE;
@@ -61,12 +69,15 @@ out_addline_infile(FILE *fp, int line)
        } else
                g_assert_not_reached();
 
-       fprintf(fp,"#line %d \"%s\"\n",line,filename);
+       fprintf(fp, "#line %d \"%s\"\n", line, filename);
 }
 
 void
 out_addline_outfile(FILE *fp)
 {
+       if(no_lines || no_write)
+               return;
+
        if(fp == out) {
                if(in_out) return;
                outline++;
@@ -83,7 +94,7 @@ out_addline_outfile(FILE *fp)
        } else if(fp == outph) {
                if(in_outph) return;
                outphline++;
-               fprintf(fp,"#line %d \"%s-private.h\"\n",outphline,filebase);
+               fprintf(fp,"#line %d \"%s%cprivate.h\"\n",outphline,filebase,file_sep);
                in_outph = TRUE;
        } else
                g_assert_not_reached();