source: trunk/texinfo/info/doc.h@ 3003

Last change on this file since 3003 was 2617, checked in by bird, 19 years ago

GNU Texinfo 4.8

File size: 3.8 KB
Line 
1/* doc.h -- Structures associating function pointers with documentation.
2 $Id: doc.h,v 1.3 2004/04/11 17:56:45 karl Exp $
3
4 Copyright (C) 1993, 2001, 2004 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. */
40typedef 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. */
55typedef 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
67extern FUNCTION_DOC function_doc_array[];
68
69/* Under the old key-binding system, an info command is specified by
70 the pointer to its function. Under the new INFOKEY binding system,
71 it is specified by a pointer to the command's FUNCTION_DOC structure,
72 defined in doc.c, from which the pointer to the function can be
73 easily divined using the InfoFunction() extractor. */
74#if defined(INFOKEY)
75typedef FUNCTION_DOC InfoCommand;
76/* The cast to VFunction * prevents pgcc from complaining about
77 dereferencing a void *. */
78#define InfoFunction(ic) ((ic) ? (ic)->func : (VFunction *) NULL)
79#define InfoCmd(fn) (&function_doc_array[A_##fn])
80#define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL)
81#else /* !INFOKEY */
82typedef VFunction InfoCommand;
83#define InfoFunction(vf) ((vf))
84#define InfoCmd(fn) fn
85#define DocInfoCmd(fd) ((fd)->func)
86#endif /* !INFOKEY */
87
88#include "infomap.h" /* for Keymap. */
89
90#if defined (NAMED_FUNCTIONS)
91extern char *function_name (InfoCommand *cmd);
92extern InfoCommand *named_function (char *name);
93#endif /* NAMED_FUNCTIONS */
94
95extern char *function_documentation (InfoCommand *cmd);
96extern char *key_documentation (char key, Keymap map);
97extern char *pretty_keyname (unsigned char key);
98extern char *pretty_keyseq (char *keyseq);
99extern char *where_is (Keymap map, InfoCommand *cmd);
100extern char *replace_in_documentation (char *string, int help_is_only_window_p);
101extern void dump_map_to_message_buffer (char *prefix, Keymap map);
102
103#endif /* !DOC_H */
Note: See TracBrowser for help on using the repository browser.