Home | History | Annotate | Line # | Download | only in makeinfo
      1 /*	$NetBSD: node.h,v 1.1.1.1 2016/01/14 00:11:29 christos Exp $	*/
      2 
      3 /* node.h -- declarations for Node.
      4    Id: node.h,v 1.2 2004/04/11 17:56:47 karl Exp
      5 
      6    Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
      7 
      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)
     11    any later version.
     12 
     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.
     17 
     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.
     21 
     22    Written by Brian Fox (bfox (at) ai.mit.edu). */
     23 
     24 #ifndef NODE_H
     25 #define NODE_H
     26 
     27 #include "xref.h"
     28 
     29 /* The various references that we know about. */
     30 /* What we remember for each node. */
     31 typedef struct tentry
     32 {
     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. */
     42   int flags;
     43   int number;           /* Number for this node, relevant for HTML
     44                            splitting -- from use+define order, not just
     45                            define. */
     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).  */
     49 } TAG_ENTRY;
     50 
     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
     61 
     62 /* Menu reference, *note reference, and validation hacking. */
     64 
     65 /* A structure to remember references with.  A reference to a node is
     66    either an entry in a menu, or a cross-reference made with [px]ref. */
     67 typedef struct node_ref
     68 {
     69   struct node_ref *next;
     70   char *node;                   /* Name of node referred to. */
     71   char *containing_node;        /* Name of node containing this reference. */
     72   int line_no;                  /* Line number where the reference occurs. */
     73   int section;                  /* Section level where the reference occurs. */
     74   char *filename;               /* Name of file where the reference occurs. */
     75   enum reftype type;            /* Type of reference, either menu or note. */
     76   int number;                   /* Number for this node, relevant for
     77                                    HTML splitting -- from use+define
     78                                    order, not just define. */
     79 } NODE_REF;
     80 
     81 /* The linked list of such structures. */
     82 extern NODE_REF *node_references;
     83 
     84 /* A similar list for references occuring in @node next
     85    and similar references, needed for HTML. */
     86 extern NODE_REF *node_node_references;
     87 
     88 /* List of all nodes.  */
     89 extern TAG_ENTRY *tag_table;
     90 
     91 /* Counter for setting node_ref.number; zero is Top. */
     92 extern int node_number;
     93 
     94 /* Node order counter.  */
     95 extern int node_order;
     96 
     97 /* The current node's section level. */
     98 extern int current_section;
     99 
    100 /* Nonzero when the next sectioning command should generate an anchor
    101    corresponding to the current node in HTML mode. */
    102 extern int outstanding_node;
    103 
    104 extern TAG_ENTRY *find_node (char *name);
    106 
    107 /* A search string which is used to find a line defining a node. */
    108 DECLARE (char *, node_search_string, "\n@node ");
    109 
    110 /* Extract node name from a menu item. */
    111 extern char *glean_node_from_menu (int remember_ref, enum reftype ref_type);
    112 
    113 /* Remember a node for later validation.  */
    114 extern void remember_node_reference (char *node, int line, enum reftype type);
    115 
    116 /* Remember the name of the current output file.  */
    117 extern void set_current_output_filename (const char *fname);
    118 
    119 /* Expand macros and commands in the node name and canonicalize
    120    whitespace in the resulting expansion.  */
    121 extern char *expand_node_name (char *node);
    122 
    123 extern int number_of_node (char *node);
    124 
    125 extern void init_tag_table (void);
    126 extern void write_tag_table (char *filename);
    127 extern void free_node_references (void);
    128 extern void free_node_node_references (void);
    129 extern void validate_file (TAG_ENTRY *tag_table);
    130 extern void split_file (char *filename, int size);
    131 extern void clean_old_split_files (char *filename);
    132 
    133 #endif /* NODE_H */
    134