| 1 | /* info.h -- Header file which includes all of the other headers. | 
|---|
| 2 | $Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp $ | 
|---|
| 3 |  | 
|---|
| 4 | Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software | 
|---|
| 5 | Foundation, Inc. | 
|---|
| 6 |  | 
|---|
| 7 | This program is free software; you can redistribute it and/or modify | 
|---|
| 8 | it under the terms of the GNU General Public License as published by | 
|---|
| 9 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 10 | any later version. | 
|---|
| 11 |  | 
|---|
| 12 | This program is distributed in the hope that it will be useful, | 
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 15 | GNU General Public License for more details. | 
|---|
| 16 |  | 
|---|
| 17 | You should have received a copy of the GNU General Public License | 
|---|
| 18 | along with this program; if not, write to the Free Software | 
|---|
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 
|---|
| 20 |  | 
|---|
| 21 | Written by Brian Fox (bfox@ai.mit.edu). */ | 
|---|
| 22 |  | 
|---|
| 23 | #ifndef INFO_H | 
|---|
| 24 | #define INFO_H | 
|---|
| 25 |  | 
|---|
| 26 | /* We always want these, so why clutter up the compile command?  */ | 
|---|
| 27 | #define HANDLE_MAN_PAGES | 
|---|
| 28 | #define NAMED_FUNCTIONS | 
|---|
| 29 | #define INFOKEY | 
|---|
| 30 |  | 
|---|
| 31 | /* System dependencies.  */ | 
|---|
| 32 | #include "system.h" | 
|---|
| 33 |  | 
|---|
| 34 | /* Some of our other include files use these.  */ | 
|---|
| 35 | typedef int Function (); | 
|---|
| 36 | typedef void VFunction (); | 
|---|
| 37 | typedef char *CFunction (); | 
|---|
| 38 |  | 
|---|
| 39 | #include "filesys.h" | 
|---|
| 40 | #include "doc.h" | 
|---|
| 41 | #include "display.h" | 
|---|
| 42 | #include "session.h" | 
|---|
| 43 | #include "echo-area.h" | 
|---|
| 44 | #include "footnotes.h" | 
|---|
| 45 | #include "gc.h" | 
|---|
| 46 |  | 
|---|
| 47 | #define info_toupper(x) (islower (x) ? toupper (x) : x) | 
|---|
| 48 | #define info_tolower(x) (isupper (x) ? tolower (x) : x) | 
|---|
| 49 |  | 
|---|
| 50 | #if !defined (whitespace) | 
|---|
| 51 | #  define whitespace(c) ((c == ' ') || (c == '\t')) | 
|---|
| 52 | #endif /* !whitespace */ | 
|---|
| 53 |  | 
|---|
| 54 | #if !defined (whitespace_or_newline) | 
|---|
| 55 | #  define whitespace_or_newline(c) (whitespace (c) || (c == '\n')) | 
|---|
| 56 | #endif /* !whitespace_or_newline */ | 
|---|
| 57 |  | 
|---|
| 58 | /* Add POINTER to the list of pointers found in ARRAY.  SLOTS is the number | 
|---|
| 59 | of slots that have already been allocated.  INDEX is the index into the | 
|---|
| 60 | array where POINTER should be added.  GROW is the number of slots to grow | 
|---|
| 61 | ARRAY by, in the case that it needs growing.  TYPE is a cast of the type | 
|---|
| 62 | of object stored in ARRAY (e.g., NODE_ENTRY *. */ | 
|---|
| 63 | #define add_pointer_to_array(pointer, idx, array, slots, grow, type) \ | 
|---|
| 64 | do { \ | 
|---|
| 65 | if (idx + 2 >= slots) \ | 
|---|
| 66 | array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \ | 
|---|
| 67 | array[idx++] = (type)pointer; \ | 
|---|
| 68 | array[idx] = (type)NULL; \ | 
|---|
| 69 | } while (0) | 
|---|
| 70 |  | 
|---|
| 71 | #define maybe_free(x) do { if (x) free (x); } while (0) | 
|---|
| 72 |  | 
|---|
| 73 | #if !defined (zero_mem) && defined (HAVE_MEMSET) | 
|---|
| 74 | #  define zero_mem(mem, length) memset (mem, 0, length) | 
|---|
| 75 | #endif /* !zero_mem && HAVE_MEMSET */ | 
|---|
| 76 |  | 
|---|
| 77 | #if !defined (zero_mem) && defined (HAVE_BZERO) | 
|---|
| 78 | #  define zero_mem(mem, length) bzero (mem, length) | 
|---|
| 79 | #endif /* !zero_mem && HAVE_BZERO */ | 
|---|
| 80 |  | 
|---|
| 81 | #if !defined (zero_mem) | 
|---|
| 82 | #  define zero_mem(mem, length) \ | 
|---|
| 83 | do {                                  \ | 
|---|
| 84 | register int zi;                \ | 
|---|
| 85 | register unsigned char *place;  \ | 
|---|
| 86 | \ | 
|---|
| 87 | place = (unsigned char *)mem;   \ | 
|---|
| 88 | for (zi = 0; zi < length; zi++) \ | 
|---|
| 89 | place[zi] = 0;                \ | 
|---|
| 90 | } while (0) | 
|---|
| 91 | #endif /* !zero_mem */ | 
|---|
| 92 |  | 
|---|
| 93 |  | 
|---|
| 94 |  | 
|---|
| 95 | /* A structure associating the nodes visited in a particular window. */ | 
|---|
| 96 | typedef struct { | 
|---|
| 97 | WINDOW *window;               /* The window that this list is attached to. */ | 
|---|
| 98 | NODE **nodes;                 /* Array of nodes visited in this window. */ | 
|---|
| 99 | int *pagetops;                /* For each node in NODES, the pagetop. */ | 
|---|
| 100 | long *points;                 /* For each node in NODES, the point. */ | 
|---|
| 101 | int current;                  /* Index in NODES of the current node. */ | 
|---|
| 102 | int nodes_index;              /* Index where to add the next node. */ | 
|---|
| 103 | int nodes_slots;              /* Number of slots allocated to NODES. */ | 
|---|
| 104 | } INFO_WINDOW; | 
|---|
| 105 |  | 
|---|
| 106 | /* Array of structures describing for each window which nodes have been | 
|---|
| 107 | visited in that window. */ | 
|---|
| 108 | extern INFO_WINDOW **info_windows; | 
|---|
| 109 |  | 
|---|
| 110 | /* For handling errors.  If you initialize the window system, you should | 
|---|
| 111 | also set info_windows_initialized_p to non-zero.  It is used by the | 
|---|
| 112 | info_error () function to determine how to format and output errors. */ | 
|---|
| 113 | extern int info_windows_initialized_p; | 
|---|
| 114 |  | 
|---|
| 115 | /* Non-zero if an error message has been printed. */ | 
|---|
| 116 | extern int info_error_was_printed; | 
|---|
| 117 |  | 
|---|
| 118 | /* Non-zero means ring terminal bell on errors. */ | 
|---|
| 119 | extern int info_error_rings_bell_p; | 
|---|
| 120 |  | 
|---|
| 121 | /* Non-zero means default keybindings are loosely modeled on vi(1).  */ | 
|---|
| 122 | extern int vi_keys_p; | 
|---|
| 123 |  | 
|---|
| 124 | /* Non-zero means don't remove ANSI escape sequences from man pages.  */ | 
|---|
| 125 | extern int raw_escapes_p; | 
|---|
| 126 |  | 
|---|
| 127 | /* Print FORMAT with ARG1 and ARG2.  If the window system was initialized, | 
|---|
| 128 | then the message is printed in the echo area.  Otherwise, a message is | 
|---|
| 129 | output to stderr. */ | 
|---|
| 130 | extern void info_error (char *format, void *arg1, void *arg2); | 
|---|
| 131 |  | 
|---|
| 132 | extern void add_file_directory_to_path (char *filename); | 
|---|
| 133 |  | 
|---|
| 134 | /* Error message defines. */ | 
|---|
| 135 | extern const char *msg_cant_find_node; | 
|---|
| 136 | extern const char *msg_cant_file_node; | 
|---|
| 137 | extern const char *msg_cant_find_window; | 
|---|
| 138 | extern const char *msg_cant_find_point; | 
|---|
| 139 | extern const char *msg_cant_kill_last; | 
|---|
| 140 | extern const char *msg_no_menu_node; | 
|---|
| 141 | extern const char *msg_no_foot_node; | 
|---|
| 142 | extern const char *msg_no_xref_node; | 
|---|
| 143 | extern const char *msg_no_pointer; | 
|---|
| 144 | extern const char *msg_unknown_command; | 
|---|
| 145 | extern const char *msg_term_too_dumb; | 
|---|
| 146 | extern const char *msg_at_node_bottom; | 
|---|
| 147 | extern const char *msg_at_node_top; | 
|---|
| 148 | extern const char *msg_one_window; | 
|---|
| 149 | extern const char *msg_win_too_small; | 
|---|
| 150 | extern const char *msg_cant_make_help; | 
|---|
| 151 |  | 
|---|
| 152 |  | 
|---|
| 153 |  | 
|---|
| 154 | #if defined(INFOKEY) | 
|---|
| 155 | /* Found in variables.c. */ | 
|---|
| 156 | extern void set_variable_to_value (char *name, char *value); | 
|---|
| 157 | #endif /* INFOKEY */ | 
|---|
| 158 |  | 
|---|
| 159 | /* Found in m-x.c.  */ | 
|---|
| 160 | extern char *read_function_name (char *prompt, WINDOW *window); | 
|---|
| 161 |  | 
|---|
| 162 | #endif /* !INFO_H */ | 
|---|