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