xref: /netbsd/external/gpl2/texinfo/dist/info/info.h (revision dc174305)
1 /*	$NetBSD: info.h,v 1.1.1.1 2016/01/14 00:11:29 christos Exp $	*/
2 
3 /* info.h -- Header file which includes all of the other headers.
4    Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp
5 
6    Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software
7    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 #ifndef 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 #define INFOKEY
32 
33 /* System dependencies.  */
34 #include "system.h"
35 
36 /* Some of our other include files use these.  */
37 typedef int Function ();
38 typedef void VFunction ();
39 typedef char *CFunction ();
40 
41 #include "filesys.h"
42 #include "doc.h"
43 #include "display.h"
44 #include "session.h"
45 #include "echo-area.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 /* Non-zero means default keybindings are loosely modeled on vi(1).  */
123 extern int vi_keys_p;
124 
125 /* Non-zero means don't remove ANSI escape sequences from man pages.  */
126 extern int raw_escapes_p;
127 
128 /* Print FORMAT with ARG1 and ARG2.  If the window system was initialized,
129    then the message is printed in the echo area.  Otherwise, a message is
130    output to stderr. */
131 extern void info_error (char *format, void *arg1, void *arg2);
132 
133 extern void add_file_directory_to_path (char *filename);
134 
135 /* Error message defines. */
136 extern const char *msg_cant_find_node;
137 extern const char *msg_cant_file_node;
138 extern const char *msg_cant_find_window;
139 extern const char *msg_cant_find_point;
140 extern const char *msg_cant_kill_last;
141 extern const char *msg_no_menu_node;
142 extern const char *msg_no_foot_node;
143 extern const char *msg_no_xref_node;
144 extern const char *msg_no_pointer;
145 extern const char *msg_unknown_command;
146 extern const char *msg_term_too_dumb;
147 extern const char *msg_at_node_bottom;
148 extern const char *msg_at_node_top;
149 extern const char *msg_one_window;
150 extern const char *msg_win_too_small;
151 extern const char *msg_cant_make_help;
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 */
163