142660Smarkm/* info.h -- Header file which includes all of the other headers. 2146515Sru $Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp $ 321495Sjmacd 4146515Sru Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software 5116525Sru Foundation, Inc. 621495Sjmacd 721495Sjmacd This program is free software; you can redistribute it and/or modify 821495Sjmacd it under the terms of the GNU General Public License as published by 921495Sjmacd the Free Software Foundation; either version 2, or (at your option) 1021495Sjmacd any later version. 1121495Sjmacd 1221495Sjmacd This program is distributed in the hope that it will be useful, 1321495Sjmacd but WITHOUT ANY WARRANTY; without even the implied warranty of 1421495Sjmacd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1521495Sjmacd GNU General Public License for more details. 1621495Sjmacd 1721495Sjmacd You should have received a copy of the GNU General Public License 1821495Sjmacd along with this program; if not, write to the Free Software 1921495Sjmacd Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 2021495Sjmacd 2121495Sjmacd Written by Brian Fox (bfox@ai.mit.edu). */ 2221495Sjmacd 2356160Sru#ifndef INFO_H 2442660Smarkm#define INFO_H 2521495Sjmacd 2642660Smarkm/* We always want these, so why clutter up the compile command? */ 2742660Smarkm#define HANDLE_MAN_PAGES 2842660Smarkm#define NAMED_FUNCTIONS 2993139Sru#define INFOKEY 3042660Smarkm 3142660Smarkm/* System dependencies. */ 3242660Smarkm#include "system.h" 3342660Smarkm 3442660Smarkm/* Some of our other include files use these. */ 3542660Smarkmtypedef int Function (); 3642660Smarkmtypedef void VFunction (); 3742660Smarkmtypedef char *CFunction (); 3842660Smarkm 3921495Sjmacd#include "filesys.h" 4093139Sru#include "doc.h" 4121495Sjmacd#include "display.h" 4221495Sjmacd#include "session.h" 4342660Smarkm#include "echo-area.h" 4421495Sjmacd#include "footnotes.h" 4521495Sjmacd#include "gc.h" 4621495Sjmacd 4742660Smarkm#define info_toupper(x) (islower (x) ? toupper (x) : x) 4842660Smarkm#define info_tolower(x) (isupper (x) ? tolower (x) : x) 4942660Smarkm 5042660Smarkm#if !defined (whitespace) 5142660Smarkm# define whitespace(c) ((c == ' ') || (c == '\t')) 5242660Smarkm#endif /* !whitespace */ 5342660Smarkm 5442660Smarkm#if !defined (whitespace_or_newline) 5542660Smarkm# define whitespace_or_newline(c) (whitespace (c) || (c == '\n')) 5642660Smarkm#endif /* !whitespace_or_newline */ 5742660Smarkm 5842660Smarkm/* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number 5942660Smarkm of slots that have already been allocated. INDEX is the index into the 6042660Smarkm array where POINTER should be added. GROW is the number of slots to grow 6142660Smarkm ARRAY by, in the case that it needs growing. TYPE is a cast of the type 6242660Smarkm of object stored in ARRAY (e.g., NODE_ENTRY *. */ 6342660Smarkm#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \ 6442660Smarkm do { \ 6542660Smarkm if (idx + 2 >= slots) \ 6642660Smarkm array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \ 6742660Smarkm array[idx++] = (type)pointer; \ 6842660Smarkm array[idx] = (type)NULL; \ 6942660Smarkm } while (0) 7042660Smarkm 7142660Smarkm#define maybe_free(x) do { if (x) free (x); } while (0) 7242660Smarkm 7342660Smarkm#if !defined (zero_mem) && defined (HAVE_MEMSET) 7442660Smarkm# define zero_mem(mem, length) memset (mem, 0, length) 7542660Smarkm#endif /* !zero_mem && HAVE_MEMSET */ 7642660Smarkm 7742660Smarkm#if !defined (zero_mem) && defined (HAVE_BZERO) 7842660Smarkm# define zero_mem(mem, length) bzero (mem, length) 7942660Smarkm#endif /* !zero_mem && HAVE_BZERO */ 8042660Smarkm 8142660Smarkm#if !defined (zero_mem) 8242660Smarkm# define zero_mem(mem, length) \ 8342660Smarkm do { \ 8442660Smarkm register int zi; \ 8542660Smarkm register unsigned char *place; \ 8642660Smarkm \ 8742660Smarkm place = (unsigned char *)mem; \ 8842660Smarkm for (zi = 0; zi < length; zi++) \ 8942660Smarkm place[zi] = 0; \ 9042660Smarkm } while (0) 9142660Smarkm#endif /* !zero_mem */ 9242660Smarkm 9342660Smarkm 9421495Sjmacd/* A structure associating the nodes visited in a particular window. */ 9521495Sjmacdtypedef struct { 9642660Smarkm WINDOW *window; /* The window that this list is attached to. */ 9742660Smarkm NODE **nodes; /* Array of nodes visited in this window. */ 9842660Smarkm int *pagetops; /* For each node in NODES, the pagetop. */ 9942660Smarkm long *points; /* For each node in NODES, the point. */ 10042660Smarkm int current; /* Index in NODES of the current node. */ 10142660Smarkm int nodes_index; /* Index where to add the next node. */ 10242660Smarkm int nodes_slots; /* Number of slots allocated to NODES. */ 10321495Sjmacd} INFO_WINDOW; 10421495Sjmacd 10521495Sjmacd/* Array of structures describing for each window which nodes have been 10621495Sjmacd visited in that window. */ 10721495Sjmacdextern INFO_WINDOW **info_windows; 10821495Sjmacd 10921495Sjmacd/* For handling errors. If you initialize the window system, you should 11021495Sjmacd also set info_windows_initialized_p to non-zero. It is used by the 11121495Sjmacd info_error () function to determine how to format and output errors. */ 11221495Sjmacdextern int info_windows_initialized_p; 11321495Sjmacd 11421495Sjmacd/* Non-zero if an error message has been printed. */ 11521495Sjmacdextern int info_error_was_printed; 11621495Sjmacd 11721495Sjmacd/* Non-zero means ring terminal bell on errors. */ 11821495Sjmacdextern int info_error_rings_bell_p; 11921495Sjmacd 12056160Sru/* Non-zero means default keybindings are loosely modeled on vi(1). */ 12156160Sruextern int vi_keys_p; 12256160Sru 12393139Sru/* Non-zero means don't remove ANSI escape sequences from man pages. */ 12493139Sruextern int raw_escapes_p; 12593139Sru 12621495Sjmacd/* Print FORMAT with ARG1 and ARG2. If the window system was initialized, 12721495Sjmacd then the message is printed in the echo area. Otherwise, a message is 12821495Sjmacd output to stderr. */ 129146515Sruextern void info_error (char *format, void *arg1, void *arg2); 13021495Sjmacd 131146515Sruextern void add_file_directory_to_path (char *filename); 132146515Sru 13321495Sjmacd/* Error message defines. */ 134116525Sruextern const char *msg_cant_find_node; 135116525Sruextern const char *msg_cant_file_node; 136116525Sruextern const char *msg_cant_find_window; 137116525Sruextern const char *msg_cant_find_point; 138116525Sruextern const char *msg_cant_kill_last; 139116525Sruextern const char *msg_no_menu_node; 140116525Sruextern const char *msg_no_foot_node; 141116525Sruextern const char *msg_no_xref_node; 142116525Sruextern const char *msg_no_pointer; 143116525Sruextern const char *msg_unknown_command; 144116525Sruextern const char *msg_term_too_dumb; 145116525Sruextern const char *msg_at_node_bottom; 146116525Sruextern const char *msg_at_node_top; 147116525Sruextern const char *msg_one_window; 148116525Sruextern const char *msg_win_too_small; 149116525Sruextern const char *msg_cant_make_help; 15021495Sjmacd 15142660Smarkm 15293139Sru#if defined(INFOKEY) 153146515Sru/* Found in variables.c. */ 154146515Sruextern void set_variable_to_value (char *name, char *value); 15593139Sru#endif /* INFOKEY */ 15693139Sru 157146515Sru/* Found in m-x.c. */ 158146515Sruextern char *read_function_name (char *prompt, WINDOW *window); 15942660Smarkm 16042660Smarkm#endif /* !INFO_H */ 161