1 /* info.h -- Header file which includes all of the other headers. 2 3 Copyright 1993-2019 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 extern char *program_name; 36 37 #if !defined (whitespace) 38 # define whitespace(c) ((c == ' ') || (c == '\t')) 39 #endif /* !whitespace */ 40 41 #if !defined (whitespace_or_newline) 42 # define whitespace_or_newline(c) (whitespace (c) \ 43 || (c == '\n') || (c == '\r')) 44 #endif /* !whitespace_or_newline */ 45 46 /* Add ELT to the list of elements found in ARRAY. SLOTS is the number 47 of slots that have already been allocated. IDX is the index into the 48 array where ELT should be added. MINSLOTS is the number of slots to 49 start the array with in case it is empty. */ 50 #define add_pointer_to_array(elt, idx, array, slots, minslots) \ 51 do \ 52 { \ 53 if (idx + 2 >= slots) \ 54 { \ 55 if (slots == 0) \ 56 slots = minslots; \ 57 array = x2nrealloc (array, &slots, sizeof(array[0])); \ 58 } \ 59 array[idx++] = elt; \ 60 array[idx] = 0; /* null pointer for pointer types */ \ 61 } \ 62 while (0) 63 64 #define add_element_to_array add_pointer_to_array 65 66 /* All commands that can be invoked from within info_session () receive 67 arguments in the same way. This simple define declares the header 68 of a function named NAME, with associated documentation DOC. The 69 documentation string is groveled out of the source files by the 70 utility program `makedoc', which is also responsible for making 71 the documentation/function-pointer maps. */ 72 #define DECLARE_INFO_COMMAND(name, doc) \ 73 void name (WINDOW *window, int count) 74 75 76 /* For handling errors. If you initialize the window system, you should 77 also set info_windows_initialized_p to non-zero. It is used by the 78 info_error () function to determine how to format and output errors. */ 79 extern int info_windows_initialized_p; 80 81 /* Non-zero means default keybindings are loosely modeled on vi(1). */ 82 extern int vi_keys_p; 83 84 /* Non-zero means don't remove ANSI escape sequences from man pages. */ 85 extern int raw_escapes_p; 86 87 /* Error message defines. */ 88 extern const char *msg_cant_find_node; 89 extern const char *msg_cant_file_node; 90 extern const char *msg_cant_find_window; 91 extern const char *msg_cant_find_point; 92 extern const char *msg_cant_kill_last; 93 extern const char *msg_no_menu_node; 94 extern const char *msg_no_foot_node; 95 extern const char *msg_no_xref_node; 96 extern const char *msg_no_pointer; 97 extern const char *msg_unknown_command; 98 extern const char *msg_term_too_dumb; 99 extern const char *msg_at_node_bottom; 100 extern const char *msg_at_node_top; 101 extern const char *msg_one_window; 102 extern const char *msg_win_too_small; 103 extern const char *msg_cant_make_help; 104 105 106 /* In infopath.c, but also used in man.c. */ 107 108 /* Given a string containing units of information separated by colons, 109 return the next one pointed to by IDX, or NULL if there are no more. 110 Advance IDX to the character after the colon. */ 111 char *extract_colon_unit (char *string, int *idx); 112 113 #endif /* !INFO_H */ 114