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