1 /* makeinfo.h -- declarations for Makeinfo.
2 $Id: makeinfo.h,v 1.25 1999/09/18 18:09:22 karl Exp $
4 Copyright (C) 1996, 97, 98, 99 Free Software Foundation, Inc.
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)
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.
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.
20 Written by Brian Fox (bfox@ai.mit.edu). */
25 #ifdef COMPILING_MAKEINFO
26 # define DECLARE(type,var,init) type var = init
28 # define DECLARE(type,var,init) extern type var
31 /* Hardcoded per GNU standards, not dependent on argv[0]. */
32 DECLARE (char *, progname, "makeinfo");
36 menu_reference, followed_reference
39 extern char *get_xref_token ();
41 /* Nonzero means a string is in execution, as opposed to a file. */
42 DECLARE (int, executing_string, 0);
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);
48 extern char *expansion (), *text_expansion ();
50 /* Current output stream. */
51 DECLARE (FILE *, output_stream, NULL);
53 DECLARE (char *, pretty_output_filename, NULL);
55 /* Current output file name. */
56 DECLARE (char *, current_output_filename, NULL);
58 /* Output paragraph buffer. */
59 DECLARE (unsigned char *, output_paragraph, NULL);
61 /* Offset into OUTPUT_PARAGRAPH. */
62 DECLARE (int, output_paragraph_offset, 0);
64 /* The output paragraph "cursor" horizontal position. */
65 DECLARE (int, output_column, 0);
67 /* Position in the output file. */
68 DECLARE (int, output_position, 0);
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);
74 /* Nonzero means output_paragraph contains text. */
75 DECLARE (int, paragraph_is_open, 0);
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);
81 /* Nonzero means that we have seen "@top" once already. */
82 DECLARE (int, top_node_seen, 0);
84 /* Nonzero means that we have seen a non-"@top" node already. */
85 DECLARE (int, non_top_node_seen, 0);
87 /* Nonzero indicates that indentation is temporarily turned off. */
88 DECLARE (int, no_indent, 1);
90 /* Nonzero indicates that filling a line also indents the new line. */
91 DECLARE (int, indented_fill, 0);
93 /* Nonzero means forcing output text to be flushright. */
94 DECLARE (int, force_flush_right, 0);
96 /* The amount of indentation to apply at the start of each line. */
97 DECLARE (int, current_indent, 0);
99 /* The column at which long lines are broken. */
100 DECLARE (int, fill_column, 72);
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);
106 /* Amount by which @example indentation increases/decreases. */
107 DECLARE (int, default_indentation_increment, 5);
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);
113 /* Nonzero if we are currently processing a multitable command */
114 DECLARE (int, multitable_active, 0);
116 /* Nonzero means that we're generating HTML. */
117 DECLARE (int, html, 0);
119 /* Nonzero means escape characters in HTML output. */
120 DECLARE (int, escape_html, 1);
121 extern char *escape_string (); /* do HTML escapes */
123 /* Nonzero means that the use of paragraph_start_indent is inhibited.
124 @example uses this to line up the left columns of the example text.
125 A negative value for this variable is incremented each time it is used.
126 @noindent uses this to inhibit indentation for a single paragraph. */
127 DECLARE (int, inhibit_paragraph_indentation, 0);
129 /* Nonzero indicates that filling will take place on long lines. */
130 DECLARE (int, filling_enabled, 1);
132 /* The current node's node name. */
133 DECLARE (char *, current_node, NULL);
135 /* Command name in the process of being hacked. */
136 DECLARE (char *, command, NULL);
138 /* Nonzero if the last character inserted has the syntax class of NEWLINE. */
139 DECLARE (int, last_char_was_newline, 1);
141 /* The current input file state. */
142 DECLARE (char *, input_filename, (char *)NULL);
143 DECLARE (char *, input_text, (char *)NULL);
144 DECLARE (int, input_text_length, 0);
145 DECLARE (int, input_text_offset, 0);
146 DECLARE (int, line_number, 0);
147 #define curchar() input_text[input_text_offset]
149 /* A colon separated list of directories to search for files included
150 with @include. This can be controlled with the `-I' option to makeinfo. */
151 DECLARE (char *, include_files_path, NULL);
153 /* The filename of the current input file. This is never freed. */
154 DECLARE (char *, node_filename, NULL);
156 /* Nonzero means do not output "Node: Foo" for node separations, that
157 is, generate plain text. (--no-headers) */
158 DECLARE (int, no_headers, 0);
160 /* Nonzero means that we process @html and @rawhtml even when not
161 generating HTML. (--ifhtml) */
162 DECLARE (int, process_html, 0);
164 /* Nonzero means that we process @ifinfo even when generating HTML.
166 DECLARE (int, process_info, 1);
168 /* Nonzero means that we process @tex and @iftex. (--iftex) */
169 DECLARE (int, process_tex, 0);
171 /* Maximum number of references to a single node before complaining.
172 (--reference-limit) */
173 DECLARE (int, reference_warning_limit, 1000);
175 /* Default is to check node references. (--no-validate) */
176 DECLARE (int, validating, 1);
178 /* Nonzero means print information about what is going on. (--verbose) */
179 DECLARE (int, verbose_mode, 0);
181 /* Nonzero means prefix each @chapter, ... with a number like 1. (--number-sections) */
182 DECLARE (int, number_sections, 0);
184 /* Nonzero means expand node names and references while validating.
185 This will avoid errors when the Texinfo document uses features
186 like @@ and @value inconsistently in node names, but will slow
187 the program by about 80%. You HAVE been warned. */
188 DECLARE (int, expensive_validation, 0);
190 /* C's standard macros don't check to make sure that the characters being
191 changed are within range. So I have to check explicitly. */
193 #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
194 #define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c)))
196 #define control_character_bit 0x40 /* %01000000, must be off. */
197 #define meta_character_bit 0x080/* %10000000, must be on. */
198 #define CTL(c) ((c) & (~control_character_bit))
199 #define UNCTL(c) coerce_to_upper(((c)|control_character_bit))
200 #define META(c) ((c) | (meta_character_bit))
201 #define UNMETA(c) ((c) & (~meta_character_bit))
203 #define whitespace(c) ((c) == '\t' || (c) == ' ')
204 #define sentence_ender(c) ((c) == '.' || (c) == '?' || (c) == '!')
205 #define cr_or_whitespace(c) (whitespace(c) || (c) == '\r' || (c) == '\n')
208 #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
212 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
216 #define isdigit(c) ((c) >= '0' && (c) <= '9')
220 #define digit_value(c) ((c) - '0')
223 #define HTML_SAFE "$-_.+!*'()"
224 #define URL_SAFE_CHAR(ch) (isalnum (ch) || strchr (HTML_SAFE, ch))
226 #define COMMAND_PREFIX '@'
228 /* Stuff for splitting large files. */
229 #define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */
230 #define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */
231 DECLARE (int, splitting, 1); /* Defaults to true for now. */
233 #define command_char(c) (!cr_or_whitespace(c) \
238 #define skip_whitespace() \
239 while ((input_text_offset != input_text_length) && \
240 whitespace (curchar())) \
243 #define skip_whitespace_and_newlines() \
245 while (input_text_offset != input_text_length \
246 && cr_or_whitespace (curchar ())) \
248 if (curchar () == '\n') \
250 input_text_offset++; \
254 /* Return nonzero if STRING is the text at input_text + input_text_offset,
256 #define looking_at(string) \
257 (strncmp (input_text + input_text_offset, string, strlen (string)) == 0)
260 #endif /* not MAKEINFO_H */