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