Back to index

tetex-bin  3.0
index.h
Go to the documentation of this file.
00001 /* index.h -- declarations for index.c.
00002    $Id: index.h,v 1.2 2004/04/11 17:56:47 karl Exp $
00003 
00004    Copyright (C) 1998, 99 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software Foundation,
00018    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00019 
00020 #ifndef INDEX_H
00021 #define INDEX_H
00022 
00023 #include "makeinfo.h"
00024 #include "cmds.h"
00025 
00026 /* User commands are only new indices.  (Macros are handled separately.)  */
00027 extern COMMAND **user_command_array;
00028 extern int user_command_array_len;
00029 
00030 /* An index element... */
00031 typedef struct index_elt
00032 {
00033   struct index_elt *next;
00034   char *entry;                  /* The index entry itself, after expansion. */
00035   char *entry_text;             /* The original, non-expanded entry text. */
00036   char *node;                   /* The node from whence it came. */
00037   char *section;                /* Current section number we are in, */
00038   char *section_name;           /* ... and its title.  */
00039   int code;                     /* Nonzero means add `@code{...}' when
00040                                    printing this element. */
00041   int defining_line;            /* Line number where this entry was written. */
00042   int output_line;              /* And line number where it is in the output. */
00043   char *defining_file;          /* Source file for defining_line. */
00044   char *output_file;            /* Output file for output_line. */
00045   int entry_number;             /* Entry number.  */
00046 } INDEX_ELT;
00047 
00048 
00049 /* A list of short-names for each index.
00050    There are two indices into the the_indices array.
00051    * read_index is the index that points to the list of index
00052      entries that we will find if we ask for the list of entries for
00053      this name.
00054    * write_index is the index that points to the list of index entries
00055      that we will add new entries to.
00056 
00057    Initially, read_index and write_index are the same, but the
00058    @syncodeindex and @synindex commands can change the list we add
00059    entries to.
00060 
00061    For example, after the commands
00062      @cindex foo
00063      @defindex ii
00064      @synindex cp ii
00065      @cindex bar
00066 
00067    the cp index will contain the entry `foo', and the new ii
00068    index will contain the entry `bar'.  This is consistent with the
00069    way texinfo.tex handles the same situation.
00070 
00071    In addition, for each index, it is remembered whether that index is
00072    a code index or not.  Code indices have @code{} inserted around the
00073    first word when they are printed with printindex. */
00074 typedef struct
00075 {
00076   char *name;
00077   int read_index;   /* index entries for `name' */
00078   int write_index;  /* store index entries here, @synindex can change it */
00079   int code;
00080 } INDEX_ALIST;
00081 
00082 extern INDEX_ALIST **name_index_alist;
00083 
00084 /* Initialize all indices.  */
00085 extern void init_indices (void);
00086 
00087 extern int defined_indices;
00088 extern int printing_index;
00089 extern int index_counter;
00090 
00091 INDEX_ELT *index_list (char *name);
00092 
00093 #endif /* !INDEX_H */