X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/4c9cb9b99991c36920bd17e366e2128d1b22eb6e..refs/tags/v0.92.0:/src/out.c diff --git a/src/out.c b/src/out.c index df0d7f5..ee1d328 100644 --- 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();