1 | /* makeinfo.h -- declarations for Makeinfo. |
---|
2 | $Id: makeinfo.h,v 1.1.1.1 2002-06-05 22:17:34 zacheiss Exp $ |
---|
3 | |
---|
4 | Copyright (C) 1996, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | This program is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with this program; if not, write to the Free Software |
---|
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
19 | |
---|
20 | Written by Brian Fox (bfox@ai.mit.edu). */ |
---|
21 | |
---|
22 | #ifndef MAKEINFO_H |
---|
23 | #define MAKEINFO_H |
---|
24 | |
---|
25 | #ifdef COMPILING_MAKEINFO |
---|
26 | # define DECLARE(type,var,init) type var = init |
---|
27 | #else |
---|
28 | # define DECLARE(type,var,init) extern type var |
---|
29 | #endif |
---|
30 | |
---|
31 | /* Hardcoded per GNU standards, not dependent on argv[0]. */ |
---|
32 | DECLARE (char *, progname, "makeinfo"); |
---|
33 | |
---|
34 | enum reftype |
---|
35 | { |
---|
36 | menu_reference, followed_reference |
---|
37 | }; |
---|
38 | |
---|
39 | extern char *get_xref_token (); |
---|
40 | |
---|
41 | /* Nonzero means a string is in execution, as opposed to a file. */ |
---|
42 | DECLARE (int, executing_string, 0); |
---|
43 | |
---|
44 | /* Nonzero means to inhibit writing macro expansions to the output |
---|
45 | stream, because it has already been written. */ |
---|
46 | DECLARE (int, me_inhibit_expansion, 0); |
---|
47 | |
---|
48 | extern char *expansion (), *text_expansion (), *full_expansion (); |
---|
49 | |
---|
50 | /* Current output stream. */ |
---|
51 | DECLARE (FILE *, output_stream, NULL); |
---|
52 | |
---|
53 | DECLARE (char *, pretty_output_filename, NULL); |
---|
54 | |
---|
55 | /* Current output file name. */ |
---|
56 | DECLARE (char *, current_output_filename, NULL); |
---|
57 | |
---|
58 | /* Output paragraph buffer. */ |
---|
59 | DECLARE (unsigned char *, output_paragraph, NULL); |
---|
60 | |
---|
61 | /* Offset into OUTPUT_PARAGRAPH. */ |
---|
62 | DECLARE (int, output_paragraph_offset, 0); |
---|
63 | |
---|
64 | /* The output paragraph "cursor" horizontal position. */ |
---|
65 | DECLARE (int, output_column, 0); |
---|
66 | |
---|
67 | /* Position in the output file. */ |
---|
68 | DECLARE (int, output_position, 0); |
---|
69 | |
---|
70 | /* The offset into OUTPUT_PARAGRAPH where we have a meta character |
---|
71 | produced by a markup such as @code or @dfn. */ |
---|
72 | DECLARE (int, meta_char_pos, -1); |
---|
73 | |
---|
74 | /* Nonzero means output_paragraph contains text. */ |
---|
75 | DECLARE (int, paragraph_is_open, 0); |
---|
76 | |
---|
77 | /* Nonzero means that `start_paragraph' MUST be called before we pay |
---|
78 | any attention to `close_paragraph' calls. */ |
---|
79 | DECLARE (int, must_start_paragraph, 0); |
---|
80 | |
---|
81 | /* Nonzero means that we have seen "@top" once already. */ |
---|
82 | DECLARE (int, top_node_seen, 0); |
---|
83 | |
---|
84 | /* Nonzero means that we have seen a non-"@top" node already. */ |
---|
85 | DECLARE (int, non_top_node_seen, 0); |
---|
86 | |
---|
87 | /* Nonzero indicates that indentation is temporarily turned off. */ |
---|
88 | DECLARE (int, no_indent, 1); |
---|
89 | |
---|
90 | /* Nonzero indicates that filling a line also indents the new line. */ |
---|
91 | DECLARE (int, indented_fill, 0); |
---|
92 | |
---|
93 | /* Nonzero means forcing output text to be flushright. */ |
---|
94 | DECLARE (int, force_flush_right, 0); |
---|
95 | |
---|
96 | /* The amount of indentation to apply at the start of each line. */ |
---|
97 | DECLARE (int, current_indent, 0); |
---|
98 | |
---|
99 | /* The column at which long lines are broken. */ |
---|
100 | DECLARE (int, fill_column, 72); |
---|
101 | |
---|
102 | /* Nonzero means that words are not to be split, even in long lines. This |
---|
103 | gets changed for cm_w (). */ |
---|
104 | DECLARE (int, non_splitting_words, 0); |
---|
105 | |
---|
106 | /* Amount by which @example indentation increases/decreases. */ |
---|
107 | DECLARE (int, default_indentation_increment, 5); |
---|
108 | |
---|
109 | /* Nonzero means that we are currently hacking the insides of an |
---|
110 | insertion which would use a fixed width font. */ |
---|
111 | DECLARE (int, in_fixed_width_font, 0); |
---|
112 | |
---|
113 | /* Nonzero if we are currently processing a multitable command */ |
---|
114 | DECLARE (int, multitable_active, 0); |
---|
115 | |
---|
116 | /* Nonzero means that we're generating HTML. */ |
---|
117 | DECLARE (int, html, 0); |
---|
118 | |
---|
119 | /* Nonzero means that we're generating XML. */ |
---|
120 | DECLARE (int, xml, 0); |
---|
121 | |
---|
122 | /* Nonzero means that we're generating DocBook. */ |
---|
123 | DECLARE (int, docbook, 0); |
---|
124 | |
---|
125 | /* Nonzero means true 8-bit output for Info and plain text. */ |
---|
126 | DECLARE (int, enable_encoding, 0); |
---|
127 | |
---|
128 | /* Nonzero means escape characters in HTML output. */ |
---|
129 | DECLARE (int, escape_html, 1); |
---|
130 | extern char *escape_string (); /* do HTML escapes */ |
---|
131 | |
---|
132 | /* Access key number for next menu entry to be generated (1 to 9, or 10 to |
---|
133 | mean no access key) */ |
---|
134 | DECLARE (int, next_menu_item_number, 1); |
---|
135 | |
---|
136 | /* Nonzero means that the use of paragraph_start_indent is inhibited. |
---|
137 | @example uses this to line up the left columns of the example text. |
---|
138 | A negative value for this variable is incremented each time it is used. |
---|
139 | @noindent uses this to inhibit indentation for a single paragraph. */ |
---|
140 | DECLARE (int, inhibit_paragraph_indentation, 0); |
---|
141 | |
---|
142 | /* Nonzero indicates that filling will take place on long lines. */ |
---|
143 | DECLARE (int, filling_enabled, 1); |
---|
144 | |
---|
145 | /* The current node's node name. */ |
---|
146 | DECLARE (char *, current_node, NULL); |
---|
147 | |
---|
148 | /* Command name in the process of being hacked. */ |
---|
149 | DECLARE (char *, command, NULL); |
---|
150 | |
---|
151 | /* @copying ... @end copying. */ |
---|
152 | DECLARE (char *, copying_text, NULL); |
---|
153 | |
---|
154 | /* @documentdescription ... @end documentdescription. */ |
---|
155 | DECLARE (char *, document_description, NULL); |
---|
156 | |
---|
157 | /* Nonzero if the last character inserted has the syntax class of NEWLINE. */ |
---|
158 | DECLARE (int, last_char_was_newline, 1); |
---|
159 | |
---|
160 | /* The current input file state. */ |
---|
161 | DECLARE (char *, input_filename, (char *)NULL); |
---|
162 | DECLARE (char *, input_text, (char *)NULL); |
---|
163 | DECLARE (int, input_text_length, 0); |
---|
164 | DECLARE (int, input_text_offset, 0); |
---|
165 | DECLARE (int, line_number, 0); |
---|
166 | DECLARE (char *, toplevel_output_filename, NULL); |
---|
167 | #define curchar() input_text[input_text_offset] |
---|
168 | |
---|
169 | /* A colon separated list of directories to search for files included |
---|
170 | with @include. This can be controlled with the `-I' option to makeinfo. */ |
---|
171 | DECLARE (char *, include_files_path, NULL); |
---|
172 | |
---|
173 | /* The filename of the current input file. This is never freed. */ |
---|
174 | DECLARE (char *, node_filename, NULL); |
---|
175 | |
---|
176 | /* Nonzero means do not output "Node: Foo" for node separations, that |
---|
177 | is, generate plain text. (--no-headers) */ |
---|
178 | DECLARE (int, no_headers, 0); |
---|
179 | |
---|
180 | /* Nonzero means that we process @html and @rawhtml even when not |
---|
181 | generating HTML. (--ifhtml) */ |
---|
182 | DECLARE (int, process_html, 0); |
---|
183 | |
---|
184 | /* Positive means process @ifinfo (even if not generating Info); |
---|
185 | zero means don't process @ifinfo (even if we are); |
---|
186 | -1 means we don't know yet. (--ifinfo) */ |
---|
187 | DECLARE (int, process_info, -1); |
---|
188 | |
---|
189 | /* Positive means process @ifplaintext (even if not generating plain text); |
---|
190 | zero means we don't process @ifplaintext (even if we are); |
---|
191 | -1 means we don't know yet. (--ifplaintext) */ |
---|
192 | DECLARE (int, process_plaintext, -1); |
---|
193 | |
---|
194 | /* Nonzero means that we process @tex and @iftex. (--iftex) */ |
---|
195 | DECLARE (int, process_tex, 0); |
---|
196 | |
---|
197 | /* Maximum number of references to a single node before complaining. |
---|
198 | (--reference-limit) */ |
---|
199 | DECLARE (int, reference_warning_limit, 1000); |
---|
200 | |
---|
201 | /* Default is to check node references. (--no-validate) */ |
---|
202 | DECLARE (int, validating, 1); |
---|
203 | |
---|
204 | /* Nonzero means print information about what is going on. (--verbose) */ |
---|
205 | DECLARE (int, verbose_mode, 0); |
---|
206 | |
---|
207 | /* Nonzero means prefix each @chapter, ... with a number like 1. (--number-sections) */ |
---|
208 | DECLARE (int, number_sections, 0); |
---|
209 | |
---|
210 | /* Nonzero means split size. When zero, DEFAULT_SPLIT_SIZE is used. */ |
---|
211 | DECLARE (int, split_size, 0); |
---|
212 | |
---|
213 | /* Nonzero means expand node names and references while validating. |
---|
214 | This will avoid errors when the Texinfo document uses features |
---|
215 | like @@ and @value inconsistently in node names, but will slow |
---|
216 | the program by about 80%. You HAVE been warned. */ |
---|
217 | DECLARE (int, expensive_validation, 0); |
---|
218 | |
---|
219 | /* C's standard macros don't check to make sure that the characters being |
---|
220 | changed are within range. So I have to check explicitly. */ |
---|
221 | |
---|
222 | #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c))) |
---|
223 | #define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c))) |
---|
224 | |
---|
225 | #define control_character_bit 0x40 /* %01000000, must be off. */ |
---|
226 | #define meta_character_bit 0x080/* %10000000, must be on. */ |
---|
227 | #define CTL(c) ((c) & (~control_character_bit)) |
---|
228 | #define UNCTL(c) coerce_to_upper(((c)|control_character_bit)) |
---|
229 | #define META(c) ((c) | (meta_character_bit)) |
---|
230 | #define UNMETA(c) ((c) & (~meta_character_bit)) |
---|
231 | |
---|
232 | #define whitespace(c) ((c) == '\t' || (c) == ' ') |
---|
233 | #define sentence_ender(c) ((c) == '.' || (c) == '?' || (c) == '!') |
---|
234 | #define cr_or_whitespace(c) (whitespace(c) || (c) == '\r' || (c) == '\n') |
---|
235 | |
---|
236 | #ifndef isletter |
---|
237 | #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z')) |
---|
238 | #endif |
---|
239 | |
---|
240 | #ifndef isupper |
---|
241 | #define isupper(c) ((c) >= 'A' && (c) <= 'Z') |
---|
242 | #endif |
---|
243 | |
---|
244 | #ifndef isdigit |
---|
245 | #define isdigit(c) ((c) >= '0' && (c) <= '9') |
---|
246 | #endif |
---|
247 | |
---|
248 | #ifndef digit_value |
---|
249 | #define digit_value(c) ((c) - '0') |
---|
250 | #endif |
---|
251 | |
---|
252 | #define HTML_SAFE "$-_.+!*'()" |
---|
253 | #define URL_SAFE_CHAR(ch) (isalnum (ch) || strchr (HTML_SAFE, ch)) |
---|
254 | |
---|
255 | #define COMMAND_PREFIX '@' |
---|
256 | |
---|
257 | #define END_VERBATIM "end verbatim" |
---|
258 | |
---|
259 | /* Stuff for splitting large files. */ |
---|
260 | #define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */ |
---|
261 | #define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */ |
---|
262 | DECLARE (int, splitting, 1); /* Defaults to true for now. */ |
---|
263 | |
---|
264 | #define command_char(c) (!cr_or_whitespace(c) \ |
---|
265 | && (c) != '{' \ |
---|
266 | && (c) != '}' \ |
---|
267 | && (c) != '=') |
---|
268 | |
---|
269 | #define skip_whitespace() \ |
---|
270 | while ((input_text_offset != input_text_length) && \ |
---|
271 | whitespace (curchar())) \ |
---|
272 | input_text_offset++ |
---|
273 | |
---|
274 | #define skip_whitespace_and_newlines() \ |
---|
275 | do { \ |
---|
276 | while (input_text_offset != input_text_length \ |
---|
277 | && cr_or_whitespace (curchar ())) \ |
---|
278 | { \ |
---|
279 | if (curchar () == '\n') \ |
---|
280 | line_number++; \ |
---|
281 | input_text_offset++; \ |
---|
282 | } \ |
---|
283 | } while (0) |
---|
284 | |
---|
285 | /* Return nonzero if STRING is the text at input_text + input_text_offset, |
---|
286 | else zero. */ |
---|
287 | #define looking_at(string) \ |
---|
288 | (strncmp (input_text + input_text_offset, string, strlen (string)) == 0) |
---|
289 | |
---|
290 | #endif /* not MAKEINFO_H */ |
---|