(root)/
texinfo-7.1/
info/
info.h
       1  /* info.h -- Header file included everywhere
       2  
       3     Copyright 1993-2023 Free Software Foundation, Inc.
       4  
       5     This program is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation, either version 3 of the License, or
       8     (at your option) any later version.
       9  
      10     This program is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      17  
      18     Originally written by Brian Fox. */
      19  
      20  #ifndef INFO_H
      21  #define INFO_H
      22  
      23  /* System dependencies.  */
      24  #include "system.h"
      25  
      26  /* Some of our other include files use these.  */
      27  typedef int Function ();
      28  typedef void VFunction ();
      29  typedef char *CFunction ();
      30  
      31  #include "string.h"
      32  #include "mbiter.h"
      33  #include "mbchar.h"
      34  
      35  int xasprintf (char **ptr, const char *template, ...);
      36  
      37  extern char *program_name;
      38  
      39  #if !defined (whitespace)
      40  #  define whitespace(c) ((c == ' ') || (c == '\t'))
      41  #endif /* !whitespace */
      42  
      43  #if !defined (whitespace_or_newline)
      44  #  define whitespace_or_newline(c) (whitespace (c) \
      45                                      || (c == '\n') || (c == '\r'))
      46  #endif /* !whitespace_or_newline */
      47  
      48  /* Add ELT to the list of elements found in ARRAY.  SLOTS is the number
      49     of slots that have already been allocated.  IDX is the index into the
      50     array where ELT should be added.  MINSLOTS is the number of slots to
      51     start the array with in case it is empty. */
      52  #define add_pointer_to_array(elt, idx, array, slots, minslots)	\
      53    do									\
      54      {									\
      55         if (idx + 2 >= slots)						\
      56  	 {								\
      57  	   if (slots == 0)						\
      58  	     slots = minslots;						\
      59  	   array = x2nrealloc (array, &slots, sizeof(array[0]));	\
      60  	 }								\
      61         array[idx++] = elt;						\
      62         array[idx] = 0; /* null pointer for pointer types */       	\
      63      }									\
      64    while (0)
      65  
      66  #define add_element_to_array add_pointer_to_array
      67  
      68  /* All commands that can be invoked from within info_session () receive
      69     arguments in the same way.  This simple define declares the header
      70     of a function named NAME, with associated documentation DOC.  The
      71     documentation string is groveled out of the source files by the
      72     utility program `makedoc', which is also responsible for making
      73     the documentation/function-pointer maps. */
      74  #define DECLARE_INFO_COMMAND(name, doc) \
      75  void name (WINDOW *window, int count)
      76  
      77  
      78  /* For handling errors.  If you initialize the window system, you should
      79     also set info_windows_initialized_p to non-zero.  It is used by the
      80     info_error () function to determine how to format and output errors. */
      81  extern int info_windows_initialized_p;
      82  
      83  /* Non-zero means default keybindings are loosely modeled on vi(1).  */
      84  extern int vi_keys_p;
      85  
      86  /* Non-zero means don't remove ANSI escape sequences from man pages.  */
      87  extern int raw_escapes_p;
      88  
      89  /* Error message defines. */
      90  extern const char *msg_cant_find_node;
      91  extern const char *msg_cant_file_node;
      92  extern const char *msg_cant_find_window;
      93  extern const char *msg_cant_find_point;
      94  extern const char *msg_cant_kill_last;
      95  extern const char *msg_no_menu_node;
      96  extern const char *msg_no_foot_node;
      97  extern const char *msg_no_xref_node;
      98  extern const char *msg_no_pointer;
      99  extern const char *msg_unknown_command;
     100  extern const char *msg_term_too_dumb;
     101  extern const char *msg_at_node_bottom;
     102  extern const char *msg_at_node_top;
     103  extern const char *msg_one_window;
     104  extern const char *msg_win_too_small;
     105  extern const char *msg_cant_make_help;
     106  
     107  
     108  /* In infopath.c, but also used in man.c. */
     109  
     110  /* Given a string containing units of information separated by colons,
     111     return the next one pointed to by IDX, or NULL if there are no more.
     112     Advance IDX to the character after the colon. */
     113  char *extract_colon_unit (char *string, int *idx);
     114  
     115  #endif /* !INFO_H */