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