Back to index

tetex-bin  3.0
node.h
Go to the documentation of this file.
00001 /* node.h -- declarations for Node.
00002    $Id: node.h,v 1.2 2004/04/11 17:56:47 karl Exp $
00003 
00004    Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019 
00020    Written by Brian Fox (bfox@ai.mit.edu). */
00021 
00022 #ifndef NODE_H
00023 #define NODE_H
00024 
00025 #include "xref.h"
00026 
00027 /* The various references that we know about. */
00028 /* What we remember for each node. */
00029 typedef struct tentry
00030 {
00031   struct tentry *next_ent;
00032   char *node;           /* Name of this node. */
00033   char *prev;           /* Name of "Prev:" for this node. */
00034   char *next;           /* Name of "Next:" for this node. */
00035   char *up;             /* Name of "Up:" for this node.   */
00036   int position;         /* Output file position of this node. */
00037   int line_no;          /* Defining line in source file. */
00038   char *filename;       /* The file that this node was found in. */
00039   int touched;          /* Nonzero means this node has been referenced. */
00040   int flags;
00041   int number;           /* Number for this node, relevant for HTML
00042                            splitting -- from use+define order, not just
00043                            define. */
00044   int order;            /* The order of the tag, starting from zero.  */
00045   char *html_fname;  /* The HTML file to which this node is written
00046                         (non-NULL only for HTML splitting).  */
00047 } TAG_ENTRY;
00048 
00049 /* If node-a has a "Next" for node-b, but node-b has no "Prev" for node-a,
00050    we turn on this flag bit in node-b's tag entry.  This means that when
00051    it is time to validate node-b, we don't report an additional error
00052    if there was no "Prev" field. */
00053 #define TAG_FLAG_PREV_ERROR  1
00054 #define TAG_FLAG_NEXT_ERROR  2
00055 #define TAG_FLAG_UP_ERROR    4
00056 #define TAG_FLAG_NO_WARN     8
00057 #define TAG_FLAG_IS_TOP     16
00058 #define TAG_FLAG_ANCHOR     32
00059 
00060 /* Menu reference, *note reference, and validation hacking. */
00061 
00062 /* A structure to remember references with.  A reference to a node is
00063    either an entry in a menu, or a cross-reference made with [px]ref. */
00064 typedef struct node_ref
00065 {
00066   struct node_ref *next;
00067   char *node;                   /* Name of node referred to. */
00068   char *containing_node;        /* Name of node containing this reference. */
00069   int line_no;                  /* Line number where the reference occurs. */
00070   int section;                  /* Section level where the reference occurs. */
00071   char *filename;               /* Name of file where the reference occurs. */
00072   enum reftype type;            /* Type of reference, either menu or note. */
00073   int number;                   /* Number for this node, relevant for
00074                                    HTML splitting -- from use+define
00075                                    order, not just define. */
00076 } NODE_REF;
00077 
00078 /* The linked list of such structures. */
00079 extern NODE_REF *node_references;
00080 
00081 /* A similar list for references occuring in @node next
00082    and similar references, needed for HTML. */
00083 extern NODE_REF *node_node_references;
00084 
00085 /* List of all nodes.  */
00086 extern TAG_ENTRY *tag_table;
00087 
00088 /* Counter for setting node_ref.number; zero is Top. */
00089 extern int node_number;
00090 
00091 /* Node order counter.  */
00092 extern int node_order;
00093 
00094 /* The current node's section level. */
00095 extern int current_section;
00096 
00097 /* Nonzero when the next sectioning command should generate an anchor
00098    corresponding to the current node in HTML mode. */
00099 extern int outstanding_node;
00100 
00101 extern TAG_ENTRY *find_node (char *name);
00102 
00103 /* A search string which is used to find a line defining a node. */
00104 DECLARE (char *, node_search_string, "\n@node ");
00105 
00106 /* Extract node name from a menu item. */
00107 extern char *glean_node_from_menu (int remember_ref, enum reftype ref_type);
00108 
00109 /* Remember a node for later validation.  */
00110 extern void remember_node_reference (char *node, int line, enum reftype type);
00111 
00112 /* Remember the name of the current output file.  */
00113 extern void set_current_output_filename (const char *fname);
00114 
00115 /* Expand macros and commands in the node name and canonicalize
00116    whitespace in the resulting expansion.  */
00117 extern char *expand_node_name (char *node);
00118 
00119 extern int number_of_node (char *node);
00120 
00121 extern void init_tag_table (void);
00122 extern void write_tag_table (char *filename);
00123 extern void free_node_references (void);
00124 extern void free_node_node_references (void);
00125 extern void validate_file (TAG_ENTRY *tag_table);
00126 extern void split_file (char *filename, int size);
00127 extern void clean_old_split_files (char *filename);
00128 
00129 #endif /* NODE_H */