1 /* info.h -- Header file which includes all of the other headers.
2 $Id: info.h,v 1.9 2008/05/10 14:39:05 gray Exp $
4 Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007
5 Free Software Foundation, Inc.
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 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Written by Brian Fox (bfox@ai.mit.edu). */
25 /* We always want these, so why clutter up the compile command? */
26 #define HANDLE_MAN_PAGES
27 #define NAMED_FUNCTIONS
30 /* System dependencies. */
33 /* Some of our other include files use these. */
34 typedef int Function ();
35 typedef void VFunction ();
36 typedef char *CFunction ();
42 #include "echo-area.h"
43 #include "footnotes.h"
50 #define info_toupper(x) (islower (x) ? toupper (x) : x)
51 #define info_tolower(x) (isupper (x) ? tolower (x) : x)
53 #if !defined (whitespace)
54 # define whitespace(c) ((c == ' ') || (c == '\t'))
55 #endif /* !whitespace */
57 #if !defined (whitespace_or_newline)
58 # define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
59 #endif /* !whitespace_or_newline */
61 /* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number
62 of slots that have already been allocated. INDEX is the index into the
63 array where POINTER should be added. GROW is the number of slots to grow
64 ARRAY by, in the case that it needs growing. TYPE is a cast of the type
65 of object stored in ARRAY (e.g., NODE_ENTRY *. */
66 #define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
68 if (idx + 2 >= slots) \
69 array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
70 array[idx++] = (type)pointer; \
71 array[idx] = (type)NULL; \
74 #define maybe_free(x) do { if (x) free (x); } while (0)
76 #if !defined (zero_mem) && defined (HAVE_MEMSET)
77 # define zero_mem(mem, length) memset (mem, 0, length)
78 #endif /* !zero_mem && HAVE_MEMSET */
80 #if !defined (zero_mem) && defined (HAVE_BZERO)
81 # define zero_mem(mem, length) bzero (mem, length)
82 #endif /* !zero_mem && HAVE_BZERO */
84 #if !defined (zero_mem)
85 # define zero_mem(mem, length) \
88 register unsigned char *place; \
90 place = (unsigned char *)mem; \
91 for (zi = 0; zi < length; zi++) \
94 #endif /* !zero_mem */
97 /* A structure associating the nodes visited in a particular window. */
99 WINDOW *window; /* The window that this list is attached to. */
100 NODE **nodes; /* Array of nodes visited in this window. */
101 int *pagetops; /* For each node in NODES, the pagetop. */
102 long *points; /* For each node in NODES, the point. */
103 int current; /* Index in NODES of the current node. */
104 int nodes_index; /* Index where to add the next node. */
105 int nodes_slots; /* Number of slots allocated to NODES. */
108 /* Array of structures describing for each window which nodes have been
109 visited in that window. */
110 extern INFO_WINDOW **info_windows;
112 /* For handling errors. If you initialize the window system, you should
113 also set info_windows_initialized_p to non-zero. It is used by the
114 info_error () function to determine how to format and output errors. */
115 extern int info_windows_initialized_p;
117 /* Non-zero if an error message has been printed. */
118 extern int info_error_was_printed;
120 /* Non-zero means ring terminal bell on errors. */
121 extern int info_error_rings_bell_p;
123 /* Non-zero means default keybindings are loosely modeled on vi(1). */
124 extern int vi_keys_p;
126 /* Non-zero means don't remove ANSI escape sequences from man pages. */
127 extern int raw_escapes_p;
129 /* Print FORMAT with ARG1 and ARG2. If the window system was initialized,
130 then the message is printed in the echo area. Otherwise, a message is
132 extern void info_error (const char *format, void *arg1, void *arg2);
134 extern void add_file_directory_to_path (char *filename);
136 /* Error message defines. */
137 extern const char *msg_cant_find_node;
138 extern const char *msg_cant_file_node;
139 extern const char *msg_cant_find_window;
140 extern const char *msg_cant_find_point;
141 extern const char *msg_cant_kill_last;
142 extern const char *msg_no_menu_node;
143 extern const char *msg_no_foot_node;
144 extern const char *msg_no_xref_node;
145 extern const char *msg_no_pointer;
146 extern const char *msg_unknown_command;
147 extern const char *msg_term_too_dumb;
148 extern const char *msg_at_node_bottom;
149 extern const char *msg_at_node_top;
150 extern const char *msg_one_window;
151 extern const char *msg_win_too_small;
152 extern const char *msg_cant_make_help;
156 /* Found in variables.c. */
157 extern void set_variable_to_value (char *name, char *value);
160 /* Found in m-x.c. */
161 extern char *read_function_name (const char *prompt, WINDOW *window);