3 * Copyright (C) 1999,2000 the Free Software Foundation.
4 * Copyright (C) 2000 Eazel, Inc.
5 * Copyright (C) 2001-2011 George (Jiri) Lebl
7 * Author: George (Jiri) Lebl
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
35 static gboolean in_out = TRUE;
37 static gboolean in_outh = TRUE;
39 static gboolean in_outph = TRUE;
44 strchrcnt(char *s, char c)
54 out_printf(FILE *fp, const char *format,...)
63 s = g_strdup_vprintf(format, ap);
67 outline += strchrcnt(s, '\n');
69 outhline += strchrcnt(s, '\n');
71 outphline += strchrcnt(s, '\n');
73 g_assert_not_reached();
80 out_addline_infile(FILE *fp, int line)
82 if(no_lines || no_write)
88 } else if(fp == outh) {
91 } else if(fp == outph) {
95 g_assert_not_reached();
97 fprintf(fp, "#line %d \"%s\"\n", line, filename);
101 out_addline_outfile(FILE *fp)
103 if(no_lines || no_write)
110 fprintf(fp,"#line %d \"%s.c\"\n",outline,filebase);
112 fprintf(fp,"#line %d \"%s.cc\"\n",outline,filebase);
114 } else if(fp == outh) {
117 fprintf(fp,"#line %d \"%s.h\"\n",outhline,filebase);
119 } else if(fp == outph) {
125 fprintf(fp,"#line %d \"%s%sprivate.h\"\n",outphline,filebase,sep);
128 g_assert_not_reached();