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