3 /* doc.h -- Structures associating function pointers with documentation.
4 Id: doc.h,v 1.3 2004/04/11 17:56:45 karl Exp
6 Copyright (C) 1993, 2001, 2004 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 Written by Brian Fox (bfox@ai.mit.edu). */
27 #include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */
30 /* For each function, we keep track of the first defined key sequence
31 which invokes that function, for each different map. This is so that
32 the dynamic documentation generation in infodoc.c (a) doesn't have to
33 search through copious KEYMAP_ENTRYs, and, more importantly, (b) the
34 user and programmer can choose the preferred key sequence that is
35 printed for any given function -- it's just the first one that
36 appears in the user's infokey file or the default keymaps in
39 Each FUNCTION_DOC has a linked list of FUNCTION_KEYSEQ structs
40 hanging off it, which are created on startup when the user and/or
41 default keymaps are being parsed. */
42 typedef struct function_keyseq
44 struct function_keyseq
*next
;
45 struct keymap_entry
*map
;
52 /* An array of FUNCTION_DOC structures is defined in doc.c, which is
53 automagically generated by the makedoc utility, whose job is to scan
54 through the source files for command function declarations and
55 compile a list of all the ones it finds. This saves tedious
56 housekeeping and avoids errors of omission. */
60 #if defined (NAMED_FUNCTIONS)
62 #endif /* NAMED_FUNCTIONS */
64 FUNCTION_KEYSEQ
*keys
;
69 extern FUNCTION_DOC function_doc_array
[];
71 /* Under the old key-binding system, an info command is specified by
72 the pointer to its function. Under the new INFOKEY binding system,
73 it is specified by a pointer to the command's FUNCTION_DOC structure,
74 defined in doc.c, from which the pointer to the function can be
75 easily divined using the InfoFunction() extractor. */
77 typedef FUNCTION_DOC InfoCommand
;
78 /* The cast to VFunction * prevents pgcc from complaining about
79 dereferencing a void *. */
80 #define InfoFunction(ic) ((ic) ? (ic)->func : (VFunction *) NULL)
81 #define InfoCmd(fn) (&function_doc_array[A_##fn])
82 #define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL)
84 typedef VFunction InfoCommand
;
85 #define InfoFunction(vf) ((vf))
86 #define InfoCmd(fn) fn
87 #define DocInfoCmd(fd) ((fd)->func)
90 #include "infomap.h" /* for Keymap. */
92 #if defined (NAMED_FUNCTIONS)
93 extern char *function_name (InfoCommand
*cmd
);
94 extern InfoCommand
*named_function (char *name
);
95 #endif /* NAMED_FUNCTIONS */
97 extern char *function_documentation (InfoCommand
*cmd
);
98 extern char *key_documentation (char key
, Keymap map
);
99 extern char *pretty_keyname (unsigned char key
);
100 extern char *pretty_keyseq (char *keyseq
);
101 extern char *where_is (Keymap map
, InfoCommand
*cmd
);
102 extern char *replace_in_documentation (char *string
, int help_is_only_window_p
);
103 extern void dump_map_to_message_buffer (char *prefix
, Keymap map
);