156160Sru/* index.h -- declarations for index.c.
2146515Sru   $Id: index.h,v 1.2 2004/04/11 17:56:47 karl Exp $
356160Sru
456160Sru   Copyright (C) 1998, 99 Free Software Foundation, Inc.
556160Sru
656160Sru   This program is free software; you can redistribute it and/or modify
756160Sru   it under the terms of the GNU General Public License as published by
856160Sru   the Free Software Foundation; either version 2, or (at your option)
956160Sru   any later version.
1056160Sru
1156160Sru   This program is distributed in the hope that it will be useful,
1256160Sru   but WITHOUT ANY WARRANTY; without even the implied warranty of
1356160Sru   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1456160Sru   GNU General Public License for more details.
1556160Sru
1656160Sru   You should have received a copy of the GNU General Public License
1756160Sru   along with this program; if not, write to the Free Software Foundation,
1856160Sru   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1956160Sru
2056160Sru#ifndef INDEX_H
2156160Sru#define INDEX_H
2256160Sru
2356160Sru#include "makeinfo.h"
2456160Sru#include "cmds.h"
2556160Sru
2656160Sru/* User commands are only new indices.  (Macros are handled separately.)  */
2756160Sruextern COMMAND **user_command_array;
2856160Sruextern int user_command_array_len;
2956160Sru
30146515Sru/* An index element... */
31146515Srutypedef struct index_elt
32146515Sru{
33146515Sru  struct index_elt *next;
34146515Sru  char *entry;                  /* The index entry itself, after expansion. */
35146515Sru  char *entry_text;             /* The original, non-expanded entry text. */
36146515Sru  char *node;                   /* The node from whence it came. */
37146515Sru  char *section;                /* Current section number we are in, */
38146515Sru  char *section_name;           /* ... and its title.  */
39146515Sru  int code;                     /* Nonzero means add `@code{...}' when
40146515Sru                                   printing this element. */
41146515Sru  int defining_line;            /* Line number where this entry was written. */
42146515Sru  int output_line;              /* And line number where it is in the output. */
43146515Sru  char *defining_file;          /* Source file for defining_line. */
44146515Sru  char *output_file;            /* Output file for output_line. */
45146515Sru  int entry_number;             /* Entry number.  */
46146515Sru} INDEX_ELT;
47146515Sru
48146515Sru
49146515Sru/* A list of short-names for each index.
50146515Sru   There are two indices into the the_indices array.
51146515Sru   * read_index is the index that points to the list of index
52146515Sru     entries that we will find if we ask for the list of entries for
53146515Sru     this name.
54146515Sru   * write_index is the index that points to the list of index entries
55146515Sru     that we will add new entries to.
56146515Sru
57146515Sru   Initially, read_index and write_index are the same, but the
58146515Sru   @syncodeindex and @synindex commands can change the list we add
59146515Sru   entries to.
60146515Sru
61146515Sru   For example, after the commands
62146515Sru     @cindex foo
63146515Sru     @defindex ii
64146515Sru     @synindex cp ii
65146515Sru     @cindex bar
66146515Sru
67146515Sru   the cp index will contain the entry `foo', and the new ii
68146515Sru   index will contain the entry `bar'.  This is consistent with the
69146515Sru   way texinfo.tex handles the same situation.
70146515Sru
71146515Sru   In addition, for each index, it is remembered whether that index is
72146515Sru   a code index or not.  Code indices have @code{} inserted around the
73146515Sru   first word when they are printed with printindex. */
74146515Srutypedef struct
75146515Sru{
76146515Sru  char *name;
77146515Sru  int read_index;   /* index entries for `name' */
78146515Sru  int write_index;  /* store index entries here, @synindex can change it */
79146515Sru  int code;
80146515Sru} INDEX_ALIST;
81146515Sru
82146515Sruextern INDEX_ALIST **name_index_alist;
83146515Sru
8456160Sru/* Initialize all indices.  */
85146515Sruextern void init_indices (void);
8656160Sru
87146515Sruextern int defined_indices;
88146515Sruextern int printing_index;
89146515Sruextern int index_counter;
9056160Sru
91146515SruINDEX_ELT *index_list (char *name);
92146515Sru
9356160Sru#endif /* !INDEX_H */
94