2 Copyright (C) 1994-2007 Frans Slothouber, Jacco van Weert, Petteri Kettunen,
3 Bernd Koesling, Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner,
4 Sasha Vasko, Kai Hofmann, Thierry Pierron, Friedrich Haase, and Gergely Budai.
6 This file is part of ROBODoc
8 ROBODoc is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 /****h* ROBODoc/ASCII_Generator
27 * ASCII_Generator -- Generator for ASCII output
29 * Plain ascii output, no formatting.
30 * MODIFICATION HISTORY
31 * 2003-06-17 Frans Slothouber V1.0
33 * $Id: ascii_generator.c,v 1.21 2007/07/10 19:13:51 gumpu Exp $
39 #include "ascii_generator.h"
45 #include "headertypes.h"
46 #include "generator.h"
52 /*x**h* ROBODoc/ASCII_Generator
54 * Generator for plain ASCII output
59 /*x**f* ASCII_Generator/RB_ASCII_Generate_Doc_Start
61 * RB_ASCII_Generate_Doc_Start --
65 void RB_ASCII_Generate_Doc_Start(
75 if ( course_of_action.do_toc )
77 fprintf( dest_doc, "TABLE OF CONTENTS\n" );
80 for ( cur_header = first_header, header_nr = 1;
81 cur_header; cur_header = cur_header->next_header, header_nr++ )
83 if ( cur_header->name && cur_header->function_name )
85 fprintf( dest_doc, "%4.4d %s\n",
86 header_nr, cur_header->name );
90 fputc( '\f', dest_doc );
94 /*x**f* ASCII_Generator/RB_ASCII_Generate_Doc_End
96 * RB_ASCII_Generate_Doc_End --
100 void RB_ASCII_Generate_Doc_End(
109 /*x**f* ASCII_Generator/RB_ASCII_Generate_Header_Start
111 * RB_ASCII_Generate_Header_Start --
115 void RB_ASCII_Generate_Header_Start(
117 struct RB_header *cur_header )
119 fprintf( dest_doc, "%s", cur_header->name );
120 fprintf( dest_doc, "\n\n" );
123 void RB_ASCII_Generate_Header_End(
125 struct RB_header *cur_header )
129 "\n---------------------------------------------------------------------------\n" );
130 /* form-feeds are annoying fputc( '\f', dest_doc ); */
133 /*x**f* ASCII_Generator/RB_ASCII_Generate_Empty_Item
135 * RB_ASCII_Generate_Empty_Item --
139 void RB_ASCII_Generate_Empty_Item(
146 /* TODO Documentation */
147 void RB_ASCII_Generate_String(
151 fprintf( dest, "%s", string );
154 /* TODO Documentation */
155 void RB_ASCII_Generate_False_Link(
159 fprintf( dest_doc, "%s", name );
162 /* TODO Documentation */
163 char *RB_ASCII_Get_Default_Extension(
169 /* TODO Documentation */
170 void RB_ASCII_Generate_Item_Name(
174 fprintf( dest_doc, "%s\n", name );
178 /* TODO Documentation */
179 void RB_ASCII_Generate_Item_Begin(
187 /* TODO Documentation */
188 void RB_ASCII_Generate_Char(
192 fputc( c, dest_doc );
196 /* TODO Documentation */
197 void RB_ASCII_Generate_Item_End(
205 static int section_counters[ASCII_MAX_SECTION_DEPTH];
206 void RB_ASCII_Generate_BeginSection(
210 struct RB_header *header )
214 ++section_counters[depth];
215 for ( i = depth + 1; i < ASCII_MAX_SECTION_DEPTH; ++i )
217 section_counters[i] = 0;
219 if ( depth < ASCII_MAX_SECTION_DEPTH )
221 if ( !( course_of_action.do_sectionnameonly ) )
223 for ( i = 1; i <= depth; ++i )
225 fprintf( dest_doc, "%d.", section_counters[i] );
227 fprintf( dest_doc, " " );
230 // Print Header "first" name
231 RB_ASCII_Generate_String( dest_doc, name );
233 // Print further names
234 for ( i = 1; i < header->no_names; i++ )
236 fprintf( dest_doc, ( i % header_breaks ) ? ", " : ",\n" );
237 RB_ASCII_Generate_String( dest_doc, header->names[i] );
240 // Include module name if not sectionnameonly
241 if ( !( course_of_action.do_sectionnameonly ) )
243 fprintf( dest_doc, " [ " );
244 RB_ASCII_Generate_String( dest_doc, header->htype->indexName );
245 fprintf( dest_doc, " ]" );
250 /* too deep, don't do anything. */
255 void RB_ASCII_Generate_EndSection(