info.h 4.0 KB

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