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