Merge from vendor branch CVS:
[dragonfly.git] / contrib / texinfo / info / doc.h
1 /* doc.h -- Structures associating function pointers with documentation.
2    $Id: doc.h,v 1.5 2001/11/16 23:16:40 karl Exp $
3
4    Copyright (C) 1993, 2001 Free Software Foundation, Inc.
5
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 2, or (at your option)
9    any later version.
10
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.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20    Written by Brian Fox (bfox@ai.mit.edu). */
21
22 #if !defined (DOC_H)
23 #define DOC_H
24
25 #include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc.  */
26
27 #if defined (INFOKEY)
28 /* For each function, we keep track of the first defined key sequence
29    which invokes that function, for each different map.  This is so that
30    the dynamic documentation generation in infodoc.c (a) doesn't have to
31    search through copious KEYMAP_ENTRYs, and, more importantly, (b) the
32    user and programmer can choose the preferred key sequence that is
33    printed for any given function -- it's just the first one that
34    appears in the user's infokey file or the default keymaps in
35    infomap.c.
36
37    Each FUNCTION_DOC has a linked list of FUNCTION_KEYSEQ structs
38    hanging off it, which are created on startup when the user and/or
39    default keymaps are being parsed.  */
40 typedef struct function_keyseq
41 {
42   struct function_keyseq *next;
43   struct keymap_entry *map;
44   char *keyseq;
45 } FUNCTION_KEYSEQ;
46
47 #endif /* INFOKEY */
48
49
50 /* An array of FUNCTION_DOC structures is defined in doc.c, which is
51    automagically generated by the makedoc utility, whose job is to scan
52    through the source files for command function declarations and
53    compile a list of all the ones it finds.  This saves tedious
54    housekeeping and avoids errors of omission.  */
55 typedef struct
56 {
57   VFunction *func;
58 #if defined (NAMED_FUNCTIONS)
59   char *func_name;
60 #endif /* NAMED_FUNCTIONS */
61 #if defined (INFOKEY)
62   FUNCTION_KEYSEQ *keys;
63 #endif /* INFOKEY */
64    char *doc;
65 } FUNCTION_DOC;
66
67 extern FUNCTION_DOC function_doc_array[];
68
69 extern char *function_documentation ();
70 extern char *key_documentation ();
71 extern char *pretty_keyname ();
72 extern char *pretty_keyseq ();
73 extern char *where_is ();
74 extern char *replace_in_documentation ();
75 extern void info_document_key ();
76 extern void dump_map_to_message_buffer ();
77
78 /* Under the old key-binding system, an info command is specified by
79    the pointer to its function.  Under the new INFOKEY binding system, 
80    it is specified by a pointer to the command's FUNCTION_DOC structure,
81    defined in doc.c, from which the pointer to the function can be
82    easily divined using the InfoFunction() extractor.  */
83 #if defined(INFOKEY)
84 typedef FUNCTION_DOC InfoCommand;
85 #define InfoFunction(ic) ((ic) ? (ic)->func : NULL)
86 #define InfoCmd(fn) (&function_doc_array[A_##fn])
87 #define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL)
88 #else /* !INFOKEY */
89 typedef VFunction InfoCommand;
90 #define InfoFunction(vf) ((vf))
91 #define InfoCmd(fn) fn
92 #define DocInfoCmd(fd) ((fd)->func)
93 #endif /* !INFOKEY */
94
95 #if defined (NAMED_FUNCTIONS)
96 extern char *function_name ();
97 extern InfoCommand *named_function ();
98 #endif /* NAMED_FUNCTIONS */
99 #endif /* !DOC_H */