1/* makeinfo.h -- Declarations for Makeinfo. 2 $Id: makeinfo.h,v 1.1 2004/10/28 18:14:10 zooey Exp $ 3 4 Copyright (C) 1996, 97 Free Software Foundation, Inc. 5 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. 10 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. 15 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. 19 20 Written by Brian Fox (bfox@ai.mit.edu). */ 21 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 */ 26 27#if !defined (MAKEINFO_H) 28#define MAKEINFO_H 29 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 35 36enum insertion_type 37{ 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 46}; 47 48DECLARE (int, insertion_level, 0); 49 50#if defined (COMPILING_MAKEINFO) 51char *insertion_type_names[] = 52{ 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" 61}; 62#endif 63 64typedef struct istack_elt 65{ 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; 76 77DECLARE (INSERTION_ELT *, insertion_stack, (INSERTION_ELT *)NULL); 78 79/* Current output stream. */ 80DECLARE (FILE *, output_stream, (FILE *)NULL); 81 82/* Output paragraph buffer. */ 83DECLARE (unsigned char *, output_paragraph, (unsigned char *)NULL); 84 85/* Offset into OUTPUT_PARAGRAPH. */ 86DECLARE (int, output_paragraph_offset, 0); 87 88/* The output paragraph "cursor" horizontal position. */ 89DECLARE (int, output_column, 0); 90 91/* Non-zero means output_paragraph contains text. */ 92DECLARE (int, paragraph_is_open, 0); 93 94/* The amount of indentation to apply at the start of each line. */ 95DECLARE (int, current_indent, 0); 96 97/* nonzero if we are currently processing a multitable command */ 98DECLARE (int, multitable_active, 0); 99 100/* The column at which long lines are broken. */ 101DECLARE (int, fill_column, 72); 102 103/* The current input file state. */ 104DECLARE (char *, input_filename, (char *)NULL); 105DECLARE (char *, input_text, (char *)NULL); 106DECLARE (int, size_of_input_text, 0); 107DECLARE (int, input_text_offset, 0); 108DECLARE (int, line_number, 0); 109 110#define curchar() input_text[input_text_offset] 111/* **************************************************************** */ 112/* */ 113/* Global Defines */ 114/* */ 115/* **************************************************************** */ 116 117/* Error levels */ 118#define NO_ERROR 0 119#define SYNTAX 2 120#define FATAL 4 121 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. */ 124 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 130 131#define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c))) 132#define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c))) 133 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)) 140 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')) 144 145#ifndef isletter 146#define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z')) 147#endif 148 149#ifndef isupper 150#define isupper(c) ((c) >= 'A' && (c) <= 'Z') 151#endif 152 153#ifndef isdigit 154#define isdigit(c) ((c) >= '0' && (c) <= '9') 155#endif 156 157#ifndef digit_value 158#define digit_value(c) ((c) - '0') 159#endif 160 161#define member(c, s) (strchr (s, c) != NULL) 162 163#define COMMAND_PREFIX '@' 164 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. */ 168 169DECLARE (int, splitting, 1); /* Defaults to true for now. */ 170 171typedef void COMMAND_FUNCTION (); /* So I can say COMMAND_FUNCTION *foo; */ 172 173#define command_char(c) ((!whitespace(c)) && \ 174 ((c) != '\n') && \ 175 ((c) != '{') && \ 176 ((c) != '}') && \ 177 ((c) != '=')) 178 179#define skip_whitespace() \ 180 while ((input_text_offset != size_of_input_text) && \ 181 whitespace (curchar())) \ 182 input_text_offset++ 183 184#define skip_whitespace_and_newlines() \ 185 do { \ 186 while ((input_text_offset != size_of_input_text) && \ 187 (whitespace (curchar ()) || (curchar () == '\n'))) \ 188 { \ 189 if (curchar () == '\n') \ 190 line_number++; \ 191 input_text_offset++; \ 192 } \ 193 } while (0) 194 195#endif /* !MAKEINFO_H */ 196