]> git.draconx.ca Git - gob-dx.git/blobdiff - src/out.c
Release 0.91.2
[gob-dx.git] / src / out.c
index df0d7f57f6ccc6c03204a4ac1798cdb4feb5e42e..ee1d3289d3853cda215208b390f3900e0d6acd9b 100644 (file)
--- a/src/out.c
+++ b/src/out.c
@@ -6,12 +6,16 @@
 
 extern FILE *out;
 extern FILE *outh;
+extern FILE *outph;
+
+extern gboolean for_cpp;
 
 extern char *filename;
 extern char *filebase;
 
 int outline = 1;
 int outhline = 1;
+int outphline = 1;
 
 static int
 strchrcnt(char *s, char c)
@@ -28,21 +32,22 @@ out_printf(FILE *fp,char *format,...)
 {
        va_list ap;
        char *s;
+
        va_start(ap,format);
-       
        s = g_strdup_vprintf(format,ap);
+       va_end(ap);
 
        if(fp == out)
                outline += strchrcnt(s,'\n');
        else if(fp == outh)
                outhline += strchrcnt(s,'\n');
+       else if(fp == outph)
+               outphline += strchrcnt(s,'\n');
        else
                g_assert_not_reached();
 
        fprintf(fp,"%s",s);
        g_free(s);
-
-       va_end(ap);
 }
 
 void
@@ -52,6 +57,8 @@ out_addline_infile(FILE *fp, int line)
                outline++;
        else if(fp == outh)
                outhline++;
+       else if(fp == outph)
+               outphline++;
        else
                g_assert_not_reached();
 
@@ -63,10 +70,16 @@ out_addline_outfile(FILE *fp)
 {
        if(fp == out) {
                outline++;
-               fprintf(fp,"#line %d \"%s.c\"\n",outline,filebase);
+               if(!for_cpp)
+                       fprintf(fp,"#line %d \"%s.c\"\n",outline,filebase);
+               else
+                       fprintf(fp,"#line %d \"%s.cc\"\n",outline,filebase);
        } else if(fp == outh) {
                outhline++;
                fprintf(fp,"#line %d \"%s.h\"\n",outhline,filebase);
+       } else if(fp == outph) {
+               outphline++;
+               fprintf(fp,"#line %d \"%s-private.h\"\n",outphline,filebase);
        } else
                g_assert_not_reached();