File: info.h

package info (click to toggle)
texinfo 7.2.91-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 99,372 kB
  • sloc: perl: 639,678; ansic: 153,056; sh: 17,327; xml: 9,180; makefile: 2,531; javascript: 1,935; awk: 1,902; python: 74; pascal: 68; sed: 39
file content (153 lines) | stat: -rw-r--r-- 4,766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* info.h -- Header file included everywhere

   Copyright 1993-2026 Free Software Foundation, Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.

   Originally written by Brian Fox. */

#ifndef INFO_H
#define INFO_H

/* System dependencies.  */
#include "system.h"

#if O_BINARY
# ifdef __MSDOS__
#  define SET_SCREEN_SIZE_HELPER terminal_prep_terminal()
#  define DEFAULT_INFO_PRINT_COMMAND ">PRN"
# endif
# ifndef __CYGWIN__
#  ifdef __MINGW32__
#   define SET_SCREEN_SIZE_HELPER terminal_prep_terminal()
extern int kill (pid_t, int);
#  endif
# endif
#endif

#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

/* From gnulib */
#include "xalloc.h"

#define STREQ(s1,s2) (strcmp (s1, s2) == 0)

#ifndef TEXINFO_PRINTFLIKE
# ifdef __GNUC__
#  define TEXINFO_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg)))
# else
#  define TEXINFO_PRINTFLIKE(fmt,narg)
# endif
#endif

struct window_struct;
typedef void COMMAND_FUNCTION (struct window_struct *window, int count);

#include "string.h"
#include "mbiter.h"
#include "mbchar.h"

int xasprintf (char **ptr, const char *template, ...);

extern char *program_name;

#if !defined (whitespace)
#  define whitespace(c) ((c == ' ') || (c == '\t'))
#endif /* !whitespace */

#if !defined (whitespace_or_newline)
#  define whitespace_or_newline(c) (whitespace (c) \
                                    || (c == '\n') || (c == '\r'))
#endif /* !whitespace_or_newline */

/* Add ELT to the list of elements found in ARRAY.  SLOTS is the number
   of slots that have already been allocated.  IDX is the index into the
   array where ELT should be added.  MINSLOTS is the number of slots to
   start the array with in case it is empty. */
#define add_pointer_to_array(elt, idx, array, slots, minslots)	\
  do									\
    {									\
       if (idx + 2 >= slots)						\
	 {								\
	   if (slots == 0)						\
	     slots = minslots;						\
	   array = x2nrealloc (array, &slots, sizeof(array[0]));	\
	 }								\
       array[idx++] = elt;						\
       array[idx] = 0; /* null pointer for pointer types */       	\
    }									\
  while (0)

#define add_element_to_array add_pointer_to_array

/* All commands that can be invoked from within info_session () receive
   arguments in the same way.  This simple define declares the header
   of a function named NAME, with associated documentation DOC.  The
   documentation string is groveled out of the source files by the
   utility program `makedoc', which is also responsible for making
   the documentation/function-pointer maps. */
#define DECLARE_INFO_COMMAND(name, doc) \
void name (WINDOW *window, int count)


/* For handling errors.  If you initialize the window system, you should
   also set info_windows_initialized_p to non-zero.  It is used by the
   info_error () function to determine how to format and output errors. */
extern int info_windows_initialized_p;

/* Non-zero means default keybindings are loosely modeled on vi(1).  */
extern int vi_keys_p;

/* Non-zero means don't remove ANSI escape sequences from man pages.  */
extern int raw_escapes_p;

/* Non-zero means don't try to be smart when searching for nodes.  */
extern int strict_node_location_p;

/* Error message defines. */
extern const char *msg_cant_find_node;
extern const char *msg_cant_file_node;
extern const char *msg_cant_find_point;
extern const char *msg_no_menu_node;
extern const char *msg_no_xref_node;
extern const char *msg_one_window;
extern const char *msg_win_too_small;

extern unsigned debug_level;
#define debug(n,c)							\
  do									\
    {									\
      if (debug_level >= (n))						\
        info_debug c;							\
    }									\
  while (0)

void info_debug (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);


/* In infopath.c, but also used in man.c. */

/* Given a string containing units of information separated by colons,
   return the next one pointed to by IDX, or NULL if there are no more.
   Advance IDX to the character after the colon. */
char *extract_colon_unit (char *string, int *idx);

#endif /* !INFO_H */