1 /* makeinfo.h -- Declarations for Makeinfo.
2 $Id: makeinfo.h,v 1.3 1997/07/15 18:28:38 karl Exp $
4 Copyright (C) 1996, 97 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). */
22 /* Why, oh why, did I ever listen to rms when he said:
23 "Don't make lots of small files, just make one big one!" I've
24 regretted it ever since with this program, and with readline.
25 bfox@ai.mit.edu Thu Jul 11 07:54:32 1996 */
27 #if !defined (MAKEINFO_H)
30 #if defined (COMPILING_MAKEINFO)
31 # define DECLARE(type, var, init) type var = init
33 # define DECLARE(type, var, init) extern type var
38 cartouche, defcv, deffn, defivar, defmac, defmethod,
39 defop, defopt, defspec, deftp, deftypefn, deftypefun,
40 deftypemethod, deftypevar, deftypevr, defun, defvar,
41 defvr, detailmenu, direntry, display, enumerate, example,
42 flushleft, flushright, format, ftable, group, ifclear,
43 ifinfo, ifnothtml, ifnottex, ifset, itemize, lisp, menu,
44 multitable, quotation, smallexample, smalllisp, table, vtable,
48 DECLARE (int, insertion_level, 0);
50 #if defined (COMPILING_MAKEINFO)
51 char *insertion_type_names[] =
53 "cartouche", "defcv", "deffn", "defivar", "defmac", "defmethod",
54 "defop", "defopt", "defspec", "deftp", "deftypefn", "deftypefun",
55 "deftypemethod", "deftypevar", "deftypevr", "defun", "defvar",
56 "defvr", "detailmenu", "direntry", "display", "enumerate", "example",
57 "flushleft", "flushright", "format", "ftable", "group", "ifclear",
58 "ifinfo", "ifnothtml", "ifnottex", "ifset", "itemize", "lisp", "menu",
59 "multitable", "quotation", "smallexample", "smalllisp", "table", "vtable",
64 typedef struct istack_elt
66 struct istack_elt *next;
72 enum insertion_type insertion;
74 int in_fixed_width_font;
77 DECLARE (INSERTION_ELT *, insertion_stack, (INSERTION_ELT *)NULL);
79 /* Current output stream. */
80 DECLARE (FILE *, output_stream, (FILE *)NULL);
82 /* Output paragraph buffer. */
83 DECLARE (unsigned char *, output_paragraph, (unsigned char *)NULL);
85 /* Offset into OUTPUT_PARAGRAPH. */
86 DECLARE (int, output_paragraph_offset, 0);
88 /* The output paragraph "cursor" horizontal position. */
89 DECLARE (int, output_column, 0);
91 /* Non-zero means output_paragraph contains text. */
92 DECLARE (int, paragraph_is_open, 0);
94 /* The amount of indentation to apply at the start of each line. */
95 DECLARE (int, current_indent, 0);
97 /* nonzero if we are currently processing a multitable command */
98 DECLARE (int, multitable_active, 0);
100 /* The column at which long lines are broken. */
101 DECLARE (int, fill_column, 72);
103 /* The current input file state. */
104 DECLARE (char *, input_filename, (char *)NULL);
105 DECLARE (char *, input_text, (char *)NULL);
106 DECLARE (int, size_of_input_text, 0);
107 DECLARE (int, input_text_offset, 0);
108 DECLARE (int, line_number, 0);
110 #define curchar() input_text[input_text_offset]
111 /* **************************************************************** */
115 /* **************************************************************** */
122 /* C's standard macros don't check to make sure that the characters being
123 changed are within range. So I have to check explicitly. */
125 /* GNU Library doesn't have toupper(). Until GNU gets this fixed, I will
128 #define toupper(c) ((c) - 32)
131 #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
132 #define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c)))
134 #define control_character_bit 0x40 /* %01000000, must be off. */
135 #define meta_character_bit 0x080/* %10000000, must be on. */
136 #define CTL(c) ((c) & (~control_character_bit))
137 #define UNCTL(c) coerce_to_upper(((c)|control_character_bit))
138 #define META(c) ((c) | (meta_character_bit))
139 #define UNMETA(c) ((c) & (~meta_character_bit))
141 #define whitespace(c) (((c) == '\t') || ((c) == ' '))
142 #define sentence_ender(c) ((c) == '.' || (c) == '?' || (c) == '!')
143 #define cr_or_whitespace(c) (((c) == '\t') || ((c) == ' ') || ((c) == '\n'))
146 #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
150 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
154 #define isdigit(c) ((c) >= '0' && (c) <= '9')
158 #define digit_value(c) ((c) - '0')
161 #define member(c, s) (strchr (s, c) != NULL)
163 #define COMMAND_PREFIX '@'
165 /* Stuff for splitting large files. */
166 #define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */
167 #define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */
169 DECLARE (int, splitting, 1); /* Defaults to true for now. */
171 typedef void COMMAND_FUNCTION (); /* So I can say COMMAND_FUNCTION *foo; */
173 #define command_char(c) ((!whitespace(c)) && \
179 #define skip_whitespace() \
180 while ((input_text_offset != size_of_input_text) && \
181 whitespace (curchar())) \
184 #define skip_whitespace_and_newlines() \
186 while ((input_text_offset != size_of_input_text) && \
187 (whitespace (curchar ()) || (curchar () == '\n'))) \
189 if (curchar () == '\n') \
191 input_text_offset++; \
195 #endif /* !MAKEINFO_H */