* gcc.c-torture/compile/20000701-1.c: New test.
[official-gcc.git] / texinfo / makeinfo / makeinfo.h
blobdccb0b78dadc59837572c0a22d2c46d7200a5fd6
1 /* makeinfo.h -- Declarations for Makeinfo.
2 $Id: makeinfo.h,v 1.1.1.2 1998/03/22 20:43:08 law 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)
9 any later version.
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)
28 #define MAKEINFO_H
30 #if defined (COMPILING_MAKEINFO)
31 # define DECLARE(type, var, init) type var = init
32 #else
33 # define DECLARE(type, var, init) extern type var
34 #endif
36 enum insertion_type
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,
45 bad_type
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",
60 "bad_type"
62 #endif
64 typedef struct istack_elt
66 struct istack_elt *next;
67 char *item_function;
68 char *filename;
69 int line_number;
70 int filling_enabled;
71 int indented_fill;
72 enum insertion_type insertion;
73 int inhibited;
74 int in_fixed_width_font;
75 } INSERTION_ELT;
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 /* **************************************************************** */
112 /* */
113 /* Global Defines */
114 /* */
115 /* **************************************************************** */
117 /* Error levels */
118 #define NO_ERROR 0
119 #define SYNTAX 2
120 #define FATAL 4
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
126 have to do it. */
127 #ifndef toupper
128 #define toupper(c) ((c) - 32)
129 #endif
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'))
145 #ifndef isletter
146 #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
147 #endif
149 #ifndef isupper
150 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')
151 #endif
153 #ifndef isdigit
154 #define isdigit(c) ((c) >= '0' && (c) <= '9')
155 #endif
157 #ifndef digit_value
158 #define digit_value(c) ((c) - '0')
159 #endif
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)) && \
174 ((c) != '\n') && \
175 ((c) != '{') && \
176 ((c) != '}') && \
177 ((c) != '='))
179 #define skip_whitespace() \
180 while ((input_text_offset != size_of_input_text) && \
181 whitespace (curchar())) \
182 input_text_offset++
184 #define skip_whitespace_and_newlines() \
185 do { \
186 while ((input_text_offset != size_of_input_text) && \
187 (whitespace (curchar ()) || (curchar () == '\n'))) \
189 if (curchar () == '\n') \
190 line_number++; \
191 input_text_offset++; \
193 } while (0)
195 #endif /* !MAKEINFO_H */