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/>.
23 /****h* Docuwala/ROBODoc
25 * ROBODoc is intended to be a replacement for the original AutoDocs
26 * program. ROBODoc will extract the comment headers from a source
27 * file, and put them into a separate documentation file.
30 * Sourcecode ---> [ROBODoc] ---> Document.
32 * The whole ROBODoc process consists of three steps: scanning,
33 * analysing, generating.
37 * ROBODoc scans the source directory tree. This collects the names of
38 * all the source files.
42 * ROBODOc analyses all the sourcefiles. This reads the content of all
43 * source files and collects all the headers.
47 * In this step the headers are written to one or more documentation files.
51 * The data collected during scanning and analysing is stored in a
52 * number of structures.
54 * RB_Directory, it stores the names of the sourcefiles and directories in
55 * the source direcory tree. File names are stored in a RB_Filename
56 * structure, directory names in a RB_Path structure. Each RB_Filename
57 * contains a pointer (path) to a RB_Path structure that tells in which
58 * directory a file is located. Each RB_Path has a pointer (parent) to
59 * another RB_Path structure that tells in which directory is a directory
60 * located (of which directory it is a subdirectory). The only exception
61 * is the root directory.
63 * Besides the name of the sourcefile, the RB_Filename also stores the
64 * name of the documentation file.
66 * For each sourcefile there is an RB_Part structure. It contains a
67 * pointer (filename) to the RB_Filename and a list (headers) of
68 * RB_Header structure containing the headers found in the sourcefile.
70 * Every RB_Header structure contains a pointer (owner) to the RB_Part
71 * structure to which it belongs. Headers can form a hierarchy that is
72 * used to create sections and subsections in the documentation. To
73 * store this hierarchy every RB_header structure contains a pointer
74 * (parent) to its parent header. For instance, given the following two
75 * headers, SubModule is the parent of SubSubModule.
76 * ****h* TopModule/SubModule
80 * ****h* SubModule/SubSubModule
84 * In the documentation this creates the sections
89 * The RB_Directory and the linked list of RB_Part structures are
90 * stored in a RB_Document structure.
92 * During the generation of the documentation ROBODoc tries to create
93 * cross links between the mention of a header's name (an object) and the
94 * documentation generated from that header (the documentation for the
97 * To aid this proces there is an array of RB_link structures. This
98 * array is sorted for quick searching. RB_link structures the name
99 * of a header and the name of the label under which the documentation
100 * can be found in the documentation file.
103 * See AUTHORS in the archive.
105 * 20-Dec-94 Jacco van Weert.
106 * MODIFICATION HISTORY
107 * See ChangeLog in the archive. Latest version can be found on:
108 * o http://www.xs4all.nl/~rfsber/Robo/
110 * Other bugs? Catch them in a jar and send them to rfsber -(at)- xs4all.nl
113 * $Id: robodoc.c,v 1.106 2007/07/10 19:13:52 gumpu Exp $
120 #include <sys/stat.h>
133 #include "analyser.h"
134 #include "generator.h"
135 #include "document.h"
136 #include "directory.h"
137 #include "roboconfig.h"
138 #include "optioncheck.h"
144 /* Functions local to this file. */
146 T_RB_DocType Find_DocType(
149 actions_t Find_Actions(
158 static int PathBegin_Check(
161 static void Path_Check(
165 char *Find_Parameterized_Option(
168 char *RB_Find_In_Argv_Parameterized_Option(
173 static char *General_Find_Parameterized_Option(
178 static char *Fix_Path(
181 static char *Path_Convert_Win32_to_Unix(
184 static char *Find_And_Fix_Path(
187 static void RB_Summary(
188 struct RB_Document *document );
190 static void Find_Tabstops(
193 static void Find_And_Install_Document_Name(
195 unsigned char type );
198 "$VER: robodoc " VERSION " (" __DATE__
199 ") (c) by Maverick Software Development 1994-2006";
202 /****h* ROBODoc/UserInterface
204 * This module contains functions to parse the
205 * command line and inform the user about any errors.
210 /****v* UserInterface/use
212 * use -- usage string
214 * Inform the user how to use ROBODoc.
222 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
223 "ROBODoc Version " VERSION " autodocs formatter ($Revision: 1.106 $)\n"
224 "(c) 1994-2007 Frans Slothouber, Petteri Kettunen, \n"
225 " Gergely Budai and Jacco van Weert\n"
226 "ROBODoc comes with ABSOLUTELY NO WARRANTY.\n"
227 "This is free software, and you are welcome to redistribute it\n"
228 "under certain conditions; type `robodoc -c' for details.\n" "\n";
231 " robodoc --src <directory> --doc <directory> --multidoc [type] [options]\n"
232 " robodoc --src <directory> --doc <file> --singledoc [type] [options]\n"
233 " robodoc --src <file> --doc <file> --singlefile [type] [options]\n"
235 "Type:\n" " --html, --rtf, --latex, --ascii, --dbxml, --troff\n" "\n";
236 char use_options1[] =
238 " --charset NAME Add character encoding information (html only).\n"
239 " --cmode Use ANSI C grammar in source items (html only).\n"
240 " --css Specify the stylesheet to use.\n"
241 " --ext EXTENSION Set extension for generated files.\n"
242 " --footless Do not create the foot of a document.\n"
243 " --headless Do not create the head of a document.\n"
244 " --index Add an index.\n";
245 char use_options2[] =
246 " --internal Also include internal headers.\n"
247 " --internalonly Only include internal headers.\n"
248 " --lock Recognize only one header marker per file.\n"
249 " --nodesc Do not descent into subdirectories.\n"
250 " --no_subdirectories\n"
251 " Do no create documentation subdirectories.\n"
252 " --nopre Do not use <PRE> </PRE> in the HTML output.\n"
253 " --nosort Do not sort the headers.\n"
254 " --nosource Do not include SOURCE items.\n"
255 " --nogeneratedwith\n"
256 " Do not add the 'generated by robodoc' message\n"
257 " at the top of each documentation file.\n"
258 " --ignore_case_when_linking\n"
259 " Ignore the case of the symbols when trying\n"
260 " to create crosslinks.\n";
261 char use_options3[] =
262 " --rc Specify an alternate configuration file.\n"
263 " --sections Add sections and subsections.\n"
264 " --first_section_level NUMBER\n"
265 " Start the first section not at 1 but at \n"
267 " --tabsize NUMBER Set the tab size.\n"
268 " --tabstops a,b,..,n\n"
270 " --tell ROBODoc will tell you what it is doing.\n"
271 " --debug same as --tell, but with lots more details.\n"
272 " --toc Add a table of contents.\n"
273 " --version Print version info and exit.\n"
274 " --sectionnameonly\n"
275 " Generate section header with name only.\n"
276 " --compress Only supported by TROFF output format. Defines by which\n"
277 " program manpages will be compressed. Either bzip2 or gzip.\n"
278 " --mansection Manual section where pages will be inserted (default: 3).\n"
279 " --documenttitle TITLE\n"
280 " Set the document title\n"
281 " --altlatex Alternate LaTeX file format (bigger / clearer than normal)\n"
282 " --latexparts Make the first module level as PART in LaTeX output\n"
283 " --syntaxcolors Turn on all syntax highlighting features in SOURCE items\n"
285 " --syntaxcolors_enable quotes,squotes,line_comments,block_comments,\n"
286 " keywords,non_alpha\n"
287 " Enable only specific syntax highlighting features in\n"
288 " SOURCE items (html only)\n"
289 " --dotname NAME Specify the name (and path / options) of DOT tool\n"
290 " --masterindex title,filename\n"
291 " Specify the tile and filename for master index page\n"
292 " --sourceindex title,filename\n"
293 " Specify the tile and filename for source files index page\n"
294 " --one_file_per_header\n"
295 " Create a separate documentation file for each header\n"
296 " --header_breaks NUMBER\n"
297 " Insert a linebreak after every NUMBER header names\n"
298 " (default value: 2, set to zero to disable)\n" "\n";
300 "Authors/Contributors:\n"
301 " Frans Slothouber, Jacco van Weert, Petteri Kettunen, Bernd Koesling,\n"
302 " Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner, Sasha Vasko,\n"
303 " Kai Hofmann, Thierry Pierron, Friedrich Haase, Gergely Budai.\n";
307 /****v* UserInterface/copying
309 * Information about the ROBODoc licence.
313 * 2003-02-25/petterik: corrected link to GNU copyleft.
319 " Distributed under the GNU GENERAL PUBLIC LICENSE\n"
320 " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n"
321 " See the source archive for a copy of the complete licence\n"
322 " If you do not have it you can get it from URL\n"
323 " http://www.gnu.org/copyleft/gpl.html\n";
326 static void dump_version(
329 printf( "%s\n", VERSION );
330 /* TODO create an option to show robodoc configuration,
331 * including compiler setting etc..
332 printf( "Configuration:\n" );
333 printf( " locale: %s", setlocale( LC_ALL, "" ) );
337 /* TODO This function is too long. */
339 /****f* UserInterface/main
341 * Get and parse the arguments. Analyse document and generate the
342 * documentation. Everything starts from here.
352 struct RB_Document *document = NULL;
353 struct RB_Directory *srctree = NULL;
355 char *used_rc_file = NULL;
359 TODO, make setlocale work.
362 if ( (loc = getenv("LC_CTYPE") ) != NULL )
364 printf( ".... %s\n", loc );
365 setlocale( LC_ALL, loc);
369 setlocale(LC_ALL, "");
373 whoami = argv[0]; /* global me,myself&i */
375 // Init Actions global
376 course_of_action = No_Actions( );
378 /* Read the configuration file. This might contain
380 RB_SetCurrentFile( NULL );
381 used_rc_file = ReadConfiguration( argc, argv,
382 RB_Find_In_Argv_Parameterized_Option
383 ( argc, argv, "--rc" ) );
385 /* Force debug mode early if the user wants the debug mode */
386 debugmode = Find_DebugMode( );
387 course_of_action.do_tell = TRUE;
389 if ( Check_Options( ) == EXIT_FAILURE )
395 if ( Find_Option( "-c" ) )
397 printf( "%s", copying );
401 if ( Find_Option( "--version" ) )
407 if ( Find_Option( "--help" ) )
409 printf( "%s%s%s%s%s%s", use, use_usage, use_options1, use_options2,
410 use_options3, use_authors );
414 output_mode = Find_DocType( ); /* one of the globals that are still left */
415 if ( output_mode == UNKNOWN )
421 /* First the basics. */
422 document = RB_Get_RB_Document( );
423 document->doctype = output_mode;
424 document->actions = Find_Actions( );
425 debug = document->debugmode = Find_DebugMode( );
426 document->charset = Find_Parameterized_Option( "--charset" );
427 document->extension = Find_Parameterized_Option( "--ext" );
428 document->css = Find_Parameterized_Option( "--css" );
429 document->compress = Find_Parameterized_Option( "--compress" );
430 document->section = Find_Parameterized_Option( "--mansection" );
431 document_title = Find_Parameterized_Option( "--documenttitle" );
432 optstr = Find_Parameterized_Option( "--first_section_level" );
435 document->first_section_level = atoi( optstr );
438 course_of_action = document->actions; /* a global */
439 debugmode = document->debugmode; /* a global */
441 RB_Say( "Using %s for defaults\n", SAY_INFO, used_rc_file );
442 free( used_rc_file ); /* No longer necessary */
447 document->css = Path_Convert_Win32_to_Unix( document->css );
450 if ( ( document->actions.do_index ) && output_mode == TROFF )
452 RB_Warning( "Index generation not supported for TROFF format.\n" );
453 document->actions.do_index = FALSE;
456 if ( Find_Parameterized_Option( "--doctype_name" ) &&
457 Find_Parameterized_Option( "--doctype_location" ) )
459 document->doctype_name =
460 Find_Parameterized_Option( "--doctype_name" );
461 document->doctype_location =
462 Find_Parameterized_Option( "--doctype_location" );
465 // Find tab sizes and tab stops
468 // Find master index file name
469 Find_And_Install_Document_Name( "--masterindex", HT_MASTERINDEXTYPE );
471 // Find source index file name
472 Find_And_Install_Document_Name( "--sourceindex", HT_SOURCEHEADERTYPE );
474 // Find DOT tool name
475 optstr = Find_Parameterized_Option( "--dotname" );
481 // Find number of headers before linebreak
482 optstr = Find_Parameterized_Option( "--header_breaks" );
485 int breaks = atoi( optstr );
489 breaks = MAX_HEADER_BREAKS;
491 header_breaks = breaks;
495 if ( !document->extension )
497 document->extension = RB_Get_Default_Extension( document->doctype );
501 /* Test if there is a --src and --doc */
502 if ( !Find_Parameterized_Option( "--src" ) )
504 printf( "Error: you need to specify a source"
505 " file or directory with --src.\n" );
509 if ( !Find_Parameterized_Option( "--doc" ) )
511 printf( "Error: you need to specify a documentation file"
512 " or directory with --doc.\n" );
517 /* What mode are we using? */
518 if ( Find_Option( "--multidoc" ) )
520 char *srcrootname; /* directory */
523 srcrootname = Find_And_Fix_Path( "--src" );
524 if ( !Stat_Path( 'e', srcrootname ) )
526 printf( "Error: %s does not exists\n", srcrootname );
531 if ( !Stat_Path( 'd', srcrootname ) )
533 printf( "Error: %s is not a directory\n", srcrootname );
537 document->srcroot = RB_Get_RB_Path( srcrootname );
539 docrootname = Find_And_Fix_Path( "--doc" );
540 Path_Check( srcrootname, docrootname );
542 document->docroot = RB_Get_RB_Path( docrootname );
544 srctree = RB_Get_RB_Directory( srcrootname, docrootname );
545 document->srctree = srctree;
547 RB_Document_Create_Parts( document );
548 RB_Analyse_Document( document );
549 RB_Generate_Documentation( document );
551 RB_Free_RB_Path( document->srcroot );
552 document->srcroot = 0;
553 RB_Free_RB_Path( document->docroot );
554 document->docroot = 0;
555 RB_Free_RB_Directory( srctree );
556 document->srctree = 0;
558 else if ( output_mode == TROFF )
560 RB_Panic( "Only --multidoc is supported for TROFF output.\n" );
562 else if ( Find_Option( "--singledoc" ) )
564 char *srcrootname; /* directory */
566 srcrootname = Find_And_Fix_Path( "--src" );
567 if ( !Stat_Path( 'e', srcrootname ) )
569 printf( "Error: %s does not exists\n", srcrootname );
574 if ( !Stat_Path( 'd', srcrootname ) )
576 printf( "Error: %s is not a directory\n", srcrootname );
580 document->srcroot = RB_Get_RB_Path( srcrootname );
582 document->docroot = 0;
583 document->singledoc_name = Find_And_Fix_Path( "--doc" );
585 srctree = RB_Get_RB_Directory( srcrootname, NULL );
586 document->srctree = srctree;
588 RB_Document_Create_Parts( document );
589 RB_Analyse_Document( document );
590 RB_Generate_Documentation( document );
592 RB_Free_RB_Directory( srctree );
594 else if ( Find_Option( "--singlefile" ) )
596 char *srcfile; /* file */
597 char *docfile; /* file */
599 document->docroot = 0;
600 docfile = Find_And_Fix_Path( "--doc" );
601 document->singledoc_name = docfile;
602 srcfile = Find_And_Fix_Path( "--src" );
603 if ( !Stat_Path( 'e', srcfile ) )
605 printf( "Error: %s does not exists\n", srcfile );
610 if ( !Stat_Path( 'f', srcfile ) )
612 printf( "Error: %s is not a file\n", srcfile );
617 document->srctree = RB_Get_RB_SingleFileDirectory( srcfile );
619 RB_Get_RB_Path( document->srctree->first_path->name );
621 RB_Document_Create_Parts( document );
622 RB_Analyse_Document( document );
623 RB_Generate_Documentation( document );
625 RB_Free_RB_Directory( document->srctree );
631 ( "\n\nError: Use either --multidoc, --singledoc, or --singlefile\n" );
635 RB_Summary( document );
636 RB_Free_RB_Document( document );
637 Free_Configuration( );
640 /* Mac OS X specific: print memory leaks */
641 if ( debug & SAY_DEBUG )
645 sprintf( cmd, "/usr/bin/leaks %d", getpid( ) );
648 #endif /* __APPLE__ */
656 /****if* UserInterface/Find_Tabstops
658 * This function looks for the tab stop configuration and fills out the
662 static void Find_Tabstops(
669 int tabsize = DEFAULT_TABSIZE;
673 optstr = Find_Parameterized_Option( "--tabsize" );
676 tabsize = atoi( optstr );
679 // Fill tabstop table with default values
680 for ( i = 0; i < MAX_TABS; i++ )
682 tab_stops[i] = tabsize * ( i + 1 );
686 optstr = Find_Parameterized_Option( "--tabstops" );
689 // Get TAB sizes and fill table
690 for ( str = strtok( optstr, TABSIZE_SEPARATOR ), i = 0;
691 str != NULL && i < MAX_TABS;
692 str = strtok( NULL, TABSIZE_SEPARATOR ), i++ )
694 tab_stops[i] = atoi( str ) - 1;
702 /****if* UserInterface/Find_And_Install_Document_Name
704 * Looks for specific option strings and installs special document titles
707 * Should be used to overwrite the HT_MASTERINDEXTYPE or HT_SOURCEHEADERTYPE
708 * entries in the header_type_lookup_table.
711 static void Find_And_Install_Document_Name(
716 * o option -- the option string to look for
717 * o type -- the type entry in header_type_lookup_table to overwrite
718 * (Should be either HT_MASTERINDEXTYPE or HT_SOURCEHEADERTYPE)
723 char *title = NULL, *filename = NULL, *optstr = NULL;
725 // First find the option
726 optstr = Find_Parameterized_Option( option );
730 // Break the option into substrings
731 title = strtok( optstr, "," );
732 filename = strtok( NULL, "," );
734 // If something missing
735 if ( title == NULL || filename == NULL )
737 RB_Panic( "Invalid %s option\n", option );
740 // Install document title and filename
741 RB_AddHeaderType( type, title, filename, 0 );
749 /****f* UserInterface/Find_And_Fix_Path
751 * Searches through the options to find a path.
752 * This path is converted to a propper path
753 * if it contains errors such as the use of
754 * '\' or when it does not start with ./ or a
756 * The option must exist.
759 static char *Find_And_Fix_Path(
763 * o option_name -- the option name for the path
765 * o path -- the path.
773 temp = Find_Parameterized_Option( option_name );
775 temp = Path_Convert_Win32_to_Unix( temp );
776 temp2 = Fix_Path( temp );
784 /****f* UserInterface/Path_Convert_Win32_to_Unix
786 * Although people are supposed to specify all paths
787 * with a '/' as seperator, sometimes people on Win32
788 * use '\', this causes problems later on in some
789 * other function of robodoc that expect a '/'.
790 * So to prevent this we replace all the '\' in a path
793 * In addition people sometimes add a '/' at the
794 * end of the path. We remove it.
798 static char *Path_Convert_Win32_to_Unix(
802 * o path -- the path.
804 * o path -- the converted path (in a newly allocated
811 /* First make a copy */
812 path = RB_StrDup( path );
813 for ( i = 0; i < strlen( path ); ++i )
815 if ( path[i] == '\\' )
821 /* Remove trailing '/' if there is one. */
822 if ( path[strlen( path ) - 1] == '/' )
824 path[strlen( path ) - 1] = '\0';
832 /****f* UserInterface/Path_Check
834 * Test the validity of the doc and source path. The doc path should
835 * not be a sub directory of the source path otherwise the generated
836 * documentation will be part of the generated documentation if
837 * robodoc is run more than once.
841 static void Path_Check(
846 * o sourcepath -- the path to the source files.
847 * o docpath -- the path to the documentation files.
858 dl = strlen( docpath );
859 sl = strlen( sourcepath );
865 for ( i = 0; i < sl; ++i )
867 if ( docpath[i] != sourcepath[i] )
873 if ( equal && ( dl == sl ) )
876 ( "The source path and document path can not be equal\n" );
889 /****f* UserInterface/PathBegin_Check
891 * Checks the validity of a path.
892 * A path should start with
897 * have a ':' some where
900 static int PathBegin_Check(
904 * o path -- the path to be cheked.
906 * o FALSE -- path is not OK.
907 * o TRUE -- path is OK.
912 int l = strlen( path );
916 result = ( path[0] == '.' );
920 result = ( ( path[0] == '.' ) && ( path[1] == '/' ) ) ||
921 ( path[0] == '/' ) || ( strchr( path, ':' ) != NULL );
934 /****f* UserInterface/Find_Option
936 * Search configuration.options for a specific option.
942 * o option -- the option to be found.
944 * o TRUE -- option does exist
945 * o FALSE -- option does not exist
949 unsigned int parameter_nr;
952 for ( parameter_nr = 0;
953 parameter_nr < configuration.options.number; parameter_nr++ )
955 if ( !RB_Str_Case_Cmp
956 ( configuration.options.names[parameter_nr], option ) )
967 /****f* UserInterface/Fix_Path
969 * Add a "./" to a path if it does not start with a "./" or does not
970 * contain a ":". If the path was "." just add a "/". Adding a
971 * "./" simplifies the creating of relative links during the
972 * generation process.
976 static char *Fix_Path(
980 * o path -- the path to be fixed.
982 * A pointer to a newly allocated string containing the path.
988 if ( !PathBegin_Check( path ) )
992 if ( strcmp( path, "." ) == 0 )
994 result = RB_StrDup( prefix );
998 int l = strlen( path );
1000 l += strlen( prefix ) + 1;
1001 result = malloc( l );
1004 strcat( result, prefix );
1005 strcat( result, path );
1010 result = RB_StrDup( path );
1018 /* TODO: FS Documentation */
1020 T_RB_DocType Find_DocType(
1023 T_RB_DocType doctype = UNKNOWN;
1024 unsigned int parameter_nr;
1026 for ( parameter_nr = 0;
1027 parameter_nr < configuration.options.number; parameter_nr++ )
1030 if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1036 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1042 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1048 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1054 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1060 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1066 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1069 doctype = XMLDOCBOOK;
1081 actions_t No_Actions(
1086 unsigned char *actptr;
1088 for ( i = 0, actptr = ( unsigned char * ) &actions;
1089 i < sizeof( actions ); i++, actptr++ )
1097 /* TODO: FS Documentation */
1098 actions_t Find_Actions(
1102 unsigned int parameter_nr;
1105 actions = No_Actions( );
1107 for ( parameter_nr = 0;
1108 parameter_nr < configuration.options.number; parameter_nr++ )
1110 if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1113 actions.do_singledoc = TRUE;
1115 if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1118 actions.do_singlefile = TRUE;
1120 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1123 actions.do_multidoc = TRUE;
1125 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1126 "--no_subdirectories" ) )
1128 actions.do_no_subdirectories = TRUE;
1130 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1131 "--one_file_per_header" ) )
1133 actions.do_one_file_per_header = TRUE;
1135 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1138 actions.do_sections = TRUE;
1140 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1143 actions.do_include_internal = TRUE;
1145 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1146 "--ignore_case_when_linking" ) )
1148 actions.do_ignore_case_when_linking = TRUE;
1150 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1151 "--internalonly" ) )
1153 actions.do_internal_only = TRUE;
1155 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1158 actions.do_toc = TRUE;
1160 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1163 actions.do_index = TRUE;
1165 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1168 actions.do_nosource = TRUE;
1170 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1173 actions.do_tell = TRUE;
1175 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1178 actions.do_tell = TRUE;
1180 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1183 actions.do_nodesc = TRUE;
1185 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1186 "--nogeneratedwith" ) )
1188 actions.do_nogenwith = TRUE;
1190 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1193 actions.do_quotes = TRUE;
1194 actions.do_squotes = TRUE;
1195 actions.do_line_comments = TRUE;
1196 actions.do_block_comments = TRUE;
1197 actions.do_keywords = TRUE;
1198 actions.do_non_alpha = TRUE;
1200 Install_C_Syntax( );
1202 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1205 actions.do_lockheader = TRUE;
1207 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1210 actions.do_footless = TRUE;
1212 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1215 actions.do_verbal = TRUE;
1217 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1220 actions.do_ms_errors = TRUE;
1222 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1225 actions.do_headless = TRUE;
1227 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1230 actions.do_nosort = TRUE;
1232 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1235 actions.do_nopre = TRUE;
1237 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1238 "--sectionnameonly" ) )
1240 actions.do_sectionnameonly = TRUE;
1242 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1245 actions.do_altlatex = TRUE;
1247 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1250 actions.do_latexparts = TRUE;
1252 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1253 "--syntaxcolors" ) )
1255 actions.do_quotes = TRUE;
1256 actions.do_squotes = TRUE;
1257 actions.do_line_comments = TRUE;
1258 actions.do_block_comments = TRUE;
1259 actions.do_keywords = TRUE;
1260 actions.do_non_alpha = TRUE;
1268 // Find specific syntax colors enable options
1269 optstr = Find_Parameterized_Option( "--syntaxcolors_enable" );
1275 for ( str = strtok( optstr, "," ); str; str = strtok( NULL, "," ) )
1277 if ( !RB_Str_Case_Cmp( str, "quotes" ) )
1279 actions.do_quotes = TRUE;
1281 else if ( !RB_Str_Case_Cmp( str, "squotes" ) )
1283 actions.do_squotes = TRUE;
1285 else if ( !RB_Str_Case_Cmp( str, "line_comments" ) )
1287 actions.do_line_comments = TRUE;
1289 else if ( !RB_Str_Case_Cmp( str, "block_comments" ) )
1291 actions.do_block_comments = TRUE;
1293 else if ( !RB_Str_Case_Cmp( str, "keywords" ) )
1295 actions.do_keywords = TRUE;
1297 else if ( !RB_Str_Case_Cmp( str, "non_alpha" ) )
1299 actions.do_non_alpha = TRUE;
1303 // Bad option specified
1304 RB_Panic( "Invalid --syntaxcolors_enable option: %s\n", str );
1312 /* TODO: FS Documentation */
1313 long Find_DebugMode(
1317 unsigned int parameter_nr;
1319 for ( parameter_nr = 0;
1320 parameter_nr < configuration.options.number; parameter_nr++ )
1322 if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1328 else if ( !RB_Str_Case_Cmp( configuration.options.names[parameter_nr],
1337 /****f* UserInterface/Find_Parameterized_Option
1339 * Search for an option of the form
1340 * --a_option_name a_value
1341 * in configuration.options.
1344 char *Find_Parameterized_Option(
1348 * optionname -- the name of the option to search for.
1350 * NULL if the option is not found, a pointer to the value
1353 * Results in a Panic if the option is found but
1354 * no value is specified.
1358 return General_Find_Parameterized_Option( configuration.options.number,
1359 &( configuration.options.
1360 names[0] ), optionname );
1366 /****f* UserInterface/RB_Find_In_Argv_Parameterized_Option
1368 * Search for an option of the form
1369 * --a_option_name a_value
1370 * in argv. The function is used to look for the
1372 * option that can be used to specify an
1373 * alternate robodoc configuration file.
1376 char *RB_Find_In_Argv_Parameterized_Option(
1382 * * argc -- the argument count as received by main().
1383 * * argv -- the array of argument values as received by main()
1384 * * optionname -- the name of the option to search for.
1386 * NULL if the option is not found, a pointer to the value
1389 * Results in a Panic if the option is found but
1390 * no value is specified.
1394 return General_Find_Parameterized_Option( argc, argv, optionname );
1400 /****f* UserInterface/General_Find_Parameterized_Option
1402 * Search for an option of the form
1403 * --a_option_name a_value
1406 static char *General_Find_Parameterized_Option(
1412 * o n -- the number of options in the options array.
1413 * o options -- the options array
1414 * o optionname -- the name of the option to search for.
1416 * NULL if the option is not found, a pointer to the value
1419 * Results in a Panic if the option is found but
1420 * no value is specified.
1427 for ( parameter_nr = 0; parameter_nr < n; parameter_nr++ )
1429 if ( !RB_Str_Case_Cmp( options[parameter_nr], optionname ) )
1431 if ( parameter_nr < n - 1 )
1433 value = options[parameter_nr + 1];
1434 if ( ( value[0] == '-' ) && ( value[1] == '-' ) )
1441 /* to few parameters. */
1445 RB_Panic( "you must be more specific"
1446 " with the %s option\n", optionname );
1456 /* TODO Documentation */
1458 static void RB_Summary(
1459 struct RB_Document *document )
1463 printf( "Ready\n" );
1466 printf( "Found %d headers\n", document->no_headers );
1468 if ( number_of_warnings )
1470 printf( "Found %d warnings\n", number_of_warnings );