3.6 branching and setup.
[dragonfly.git] / contrib / texinfo / info / doc.h
blob98d1ec627b4114bd3f2d4e93cc7a0c42216743de
1 /* doc.h -- Structures associating function pointers with documentation.
2 $Id: doc.h,v 1.7 2008/02/26 16:51:05 karl Exp $
4 Copyright (C) 1993, 2001, 2004, 2007 Free Software Foundation, Inc.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Written by Brian Fox (bfox@ai.mit.edu). */
21 #if !defined (DOC_H)
22 #define DOC_H
24 #include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */
26 #if defined (INFOKEY)
27 /* For each function, we keep track of the first defined key sequence
28 which invokes that function, for each different map. This is so that
29 the dynamic documentation generation in infodoc.c (a) doesn't have to
30 search through copious KEYMAP_ENTRYs, and, more importantly, (b) the
31 user and programmer can choose the preferred key sequence that is
32 printed for any given function -- it's just the first one that
33 appears in the user's infokey file or the default keymaps in
34 infomap.c.
36 Each FUNCTION_DOC has a linked list of FUNCTION_KEYSEQ structs
37 hanging off it, which are created on startup when the user and/or
38 default keymaps are being parsed. */
39 typedef struct function_keyseq
41 struct function_keyseq *next;
42 struct keymap_entry *map;
43 char *keyseq;
44 } FUNCTION_KEYSEQ;
46 #endif /* INFOKEY */
49 /* An array of FUNCTION_DOC structures is defined in doc.c, which is
50 automagically generated by the makedoc utility, whose job is to scan
51 through the source files for command function declarations and
52 compile a list of all the ones it finds. This saves tedious
53 housekeeping and avoids errors of omission. */
54 typedef struct
56 VFunction *func;
57 #if defined (NAMED_FUNCTIONS)
58 char *func_name;
59 #endif /* NAMED_FUNCTIONS */
60 #if defined (INFOKEY)
61 FUNCTION_KEYSEQ *keys;
62 #endif /* INFOKEY */
63 char *doc;
64 } FUNCTION_DOC;
66 extern FUNCTION_DOC function_doc_array[];
68 /* Under the old key-binding system, an info command is specified by
69 the pointer to its function. Under the new INFOKEY binding system,
70 it is specified by a pointer to the command's FUNCTION_DOC structure,
71 defined in doc.c, from which the pointer to the function can be
72 easily divined using the InfoFunction() extractor. */
73 #if defined(INFOKEY)
74 typedef FUNCTION_DOC InfoCommand;
75 /* The cast to VFunction * prevents pgcc from complaining about
76 dereferencing a void *. */
77 #define InfoFunction(ic) ((ic) ? (ic)->func : (VFunction *) NULL)
78 #define InfoCmd(fn) (&function_doc_array[A_##fn])
79 #define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL)
80 #else /* !INFOKEY */
81 typedef VFunction InfoCommand;
82 #define InfoFunction(vf) ((vf))
83 #define InfoCmd(fn) fn
84 #define DocInfoCmd(fd) ((fd)->func)
85 #endif /* !INFOKEY */
87 #include "infomap.h" /* for Keymap. */
89 #if defined (NAMED_FUNCTIONS)
90 extern char *function_name (InfoCommand *cmd);
91 extern InfoCommand *named_function (char *name);
92 #endif /* NAMED_FUNCTIONS */
94 extern char *function_documentation (InfoCommand *cmd);
95 extern char *key_documentation (char key, Keymap map);
96 extern char *pretty_keyname (unsigned char key);
97 extern char *pretty_keyseq (char *keyseq);
98 extern char *where_is (Keymap map, InfoCommand *cmd);
99 extern char *replace_in_documentation (const char *string, int help_is_only_window_p);
100 extern void dump_map_to_message_buffer (char *prefix, Keymap map);
102 #endif /* !DOC_H */