node.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* node.h -- declarations for Node.
  2. $Id: node.h,v 1.5 2007-07-01 21:20:33 karl Exp $
  3. Copyright (C) 1996, 1997, 1998, 1999, 2002, 2007
  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. Written by Brian Fox (bfox@ai.mit.edu). */
  16. #ifndef NODE_H
  17. #define NODE_H
  18. #include "xref.h"
  19. /* The various references that we know about. */
  20. /* What we remember for each node. */
  21. typedef struct tentry
  22. {
  23. struct tentry *next_ent;
  24. char *node; /* Name of this node. */
  25. char *prev; /* Name of "Prev:" for this node. */
  26. char *next; /* Name of "Next:" for this node. */
  27. char *up; /* Name of "Up:" for this node. */
  28. int position; /* Output file position of this node. */
  29. int line_no; /* Defining line in source file. */
  30. char *filename; /* The file that this node was found in. */
  31. int touched; /* Nonzero means this node has been referenced. */
  32. int flags;
  33. int number; /* Number for this node, relevant for HTML
  34. splitting -- from use+define order, not just
  35. define. */
  36. int order; /* The order of the tag, starting from zero. */
  37. char *html_fname; /* The HTML file to which this node is written
  38. (non-NULL only for HTML splitting). */
  39. } TAG_ENTRY;
  40. /* If node-a has a "Next" for node-b, but node-b has no "Prev" for node-a,
  41. we turn on this flag bit in node-b's tag entry. This means that when
  42. it is time to validate node-b, we don't report an additional error
  43. if there was no "Prev" field. */
  44. #define TAG_FLAG_PREV_ERROR 1
  45. #define TAG_FLAG_NEXT_ERROR 2
  46. #define TAG_FLAG_UP_ERROR 4
  47. #define TAG_FLAG_NO_WARN 8
  48. #define TAG_FLAG_IS_TOP 16
  49. #define TAG_FLAG_ANCHOR 32
  50. /* Menu reference, *note reference, and validation hacking. */
  51. /* A structure to remember references with. A reference to a node is
  52. either an entry in a menu, or a cross-reference made with [px]ref. */
  53. typedef struct node_ref
  54. {
  55. struct node_ref *next;
  56. char *node; /* Name of node referred to. */
  57. char *containing_node; /* Name of node containing this reference. */
  58. int line_no; /* Line number where the reference occurs. */
  59. int section; /* Section level where the reference occurs. */
  60. char *filename; /* Name of file where the reference occurs. */
  61. enum reftype type; /* Type of reference, either menu or note. */
  62. int number; /* Number for this node, relevant for
  63. HTML splitting -- from use+define
  64. order, not just define. */
  65. } NODE_REF;
  66. /* The linked list of such structures. */
  67. extern NODE_REF *node_references;
  68. /* A similar list for references occuring in @node next
  69. and similar references, needed for HTML. */
  70. extern NODE_REF *node_node_references;
  71. /* List of all nodes. */
  72. extern TAG_ENTRY *tag_table;
  73. /* Counter for setting node_ref.number; zero is Top. */
  74. extern int node_number;
  75. /* Node order counter. */
  76. extern int node_order;
  77. /* The current node's section level. */
  78. extern int current_section;
  79. /* Nonzero when the next sectioning command should generate an anchor
  80. corresponding to the current node in HTML mode. */
  81. extern int outstanding_node;
  82. extern TAG_ENTRY *find_node (char *name);
  83. /* A search string which is used to find a line defining a node. */
  84. DECLARE (char *, node_search_string, "\n@node ");
  85. /* Extract node name from a menu item. */
  86. extern char *glean_node_from_menu (int remember_ref, enum reftype ref_type);
  87. /* Remember a node for later validation. */
  88. extern void remember_node_reference (char *node, int line, enum reftype type);
  89. /* Remember the name of the current output file. */
  90. extern void set_current_output_filename (const char *fname);
  91. /* Expand macros and commands in the node name and canonicalize
  92. whitespace in the resulting expansion. */
  93. extern char *expand_node_name (char *node);
  94. extern int number_of_node (char *node);
  95. extern void init_tag_table (void);
  96. extern void write_tag_table (char *filename);
  97. extern void free_node_references (void);
  98. extern void free_node_node_references (void);
  99. extern void validate_file (TAG_ENTRY *tag_table);
  100. extern void split_file (char *filename, int size);
  101. extern void clean_old_split_files (char *filename);
  102. #endif /* NODE_H */