1 | /* node.h -- declarations for Node.
|
---|
2 | $Id: node.h,v 1.2 2004/04/11 17:56:47 karl 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 |
|
---|
61 | /* Menu reference, *note reference, and validation hacking. */
|
---|
62 |
|
---|
63 | /* A structure to remember references with. A reference to a node is
|
---|
64 | either an entry in a menu, or a cross-reference made with [px]ref. */
|
---|
65 | typedef struct node_ref
|
---|
66 | {
|
---|
67 | struct node_ref *next;
|
---|
68 | char *node; /* Name of node referred to. */
|
---|
69 | char *containing_node; /* Name of node containing this reference. */
|
---|
70 | int line_no; /* Line number where the reference occurs. */
|
---|
71 | int section; /* Section level where the reference occurs. */
|
---|
72 | char *filename; /* Name of file where the reference occurs. */
|
---|
73 | enum reftype type; /* Type of reference, either menu or note. */
|
---|
74 | int number; /* Number for this node, relevant for
|
---|
75 | HTML splitting -- from use+define
|
---|
76 | order, not just define. */
|
---|
77 | } NODE_REF;
|
---|
78 |
|
---|
79 | /* The linked list of such structures. */
|
---|
80 | extern NODE_REF *node_references;
|
---|
81 |
|
---|
82 | /* A similar list for references occuring in @node next
|
---|
83 | and similar references, needed for HTML. */
|
---|
84 | extern NODE_REF *node_node_references;
|
---|
85 |
|
---|
86 | /* List of all nodes. */
|
---|
87 | extern TAG_ENTRY *tag_table;
|
---|
88 |
|
---|
89 | /* Counter for setting node_ref.number; zero is Top. */
|
---|
90 | extern int node_number;
|
---|
91 |
|
---|
92 | /* Node order counter. */
|
---|
93 | extern int node_order;
|
---|
94 |
|
---|
95 | /* The current node's section level. */
|
---|
96 | extern int current_section;
|
---|
97 |
|
---|
98 | /* Nonzero when the next sectioning command should generate an anchor
|
---|
99 | corresponding to the current node in HTML mode. */
|
---|
100 | extern int outstanding_node;
|
---|
101 | |
---|
102 |
|
---|
103 | extern TAG_ENTRY *find_node (char *name);
|
---|
104 |
|
---|
105 | /* A search string which is used to find a line defining a node. */
|
---|
106 | DECLARE (char *, node_search_string, "\n@node ");
|
---|
107 |
|
---|
108 | /* Extract node name from a menu item. */
|
---|
109 | extern char *glean_node_from_menu (int remember_ref, enum reftype ref_type);
|
---|
110 |
|
---|
111 | /* Remember a node for later validation. */
|
---|
112 | extern void remember_node_reference (char *node, int line, enum reftype type);
|
---|
113 |
|
---|
114 | /* Remember the name of the current output file. */
|
---|
115 | extern void set_current_output_filename (const char *fname);
|
---|
116 |
|
---|
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);
|
---|
120 |
|
---|
121 | extern int number_of_node (char *node);
|
---|
122 |
|
---|
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);
|
---|
130 |
|
---|
131 | #endif /* NODE_H */
|
---|