doc.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* doc.h -- Structures associating function pointers with documentation.
  2. $Id$
  3. Copyright 1993, 2001, 2004, 2007, 2011, 2013, 2014
  4. Free Software Foundation, Inc.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. Originally written by Brian Fox. */
  16. #if !defined (DOC_H)
  17. #define DOC_H
  18. #include "info.h"
  19. /* For each function, we keep track of the first defined key sequence
  20. which invokes that function, for each different map. This is so that
  21. the dynamic documentation generation in infodoc.c (a) doesn't have to
  22. search through copious KEYMAP_ENTRYs, and, more importantly, (b) the
  23. user and programmer can choose the preferred key sequence that is
  24. printed for any given function -- it's just the first one that
  25. appears in the user's infokey file or the default keymaps in
  26. infomap.c.
  27. Each FUNCTION_DOC has a linked list of FUNCTION_KEYSEQ structs
  28. hanging off it, which are created on startup when the user and/or
  29. default keymaps are being parsed. */
  30. typedef struct function_keyseq
  31. {
  32. struct function_keyseq *next;
  33. struct keymap_entry *map;
  34. int *keyseq;
  35. } FUNCTION_KEYSEQ;
  36. /* Structure describing an Info command. */
  37. typedef struct
  38. {
  39. VFunction *func; /* Pointer to function implementing command. */
  40. char *func_name; /* Name of this command. */
  41. FUNCTION_KEYSEQ *keys; /* Key sequences that could invoke this command. */
  42. char *doc; /* Documentation string. */
  43. } FUNCTION_DOC;
  44. /* Array of FUNCTION_DOC structures defined in doc.c, generated
  45. by the makedoc utility. */
  46. extern FUNCTION_DOC function_doc_array[];
  47. typedef FUNCTION_DOC InfoCommand;
  48. #define InfoCmd(fn) (&function_doc_array[A_##fn])
  49. #include "infomap.h" /* for Keymap. */
  50. extern char *function_name (InfoCommand *cmd);
  51. extern InfoCommand *named_function (char *name);
  52. extern char *function_documentation (InfoCommand *cmd);
  53. extern char *pretty_keyname (int key);
  54. extern char *pretty_keyseq (int *keyseq);
  55. extern char *where_is (Keymap map, InfoCommand *cmd);
  56. extern char *replace_in_documentation (const char *string,
  57. int help_is_only_window_p);
  58. extern void dump_map_to_message_buffer (char *prefix, Keymap map);
  59. #endif /* !DOC_H */