Merge from vendor branch GCC:
[dragonfly.git] / contrib / texinfo / info / info.h
1 /* info.h -- Header file which includes all of the other headers.
2    $Id: info.h,v 1.16 2002/02/23 19:12:02 karl Exp $
3
4    Copyright (C) 1993, 97, 98, 99, 2001 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 #ifndef INFO_H
23 #define INFO_H
24
25 /* We always want these, so why clutter up the compile command?  */
26 #define HANDLE_MAN_PAGES
27 #define NAMED_FUNCTIONS
28 #define INFOKEY
29
30 /* System dependencies.  */
31 #include "system.h"
32
33 /* Some of our other include files use these.  */
34 typedef int Function ();
35 typedef void VFunction ();
36 typedef char *CFunction ();
37
38 #include "filesys.h"
39 #include "doc.h"
40 #include "display.h"
41 #include "session.h"
42 #include "echo-area.h"
43 #include "footnotes.h"
44 #include "gc.h"
45
46 #define info_toupper(x) (islower (x) ? toupper (x) : x)
47 #define info_tolower(x) (isupper (x) ? tolower (x) : x)
48
49 #if !defined (whitespace)
50 #  define whitespace(c) ((c == ' ') || (c == '\t'))
51 #endif /* !whitespace */
52
53 #if !defined (whitespace_or_newline)
54 #  define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
55 #endif /* !whitespace_or_newline */
56
57 /* Add POINTER to the list of pointers found in ARRAY.  SLOTS is the number
58    of slots that have already been allocated.  INDEX is the index into the
59    array where POINTER should be added.  GROW is the number of slots to grow
60    ARRAY by, in the case that it needs growing.  TYPE is a cast of the type
61    of object stored in ARRAY (e.g., NODE_ENTRY *. */
62 #define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
63   do { \
64     if (idx + 2 >= slots) \
65       array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
66     array[idx++] = (type)pointer; \
67     array[idx] = (type)NULL; \
68   } while (0)
69
70 #define maybe_free(x) do { if (x) free (x); } while (0)
71
72 #if !defined (zero_mem) && defined (HAVE_MEMSET)
73 #  define zero_mem(mem, length) memset (mem, 0, length)
74 #endif /* !zero_mem && HAVE_MEMSET */
75
76 #if !defined (zero_mem) && defined (HAVE_BZERO)
77 #  define zero_mem(mem, length) bzero (mem, length)
78 #endif /* !zero_mem && HAVE_BZERO */
79
80 #if !defined (zero_mem)
81 #  define zero_mem(mem, length) \
82   do {                                  \
83         register int zi;                \
84         register unsigned char *place;  \
85                                         \
86         place = (unsigned char *)mem;   \
87         for (zi = 0; zi < length; zi++) \
88           place[zi] = 0;                \
89       } while (0)
90 #endif /* !zero_mem */
91
92 \f
93 /* A structure associating the nodes visited in a particular window. */
94 typedef struct {
95   WINDOW *window;               /* The window that this list is attached to. */
96   NODE **nodes;                 /* Array of nodes visited in this window. */
97   int *pagetops;                /* For each node in NODES, the pagetop. */
98   long *points;                 /* For each node in NODES, the point. */
99   int current;                  /* Index in NODES of the current node. */
100   int nodes_index;              /* Index where to add the next node. */
101   int nodes_slots;              /* Number of slots allocated to NODES. */
102 } INFO_WINDOW;
103
104 /* Array of structures describing for each window which nodes have been
105    visited in that window. */
106 extern INFO_WINDOW **info_windows;
107
108 /* For handling errors.  If you initialize the window system, you should
109    also set info_windows_initialized_p to non-zero.  It is used by the
110    info_error () function to determine how to format and output errors. */
111 extern int info_windows_initialized_p;
112
113 /* Non-zero if an error message has been printed. */
114 extern int info_error_was_printed;
115
116 /* Non-zero means ring terminal bell on errors. */
117 extern int info_error_rings_bell_p;
118
119 /* Non-zero means default keybindings are loosely modeled on vi(1).  */
120 extern int vi_keys_p;
121
122 /* Non-zero means don't remove ANSI escape sequences from man pages.  */
123 extern int raw_escapes_p;
124
125 /* Print FORMAT with ARG1 and ARG2.  If the window system was initialized,
126    then the message is printed in the echo area.  Otherwise, a message is
127    output to stderr. */
128 extern void info_error ();
129
130 /* Error message defines. */
131 extern char *msg_cant_find_node;
132 extern char *msg_cant_file_node;
133 extern char *msg_cant_find_window;
134 extern char *msg_cant_find_point;
135 extern char *msg_cant_kill_last;
136 extern char *msg_no_menu_node;
137 extern char *msg_no_foot_node;
138 extern char *msg_no_xref_node;
139 extern char *msg_no_pointer;
140 extern char *msg_unknown_command;
141 extern char *msg_term_too_dumb;
142 extern char *msg_at_node_bottom;
143 extern char *msg_at_node_top;
144 extern char *msg_one_window;
145 extern char *msg_win_too_small;
146 extern char *msg_cant_make_help;
147
148 \f
149 extern char *filename_non_directory (); /* Found in info-utils.c. */
150
151 #if defined(INFOKEY)
152 extern void set_variable_to_value ();   /* Found in variables.c. */
153 #endif /* INFOKEY */
154
155 #if !defined (BUILDING_LIBRARY)
156 extern int info_windows_initialized_p;  /* Found in session.c */
157 /* Found in window.c. */
158 extern void message_in_echo_area (), unmessage_in_echo_area ();
159 #endif /* !BUILDING_LIBRARY */
160
161 #endif /* !INFO_H */