Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / texinfo / makeinfo / makeinfo.h
blob08d94d9a178719495f46b802e871816a547777f9
1 /* $NetBSD: makeinfo.h,v 1.1.1.7 2008/09/02 07:50:44 christos Exp $ */
3 /* makeinfo.h -- declarations for Makeinfo.
4 Id: makeinfo.h,v 1.17 2004/11/30 02:03:23 karl Exp
6 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
7 Software Foundation, Inc.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Written by Brian Fox (bfox@ai.mit.edu). */
25 #ifndef MAKEINFO_H
26 #define MAKEINFO_H
28 #ifdef COMPILING_MAKEINFO
29 # define DECLARE(type,var,init) type var = init
30 #else
31 # define DECLARE(type,var,init) extern type var
32 #endif
34 /* Hardcoded per GNU standards, not dependent on argv[0]. */
35 DECLARE (char *, progname, "makeinfo");
37 /* Nonzero means a string is in execution, as opposed to a file. */
38 DECLARE (int, executing_string, 0);
40 /* Nonzero means to inhibit writing macro expansions to the output
41 stream, because it has already been written. */
42 DECLARE (int, me_inhibit_expansion, 0);
44 /* Current output stream. */
45 DECLARE (FILE *, output_stream, NULL);
47 DECLARE (char *, pretty_output_filename, NULL);
49 /* Current output file name. */
50 DECLARE (char *, current_output_filename, NULL);
52 /* Output paragraph buffer. */
53 DECLARE (unsigned char *, output_paragraph, NULL);
55 /* Offset into OUTPUT_PARAGRAPH. */
56 DECLARE (int, output_paragraph_offset, 0);
58 /* The output paragraph "cursor" horizontal position. */
59 DECLARE (int, output_column, 0);
61 /* Position in the output file. */
62 DECLARE (int, output_position, 0);
64 /* Number of lines in the output. */
65 DECLARE (int, output_line_number, 1);
66 DECLARE (int, node_line_number, 0);
68 /* The offset into OUTPUT_PARAGRAPH where we have a meta character
69 produced by a markup such as @code or @dfn. */
70 DECLARE (int, meta_char_pos, -1);
72 /* Nonzero means output_paragraph contains text. */
73 DECLARE (int, paragraph_is_open, 0);
75 /* Nonzero means that `start_paragraph' MUST be called before we pay
76 any attention to `close_paragraph' calls. */
77 DECLARE (int, must_start_paragraph, 0);
79 /* Nonzero means that we have seen "@top" once already. */
80 DECLARE (int, top_node_seen, 0);
82 /* Nonzero means that we have seen a non-"@top" node already. */
83 DECLARE (int, non_top_node_seen, 0);
85 /* Nonzero indicates that indentation is temporarily turned off. */
86 DECLARE (int, no_indent, 1);
88 /* The amount of indentation to apply at the start of each line. */
89 DECLARE (int, current_indent, 0);
91 /* Nonzero means that we suppress the indentation of the first paragraph
92 following any section heading. */
93 DECLARE (int, do_first_par_indent, 0);
95 /* Amount by which @example indentation increases/decreases. */
96 DECLARE (int, example_indentation_increment, 5);
98 /* Amount by which @table, @defun, etc. indentation increases/decreases. */
99 DECLARE (int, default_indentation_increment, 5);
101 /* Amount by which xml indentation increases/decreases.
102 Zero means unnecessary whitespace is compressed. */
103 DECLARE (int, xml_indentation_increment, 2);
105 /* Nonzero indicates that filling a line also indents the new line. */
106 DECLARE (int, indented_fill, 0);
108 /* Nonzero means forcing output text to be flushright. */
109 DECLARE (int, force_flush_right, 0);
111 /* The column at which long lines are broken. */
112 DECLARE (int, fill_column, 72);
114 /* Nonzero means that words are not to be split, even in long lines. This
115 gets changed for cm_w (). */
116 DECLARE (int, non_splitting_words, 0);
118 /* Nonzero means that we are currently hacking the insides of an
119 insertion which would use a fixed width font. */
120 DECLARE (int, in_fixed_width_font, 0);
122 /* Nonzero if we are currently processing a multitable command */
123 DECLARE (int, multitable_active, 0);
125 /* Nonzero means that we're generating HTML. (--html) */
126 DECLARE (int, html, 0);
128 /* Nonzero means that we're generating XML. (--xml) */
129 DECLARE (int, xml, 0);
131 /* Nonzero means that we're generating DocBook. (--docbook) */
132 DECLARE (int, docbook, 0);
134 /* Nonzero means true 8-bit output for Info and plain text.
135 (--enable-encoding) */
136 DECLARE (int, enable_encoding, 0);
138 /* Nonzero means escape characters in HTML output. */
139 DECLARE (int, escape_html, 1);
141 /* Access key number for next menu entry to be generated (1 to 9, or 10 to
142 mean no access key) */
143 DECLARE (int, next_menu_item_number, 1);
145 /* Nonzero means that the use of paragraph_start_indent is inhibited.
146 @example uses this to line up the left columns of the example text.
147 A negative value for this variable is incremented each time it is used.
148 @noindent uses this to inhibit indentation for a single paragraph. */
149 DECLARE (int, inhibit_paragraph_indentation, 0);
151 /* Nonzero indicates that filling will take place on long lines. */
152 DECLARE (int, filling_enabled, 1);
154 /* The current node's node name. */
155 DECLARE (char *, current_node, NULL);
157 /* Command name in the process of being hacked. */
158 DECLARE (char *, command, NULL);
160 /* Nonzero if we have seen an @titlepage command. */
161 DECLARE (int, titlepage_cmd_present, 0);
163 /* @copying ... @end copying. */
164 DECLARE (char *, copying_text, NULL);
166 /* @documentdescription ... @end documentdescription. */
167 DECLARE (const char *, document_description, NULL);
169 /* Nonzero if the last character inserted has the syntax class of NEWLINE. */
170 DECLARE (int, last_char_was_newline, 1);
172 /* The current input file state. */
173 DECLARE (char *, input_filename, (char *)NULL);
174 DECLARE (char *, input_text, (char *)NULL);
175 DECLARE (int, input_text_length, 0);
176 DECLARE (int, input_text_offset, 0);
177 DECLARE (int, line_number, 0);
178 DECLARE (char *, toplevel_output_filename, NULL);
179 #define curchar() input_text[input_text_offset]
181 /* A colon separated list of directories to search for files included
182 with @include. This can be controlled with the `-I' option to makeinfo. */
183 DECLARE (char *, include_files_path, NULL);
185 /* The filename of the current input file. This is never freed. */
186 DECLARE (char *, node_filename, NULL);
188 /* Name of CSS file to include, if any. (--css-include). */
189 DECLARE (char *, css_include, NULL);
191 /* Nonzero means do not output "Node: Foo" for node separations, that
192 is, generate plain text. (--no-headers) */
193 DECLARE (int, no_headers, 0);
195 /* Nonzero means do not output makeinfo version and source file.
196 (--no-version-header) */
197 DECLARE (int, no_version_header, 0);
199 /* Nonzero means that we process @docbook and @ifdocbook. (--ifdocbook) */
200 DECLARE (int, process_docbook, 0);
202 /* Nonzero means that we process @html and @rawhtml even when not
203 generating HTML. (--ifhtml) */
204 DECLARE (int, process_html, 0);
206 /* Positive means process @ifinfo (even if not generating Info);
207 zero means don't process @ifinfo (even if we are);
208 -1 means we don't know yet. (--ifinfo) */
209 DECLARE (int, process_info, -1);
211 /* Positive means process @ifplaintext (even if not generating plain text);
212 zero means we don't process @ifplaintext (even if we are);
213 -1 means we don't know yet. (--ifplaintext) */
214 DECLARE (int, process_plaintext, -1);
216 /* Nonzero means that we process @tex and @iftex. (--iftex) */
217 DECLARE (int, process_tex, 0);
219 /* Nonzero means that we process @xml and @ifxml. (--ifxml) */
220 DECLARE (int, process_xml, 0);
222 /* Maximum number of references to a single node before complaining.
223 (--reference-limit) */
224 DECLARE (int, reference_warning_limit, 1000);
226 /* Default is to check node references. (--no-validate) */
227 DECLARE (int, validating, 1);
229 /* Nonzero means print information about what is going on. (--verbose) */
230 DECLARE (int, verbose_mode, 0);
232 /* Nonzero means prefix each @chapter, ... with a number like
233 1, 1.1, etc. (--number-sections) */
234 DECLARE (int, number_sections, 1);
236 /* Nonzero means split size. When zero, DEFAULT_SPLIT_SIZE is used. */
237 DECLARE (int, split_size, 0);
239 /* Nonzero means expand node names and references while validating.
240 This will avoid errors when the Texinfo document uses features
241 like @@ and @value inconsistently in node names, but will slow
242 the program by about 80%. You HAVE been warned. */
243 DECLARE (int, expensive_validation, 0);
245 /* C's standard macros don't check to make sure that the characters being
246 changed are within range. So I have to check explicitly. */
248 #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
249 #define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c)))
251 #define control_character_bit 0x40 /* %01000000, must be off. */
252 #define meta_character_bit 0x080/* %10000000, must be on. */
253 #define CTL(c) ((c) & (~control_character_bit))
254 #define UNCTL(c) coerce_to_upper(((c)|control_character_bit))
255 #define META(c) ((c) | (meta_character_bit))
256 #define UNMETA(c) ((c) & (~meta_character_bit))
258 #define whitespace(c) ((c) == '\t' || (c) == ' ')
259 #define sentence_ender(c) ((c) == '.' || (c) == '?' || (c) == '!')
260 #define cr_or_whitespace(c) (whitespace(c) || (c) == '\r' || (c) == '\n')
262 #ifndef isletter
263 #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
264 #endif
266 #ifndef isupper
267 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
268 #endif
270 #ifndef isdigit
271 #define isdigit(c) ((c) >= '0' && (c) <= '9')
272 #endif
274 #ifndef digit_value
275 #define digit_value(c) ((c) - '0')
276 #endif
278 /* These characters are not really HTML-safe (with strict XHTML),
279 and also there are possible collisions. That's the whole reason we
280 designed a new conversion scheme in the first place. But we
281 nevertheless need to generate the old names. See
282 `add_escaped_anchor_name' in html.c. */
283 #define OLD_HTML_SAFE "$-_.+!*'()"
284 #define OLD_URL_SAFE_CHAR(ch) (strchr (OLD_HTML_SAFE, ch))
286 /* For the current/stable scheme. */
287 #define URL_SAFE_CHAR(ch) (isalnum (ch))
289 #define COMMAND_PREFIX '@'
291 #define END_VERBATIM "end verbatim"
293 /* Stuff for splitting large files. The numbers for Emacs
294 texinfo-format-buffer are much smaller, but memory capacities have
295 increased so much, 50k info files seem a bit tiny these days. */
296 #define DEFAULT_SPLIT_SIZE 300000
297 DECLARE (int, splitting, 1); /* Defaults to true for now. */
299 #define skip_whitespace() \
300 while ((input_text_offset != input_text_length) && \
301 whitespace (curchar())) \
302 input_text_offset++
304 #define skip_whitespace_and_newlines() \
305 do { \
306 while (input_text_offset != input_text_length \
307 && cr_or_whitespace (curchar ())) \
309 if (curchar () == '\n') \
310 line_number++; \
311 input_text_offset++; \
313 } while (0)
315 /* Return nonzero if STRING is the text at input_text + input_text_offset,
316 else zero. */
317 #define looking_at(string) \
318 (strncmp (input_text + input_text_offset, string, strlen (string)) == 0)
320 /* Any list with a member named `next'. */
321 typedef struct generic_list {
322 struct generic_list *next;
323 } GENERIC_LIST;
325 /* Reverse the order of a list. */
326 extern GENERIC_LIST * reverse_list (GENERIC_LIST *list);
328 /* Possibly return Local Variables trailer for Info output. */
329 extern char *info_trailer (void),
330 *expansion (char *str, int implicit_code),
331 *text_expansion (char *str),
332 *maybe_escaped_expansion (char *str, int implicit_code, int do_escape_html),
333 *full_expansion (char *str, int implicit_code);
335 extern void free_and_clear (char **pointer),
336 add_word (char *string),
337 add_char (int character),
338 add_meta_char (int character),
339 close_single_paragraph (void),
340 insert_string (const char *),
341 insert (int character),
342 get_rest_of_line (int expand, char **string),
343 add_html_block_elt (char *string),
344 get_until_in_braces (char *match, char **string),
345 get_until_in_line (int expand, char *match, char **string),
346 canon_white (char *string),
347 discard_until (char *string),
348 indent (int amount),
349 kill_self_indent (int count),
350 backup_input_pointer (void),
351 inhibit_output_flushing (void),
352 uninhibit_output_flushing (void),
353 flush_output (void),
354 start_paragraph (void),
355 close_paragraph (void),
356 close_insertion_paragraph (void),
357 init_paragraph (void),
358 ignore_blank_line (void),
359 reader_loop (void),
360 discard_braces (void),
361 replace_with_expansion (int from, int *to),
362 fix_whitespace (char *string),
363 add_html_elt (char *string);
365 extern int get_until (char *match, char **string),
366 set_paragraph_indent (char *string),
367 self_delimiting (int character),
368 search_forward (char *string, int from),
369 search_forward_until_pos (char *string, int from, int end_pos),
370 next_nonwhitespace_character (void),
371 fs_error (char *filename);
373 #if defined (VA_FPRINTF) && __STDC__
374 /* Unfortunately we must use prototypes if we are to use <stdarg.h>. */
375 extern void add_word_args (const char *, ...),
376 add_html_block_elt_args (const char *, ...),
377 execute_string (char *, ...),
378 warning (const char *format, ...),
379 error (const char *format, ...),
380 line_error (const char *format, ...),
381 file_line_error (char *infile, int lno, const char *format, ...);
382 #else
383 extern void add_word_args (),
384 add_html_block_elt_args (),
385 execute_string (),
386 warning (),
387 error (),
388 line_error (),
389 file_line_error ();
390 #endif /* no prototypes */
392 #endif /* not MAKEINFO_H */