Imported Robodoc.
[robodoc.git] / Source / roboconfig.h
1 #ifndef ROBODOC_CONFIG_H
2 #define ROBODOC_CONFIG_H
3 // vi: spell ff=unix
4 //
5
6 /*
7 Copyright (C) 1994-2007  Frans Slothouber, Jacco van Weert, Petteri Kettunen,
8 Bernd Koesling, Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner,
9 Sasha Vasko, Kai Hofmann, Thierry Pierron, Friedrich Haase, and Gergely Budai.
10
11 This file is part of ROBODoc
12
13 ROBODoc is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 3 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
26 */
27
28 typedef enum
29 {
30     CFL_REMARK = 0,
31     CFL_PARAMETER,
32     CFL_SECTION,
33     CFL_EMPTYLINE,
34     CFL_UNKNOWN
35 } T_Line_Kind;
36
37 typedef enum
38 {
39     SK_ITEMS = 0,
40     SK_IGNOREITEMS,
41     SK_OPTIONS,
42     SK_HEADERTYPES,
43     SK_IGNORE_FILES,
44     SK_ACCEPT_FILES,
45     SK_HEADER_MARKERS,
46     SK_REMARK_MARKERS,
47     SK_END_MARKERS,
48     SK_REMARK_BEGIN_MARKERS,
49     SK_REMARK_END_MARKERS,
50     SK_SOURCE_ITEMS,
51     SK_KEYWORDS,
52     SK_SOURCE_LINE_COMMENTS,
53     SK_HEADER_IGNORE_CHARS,
54     SK_HEADER_SEPARATE_CHARS,
55     SK_PREFORMATTED_ITEMS,
56     SK_FORMAT_ITEMS,
57     SK_ITEM_ORDER,
58     SK_UNKNOWN
59 } T_Block_Kind;
60
61
62 /****s* Configuration/keywords_hash_s
63  * FUNCTION
64  *    Structure for a keyword hash table row.
65  * ATTRIBUTES
66  *    o keyword -- pointer to the keyword
67  *    o next    -- pointer to next entry in the row
68  * SOURCE
69  */
70 struct keywords_hash_s
71 {
72     struct keywords_hash_s *next;
73     char               *keyword;
74 };
75
76 /*****/
77
78
79 /****s* Configuration/Parameters
80  * FUNCTION
81  *    Structure to store all the paramters found in a block in the
82  *    robodoc configuation file.
83  * ATTRIBUTES
84  *    o number -- the number of parameters found.
85  *    o size   -- the maximum size of the names array.
86  *    o names  -- an array with the values of the parameters.
87  * NOTES
88  *    Find a better name for the attribute 'names'
89  * SOURCE
90  */
91
92 struct Parameters
93 {
94     unsigned int        number;
95     unsigned int        size;
96     char              **names;
97 };
98
99 /*****/
100
101
102 /****s* Configuration/RB_Configuration
103  * FUNCTION
104  *   All the data from the robodoc.rc file is stored in this
105  *   structure.
106  * ATTRIBUTES
107  *   o items                 -- an array with names that robodoc recognizes as
108  *                              items.  Alsways includes the name "SOURCE" as
109  *                              the first element.
110  *   o ignore_items          -- an array with the names of items that ROBODoc
111  *                              should ignore.
112  *   o source_items          -- an array with the names of items that work
113  *                              similar to the built-in SOURCE item.
114  *   o preformatted_items    -- item names that will be automatically
115  *                              preformatted
116  *   o format_items          -- item names that should be formatted by the
117  *                              browser
118  *   o item_order            -- an array with item names that
119  *                              indicates which items should be displayed first.
120  *   o options               -- Array with all options specified both on the
121  *                              commandline as well as in the robodoc.rc file.
122  *   o custom_headertypes    -- list with custom header types.
123  *   o ignore_files          -- list with wildcard expressions that specifies
124  *                              files and directories that robodoc should skip
125  *                              while scanning the source tree.
126  *   o header_markers        -- list with markers that mark the begin of a
127  *                              header.
128  *   o remark_markers        -- list with markers that mark a remark.
129  *   o end_markers           -- list with markers that markt the end of a
130  *                              header.
131  *   o remark_begin_markers  -- list of markers that mark the begin of
132  *                              a remark.  For instance (*
133  *   o remakr_end_markers    -- list of markers that mark the end of a
134  *                              remark.  For instance   *)
135  *   o keywords              -- source keywords to recognise (and colorise)
136  *   o source_line_comments  -- comment markers that span until the end of line
137  *   o header_ignore_chars   -- characters for beginning of header remarks
138  *   o header_separate_chars -- characters that separates header artifacts
139  *
140  * SOURCE
141  */
142
143 struct RB_Configuration
144 {
145     struct Parameters   items;
146     struct Parameters   ignore_items;
147     struct Parameters   source_items;
148     struct Parameters   preformatted_items;
149     struct Parameters   format_items;
150     struct Parameters   item_order;
151
152     struct Parameters   options;
153
154     struct Parameters   ignore_files;
155     struct Parameters   accept_files;
156
157     struct Parameters   custom_headertypes;
158     struct Parameters   header_markers;
159     struct Parameters   remark_markers;
160     struct Parameters   end_markers;
161     struct Parameters   remark_begin_markers;
162     struct Parameters   remark_end_markers;
163
164     struct Parameters   keywords;
165     struct Parameters   source_line_comments;
166     struct Parameters   header_ignore_chars;
167     struct Parameters   header_separate_chars;
168 };
169
170 /*******/
171
172 char               *ReadConfiguration(
173     unsigned int argc,
174     char **argv,
175     char *filename );
176 void                Free_Configuration(
177     void );
178 void                Install_C_Syntax(
179     void );
180 char               *Find_Keyword(
181     char *keyword,
182     int len );
183 char               *Find_Parameter_Exact(
184     struct Parameters *params,
185     char *paramname );
186 char               *Find_Parameter_Partial(
187     struct Parameters *params,
188     char *paramname );
189 char               *Find_Parameter_Char(
190     struct Parameters *params,
191     char param );
192
193 extern struct RB_Configuration configuration;
194
195 #endif