Added options to make Robodoc more customizable.
[robodoc.git] / Source / globals.c
1 /*
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.
5
6 This file is part of ROBODoc
7
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.
12
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.
17
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/>.
20
21 */
22
23
24 /****h* ROBODoc/Globals
25  * FUNCTION
26  *   A number of global variables.
27  * TODO
28  *   Documentation.
29  *****
30  * $Id: globals.c,v 1.22 2007/07/10 19:13:51 gumpu Exp $
31  */
32
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include "robodoc.h"
36 #include "globals.h"
37 #include "links.h"
38
39 #ifdef DMALLOC
40 #include <dmalloc.h>
41 #endif
42
43 int                 number_of_warnings = 0;
44
45 /* Pointer to the name of the current file that is being analysed,
46    use by RB_Panic */
47
48 char               *current_file = 0;
49
50 /****v* Globals/document_title
51  * NAME
52  *   document_title -- title for the documentation.
53  * PURPOSE
54  *   Used as the title for master index files or for latex documentation.
55  * SOURCE
56  */
57
58 char               *document_title = NULL;
59
60 /******/
61
62
63 /****v* Globals/document_header
64  * NAME
65  *   document_header -- Header for the documentation.
66  * PURPOSE
67  *   Used as the header of generated files
68  * SOURCE
69  */
70
71 char               *document_header = NULL;
72
73 /******/
74
75
76 /****v* Globals/document_footer
77  * NAME
78  *   document_footer -- Footer for the documentation.
79  * PURPOSE
80  *   Used as the footer of generated files
81  * SOURCE
82  */
83
84 char               *document_footer = NULL;
85
86 /******/
87
88
89 /****v* Globals/output_mode [2.0]
90  * NAME
91  *   output_mode -- the mode of output
92  * FUNCTION
93  *   Controls which type of output will be generated.
94  * SOURCE
95  */
96
97 T_RB_DocType        output_mode = ASCII;
98
99 /*******/
100
101
102 /****v* Globals/course_of_action [2.0]
103  * NAME
104  *   course_of_action
105  * FUNCTION
106  *   Global Variable that defines the course of action.
107  * SOURCE
108  */
109
110 actions_t           course_of_action;
111
112 /*******/
113
114 /****v* Globals/debugmode
115  * NAME
116  *   debugmode
117  * FUNCTION
118  *   A bitfield determining the output levels
119  * SOURCE
120  */
121
122 long                debugmode = 0;
123
124 /*******/
125
126
127 /****v* Globals/line_buffer [2.0]
128  * NAME
129  *   line_buffer -- global line buffer
130  * FUNCTION
131  *   Temporary storage area for lines
132  *   that are read from an input file.
133  * SOURCE
134  */
135
136 char                line_buffer[MAX_LINE_LEN];
137
138 /*******/
139
140 /****v* Globals/myLine
141  * NAME
142  *   myLine -- dynamic buffer for current line
143  * FUNCTION
144  *   Temporary storage area for lines
145  *   that are read from an input file.
146  * SOURCE
147  */
148
149 char               *myLine = NULL;
150
151 /*******/
152
153 /****v* Globals/readChars
154  * NAME
155  *   readChars -- number of characters in the currently bufferd line
156  * FUNCTION
157  *   Temporary storage area for lines
158  *   that are read from an input file.
159  * SOURCE
160  */
161
162 int                 readChars = 0;
163
164 /*******/
165
166 /****v* Globals/line_number [2.0]
167  * NAME
168  *   line_number -- global line counter
169  * PURPOSE
170  *   Keeps track of the number of lines that are read from the source file.
171  * AUTHOR
172  *   Koessi
173  * SOURCE
174  */
175
176 int                 line_number = 0;
177
178 /*******/
179
180 /*
181  * Global variables
182  */
183 /* TODO  Document these. */
184
185 char               *source_file;        /* DCD */
186 char               *whoami = NULL;      /* me,myself&i */
187 int                 tab_stops[MAX_TABS];        /* Tab stop positions */
188
189 // Number of header item names before linebreak
190 int                 header_breaks = DEFAULT_HEADER_BREAKS;
191
192
193 // Path and filename to dot tool
194 char               *dot_name = DEFAULT_DOT_NAME;
195
196
197 /****i* Globals/RB_Close_The_Shop [3.0b]
198  * NAME
199  *   RB_Close_The_Shop -- free resources.
200  * SYNOPSIS
201  *   void RB_Close_The_Shop ()
202  * FUNCTION
203  *   Frees all resources used by robodoc.
204  * SEE ALSO
205  *   RB_Free_Header(), RB_Free_Link()
206  * SOURCE
207  */
208
209 void RB_Close_The_Shop(
210     void )
211 {
212 /* TODO    if (link_index) { free(link_index); } */
213     if ( myLine )
214     {
215         free( myLine );
216     }
217 }
218
219 /******/