1 /* makeinfo.h -- Declarations for Makeinfo.
2 $Id: makeinfo.h,v 1.1 1997/08/21 22:58:08 jason Exp $
4 Copyright (C) 1996 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 menu
, detailmenu
, quotation
, lisp
, smalllisp
, example
, smallexample
,
39 display
, itemize
, format
, enumerate
, cartouche
, multitable
, table
,
40 ftable
, vtable
, group
, ifinfo
, flushleft
, flushright
, ifset
,
41 ifclear
, deffn
, defun
, defmac
, defspec
, defvr
, defvar
, defopt
,
42 deftypefn
, deftypefun
, deftypevr
, deftypevar
, defcv
, defivar
, defop
,
43 defmethod
, deftypemethod
, deftp
, direntry
, bad_type
46 DECLARE (int, insertion_level
, 0);
48 #if defined (COMPILING_MAKEINFO)
49 char *insertion_type_names
[] =
51 "menu", "detailmenu", "quotation", "lisp", "smalllisp", "example",
52 "smallexample", "display", "itemize", "format", "enumerate",
53 "cartouche", "multitable", "table", "ftable", "vtable", "group",
54 "ifinfo", "flushleft", "flushright", "ifset", "ifclear", "deffn",
55 "defun", "defmac", "defspec", "defvr", "defvar", "defopt",
56 "deftypefn", "deftypefun", "deftypevr", "deftypevar", "defcv",
57 "defivar", "defop", "defmethod", "deftypemethod", "deftp", "direntry",
62 typedef struct istack_elt
64 struct istack_elt
*next
;
70 enum insertion_type insertion
;
72 int in_fixed_width_font
;
75 DECLARE (INSERTION_ELT
*, insertion_stack
, (INSERTION_ELT
*)NULL
);
77 /* Current output stream. */
78 DECLARE (FILE *, output_stream
, (FILE *)NULL
);
80 /* Output paragraph buffer. */
81 DECLARE (unsigned char *, output_paragraph
, (unsigned char *)NULL
);
83 /* Offset into OUTPUT_PARAGRAPH. */
84 DECLARE (int, output_paragraph_offset
, 0);
86 /* The output paragraph "cursor" horizontal position. */
87 DECLARE (int, output_column
, 0);
89 /* Non-zero means output_paragraph contains text. */
90 DECLARE (int, paragraph_is_open
, 0);
92 /* The amount of indentation to apply at the start of each line. */
93 DECLARE (int, current_indent
, 0);
95 /* nonzero if we are currently processing a multitable command */
96 DECLARE (int, multitable_active
, 0);
98 /* The column at which long lines are broken. */
99 DECLARE (int, fill_column
, 72);
101 /* The current input file state. */
102 DECLARE (char *, input_filename
, (char *)NULL
);
103 DECLARE (char *, input_text
, (char *)NULL
);
104 DECLARE (int, size_of_input_text
, 0);
105 DECLARE (int, input_text_offset
, 0);
106 DECLARE (int, line_number
, 0);
108 #define curchar() input_text[input_text_offset]
109 /* **************************************************************** */
113 /* **************************************************************** */
120 /* C's standard macros don't check to make sure that the characters being
121 changed are within range. So I have to check explicitly. */
123 /* GNU Library doesn't have toupper(). Until GNU gets this fixed, I will
126 #define toupper(c) ((c) - 32)
129 #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
130 #define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c)))
132 #define control_character_bit 0x40 /* %01000000, must be off. */
133 #define meta_character_bit 0x080/* %10000000, must be on. */
134 #define CTL(c) ((c) & (~control_character_bit))
135 #define UNCTL(c) coerce_to_upper(((c)|control_character_bit))
136 #define META(c) ((c) | (meta_character_bit))
137 #define UNMETA(c) ((c) & (~meta_character_bit))
139 #define whitespace(c) (((c) == '\t') || ((c) == ' '))
140 #define sentence_ender(c) ((c) == '.' || (c) == '?' || (c) == '!')
141 #define cr_or_whitespace(c) (((c) == '\t') || ((c) == ' ') || ((c) == '\n'))
144 #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
148 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
152 #define isdigit(c) ((c) >= '0' && (c) <= '9')
156 #define digit_value(c) ((c) - '0')
159 #define member(c, s) (strchr (s, c) != NULL)
161 #define COMMAND_PREFIX '@'
163 /* Stuff for splitting large files. */
164 #define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */
165 #define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */
167 DECLARE (int, splitting
, 1); /* Defaults to true for now. */
169 typedef void COMMAND_FUNCTION (); /* So I can say COMMAND_FUNCTION *foo; */
171 #define command_char(c) ((!whitespace(c)) && \
177 #define skip_whitespace() \
178 while ((input_text_offset != size_of_input_text) && \
179 whitespace (curchar())) \
182 #define skip_whitespace_and_newlines() \
184 while ((input_text_offset != size_of_input_text) && \
185 (whitespace (curchar ()) || (curchar () == '\n'))) \
187 if (curchar () == '\n') \
189 input_text_offset++; \
193 #endif /* !MAKEINFO_H */