1 /* info.h -- Header file which includes all of the other headers. 2 $Id: info.h,v 1.1.1.2 1997/08/01 22:00:21 kstailey Exp $ 3 4 This file is part of GNU Info, a program for reading online documentation 5 stored in Info format. 6 7 Copyright (C) 1993, 97 Free Software Foundation, Inc. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2, or (at your option) 12 any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 23 Written by Brian Fox (bfox@ai.mit.edu). */ 24 25 #if !defined (INFO_H) 26 #define INFO_H 27 28 /* We always want these, so why clutter up the compile command? */ 29 #define HANDLE_MAN_PAGES 30 #define NAMED_FUNCTIONS 31 32 /* System dependencies. */ 33 #include "system.h" 34 35 /* Some of our other include files use these. */ 36 typedef int Function (); 37 typedef void VFunction (); 38 typedef char *CFunction (); 39 40 41 #include "filesys.h" 42 #include "display.h" 43 #include "session.h" 44 #include "echo-area.h" 45 #include "doc.h" 46 #include "footnotes.h" 47 #include "gc.h" 48 49 #define info_toupper(x) (islower (x) ? toupper (x) : x) 50 #define info_tolower(x) (isupper (x) ? tolower (x) : x) 51 52 #if !defined (whitespace) 53 # define whitespace(c) ((c == ' ') || (c == '\t')) 54 #endif /* !whitespace */ 55 56 #if !defined (whitespace_or_newline) 57 # define whitespace_or_newline(c) (whitespace (c) || (c == '\n')) 58 #endif /* !whitespace_or_newline */ 59 60 /* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number 61 of slots that have already been allocated. INDEX is the index into the 62 array where POINTER should be added. GROW is the number of slots to grow 63 ARRAY by, in the case that it needs growing. TYPE is a cast of the type 64 of object stored in ARRAY (e.g., NODE_ENTRY *. */ 65 #define add_pointer_to_array(pointer, idx, array, slots, grow, type) \ 66 do { \ 67 if (idx + 2 >= slots) \ 68 array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \ 69 array[idx++] = (type)pointer; \ 70 array[idx] = (type)NULL; \ 71 } while (0) 72 73 #define maybe_free(x) do { if (x) free (x); } while (0) 74 75 #if !defined (zero_mem) && defined (HAVE_MEMSET) 76 # define zero_mem(mem, length) memset (mem, 0, length) 77 #endif /* !zero_mem && HAVE_MEMSET */ 78 79 #if !defined (zero_mem) && defined (HAVE_BZERO) 80 # define zero_mem(mem, length) bzero (mem, length) 81 #endif /* !zero_mem && HAVE_BZERO */ 82 83 #if !defined (zero_mem) 84 # define zero_mem(mem, length) \ 85 do { \ 86 register int zi; \ 87 register unsigned char *place; \ 88 \ 89 place = (unsigned char *)mem; \ 90 for (zi = 0; zi < length; zi++) \ 91 place[zi] = 0; \ 92 } while (0) 93 #endif /* !zero_mem */ 94 95 96 /* A structure associating the nodes visited in a particular window. */ 97 typedef struct { 98 WINDOW *window; /* The window that this list is attached to. */ 99 NODE **nodes; /* Array of nodes visited in this window. */ 100 int *pagetops; /* For each node in NODES, the pagetop. */ 101 long *points; /* For each node in NODES, the point. */ 102 int current; /* Index in NODES of the current node. */ 103 int nodes_index; /* Index where to add the next node. */ 104 int nodes_slots; /* Number of slots allocated to NODES. */ 105 } INFO_WINDOW; 106 107 /* Array of structures describing for each window which nodes have been 108 visited in that window. */ 109 extern INFO_WINDOW **info_windows; 110 111 /* For handling errors. If you initialize the window system, you should 112 also set info_windows_initialized_p to non-zero. It is used by the 113 info_error () function to determine how to format and output errors. */ 114 extern int info_windows_initialized_p; 115 116 /* Non-zero if an error message has been printed. */ 117 extern int info_error_was_printed; 118 119 /* Non-zero means ring terminal bell on errors. */ 120 extern int info_error_rings_bell_p; 121 122 /* Print FORMAT with ARG1 and ARG2. If the window system was initialized, 123 then the message is printed in the echo area. Otherwise, a message is 124 output to stderr. */ 125 extern void info_error (); 126 127 /* The version numbers of Info. */ 128 extern int info_major_version, info_minor_version, info_patch_level; 129 130 /* How to get the version string for this version of Info. Returns 131 something similar to "2.11". */ 132 extern char *version_string (); 133 134 /* Error message defines. */ 135 #define CANT_FIND_NODE _("Cannot find the node \"%s\".") 136 #define CANT_FILE_NODE _("Cannot find the node \"(%s)%s\".") 137 #define CANT_FIND_WIND _("Cannot find a window!") 138 #define CANT_FIND_POINT _("Point doesn't appear within this window's node!") 139 #define CANT_KILL_LAST _("Cannot delete the last window.") 140 #define NO_MENU_NODE _("No menu in this node.") 141 #define NO_FOOT_NODE _("No footnotes in this node.") 142 #define NO_XREF_NODE _("No cross references in this node.") 143 #define NO_POINTER _("No \"%s\" pointer for this node.") 144 #define UNKNOWN_COMMAND _("Unknown Info command `%c'. `?' for help.") 145 #define TERM_TOO_DUMB _("Terminal type \"%s\" is not smart enough to run Info.") 146 #define AT_NODE_BOTTOM _("You are already at the last page of this node.") 147 #define AT_NODE_TOP _("You are already at the first page of this node.") 148 #define ONE_WINDOW _("Only one window.") 149 #define WIN_TOO_SMALL _("Resulting window would be too small.") 150 #define CANT_MAKE_HELP \ 151 _("There isn't enough room to make a help window. Please delete a window.") 152 153 154 /* Found in info-utils.c. */ 155 extern char *filename_non_directory (); 156 157 #if !defined (BUILDING_LIBRARY) 158 /* Found in session.c */ 159 extern int info_windows_initialized_p; 160 161 /* Found in window.c. */ 162 extern void message_in_echo_area (), unmessage_in_echo_area (); 163 #endif /* !BUILDING_LIBRARY */ 164 165 #endif /* !INFO_H */ 166