3 Copyright (C) 1994-2007 Frans Slothouber, Jacco van Weert, Petteri Kettunen,
4 Bernd Koesling, Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner,
5 Sasha Vasko, Kai Hofmann, Thierry Pierron, Friedrich Haase, and Gergely Budai.
7 This file is part of ROBODoc
9 ROBODoc 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 3 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, see <http://www.gnu.org/licenses/>.
26 /****h* ROBODoc/Generator
28 * This contains routines to generate the documentation from the
29 * headers collected from the source code. It contains
30 * functionality common for all document types (HTML, RTF etc).
31 * The specifics are handled in the modules for each of the several
34 * The behaviour of many of the functions in this module are
35 * modified by the global output_mode.
37 * The general call sequence is as follows:
38 * RB_Generate_Documentation
39 * +> RB_Generate_SingleDoc
42 * +> Generate_Item_Line
45 * o Confusing use of doctype and output mode.
47 * Might be a good idea to replace all the switch statements with
50 * switch (output_mode)
53 * RB_HTML_Generate_Doc_Start(dest_doc, src_name, name, toc);
56 * RB_LaTeX_Generate_Doc_Start(dest_doc, src_name, name, toc);
59 * RB_RTF_Generate_Doc_Start(dest_doc, src_name, name, toc);
62 * RB_ASCII_Generate_Doc_Start(dest_doc, src_name, name, toc);
65 * RB_TROFF_Generate_Doc_Start(dest_doc, src_name, name, toc);
71 * (*rb_generate_doc_start)(dest_doc, src_name, name, toc);
73 * were the function pointers are initialized at program start based
76 * $Id: generator.c,v 1.106 2007/07/10 19:13:51 gumpu Exp $
91 #include "generator.h"
95 #include "roboconfig.h"
98 #include "html_generator.h"
99 #include "latex_generator.h"
100 #include "xmldocbook_generator.h"
101 #include "rtf_generator.h"
102 #include "troff_generator.h"
103 #include "ascii_generator.h"
104 #include "test_generator.h"
106 /* TODO This should not be here.... */
107 #include "analyser.h"
114 /* Module functions */
115 // static void RB_Generate_Empty_Item( FILE * dest_doc );
117 static void Generate_Item_Line(
122 struct RB_header *fnames );
126 static void Generate_Index(
127 struct RB_Document *document );
129 static void Generate_Header(
131 struct RB_Document *document,
132 struct RB_header *header,
135 static void Generate_Begin_Paragraph(
137 static void Generate_End_Paragraph(
139 static void Format_Line(
142 static void Generate_Begin_Preformatted(
145 static void Generate_End_Preformatted(
147 static void Generate_Begin_List_Item(
149 static void Generate_End_List_Item(
151 static void Generate_Begin_List(
153 static void Generate_End_List(
155 static void Pipe_Line(
159 static char piping = FALSE;
162 /* TODO Documentation */
163 void RB_Generate_False_Link(
167 switch ( output_mode )
170 RB_TEST_Generate_False_Link( dest_doc, name );
173 RB_XMLDB_Generate_False_Link( dest_doc, name );
176 RB_HTML_Generate_False_Link( dest_doc, name );
179 RB_LaTeX_Generate_False_Link( dest_doc, name );
182 RB_RTF_Generate_False_Link( dest_doc, name );
185 RB_ASCII_Generate_False_Link( dest_doc, name );
188 RB_TROFF_Generate_False_Link( dest_doc, name );
196 /****f* Generator/RB_Generate_Item_Begin
198 * Generate the begin of an item. This should switch to some
199 * preformatted output mode, similar to HTML's <PRE>.
202 void RB_Generate_Item_Begin(
207 * dest_doc -- file to be written to
208 * output_mode -- global with the current output mode
212 switch ( output_mode )
215 RB_TEST_Generate_Item_Begin( dest_doc );
218 RB_XMLDB_Generate_Item_Begin( dest_doc );
221 RB_HTML_Generate_Item_Begin( dest_doc, name );
224 RB_LaTeX_Generate_Item_Begin( dest_doc );
227 RB_RTF_Generate_Item_Begin( dest_doc );
230 RB_ASCII_Generate_Item_Begin( dest_doc );
244 /****f* Generator/Generate_Label
246 * Generate a label that can be used for a link.
247 * For instance in HTML this is <a name="label">
255 * * dest_doc -- file to be written to
256 * * name -- the label's name.
257 * * output_mode -- global with the current output mode
261 switch ( output_mode )
264 RB_TEST_Generate_Label( dest_doc, name );
267 RB_XMLDB_Generate_Label( dest_doc, name );
270 RB_HTML_Generate_Label( dest_doc, name );
273 /* lowtexx 21.09.2005 11:33 */
274 RB_LaTeX_Generate_Label( dest_doc, name );
277 RB_RTF_Generate_Label( dest_doc, name );
294 /****f* Generator/RB_Generate_Item_End
296 * Generate the end of an item. This should switch back from the
297 * preformatted mode. So in HTML it generates the </PRE> of a <PRE>
300 * * dest_doc -- file to be written to
301 * * output_mode -- global with the current output mode
305 void RB_Generate_Item_End(
309 switch ( output_mode )
312 RB_TEST_Generate_Item_End( dest_doc );
315 RB_XMLDB_Generate_Item_End( dest_doc );
318 RB_HTML_Generate_Item_End( dest_doc, name );
321 if ( piping == TRUE )
323 fprintf( dest_doc, "\\begin{verbatim}\n" );
326 RB_LaTeX_Generate_Item_End( dest_doc );
329 RB_RTF_Generate_Item_End( dest_doc );
332 RB_ASCII_Generate_Item_End( dest_doc );
335 /* Doesn't apply */ break;
347 /****f Generator/RB_Get_Len_Extension
349 * Compute the length of the filename extension for
350 * the current document type.
354 size_t RB_Get_Len_Extension(
359 size = strlen( extension );
360 if ( *extension != '.' )
365 /****f* Generator/RB_Add_Extension
367 * Add an extension to the filename base based on on the current
370 * * doctype -- output mode
371 * * name -- the name of the file without extension and with
372 * enough room left to add the extension.
374 * name -- the name of the file including the extension.
378 void RB_Add_Extension(
382 if ( *extension != '.' )
384 strcat( name, extension );
389 /*x**f Generator/RB_Default_Len_Extension
391 * Returns default extension for
392 * the current document type.
396 char *RB_Get_Default_Extension(
397 T_RB_DocType doctype )
399 char *extension = NULL;
404 extension = RB_TEST_Get_Default_Extension( );
407 extension = RB_XMLDB_Get_Default_Extension( );
410 extension = RB_HTML_Get_Default_Extension( );
413 extension = RB_LaTeX_Get_Default_Extension( );
416 extension = RB_RTF_Get_Default_Extension( );
419 extension = RB_ASCII_Get_Default_Extension( );
422 extension = RB_TROFF_Get_Default_Extension( );
432 /****f* Generator/RB_Generate_BeginSection
434 * Generate a section of level depth in the current output mode.
435 * This is used for the --sections option. Where each header is
436 * placed in a section based on the header hierarchy.
438 * * dest_doc -- the destination file.
439 * * doctype -- document type
440 * * depth -- the level of the section
441 * * name -- the name of the section
442 * * header -- pointer to the header structure
443 * * output_mode -- global with the current output mode.
447 void RB_Generate_BeginSection(
451 struct RB_header *header )
453 switch ( output_mode )
456 RB_TEST_Generate_BeginSection( dest_doc, depth, name );
459 RB_XMLDB_Generate_BeginSection( dest_doc, depth, name );
462 RB_HTML_Generate_BeginSection( dest_doc, depth, name, header );
465 RB_LaTeX_Generate_BeginSection( dest_doc, depth, name, header );
468 RB_RTF_Generate_BeginSection( dest_doc, depth, name );
471 /* RB_TROFF_Generate_BeginSection( dest_doc, depth, name ); */
474 RB_ASCII_Generate_BeginSection( dest_doc, depth, name, header );
485 /****f* Generator/RB_Generate_EndSection
487 * Generate the end of a section base on the current output mode.
488 * The functions is used for the --section option.
489 * It closes a section in the current output mode.
491 * * dest_doc -- the destination file.
493 * * depth -- the level of the section
494 * * name -- the name of the section
495 * * output_mode -- global with the current output mode.
499 void RB_Generate_EndSection(
504 switch ( output_mode )
507 RB_TEST_Generate_EndSection( dest_doc, depth, name );
510 RB_XMLDB_Generate_EndSection( dest_doc, depth, name );
513 RB_HTML_Generate_EndSection( dest_doc, depth, name );
516 RB_LaTeX_Generate_EndSection( dest_doc, depth, name );
519 RB_RTF_Generate_EndSection( dest_doc, depth, name );
525 RB_HTML_Generate_EndSection( dest_doc, depth, name );
537 /****f* Generator/RB_Generate_Index_Entry
539 * Generate an entry for an auto generated index. This works only
540 * for output modes that support this, LaTeX for instance. This
541 * has nothting to do with the master index.
544 void RB_Generate_Index_Entry(
546 T_RB_DocType doctype,
547 struct RB_header *header )
550 * * dest_doc -- the destination file.
551 * * header -- pointer to the header the index entry is for.
552 * * output_mode -- global with the current output mode.
568 RB_LaTeX_Generate_Index_Entry( dest_doc, header );
574 /* No index available */
577 /* No index available */
588 /****f* Generator/RB_Generate_TOC_2
590 * Create a Table of Contents based on the headers found in
591 * _all_ source files. There is also a function to create
592 * a table of contents based on the headers found in a single
593 * source file RB_Generate_TOC_1
596 void RB_Generate_TOC_2(
598 struct RB_header **headers,
600 struct RB_Part *owner,
604 * * dest_doc -- the destination file.
605 * * headers -- an array of pointers to all the headers.
606 * * count -- the number of pointers in the array.
607 * * output_mode -- global with the current output mode.
608 * * owner -- The owner of the TOC. Only the headers that are owned
609 * by this owner are included in the TOC. Can be NULL,
610 * in which case all headers are included.
614 switch ( output_mode )
623 RB_HTML_Generate_TOC_2( dest_doc, headers, count, owner, dest_name );
626 /* LaTeX has it's own mechanism for creating
627 * a table of content */
630 RB_RTF_Generate_TOC_2( dest_doc, headers, count );
633 /* TODO: No TOC in ASCII mode */
645 /****f* Generator/RB_Generate_Doc_Start
647 * RB_Generate_Doc_Start -- Generate document header.
650 void RB_Generate_Doc_Start(
651 struct RB_Document *document,
660 * Generates for depending on the output_mode the text that
661 * will be at the start of a document.
662 * Including the table of contents.
664 * o dest_doc - pointer to the file to which the output will
666 * o src_name - the name of the source file or directory.
667 * o name - the name of this file.
668 * o output_mode - global variable that indicates the output
670 * o toc - generate table of contens
672 * RB_Generate_Doc_End
676 switch ( output_mode )
679 RB_TEST_Generate_Doc_Start( dest_doc, src_name, title, toc );
682 RB_XMLDB_Generate_Doc_Start( document, dest_doc, charset );
685 RB_HTML_Generate_Doc_Start( dest_doc, src_name, title, dest_name,
689 RB_LaTeX_Generate_Doc_Start( dest_doc, src_name, title, charset );
692 RB_RTF_Generate_Doc_Start( dest_doc, src_name, title, toc );
695 RB_ASCII_Generate_Doc_Start( dest_doc, src_name, title, toc );
709 /****f* Generator/RB_Generate_Doc_End
711 * RB_Generate_Doc_End -- generate document trailer.
714 void RB_Generate_Doc_End(
720 * Generates for depending on the output_mode the text that
721 * will be at the end of a document.
723 * o dest_doc - pointer to the file to which the output will
725 * o name - the name of this file.
726 * o output_mode - global variable that indicates the output
729 * Doesn't do anything with its arguments, but that might
730 * change in the future.
735 switch ( output_mode )
738 RB_TEST_Generate_Doc_End( dest_doc, name );
741 RB_XMLDB_Generate_Doc_End( dest_doc, name );
744 RB_HTML_Generate_Doc_End( dest_doc, name, src_name );
747 RB_LaTeX_Generate_Doc_End( dest_doc, name );
750 RB_RTF_Generate_Doc_End( dest_doc, name );
766 /****f* Generator/RB_Generate_Header_Start [3.0h]
768 * RB_Generate_Header_Start -- generate header start text.
771 FILE *RB_Generate_Header_Start(
773 struct RB_header *cur_header )
776 * Generates depending on the output_mode the text that
777 * will be at the end of each header.
779 * o dest_doc - pointer to the file to which the output will
781 * o cur_header - pointer to a RB_header structure.
783 * RB_Generate_Header_End
787 switch ( output_mode )
790 RB_TEST_Generate_Header_Start( dest_doc, cur_header );
793 RB_XMLDB_Generate_Header_Start( dest_doc, cur_header );
796 RB_HTML_Generate_Header_Start( dest_doc, cur_header );
799 RB_LaTeX_Generate_Header_Start( dest_doc, cur_header );
802 RB_RTF_Generate_Header_Start( dest_doc, cur_header );
805 RB_ASCII_Generate_Header_Start( dest_doc, cur_header );
808 dest_doc = RB_TROFF_Generate_Header_Start( dest_doc, cur_header );
820 /****f* Generator/RB_Generate_Header_End [3.0h]
822 * RB_Generate_Header_End
825 void RB_Generate_Header_End(
827 struct RB_header *cur_header )
830 * Generates for depending on the output_mode the text that
831 * will be at the end of a header.
832 * This function is used if the option --section is _not_
835 * o dest_doc - pointer to the file to which the output will
837 * o cur_header - pointer to a RB_header structure.
839 * RB_Generate_Header_Start, RB_Generate_EndSection,
840 * RB_Generate_BeginSection
844 switch ( output_mode )
845 { /* switch by *koessi */
847 RB_TEST_Generate_Header_End( dest_doc, cur_header );
850 RB_XMLDB_Generate_Header_End( dest_doc, cur_header );
853 RB_HTML_Generate_Header_End( dest_doc, cur_header );
856 RB_LaTeX_Generate_Header_End( dest_doc, cur_header );
859 RB_RTF_Generate_Header_End( dest_doc, cur_header );
862 RB_ASCII_Generate_Header_End( dest_doc, cur_header );
865 RB_TROFF_Generate_Header_End( dest_doc, cur_header );
876 /****f* Generator/Generate_Item_Name [2.01]
878 * Generate_Item_Name -- fast&easy
881 void Generate_Item_Name(
886 * write the item's name to the doc
888 * o FILE* dest_doc -- destination file
889 * o int item_type -- the type of item
893 * uses globals: output_mode
897 char *name = configuration.items.names[item_type];
899 switch ( output_mode )
902 RB_TEST_Generate_Item_Name( dest_doc, name );
905 RB_XMLDB_Generate_Item_Name( dest_doc, name );
908 RB_HTML_Generate_Item_Name( dest_doc, name );
911 RB_LaTeX_Generate_Item_Name( dest_doc, name );
914 RB_RTF_Generate_Item_Name( dest_doc, name );
917 RB_ASCII_Generate_Item_Name( dest_doc, name );
920 RB_TROFF_Generate_Item_Name( dest_doc, name, item_type );
932 void Generate_Begin_Content(
935 switch ( output_mode )
938 HTML_Generate_Begin_Content( dest_doc );
945 void Generate_End_Content(
948 switch ( output_mode )
951 HTML_Generate_End_Content( dest_doc );
958 void Generate_Begin_Navigation(
961 switch ( output_mode )
964 HTML_Generate_Begin_Navigation( dest_doc );
972 void Generate_End_Navigation(
975 switch ( output_mode )
978 HTML_Generate_End_Navigation( dest_doc );
986 void Generate_IndexMenu(
989 struct RB_Document *document )
991 switch ( output_mode )
994 RB_HTML_Generate_IndexMenu( dest_doc, filename, document, NULL );
1002 void Generate_Header_IndexMenu(
1005 struct RB_Part *owner,
1006 struct RB_Document *document )
1008 switch ( output_mode )
1011 RB_HTML_Generate_Header_IndexMenu( dest_doc, filename,
1012 document, owner, NULL );
1020 void Generate_Module_IndexMenu(
1023 struct RB_Document *document )
1025 switch ( output_mode )
1028 RB_HTML_Generate_Module_IndexMenu( dest_doc, filename,
1037 void Generate_Begin_Extra(
1040 switch ( output_mode )
1043 HTML_Generate_Begin_Extra( dest_doc );
1050 void Generate_End_Extra(
1053 switch ( output_mode )
1056 HTML_Generate_End_Extra( dest_doc );
1068 /* TODO Documentation */
1069 void RB_Generate_Nav_Bar(
1070 struct RB_Document *document,
1072 struct RB_header *current_header )
1074 switch ( output_mode )
1081 if ( course_of_action.do_one_file_per_header )
1087 RB_HTML_Generate_Nav_Bar( document, current_doc, current_header );
1107 /* TODO Documentation */
1116 switch ( output_mode )
1124 RB_HTML_Generate_Extra( dest_doc, item_type, cur_char,
1137 res = RB_TROFF_Generate_Extra( dest_doc, item_type, cur_char );
1149 /****f* Generator/RB_Name_Headers
1151 * Give all headers a unique name. This makes sure that if
1152 * two headers have the same name linking to one of the headers
1156 void RB_Name_Headers(
1157 struct RB_header **headers,
1162 #define MAX_UNIQUE_ID_LENGTH 80
1165 char id[MAX_UNIQUE_ID_LENGTH + 1];
1167 RB_Say( "Assigning headers a unique name.\n", SAY_DEBUG );
1168 for ( i = 0; i < count; ++i )
1170 struct RB_header *header;
1172 header = headers[i];
1173 sprintf( id, "robo%d", i );
1174 header->unique_name = RB_StrDup( id );
1180 /****f* Generator/RB_Sort_Items
1182 * Sort the items in all the headers according to the order
1183 * specified in the 'item order' block in the robodoc.rc
1187 static void RB_Sort_Items(
1188 struct RB_header **headers,
1194 int n_order = configuration.item_order.number;
1200 int max_number_of_items = 0;
1201 struct RB_Item **items = NULL;
1202 struct RB_Item **items_sorted = NULL;
1204 RB_Say( "Sorting items in %d headers.\n", SAY_DEBUG, header_count );
1206 /* Compute the maximum number of items in any given header */
1207 for ( j = 0; j < header_count; ++j )
1209 struct RB_header *header;
1210 struct RB_Item *item;
1213 header = headers[j];
1214 for ( item = header->items; item; item = item->next )
1219 if ( item_count > max_number_of_items )
1221 max_number_of_items = item_count;
1224 /* Allocate an array for the items, this makes it easier to
1227 RB_Say( "Largest header has %d items.\n", SAY_DEBUG,
1228 max_number_of_items );
1230 if ( max_number_of_items == 0 )
1232 /* No items in any of the headers, do nothing */
1236 items = calloc( max_number_of_items, sizeof( struct RB_Item * ) );
1238 calloc( max_number_of_items, sizeof( struct RB_Item * ) );
1241 for ( j = 0; j < header_count; ++j )
1243 struct RB_header *header = NULL;
1244 struct RB_Item *item = NULL;
1246 int sorted_item_index = 0;
1249 header = headers[j];
1251 /* Copy item pointers to array */
1252 for ( item = header->items; item;
1253 item = item->next, ++item_index )
1255 items[item_index] = item;
1256 items_sorted[item_index] = item;
1258 item_count = item_index;
1260 if ( item_count == 0 )
1262 /* No items in this header, do nothing. */
1266 assert( item_count <= max_number_of_items );
1268 /* First copy the items in the order that is defined in
1269 * item_order[] to sorted_items[] */
1270 sorted_item_index = 0;
1271 for ( i = 0; i < n_order; ++i )
1273 for ( item_index = 0; item_index < item_count;
1276 if ( items[item_index] )
1279 ( configuration.items.
1280 names[items[item_index]->type],
1281 configuration.item_order.names[i] ) ==
1284 /* copy to items_sorted */
1285 items_sorted[sorted_item_index] =
1287 ++sorted_item_index;
1288 items[item_index] = NULL;
1293 /* Then copy the remaining items to items_sorted[] */
1294 for ( item_index = 0; item_index < item_count;
1297 if ( items[item_index] )
1299 /* copy to items_sorted */
1300 items_sorted[sorted_item_index] =
1302 ++sorted_item_index;
1303 items[item_index] = NULL;
1307 assert( sorted_item_index == item_count );
1309 /* Now copy the items in items_sorted[] back into the linked list in
1311 if ( item_count > 1 )
1313 /* Chain all the items */
1314 for ( item_index = 0; item_index < item_count - 1;
1317 items_sorted[item_index]->next =
1318 items_sorted[item_index + 1];
1322 assert( item_count > 0 );
1323 items_sorted[item_count - 1]->next = NULL;
1324 /* now link the first item to the header. */
1325 header->items = items_sorted[0];
1329 free( items_sorted );
1334 RB_Say( "Done sorting items in %d headers.\n", SAY_DEBUG, header_count );
1340 /****f* Generator/RB_Generate_Documentation
1342 * Generate the documentation for all the information contained in a
1343 * RB_Document structure.
1346 void RB_Generate_Documentation(
1347 struct RB_Document *document )
1350 * document -- pointer to the RB_Document structure.
1354 RB_SetCurrentFile( NULL );
1358 if ( document->actions.do_singledoc )
1360 RB_Generate_SingleDoc( document );
1362 else if ( document->actions.do_multidoc )
1364 RB_Generate_MultiDoc( document );
1366 else if ( document->actions.do_singlefile )
1368 RB_Generate_SingleDoc( document );
1374 /****f* Generator/RB_Generate_MultiDoc
1376 * Create documentation by creating a file for each
1377 * individual source file that was scanned.
1380 void RB_Generate_MultiDoc(
1381 struct RB_Document *document )
1384 * document -- pointer to the RB_Document structure.
1388 struct RB_Part *i_part;
1389 FILE *document_file = NULL;
1391 RB_Document_Determine_DocFilePaths( document );
1392 RB_Document_Create_DocFilePaths( document );
1393 if ( document->actions.do_one_file_per_header )
1395 RB_Document_Split_Parts( document );
1397 RB_Document_Determine_DocFileNames( document );
1398 RB_Document_Collect_Headers( document );
1399 if ( document->actions.do_nosort )
1405 RB_Document_Sort_Headers( document );
1407 RB_Document_Link_Headers( document );
1408 RB_Fill_Header_Filename( document );
1409 RB_Name_Headers( document->headers, document->no_headers );
1410 RB_Sort_Items( document->headers, document->no_headers );
1411 RB_CollectLinks( document, document->headers, document->no_headers );
1412 if ( output_mode == HTML )
1414 RB_Create_CSS( document );
1418 for ( i_part = document->parts; i_part != NULL; i_part = i_part->next )
1421 char *srcname = Get_Fullname( i_part->filename );
1422 char *docname = RB_Get_FullDocname( i_part->filename );
1424 /* Nothing found in this part, do not generate it */
1425 if ( i_part->headers == 0 )
1428 if ( output_mode != TROFF )
1430 document_file = RB_Open_Documentation( i_part );
1431 RB_Generate_Doc_Start( document,
1432 document_file, srcname,
1433 i_part->filename->name, 1,
1434 docname, document->charset );
1436 Generate_Begin_Navigation( document_file );
1437 if ( document->actions.do_one_file_per_header )
1439 if ( document->actions.do_module_index_menu )
1441 if ( i_part->headers[0].htype->typeCharacter == 'h' )
1442 Generate_Module_IndexMenu( document_file, docname,
1445 Generate_Header_IndexMenu( document_file, docname,
1450 RB_HTML_Generate_Nav_Bar_One_File_Per_Header( document,
1458 Generate_IndexMenu( document_file, docname, document );
1460 Generate_End_Navigation( document_file );
1462 Generate_Begin_Content( document_file );
1464 if ( ( document->actions.do_toc ) && document->no_headers )
1466 RB_Generate_TOC_2( document_file,
1467 document->headers, document->no_headers,
1470 RB_Generate_Part( document_file, document, i_part );
1472 if ( document->actions.do_header_toc && output_mode == HTML )
1474 if ( document->actions.do_one_file_per_header &&
1475 i_part->headers[0].htype->typeCharacter == 'h' )
1476 RB_HTML_Generate_TOC_Entries( document_file,
1478 document->no_headers,
1482 Generate_End_Content( document_file );
1484 RB_Generate_Doc_End( document_file, docname, srcname );
1485 fclose( document_file );
1489 RB_Generate_Part( document_file, document, i_part );
1493 if ( document->actions.do_index )
1495 Generate_Index( document );
1504 /****f* Generator/RB_Generate_SingleDoc
1506 * Create documentation by creating a single file for all individual
1507 * source file that were scanned.
1509 * This function is called when the option --singledoc is used.
1510 * Based on whether the option --sections is used this function then
1511 * calls RB_Generate_Sections or RB_Generate_Part
1514 void RB_Generate_SingleDoc(
1515 struct RB_Document *document )
1518 * document -- pointer to the RB_Document structure.
1522 FILE *document_file;
1523 struct RB_Part *i_part;
1525 RB_Document_Collect_Headers( document );
1526 if ( document->actions.do_nosort )
1532 RB_Document_Sort_Headers( document );
1534 RB_Document_Link_Headers( document );
1535 RB_Fill_Header_Filename( document );
1536 RB_Name_Headers( document->headers, document->no_headers );
1537 RB_Sort_Items( document->headers, document->no_headers );
1538 RB_CollectLinks( document, document->headers, document->no_headers );
1540 for ( i_part = document->parts; i_part != NULL; i_part = i_part->next )
1542 RB_Set_FullDocname( i_part->filename, document->singledoc_name );
1545 if ( output_mode == HTML )
1547 RB_Create_CSS( document );
1550 document_file = RB_Open_SingleDocumentation( document );
1551 assert( document->parts->filename->name );
1554 RB_Generate_Doc_Start( document,
1556 document->srcroot->name,
1557 document->singledoc_name, 1,
1558 document->singledoc_name, document->charset );
1560 if ( ( document->actions.do_toc ) && document->no_headers )
1562 RB_Generate_TOC_2( document_file,
1563 document->headers, document->no_headers, NULL,
1564 document->parts->filename->name );
1566 if ( document->actions.do_sections )
1568 RB_Generate_Sections( document_file, document );
1572 for ( i_part = document->parts;
1573 i_part != NULL; i_part = i_part->next )
1575 RB_Generate_Part( document_file, document, i_part );
1579 if ( document->actions.do_header_toc && output_mode == HTML )
1581 if ( i_part->headers[0].htype->typeCharacter == 'h' )
1582 RB_HTML_Generate_TOC_Entries( document_file,
1584 document->no_headers,
1586 document->parts->filename->name );
1589 RB_Generate_Doc_End( document_file, "singledoc",
1590 document->srcroot->name );
1591 fclose( document_file );
1599 /****f* Generator/RB_Generate_Sections
1601 * Creates the documentation for all headers found in all source
1602 * files. The order in which they are generated depends on the
1603 * header hierarchy. First the top level header's documentation
1604 * is generated then, the documentation for all it's childern, then
1605 * the next top level header's documentation is generated.
1606 * This is a recursive proces.
1607 * The idea is to create something like:
1611 * 1.2.1 Child's child1
1616 void RB_Generate_Sections(
1617 FILE *document_file,
1618 struct RB_Document *document )
1621 * o document_file -- destination file.
1622 * o document -- pointer to the RB_Document structure.
1628 struct RB_header *header;
1630 depth = document->first_section_level;
1632 RB_Say( "Generating Sections\n", SAY_INFO );
1633 for ( i = 0; i < document->no_headers; ++i )
1635 header = ( document->headers )[i];
1636 if ( header->parent )
1638 /* This will be in one of the subsections */
1642 RB_Generate_Section( document_file, header, document, depth );
1651 /****f* Generator/RB_Generate_Section
1653 * Generate the documentation for a header and all
1656 * o document_file -- destination file
1657 * o parent -- the parent of the header for which the documentation
1658 * is to be generated.
1659 * o document -- pointer to the RB_Document structure.
1660 * o depth -- level of sectioning ( 1 1.1 1.1.1 etc)
1663 void RB_Generate_Section(
1664 FILE *document_file,
1665 struct RB_header *parent,
1666 struct RB_Document *document,
1670 * This is a recursive function.
1672 * RB_Generate_Sections
1677 struct RB_header *header;
1680 // We pass either modulename/name or just the name
1681 if ( course_of_action.do_sectionnameonly )
1683 headername = parent->function_name;
1687 headername = parent->name;
1690 switch ( output_mode )
1694 RB_Generate_BeginSection( document_file, depth, headername,
1696 /* Docbook output does not like the labels to be
1697 * generated before the <section> part
1699 Generate_Label( document_file, parent->unique_name );
1700 Generate_Label( document_file, parent->name );
1703 /* lowtexx 21.09.2005 11:37 */
1706 RB_Generate_BeginSection( document_file, depth, headername,
1708 /* We have to start section before labeling in latex */
1709 Generate_Label( document_file, parent->unique_name );
1710 Generate_Label( document_file, parent->name );
1716 Generate_Label( document_file, parent->unique_name );
1717 Generate_Label( document_file, parent->name );
1718 RB_Generate_BeginSection( document_file, depth, headername,
1724 RB_Generate_Nav_Bar( document, document_file, parent );
1725 RB_Generate_Index_Entry( document_file, document->doctype, parent );
1726 Generate_Header( document_file, document, parent, "dummy" );
1727 for ( i = 0; i < document->no_headers; ++i )
1729 header = ( document->headers )[i];
1730 if ( header->parent == parent )
1732 RB_Generate_Section( document_file, header, document, depth + 1 );
1739 RB_Generate_EndSection( document_file, depth, parent->name );
1746 /****f* Generator/RB_Generate_Part
1748 * Generate the documention for all the headers found in a single
1752 void RB_Generate_Part(
1753 FILE *document_file,
1754 struct RB_Document *document,
1755 struct RB_Part *part )
1758 * * document_file -- The file were it stored.
1759 * * document -- All the documentation.
1760 * * part -- pointer to a RB_Part that contains all the headers found
1761 * in a single source file.
1765 struct RB_header *i_header;
1766 char *docname = NULL;
1767 char *srcname = Get_Fullname( part->filename );
1769 RB_Say( "generating documentation for file \"%s\"\n", SAY_INFO, srcname );
1770 if ( document->actions.do_singledoc )
1772 docname = document->singledoc_name;
1774 else if ( document->actions.do_multidoc )
1776 docname = RB_Get_FullDocname( part->filename );
1778 else if ( document->actions.do_singlefile )
1780 docname = document->singledoc_name;
1787 if ( output_mode == TROFF )
1789 RB_TROFF_Set_Param( document->compress, document->section );
1792 for ( i_header = part->headers; i_header; i_header = i_header->next )
1794 RB_Say( "generating documentation for header \"%s\"\n", SAY_INFO,
1796 document_file = RB_Generate_Header_Start( document_file, i_header );
1797 RB_Generate_Nav_Bar( document, document_file, i_header );
1798 RB_Generate_Index_Entry( document_file, document->doctype, i_header );
1799 Generate_Header( document_file, document, i_header, docname );
1800 RB_Generate_Header_End( document_file, i_header );
1807 /****f* Generator/RB_Get_DOT_Type
1809 * Returns the type of the DOT file for the given output mode
1812 char *RB_Get_DOT_Type(
1815 switch ( output_mode )
1818 return DOT_HTML_TYPE;
1822 return DOT_LATEX_TYPE;
1835 /****f* Generator/RB_Generate_DOT_Image_Link
1837 * Generates the image link for the created dot graphics
1840 void RB_Generate_DOT_Image_Link(
1845 switch ( output_mode )
1848 fprintf( f, "<img src=\"%s%d.%s\">\n", DOT_GRAPH_NAME, dot_nr,
1854 char str[TEMP_BUF_SIZE];
1856 // First we need to convert graph to PDF
1857 // (maybe the user is using pdflatex)
1858 #if defined(RB_MSVC)
1859 sprintf( str, "%s %s%d.%s", EPSTOPDF_NAME,
1860 DOT_GRAPH_NAME, dot_nr, dot_type );
1862 snprintf( str, sizeof( str ), "%s %s%d.%s", EPSTOPDF_NAME,
1863 DOT_GRAPH_NAME, dot_nr, dot_type );
1867 fprintf( f, "\\includegraphics{%s%d}\n", DOT_GRAPH_NAME, dot_nr );
1878 /****f* Generator/Generate_Item
1881 static void Generate_Item(
1883 struct RB_Document *document,
1884 struct RB_header *header,
1885 struct RB_Item *cur_item,
1889 * Generate the documentation for a single item.
1893 static int dot_nr = 1;
1895 char *dot_type = NULL;
1896 FILE *tool = NULL; // Pipe handler to the tool we use
1897 enum ItemType item_type = cur_item->type;
1898 char *name = configuration.items.names[item_type];
1901 Generate_Item_Name( f, item_type );
1902 RB_Generate_Item_Begin( f, name );
1903 for ( line_nr = 0; line_nr < cur_item->no_lines; ++line_nr )
1905 struct RB_Item_Line *item_line = cur_item->lines[line_nr];
1906 char *line = item_line->line;
1909 if ( !Works_Like_SourceItem( item_type ) &&
1910 ( item_line->kind == ITEM_LINE_PLAIN ) )
1912 Format_Line( f, item_line->format );
1913 Generate_Item_Line( f, line, item_type, docname, header );
1916 else if ( item_line->kind == ITEM_LINE_END )
1918 Format_Line( f, item_line->format );
1921 else if ( !Works_Like_SourceItem( item_type ) &&
1922 ( item_line->kind == ITEM_LINE_PIPE ) )
1924 Format_Line( f, item_line->format );
1925 if ( item_line->pipe_mode == output_mode )
1927 Pipe_Line( f, line );
1931 else if ( !Works_Like_SourceItem( item_type ) &&
1932 ( item_line->kind == ITEM_LINE_TOOL_START ) )
1934 Format_Line( f, item_line->format );
1937 RB_Change_To_Docdir( document );
1939 // Open pipe to tool
1940 tool = Open_Pipe( line );
1942 // Get back to working dir
1943 RB_Change_Back_To_CWD( );
1945 // Tool (or DOT) body
1946 else if ( !Works_Like_SourceItem( item_type ) &&
1947 ( item_line->kind == ITEM_LINE_TOOL_BODY ) )
1951 fprintf( tool, "%s\n", line );
1955 else if ( !Works_Like_SourceItem( item_type ) &&
1956 ( item_line->kind == ITEM_LINE_TOOL_END ) )
1963 else if ( !Works_Like_SourceItem( item_type ) &&
1964 ( item_line->kind == ITEM_LINE_DOT_START ) )
1966 Format_Line( f, item_line->format );
1968 // Get DOT file type
1969 dot_type = RB_Get_DOT_Type( );
1973 char pipe_str[TEMP_BUF_SIZE];
1976 RB_Change_To_Docdir( document );
1977 #if defined(RB_MSVC)
1979 "%s -T%s -o%s%d.%s", dot_name,
1980 dot_type, DOT_GRAPH_NAME, dot_nr, dot_type );
1982 snprintf( pipe_str, sizeof( pipe_str ),
1983 "%s -T%s -o%s%d.%s", dot_name,
1984 dot_type, DOT_GRAPH_NAME, dot_nr, dot_type );
1986 tool = Open_Pipe( pipe_str );
1990 else if ( !Works_Like_SourceItem( item_type ) &&
1991 ( item_line->kind == ITEM_LINE_DOT_END ) )
1999 // Generate link to image
2000 RB_Generate_DOT_Image_Link( f, dot_nr, dot_type );
2002 // Get back to working dir
2003 RB_Change_Back_To_CWD( );
2005 // Increment dot file number
2010 else if ( !Works_Like_SourceItem( item_type ) &&
2011 ( item_line->kind == ITEM_LINE_DOT_FILE ) )
2013 Format_Line( f, item_line->format );
2015 // Get DOT file type
2016 dot_type = RB_Get_DOT_Type( );
2020 char str[TEMP_BUF_SIZE];
2023 RB_Change_To_Docdir( document );
2025 #if defined(RB_MSVC)
2027 "%s -T%s \"%s/%s\" -o%s%d.%s", dot_name,
2028 dot_type, RB_Get_Saved_CWD( ), line,
2029 DOT_GRAPH_NAME, dot_nr, dot_type );
2031 snprintf( str, sizeof( str ),
2032 "%s -T%s \"%s/%s\" -o%s%d.%s", dot_name,
2033 dot_type, RB_Get_Saved_CWD( ), line,
2034 DOT_GRAPH_NAME, dot_nr, dot_type );
2038 // Generate link to image
2039 RB_Generate_DOT_Image_Link( f, dot_nr, dot_type );
2041 // Get back to working dir
2042 RB_Change_Back_To_CWD( );
2044 // Increment dot file number
2049 else if ( !Works_Like_SourceItem( item_type ) &&
2050 ( item_line->kind == ITEM_LINE_EXEC ) )
2052 Format_Line( f, item_line->format );
2055 RB_Change_To_Docdir( document );
2060 // Get back to working dir
2061 RB_Change_Back_To_CWD( );
2064 else if ( Works_Like_SourceItem( item_type ) )
2066 Format_Line( f, item_line->format );
2067 Generate_Item_Line( f, line, item_type, docname, header );
2071 /* This item line is ignored */
2074 RB_Generate_Item_End( f, name );
2080 /****f* Generator/Generate_Header
2082 * Generate the documentation for all the items found in
2083 * a header except for any items specified in
2084 * configuration.ignore_items.
2087 static void Generate_Header(
2089 struct RB_Document *document,
2090 struct RB_header *header,
2094 * * f -- destination file
2095 * * header -- header to be searched.
2096 * * srcname -- name of the source file the header was found in.
2097 * * document -- name of the documentation file.
2099 * This skips the first item body if the first item name was
2100 * not correctly spelled.
2104 struct RB_Item *cur_item;
2106 for ( cur_item = header->items; cur_item; cur_item = cur_item->next )
2108 enum ItemType item_type = cur_item->type;
2109 char *name = configuration.items.names[item_type];
2111 if ( Is_Ignore_Item( name ) )
2113 /* User does not want this item */
2115 else if ( Works_Like_SourceItem( item_type )
2116 && ( course_of_action.do_nosource ) )
2118 /* User does not want source items */
2122 Generate_Item( f, document, header, cur_item, docname );
2130 static void Pipe_Line(
2134 char *cur_char = arg_line;
2136 for ( ; *cur_char && ( *cur_char == ' ' || *cur_char == '\t' );
2139 fputc( *cur_char, dest_doc );
2141 fprintf( dest_doc, "%s%s", cur_char,
2142 ( output_mode == RTF ? "\\line" : "\n" ) );
2146 static void Format_Line(
2150 if ( format & RBILA_END_LIST_ITEM )
2152 Generate_End_List_Item( dest_doc );
2154 if ( format & RBILA_END_LIST )
2156 Generate_End_List( dest_doc );
2158 if ( format & RBILA_END_PRE )
2160 Generate_End_Preformatted( dest_doc );
2162 if ( format & RBILA_BEGIN_PARAGRAPH )
2164 Generate_Begin_Paragraph( dest_doc );
2166 if ( format & RBILA_END_PARAGRAPH )
2168 Generate_End_Paragraph( dest_doc );
2170 if ( format & RBILA_BEGIN_PRE )
2172 Generate_Begin_Preformatted( dest_doc,
2173 ( format & RBILA_BEGIN_SOURCE ) );
2175 if ( format & RBILA_BEGIN_LIST )
2177 Generate_Begin_List( dest_doc );
2179 if ( format & RBILA_BEGIN_LIST_ITEM )
2181 Generate_Begin_List_Item( dest_doc );
2187 static void Generate_Begin_List_Item(
2190 switch ( output_mode )
2193 TEST_Generate_Begin_List_Item( dest_doc );
2196 XMLDB_Generate_Begin_List_Item( dest_doc );
2199 HTML_Generate_Begin_List_Item( dest_doc );
2202 LaTeX_Generate_Begin_List_Item( dest_doc );
2207 TROFF_Generate_Begin_List_Item( dest_doc );
2219 static void Generate_End_List_Item(
2222 switch ( output_mode )
2225 TEST_Generate_End_List_Item( dest_doc );
2228 XMLDB_Generate_End_List_Item( dest_doc );
2231 HTML_Generate_End_List_Item( dest_doc );
2234 LaTeX_Generate_End_List_Item( dest_doc );
2239 TROFF_Generate_End_List_Item( dest_doc );
2251 static void Generate_Begin_List(
2254 switch ( output_mode )
2257 TEST_Generate_Begin_List( dest_doc );
2260 XMLDB_Generate_Begin_List( dest_doc );
2263 HTML_Generate_Begin_List( dest_doc );
2266 LaTeX_Generate_Begin_List( dest_doc );
2280 /* TODO FS Document */
2282 static void Generate_End_List(
2285 switch ( output_mode )
2288 TEST_Generate_End_List( dest_doc );
2291 XMLDB_Generate_End_List( dest_doc );
2294 HTML_Generate_End_List( dest_doc );
2297 LaTeX_Generate_End_List( dest_doc );
2312 /* TODO FS Document */
2314 static void Generate_Begin_Preformatted(
2318 switch ( output_mode )
2321 TEST_Generate_Begin_Preformatted( dest_doc );
2324 XMLDB_Generate_Begin_Preformatted( dest_doc );
2327 HTML_Generate_Begin_Preformatted( dest_doc, source );
2330 LaTeX_Generate_Begin_Preformatted( dest_doc );
2335 TROFF_Generate_Begin_Preformatted( dest_doc );
2346 /* TODO FS Document */
2347 static void Generate_End_Preformatted(
2350 switch ( output_mode )
2353 TEST_Generate_End_Preformatted( dest_doc );
2356 XMLDB_Generate_End_Preformatted( dest_doc );
2359 HTML_Generate_End_Preformatted( dest_doc );
2362 LaTeX_Generate_End_Preformatted( dest_doc );
2367 TROFF_Generate_End_Preformatted( dest_doc );
2378 /* TODO FS Document */
2379 static void Generate_End_Paragraph(
2382 switch ( output_mode )
2385 TEST_Generate_End_Paragraph( dest_doc );
2388 XMLDB_Generate_End_Paragraph( dest_doc );
2391 HTML_Generate_End_Paragraph( dest_doc );
2394 LaTeX_Generate_End_Paragraph( dest_doc );
2399 TROFF_Generate_End_Paragraph( dest_doc );
2410 /* TODO FS Document */
2411 static void Generate_Begin_Paragraph(
2414 switch ( output_mode )
2417 TEST_Generate_Begin_Paragraph( dest_doc );
2420 XMLDB_Generate_Begin_Paragraph( dest_doc );
2423 HTML_Generate_Begin_Paragraph( dest_doc );
2426 LaTeX_Generate_Begin_Paragraph( dest_doc );
2431 TROFF_Generate_Begin_Paragraph( dest_doc );
2443 /*x**f* Generator/RB_Generate_Empty_Item
2445 * Generate documentation for an item with an empty body.
2447 * dest_doc -- destination file.
2449 * TODO Documentation
2452 static void RB_Generate_Empty_Item(
2455 switch ( output_mode )
2462 RB_HTML_Generate_Empty_Item( dest_doc );
2465 RB_LaTeX_Generate_Empty_Item( dest_doc );
2468 RB_RTF_Generate_Empty_Item( dest_doc );
2473 RB_ASCII_Generate_Empty_Item( dest_doc );
2484 static void Generate_Item_Line(
2489 struct RB_header *fnames )
2491 char *cur_char = line;
2492 char *object_name = NULL;
2493 char *label_name = NULL;
2494 char *file_name = NULL;
2497 { SKIP_ALPHANUM, SKIP_SPACE, SEARCH_LINK_START_WORD, SEARCH_LINK }
2500 for ( ; *cur_char; cur_char++ )
2504 /* This is a little statemachine to switch searching for
2505 * links on and off. A link can be found for a word
2506 * or for a word combined with some punctuation
2507 * characters. A word is a string of alpha numeric
2508 * characters (including a '_'), say FunctionAA_10_B
2509 * All other characters are punctuation characters.
2510 * We do not want links to start in the middle of a word,
2511 * but they can start after or on a punctuation character.
2512 * So for a link can start at
2519 /* Move to the next state based on current character. */
2523 /* In this state we try to skip of a string of space
2524 * characters until we find something else.
2527 if ( utf8_ispunct( c ) )
2529 /* we were in the process of skipping spaces,
2530 * but now we found a non-space character.
2531 * This might be the begin of a link, so
2532 * switch to the search link state.
2534 state = SEARCH_LINK;
2536 else if ( utf8_isalnum( c ) || ( c == '_' ) )
2538 state = SEARCH_LINK_START_WORD;
2542 /* Links can only start with a none space character,
2543 * so if the current charater is a space, we skip it.
2549 /* In this state we skipping a string of alpha
2550 * numeric charaters after that the first
2551 * character in this string did not result in a
2555 if ( utf8_isspace( c ) )
2557 /* We found the end of the string, so we go
2558 * back to the space skipping state
2562 else if ( utf8_ispunct( c ) && ( c != '_' ) )
2564 /* We found a puntuation character, this end
2565 * the string of alpha numeric character, but
2566 * can be the begin of a new link, so we
2567 * switch to the seach link state.
2569 state = SEARCH_LINK;
2573 /* We stay in this state */
2577 case SEARCH_LINK_START_WORD:
2578 /* In this state we are at the start of a string
2579 * of alpha numeric characters.
2582 if ( utf8_isalnum( c ) || ( c == '_' ) )
2584 /* We are not at the second character of
2585 * a string of alpha numeric characters,
2586 * we can stop searching for links, as a
2587 * link can only start at the begin of
2590 state = SKIP_ALPHANUM;
2592 else if ( utf8_ispunct( c ) && ( c != '_' ) )
2594 state = SEARCH_LINK;
2596 else if ( utf8_isspace( c ) )
2608 /* In this state we search for links. We stop
2609 * searching if we encounter a space because this
2610 * marks end of the word,
2612 if ( utf8_isalnum( c ) || ( c == '_' ) )
2614 /* We are at the start of a word.
2616 state = SEARCH_LINK_START_WORD;
2618 else if ( utf8_isspace( c ) )
2624 /* We stay in this state */
2633 if ( ( ( state == SEARCH_LINK ) ||
2634 ( state == SEARCH_LINK_START_WORD ) ) &&
2635 Find_Link( cur_char, &object_name, &label_name, &file_name ) )
2637 /* We found a link, so we can stop searching for one
2642 if ( object_name && fnames->no_names > 0 )
2644 extern char *function_name(
2648 for ( i = 0; i < fnames->no_names; i++ )
2651 function_name( fnames->names[i] ) ) == 0 )
2653 if ( i < fnames->no_names )
2655 RB_Generate_False_Link( dest_doc, object_name );
2656 cur_char += strlen( object_name ) - 1;
2660 Generate_Link( dest_doc, docname,
2661 file_name, label_name, object_name );
2662 cur_char += strlen( object_name ) - 1;
2673 RB_HTML_Extra( dest_doc, item_type, cur_char,
2674 ( cur_char == line ) ? 0 : *( cur_char - 1 ) );
2682 /* convert from signed to unsigned */
2683 unsigned char c2 = *cur_char;
2685 Generate_Char( dest_doc, c2 );
2690 /* TODO Move to the RTF_Generator */
2691 switch ( output_mode )
2694 fprintf( dest_doc, "\\line" );
2698 RB_TROFF_Start_New_Line( dest_doc );
2702 // Check for source line comment endings
2703 RB_HTML_Generate_Line_Comment_End( dest_doc );
2716 /* For all modes we add a newline. */
2717 fputc( '\n', dest_doc );
2722 /****f* Generator/Generate_Link
2724 * Generate a link to another headers documentation.
2732 char *function_name )
2735 * * dest_doc -- the output file
2736 * * docname -- the name of the output file
2737 * * file_name -- the name of the file that contains the link's body
2738 * * label_name -- the label for the link
2739 * * function_name -- the name that is shown for the link in the
2745 switch ( output_mode )
2748 RB_TEST_Generate_Link( dest_doc, docname, file_name, label_name,
2752 RB_XMLDB_Generate_Link( dest_doc, docname, file_name, label_name,
2756 RB_HTML_Generate_Link( dest_doc, docname, file_name, label_name,
2757 function_name, NULL );
2760 RB_RTF_Generate_Link( dest_doc, docname, file_name, label_name,
2764 RB_LaTeX_Generate_String( dest_doc, function_name );
2765 /* lowtexx 21.09.2005 11:43 */
2766 /* generate a simple link here */
2767 RB_LaTeX_Generate_Link( dest_doc, docname, file_name, label_name,
2774 fprintf( dest_doc, "%s", function_name );
2781 /****f* Generator/Generate_Char
2783 * Generate a single character in the current output mode.
2784 * The individual generators will make sure that special
2785 * characters are escaped.
2793 * * dest_doc -- destination file.
2794 * * cur_char -- character to be generated.
2798 switch ( output_mode )
2801 RB_TEST_Generate_Char( dest_doc, cur_char );
2804 RB_XMLDB_Generate_Char( dest_doc, cur_char );
2807 RB_HTML_Generate_Char( dest_doc, cur_char );
2810 RB_LaTeX_Generate_Char( dest_doc, cur_char );
2813 RB_RTF_Generate_Char( dest_doc, cur_char );
2816 RB_TROFF_Generate_Char( dest_doc, cur_char );
2819 RB_ASCII_Generate_Char( dest_doc, cur_char );
2828 /****f* Generator/RB_Get_SubIndex_FileName
2830 * Get the name of the master index file for a specific
2834 char *RB_Get_SubIndex_FileName(
2837 struct RB_HeaderType *header_type )
2840 * * docroot -- the path to the documentation directory.
2841 * * extension -- the extension for the file
2842 * * header_type -- the header type
2844 * a pointer to a freshly allocated string.
2846 * Has too many parameters.
2855 l = strlen( docroot );
2857 l += RB_Get_Len_Extension( extension );
2858 l += strlen( docroot );
2859 l += strlen( header_type->fileName );
2861 filename = ( char * ) malloc( l + 2 );
2865 strcat( filename, docroot );
2866 strcat( filename, header_type->fileName );
2867 RB_Add_Extension( extension, filename );
2875 /****f* Generator/Generate_Index
2877 * Generate_Index -- generate index file based on xref files.
2880 static void Generate_Index(
2881 struct RB_Document *document )
2884 * Create a master index file. It contains pointers to the
2885 * documentation generated for each source file, as well as all
2886 * "objects" found in the source files.
2890 switch ( output_mode )
2897 RB_HTML_Generate_Index( document );
2900 /* RB_LaTeX_Generate_Index(dest, source); */
2901 /* Latex has a index by default */