xref: /openbsd-src/gnu/usr.bin/texinfo/makeinfo/index.h (revision a1acfa9b69ad64eb720639240c8438f11107dc85)
11cc83814Sespie /* index.h -- declarations for index.c.
2*a1acfa9bSespie    $Id: index.h,v 1.1.1.2 2006/07/17 16:03:46 espie Exp $
31cc83814Sespie 
41cc83814Sespie    Copyright (C) 1998, 99 Free Software Foundation, Inc.
51cc83814Sespie 
61cc83814Sespie    This program is free software; you can redistribute it and/or modify
71cc83814Sespie    it under the terms of the GNU General Public License as published by
81cc83814Sespie    the Free Software Foundation; either version 2, or (at your option)
91cc83814Sespie    any later version.
101cc83814Sespie 
111cc83814Sespie    This program is distributed in the hope that it will be useful,
121cc83814Sespie    but WITHOUT ANY WARRANTY; without even the implied warranty of
131cc83814Sespie    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
141cc83814Sespie    GNU General Public License for more details.
151cc83814Sespie 
161cc83814Sespie    You should have received a copy of the GNU General Public License
171cc83814Sespie    along with this program; if not, write to the Free Software Foundation,
181cc83814Sespie    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
191cc83814Sespie 
201cc83814Sespie #ifndef INDEX_H
211cc83814Sespie #define INDEX_H
221cc83814Sespie 
231cc83814Sespie #include "makeinfo.h"
241cc83814Sespie #include "cmds.h"
251cc83814Sespie 
261cc83814Sespie /* User commands are only new indices.  (Macros are handled separately.)  */
271cc83814Sespie extern COMMAND **user_command_array;
281cc83814Sespie extern int user_command_array_len;
291cc83814Sespie 
30*a1acfa9bSespie /* An index element... */
31*a1acfa9bSespie typedef struct index_elt
32*a1acfa9bSespie {
33*a1acfa9bSespie   struct index_elt *next;
34*a1acfa9bSespie   char *entry;                  /* The index entry itself, after expansion. */
35*a1acfa9bSespie   char *entry_text;             /* The original, non-expanded entry text. */
36*a1acfa9bSespie   char *node;                   /* The node from whence it came. */
37*a1acfa9bSespie   char *section;                /* Current section number we are in, */
38*a1acfa9bSespie   char *section_name;           /* ... and its title.  */
39*a1acfa9bSespie   int code;                     /* Nonzero means add `@code{...}' when
40*a1acfa9bSespie                                    printing this element. */
41*a1acfa9bSespie   int defining_line;            /* Line number where this entry was written. */
42*a1acfa9bSespie   int output_line;              /* And line number where it is in the output. */
43*a1acfa9bSespie   char *defining_file;          /* Source file for defining_line. */
44*a1acfa9bSespie   char *output_file;            /* Output file for output_line. */
45*a1acfa9bSespie   int entry_number;             /* Entry number.  */
46*a1acfa9bSespie } INDEX_ELT;
471cc83814Sespie 
48*a1acfa9bSespie 
49*a1acfa9bSespie /* A list of short-names for each index.
50*a1acfa9bSespie    There are two indices into the the_indices array.
51*a1acfa9bSespie    * read_index is the index that points to the list of index
52*a1acfa9bSespie      entries that we will find if we ask for the list of entries for
53*a1acfa9bSespie      this name.
54*a1acfa9bSespie    * write_index is the index that points to the list of index entries
55*a1acfa9bSespie      that we will add new entries to.
56*a1acfa9bSespie 
57*a1acfa9bSespie    Initially, read_index and write_index are the same, but the
58*a1acfa9bSespie    @syncodeindex and @synindex commands can change the list we add
59*a1acfa9bSespie    entries to.
60*a1acfa9bSespie 
61*a1acfa9bSespie    For example, after the commands
62*a1acfa9bSespie      @cindex foo
63*a1acfa9bSespie      @defindex ii
64*a1acfa9bSespie      @synindex cp ii
65*a1acfa9bSespie      @cindex bar
66*a1acfa9bSespie 
67*a1acfa9bSespie    the cp index will contain the entry `foo', and the new ii
68*a1acfa9bSespie    index will contain the entry `bar'.  This is consistent with the
69*a1acfa9bSespie    way texinfo.tex handles the same situation.
70*a1acfa9bSespie 
71*a1acfa9bSespie    In addition, for each index, it is remembered whether that index is
72*a1acfa9bSespie    a code index or not.  Code indices have @code{} inserted around the
73*a1acfa9bSespie    first word when they are printed with printindex. */
74*a1acfa9bSespie typedef struct
75*a1acfa9bSespie {
76*a1acfa9bSespie   char *name;
77*a1acfa9bSespie   int read_index;   /* index entries for `name' */
78*a1acfa9bSespie   int write_index;  /* store index entries here, @synindex can change it */
79*a1acfa9bSespie   int code;
80*a1acfa9bSespie } INDEX_ALIST;
81*a1acfa9bSespie 
82*a1acfa9bSespie extern INDEX_ALIST **name_index_alist;
83*a1acfa9bSespie 
84*a1acfa9bSespie /* Initialize all indices.  */
85*a1acfa9bSespie extern void init_indices (void);
86*a1acfa9bSespie 
87*a1acfa9bSespie extern int defined_indices;
88*a1acfa9bSespie extern int printing_index;
89*a1acfa9bSespie extern int index_counter;
90*a1acfa9bSespie 
91*a1acfa9bSespie INDEX_ELT *index_list (char *name);
921cc83814Sespie 
931cc83814Sespie #endif /* !INDEX_H */
94