1114402Sru/*	$NetBSD: info.h,v 1.1.1.1 2016/01/14 00:11:29 christos Exp $	*/
2114402Sru
3114402Sru/* info.h -- Header file which includes all of the other headers.
4114402Sru   Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp
5114402Sru
6114402Sru   Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software
7114402Sru   Foundation, Inc.
8114402Sru
9114402Sru   This program is free software; you can redistribute it and/or modify
10114402Sru   it under the terms of the GNU General Public License as published by
11114402Sru   the Free Software Foundation; either version 2, or (at your option)
12114402Sru   any later version.
13114402Sru
14114402Sru   This program is distributed in the hope that it will be useful,
15114402Sru   but WITHOUT ANY WARRANTY; without even the implied warranty of
16114402Sru   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17114402Sru   GNU General Public License for more details.
18114402Sru
19114402Sru   You should have received a copy of the GNU General Public License
20114402Sru   along with this program; if not, write to the Free Software
21114402Sru   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22114402Sru
23114402Sru   Written by Brian Fox (bfox@ai.mit.edu). */
24114402Sru
25114402Sru#ifndef INFO_H
26114402Sru#define INFO_H
27114402Sru
28114402Sru/* We always want these, so why clutter up the compile command?  */
29114402Sru#define HANDLE_MAN_PAGES
30114402Sru#define NAMED_FUNCTIONS
31114402Sru#define INFOKEY
32114402Sru
33114402Sru/* System dependencies.  */
34114402Sru#include "system.h"
35114402Sru
36114402Sru/* Some of our other include files use these.  */
37114402Srutypedef int Function ();
38114402Srutypedef void VFunction ();
39114402Srutypedef char *CFunction ();
40114402Sru
41114402Sru#include "filesys.h"
42114402Sru#include "doc.h"
43114402Sru#include "display.h"
44114402Sru#include "session.h"
45114402Sru#include "echo-area.h"
46114402Sru#include "footnotes.h"
47114402Sru#include "gc.h"
48114402Sru
49114402Sru#define info_toupper(x) (islower (x) ? toupper (x) : x)
50114402Sru#define info_tolower(x) (isupper (x) ? tolower (x) : x)
51114402Sru
52114402Sru#if !defined (whitespace)
53114402Sru#  define whitespace(c) ((c == ' ') || (c == '\t'))
54114402Sru#endif /* !whitespace */
55114402Sru
56114402Sru#if !defined (whitespace_or_newline)
57114402Sru#  define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
58114402Sru#endif /* !whitespace_or_newline */
59114402Sru
60114402Sru/* Add POINTER to the list of pointers found in ARRAY.  SLOTS is the number
61114402Sru   of slots that have already been allocated.  INDEX is the index into the
62114402Sru   array where POINTER should be added.  GROW is the number of slots to grow
63114402Sru   ARRAY by, in the case that it needs growing.  TYPE is a cast of the type
64114402Sru   of object stored in ARRAY (e.g., NODE_ENTRY *. */
65114402Sru#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
66114402Sru  do { \
67114402Sru    if (idx + 2 >= slots) \
68114402Sru      array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
69114402Sru    array[idx++] = (type)pointer; \
70114402Sru    array[idx] = (type)NULL; \
71114402Sru  } while (0)
72114402Sru
73114402Sru#define maybe_free(x) do { if (x) free (x); } while (0)
74114402Sru
75114402Sru#if !defined (zero_mem) && defined (HAVE_MEMSET)
76114402Sru#  define zero_mem(mem, length) memset (mem, 0, length)
77114402Sru#endif /* !zero_mem && HAVE_MEMSET */
78114402Sru
79114402Sru#if !defined (zero_mem) && defined (HAVE_BZERO)
80114402Sru#  define zero_mem(mem, length) bzero (mem, length)
81114402Sru#endif /* !zero_mem && HAVE_BZERO */
82114402Sru
83114402Sru#if !defined (zero_mem)
84114402Sru#  define zero_mem(mem, length) \
85114402Sru  do {                                  \
86114402Sru        register int zi;                \
87114402Sru        register unsigned char *place;  \
88114402Sru                                        \
89114402Sru        place = (unsigned char *)mem;   \
90114402Sru        for (zi = 0; zi < length; zi++) \
91114402Sru          place[zi] = 0;                \
92114402Sru      } while (0)
93114402Sru#endif /* !zero_mem */
94114402Sru
95114402Sru
96114402Sru/* A structure associating the nodes visited in a particular window. */
97114402Srutypedef struct {
98114402Sru  WINDOW *window;               /* The window that this list is attached to. */
99114402Sru  NODE **nodes;                 /* Array of nodes visited in this window. */
100114402Sru  int *pagetops;                /* For each node in NODES, the pagetop. */
101114402Sru  long *points;                 /* For each node in NODES, the point. */
102114402Sru  int current;                  /* Index in NODES of the current node. */
103114402Sru  int nodes_index;              /* Index where to add the next node. */
104114402Sru  int nodes_slots;              /* Number of slots allocated to NODES. */
105114402Sru} INFO_WINDOW;
106114402Sru
107114402Sru/* Array of structures describing for each window which nodes have been
108114402Sru   visited in that window. */
109114402Sruextern INFO_WINDOW **info_windows;
110114402Sru
111114402Sru/* For handling errors.  If you initialize the window system, you should
112114402Sru   also set info_windows_initialized_p to non-zero.  It is used by the
113114402Sru   info_error () function to determine how to format and output errors. */
114114402Sruextern int info_windows_initialized_p;
115114402Sru
116114402Sru/* Non-zero if an error message has been printed. */
117114402Sruextern int info_error_was_printed;
118114402Sru
119114402Sru/* Non-zero means ring terminal bell on errors. */
120114402Sruextern int info_error_rings_bell_p;
121114402Sru
122114402Sru/* Non-zero means default keybindings are loosely modeled on vi(1).  */
123114402Sruextern int vi_keys_p;
124114402Sru
125114402Sru/* Non-zero means don't remove ANSI escape sequences from man pages.  */
126114402Sruextern int raw_escapes_p;
127114402Sru
128114402Sru/* Print FORMAT with ARG1 and ARG2.  If the window system was initialized,
129114402Sru   then the message is printed in the echo area.  Otherwise, a message is
130114402Sru   output to stderr. */
131114402Sruextern void info_error (char *format, void *arg1, void *arg2);
132114402Sru
133114402Sruextern void add_file_directory_to_path (char *filename);
134114402Sru
135114402Sru/* Error message defines. */
136114402Sruextern const char *msg_cant_find_node;
137114402Sruextern const char *msg_cant_file_node;
138extern const char *msg_cant_find_window;
139extern const char *msg_cant_find_point;
140extern const char *msg_cant_kill_last;
141extern const char *msg_no_menu_node;
142extern const char *msg_no_foot_node;
143extern const char *msg_no_xref_node;
144extern const char *msg_no_pointer;
145extern const char *msg_unknown_command;
146extern const char *msg_term_too_dumb;
147extern const char *msg_at_node_bottom;
148extern const char *msg_at_node_top;
149extern const char *msg_one_window;
150extern const char *msg_win_too_small;
151extern const char *msg_cant_make_help;
152
153
154#if defined(INFOKEY)
155/* Found in variables.c. */
156extern void set_variable_to_value (char *name, char *value);
157#endif /* INFOKEY */
158
159/* Found in m-x.c.  */
160extern char *read_function_name (char *prompt, WINDOW *window);
161
162#endif /* !INFO_H */
163