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