| fb-doc 0.2 documentation tool for FreeBasic

- Main Page
- Tutorial
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fb-doc_options.bi
Go to the documentation of this file.
1 /** \file fb-doc_options.bi
2 \brief Header file for options
3
4 This file contains the declaration of the \ref Options class. It's
5 used to scan options and parameters in the command line.
6
7 */
8
9 #include "dir.bi"
10
11 #define MSG_LINE(_T_) PRINT SPC(28 - LEN(_T_)); _T_;
12
13
14 /** \brief File name for callees list */
15 const VAR CALLEES_FILE = "fb-doc.lfn";
16
17 /** \brief Parameters red from the command line
18
19 The class to scan options and parameters from command line. the
20 command line gets parsed once at the program start. Since this
21 structure is global, the settings are available in all internal
22 modules.
23
24 */
25 class Options{
26 public:
27
28 /** \brief fb-doc operation modes. */
29 enum RunModes{
30
31 /** \brief Operate as Doxygen filter
32
33 Read a file and generate C-source to StdOut. (Default mode). */
34 DOXYFILTER,
35
36 /** \brief Operate in scan mode
37
38 Read input from one or more files, write output to files. Usually
39 this is to generate pseudo C source output, but an alternative
40 emitter can be specified. When no file name or pattern is specified,
41 all *.bas and *.bi files in the current folder gets parsed. (Option
42 \em --fileoutput). */
43 FILE_OUT,
44
45 /** \brief Operate as Geany filter
46
47 Read from StdIn and output on StdOut. Usually this is to generate
48 templates in Geany, but it also can be used with pipes. (Option \em
49 --geany). */
50 GEANYFILTER,
51
52 /** \brief Operate in list mode
53
54 Read input from one or more files, write output to a single file \em
55 fb-doc.lfn. Generate a list of callee names in this file. When no
56 file name or patter is specified, all *.bas and *.bi files in the
57 current folder gets parsed. (Option \em --list). */
58 SCAN_LIST,
59
60 /** \brief Print version information
61
62 Print out the version information and stop (Option \em --version). */
63 VERSION_MESSAGE,
64
65 /** \brief Print the helptext
66
67 Stop after printing out some help information on how to start fb-doc
68 and how to use options at the command line. (Option \em --help). */
69 HELP_MESSAGE
70 } RunModes;
71
72 /** \brief In-build emitters
73
74 By default these four emitters are available in fb-doc. The
75 enumerators are used for default settings in the Options class. The
76 user can choose the emitter by option \em --emitter. The parameter
77 gets checked against the EmitterIF::Nam string (or parts of it). */
78 enum EmitterTypes{
79 C_SOURCE, //!< emit pseudo C source (default and option \em --fileoutput)
80 DOXYGEN_CALLEES, //!< emit a list of callees for Doxygen (option \em --list)
81 GTK_DOC_TEMPLATES, //!< emit templates for gtk-doc (option \em --geany gtk)
82 DOXYGEN_TEMPLATES//!< emit templates for Doxygen (option \em --geany doxy)
83 } EmitterTypes;
84
85
86 /** \brief The style of the types in the C source
87
88 A FB type can be translated to a C type or it can be shown as a
89 pseudo type. Ie instead of the C type void the pseudo type SUB can
90 be used. */
91 enum TypesStyle{
92 C_STYLE, //!< types gets translated to C
93 FB_STYLE//!< pseudo FB types are used
94 } TypesStyle;
95
96 /** \brief The style of the documentation output in the C source */
97 enum BackEnds{
98 DOXYGEN, //!< emit multi line comments as-is (no leading * )
99 GTK_DOC//!< emit multi line comments with a leading * for each line
100 } BackEnds;
101
102 RunModes RunMode = DOXYFILTER;//!< the mode how we operate (DOXYFILTER is default)
103 BackEnds Asterix = DOXYGEN;//!< the style how the emitter should export comment blocks (DOXYGEN is default)
104 TypesStyle Types = FB_STYLE;//!< the style for the type generation (FB_STYLE is default)
105 Parser_PTR Pars = 0;//!< the parser we use
106 EmitterIF_PTR EmitIF = Emitters(C_SOURCE);//!< the emitter we use (\em C_source is default)
107 ANY_PTR DllEmitter = 0;//!< the pointer for an external emitter
108 STRING EmitFile = "emit.txt",//!< the file name for the template for empty blocks (use in \em --geany)
109 InFile = "",//!< name or pattern of input file[s]
110 Callees = "",//!< names of SUBs, FUNCTIONs and PROPERTYs
111 InPattern = "",//!< pattern for input files
112 OutPath = "";//!< path for file output (option \em --path)
113 INTEGER AllCallees = 0,//!< export external callee names as well (option \em --list)
114 InRecursiv = 0,//!< flag set when InFile should get scaned recursiv
115 InTree = 0,//!< flag set when InFile should get scaned recursiv
116 OutFiles = 0;//!< flag set when output should be written to files
117 UBYTE JoComm = ASC("*"),//!< the character to start a documentation comment
118 AdLine = ASC("&");//!< the character to start a comment for export
119 EmitFunc
120 Function_,//!< emitter for a function declaration with parameter list
121 Variable_;//!< emitter for a variable declaration
122
123 Options ();
124 ~Options ();
125 SUB chooseEmitter (BYREF_AS_INTEGER);
126 SUB Pattern ();
127 FUNCTION_AS_INTEGER checkDir (BYREF_AS_STRING P);
128 };
129
130
131 /** \brief The global struct for all parameters red from the command line */
132 Options_PTR OPT;
133