Add texinfo 4.8, appropriately stripped down.
[dragonfly.git] / contrib / texinfo-4 / info / info.h
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 \f
94 /* A structure associating the nodes visited in a particular window. */
95 typedef struct {
96   WINDOW *window;               /* The window that this list is attached to. */
97   NODE **nodes;                 /* Array of nodes visited in this window. */
98   int *pagetops;                /* For each node in NODES, the pagetop. */
99   long *points;                 /* For each node in NODES, the point. */
100   int current;                  /* Index in NODES of the current node. */
101   int nodes_index;              /* Index where to add the next node. */
102   int nodes_slots;              /* Number of slots allocated to NODES. */
103 } INFO_WINDOW;
104
105 /* Array of structures describing for each window which nodes have been
106    visited in that window. */
107 extern INFO_WINDOW **info_windows;
108
109 /* For handling errors.  If you initialize the window system, you should
110    also set info_windows_initialized_p to non-zero.  It is used by the
111    info_error () function to determine how to format and output errors. */
112 extern int info_windows_initialized_p;
113
114 /* Non-zero if an error message has been printed. */
115 extern int info_error_was_printed;
116
117 /* Non-zero means ring terminal bell on errors. */
118 extern int info_error_rings_bell_p;
119
120 /* Non-zero means default keybindings are loosely modeled on vi(1).  */
121 extern int vi_keys_p;
122
123 /* Non-zero means don't remove ANSI escape sequences from man pages.  */
124 extern int raw_escapes_p;
125
126 /* Print FORMAT with ARG1 and ARG2.  If the window system was initialized,
127    then the message is printed in the echo area.  Otherwise, a message is
128    output to stderr. */
129 extern void info_error (char *format, void *arg1, void *arg2);
130
131 extern void add_file_directory_to_path (char *filename);
132
133 /* Error message defines. */
134 extern const char *msg_cant_find_node;
135 extern const char *msg_cant_file_node;
136 extern const char *msg_cant_find_window;
137 extern const char *msg_cant_find_point;
138 extern const char *msg_cant_kill_last;
139 extern const char *msg_no_menu_node;
140 extern const char *msg_no_foot_node;
141 extern const char *msg_no_xref_node;
142 extern const char *msg_no_pointer;
143 extern const char *msg_unknown_command;
144 extern const char *msg_term_too_dumb;
145 extern const char *msg_at_node_bottom;
146 extern const char *msg_at_node_top;
147 extern const char *msg_one_window;
148 extern const char *msg_win_too_small;
149 extern const char *msg_cant_make_help;
150
151 \f
152 #if defined(INFOKEY)
153 /* Found in variables.c. */
154 extern void set_variable_to_value (char *name, char *value);
155 #endif /* INFOKEY */
156
157 /* Found in m-x.c.  */
158 extern char *read_function_name (char *prompt, WINDOW *window);
159
160 #endif /* !INFO_H */