Home | History | Annotate | Line # | Download | only in makeinfo
      1 /*	$NetBSD: index.h,v 1.1.1.1 2016/01/14 00:11:29 christos Exp $	*/
      2 
      3 /* index.h -- declarations for index.c.
      4    Id: index.h,v 1.2 2004/04/11 17:56:47 karl Exp
      5 
      6    Copyright (C) 1998, 99 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 Foundation,
     20    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     21 
     22 #ifndef INDEX_H
     23 #define INDEX_H
     24 
     25 #include "makeinfo.h"
     26 #include "cmds.h"
     27 
     28 /* User commands are only new indices.  (Macros are handled separately.)  */
     29 extern COMMAND **user_command_array;
     30 extern int user_command_array_len;
     31 
     32 /* An index element... */
     33 typedef struct index_elt
     34 {
     35   struct index_elt *next;
     36   char *entry;                  /* The index entry itself, after expansion. */
     37   char *entry_text;             /* The original, non-expanded entry text. */
     38   char *node;                   /* The node from whence it came. */
     39   char *section;                /* Current section number we are in, */
     40   char *section_name;           /* ... and its title.  */
     41   int code;                     /* Nonzero means add `@code{...}' when
     42                                    printing this element. */
     43   int defining_line;            /* Line number where this entry was written. */
     44   int output_line;              /* And line number where it is in the output. */
     45   char *defining_file;          /* Source file for defining_line. */
     46   char *output_file;            /* Output file for output_line. */
     47   int entry_number;             /* Entry number.  */
     48 } INDEX_ELT;
     49 
     50 
     51 /* A list of short-names for each index.
     52    There are two indices into the the_indices array.
     53    * read_index is the index that points to the list of index
     54      entries that we will find if we ask for the list of entries for
     55      this name.
     56    * write_index is the index that points to the list of index entries
     57      that we will add new entries to.
     58 
     59    Initially, read_index and write_index are the same, but the
     60    @syncodeindex and @synindex commands can change the list we add
     61    entries to.
     62 
     63    For example, after the commands
     64      @cindex foo
     65      @defindex ii
     66      @synindex cp ii
     67      @cindex bar
     68 
     69    the cp index will contain the entry `foo', and the new ii
     70    index will contain the entry `bar'.  This is consistent with the
     71    way texinfo.tex handles the same situation.
     72 
     73    In addition, for each index, it is remembered whether that index is
     74    a code index or not.  Code indices have @code{} inserted around the
     75    first word when they are printed with printindex. */
     76 typedef struct
     77 {
     78   char *name;
     79   int read_index;   /* index entries for `name' */
     80   int write_index;  /* store index entries here, @synindex can change it */
     81   int code;
     82 } INDEX_ALIST;
     83 
     84 extern INDEX_ALIST **name_index_alist;
     85 
     86 /* Initialize all indices.  */
     87 extern void init_indices (void);
     88 
     89 extern int defined_indices;
     90 extern int printing_index;
     91 extern int index_counter;
     92 
     93 INDEX_ELT *index_list (char *name);
     94 
     95 #endif /* !INDEX_H */
     96