Back to index

tetex-bin  3.0
info.h
Go to the documentation of this file.
00001 /* info.h -- Header file which includes all of the other headers.
00002    $Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp $
00003 
00004    Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software
00005    Foundation, Inc.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 
00021    Written by Brian Fox (bfox@ai.mit.edu). */
00022 
00023 #ifndef INFO_H
00024 #define INFO_H
00025 
00026 /* We always want these, so why clutter up the compile command?  */
00027 #define HANDLE_MAN_PAGES
00028 #define NAMED_FUNCTIONS
00029 #define INFOKEY
00030 
00031 /* System dependencies.  */
00032 #include "system.h"
00033 
00034 /* Some of our other include files use these.  */
00035 typedef int Function ();
00036 typedef void VFunction ();
00037 typedef char *CFunction ();
00038 
00039 #include "filesys.h"
00040 #include "doc.h"
00041 #include "display.h"
00042 #include "session.h"
00043 #include "echo-area.h"
00044 #include "footnotes.h"
00045 #include "gc.h"
00046 
00047 #define info_toupper(x) (islower (x) ? toupper (x) : x)
00048 #define info_tolower(x) (isupper (x) ? tolower (x) : x)
00049 
00050 #if !defined (whitespace)
00051 #  define whitespace(c) ((c == ' ') || (c == '\t'))
00052 #endif /* !whitespace */
00053 
00054 #if !defined (whitespace_or_newline)
00055 #  define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
00056 #endif /* !whitespace_or_newline */
00057 
00058 /* Add POINTER to the list of pointers found in ARRAY.  SLOTS is the number
00059    of slots that have already been allocated.  INDEX is the index into the
00060    array where POINTER should be added.  GROW is the number of slots to grow
00061    ARRAY by, in the case that it needs growing.  TYPE is a cast of the type
00062    of object stored in ARRAY (e.g., NODE_ENTRY *. */
00063 #define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
00064   do { \
00065     if (idx + 2 >= slots) \
00066       array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
00067     array[idx++] = (type)pointer; \
00068     array[idx] = (type)NULL; \
00069   } while (0)
00070 
00071 #define maybe_free(x) do { if (x) free (x); } while (0)
00072 
00073 #if !defined (zero_mem) && defined (HAVE_MEMSET)
00074 #  define zero_mem(mem, length) memset (mem, 0, length)
00075 #endif /* !zero_mem && HAVE_MEMSET */
00076 
00077 #if !defined (zero_mem) && defined (HAVE_BZERO)
00078 #  define zero_mem(mem, length) bzero (mem, length)
00079 #endif /* !zero_mem && HAVE_BZERO */
00080 
00081 #if !defined (zero_mem)
00082 #  define zero_mem(mem, length) \
00083   do {                                  \
00084         register int zi;                \
00085         register unsigned char *place;  \
00086                                         \
00087         place = (unsigned char *)mem;   \
00088         for (zi = 0; zi < length; zi++) \
00089           place[zi] = 0;                \
00090       } while (0)
00091 #endif /* !zero_mem */
00092 
00093 
00094 /* A structure associating the nodes visited in a particular window. */
00095 typedef struct {
00096   WINDOW *window;               /* The window that this list is attached to. */
00097   NODE **nodes;                 /* Array of nodes visited in this window. */
00098   int *pagetops;                /* For each node in NODES, the pagetop. */
00099   long *points;                 /* For each node in NODES, the point. */
00100   int current;                  /* Index in NODES of the current node. */
00101   int nodes_index;              /* Index where to add the next node. */
00102   int nodes_slots;              /* Number of slots allocated to NODES. */
00103 } INFO_WINDOW;
00104 
00105 /* Array of structures describing for each window which nodes have been
00106    visited in that window. */
00107 extern INFO_WINDOW **info_windows;
00108 
00109 /* For handling errors.  If you initialize the window system, you should
00110    also set info_windows_initialized_p to non-zero.  It is used by the
00111    info_error () function to determine how to format and output errors. */
00112 extern int info_windows_initialized_p;
00113 
00114 /* Non-zero if an error message has been printed. */
00115 extern int info_error_was_printed;
00116 
00117 /* Non-zero means ring terminal bell on errors. */
00118 extern int info_error_rings_bell_p;
00119 
00120 /* Non-zero means default keybindings are loosely modeled on vi(1).  */
00121 extern int vi_keys_p;
00122 
00123 /* Non-zero means don't remove ANSI escape sequences from man pages.  */
00124 extern int raw_escapes_p;
00125 
00126 /* Print FORMAT with ARG1 and ARG2.  If the window system was initialized,
00127    then the message is printed in the echo area.  Otherwise, a message is
00128    output to stderr. */
00129 extern void info_error (char *format, void *arg1, void *arg2);
00130 
00131 extern void add_file_directory_to_path (char *filename);
00132 
00133 /* Error message defines. */
00134 extern const char *msg_cant_find_node;
00135 extern const char *msg_cant_file_node;
00136 extern const char *msg_cant_find_window;
00137 extern const char *msg_cant_find_point;
00138 extern const char *msg_cant_kill_last;
00139 extern const char *msg_no_menu_node;
00140 extern const char *msg_no_foot_node;
00141 extern const char *msg_no_xref_node;
00142 extern const char *msg_no_pointer;
00143 extern const char *msg_unknown_command;
00144 extern const char *msg_term_too_dumb;
00145 extern const char *msg_at_node_bottom;
00146 extern const char *msg_at_node_top;
00147 extern const char *msg_one_window;
00148 extern const char *msg_win_too_small;
00149 extern const char *msg_cant_make_help;
00150 
00151 
00152 #if defined(INFOKEY)
00153 /* Found in variables.c. */
00154 extern void set_variable_to_value (char *name, char *value);
00155 #endif /* INFOKEY */
00156 
00157 /* Found in m-x.c.  */
00158 extern char *read_function_name (char *prompt, WINDOW *window);
00159 
00160 #endif /* !INFO_H */