Back to index

tetex-bin  3.0
makeinfo.h
Go to the documentation of this file.
00001 /* makeinfo.h -- declarations for Makeinfo.
00002    $Id: makeinfo.h,v 1.17 2004/11/30 02:03:23 karl Exp $
00003 
00004    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
00005    Software Foundation, Inc.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 
00021    Written by Brian Fox (bfox@ai.mit.edu). */
00022 
00023 #ifndef MAKEINFO_H
00024 #define MAKEINFO_H
00025 
00026 #ifdef COMPILING_MAKEINFO
00027 #  define DECLARE(type,var,init) type var = init
00028 #else
00029 #  define DECLARE(type,var,init) extern type var
00030 #endif
00031 
00032 /* Hardcoded per GNU standards, not dependent on argv[0].  */
00033 DECLARE (char *, progname, "makeinfo");
00034 
00035 /* Nonzero means a string is in execution, as opposed to a file. */
00036 DECLARE (int, executing_string, 0);
00037 
00038 /* Nonzero means to inhibit writing macro expansions to the output
00039    stream, because it has already been written. */
00040 DECLARE (int, me_inhibit_expansion, 0);
00041 
00042 /* Current output stream. */
00043 DECLARE (FILE *, output_stream, NULL);
00044 
00045 DECLARE (char *, pretty_output_filename, NULL);
00046 
00047 /* Current output file name.  */
00048 DECLARE (char *, current_output_filename, NULL);
00049 
00050 /* Output paragraph buffer. */
00051 DECLARE (unsigned char *, output_paragraph, NULL);
00052 
00053 /* Offset into OUTPUT_PARAGRAPH. */
00054 DECLARE (int, output_paragraph_offset, 0);
00055 
00056 /* The output paragraph "cursor" horizontal position. */
00057 DECLARE (int, output_column, 0);
00058 
00059 /* Position in the output file. */
00060 DECLARE (int, output_position, 0);
00061 
00062 /* Number of lines in the output.  */
00063 DECLARE (int, output_line_number, 1);
00064 DECLARE (int, node_line_number, 0);
00065 
00066 /* The offset into OUTPUT_PARAGRAPH where we have a meta character
00067    produced by a markup such as @code or @dfn.  */
00068 DECLARE (int, meta_char_pos, -1);
00069 
00070 /* Nonzero means output_paragraph contains text. */
00071 DECLARE (int, paragraph_is_open, 0);
00072 
00073 /* Nonzero means that `start_paragraph' MUST be called before we pay
00074    any attention to `close_paragraph' calls. */
00075 DECLARE (int, must_start_paragraph, 0);
00076 
00077 /* Nonzero means that we have seen "@top" once already. */
00078 DECLARE (int, top_node_seen, 0);
00079 
00080 /* Nonzero means that we have seen a non-"@top" node already. */
00081 DECLARE (int, non_top_node_seen, 0);
00082 
00083 /* Nonzero indicates that indentation is temporarily turned off. */
00084 DECLARE (int, no_indent, 1);
00085 
00086 /* The amount of indentation to apply at the start of each line. */
00087 DECLARE (int, current_indent, 0);
00088 
00089 /* Nonzero means that we suppress the indentation of the first paragraph
00090    following any section heading.  */
00091 DECLARE (int, do_first_par_indent, 0);
00092 
00093 /* Amount by which @example indentation increases/decreases. */
00094 DECLARE (int, example_indentation_increment, 5);
00095 
00096 /* Amount by which @table, @defun, etc. indentation increases/decreases.  */
00097 DECLARE (int, default_indentation_increment, 5);
00098 
00099 /* Amount by which xml indentation increases/decreases.
00100    Zero means unnecessary whitespace is compressed.  */
00101 DECLARE (int, xml_indentation_increment, 2);
00102 
00103 /* Nonzero indicates that filling a line also indents the new line. */
00104 DECLARE (int, indented_fill, 0);
00105 
00106 /* Nonzero means forcing output text to be flushright. */
00107 DECLARE (int, force_flush_right, 0);
00108 
00109 /* The column at which long lines are broken. */
00110 DECLARE (int, fill_column, 72);
00111 
00112 /* Nonzero means that words are not to be split, even in long lines.  This
00113    gets changed for cm_w (). */
00114 DECLARE (int, non_splitting_words, 0);
00115 
00116 /* Nonzero means that we are currently hacking the insides of an
00117    insertion which would use a fixed width font. */
00118 DECLARE (int, in_fixed_width_font, 0);
00119 
00120 /* Nonzero if we are currently processing a multitable command */
00121 DECLARE (int, multitable_active, 0);
00122 
00123 /* Nonzero means that we're generating HTML. (--html) */
00124 DECLARE (int, html, 0);
00125 
00126 /* Nonzero means that we're generating XML. (--xml) */
00127 DECLARE (int, xml, 0);
00128 
00129 /* Nonzero means that we're generating DocBook. (--docbook) */
00130 DECLARE (int, docbook, 0);
00131 
00132 /* Nonzero means true 8-bit output for Info and plain text.
00133    (--enable-encoding) */
00134 DECLARE (int, enable_encoding, 0);
00135 
00136 /* Nonzero means escape characters in HTML output. */
00137 DECLARE (int, escape_html, 1);
00138 
00139 /* Access key number for next menu entry to be generated (1 to 9, or 10 to
00140    mean no access key)  */
00141 DECLARE (int, next_menu_item_number, 1);
00142 
00143 /* Nonzero means that the use of paragraph_start_indent is inhibited.
00144    @example uses this to line up the left columns of the example text.
00145    A negative value for this variable is incremented each time it is used.
00146    @noindent uses this to inhibit indentation for a single paragraph.  */
00147 DECLARE (int, inhibit_paragraph_indentation, 0);
00148 
00149 /* Nonzero indicates that filling will take place on long lines. */
00150 DECLARE (int, filling_enabled, 1);
00151 
00152 /* The current node's node name. */
00153 DECLARE (char *, current_node, NULL);
00154 
00155 /* Command name in the process of being hacked. */
00156 DECLARE (char *, command, NULL);
00157 
00158 /* Nonzero if we have seen an @titlepage command.  */
00159 DECLARE (int, titlepage_cmd_present, 0);
00160 
00161 /* @copying ... @end copying. */
00162 DECLARE (char *, copying_text, NULL);
00163 
00164 /* @documentdescription ... @end documentdescription. */
00165 DECLARE (const char *, document_description, NULL);
00166 
00167 /* Nonzero if the last character inserted has the syntax class of NEWLINE. */
00168 DECLARE (int, last_char_was_newline, 1);
00169 
00170 /* The current input file state. */
00171 DECLARE (char *, input_filename, (char *)NULL);
00172 DECLARE (char *, input_text, (char *)NULL);
00173 DECLARE (int, input_text_length, 0);
00174 DECLARE (int, input_text_offset, 0);
00175 DECLARE (int, line_number, 0);
00176 DECLARE (char *, toplevel_output_filename, NULL);
00177 #define curchar() input_text[input_text_offset]
00178 
00179 /* A colon separated list of directories to search for files included
00180    with @include.  This can be controlled with the `-I' option to makeinfo. */
00181 DECLARE (char *, include_files_path, NULL);
00182 
00183 /* The filename of the current input file.  This is never freed. */
00184 DECLARE (char *, node_filename, NULL);
00185 
00186 /* Name of CSS file to include, if any.  (--css-include).  */
00187 DECLARE (char *, css_include, NULL);
00188 
00189 /* Nonzero means do not output "Node: Foo" for node separations, that
00190    is, generate plain text.  (--no-headers) */
00191 DECLARE (int, no_headers, 0);
00192 
00193 /* Nonzero means that we process @docbook and @ifdocbook.  (--ifdocbook) */
00194 DECLARE (int, process_docbook, 0);
00195 
00196 /* Nonzero means that we process @html and @rawhtml even when not
00197    generating HTML.  (--ifhtml) */
00198 DECLARE (int, process_html, 0);
00199 
00200 /* Positive means process @ifinfo (even if not generating Info);
00201    zero means don't process @ifinfo (even if we are);
00202    -1 means we don't know yet.  (--ifinfo) */
00203 DECLARE (int, process_info, -1);
00204 
00205 /* Positive means process @ifplaintext (even if not generating plain text);
00206    zero means we don't process @ifplaintext (even if we are);
00207    -1 means we don't know yet.  (--ifplaintext) */
00208 DECLARE (int, process_plaintext, -1);
00209 
00210 /* Nonzero means that we process @tex and @iftex.  (--iftex) */
00211 DECLARE (int, process_tex, 0);
00212 
00213 /* Nonzero means that we process @xml and @ifxml.  (--ifxml) */
00214 DECLARE (int, process_xml, 0);
00215 
00216 /* Maximum number of references to a single node before complaining.
00217    (--reference-limit) */
00218 DECLARE (int, reference_warning_limit, 1000);
00219 
00220 /* Default is to check node references.  (--no-validate) */
00221 DECLARE (int, validating, 1);
00222 
00223 /* Nonzero means print information about what is going on.  (--verbose) */
00224 DECLARE (int, verbose_mode, 0);
00225 
00226 /* Nonzero means prefix each @chapter, ... with a number like
00227    1, 1.1, etc.  (--number-sections) */
00228 DECLARE (int, number_sections, 1);
00229 
00230 /* Nonzero means split size.  When zero, DEFAULT_SPLIT_SIZE is used. */
00231 DECLARE (int, split_size, 0);
00232 
00233 /* Nonzero means expand node names and references while validating.
00234    This will avoid errors when the Texinfo document uses features
00235    like @@ and @value inconsistently in node names, but will slow
00236    the program by about 80%.  You HAVE been warned.  */
00237 DECLARE (int, expensive_validation, 0);
00238 
00239 /* C's standard macros don't check to make sure that the characters being
00240    changed are within range.  So I have to check explicitly. */
00241 
00242 #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
00243 #define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c)))
00244 
00245 #define control_character_bit 0x40 /* %01000000, must be off. */
00246 #define meta_character_bit 0x080/* %10000000, must be on.  */
00247 #define CTL(c) ((c) & (~control_character_bit))
00248 #define UNCTL(c) coerce_to_upper(((c)|control_character_bit))
00249 #define META(c) ((c) | (meta_character_bit))
00250 #define UNMETA(c) ((c) & (~meta_character_bit))
00251 
00252 #define whitespace(c)       ((c) == '\t' || (c) == ' ')
00253 #define sentence_ender(c)   ((c) == '.'  || (c) == '?' || (c) == '!')
00254 #define cr_or_whitespace(c) (whitespace(c) || (c) == '\r' || (c) == '\n')
00255 
00256 #ifndef isletter
00257 #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
00258 #endif
00259 
00260 #ifndef isupper
00261 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
00262 #endif
00263 
00264 #ifndef isdigit
00265 #define isdigit(c)  ((c) >= '0' && (c) <= '9')
00266 #endif
00267 
00268 #ifndef digit_value
00269 #define digit_value(c) ((c) - '0')
00270 #endif
00271 
00272 /* These characters are not really HTML-safe (with strict XHTML),
00273    and also there are possible collisions.  That's the whole reason we
00274    designed a new conversion scheme in the first place.  But we
00275    nevertheless need to generate the old names.  See
00276    `add_escaped_anchor_name' in html.c.  */
00277 #define OLD_HTML_SAFE "$-_.+!*'()"
00278 #define OLD_URL_SAFE_CHAR(ch) (strchr (OLD_HTML_SAFE, ch))
00279 
00280 /* For the current/stable scheme.  */
00281 #define URL_SAFE_CHAR(ch) (isalnum (ch))
00282 
00283 #define COMMAND_PREFIX '@'
00284 
00285 #define END_VERBATIM "end verbatim"
00286 
00287 /* Stuff for splitting large files.  The numbers for Emacs
00288    texinfo-format-buffer are much smaller, but memory capacities have
00289    increased so much, 50k info files seem a bit tiny these days.  */
00290 #define DEFAULT_SPLIT_SIZE 300000
00291 DECLARE (int, splitting, 1);    /* Defaults to true for now. */
00292 
00293 #define skip_whitespace() \
00294      while ((input_text_offset != input_text_length) && \
00295              whitespace (curchar())) \
00296        input_text_offset++
00297 
00298 #define skip_whitespace_and_newlines() \
00299   do { \
00300    while (input_text_offset != input_text_length \
00301           && cr_or_whitespace (curchar ())) \
00302       { \
00303          if (curchar () == '\n') \
00304            line_number++; \
00305          input_text_offset++; \
00306       } \
00307    } while (0)
00308 
00309 /* Return nonzero if STRING is the text at input_text + input_text_offset,
00310    else zero. */
00311 #define looking_at(string) \
00312   (strncmp (input_text + input_text_offset, string, strlen (string)) == 0)
00313 
00314 /* Any list with a member named `next'.  */
00315 typedef struct generic_list {
00316   struct generic_list *next;
00317 } GENERIC_LIST;
00318 
00319 /* Reverse the order of a list.  */
00320 extern GENERIC_LIST * reverse_list (GENERIC_LIST *list);
00321 
00322 /* Possibly return Local Variables trailer for Info output.  */
00323 extern char *info_trailer (void),
00324   *expansion (char *str, int implicit_code),
00325   *text_expansion (char *str),
00326   *maybe_escaped_expansion (char *str, int implicit_code, int do_escape_html),
00327   *full_expansion (char *str, int implicit_code);
00328 
00329 extern void free_and_clear (char **pointer),
00330   add_word (char *string),
00331   add_char (int character),
00332   add_meta_char (int character),
00333   close_single_paragraph (void),
00334   insert_string (const char *),
00335   insert (int character),
00336   get_rest_of_line (int expand, char **string),
00337   add_html_block_elt (char *string),
00338   get_until_in_braces (char *match, char **string),
00339   get_until_in_line (int expand, char *match, char **string),
00340   canon_white (char *string),
00341   discard_until (char *string),
00342   indent (int amount),
00343   kill_self_indent (int count),
00344   backup_input_pointer (void),
00345   inhibit_output_flushing (void),
00346   uninhibit_output_flushing (void),
00347   flush_output (void),
00348   start_paragraph (void),
00349   close_paragraph (void),
00350   close_insertion_paragraph (void),
00351   init_paragraph (void),
00352   ignore_blank_line (void),
00353   reader_loop (void),
00354   discard_braces (void),
00355   replace_with_expansion (int from, int *to),
00356   fix_whitespace (char *string),
00357   add_html_elt (char *string);
00358 
00359 extern int get_until (char *match, char **string),
00360   set_paragraph_indent (char *string),
00361   self_delimiting (int character),
00362   search_forward (char *string, int from),
00363   search_forward_until_pos (char *string, int from, int end_pos),
00364   next_nonwhitespace_character (void),
00365   fs_error (char *filename);
00366 
00367 #if defined (VA_FPRINTF) && __STDC__
00368 /* Unfortunately we must use prototypes if we are to use <stdarg.h>.  */
00369 extern void add_word_args (const char *, ...),
00370   add_html_block_elt_args (const char *, ...),
00371   execute_string (char *, ...),
00372   warning (const char *format, ...),
00373   error (const char *format, ...),
00374   line_error (const char *format, ...),
00375   file_line_error (char *infile, int lno, const char *format, ...);
00376 #else
00377 extern void add_word_args (),
00378   add_html_block_elt_args (),
00379   execute_string (),
00380   warning (),
00381   error (),
00382   line_error (),
00383   file_line_error ();
00384 #endif /* no prototypes */
00385 
00386 #endif /* not MAKEINFO_H */