From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- indexing/glo+idxtex/GloDef.h | 42 ++ indexing/glo+idxtex/IdxDef.h | 47 ++ indexing/glo+idxtex/Makefile | 92 ++++ indexing/glo+idxtex/README | 39 ++ indexing/glo+idxtex/TAGS | 80 +++ indexing/glo+idxtex/crlext.sty | 387 +++++++++++++++ indexing/glo+idxtex/glo+idx.gdf | 20 + indexing/glo+idxtex/glo+idx.pdf | Bin 0 -> 93861 bytes indexing/glo+idxtex/glo+idx.tex | 497 +++++++++++++++++++ indexing/glo+idxtex/glo_idx.sty | 37 ++ indexing/glo+idxtex/globldfil.c | 182 +++++++ indexing/glo+idxtex/globldlab.c | 381 +++++++++++++++ indexing/glo+idxtex/glocmd.c | 193 ++++++++ indexing/glo+idxtex/glomiss.c | 145 ++++++ indexing/glo+idxtex/gloscan.c | 618 ++++++++++++++++++++++++ indexing/glo+idxtex/glotex.c | 275 +++++++++++ indexing/glo+idxtex/glotex.gdf | 36 ++ indexing/glo+idxtex/glotex.pdf | Bin 0 -> 101317 bytes indexing/glo+idxtex/glotex.tex | 445 +++++++++++++++++ indexing/glo+idxtex/idxbuild.c | 771 +++++++++++++++++++++++++++++ indexing/glo+idxtex/idxcmd.c | 189 ++++++++ indexing/glo+idxtex/idxgen.c | 716 +++++++++++++++++++++++++++ indexing/glo+idxtex/idxmaster.c | 246 ++++++++++ indexing/glo+idxtex/idxparse.c | 351 ++++++++++++++ indexing/glo+idxtex/idxrange.c | 713 +++++++++++++++++++++++++++ indexing/glo+idxtex/idxspell.c | 989 ++++++++++++++++++++++++++++++++++++++ indexing/glo+idxtex/idxtex.c | 222 +++++++++ indexing/glo+idxtex/idxtex.mdx | 2 + indexing/glo+idxtex/idxtex.pdf | Bin 0 -> 108762 bytes indexing/glo+idxtex/idxtex.tex | 600 +++++++++++++++++++++++ indexing/glo+idxtex/makefile.msc | 32 ++ indexing/glo+idxtex/ms-dos/readme | 10 + indexing/glo+idxtex/pam11.sty | 112 +++++ indexing/glo+idxtex/pamphlet.sty | 291 +++++++++++ 34 files changed, 8760 insertions(+) create mode 100644 indexing/glo+idxtex/GloDef.h create mode 100644 indexing/glo+idxtex/IdxDef.h create mode 100644 indexing/glo+idxtex/Makefile create mode 100644 indexing/glo+idxtex/README create mode 100644 indexing/glo+idxtex/TAGS create mode 100644 indexing/glo+idxtex/crlext.sty create mode 100644 indexing/glo+idxtex/glo+idx.gdf create mode 100644 indexing/glo+idxtex/glo+idx.pdf create mode 100644 indexing/glo+idxtex/glo+idx.tex create mode 100644 indexing/glo+idxtex/glo_idx.sty create mode 100644 indexing/glo+idxtex/globldfil.c create mode 100644 indexing/glo+idxtex/globldlab.c create mode 100644 indexing/glo+idxtex/glocmd.c create mode 100644 indexing/glo+idxtex/glomiss.c create mode 100644 indexing/glo+idxtex/gloscan.c create mode 100644 indexing/glo+idxtex/glotex.c create mode 100644 indexing/glo+idxtex/glotex.gdf create mode 100644 indexing/glo+idxtex/glotex.pdf create mode 100644 indexing/glo+idxtex/glotex.tex create mode 100644 indexing/glo+idxtex/idxbuild.c create mode 100644 indexing/glo+idxtex/idxcmd.c create mode 100644 indexing/glo+idxtex/idxgen.c create mode 100644 indexing/glo+idxtex/idxmaster.c create mode 100644 indexing/glo+idxtex/idxparse.c create mode 100644 indexing/glo+idxtex/idxrange.c create mode 100644 indexing/glo+idxtex/idxspell.c create mode 100644 indexing/glo+idxtex/idxtex.c create mode 100644 indexing/glo+idxtex/idxtex.mdx create mode 100644 indexing/glo+idxtex/idxtex.pdf create mode 100644 indexing/glo+idxtex/idxtex.tex create mode 100644 indexing/glo+idxtex/makefile.msc create mode 100644 indexing/glo+idxtex/ms-dos/readme create mode 100644 indexing/glo+idxtex/pam11.sty create mode 100644 indexing/glo+idxtex/pamphlet.sty (limited to 'indexing/glo+idxtex') diff --git a/indexing/glo+idxtex/GloDef.h b/indexing/glo+idxtex/GloDef.h new file mode 100644 index 0000000000..e7c15441de --- /dev/null +++ b/indexing/glo+idxtex/GloDef.h @@ -0,0 +1,42 @@ +/* Module Name: GloDef.H + * + * Description: + * Definitions for GloTeX data structures + * + * Author: R L Aurbach CR&DS MIS Group 17-Aug-1986 + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 17-Aug-1986 Original Code + * 2-001 F.H. 17-May-1991 converted to portable C + * 2-002 S.I. 30-Mar-1992 added /glossaryname for intern. support + * + */ + +/* Definitions */ + +#define TRUE 1 +#define FALSE 0 +#define STRDYN { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 } +#define NONE 0 +#define ARTICLE 1 +#define REPORT 2 +#define linesz 133 /* Max size of a line */ + +/* Declarations */ + +typedef struct string +{ + struct string *next; + char *desc; +} STRING, *STRING_PTR; + +typedef struct node +{ + struct node *next; + char *spell; + char *item; + struct string *hdr; +} NODE, *NODE_PTR; diff --git a/indexing/glo+idxtex/IdxDef.h b/indexing/glo+idxtex/IdxDef.h new file mode 100644 index 0000000000..1bd0118cb5 --- /dev/null +++ b/indexing/glo+idxtex/IdxDef.h @@ -0,0 +1,47 @@ +/* Module Name: IdxDef.H + * + * Description: + * Define data structures used by IdxTeX + * + * Author: R L Aurbach CR&DS MIS Group 26-Apr-1986 + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 26-Apr-1986 Original Code + * 1-002 RLA 03-May-1986 Add support for page-no highlighting + * 1-003 RLA 14-Apr-1987 Add new page-no highlight -- ff + * 2-004 RLA 14-Apr-1987 Add "see also" listhead + * 3-001 F.H. 17-May-1991 converted to portable C + * 3-002 S.I. 30-May-1992 Added \indexname \seename and + * \alsoname for intern. support + */ + +/* Definitions */ +#define IDX_K_NONE 0 /* No highlighting */ +#define IDX_K_UNDERLINE 1 /* Underline */ +#define IDX_K_ITALIC 2 /* Italicize */ +#define IDX_K_BOLD 3 /* BoldFace */ +#define IDX_K_FOLLOW 4 /* Following */ +#define IDX_K_ARTICLE 1 /* /TOC:ARTICLE seen */ +#define IDX_K_REPORT 2 /* /TOC:REPORT seen */ + +/* Declarations */ +typedef struct pgnode +{ + struct pgnode *link; /* Link to next page-ref*/ + char *vol; /* Volume string ptr */ + char *page_dsc; /* Page-ref string */ + char highlight; /* Highlight flag */ +} PGNODE, *PGNODE_PTR; + +typedef struct node +{ + struct node *link; /* Link to next node */ + char *spell; /* Spell string */ + char *item; /* Item string */ + struct node *subhead; /* Subitem listhead */ + struct pgnode *pghead; /* Page-ref listhead */ + struct pgnode *seehead; /* See-also listhead */ +} TREE, *TREE_PTR; diff --git a/indexing/glo+idxtex/Makefile b/indexing/glo+idxtex/Makefile new file mode 100644 index 0000000000..f693816308 --- /dev/null +++ b/indexing/glo+idxtex/Makefile @@ -0,0 +1,92 @@ +# Makefile for IDXTEX and GLOTEX (MSDOS and Unix) +# 17-May-1991 F.H. + +GCFILES= globldfil.c\ + globldlab.c\ + glocmd.c\ + glomiss.c\ + gloscan.c\ + glotex.c\ + idxspell.c +GOFILES= globldfil.o\ + globldlab.o\ + glocmd.o\ + glomiss.o\ + gloscan.o\ + glotex.o\ + idxspell.o +ICFILES= idxbuild.c\ + idxcmd.c\ + idxgen.c\ + idxmaster.c\ + idxparse.c\ + idxrange.c\ + idxspell.c\ + idxtex.c +IOFILES= idxbuild.o\ + idxcmd.o\ + idxgen.o\ + idxmaster.o\ + idxparse.o\ + idxrange.o\ + idxspell.o\ + idxtex.o + +CC=gcc + +CFLAGS= -O + +BINS= glotex idxtex + +BINDIR=/pool/lib/tex/bin + +TEXMACRODIR=/pool/lib/tex/tex82/texinputs + +INSTALL=install + +all: idxtex glotex + +install: idxtex glotex + $(INSTALL) -c -m 755 idxtex $(BINDIR) + $(INSTALL) -c -m 755 glotex $(BINDIR) + $(INSTALL) -c -m 644 glo_idx.sty $(TEXMACRODIR) + $(INSTALL) -c -m 644 crlext.sty $(TEXMACRODIR) + $(INSTALL) -c -m 644 pam11.sty $(TEXMACRODIR) + $(INSTALL) -c -m 644 pamphlet.sty $(TEXMACRODIR) + +clean: + rm -f a.out core *.o $(BINS) *~ *% \#* + +glotex: $(GOFILES) + $(CC) $(CFLAGS) $(GOFILES) -o $@ +idxtex: $(IOFILES) + $(CC) $(CFLAGS) $(IOFILES) -o $@ + +globldfil.o: globldfil.c + $(CC) -c $(CFLAGS) globldfil.c +globldlab.o: globldlab.c + $(CC) -c $(CFLAGS) globldlab.c +glocmd.o: glocmd.c + $(CC) -c $(CFLAGS) glocmd.c +glomiss.o: glomiss.c + $(CC) -c $(CFLAGS) glomiss.c +gloscan.o: gloscan.c + $(CC) -c $(CFLAGS) gloscan.c +glotex.o: glotex.c + $(CC) -c $(CFLAGS) glotex.c +idxbuild.o: idxbuild.c + $(CC) -c $(CFLAGS) idxbuild.c +idxcmd.o: idxcmd.c + $(CC) -c $(CFLAGS) idxcmd.c +idxgen.o: idxgen.c + $(CC) -c $(CFLAGS) idxgen.c +idxmaster.o: idxmaster.c + $(CC) -c $(CFLAGS) idxmaster.c +idxparse.o: idxparse.c + $(CC) -c $(CFLAGS) idxparse.c +idxrange.o: idxrange.c + $(CC) -c $(CFLAGS) idxrange.c +idxspell.o: idxspell.c + $(CC) -c $(CFLAGS) idxspell.c +idxtex.o: idxtex.c + $(CC) -c $(CFLAGS) idxtex.c diff --git a/indexing/glo+idxtex/README b/indexing/glo+idxtex/README new file mode 100644 index 0000000000..0450470231 --- /dev/null +++ b/indexing/glo+idxtex/README @@ -0,0 +1,39 @@ +Dieses Directory enthaelt die Quellen und Macros zu dem von R. L +Aurbach entwickelten Programme GloTeX und IdXTeX sowie deren +Modifikationen von F. Hantelmann (Anpassung an Standard C) und Stefano +Ianigro (Internationalisierung). + +In Ergaenzung zu den User's Guides von GloTeX und IdxTeX ist die +Einbindung eines zusaetzlichen, kleinen Style-Files notwendig. Dieses +Style-File muss an letzter Stelle der aufgefuehrten Stiloptionen +stehen, z. B. \documentstyle[12pt,crlext,german,glo_idx]{article}. Der +Grund liegt darin, dass einige Namen in glo_idx.sty neu definiert +werden. + +Eine Anpassung an verschiedene Landessprachen im File glo_idx.sty ist +leicht moeglich: + +Bisher gibt es 3 Sprachschalter: USenglish, deutsch und franzoesisch. +Duch Erweiterung dieser Abfrage koennen die Definitionen fuer +italienisch, spanisch etc. eingefuegt werden. An den C-Quellen der +Programme braucht nichts geaendert werden. + +Zur Installation: + +Fuer UNIX-Systeme: + +1. Anpassung des Files Makefile (BINDIR, TEXMACRODIR, CC) + +2. make all + +3. make install + + +Fuer MS-DOS Systeme existiert ein eigenes Makefile, das MS C +benoetigt. + +Fred Hantelmann (E-Mail: w_mf@unibw-hamburg.de) +Stefano Ianigro (E-Mail: w_stef@unibw-hamburg.de) + +Fachbereich Wirtschafts- und Organisationswissenschaften +Universitaet der Bundeswehr Hamburg diff --git a/indexing/glo+idxtex/TAGS b/indexing/glo+idxtex/TAGS new file mode 100644 index 0000000000..a96af44f5e --- /dev/null +++ b/indexing/glo+idxtex/TAGS @@ -0,0 +1,80 @@ + +globldfil.c,29 +int Glo_Build_File 126,3284 + +globldlab.c,106 +int Glo_Build_LabLst 146,4112 +static int glo_get_next_file 361,9214 +static void glo_get_token 293,7692 + +glocmd.c,27 +void Glo_Command 138,3966 + +glomiss.c,33 +int Glo_Report_Missing 116,2865 + +gloscan.c,174 +int Glo_Scan_File 157,4685 +static int glo_copy_text 590,15130 +static int glo_link_node 297,8337 +static int glo_match_label 390,10408 +static int glo_parse_item 489,12869 + +glotex.c,15 +main(196,6721 + +idxbuild.c,213 +void idx_add_cross_ref 622,16728 +void idx_add_page_ref 532,14478 +TREE_PTR idx_allocate_node 443,12257 +PGNODE_PTR idx_allocate_pgnode 751,19736 +void idx_build_tree 194,5920 +TREE_PTR idx_locate_node 356,10476 + +idxcmd.c,27 +void idx_command 156,4770 + +idxgen.c,142 +void idx_generate 160,4713 +void idx_new_group 386,10222 +void idx_postamble 706,18254 +void idx_preamble 259,6995 +void idx_write 478,12519 + +idxmaster.c,63 +int idx_parse_master(221,5979 +void idx_process_file(138,3709 + +idxparse.c,51 +int idx_extract 298,8294 +void idx_parse(150,4410 + +idxrange.c,208 +void idx_allocate_new_pgnode 694,18330 +void idx_build_new_pglist 608,16478 +void idx_build_range(173,5174 +void idx_deallocate_pglist 534,14883 +int idx_is_adjacent 470,13593 +void idx_page_parse 380,11349 + +idxspell.c,421 +int chrposition(949,23345 +void idx_build_spell_string 180,5000 +void idx_collapse_string 366,9511 +int idx_is_verbatim(852,20629 +void idx_process_accent(451,11652 +void idx_process_backslash(689,16826 +void idx_process_emphasis(755,18118 +void idx_process_groups(532,13501 +int idx_process_verb(605,15157 +void idx_replace_string 268,7156 +int strposition(931,23042 +void strprefix(973,23734 +void strupcase(964,23575 + +idxtex.c,15 +main(156,4703 + +GloDef.h,0 + +IdxDef.h,0 diff --git a/indexing/glo+idxtex/crlext.sty b/indexing/glo+idxtex/crlext.sty new file mode 100644 index 0000000000..8851b28c8d --- /dev/null +++ b/indexing/glo+idxtex/crlext.sty @@ -0,0 +1,387 @@ +% CRL Extensions to LaTeX +% +\typeout{CRDS Extensions to LaTeX, V1.1. (RL Aurbach, 09-Sep-1986)} +% +%**************************************************************************** +%* * +%* Outline Environment * +%* * +%* Description: * +%* The outline environment is a modified enumerate environment in * +%* which the numbering is done using standard outlining conventions. * +%* * +%* Syntax: * +%* \begin{outline} \item text \end{outline} * +%* * +%**************************************************************************** +% +\@definecounter{outlni} \@definecounter{outlnii} \@definecounter{outlniii} +\@definecounter{outlniv} \@definecounter{outlnv} +\newcount\@outlndepth \@outlndepth =0 +\def\outline{\ifnum \@outlndepth >4 \@toodeep \else \advance\@outlndepth\@ne + \edef\@outlnctr{outln\romannumeral\the\@outlndepth}\list + {\csname label\@outlnctr\endcsname}{\usecounter{\@outlnctr} + \def\makelabel##1{\hss\llap{##1}}}\fi} +\let\endoutline =\endlist +\def\labeloutlni{\Roman{outlni}.} \def\theoutlni{\Roman{outlni}} +\def\labeloutlnii{\Alph{outlnii}.} \def\theoutlnii{\Alph{outlnii}} +\def\labeloutlniii{\arabic{outlniii}.} \def\theoutlniii{\arabic{outlniii}} +\def\labeloutlniv{\alph{outlniv}.} \def\theoutlniv{\alph{outlniv}} +\def\labeloutlnv{(\roman{outlnv})} \def\theoutlnv{\roman{outlnv}} +\def\p@outlnii{\theoutlni.} \def\p@outlniii{\p@outlnii\theoutlnii.} +\def\p@outlniv{\p@outlniii\theoutlniii.}\def\p@outlnv{\p@outlniv\theoutlniv.} +% +%**************************************************************************** +%* * +%* InfoMap Environment * +%* * +%* Description: * +%* The infomap environment is a modified description environment in * +%* which the label is set off from the text as a signpost. The * +%* signpost is implemented in a \parbox to allow for a multi-line * +%* label. * +%* * +%* Syntax: * +%* \begin{infomap} \item[label] text \end{infomap} * +%* * +%* Where: * +%* label is the text to be placed in the Signpost at the current * +%* left margin. * +%* * +%* Note: * +%* The signpost is implemented as a \parbox set in a \raisebox which * +%* has a depth of 0pt. This is necessary to make a multi-line sign- * +%* work correctly, but occasionally, you will need to add extra * +%* vertical space if the signpost occupies more lines than the text. * +%* * +%**************************************************************************** +% +\newdimen\infomapmargin +\newdimen\infomapwidth +\infomapmargin 115pt +\infomapwidth 103pt +\def\infomaplabel#1{\raisebox{0pt}[1em][0pt]{\makebox[\labelwidth][l] + {\parbox[t]{\infomapwidth}{\bf #1}}}} +\def\infomap{\list{}{\leftmargin\infomapmargin + \labelwidth\leftmargin\advance\labelwidth-\labelsep + \let\makelabel\infomaplabel}} +\let\endinfomap\endlist +\def\ttitem[#1]{\item[{\tt #1}]} +% +%**************************************************************************** +%* * +%* Note Environment * +%* * +%* Description: * +%* The note environment is a modified version of the quote environment.* +%* It is distinctive in that it has a centered title for the note * +%* prior to the beginning of the text. The title may be specified, * +%* using the optional argument. If no title is specified, the title * +%* "Note" is used. * +%* * +%* Syntax: * +%* \begin{note}[title] text \end{note} * +%* * +%* Where: * +%* title is the text to be used as the title. If not specified * +%* "Note" is used. The title is centered above the text, * +%* in boldface. * +%* * +%* Note: * +%* It is possible for the title and text of a note to be separated * +%* across a page break. So far, I haven't been able to discover a * +%* fool-proof way to prevent this from occurring, so check the output. * +%* * +%**************************************************************************** +% +\def\note{\@ifnextchar [{\@note}{\@note[Note]}} +\def\@note[#1]{\par \list{}{\leftmargin 2em \rightmargin\leftmargin } + \item[] \hfil {\bf #1} \hfil \par \item[]} +\let\endnote\endlist +% +%**************************************************************************** +%* * +%* Ctl Command * +%* * +%* Description: * +%* The \ctl command is used to place a representation of a control * +%* character in the document. \ctl{x} is represented as ^x. * +%* * +%* Syntax: * +%* \ctl{ch} * +%* * +%* Where: * +%* ch is the character to be represented. * +%* * +%* Note: * +%* The character is displayed in \tt. * +%* * +%**************************************************************************** +% +\def\ctl#1{{\tt $^\wedge$#1}} +% +%**************************************************************************** +%* * +%* Trademark Command * +%* * +%* Description: * +%* This command generates a trademark symbol (an R in a circle). The * +%* symbol is normally used as "foo$^\trademark$". * +%* * +%* Syntax: * +%* \trademark * +%* * +%* Note: * +%* Thanks to Kent McPherson of Lear/Siegler for this command. * +%* * +%**************************************************************************** +% +\def\trademark{{\ooalign + {\tiny \hfill \raise .085ex\hbox{R}\hfill \crcr + \scriptsize \mathhexbox20D}}} +% +%**************************************************************************** +%* * +%* ULine Command * +%* * +%* Description: * +%* The \uline command is used to underline text. Unlike the * +%* \underline command, \uline provides the user with the ability to * +%* control the thickness of the line. * +%* * +%* Syntax: * +%* \uline{text}{thickness} * +%* * +%* Where: * +%* text is the text which will be underlined. * +%* * +%* thickness is the thickness of the line. This dimension is * +%* typically .3pt --.5pt. * +%* * +%* Note: * +%* Thanks to Kent McPherson of Lear/Siegler for this command. * +%* * +%**************************************************************************** +% +\newlength{\ulength} +\newcommand{\uline}[2]{\settowidth{\ulength}{#1} + \parbox{\ulength}{{#1} \\[-.75\baselineskip] \rule{\ulength}{#2}}} +% +%**************************************************************************** +%* * +%* ClearDoublePage Command * +%* * +%* Description: * +%* This command is a modification of the standard LaTeX command of the * +%* same name. Unlike standard LaTeX, this command uses the "empty" * +%* pagestyle for the blank page it throws, so that the page is totally * +%* blank. * +%* * +%* Syntax: * +%* \cleardoublepage * +%* * +%**************************************************************************** +% +\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else + \if@twocolumn\hbox{}\newpage\fi\hbox{}\thispagestyle{empty}\newpage\fi\fi} +% +%**************************************************************************** +%* * +%* ForceRightPage Command * +%* * +%* Description: * +%* The \forcerightpage command is a variant on the \cleardoublepage * +%* command. It conditionally throws a blank page to force the text * +%* which follows to appear on a right-hand page. The blank page will * +%* contain an optional, centered message. * +%* * +%* Syntax: * +%* \forcerightpage[text] * +%* * +%* Where: * +%* text is the text to be displayed centered on the page. If * +%* not specified, "This page intentionally left blank" * +%* is used. * +%* * +%* Note: * +%* This command will not correctly handle a two-column document and * +%* should not be used in that environment. * +%* * +%**************************************************************************** +% +\def\forcerightpage{\@ifnextchar [{\@forcerightpage} + {\@forcerightpage[This page intentionally left blank]}} +\def\@forcerightpage[#1]{\clearpage\if@twoside \ifodd\c@page\else + \hbox{} \vfill \centerline{#1} \vfill \newpage\fi\fi} +% +%**************************************************************************** +%* * +%* ForceLeftPage Command * +%* * +%* Description: * +%* The \forceleftpage command is a variant on the \cleardoublepage * +%* command. It conditionally throws a blank page to force the text * +%* which follows to appear on a left-hand page. The blank page will * +%* contain an optional, centered message. * +%* * +%* Syntax: * +%* \forceleftpage[text] * +%* * +%* Where: * +%* text is the text to be displayed centered on the page. If * +%* not specified, "This page intentionally left blank" * +%* is used. * +%* * +%* Note: * +%* This command will not correctly handle a two-column document and * +%* should not be used in that environment. * +%* * +%**************************************************************************** +% +\def\forceleftpage{\@ifnextchar [{\@forceleftpage} + {\@forceleftpage[This page intentionally left blank]}} +\def\@forceleftpage[#1]{\clearpage \if@twoside \ifodd\c@page + \hbox{} \vfill \centerline{#1} \vfill \newpage\fi\fi} +% +%**************************************************************************** +%* * +%* Input Command * +%* * +%* Description: * +%* The \input command is a variation of the standard LaTeX command of * +%* the same name. It reads in an external file. It differs from the * +%* normal LaTeX command in that if the specified file is not found, * +%* the routine displays a message and continues, rather than prompting * +%* for a new file name. * +%* * +%* Syntax: * +%* \input{file} * +%* * +%* Where: * +%* file is the file specification of the input file to be read. * +%* By default, the file has the file type ".tex" unless * +%* specified otherwise. If the file is not found in the * +%* current default directory, it will be searched for in * +%* TEX$INPUTS. * +%* * +%**************************************************************************** +% +\def\input{\@ifnextchar \bgroup{\@input}{\@@input }} +% +%**************************************************************************** +%* * +%* CoverStyle Command * +%* * +%* Description: * +%* This routine defines a cover style for a document. It reads in a * +%* ".cvrsty" file, which contains the necessary information. * +%* * +%* Syntax: * +%* \coverstyle{name} * +%* * +%* Where: * +%* name is the name of a coverstyle. The file name.cvrsty will * +%* be input. * +%* * +%**************************************************************************** +% +\def\coverstyle#1{\def\@coverstyle{#1} + \makeatletter \input \@coverstyle.cvrsty \relax \makeatother} +% +%**************************************************************************** +%* * +%* ScreenPix Environment * +%* * +%* Description: * +%* The screenpix environment is used to display the image of a screen * +%* in a document. A curved line is drawn at the top, which represents * +%* the beginning of the screen. After the verbatim text, another line * +%* is drawn at the bottom to represent the bottom of the screen. * +%* * +%* Lines up to 80 characters long may appear. You should place a * +%* leading space at the beginning of each line, so that the text will * +%* not overwrite the curved lines. Since tabs are not expanded in * +%* verbatim mode, they should be explicitly converted to spaces. * +%* * +%* Syntax: * +%* \begin{screenpix} * +%* \begin{verbatim} * +%* lines of verbatim screen-image text * +%* \end{verbatim} * +%* \end{screenpix} * +%* * +%* Where: * +%* The lines of verbatim text may be up to 80 characters long, not * +%* counting the REQUIRED leading space on each line. * +%* * +%* Note: * +%* This environment assumes that a text width of 6 inches is available * +%* for the display of the screen. * +%* * +%**************************************************************************** +% +\def\screenpix{\small \setlength{\unitlength}{1in} \thicklines + \begin{picture}(6,.35) \put(3,0){\oval(6,.7)[t]} \end{picture}\par + \vspace*{-3\parskip}} +\def\endscreenpix{\vspace*{-3\parskip} + \begin{picture}(6,.35) \put(3,.35){\oval(6,.7)[b]} \end{picture}} +% +%**************************************************************************** +%* * +%* Glossaryfile Command * +%* * +%* Description: * +%* This command is used to specify one or more Glossary Definition * +%* files which will be searched for glossary definitions by GloTeX. * +%* * +%* Syntax: * +%* \glossaryfile{filelist} * +%* * +%* Where: * +%* filelist is a file specification of a .gdf file or a comma-list * +%* of file specifications. * +%* * +%* Note: * +%* This command writes a \glofile command to the .glo file * +%* * +%**************************************************************************** +% +\def\glossaryfile#1{\if@filesw\write\@glossaryfile{\string + \glofile{#1}}\fi} +% +%**************************************************************************** +%* * +%* InsertGlossary Command * +%* * +%* Description: * +%* This command causes a .gls file to be read in and processed. * +%* * +%* Syntax: * +%* \insertglossary * +%* * +%* Note: * +%* The .gls file is assumed to have the same name as the root latex * +%* source file. * +%* * +%**************************************************************************** +% +\def\insertglossary{\@input{\jobname.gls}} +% +%**************************************************************************** +%* * +%* InsertIndex Command * +%* * +%* Description: * +%* This command causes an .ind file to be read in and processed. * +%* * +%* Syntax: * +%* \insertindex * +%* * +%* Note: * +%* The .ind file is assumed to have the same name as the root latex * +%* source file. * +%* * +%**************************************************************************** +% +\def\insertindex{\@input{\jobname.ind}} +% diff --git a/indexing/glo+idxtex/glo+idx.gdf b/indexing/glo+idxtex/glo+idx.gdf new file mode 100644 index 0000000000..feb5d8662c --- /dev/null +++ b/indexing/glo+idxtex/glo+idx.gdf @@ -0,0 +1,20 @@ +@entry{gdf-file, Glossary\\Definition\\File} Ein Glossary Definition +File ist eine Glossar-Datenbank. Das Glossary Definition File besteht aus +Glossar-Eintr\"agen. Glo\TeX{} kann in einem Durchlauf mehrere +Glossar-Datenbanken konsultieren. + +@entry{glo-keys, Glossar-\\Schl\"ussel} Der Glossar-Schl\"ussel ist +der Bezeichner, welcher im Dokument als Parameter an \verb+\glossary+ +\"ubergeben wird. Glo\TeX{} sucht die Glossar-Datenbank(en) nach +Glossar-Schl\"usseln ab, welche dort als erster Parameter der +\verb+@entry+-Anweisung stehen. Falls Glo\TeX{} in der Glossar-Datenbank +einen aufzul\"osenden Glossar-Schl\"ussel findet, wird der zugeh\"orige +Glossar-Eintrag in das Glossar \"ubernommen. + +@entry{glo-entry, Glossar-\\Eintrag} Zur Kennzeichnung eines +Glossar-Eintrags steht in der Glossar-Datenbank einleitend +\verb+@entry{Referenz, Schlagwort}+. Daran anschlie\ss end darf +ein beliebig umfangreiches Textsegment als Erl\"auterung zu dem +Schlagwort stehen. \verb+Referenz+ ist der Glossar-Schl\"ussel, +\verb+Schlagwort+ ist die Bezeichnung, welche Glo\TeX{} als +Akronym im Glossar einsetzt. diff --git a/indexing/glo+idxtex/glo+idx.pdf b/indexing/glo+idxtex/glo+idx.pdf new file mode 100644 index 0000000000..9ba5dc5360 Binary files /dev/null and b/indexing/glo+idxtex/glo+idx.pdf differ diff --git a/indexing/glo+idxtex/glo+idx.tex b/indexing/glo+idxtex/glo+idx.tex new file mode 100644 index 0000000000..a4b3adbc65 --- /dev/null +++ b/indexing/glo+idxtex/glo+idx.tex @@ -0,0 +1,497 @@ +\hoffset-1.3cm +\voffset-1cm +\documentstyle[12pt,crlext,oldlfont,german,glo_idx]{article} +\topmargin=0cm +\headheight=0cm +\headsep=0cm +\oddsidemargin=0.6cm +\evensidemargin=0.6cm +\textheight=26.5cm +\textwidth=18cm +\parindent=24pt +\unitlength1mm +\parskip=0pt +\makeindex +\makeglossary + +\begin{document} + +\begin{center} +\noindent +{\Huge Glo\TeX{} und Idx\TeX} + +\vspace{10mm} +{\bf Fred Hantelmann\\ Universit\"at der Bundeswehr Hamburg\\ +Institut f\"ur Informatik\\ +Holstenhofweg 85\\ D-2000 Hamburg 70\\ w\_mf\symbol{64}unibw-hamburg.de} +\end{center} + +\vspace{10mm} +\begin{abstract} +\noindent +Glo\TeX{} und Idx\TeX{} sind keine Pr\"a- oder Postprozessoren zum +\TeX -System; es sind vielmehr Programme, die den Anwendungsbereich +des \LaTeX -Makro\-pakets um M\"oglichkeiten erg\"anzt, die Leslie +Lamport in \verb+article.sty+ und \verb+report.sty+ bereits +vorbereitet hat. Glo\TeX{} automatisiert die Produktion von Glossaren +zu einem \LaTeX -Dokument. Idx\TeX{} gestattet die Erstellung eines +komfortablen Index-Verzeichnisses mit Unterst\"utzung von +Seitenbereichen und Querverweisen.\index{Querverweis} Au\ss erdem +kann Idx\TeX{} zu einem mehrb\"andigen Werk ein {\sl Masterindex} +generieren. +\end{abstract} + +\section{Auftakt} +Glo\TeX{} und Idx\TeX{} wurden 1986 von Richard L.~Aurbach f\"ur +Vax C-Compiler programmiert. Der Autor dieses Artikels hat sich +interessenhalber die Quellen geordert und dann die Vax-spezifischen +Kommandos zur Bearbeitung von Zeichenketten (Strings) f\"ur C-Compiler +unter Unix und MS-DOS angepa\ss t. Die Konvertierung war bereits nach +zwei Wochen Arbeit im Mai 1991 abgeschlossen und wird nun im Rahmen +der \TeX -Tagung DANTE '{}92 zur Verbreitung an die Public Domain +\"ubergeben. + +Die Funktionalit\"at von Glo\TeX und Idx\TeX{} wurde nicht +ver\"andert; die von Richard L.~Aurbach produzierten jeweiligen +{\sl User'{}s Guides} enthalten weiterhin die vollst\"andige +Beschreibung der Programme. Der Umgang mit Dateien ist in den +{\sl User'{} Guides} f\"ur Vax-Systeme angegeben, bei Anwendung der +Programme unter MS-DOS oder Unix sind die dort \"ublichen +Konventionen anzuwenden. Der nun folgende Teil des Artikels enth\"alt +eine kompakte \"Ubersicht zum Einsatzbereich beider Programme. +Au\ss erdem werden einige Unzul\"anglichkeiten von insbesondere +Idx\TeX{} erl\"autert, die allerdings nur bedingt als Probleme +anzusehen sind. Zum Abschlu\ss{} sind dem Artikel ein Beispiel +eines Glo\TeX{} Glossars und eines Idx\TeX{} Indexverzeichnises +angeh\"angt. + +\section{Regieanweisungen} +Leslie Lamport hat im Abschnit 4.5 seines {\sl \LaTeX{} User'{}s Guide +\& Reference Manual} den Gebrauch der \LaTeX -Makros \verb+\glossary+, +\index{^\verb+\glossary+} \verb+\makeglossary+,\index{\verb+makeglossary+} +\verb+\index+\index{\verb+\index+} und \verb+\makeindex+ +\index{\verb+makeindex+} erl\"autert. Die Angabe von +\verb+\makeglossary+\index{\verb+makeglossary+} veranla\ss t \LaTeX{} +zu einem Dokument \verb+file.tex+ eine Datei \verb+file.glo+ +\index{Dateikennung>\verb+.glo+} anzulegen, in welcher alle in +\verb+file.tex+ mit \verb+\glossary{referenz}+\index{^\verb+\glossary+} +markierten Textstellen als + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+\glossaryentry{referenz}{seite}+ +\index{\verb+\glossaryentry+}\index{\verb+\glossaryentry+&\verb+\indexentry+} +\vspace{5mm} + +\noindent +aufgelistet sind (\verb+seite+ ist dabei einfach die Nummer der Seite +im mit \LaTeX{} formatierten Text, auf der \verb+\glossary{referenz}+ +\index{^\verb+\glossary+} gefunden wurde. Analog erzeugt \LaTeX{} +eine Datei \verb+file.idx+,\index{Dateikennung>\verb+.idx+} wenn +\LaTeX{} mittels \verb+\makeindex+\index{\verb+makeindex+} dazu +aufgefordert wurde. In \verb+file.idx+\index{Dateikennung>\verb+.idx+} +befinden sich nach einem \LaTeX{} Durchlauf dann Eintr\"age der Form + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+\indexentry{referenz}{seite}+, +\index{\verb+\indexentry+&\verb+\glossaryentry+} +\vspace{5mm} + +\noindent +falls auf Seite \verb+seite+ im Dokument \verb+\index{referenz}+ +\index{\verb+\index+} steht. + +Die Aufbereitung der durch \verb+\makeglossary+\index{\verb+makeglossary+} +oder \verb+\makeindex+\index{\verb+makeindex+} von \LaTeX{} erzeugten +Zwischendateien zu Textsegmenten, die ihrerseits bei der endg\"ultigen +Produktion eines \LaTeX -Dokuments mit \verb+\input{file}+ +\index{\verb+\input+} an beliebiger Stelle in das Dokument einzubinden +sind, \"uberl\"a\ss t Leslie Lamport dem Anwender bzw.~er verweist auf +das {\sl Local Guide} zur verwendeten \TeX -Implementation, welche +gegebenenfalls Auskunft \"uber die Verf\"ugbarkeit von f\"ur diese +Aufgabe geeigneten Programmen Aufschlu\ss{} gibt. + +Neben dem allgemein bekannten Programm Makeindex, einem +von Pehong Chen programmierten und relativ ansprechenden Werkzeug +zum Formatieren von Indexverzeichnissen, bietet Idx\TeX{} +eine alternative L\"osung zu dieser Aufgabe. Glo\TeX{} ist in seiner +Arbeitsweise mit Bib\TeX{} zu vergleichen, Glo\TeX{} arbeitet +jedoch nicht mit Bibliographie- sondern mit Glossar-Datenbanken. + +\section{Glo\TeX{} im Rampenlicht} + +Ein Glossar zu einem Dokument ist eine erhebliche Bereicherung f\"ur +einen Fachartikel; es bietet dem fachfremden Leser eine kurze +Erl\"auterung zu den im Dokument verwendeten Akronymen. Autoren, +die viele Fachartikel erstellen, ben\"otigen ein automatisiertes +Verfahren zur Erstellung von Glossaren, zum Beispiel Glo\TeX . + +Glo\TeX{} setzt voraus, da\ss{} der Benutzer eine (oder mehrere) +Glossar-Daten\-bank(en) \verb+file.gdf+\index{Dateikennung>\verb+.gdf+} +(Glossary Definition File)\glossary{gdf-file} angelegt hat und erzeugt +aus den vom Anwender im Dokument benutzten Glossar-Schl\"usseln +\glossary{glo-keys} eine Datei, welche zu jedem benutzten +Glossar- Schl\"ussel einen Glossar-Eintrag\glossary{glo-entry} +enth\"alt --- falls alle verwendeten Schl\"ussel auch in der (den) +Glossar-Datenbank(en) aufgef\"uhrt sind. Nach Aufruf von + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+$ glotex file [/STYLE={Article | Report | Special}]\+\\ +\index{\verb+glotex+&\verb+/STYLE+}\index{\verb+/STYLE+} +\hbox{}\hspace{1cm}\verb+ /GLOSSARY=(def1[,def2[,...]])+ +\index{\verb+/GLOSSARY+&\verb+/STYLE+} + +\vspace{5mm} + +\noindent +erzeugt \verb+glotex+\index{\verb+glotex+} aus \verb+file.glo+ +\index{Dateikennung>\verb+.glo+} eine Datei \verb+file.gls+, +\index{Dateikennung>\verb+.gls+} welche an beliebiger Stelle im +Dokument mit \verb+\input{file.gls}+ \index{\verb+\input+} +\index{Dateikennung>\verb+.gls+} eingebunden werden kann. + +Die angegebene Aufrufsyntax ist nicht unbedingt leicht verst\"andlich, +soda\ss{} an dieser Stelle ein Kommentar n\"otig ist. Das +\verb+$+-Zeichen steht f\"ur das Prompt einer Unix-Shell. \verb+file+ +ist der Name einer von \LaTeX{} erzeugten Glossar-Referenzliste und +wird an Glo\TeX{} ohne Kennung \"ubergeben. Die angebbare +\verb+/STYLE+-Option\index{\verb+/STYLE+} bewirkt eine Formatierung +von \verb+file.gls+\index{Dateikennung>\verb+.gls+} f\"ur wahlweise +den Dokumentstil \verb+article+, \verb+report+ (bzw.~\verb+book+) +oder einem alternativen Stil. Hinter \verb+/GLOSSARY+ kann eine +Datei oder auch eine Liste von Dateien angegeben sein (ohne +Kennung!), welche die von Glo\TeX{} zu konsultierenden +Glossar-Datenbanken beinhalten. + +Im \verb+Article+-Stil erscheint das Glossar als eigenst\"andige +und numerierte Sektion im Dokument. Im \verb+Report+-Stil wird +das Glossar als nichtnumeriertes Kapitel zum Dokument erstellt. In +beiden F\"allen wird zum Glossar ein Eintrag im Inhaltsverzeichnis +getroffen. Standardm\"a\ss ig arbeitet \verb+glotex+ +\index{\verb+glotex+} im \verb+Special+-Modus, welcher f\"ur die +Verwendung der seitens der CR\&DS Gruppe der Monsanto Company +erstellten Dokumentstile \verb+pamphlet+,\index{\verb+pamphlet+} +\verb+manual+\index{\verb+manual+} oder \verb+memo+\index{\verb+memo+} +gedacht ist. Diese Dokumentstile stellen die f\"ur das +\verb+theglossary+-Environment \index{\verb+theglossary+} +\index{Environment>\verb+theglossary+} ben\"otigten Definitionen +selbst bereit, welche anderenfalls der Datei +\verb+file.gls+\index{Dateikennung>\verb+.gls+} vorangestellt werden. + +In \verb+file.gls+\index{Dateikennung>\verb+.gls+} finden sich die im +Dokument mit \verb+\glossary{Referenz}+\index{^\verb+\glossary+} +gekennzeichneten Begriffe als \verb+\item[Referenz]+\index{\verb+\item+} +wieder, falls in den verwendeten Glossary Definition Files der Eintrag +\verb+@entry{Referenz,Schlagwort}+\index{\verb+@entry+} oder einfach +\verb+@entry{Referenz}+\index{\verb+@entry+} vorhanden ist. Falls +\verb+Schlagwort+ dort zu einer \verb+Referenz+ angegeben ist, +setzt \verb+glotex+\index{\verb+glotex+} dieses als Bezeichner zu +einem Glossar-Eintrag ein. Das Glossar erh\"alt eine Formatierung im +\verb+infomap+-Environment,\index{\verb+\infomap+} +\index{Environment>\verb+infomap+} einer von Monsanto CR\&DS erweiterten +Version des \verb+description+-Environment.\index{\verb+description+} +\index{Environment>\verb+description+} + +Wurde keine \verb+/GLOSSARY+-Spezifikation\index{\verb+/Glossary+} +getroffen, sucht \verb+glotex+\index{\verb+glotex+} nach \verb+file.gdf+. +\index{Dateikennung>\verb+.gdf+} Die Verwendung mehrerer +Glossar-Datenbanken bietet den Vorteil, die im Dokument referenzierten +Begriffe nach Sachthemen geordnet zu verwalten. \verb+glotex+ +\index{\verb+glotex+} zeigt auch eine Liste der nicht aufgel\"osten +Schl\"ussel, soda\ss{} \verb+glotex+\index{\verb+glotex+} bei der +Erstellung von Glossar-Datenbanken helfen kann. Zu einem +\verb+glotex+-Durchlauf\index{\verb+glotex+} wird dazu eine Statistik +am Terminal ausgegeben und gleichzeitig in ein Glossary Log File +(Endung \verb+.glg+)\index{dateikennung>\verb+.glg+} geschrieben. + +\section{Zwischenspiel f\"ur Idx\TeX} +Gem\"a\ss{} der im {\sl User'{}s Guide to the Idx\TeX{} Program} +angegebenen Aufrufsyntax + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+$ idxtex file [/TOC={ARTICLE | REPORT}]+ +\index{#\verb+idxtex+} +\vspace{5mm} + +\noindent +erzeugt Idx\TeX{} zu +\verb+file.idx+\index{Dateikennung>\verb+.idx+} +eine Datei \verb+file.ind+.\index{Dateikennung>\verb+.ind+} Die Datei +\verb+file.ind+\index{Dateikennung>\verb+.ind+} enth\"alt am Kopf die +Definition von \verb+\indexhead#1#2#3+,\index{\verb+\indexhead+} +also einem Makro mit 3 Parametern. Der dritte Parameter f\"ur +\verb+\indexhead+ ist die Index\"uberschrift, welche einleitend bei +einem Wechsel des Anfangsbuchstabens innerhalb des Index gesetzt wird. +Die beiden anderen Parameter bestimmen den vertikalen Zeilenvorschub +zur Index\"uberschrift und zum darauf folgenden Text. + +Das Aussehen einer Index\"uberschrift ist im Programm +\verb+idxtex+\index{#\verb+idxtex+} fest einprogrammiert und +wird beispielsweise f\"ur den Buschstaben \verb+A+ gem\"a\ss{} + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+\indexhead{2em}{1em}{--- A ---}+ +\vspace{5mm} + +\noindent +an die aktuelle Position der Ergebnisdatei angef\"ugt. Ob das +von R.~L.~Aurbach vorgegebene Aussehen einer Index\"uberschrift dem +eigenen Geschmack entspricht ist Ansichtssache --- Leslie Lamport +hat im Index zum {\sl \LaTeX{} User'{}s Guide} beim Wechsel zu einem +neuen Anfangsbuchstaben lediglich eine Leerzeile gelassen, und +daran hat sich bisher wohl kaum jemand gest\"ort. Die von +R.~L.~Aurbach vorgeschlagene Index\"uberschrift hat zudem einen +Layout-technischen Nachteil, der im folgenden noch erl\"autert wird. + +Zur Unterst\"utzung von Indexverzeichnissen ist im \verb+latex.tex+ +das \verb+theindex+-Environment\index{\verb+theindex+} +\index{Environment>\verb+theindex+} definiert. \verb+idxtex+ +\index{#\verb+idxtex+} tr\"agt vor dem ersten \verb+\indexhead+ die +Angabe \verb+\begin{theindex}+\index{\verb+\begin{theindex}+} +ein, soda\ss{} der folgende Text gem\"a\ss{} dem im +\verb+theindex+-Environment\index{\verb+\theindex+} +\index{Environment>\verb+theindex+} vorgesehenen zweispaltigen +Seitenaufbau gesetzt wird. Hier kommt der im vorigen Absatz +angek\"undigte Nachteil der Index\"uberschrift zum tragen: Die +Index\"uberschrift nimmt nicht zwingend genau den Platz ein, der +von einer ganzzahligen Anzahl von Textzeilen beansprucht wird. Im +zweispaltigen Druck sieht die Ausgabe nicht gerade so aus, als w\"are +sie von einem Profi gesetzt: Nebeneinander liegende Zeilen sind +gegeneinander nach oben oder unter versetzt (siehe Indexverzeichnis +am Ende des Artikels). + +Zul\"assige Textelemente m\"ussen im \verb+theindex+-Environment +\index{Environment>\verb+theindex+}\index{\verb+theindex+} +wahlweise mit \verb+\item+,\index{\verb+\item+} \verb+\subitem+ +\index{\verb+\subitem+} oder \verb+\subsubitem+ +\index{\verb+\subsubitem+} eingeleitet sein. Damit werden +Haupt- und Unterbegriffe gekennzeichnet, die \LaTeX{} durch +Einr\"ucken voneinander abhebt. Der Gebrauch von genau drei Ebenen +ist auch im Index des {\sl \LaTeX{} User'{}s Guide} zu finden. +Zus\"atzlich hat Leslie Lamport dort Texte in \verb+verbatim+ +gesetzt, mehrfache Referenzen zusammengefa\ss t und Seitenbereiche +durch ein auf die Seitenzahl der ersten Referenz folgendes +\verb+ff+ gekennzeichnet. + +Diese Arbeit erledigt Idx\TeX{} automatisch. Erg\"anzend zu den von +Leslie Lamport benutzten Text-Attributen f\"ur den im Index enthaltenen +Text und auch bez\"uglich der Darstellung der Seitenzahl erlaubt +Idx\TeX{} die Attribute {\bf boldface} und {\it italic}. +Seitenzahlen k\"onnen auch \underline{underlined} dargestellt +werden, was den gestalterischen Freiheitsgrad bei der +Indexerstellung vervollst\"andigt. Die Darstellung einer +Seitenzahl in {\bf boldface}, {\it italic} oder \underline{underlined} +erzeugt Idx\TeX , falls der Anwender folgende simple Konvention +bei \verb+\index+\index{_\verb+\index+} verwendet: Dem im Index zu +erscheinenden Text wird eines der Fluchtsymbole \verb+^+, +\index{^Seitenzahl>{\bf boldface}} \verb+~+\index{~Seitenzahl>{\sl italic}} +oder \verb+_+\index{_Seitenzahl>\underline{underlined}} vorangestellt. +Idx\TeX{} erkennt diese Fluchtsymbole und stellt daraufhin die +ben\"otigten \TeX -Makros zusammen. + +Damit sieht es zun\"achst so aus, als ob Idx\TeX{} eigentlich nur +die \verb+\indexentry+\index{\verb+\indexentry+} Angaben innerhalb +einer \verb+.idx+-Datei\index{Dateikennung>\verb+.idx+} alphabetisch +sortiert, Fluchtsymbole auswertet, und jedem Wechsel des +Anfangsbuchstabens eine Index\"uberschrift voranstellt. Zus\"atzlich +kann Idx\TeX{} das Symbol \verb+&+ auswerten, welches Querverweise +\index{Querverweis} erm\"oglicht. Die Angabe von + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+\index{Referenz&Querverweis}+\index{_\verb+\index+} +\index{Querverweis} +\vspace{5mm} + +\noindent +veranla\ss t Idx\TeX{} zur Angabe von \verb+Querverweis+ +\index{Querverweis} unter dem im Index erzeugten Begriff +\verb+Referenz+. Im Index zu diesem Artikel sind zwei m\"ogliche +Darstellungen f\"ur Querverweise angegeben; die jeweils zugeh\"orige +Konvention zur Markierung im Text mit \verb+\index+ befindet sich +im {\sl Idx\TeX{} User'{}s Guide}. + +Bei der Arbeit mit \verb+idxtex+\index{#\verb+idxtex+} ist zu +ber\"ucksichtigen, da\ss{} im \verb+theindex+-Environment +\index{Environment>\verb+theindex+}\index{\verb+theindex+} +\verb+\thepagestyle+\index{\verb+\thepagestyle+} auf \verb+plain+ +\index{\verb+plain+} gesetzt wird. Au\ss erdem erh\"alt der Index +f\"ur das Inhaltsverzeichnis den Status von \verb+section*+; der +Begriff {\sl Index} taucht nicht in der \verb+TOC+-Liste auf. Das +Umschalten in den \verb+\twocolumn+-Modus erzwingt einen Seitenvorschub, +der allenfalls unterdr\"uckt wird, wenn \verb+\input{file.ind}+ +\index{\verb+\input+}\index{Dateikennung>\verb+.ind+} innerhalb einer +\verb+\vbox+ oder dem \verb+minipage+-Environment +\index{\verb+minipage+&Environment}\index{Environment>\verb+minipage+} +eingebettet ist. Wen diese Begleiterscheinungen st\"oren, dem bleibt +nur eine seinen Vorstellungen entsprechende Definition von \verb+theindex+ +\index{\verb+theindex+} anzulegen. + +\section{Master-Index} + +Zu einer Sammlung von Dokumenten enth\"alt ein zusammenfassendes +Inhaltsverzeichnis eine sortierte Liste der in \underline{allen} +Dokumenten verwendeten Stichworte. Im {\sl Masterindex} ist zus\"atzlich zur +Seitennummer der Verweis auf das Dokument aufzunehmen, welches +das Stichwort beschreibt. Idx\TeX{} unterst\"utzt auch +diese Aufgabenstellung. + +Zur Vorbereitung mu\ss{} \verb+latex+ +zun\"achst zu jedem Dokument ein \verb+.idx+-File +\index{Dateikennung>\verb+.idx+} anlegen. Anschlie\ss end erzeugt +der Anwender eine Steuer-Datei mit Endung \verb+.mdx+, +\index{Dateikennung>\verb+.mdx+} beispielsweise \verb+file.mdx+. +Um ein \verb+.idx+-File\index{Dateikennung>\verb+.idx+} in das +{\sl Masterindex} aufzunehmen, mu\ss{} die Steuerdatei einen Eintrag +der Form + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+\usefile{Bezeichner}{idx-file}+ +\vspace{5mm} + +\noindent +enthalten (\verb+idx-file+ ist der Name einer von \LaTeX{} erzeugten +\verb+.idx+-Datei und ist ohne Kennung anzugeben). Die Aufforderung an +\verb+idxtex+,\index{#\verb+idxtex+} das \verb+.mdx+-File +\index{Dateikennung>\verb+.mdx+} auszuwerten, wird mit der Aufrufsymtax + +\vspace{5mm} +\noindent +\hbox{}\hspace{1cm}\verb+$ idxtex file /MASTER+ +\index{#\verb+idxtex+}\index{\verb+/MASTER+&\verb+idxtex+} +\vspace{5mm} + +\noindent +erreicht. F\"ur alle in \verb+idx-file+ auftretenden +\verb+\indexentry+-Angaben\index{\verb+\indexentry+} erzeugt +\verb+idxtex+\index{#\verb+idxtex+} daraufhin ein zusammenfassendes +Index und schreibt diese nach \verb+file.mnd+.\index{Dateikennung>\verb+.mnd+} +Der Verweis auf das jeweilige Dokument, auf welches sich das Stichwort +bezieht, wird dabei mit \verb+\bullet+ und anschlie\ss ender Angabe +von \verb+Bezeichner+ eingeleitet, gefolgt von der zugeh\"origen +Seitennummer. Zur Aufnahme des {\sl Masterindex} in das Dokument +ist das so von \verb+idxtex+ \index{#\verb+idxtex+} produzierte +\verb+.mnd+-File an gew\"unschter Stelle im Dokument mit +\verb+\input+\index{\verb+\input+} einzuladen. + +\section{Wiederholte Gastspiele} + +Die Aufnahme eines Glossars oder Indexverzeichnisses an beliebiger +Stelle im Dokument bewirkt gegebenenfalls eine \"Anderung der von +\verb+idxtex+\index{#\verb+idxtex+} eingetragenen Seitenzahlen und +denen, auf welchen die Referenzen letztendlich stehen. Abhilfe schafft +hier ein mehrfacher Durchlauf von \verb+idxtex+\index{#\verb+idxtex+} +und \verb+latex+. Nachstehend sei hier eine kurze Anleitung zur +Aufbereitung eines Dokuments mit Glossar und Index skizziert: + +\begin{itemize} +\item Eintragen aller \verb+\glossary+\index{\verb+\glossary+} und +\verb+\index+\index{\verb+\index+} Befehle im Dokument an den +gew\"unschten Stellen sowie der Makros \verb+\makeglossary+ +\index{\verb+makeglossary+} und \verb+\makeindex+ +\index{\verb+makeindex+} in der Pr\"aambel (zwischen +\verb+\documentstyle+\index{\verb+\documentstyle+} und +\verb+\begin{document}+).\index{\verb+\begin{document}+} +\item Das Dokument ist anschlie\ss end zweimal mit \LaTeX{} zu +formatieren, damit erstmal die getroffenen Referenzen auf den +zugeordneten Seitenzahlen wiederzufinden sind. +\item Aufruf von \verb+glotex+\index{\verb+glotex+} und \verb+idxtex+, +\index{#\verb+idxtex+} um aus der \verb+.glo+- +\index{Dateikennung>\verb+.glo+} und der \verb+.idx+-Datei +\index{Dateikennung>\verb+.idx+} die zugeh\"orige \verb+.gls+- +\index{Dateikennung>\verb+.gls+} und \verb+.ind+-Datei +\index{Dateikennung>\verb+.ind+} zu erzeugen. +\item Eintragen der \verb+\include+-Anweisungen in das Dokument. +\item Erneuter Durchlauf von \LaTeX , damit die \verb+.idx+-Datei +\index{Dateikennung>\verb+.idx+} die nach Einbinden von Glossar und +Index g\"ultigen Seitenzahlen enth\"alt. +\item Nochmaliger Aufruf von \verb+idxtex+.\index{#\verb+idxtex+} +\item Abschlie\ss ender zweimaliger Durchlauf von \LaTeX{} (damit +gegebenenfalls auch das Inhaltsverzeichnis die richtige Referenz auf +den Index zeigt). +\end{itemize} + +Nachstehende Grafik bietet eine strukturierte \"Ubersicht zur Arbeit +mit Glo\TeX{} und Idx\TeX . + +\vspace{5mm} +\begin{center} +\begin{picture}(160,175) +\put(0,0){\framebox(160,175){}} +\put(10,155){\framebox(40,10){\verb+file.tex+}} +\put(60,150){\framebox(40,20){\LaTeX}} +\put(110,155){\framebox(40,10){\verb+file.gdf+}} +\put(30,125){\framebox(40,10){\verb+file.idx+}} +\put(90,125){\framebox(40,10){\verb+file.glo+}} +\put(30,90){\framebox(40,20){Idx\TeX}} +\put(90,90){\framebox(40,20){Glo\TeX}} +\put(30,65){\framebox(40,10){\verb+file.ind+}} +\put(90,65){\framebox(40,10){\verb+file.gls+}} +\put(60,30){\framebox(40,20){\LaTeX}} +\put(60,5){\framebox(40,10){\verb+file.dvi+}} +\put(50,160){\vector(1,0){10}} +\put(65,150){\vector(0,-1){15}} +\put(95,150){\vector(0,-1){15}} +\put(50,125){\vector(0,-1){15}} +\put(110,125){\vector(0,-1){15}} +\put(50,90){\vector(0,-1){15}} +\put(110,90){\vector(0,-1){15}} +\put(65,65){\vector(0,-1){15}} +\put(95,65){\vector(0,-1){15}} +\put(80,30){\vector(0,-1){15}} +\put(20,155){\line(0,-1){115}} +\put(20,40){\vector(1,0){40}} +\put(140,155){\line(0,-1){55}} +\put(140,100){\vector(-1,0){10}} +\end{picture} +\end{center} + +Im {\sl User'{}s Guide to the Glo\TeX{} Program} und im +{\sl User'{}s Guide to the Idx\TeX{} Program} finden sich zu jeder +seiner F\"ahigkeiten Beispiele, welche die hier nur in einer \"Ubersicht +zusammengestellten M\"oglichkeiten beim Einsatz von Glo\TeX{} +und Idx\TeX{} weitergehend erl\"autern. + +\section{Nachwort} + +Das im letzten Abschnitt aufgef\"uhrte Rezept zeigt, da\ss{} +der Anwender das Zusammenspiel von Glo\TeX{}, Idx\TeX{} und \LaTeX{} +in weiten Bereichen selbst steuern mu\ss . Das scheint auf den +ersten Blick nicht sehr komfortabel; au\ss er vielleicht, wenn der +Anwender die n\"otigen Kommandos \"uber eine Batch-Datei oder +ein Shell-Skript steuert. Die Qualit\"at der Ergebnisse ist es +aber letzlich, welche den Aufwand rechtfertigt. + +Richard L.~Aurbach gestattet die Modifikation und den Vertrieb +seiner Quellen auf nichtkommerzieller Basis. Interessierte +\TeX -Freunde sind also herzlich eingeladen, ihre Vorstellungen und +Ideen in das Konzept von Glo\TeX{} und Idx\TeX{} einflie\ss en +zu lassen. Die Koordination etwaiger T\"atigkeiten ist dabei +sicherlich oberstes Gebot, damit die \TeX -Welt nicht +in Zukunft mit mehreren verschiedenen Glo\TeX- und Idx\TeX +-Dialekten konfrontiert wird. + +Modifikationen der Programme reichen nach den in diesem Artikel +aufgef\"uhrten Problemen allein nicht aus, um mit Glo\TeX{} oder +eher Idx\TeX{} noch bessere Ergebnisse zu erzielen. Die im Glo\TeX - +und Idx\TeX -Programm fest eingebauten Zeichenketten, seien es nun +\TeX -Makros oder auch die bei Querverweisen\index{Querverweis} verwendeten +zus\"atzlichen Angaben von {\sl see}, {\sl see also} oder +{\sl Symbols} (siehe Indexverzeichnis), geh\"oren beispielsweise nicht +in das Programm sondern in eine Datei, die als Konfigurationsdatei von +\verb+idxtex+\index{#\verb+idxtex+} zu benutzen ist. Zus\"atzlich +ist eine Sammlung von \TeX -Makros erforderlich, mit denen die nun +bekannten Probleme umgangen werden k\"onnen. + +\insertglossary + +\insertindex + +\tableofcontents + +\end{document} diff --git a/indexing/glo+idxtex/glo_idx.sty b/indexing/glo+idxtex/glo_idx.sty new file mode 100644 index 0000000000..363411be07 --- /dev/null +++ b/indexing/glo+idxtex/glo_idx.sty @@ -0,0 +1,37 @@ +% Additional stylefile for GloTeX and IdXTeX so that these programs +% can be used internationally. +% internationally +% Created by Stefano Ianigro, 30.03.1992, University of Federal Armed +% Forces Hamburg +% +% It can be easily modified using the language switch counter +% +\typeout{Additional Style for Glo+IdxTeX, 1.0, Released 30.03.1992} +% +\ifnum \language=0 % USenglish + \def\glossaryname{Glossary} + \def\indexname{Index} + \def\masterindexname{Master Index} + \def\seename{see} + \def\alsoname{see also} + \def\symbolsname{Symbols } +\else \ifnum \language=1 % german + \def\glossaryname{Glossar} + \def\indexname{Stichwortverzeichnis} + \def\masterindexname{Gesamtregister} + \def\seename{siehe} + \def\alsoname{siehe auch} + \def\symbolsname{Symbole } + \else \ifnum \language=2 % french + \def\glossaryname{Glossar} + \def\indexname{Index} + \def\masterindexname{Index G\'en\'erale} + \def\seename{voir} + \def\alsoname{voir aussi} + \def\symbolsname{Symboles } + \fi + \fi +\fi +% +% End of glo_idx.sty +% diff --git a/indexing/glo+idxtex/globldfil.c b/indexing/glo+idxtex/globldfil.c new file mode 100644 index 0000000000..738d17da5f --- /dev/null +++ b/indexing/glo+idxtex/globldfil.c @@ -0,0 +1,182 @@ +/* #module GloBldFil "2-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: GloBldFil *5 + * Author: R L Aurbach CR&DS MIS Group 22-Aug-1986 + * + * Function: + * Build the output file. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 22-Aug-1986 Original Code + * 2-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module GloBldFil - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +# include +# include +# define F_OK 0 /* access(): File exists */ +#else +# include +extern char *sprintf(); +#endif +#include +#include +#include "GloDef.h" +/* + * Module Definitions: + */ +/* + * Global Declarations: + */ +#ifdef MSDOS +int Glo_Build_File(void); +#else +int Glo_Build_File(); +#endif +/* + * Static Declarations: + */ +/* + * External References: + */ + extern char infile[256]; + extern NODE_PTR root; + extern int flag; +/* + * Functions Called: + */ +/* + * Function Glo_Build_File - Documentation Section + * + * Discussion: + * Create the output file which will be included into the final document + * to create the glossary. + * + * Calling Synopsis: + * status = Glo_Build_File () + * + * Inputs: + * none + * + * Outputs: + * none + * + * Return Value: + * status -> is a boolean integer which indicates success or + * failure. + * + * Global Data: + * root -> the data structure is scanned. + * + * flag -> the flag is used to control the format of the output. + * + * infile -> the input filespec is used to generate the output + * filespec. + * + * Files Used: + * An output file is generated. The output file specification is + * constructed using "SYS$DISK:[].GLS" as the file spec and infile + * as the default filespec. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE success. + * + * Error Conditions: + * status == FALSE failure. + * + * Algorithm: + * A. Construct the filename of the output file and open it. + * B. Build a style-dependent preamble to the file. + * C. For each node in the root, + * 1. Generate a data line for the item. + * 2. For each definition line, + * a. Generate a data line for the definition. + * D. Close the file. + * + * Special Notes: + * none + */ +/* + * Function Glo_Build_File - Code Section + */ +int Glo_Build_File () +{ +/* + * Local Declarations + */ + NODE_PTR node; + STRING_PTR string; + char dna[256]; + FILE *f; +/* + * Module Body + */ + if (root == 0) return (FALSE); +/* Open the output file. */ + (void)sprintf(dna, "%s.gls", infile); + if ((f = fopen(dna,"w")) == NULL) return (FALSE); +/* Write the style dependent header information. */ + if (flag != NONE) { + (void)fprintf(f,"\\newdimen\\infomapmargin \\newdimen\\infomapwidth\n"); + (void)fprintf(f,"\\infomapmargin 115pt \\infomapwidth 103pt\n"); + (void)fprintf(f,"\\def\\infomaplabel#1{\\raisebox{0pt}[1em][0pt]"); + (void)fprintf(f,"{\\makebox[\\labelwidth][l]\n"); + (void)fprintf(f," {\\parbox[t]{\\infomapwidth}{\\bf #1}}}}\n\n"); + } + if (flag == ARTICLE) + (void)fprintf(f,"\\def\\theglossary{\\section{\\glossaryname}\n"); + if (flag == REPORT) { + (void)fprintf(f,"\\def\\theglossary{\\chapter*{\\glossaryname\\markboth{\\glossaryname}\n"); + (void)fprintf(f," {Glossary}} \\addcontentsline{toc}{chapter}{\\glossaryname}\n"); + } + if (flag != NONE) { + (void)fprintf(f," \\typeout{Glossary.} \\list{}{\\leftmargin\\infomapmargin\n"); + (void)fprintf(f," \\labelwidth\\leftmargin\\advance\\labelwidth-\\labelsep\n"); + (void)fprintf(f," \\let\\makelabel\\infomaplabel}}\n"); + (void)fprintf(f,"\\let\\endtheglossary\\endlist\n\n"); + } +/* Begin the actual glossary code. */ + (void)fprintf(f,"\\begin{theglossary}\n\n"); +/* Process each node in the data structure */ + node = root; + while (node != 0) { + (void)fprintf(f,"\\item[%s] ", node->item); + string = node->hdr; + while (string != 0) { + if ((strlen(string->desc)) > 0) + (void)fprintf(f, "%s", string->desc); + else (void)fprintf(f,"\n"); + string = string->next; + } + (void)fprintf(f,"\n"); + node = node->next; + } +/* Done. */ + (void)fprintf(f,"\\end{theglossary}\n\n"); + (void)fclose(f); + return(TRUE); +} diff --git a/indexing/glo+idxtex/globldlab.c b/indexing/glo+idxtex/globldlab.c new file mode 100644 index 0000000000..65a3255355 --- /dev/null +++ b/indexing/glo+idxtex/globldlab.c @@ -0,0 +1,381 @@ +/* #module GloBldLab "2-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: GloBldLab + * + * Author: R L Aurbach CR&DS MIS Group 18-Aug-1986 + * + * Function: + * Build the list of labels seen in the input file. Also, if a file + * entry is seen, add it to the filelist. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 18-Aug-1986 Original Code + * 1-002 RLA 26-Aug-1986 Fix problem with duplicate label + * detection. + * 2-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module GloBldLab - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include +#include "GloDef.h" +/* + * Module Definitions: + */ +/* + * Global Declarations: + */ +#ifdef MSDOS +int Glo_Build_LabLst(void); +#else +int Glo_Build_LabLst(); +#endif +/* + * Static Declarations: + */ +/* + * External References: + */ +extern char infile[256]; +extern STRING_PTR labels; +extern STRING_PTR filelist; +/* + * Functions Called: + */ +#ifdef MSDOS +static void glo_get_token(char *buffer, char *token); +static int glo_get_next_file(char *token, int *ptr, char *spec); +#else +static void glo_get_token(); +static int glo_get_next_file(); +#endif +/* + * Function Glo_Build_LabLst - Documentation Section + * + * Discussion: + * Read the input file and use its contents to build a list of labels for + * which glossary entries are needed. If a file specification is seen + * during this operation, add the file to the filelist. + * + * Calling Synopsis: + * status = Glo_Build_LabLst () + * + * Inputs: + * none + * + * Outputs: + * none + * + * Return Value: + * status -> is a status code for the operation. It is a boolean + * integer, passed by value. If TRUE, the routine + * completed normally. If FALSE, an error occurred. + * + * Global Data: + * labels -> the list of labels is created by this routine. + * + * filelist -> if one or more files are seen by the routine, they are + * added to the file list. + * + * Files Used: + * The input file is read. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status = TRUE normal successful completion. + * + * Error Conditions: + * status = FALSE an error occurred. The reason for the error is written + * to SYS$OUTPUT. + * + * Algorithm: + * A. Open the input file. + * B. For each record in the file, + * 1. If it is an \indexentry, + * or If it is a \glossaryentry, (TeX 3.0) + * a. Parse out the label. + * b. If the label does not already appear in the label list, + * 1. Build a STRING to contain the label. + * 2. Chain it into the label list. + * 2. If it is a \glofile, + * a. For each file in the list, + * 1. Parse out the file specification. + * 2. Build a STRING to contain the file specification. + * 3. Chain it into the file list. + * 3. Else, + * a. Ignore the record. + * C. Close the input file. + * + * Special Notes: + * none + */ +/* + * Function Glo_Build_LabLst - Code Section + */ +int Glo_Build_LabLst () +{ +/* + * Local Declarations + */ + int status; + FILE *file; + char linebf[linesz]; + char label[linesz]; + int found; + STRING_PTR new; + STRING_PTR old; + char spec[linesz]; + int ptr; + char fname[256]; +/* + * Module Body + */ +/* Open the input file */ + (void)sprintf(fname,"%s.glo",infile); + if ((file = fopen(fname, "r")) == NULL) { + (void)printf("Could not open the input file\n"); + return (FALSE); + } +/* For each record in the file, */ + status = TRUE; + while (fgets(linebf, linesz, file) != 0) { +/* + * If the record begins with \indexentry (or \glossaryentry), then it is + * a record containing a label. Process the label by parsing it out, + * checking for duplicates, and if unique, building a label list entry for it. + */ + if ((strncmp(linebf, "\\indexentry{", 12)) == 0) { + glo_get_token(&linebf[12], label); + if (strlen(label) == 0) continue; + old = labels; + found = FALSE; + while (old != 0) { + if (strcmp(label,old->desc) == 0) found = TRUE; + if (old->next == 0) break; + old = old->next; + } + if (!found) { + new = (STRING_PTR) malloc(sizeof(STRING)); + if (new == 0) continue; + new->next = 0; + new->desc=strdup(label); + if (old == 0) labels = new; + else old->next = new; + } + } + else if ((strncmp(linebf, "\\glossaryentry{", 15)) == 0) { + glo_get_token(&linebf[15], label); + if (strlen(label) == 0) continue; + old = labels; + found = FALSE; + while (old != 0) { + if (strcmp(label,old->desc) == 0) found = TRUE; + if (old->next == 0) break; + old = old->next; + } + if (!found) { + new = (STRING_PTR) malloc(sizeof(STRING)); + if (new == 0) continue; + new->next = 0; + new->desc=strdup(label); + if (old == 0) labels = new; + else old->next = new; + } + } +/* + * If the record begins with \glofile, then it is a record containing one or + * more glossary definition file specifications. For each specification, parse + * it out and build a file list entry for it. + */ + else if ((strncmp(linebf, "\\glofile{", 9)) == 0) { + glo_get_token(&linebf[9], label); + if (strlen(label) == 0) continue; + ptr = 0; + while (glo_get_next_file(label, &ptr, spec) != 0) { + new = (STRING_PTR) malloc(sizeof(STRING)); + if (new == 0) continue; + new->next = 0; + new->desc=strdup(spec); + old = filelist; + if (old == 0) filelist = new; + else { + while (old->next != 0) old = old->next; +/*@@@ old->next = file;*/ + } + } + } +/* + * If the record begins with anything else, ignore it. + */ + else continue; + } + (void)fclose(file); + return (status); +} + +/* + * Function Glo_Get_Token - Documentation Section + * + * Discussion: + * Parse a token from the command line. The token begins at the first + * character position in the buffer and ends with a "}". + * + * Calling Synopsis: + * Call Glo_Get_Token (buffer, token) + * + * Inputs: + * buffer -> is an ASCIZ string containing the token to be found. + * + * Outputs: + * token -> is an ASCIZ string into which the token is copied. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * The token is returned. + * + * Error Conditions: + * none + * + * Algorithm: + * A. Locate the trailing "}" or end of string. + * B. Copy the substring starting at the beginning of the buffer to the + * end found to the token. + * C. Null terminate the string. + * + * Special Notes: + * none + */ +/* + * Function Glo_Get_Token - Code Section + */ +static void glo_get_token (buffer, token) +char *buffer; +char *token; +{ +/* + * Local Declarations + */ + int len; /* Length of the substring */ +/* + * Module Body + */ + len = strcspn(buffer, "}"); + (void)strncpy(token, buffer, len); + token[len] = '\0'; +} + +/* + * Function Glo_Get_Next_File - Documentation Section + * + * Discussion: + * Parse the next file specification out of the token list. Files are + * separated by commas. Return the length of the specification. + * + * Calling Synopsis: + * length = Glo_Get_Next_File (token, ptr, spec) + * + * Inputs: + * token -> is an ASCIZ string containing the list of files. + * + * ptr -> is an integer (passed by reference) which is the + * starting index in the token string for the search. + * + * Outputs: + * spec -> is an ASCIZ string containing the next file spec. + * + * Return Value: + * length -> is the length of the spec string. A value of 0 + * indicates that there is no file spec. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * length != 0 spec contains a file spec. ptr is updated to point + * to the starting place for the next search. + * length == 0 no spec was found. + * + * Error Conditions: + * none + * + * Algorithm: + * A. Find the next "," in the string. + * B. Copy the substring into the output variable. + * C. Adjust the pointer. + * D. Return the length of the string. + * + * Special Notes: + * none + */ +/* + * Function Glo_Get_Next_File - Code Section + */ +static int glo_get_next_file (token, ptr, spec) +char *token; +int *ptr; +char *spec; +{ +/* + * Local Declarations + */ + int length; +/* + * Module Body + */ + length = strcspn (&token[*ptr], ","); + if (length != 0) { + (void)strncpy (spec, &token[*ptr], length); + spec[length] = 0; + (*ptr) += length; + if (token[*ptr] == ',') (*ptr)++; + } + return (length); +} diff --git a/indexing/glo+idxtex/glocmd.c b/indexing/glo+idxtex/glocmd.c new file mode 100644 index 0000000000..9f87b8c40e --- /dev/null +++ b/indexing/glo+idxtex/glocmd.c @@ -0,0 +1,193 @@ +/* #module GloCmd "2-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: GloCmd + * + * Author: R L Aurbach CR&DS MIS Group 18-Aug-1986 + * + * Function: + * This routine parses the GloTeX Command Line, and returns the name of + * the input file, a flag which specifies the style of treatment for the + * output file, and optionally, a list of files for the glossary definition + * file. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 18-Aug-1986 Original Code + * 2-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module GloCmd - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +# include +extern char *sprintf(); +#endif +#include +#include +#include +#include "GloDef.h" +/* + * Module Definitions: + */ +/* + * Global Declarations: + */ +#ifdef MSDOS +void Glo_Command(int argc, char *argv[]); +#else +void Glo_Command(); +#endif +/* + * Static Declarations: + */ +/* + * External References: + */ +extern STRING_PTR filelist; +extern int flag; +extern char infile[256]; +/* + * Functions Called: + */ +/* + * Function Glo_Command - Documentation Section + * + * Discussion: + * This routine uses lib$get_foreign to read the command line. It + * prefixes the command line with "GloTeX ", so that the CLI routines + * will have the appropriate information on which to operate. It then + * parses the command line and returns the appropriate information to the + * program. + * + * Since the routine establishes LIB$SIG_TO_STOP as a condition handler, + * syntax errors detected during processing result in program exit. + * + * Calling Synopsis: + * Call Glo_Command () + * + * Inputs: + * none + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * infile -> contains the name of the input file as an ASCIZ string. + * + * flag -> indicates the value of the /STYLE qualifier. + * + * filelist -> is updated to contain a list of file specifications. + * + * Files Used: + * none + * + * Assumed Entry State: + * GloTeX is invoked as a foreign DCL command. + * + * Normal Exit State: + * The routine returns to the caller. The global variables are set up + * appropriately. + * + * Error Conditions: + * For the majority of the processing of the routine, LIB$SIG_TO_STOP + * is established as the condition handler. Therefore, any errors cause + * an immediate exit. + * + * Algorithm: + * A. Call Lib$Get_Foreign to retrieve the command line. + * B. Prefix the command line with the command verb. + * C. Call Cli$DCL_Parse to parse the command line. + * D. Process the file name. + * 1. Get the file name. + * 2. Convert it to an ASCIZ string. + * E. Process the /STYLE qualifier. + * F. Process the /GLOSSARY qualifier. + * + * Special Notes: + * This routine is based on the LIB_PARSE_FOREIGN routine, suitably + * modified. + */ +/* + * Function Glo_Command - Code Section + */ +void Glo_Command (argc, argv) +int argc; +char *argv[]; +{ +/* + * Local Declarations + */ + int status; + STRING_PTR file; + STRING_PTR old; + int i,j,clen; + char dummy[linesz]; +/* + * Module Body + */ +/* Get the command line */ +/* Parse the command line */ +/* Get the filename string */ + (void) sprintf(infile,"%s",argv[1]); + i=2; +/* Process the /STYLE qualifier */ + if (argc > i) { + if (strncmp("/STYLE",argv[i],6) == 0) { + if (argv[i][7] == 'A') flag = ARTICLE; + if (argv[i][7] == 'R') flag = REPORT; + i++; + } + } +/* Process the /GLOSSARY qualifier */ + if (argc > i) { + if ((strncmp("/GLOSSARY",argv[i],9)) == 0) { + clen = strlen(argv[i]); + j=10; + while (TRUE) { + file = (STRING_PTR)malloc(sizeof(STRING)); + if (file == 0) break; + file->next = 0; + (void)sscanf(&argv[i][j],"%[^, ]",dummy); + file->desc = strdup(dummy); + status = 0; + if (file->desc[0]!='\0') { + status = 1; + j+=(strlen(file->desc)+1); + if (j > (clen+1)) status = 0; + } + if (!(status & TRUE)) return; + old = filelist; + if (filelist == 0) filelist = file; + else { + while (old->next != 0) old = old->next; + old->next = file; + } + } + } + } +} diff --git a/indexing/glo+idxtex/glomiss.c b/indexing/glo+idxtex/glomiss.c new file mode 100644 index 0000000000..a8376d1945 --- /dev/null +++ b/indexing/glo+idxtex/glomiss.c @@ -0,0 +1,145 @@ +/* #module GloMiss "2-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: GloMiss + * + * Author: R L Aurbach CR&DS MIS Group 22-Aug-1986 + * + * Function: + * Report those labels for which no glossary entry was found. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 22-Aug-1986 Original Code + * 2-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module GloMiss - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include "GloDef.h" +/* + * Module Definitions: + */ +/* + * Global Declarations: + */ +#ifdef MSDOS +int Glo_Report_Missing(void); +#else +int Glo_Report_Missing(); +#endif +/* + * Static Declarations: + */ +/* + * External References: + */ +extern STRING_PTR labels; +extern char infile[256]; +/* + * Functions Called: + */ +/* + * Function Glo_Report_Missing - Documentation Section + * + * Discussion: + * Report the labels for which no definition has been found in any + * glossary definition file. The report is made both to SYS$OUTPUT and + * to a glossary log file (.glg file). + * + * Calling Synopsis: + * status = Glo_Report_Missing () + * + * Inputs: + * none + * + * Outputs: + * none + * + * Return Value: + * status -> is a boolean integer. It indicates success or + * failure of the operation. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE success. + * + * Error Conditions: + * status == FALSE failure + * + * Algorithm: + * A. Open the output file. + * B. For each leaf in the labels list, + * 1. Report the value of the label. + * + * Special Notes: + * none + */ +/* + * Function Glo_Report_Missing - Code Section + */ +int Glo_Report_Missing () +{ +/* + * Local Declarations + */ + STRING_PTR token; + char dna[256]; + FILE *f; +/* + * Module Body + */ + if (labels == 0) return(TRUE); +/* Open the output file */ + (void)sprintf(dna, "%s.glg", infile); + f = fopen(dna, "w"); + (void)fprintf(f,"GloTeX Log File\n\n"); + (void)fprintf(f,"Processing input file \'%s.glo\'\n\n", infile); + token = labels; + while (token != 0) { + if ((strlen(token->desc)) > 0) { + (void)printf("The label \'%s\' ", token->desc); + (void)printf("was not found in any glossary definition file\n"); + (void)fprintf(f,"The label \'%s\' ", token->desc); + (void)fprintf(f,"was not found in any glossary definition file\n"); + } + token = token->next; + } + (void)fclose(f); + return (TRUE); +} diff --git a/indexing/glo+idxtex/gloscan.c b/indexing/glo+idxtex/gloscan.c new file mode 100644 index 0000000000..3ecde63e60 --- /dev/null +++ b/indexing/glo+idxtex/gloscan.c @@ -0,0 +1,618 @@ +/* #module GloScan "2-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: GloScan + * + * Author: R L Aurbach CR&DS MIS Group 20-Aug-1986 + * + * Function: + * Scan a file for glossary definitions and build the internal data + * structure for the data. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 20-Aug-1986 Original Code + * 1-002 RLA 25-Aug-1986 Make Glo_Parse_Item more sophisticated. + * 2-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module GloScan - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include +#include +#include "GloDef.h" +/* + * Module Definitions: + */ +/* + * Global Declarations: + */ +#ifdef MSDOS +int Glo_Scan_File(STRING_PTR file); +#else +int Glo_Scan_File(); +#endif +/* + * Static Declarations: + */ +#ifdef MSDOS +static int glo_copy_text(char *line, NODE_PTR node); +static int glo_match_label(char *token); +static int glo_link_node(NODE_PTR node); +static int glo_parse_item(char *line, char *label, char *item, int *ptr); +#else +static int glo_copy_text(); +static int glo_match_label(); +static int glo_link_node(); +static int glo_parse_item(); +#endif +/* + * External References: + */ +#ifdef MSDOS +extern void idx_build_spell_string(char *desc); +#else +extern void idx_build_spell_string(); +#endif +extern NODE_PTR root; +extern STRING_PTR labels; +/* + * Functions Called: + */ +/* + * Function Glo_Scan_File - Documentation Section + * + * Discussion: + * Scan the specified glossary file for definitions which have labels which + * match the labels in the label list. If a match is found, copy the + * information to a NODE in the data structure and delete the label from + * the label list. Entries are placed in the data structure in alphabetic + * order. + * + * Calling Synopsis: + * status = Glo_Scan_File (file) + * + * Inputs: + * file -> is a STRING_PTR, passed by value. It contains the + * descriptor for the file specification string to be + * used to open the file. + * + * Outputs: + * none + * + * Return Value: + * status -> is a boolean flag which indicates the result of the + * operation. It will have a value of TRUE unless an + * error occurs which is fatal to the execution of the + * program. + * + * Global Data: + * root -> additions may be made to the internal data structure. + * + * labels -> if a definition is found, its entry in the label list is + * removed. + * + * Files Used: + * The specified definition file is opened for read access. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE The operation succeeded. This means that no error which + * is fatal to the operation of the program occurred, not + * that the program proceeded without error. + * + * Error Conditions: + * status == FALSE A fatal error occurred. The reason for the error should + * be described in a message to the user + * + * Algorithm: + * A. If the labels list is empty, return immediately. + * B. Convert the file spec to an ASCIZ string and open the file. + * C. For each entry in the file, + * 1. Locate the label. + * 2. If the label list contains that label, + * a. Delete the label from the label list. + * b. Allocate a NODE. + * c. Fill in the NODE with the item and spell string. + * d. Fill in the NODE with definition lines. + * e. Chain the NODE into the data structure, using the spell + * string to position it correctly. + * D. Close the file. + * + * Special Notes: + * none + */ +/* + * Function Glo_Scan_File - Code Section + */ +int Glo_Scan_File (file) +STRING_PTR file; +{ +/* + * Local Declarations + */ + char dna[256]; + FILE *f; + int counter = 0; + char line[linesz]; + char token[linesz]; + char item[linesz]; + int ptr; + int status; + NODE_PTR node; + int mode = FALSE; +/* + * Module Body + */ + if (labels == 0) return (TRUE); +/* Open the glossary definition file */ + (void)sprintf(dna, "%s.gdf", file->desc); + if ((f = fopen(dna, "r")) == NULL) { + (void)printf ("Could not find the glossary definition file %s\n", + file->desc); + return (TRUE); + } + while (fgets(line, linesz, f) != 0) { +/* + * If mode = FALSE, we are in discard mode. In this mode, we throw away any + * line which does not begin with "@entry". If mode = TRUE, we are in copy + * mode. In this mode, we copy any text to the current node. In either case, + * if the line begins with "@entry", we must process it. + */ + status = strncmp(line, "@entry{", 7); + if (status != 0) { + if (mode) (void)glo_copy_text(line, node); + continue; + } +/* + * We've found a new entry in the file. Begin processing it. + * Search for the first line of a definition entry and parse out the label. + */ + status = glo_parse_item(line, token, item, &ptr); + if (!status) { + mode = FALSE; + continue; + } +/* Search the label list for a label with the same name as the token. */ + status = glo_match_label (token); + if (!status) { + mode = FALSE; + continue; + } + counter++; +/* Allocate and build the NODE structure */ + node = (NODE_PTR) malloc(sizeof(NODE)); + if (node == 0) { + (void)printf("Could not allocate space for a new definition\n"); + return(FALSE); + } + node->next = 0; + node->hdr = 0; + node->spell = strdup(item); + idx_build_spell_string(node->spell); + node->item=strdup(item); +/* Link the NODE into the data structure in alphabetical order */ + status = glo_link_node(node); + if (!(status & TRUE)) { + (void)printf("Duplicate glossary entry \'%s\' ignored\n", item); + mode = FALSE; + continue; + } +/* If there is text on the @entry line, use it. */ + if (line[ptr] != '\0') (void)glo_copy_text (&line[ptr], node); + mode = TRUE; + } +/* End of file seen. */ + (void)fclose(f); + if (counter == 0) { + (void)printf("No definitions found in file %s.gdf\n", file->desc); + } + else + (void)printf("%d definitions extracted from file %s.gdf\n", + counter, file->desc); + return (TRUE); +} + +/* + * Function Glo_Link_Node - Documentation Section + * + * Discussion: + * Link a node into the node list in alphabetical order. + * + * Calling Synopsis: + * status = Glo_Link_Node (node) + * + * Inputs: + * node -> is a NODE_PTR, passed by reference. + * + * Outputs: + * none + * + * Return Value: + * status -> is a boolean integer. TRUE means a successful link. + * FALSE means a duplicate entry was found. + * + * Global Data: + * root -> the node is linked into the root list. + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE node was linked in. + * + * Error Conditions: + * status == FALSE a node with this spell string was already linked into + * the list. This node is NOT linked in. + * + * Algorithm: + * A. If the list is empty, link the node in at the root. + * B. Else, + * 1. Beginning at the first node in the list, + * a. If spell-string < node-spell-string, + * 1. Get next node. + * b. If spell-string = node-spell-string, + * 1. Return FALSE. + * c. If spell-string > node-spell-string, + * 1. Link it in. + * + * Special Notes: + * none + */ +/* + * Function Glo_Link_Node - Code Section + */ +static int glo_link_node (node) +NODE_PTR node; +{ +/* + * Local Declarations + */ + NODE_PTR old_node; + NODE_PTR new_node; + int status; +/* + * Module Body + */ + old_node = 0; + new_node = root; + while (new_node != 0) { + status = strcmp(new_node->spell, node->spell); + if (status < 0) { + old_node = new_node; + new_node = new_node->next; + continue; + } + if (status == 0) return (FALSE); + if (status > 0) { + if (old_node == 0) root = node; + else old_node->next = node; + node->next = new_node; + return(TRUE); + } + } +/* If the list is exhausted, link the node in at the end. */ + if (old_node == 0) root = node; + else old_node->next = node; + return(TRUE); +} + +/* + * Function Glo_Match_Label - Documentation Section + * + * Discussion: + * See if a label in the label list matches the current file entry. + * If it does, then deallocate the label entry and return TRUE. + * Otherwise, return FALSE. + * + * Calling Synopsis: + * status = Glo_Match_Label (token) + * + * Inputs: + * token -> is the file token string to be matched against the label + * list. It is an ASCIZ string. + * + * Outputs: + * none + * + * Return Value: + * status -> is a boolean integer. TRUE indicates that this entry + * corresponds to a valid label in the label list. The + * label list entry is removed. FALSE indicates that + * this entry does not match a label in the label list. + * + * Global Data: + * labels -> if the entry matches a label, that STRING in the label + * list is removed. + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE We have a match. + * status == FALSE No match. + * + * Error Conditions: + * none + * + * Algorithm: + * A. For each entry in the label list, + * 1. Compare the label with the token. + * 2. If they match, + * a. Unchain and deallocate the STRING. + * b. Return TRUE. + * 3. Else, + * a. Get the next label. + * B. If no match, + * 1. Return FALSE. + * + * Special Notes: + * none + */ +/* + * Function Glo_Match_Label - Code Section + */ +static int glo_match_label (token) +char *token; +{ +/* + * Local Declarations + */ + int length = strlen(token); + STRING_PTR old; + STRING_PTR new; +/* + * Module Body + */ + if (labels == 0) return (FALSE); + old = labels; + new = labels; + while (new != 0) { +/* Search the label list for a matching token */ + if ((strlen(new->desc)) != length) + if (TRUE) { + old = new; + new = new->next; + continue; + } + if (strncmp(token, new->desc, length) != 0) + if (TRUE) { + old = new; + new = new->next; + continue; + } +/* Found the matching token. Delete the entry in the labels list. */ + if (new == labels) labels = new->next; + else old->next = new->next; + (void)free((char *)new->desc); + (void)free((char *)new); + return (TRUE); + } + return (FALSE); +} + +/* + * Function Glo_Parse_Item - Documentation Section + * + * Discussion: + * Parse the label and item strings from a line with the format + * @entry{label,item}[text] + * leaving the pointer pointing to the optional text string. + * + * Calling Synopsis: + * status = Glo_Parse_Item (line, label, item, ptr) + * + * Inputs: + * line -> is the text line to parse. It is an ASCIZ text string. + * + * + * Outputs: + * label -> is the label text string. It is an ASCIZ text string. + * + * item -> is the item text string. It is an ASCIZ text string. + * + * ptr -> is an integer index value, passed by reference. It is + * the array index of the next character of the line + * string, after the closing "}". + * + * Return Value: + * status -> is a result indicator. If TRUE, the label and item + * elements were found. If FALSE, there was a problem + * with the parse operation. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE Operation succeeded. All output variables were + * returned. + * + * Error Conditions: + * status == FALSE Operation failed due to a missing syntax element. + * None of the output variables is trustworthy. + * + * Algorithm: + * A. Parse out the label. It begins with the first character after the + * leading "{" and is terminated by a ",". + * B. Find the beginning of the item. It is starts at the first + * non-whitespace character after the ",". + * C. Parse out the item. Internally, braces are allowed as long as they + * properly match. + * + * Special Notes: + * none + */ +/* + * Function Glo_Parse_Item - Code Section + */ +static int glo_parse_item (line, label, item, ptr) +char *line; +char *label; +char *item; +int *ptr; +{ +/* + * Local Declarations + */ + int i; + int brace; + char x; +/* + * Module Body + */ +/* Copy the label to the output string. */ + i = 0; + brace = 1; + *ptr = 7; + while(TRUE) { + x = line[(*ptr)++]; + if (x == '\0') return(FALSE); + if (x == '{') if (line[*ptr - 2] != '\\') brace++; + if (x == '}') { + if (line[*ptr - 2] != '\\') brace--; + if (brace <= 0) break; + } + if (x == ',') break; + label[i++] = x; + } + label[i] = '\0'; +/* Find the beginning of the item string. */ + while (isspace(line[*ptr]) != 0) (*ptr)++; +/* Copy the item to the output string. */ + i = 0; + while (brace > 0) { + x = line[(*ptr)++]; + if (x == '\0') return(FALSE); + if (x == '{') if (line[*ptr - 2] != '\\') brace++; + if (x == '}') { + if (line[*ptr - 2] != '\\') brace--; + if (brace <= 0) break; + } + item[i++] = x; + } + item[i] = '\0'; +/* Check to see if the item is missing. If it is, default to the label. */ + if (i == 0) (void)strcpy(item, label); + return (TRUE); +} + +/* + * Function Glo_Copy_Text - Documentation Section + * + * Discussion: + * Create a STRING containing the current line of text and chain it in + * to the current node's definition list. + * + * Calling Synopsis: + * status = Glo_Copy_Text (line, node) + * + * Inputs: + * line -> is the current line of text. It is an ASCIZ string. + * + * node -> is the NODE_PTR for the current glossary entry. + * + * Outputs: + * none + * + * Return Value: + * status -> is a boolean integer which reflects success or + * failure. TRUE will be returned unless there is a + * failure to allocate the string. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status == TRUE success. + * + * Error Conditions: + * status == FALSE virtual memory allocation failure. + * + * Algorithm: + * A. Allocate a STRING data structure. + * B. If the input string has a non-zero length, + * 1. Copy the string to the STRING data structure. + * C. Chain the structure in to the end of the hdr structure. + * + * Special Notes: + * none + */ +/* + * Function Glo_Copy_Text - Code Section + */ +static int glo_copy_text (line, node) +char *line; +NODE_PTR node; +{ +/* + * Local Declarations + */ + int length; + STRING_PTR old; + STRING_PTR text; +/* + * Module Body + */ + length = strlen(line); + if (line[length-1] == '\n') length--; + if (length > 0) { + text = (STRING_PTR) malloc(sizeof(STRING)); + if (text == 0) return (FALSE); + text->next = 0; + text->desc = strdup(line); + if (node->hdr == 0) node->hdr = text; + else { + old = node->hdr; + while (old->next != 0) old = old->next; + old->next = text; + } + } + return (TRUE); +} diff --git a/indexing/glo+idxtex/glotex.c b/indexing/glo+idxtex/glotex.c new file mode 100644 index 0000000000..1c5d1a55d4 --- /dev/null +++ b/indexing/glo+idxtex/glotex.c @@ -0,0 +1,275 @@ +/* #module GloTeX "2-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: GloTeX + * + * Author: R L Aurbach CR&DS MIS Group 17-Aug-1986 + * + * Function: + * Main Line for the GloTeX program. This program processes .glo files + * produced by LaTeX and generates files which will produce a properly + * formatted glossary, using definitions extracted from one or more + * glossary definition files. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 17-Aug-1986 Original Code + * 1-001 RLA 25-Aug-1986 Improve handling of error when there + * is no gdf file to process. + * 2-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module GloTeX - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +#endif +#include +#include "GloDef.h" +/* + * Module Definitions: + */ +/* + * Global Declarations: + */ +#ifdef MSDOS +main(int argc, char *argv[]); +#else +main(); +#endif + STRING_PTR filelist = 0; /* Listhead for glossary filespecs */ + NODE_PTR root = 0; /* Listhead for definitions */ + int flag = 0; /* /TOC options flag */ + char infile[256]; /* Input filespec string */ + STRING_PTR labels = 0; /* Listhead for labels */ +/* + * Static Declarations: + */ +/* + * External References: + */ +#ifdef MSDOS +extern void Glo_Command(int argc, char *argv[]); +extern int Glo_Build_LabLst(void); +extern int Glo_Scan_File(STRING_PTR file); +extern int Glo_Report_Missing(void); +extern int Glo_Build_File(void); +#else +extern void Glo_Command(); +extern int Glo_Build_LabLst(); +extern int Glo_Scan_File(); +extern int Glo_Report_Missing(); +extern int Glo_Build_File(); +#endif +/* + * Functions Called: + */ +/* + * Function GloTeX - Documentation Section + * + * Discussion: + * This is the main line of the GloTeX program. + * + * It reads the input file and creates from it a list of items to be + * defined. + * + * It then reads one or more glossary definition files, searching for + * definitions which match the items specified. If it finds an item, it + * copies the definition into an internal data structure and removes the + * item from the list. In this way, the first definition seen for an + * item is always used. + * + * Once the list of definition files is exhausted, the internal data + * structures hold a complete list of all definitions. Any items remaining + * in the item list represent items for which no definitions were found. + * These are reported. + * + * Finally, the internal data structures are used to build a text file + * which will be processed by LaTeX to generate the glossary. + * + * Calling Synopsis: + * $ GloTeX :== $Crl_Public:GloTeX + * $ GloTeX filespec [/STYLE:{ARTICLE | REPORT | SPECIAL}] + * [/GLOSSARY=(file1,file2,...)] + * + * Inputs: + * filespec -> Name of the input file to be processed. The default + * filespec SYS$DISK:[].GLO is processed against this + * specification. This is the file generated by LaTeX + * by the \makeglossary command. + * + * /STYLE -> The /STYLE qualifier indicates the type of document for + * which the glossary is to be generated. Options are: + * * ARTICLE - a standard LaTeX "article" documentstyle + * * REPORT - a standard LaTeX "report" or "book" + * documentstyle + * * SPECIAL - any of the CR&DS special documentstyles + * If the qualifier is not specified, SPECIAL is assumed. + * + * /GLOSSARY -> The /GLOSSARY qualifier defines one or more glossary + * definition files. Each value in the list is the file + * specification of a glossary definition file. These + * files are the basis for the list of glossary files + * managed by the program. + * + * If using a document style which does not define the + * \glossaryfile command (i.e., a standard LaTeX document + * style), then this qualifier is the only means + * available to specify the files to be searched for + * definitions. + * + * If using a CR&DS document style, then this qualifier + * is used to specify definition files to be searched + * before any specified by the \glossaryfile command. + * + * The qualifier is optional. However, at least one + * definition file must be specified to the program. + * + * Outputs: + * filespec -> The program produces an output file which is the + * resultant filespec from processing .GLS as the primary + * file specification and the fully-qualified input + * filespec as the default. + * + * Return Value: + * returns SUCCESS + * + * Global Data: + * All commonly-used data structures, such as the file list, the label + * list, the node list, etc., are declared globally. + * + * Files Used: + * reads the specified input file and one or more glossary definition files + * as described above. Produces an output file. + * + * Assumed Entry State: + * Called from DCL level + * + * Normal Exit State: + * Returns to DCL level + * + * Error Conditions: + * Error messages are generated for all errors. Any significant ones + * cause the program to exit with an appropriate message. + * + * Algorithm: + * A. Process the command line. + * B. Process the input file. + * 1. Glossary label entries are placed on a list. + * 2. Glossary file entries are added to the file list. + * C. For each file in the file list, + * 1. Scan the glossary file for definitions which match a label in + * the label list. + * 2. If found, + * a. Copy the definition to a node in the data structure. + * D. For any labels for which the definition was not found, + * 1. Report it. + * E. Generate the output file. + * + * Special Notes: + * none + */ +/* + * Function GloTeX - Code Section + */ +main(argc,argv) +int argc; +char *argv[]; +{ +/* + * Local Declarations + */ + int status; + STRING_PTR file; +/* + * Module Body + */ +/* Process the command line. The routine will exit on error */ + Glo_Command(argc, argv); + (void)printf("\nGloTeX, the automatic glossary processor for LaTeX, version 1.0\n"); + if (argc < 2) { + (void) printf("usage: glotex file [/STYLE={Article | Report | Special}] \\ \n"); + (void) printf(" [/GLOSSARY=(def1[,def2[,...]])]\n"); + exit(1); + } +/* + * Process the list of definitions referenced: + * Open the input file. + * For each entry record in the file, + * Build a label entry in the label list. + * For each file record in the file, + * Build a file entry in the file list. + * Close the input file. + */ + status = Glo_Build_LabLst(); + if (!(status & TRUE)) { + (void)printf("\nFatal error processing the input file...aborting\n"); + exit(1); + } + if (labels == 0) { + (void)printf("\nFatal error. No glossary entries found in the .glo file"); + (void)printf("...aborting\n"); + exit(1); + } +/* + * For each file in the file list, + * Scan the file for entries which match labels with label list entries. + * For each one, build a node containing the definition. + */ + if (filelist == 0) { + (void)Glo_Report_Missing(); + (void)printf("\nNo glossary definition files specified...aborting\n"); + exit(1); + } + file = filelist; + while (file != 0) { + status = Glo_Scan_File(file); + if (!(status & TRUE)) { + (void)printf("\nFatal error scanning glossary definition file...aborting\n"); + exit(1); + } + file = file->next; + } +/* + * Report all labels for which no definitions were found. + * Write the information to SYS$OUTPUT. + * Write the information to a glossary log file. + */ + status = Glo_Report_Missing(); + if (!(status & TRUE)) { + (void)printf("\nFatal error while reporting the list of undefined terms"); + (void)printf("...aborting\n"); + exit(1); + } +/* + * Generate a formatted output file containing the definitions. + * The file format will be dependent on whether the glossary is being built + * for a LaTeX "article", a LaTeX "report" or "book", or a CR&DS defined + * documentstyle. + */ + status = Glo_Build_File(); + if (!(status & TRUE)) + (void)printf("\nFatal error while building the output file\n"); + (void)printf("\nDone.\n"); +} diff --git a/indexing/glo+idxtex/glotex.gdf b/indexing/glo+idxtex/glotex.gdf new file mode 100644 index 0000000000..155dce38ca --- /dev/null +++ b/indexing/glo+idxtex/glotex.gdf @@ -0,0 +1,36 @@ +@entry{glotex, \GloTeX} The \GloTeX\ program is a tool used to collect and +format a glossary for inclusion in a \LaTeX\ document. It uses \verb+\glossary+ +commands in the \LaTeX\ source file to determine which words or phrases should +be included in the Glossary, and one or more Glossary Definition Files which +contain the definitions of the terms. + +@entry{gdf, Glossary\\Definition\\File} A Glossary Definition File is represents +a database of definitions. Each entry in a Glossary Definition File contains +a {\em label}, an {\em item}, and a {\em definition}. + +@entry{label} A {\em label\/} is an identifier which is associated with +a particular definition. Labels are specified in \verb+\glossary+ commands to +indicate which definitions should be included in the Glossary. + +@entry{item} An {\em item\/} is the word or term to be defined in the +glossary. + +@entry{definition} The {\em definition\/} is the text used to +indicate what a particular item means. A definition may be as short as a +phrase, or as long as a dissertation. However, short definitions (a sentence +or two) are usually most effective in the context of a Glossary. + +@entry{glo-file, {\tt glo} File} The {\tt .glo} file is produced by \LaTeX\ and +contains a list of labels for terms to be included in the Glossary. It is one +of the inputs to \GloTeX. + +@entry{gdf-file, {\tt gdf} File} The {\tt .gdf} file is the Glossary Definition +File. + +@entry{gls-file, {\tt gls} File} The {\tt .gls} file is the output of \GloTeX. +It is the file which should be \verb+\input+ in the document to generate the +Glossary. + +@entry{glg-file, {\tt glg} File} The {\tt .glg} file is a Glossary Log File. It +lists those labels for which no definition was found. This file is only +generated if needed. diff --git a/indexing/glo+idxtex/glotex.pdf b/indexing/glo+idxtex/glotex.pdf new file mode 100644 index 0000000000..21f447a0d0 Binary files /dev/null and b/indexing/glo+idxtex/glotex.pdf differ diff --git a/indexing/glo+idxtex/glotex.tex b/indexing/glo+idxtex/glotex.tex new file mode 100644 index 0000000000..5efe5c13fe --- /dev/null +++ b/indexing/glo+idxtex/glotex.tex @@ -0,0 +1,445 @@ +\documentstyle[glo_idx,oldlfont]{pamphlet} +\def\GloTeX{Glo\TeX} \def\BibTeX{B{\sc ib}\TeX} \def\IdxTeX{Idx\TeX} +\pagestyle{headings} +\makeindex \makeglossary + +\begin{document} +%\coverstyle{userguide} +\title{\GloTeX\ Program} +\author{R L Aurbach} +\authorfacts{CR\&DS MIS Group \\ Monsanto Company \\ 800 N. Lindbergh Blvd. \\ +St. Louis, MO 63167 \\ (314)--694--5453} +\version{Version 1.1} +\file{GloTeX} +\date{August 27, 1986} +\begin{thetitle} +\begin{abstract} +The \GloTeX\ program is used to automate the generation of a Glossary in a +\LaTeX\ document. It uses the {\tt .glo} file generated by the +\verb~\makeglossary~ command and one or more Glossary Definition Database Files +to create a file which is \verb~\input~ in the document to generate the +Glossary. +\end{abstract} +\end{thetitle} +\makeheading +\section{Why Automate Glossaries?}\index{#\GloTeX} +Several programs already exist to augment the capabilities of \LaTeX\ to produce +better documents --- \BibTeX\ supports the formatting and maintenance of +bibliographies, \IdxTeX\ automates the generation of an Index, etc. Why is a +program needed to automate the generation of Glossaries? There are several +reasons:\index{\GloTeX>{\em raison d'\^{e}tre}} +\begin{enumerate} +\item Consider how you might actually make a glossary in a real document. +\index{\GloTeX>{\em raison d'\^{e}tre}>Make writing easier} + \begin{itemize} + \item As you write the document, you come across words or phrases which + should be included in a glossary. You jot them down on paper somewhere. + \item When the document is nearly finished, you take your list of terms, + alphabetize it, and write definitions for each one. + \item Then you write these definitions into your document and complete it. + \end{itemize} + +Think how much easier it would be if you could completely automate documents +with glossaries: + \begin{itemize} + \item As you write the document and come across a word or phrase to be + included in the glossary, you place a simple \verb+\glossary+ command into + the document. + \item You format the document with \LaTeX\ and use \GloTeX\ to build the + glossary. The \GloTeX\ program will tell you about any terms you haven't + yet defined. + \item The definitions go into an external database, rather than directly + into the document. This means that you can use them again in another + document without retyping them. + \end{itemize} + +So \GloTeX\ can be used to make the generation of a document which contains a +glossary easier. + + +\item \index{\GloTeX>{\em raison d'\^{e}tre}>Re-use definitions} +Suppose you are writing a series of documents about related topics and +you decide that each should have a glossary. You could carefully write the +definitions for each term into each document. + +But, wouldn't it be easier to write the definitions only once and pull those +definitions which are needed into each document? If you often write about a +certain topic, wouldn't it be easier to create a {\bf database} of definitions +of those terms you commonly use? + +\GloTeX\ helps you maintain a database of definitions for inclusion in +glossaries. It supports the use of multiple definition files in a single +document, so you can keep definitions for different terms in different places. +For example, if you are writing about an application program, you might want +to have one glossary of computer terms and another which describes the +vocabulary appropriate to that application. + +\item \index{\GloTeX>{\em raison d'\^{e}tre}>Complete a partial implementation} +The standard \LaTeX\ document styles already support the most important +features needed to automate glossaries --- the \verb+\makeglossary+ and +\verb+\glossary+ commands. Before \GloTeX, there was nothing available to +allow you to take advantage of these \LaTeX\ features. + +\end{enumerate} + +\section{Building a Glossary --- Step by Step}\index{#Building a Glossary} + +To automate the generation of a Glossary, here is what you do: + +\begin{itemize} +\item \index{Building a Glossary>\verb+\makeglossary+} +In the preamble of your document, include the command +\verb+\makeglossary+. This will cause a file to be generated when you run +\LaTeX\ which has the same filename as your \LaTeX\ file and the file type +{\tt .glo}. + +\item \index{Building a Glossary>\verb+\glossary+} +In your document, for every word or phrase which you wish to appear in +the glossary, include a \verb+\glossary+ command. The command format is +\begin{verbatim} + \glossary{label} +\end{verbatim} +where ``label\glossary{label}'' is an identifier which is compared with the +contents of the Glossary Definition File to locate the correct definition. +This will be discussed in more detail later. + +\item \index{Building a Glossary>Create {\tt .gdf} File}\glossary{gdf-file} +\index{Building a Glossary&Glossary Definition File} +If the definitions you wish to include are not already in a Glossary +Definition File, create the appropriate file. This is discussed below. + +\item \index{Building a Glossary>Create {\tt .glo} File}\glossary{glo-file} +Run \LaTeX\ on you document. This produces the {\tt .glo} file. + +\item \index{Building a Glossary>Create {\tt .gls} File}\glossary{gls-file} +Run \GloTeX\ on the {\tt .glo} file, specifying the name of one or more +Glossary Definition Files from which definitions are to be drawn. \GloTeX\ will +produce a file which has the same filename as you \LaTeX\ file, but with the +file type {\tt .gls}. + +\item \index{Building a Glossary>Include in Source File} +In your document, insert an \verb+\input+ command, such as +\begin{verbatim} + \input{myfile.gls} +\end{verbatim} +to include the {\tt .gls} file in your document at the appropriate place. + +\item \index{Building a Glossary>Generate Final Document} +Run \LaTeX\ twice. The second time is needed to get the Table of Contents +entry for the Glossary to appear properly. + +\end{itemize} + + +\section{Command Syntax}\glossary{glotex}\index{#Command Syntax} + +The \GloTeX\ program is run as a foreign DCL command.\footnote{On the Monsanto +BB1T VAXcluster, the GloTeX symbol is defined by issuing the CRLSETUP command.} + +The \GloTeX\ program is run using a command line of the form + +\begin{verbatim} + $ glotex file [/STYLE={Article | Report | Special}] + [/GLOSSARY=(def1[,def2[,...]])] +\end{verbatim} + +The ``file'' parameter \index{Command Syntax>File Parameter} +is required. It is the name of the {\tt .glo} file +which is \GloTeX 's input file. If you don't specify an input file, \GloTeX\ +will prompt you for one. You need not specify the {\tt .glo} file type. The +default file specification for the input file is file type {\tt .glo} in your +current default directory. + +The {\tt /STYLE} qualifier \index{Command Syntax>{\tt /STYLE} Qualifier} +is optional. It describes how you wish \GloTeX\ to +format the glossary it builds. There are three possibilities: +\begin{infomap} +\item[Article] \index{Command Syntax>{\tt /STYLE} Qualifier>{\tt Article} +keyword} The {\tt Article} keyword is used if your document uses the +standard \LaTeX\ {\tt article} document style or any other section oriented +style. If you specify this keyword, then the glossary is built as a regular, +numbered section in your document. It will appear in your Table of Contents +automatically. +\item[Report] \index{Command Syntax>{\tt /STYLE} Qualifier>{\tt Report} +keyword} The {\tt Report} keyword is used if your document uses the +standard \LaTeX\ {\tt report} or {\tt book} document styles or any other +chapter oriented style. If you specify this keyword, then the glossary is built +as an unnumbered chapter in your document. It will appear in your Table of +Contents automatically. +\item[Special] \index{Command Syntax>{\tt /STYLE} Qualifier>{\tt Special} +keyword} The {\tt Special} keyword is used if your document uses any of +the Monsanto CR\&DS document styles ({\tt pamphlet}, {\tt manual}, or +{\tt memo}). They already define commands to format the glossary +appropriately --- using the {\tt Special} keyword tells \GloTeX\ not to include +commands in its output file to redefine these commands for you. + +In section-oriented Monsanto CR\&DS document styles, the glossary is formatted +as a numbered section. In the chapter-oriented {\tt manual} document style, the +glossary is an unnumbered chapter, with page numbers of the form + +``\mbox{Glossary--nn}''. + +If you do not include the {\tt /STYLE} qualifier, {\tt Special} is assumed. +\end{infomap} + +The {\tt /GLOSSARY} qualifier \index{Command Syntax>{\tt /GLOSSARY} Qualifier} +is used to specify the list of Glossary Definition +Files which \GloTeX\ will search to find the definitions you wish to include. +You may include as many files as you wish --- \GloTeX\ will search them in the +order you specify. For each file, \GloTeX\ will look for a file with the file +type {\tt .gdf} in your current default directory, unless you override the +defaults. + +The {\tt /GLOSSARY} qualifier is optional. However, you must use it unless +you are using a Monsanto CR\&DS document style, because there is no other way +for \GloTeX\ to know where your definitions are to be found.\footnote{If you use +a Monsanto CR\&DS document style, special commands are available to allow you to +build the glossary definition file specifications into your document. They are +described later.} + +\begin{note} +\GloTeX\ prints a list of all those labels which are present in your input file, +but for which it can't find any definition. This report is output both on your +terminal and to a Glossary Log File ({\tt .glg} file).\glossary{glg-file} + +You can use this feature to make a list of terms needing definition. + +\end{note} + +\section{Building a Glossary --- More Detail}\index{#Building a Glossary} + +This section discusses the steps needed to build a Glossary in more detail. +In this section, we assume that the source file for your document is named +{\tt myfile.tex}. + +\begin{infomap} + +\item[{\tt makeglossary}\\Command] +\index{Building a Glossary>\verb+\makeglossary+} +\LaTeX\ creates a list of those terms to be included in the Glossary in a file +named (in this example) {\tt myfile.glo}. This file is not created +automatically. If you want one, you must include the \verb+\makeglossary+ +command in your document. + +The \verb+\makeglossary+ command must be placed in the preamble of your source +file --- that is, between the \verb+\documentstyle+ command and the +\verb+\begin{document}+ command. + +\item[{\tt glossary}\\Command] \index{Building a Glossary>\verb+\glossary+} +When you come across a word or phrase in your document which you would like to +define in the Glossary, insert a \verb+\glossary+ command in your source file. +The format of this command is +\begin{verbatim} + \glossary{label} +\end{verbatim} +where ``label'' is an identifier you assign to this word or phrase. This +identifier is used to locate the definition in a Glossary Definition File which +you wish to be included. That is, if ``label'' matches the identifier belonging +to a definition in the database, then that definition will be included in the +Glossary. + +For example, in this document, the entry \verb+\glossary{glo-file}+ +\glossary{glo-file} appears. As you can see by examining the glossary, there +is a definition for the term ``{\tt glo} File'', which was generated as a +result of this reference. + +\item[Generating the\\{\tt glo} File] +\index{Building a Glossary>Create {\tt .glo} File} +Having prepared your document, the next step is to run it through \LaTeX. This +will generate a file {\tt myfile.glo} which contains the collected information +from the \verb+\glossary+ commands which you placed in your document. + +\item[Building the\\{\tt gls} File] +\index{Building a Glossary>Create {\tt .gls} File} +The next step is to use the \GloTeX\ program to generate the glossary +information, using the {\tt myfile.glo} file and the appropriate Glossary +Definition Files. + +In our example, we will make several assumptions. +\begin{enumerate} +\item Lets assume that your document {\tt myfile.tex} uses the standard \LaTeX\ +{\tt article} document style. +\item Lets also assume that you are using definitions from three sources --- +a local glossary of application specific terms, a public glossary of +biological terms, and a public glossary of computer terms. The biological +glossary is assumed to be located in the {\tt GenLocDoc:} area, while the +computer glossary is located in the {\tt CRL\_Documentation:} area. +\end{enumerate} + +Then, the command line +\begin{verbatim} + $ glotex myfile /STYLE=Article - + $_ /GLOSSARY=(myglos,GenLocDoc:BioDefs,- + $_ Crl_Documentation:EDPDefs) +\end{verbatim} +will process the {\tt myfile.glo} file, using the three specified Glossary +Definition Files, and produce the file {\tt myfile.gls}, formatted appropriately +for the standard \LaTeX\ {\tt article} document style. + +\item[Including the\\{\tt gls} File] +\index{Building a Glossary>Include in Source File} +Normally, a Glossary is placed in the document at the end, just before the +index. Most people place the Glossary {\bf before} the Bibliography, if both +exist in the document, but that is a matter of personal choice. + +In any case, once you decide where to put the Glossary, it is merely necessary +to add the command +\begin{verbatim} + \input{myfile.gls} +\end{verbatim} +in the appropriate place. + +\item[Generate the\\Final Document]\index{Building a Glossary>Generate Final Document} +Now you are ready to generate the final document. To do this, run \LaTeX\ on +the document twice. The first time you run \LaTeX, the Glossary will be +included in your document and a reference will be made to include a Table of +Contents entry for it. The second time you run \LaTeX, the Table of Contents +will be updated to include an entry for the Glossary. + +\end{infomap} + +\section{Glossary Definition Files} +\glossary{gdf}\glossary{label}\glossary{item}\glossary{definition} +\index{#Glossary Definition File}\index{#{\tt gdf} file} + +A Glossary Definition File is a text file which contains one or more definitions +of words or phrases (an ``entry'') in a special, defined format. A Glossary +Definition File is also called a {\tt .gdf} file, because the default file type +for these files is {\tt .gdf}. + +A entry in a {\tt .gdf} file has three parts. +\begin{infomap} +\item[label] \index{Glossary Definition File>Label} +The {\em label\/} is an identifier used to associate a particular +definition with a particular \verb+\glossary+ command from the document. + +The label is a {\bf case sensitive} string. If the label of an entry in the +{\tt .gdf} file matches a label specified in a \verb+\glossary+ command exactly +(character for character, including any whitespace characters), then the +term will be included in the Glossary. + +\item[item] \index{Glossary Definition File>Item} +The {\em item\/} is the word or phrase being defined by the entry. +Visually, the item appears on the left-hand portion of the page, separated from +the definition. + +Glossary entries are formatted in an {\tt infomap} environment,\footnote{for +those familiar with the CR\&DS Extensions to \LaTeX.} a special variation of +the {\tt description} environment.\footnote{If you specify /STYLE:ARTICLE or +/STYLE:REPORT in your command line, \GloTeX\ will automatically include in its +output file the commands needed to define this new environment.} In an {\tt +infomap} environment, the item is placed in a \verb+\parbox+. If the item is +too long for the space allotted it, it will be typeset in multiple lines. You +can often help this process along by careful inclusion of \verb+\\+ commands in +the item to control where the lines are split. + +The default formatting in an item is {\bf boldface}. Other possibilities are +available, however. In this document, for example, the item ``glo File'' was +entered as ``\verb+{\tt glo} File+''. Notice that the term appears in the +correct alphabetical order, in spite of the presence of the special formatting +characters. + +\item[definition] \index{Glossary Definition File>Definition} +The definition is the body of the glossary entry. It +consists of as much normal \LaTeX\ source as you wish --- multiple paragraphs, +lists, etc., are all supported. However, experience has shown that a +glossary entry which is two or three sentences long is normally plenty. Very +long entries lose their effectiveness with the reader. + +\end{infomap} + +The format of an entry in a {\tt .gdf} file is +\index{Glossary Definition File>Format} +\begin{verbatim} + @entry{label, item} definition + definition (continued...) +\end{verbatim} + +A new entry in the file begins with ``{\tt @entry}'' in lower case, and as the +first characters on a new line. The {\tt @entry} command takes two arguments +--- the label and the item strings. The item string is optional --- if it is +not specified, then the label string will be used as the item string as well. + +The definition may begin on the {\tt @entry} line, although that is not +required. All text is considered as definition, beginning with the first +character after the closing brace of the {\tt @entry} command up to the +next {\tt @entry} command or the end of the file. + +As an example, below is a portion of the {\tt .gdf} file used to generate the +Glossary of this document. \index{Glossary Definition File>Example} + +\begin{verbatim} + @entry{glo-file, {\tt glo} File} The {\tt .glo} file is + produced by \LaTeX\ and contains a list of labels for + terms to be included in the Glossary. It is one of the + inputs to \GloTeX. + + @entry{item} An {\em item\/} is the word or term to be + defined in the glossary. +\end{verbatim} + + +\appendix +\section{\LaTeX\ Extensions Which Support Glossaries} + +Standard \LaTeX\ document styles define the \verb+\makeglossary+ and +\verb+\glossary+ commands described above. If you are using standard +\LaTeX\ document styles, these are the only commands available to you. + +If you use one of the CR\&DS document styles ({\tt pamphlet}, {\tt manual}, or +{\tt memo}), then additional commands are defined which make glossary generation +even nicer.\footnote{This section is only relevant at sites which use the +Monsanto CR\&DS special document styles. It should be ignored otherwise.} + +\begin{infomap} + +\item[{\tt theglossary}\\Environment] +\index{New Glossary Commands>{\tt theglossary} Environment} +The {\tt theglossary} environment is +the context for a glossary. That is, a glossary begins with the +\verb+\begin{theglossary}+ command and ends with the \verb+\end{theglossary}+ +command. Each CR\&DS document style defines this environment so that the +formatting of the Glossary is appropriate to the document. When you specify +{\tt /STYLE = Article} or {\tt /STYLE = Report}, \GloTeX\ includes in the +{\tt .gls} file the necessary commands to define this environment for you. +\item[{\tt glossaryfile}\\Command] +\index{New Glossary Commands>{\tt glossaryfile} Command} +The \verb+\glossaryfile+ command is used +to specify one or more {\tt .gdf} files to be used to locate definitions. +The format of the command is +\begin{verbatim} + \glossaryfile{filelist} +\end{verbatim} +where filelist is either a single file specification or a list of file +specifications, separated by commas. + +You may specify more than one \verb+\glossaryfile+ command if you wish. The +{\tt .gdf} files you specify are searched in the following order: +\begin{enumerate} +\item Any {\tt .gdf} files specified on the command line using the {\tt +/GLOSSARY} qualifier are searched in the order specified. +\item Any {\tt .gdf} files specified in the first \verb+\glossaryfile+ command +in the source document are searched in the order specified. +\item Addition {\tt .gdf} files are searched in order as specified by additional +\verb+\glossaryfile+ commands. +\end{enumerate} + +\item[{\tt insertglossary}\\Command] +\index{New Glossary Commands>{\tt insertglossary} Command} +The \verb+\insertglossary+ command is +used to place a glossary at a particular place in the document. It is +equivalent to issuing the \verb+\input{myfile.gls}+ command, where {\tt myfile} +is the name of the source document. + +\end{infomap} + +\input{glotex.gls} + +\input{glotex.ind} + +\input{idxtex.mnd} + +\tableofcontents + +\end{document} +% diff --git a/indexing/glo+idxtex/idxbuild.c b/indexing/glo+idxtex/idxbuild.c new file mode 100644 index 0000000000..c615c159f8 --- /dev/null +++ b/indexing/glo+idxtex/idxbuild.c @@ -0,0 +1,771 @@ +/* #module IdxBuild "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: IdxBuild + * + * Author: R L Aurbach CR&DS MIS Group 27-Apr-1986 + * + * Function: + * Build the Index Tree data structure + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 27-Apr-1986 Original Code + * 1-002 RLA 03-May-1986 Add support for page-no highlighting + * and move spell-string processing to a + * separate module. + * 2-003 RLA 09-Apr-1987 Add support for volumes (used in master + * index processing). + * 2-004 RLA 14-Apr-1987 Add new page highlight flag + * 2-005 RLA 15-Apr-1987 Add support for cross-referencing + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxBuild - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +# include +extern char *sprintf(); +#endif +#include +#include +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define TRUE 1 +#define FALSE 0 +#define linebfsize 133 +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +static char *page_ref; +static char *tok_spell; +static char see_spell[linebfsize]; +#ifdef MSDOS +void idx_build_tree(char *token_1, char *token_2, char *token_3, + char *page_no, char token_ct, char *vol, int flag); +TREE_PTR idx_locate_node(TREE_PTR *head, char *token, char *desc); +void idx_add_page_ref(PGNODE_PTR *pghead, char *token, + char highlight, char *vol); +void idx_add_cross_ref(PGNODE_PTR *seehead, char *token, + char highlight, char *vol); +TREE_PTR idx_allocate_node(char *token, char *desc); +PGNODE_PTR idx_allocate_pgnode(char *vol, char *dsc, char hlite); +#else +void idx_build_tree(); +TREE_PTR idx_locate_node(); +void idx_add_page_ref(); +void idx_add_cross_ref(); +TREE_PTR idx_allocate_node(); +PGNODE_PTR idx_allocate_pgnode(); +#endif +/* + * External References: + */ +extern TREE_PTR root; /* root of the Index Tree */ +#ifdef MSDOS +extern void idx_build_spell_string(char *desc); +extern void idx_parse(char *linebf, char *token_1, char *token_2, + char *token_3, char *page_no, int *token_ct, int *flag); +#else +extern void idx_build_spell_string(); +extern void idx_parse(); +#endif +/* + * Functions Called: + */ +/* + * Function Idx_Build_Tree - Documentation Section + * + * Discussion: + * This routine uses the information parsed by Idx_Parse to build the Index + * Tree. + * + * Calling Synopsis: + * Call Idx_Build_Tree (token_1, token_2, token_3, page_no, token_ct, + * vol, flag) + * + * Inputs: + * token_1 -> is the top level item token. ASCIZ string passed by + * reference. + * + * token_2 -> is the second level item token. ASCIZ string passed by + * reference. + * + * token_3 -> is the third level item token. ASCIZ string passed by + * reference. + * + * page_no -> is the page number token. ASCIZ string passed by + * reference. + * + * token_ct -> is the number of tokens seen for this index entry. + * integer passed by value. + * + * vol -> is a pointer to the string descriptor for a volume + * string. The pointer is passed by value. + * + * flag -> is a boolean flag. If TRUE, the page_no variable is + * really a cross-reference string. + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * The Index Tree is updated. + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * Tree is updated. + * + * Error Conditions: + * The only expected error is a memory allocation failure. In this case, + * a message is printed and the entry is ignored. + * + * Algorithm: + * A. Check for a page-no highlighting flag. + * B. Check for a valid set of input data. Ignore if not. + * C. Build a Spell String for the top-level item. + * D. Locate the top-level item in the tree. + * 1. If it does not exist, + * A. Allocate a new node and link it in. + * E. If token_ct == 1, + * 1. Add page number to list. + * F. Else, + * 1. Build a Spell String for the second-level item. + * 2. Locate the second-level item in the tree. + * A. If it does not exist, + * 1. Allocate a new node and link it in. + * 3. If token_ct == 2, + * A. Add page number to list. + * 4. Else, + * A. Build a Spell String for the third-level item. + * B. Locate the third-level item in the tree. + * 1. If it does not exist, + * a. Allocate a new node and link it in. + * C. Add page number to list. + * + * Special Notes: + * The first character of token_1 may be a special character. Special + * characters are used to indicate special highlighting to be performed + * on the page-no for this index entry. The special characters are: + * ^ use boldface + * ~ use italic + * _ use underlining + * Only one type of highlighting is supported for each page entry. + */ +/* + * Function Idx_Build_Tree - Code Section + */ +void idx_build_tree (token_1, token_2, token_3, page_no, token_ct, vol, flag) + char *token_1; + char *token_2; + char *token_3; + char *page_no; + char token_ct; + char *vol; + int flag; +{ +/* + * Local Declarations + */ + char spell_str[linebfsize]; + TREE_PTR node; + int test_char; + char *real_token_1; + char highlight; +/* + * Module Body + */ +/* Check for page-no highlighting flag */ + if (token_ct == 0) return; + if (token_1[0] == '\0') return; + real_token_1 = &token_1[1]; + test_char = token_1[0]; + switch (test_char) { + case '_' : + highlight = IDX_K_UNDERLINE; + break; + case '~' : + highlight = IDX_K_ITALIC; + break; + case '^' : + highlight = IDX_K_BOLD; + break; + case '#' : + highlight = IDX_K_FOLLOW; + break; + default : + highlight = IDX_K_NONE; + real_token_1 = &token_1[0]; + break; + } +/* Check out the item for validity */ + if (real_token_1[0] == '\0') return; + if ((token_ct > 1) && (token_2[0] == '\0')) return; + if ((token_ct > 2) && (token_3[0] == '\0')) return; + if (token_ct > 3) return; + if (page_no[0] == '\0') return; +/* First level token processing */ + (void)strcpy(spell_str, real_token_1); + idx_build_spell_string (spell_str); + node = idx_locate_node (&root, real_token_1, spell_str); + if (node == 0) { + (void)printf("Error processing index item %s\n", real_token_1); + return; + } + if (token_ct == 1) { + if (!flag) + idx_add_page_ref (&node->pghead, page_no, highlight, vol); + else idx_add_cross_ref (&node->seehead, page_no, highlight, vol); + } +/* Second level token processing */ + else { + (void)strcpy(spell_str,token_2); + idx_build_spell_string(spell_str); + node = idx_locate_node (&node->subhead, token_2, spell_str); + if (node == 0) { + (void)printf("Error processing index subitem %s\n", token_2); + return; + } + if (token_ct == 2) { + if (!flag) + idx_add_page_ref (&node->pghead, page_no, highlight, vol); + else + idx_add_cross_ref (&node->seehead, page_no, highlight, vol); + } +/* Third level token processing */ + else { + (void)strcpy(spell_str,token_3); + idx_build_spell_string(spell_str); + node = idx_locate_node (&node->subhead, token_3, spell_str); + if (node == 0) { + (void)printf("Error processing index subsubitem %s\n", token_3); + return; + } + if (!flag) + idx_add_page_ref (&node->pghead, page_no, highlight, vol); + else + idx_add_cross_ref (&node->seehead, page_no, highlight, vol); + } + } +} + +/* + * Function Idx_Locate_Node - Documentation Section + * + * Discussion: + * This routine scans the list of nodes (starting from the listhead), + * looking for one which has a spell-string identical to the given + * spell string. If it doesn't find one, it adds a node in the right place + * in the chain to maintain alphabetical order. + * + * Calling Synopsis: + * node = Idx_Locate_Node (head, token, desc) + * + * Inputs: + * head -> is the address of the listhead of the list to be + * scanned. As such, it is a TREE_PTR, passed by + * reference. + * + * token -> is the token to be located or entered in the list. + * ASCIZ string passed by reference. + * + * desc -> is the spell string, passed by descriptor. + * + * Outputs: + * none + * + * Return Value: + * node -> is the address of the tree leaf for the current token. + * It is a TREE_PTR, passed by value. If the leaf did not + * already exist and if the system was unable to allocate + * one, the node is returned as 0. + * + * Global Data: + * The list specified by the listhead will be modified if it is not + * possible to add a new leaf when necessary. + * + * Files Used: + * none + * + * Assumed Entry State: + * An empty listhead contains 0. + * + * Normal Exit State: + * The node is returned. + * + * Error Conditions: + * Allocation failure -- node = 0. + * + * Algorithm: + * A. If the list is empty, + * 1. Allocate a node and link it in. + * B. Else, + * 1. Beginning with the first node, + * a. If spell-string < node-spell-string, + * 1. Get next node. + * b. If spell-string = node-spell-string, + * 1. Return node pointer. + * c. If spell-string > node-spell-string, + * 1. Allocate a node and link it in. + * + * Special Notes: + * Although this algorithm isn't a very efficient way to alphatize things, + * it has the tremendous virtue of being easy to implement. Since the + * program is not run often (typically a couple of times per document), + * the inefficiency is not important. + */ +/* + * Function Idx_Locate_Node - Code Section + */ +TREE_PTR idx_locate_node (head, token, desc) + TREE_PTR *head; + char *token; + char *desc; +{ +/* + * Local Declarations + */ + TREE_PTR node; + TREE_PTR old_node; + TREE_PTR new_node; + int status; +/* + * Module Body + */ +/* Chain through the list, looking for the right place */ + old_node = 0; + new_node = *head; + while (new_node != 0) { + status = strcmp(new_node->spell, desc); + if (status < 0) { + old_node = new_node; + new_node = new_node->link; + continue; + } + if (status == 0) return (new_node); + if (status > 0) { + node = idx_allocate_node (token, desc); + if (old_node == 0) *head = node; + else old_node->link = node; + node->link = new_node; + return (node); + } + } +/* If the list is exhausted, allocate a node immediately */ + node = idx_allocate_node (token, desc); + if (old_node == 0) *head = node; + else old_node->link = node; + return (node); +} + +/* + * Function Idx_Allocate_Node - Documentation Section + * + * Discussion: + * Allocate and initialize a leaf of the Index Tree. + * + * Calling Synopsis: + * node = Idx_Allocate_Node (token, desc) + * + * Inputs: + * token -> token string. ASCIZ string passed by reference. + * + * desc -> spell string. Character string passed by descriptor. + * + * Outputs: + * none + * + * Return Value: + * node -> Address of the allocated node. TREE_PTR passed by + * value. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * node is allocated. + * + * Error Conditions: + * allocation failure -- node is returned == 0. + * + * Algorithm: + * A. Allocate virtual memory for the node. + * B. Initialize the node structure. + * + * Special Notes: + * none + */ +/* + * Function Idx_Allocate_Node - Code Section + */ +TREE_PTR idx_allocate_node (token, desc) + char *token; + char *desc; +{ +/* + * Local Declarations + */ + TREE_PTR node; +/* + * Module Body + */ + node = (TREE_PTR) malloc (sizeof(TREE)); + if (node != 0) { + node->link = 0; + node->subhead = 0; + node->pghead = 0; + node->seehead = 0; + node->spell = strdup(desc); + node->item = strdup(token); + } + return (node); +} + +/* + * Function Idx_Add_Page_Ref - Documentation Section + * + * Discussion: + * If the specified page reference is not already in the current list, + * add it to the end of the list. + * + * Calling Synopsis: + * Call Idx_Add_Page_Ref (pghead, token, highlight, vol) + * + * Inputs: + * pghead -> the address of the listhead for the page reference list. + * a PGNODE_PTR, passed by reference. + * + * token -> the page reference. ASCIZ string passed by reference. + * + * highlight -> a flag indicating what sort of highlighting to give + * this particular page reference. char passed by value. + * + * vol -> is a pointer to a character string descriptor which + * describes the volume string. + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * If a new page reference needs to be added, the list is updated. + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * If the page reference already exists, nothing happens. If a new + * page reference needs to be added, it is allocated and appended to the + * end of the list. + * + * Error Conditions: + * If there is an allocation failure, the page reference is not added. + * + * Algorithm: + * A. Put the page_no token in a dynamic string. + * B. For all nodes in the list, + * 1. If the page-no in the list does not match the page-no, + * a. Get next node. + * 2. Else, + * a. Return. + * C. If the list is exhausted, + * 1. Allocate a new node. + * 2. Fill it in. + * 3. Chain it to the end of the list. + * + * Special Notes: + * This routine assumes that page-no references are always in numerical + * order. This assumption is necessary, because the variety of page + * numbering (perhaps within the document) makes it impossible to check + * for order. + */ +/* + * Function Idx_Add_Page_Ref - Code Section + */ +void idx_add_page_ref (pghead, token, highlight, vol) + PGNODE_PTR *pghead; + char *token; + char highlight; + char *vol; +{ +/* + * Local Declarations + */ + PGNODE_PTR node; + PGNODE_PTR last_node = *pghead; +/* + * Module Body + */ + page_ref = strdup(token); + while (last_node != 0) { + if ((strcmp(last_node->page_dsc, page_ref) == 0) && + ((strcmp(last_node->vol, vol)) == 0)) { + if (highlight == IDX_K_NONE) return; + last_node->highlight = highlight; + return; + } + if (last_node->link == 0) break; + last_node = last_node->link; + } + node = idx_allocate_pgnode (vol, page_ref, highlight); + if (node != 0) { + if (last_node == 0) *pghead = node; + else last_node->link = node; + } +} + +/* + * Function Idx_Add_Cross_Ref - Documentation Section + * + * Discussion: + * Parse and build a cross reference string. If the string is not already + * on the current list, add it to the list in alphabetical order. + * + * Calling Synopsis: + * Call Idx_Add_Cross_Ref (seehead, token, highlight, vol) + * + * Inputs: + * seehead -> the address of the listhead for the cross-reference + * list. + * + * token -> the cross-reference string. ASCIZ string passed by + * reference. + * + * hightlight -> a flag indicating what sort of highlighting to give" + * this particular cross-reference. char passed by value. + * + * vol -> is a pointer to a character string descriptor which + * describes the volume string.f + * + * Outputs:e + * noneM + * + * Return Value: + * none + * + * Global Data:a + * If a new cross-reference needs to be added, the list is updated.t + * + * Files Used: + * nonea + * + * Assumed Entry State: + * nonef + * + * Normal Exit State:s + * If the cross-reference already exists, nothing happens. If a new + * page reference needs to be added, it is allocated and added to thei + * list. + * + * Error Conditions: + * If there is an allocation failure, the page reference is not added. + * + * Algorithm: + * A. Parse the page reference into tokens. + * B. Build the cross-reference text string and put it in a dynamic string. + * C. Build a spell string for it. + * D. Chain the string into the list. + * + * Special Notes:* + * none* + */ +/* + * Function Idx_Add_Cross_Ref - Code Section + */ +void idx_add_cross_ref (seehead, token, highlight, vol) + PGNODE_PTR *seehead; + char *token; + char highlight; + char *vol; +{ +/* + * Local Declarationsp + */ + int length; + PGNODE_PTR node; + PGNODE_PTR old_node = 0; + PGNODE_PTR new_node = *seehead; + char tok_1[linebfsize]; + char tok_2[linebfsize]; + char tok_3[linebfsize]; + char dummy[linebfsize]; + int tok_ct; + int flag; +/* + * Module Body + */ + +/* + * Parse the cross-reference string into its tokens using Idx_Parse. + * Then combine the results to build a token string and write it to thei + * page_ref dynamic string. Compute its spell string. + */ + idx_parse(token, tok_1, tok_2, tok_3, dummy, &tok_ct, &flag); + if (tok_ct == 0) return; + if (strlen(tok_1) == 0) return; + if (tok_ct > 1 && strlen(tok_2) == 0) return; + if (tok_ct > 2 && strlen(tok_3) == 0) return; + length = strlen(tok_1); + (void)sprintf (dummy, "%s", tok_1); + if (tok_ct > 1) { + (void)sprintf (&dummy[length], ", %s", tok_2); + length += strlen(tok_2); + } + if (tok_ct > 2) { + (void)sprintf(&dummy[length], ", %s", tok_3); + length += strlen(tok_3); + } + page_ref = strdup(dummy); + tok_spell = dummy; + idx_build_spell_string(tok_spell); +/* + * Now scan the list of cross-references to find where to put this one.C + */ + while (new_node != 0) { + (void)strncpy(dummy, new_node->page_dsc, + strlen(new_node->page_dsc)); + dummy[strlen(new_node->page_dsc)] = '\0'; + (void)strcpy(see_spell, dummy); + idx_build_spell_string(see_spell); + flag = strcmp(see_spell, tok_spell); + if (flag < 0) { + old_node = new_node; + new_node = new_node->link; + continue; + } + if (flag == 0) return; + if (flag > 0) { + node = idx_allocate_pgnode(vol, page_ref, highlight); + if (node != 0) { + if (old_node == 0) *seehead = node; + else old_node->link = node; + node->link = new_node; + } + return; + } + } + +/* If the list is exhausted, allocate a node immediately */ + node = idx_allocate_pgnode(vol, page_ref, highlight); + if (node != 0) { + if (old_node == 0) *seehead = node; + else old_node->link = node; + } +} + +/* + * Function Idx_Allocate_PgNode - Documentation Sectioni + * + * Discussion: + * Allocate and initialize a new page node.o + * + * Calling Synopsis: + * node = Idx_Allocate_PgNode (vol, dsc, hlite) + * + * Inputs: + * vol -> is the address of the volume string descriptor. + * + * dsc -> is the address of the page ref string descriptor. + * + * hlite -> is the highlight flag + * + * Outputs: + * nonem + * + * Return Value: + * node -> is the address of the newly allocated node. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * if the allocation failed, node is returned = 0. + * + * Algorithm: + * A. Allocate the node. + * B. If successful, + * 1. Initialize it. + * + * Special Notes: + * none + */ +/* + * Function Idx_Allocate_PgNode - Code Section + */ +PGNODE_PTR idx_allocate_pgnode (vol, dsc, hlite) + char *vol; + char *dsc; + char hlite; +{ +/* + * Local Declarations + */ + PGNODE_PTR node; +/* + * Module Body + */ + node = (PGNODE_PTR) malloc (sizeof(PGNODE)); + if (node != 0) { + node->link = 0; + node->vol = strdup(vol); + node->highlight = hlite; + node->page_dsc = strdup(dsc); + } + return (node); +} diff --git a/indexing/glo+idxtex/idxcmd.c b/indexing/glo+idxtex/idxcmd.c new file mode 100644 index 0000000000..402c248d90 --- /dev/null +++ b/indexing/glo+idxtex/idxcmd.c @@ -0,0 +1,189 @@ +/* #module IdxCmd "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: IdxCmd + * + * Author: R L Aurbach CR&DS MIS Group 13-Jun-1986 + * + * Function: + * + * This routine parses the IdxTeX Command Line, and returns the name of + * the input file and a flag which indicates whether to add an entry to + * the table of contents for the Index. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 13-Jun-1986 Original Code, based on the CRDVLIB + * Library routine LIB_PARSE_FOREIGN + * 2-002 RLA 09-Apr-1987 Add support for the /MASTER qualifier + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxCmd - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ + +#define TRUE 1 /* Success value */ +#define FALSE 0 /* Failure value */ +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +#ifdef MSDOS +void idx_command(int argc, char *argv[], char *file, + int *toc_flag, int *mst_flag); +#else +void idx_command(); +#endif +/* + * External References: + */ +/* + * Functions Called: + */ +/* + * Function Idx_Commmand - Documentation Section + * + * Discussion: + * This routine uses lib$get_foreign to read the command line. It + * prefixes the command line with "IdxTeX ", so that the CLI routines + * will have the appropriate information on which to operate. It then + * parses the command line and returns the appropriate information to the + * program. + * + * Since this routine establishes LIB$SIG_TO_STOP as a condition handler, + * syntax errors detected during processing result in program exit. + * + * Calling Synopsis: + * Call Idx_Command (file, toc_flag, mst_flag) + * + * Inputs: + * none + * + * Outputs: + * file -> is the input file specified in the command line. This + * is a required parameter. This variable is an ASCIZ + * string passed by reference. The calling program is + * responsible for allocating a sufficiently large + * string (i.e., char file[256]). + * + * toc_flag -> indicates whether the /TOC qualifier was specified. + * Values returned are: + * IDX_K_NONE - /TOC not specified. + * IDX_K_ARTICLE - /TOC:ARTICLE specified. + * IDX_K_REPORT - /TOC:REPORT specified. + * + * mst_flag -> indicates whether the /MASTER qualifier was specified. + * Returns a boolean result. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * IdxTeX is invokes as a Foreign DCL command. + * + * Normal Exit State: + * Routine returns to caller. The "file", "toc_flag", and "mst_flag" + * variables are set up correctly. + * + * Error Conditions: + * Since the routine establishes LIB$SIG_TO_STOP as its exception handler, + * syntax and parsing errors detected by the CLI$ routines (which signal + * errors) cause the program to exit. That is, all syntax errors are + * fatal. + * + * Algorithm: + * A. Call Lib$Get_Foreign to retrieve the command line. + * B. Prefix the command line with the command verb. + * C. Call Cli$DCL_Parse to parse the command line. + * D. Process the file name. + * 1. Get the file name. + * 2. Convert it to an ASCIZ string. + * E. Process the /TOC qualifier. + * 1. If /TOC is not specified, + * a. toc_flag = IDX_K_NONE. + * 2. If /TOC:ARTICLE specified, + * a. toc_flag = IDX_K_ARTICLE. + * 3. If /TOC:REPORT specified. + * a. toc_flag = IDX_K_REPORT. + * F. Process the /MASTER qualifier. + * + * Special Notes: + * This routine is based on the LIB_PARSE_FOREIGN routine, suitably + * modified. + */ +/* + * Function Idx_Command - Code Section + */ +void idx_command (argc, argv, file, toc_flag, mst_flag) + int argc; + char *argv[]; + char *file; /* File name parameter */ + int *toc_flag; /* /TOC flag */ + int *mst_flag; /* /MASTER flag */ +{ +/* + * Local Declarations: + */ + int i; +/* + * Module Body: + */ +/* Establish a condition handler */ +/* Get the command line */ +/* Parse the command line */ +/* Get the filename string */ + (void)sprintf(file,"%s", argv[1]); +/* Process the /TOC qualifier */ + i = 2; + *toc_flag = IDX_K_NONE; + if (argc > i) { + if ((strncmp("/TOC", argv[i],4)) == 0) { + if (argv[i][5] == 'A') *toc_flag = IDX_K_ARTICLE; + if (argv[i][5] == 'R') *toc_flag = IDX_K_REPORT; + i++; + } + } +/* Process the /MASTER qualifier */ + *mst_flag = FALSE; + if (argc > i) + if (strncmp("/MASTER",argv[i],7) == 0) *mst_flag = TRUE; +} diff --git a/indexing/glo+idxtex/idxgen.c b/indexing/glo+idxtex/idxgen.c new file mode 100644 index 0000000000..d80efd3d27 --- /dev/null +++ b/indexing/glo+idxtex/idxgen.c @@ -0,0 +1,716 @@ +/* #module IdxGen "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ + +/* + * Module Name: IdxGen + * + * Author: R L Aurbach CR&DS MIS Group 28-Apr-1986 + * + * Function: + * Generate the text file used to actually generate the index text. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 28-Apr-1986 Original Code + * 1-002 RLA 03-May-1986 Add support for page-no highlighting + * 1-003 RLA 14-Jun-1986 Add support for the /TOC qualifier + * 2-004 RLA 10-Apr-1987 Enhance the visual appearance of the + * index and add support of a master + * index. + * 2-005 RLA 11-Apr-1987 Fix spacing around each new group by + * defining the \indexhead macro. + * 2-006 RLA 14-Apr-1987 Support new page-no highlight option. + * 2-007 RLA 16-Apr-1987 Add support for cross references. + * 2-008 RLA 20-Apr-1987 Final formatting enhancements + * 3-001 F.H. 17-May-1991 converted to portable C + */ + +/* + * Module IdxGen - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define TRUE 1 +#define FALSE 0 +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +#ifdef MSDOS +void idx_generate(FILE *file, int toc_flag, int mst_flag); +void idx_preamble(FILE *file, int toc_flag, int mst_flag); +void idx_new_group(char *test_char, TREE_PTR node, FILE *file); +void idx_write(TREE_PTR node, char *intro_str, FILE *file, int mst_flag); +void idx_postamble(FILE *file); +#else +void idx_generate(); +void idx_preamble(); +void idx_new_group(); +void idx_write(); +void idx_postamble(); +#endif +/* + * External References: + */ +#ifdef MSDOS +extern void idx_build_range(TREE_PTR node); +#else +extern void idx_build_range(); +#endif +extern TREE_PTR root; +/* + * Functions Called: + */ +/* + * Function Idx_Generate - Documentation Section + * + * Discussion: + * Generate the output file containing the appropriate LaTeX command lines + * to generate the index. + * + * Calling Synopsis: + * Call Idx_Generate (file, toc_flag, mst_flag) + * + * Inputs: + * file -> is the file descriptor for the current output file. + * It is a pointer to FILE. + * + * toc_flag -> is a flag indicating what kind of treatment should be + * applied to for table-of-contents processing. It is an + * integer, passed by value. Values are: + * IDX_K_NONE - Do nothing. + * IDX_K_ARTICLE - Add a section-oriented toc entry + * IDX_K_REPORT - Add a chapter-oriented toc entry + * + * mst_flag -> is a flag which specifies whether a master index is + * being generated. Volume labels are printed for the + * master index. + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * The Index Tree is used read-only. + * + * Files Used: + * The current output file is written. + * + * Assumed Entry State: + * The output file pointed to by the file variable is open. + * + * Normal Exit State: + * Output is written to the file. + * + * Error Conditions: + * Errors are ignored, in the sense that they don't generate output. + * + * Algorithm: + * A. Write pre-amble information. + * B. For each item in the primary list, + * 1. If the first letter of the entry changed, + * a. Output special formatting information. + * 2. Process the information for this item. + * 3. For each subitem, + * a. Process information for this subitem. + * b. For each subsubitem, + * 1. Process information for this subsubitem. + * C. Write post-amble information. + * + * Special Notes: + * none + */ +/* + * Function Idx_Generate - Code Section + */ +void idx_generate (file, toc_flag, mst_flag) + FILE *file; + int toc_flag; + int mst_flag; +{ +/* + * Local Declarations + */ + TREE_PTR node_1; + TREE_PTR node_2; + TREE_PTR node_3; + char first_letter; + int item_count = 0; + int subitem_count = 0; + int subsubitem_count = 0; +/* + * Module Body + */ +/* Write the pre-amble. */ + idx_preamble(file, toc_flag, mst_flag); + node_1 = root; + first_letter = '+'; +/* For each node of the primary tree, */ + while (node_1 != 0) { + idx_new_group(&first_letter, node_1, file); + idx_write (node_1, "\\item", file, mst_flag); + item_count++; + node_2 = node_1->subhead; + while (node_2 != 0) { + idx_write (node_2, "\\subitem", file, mst_flag); + subitem_count++; + node_3 = node_2->subhead; + while (node_3 != 0) { + idx_write (node_3, "\\subsubitem", file, mst_flag); + subsubitem_count++; + node_3 = node_3->link; + } + node_2 = node_2->link; + } + node_1 = node_1->link; + } +/* Report the total counts of entries. */ + (void)printf("\nIndex processing statistics:\n"); + (void)printf(" Items: %d\n", item_count); + (void)printf(" Subitems: %d\n", subitem_count); + (void)printf(" Subsubitems: %d\n\n", subsubitem_count); +/* Write the post-amble */ + idx_postamble(file); +} + +/* + * Function Idx_PreAmble - Documentation Section + * + * Discussion: + * Write the pre-amble information to the output file. + * + * Calling Synopsis: + * Call Idx_PreAmble (file, toc_flag) + * + * Inputs: + * file -> is the file descriptor for the output file. + * + * toc_flag -> is a flag used to indicate what treatment should be + * performed for table-of-contents processing. It is + * an integer passed by value. Values are: + * IDX_K_NONE - Do nothing. + * IDX_K_ARTICLE - Add a section-oriented toc entry. + * IDX_K_REPORT - Add a chapter-oriented toc entry. + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * non + * + * Files Used: + * The file described by "file" is written. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Write pre-amble information. + * + * Special Notes: + * none + */ +/* + * Function Idx_PreAmble - Code Section + */ +void idx_preamble (file, toc_flag, mst_flag) + FILE *file; + int toc_flag; + int mst_flag; +{ +/* + * Local Declarations + */ +/* + * Module Body + * + * Define the \indexhead macro: + * \indexhead{BEFORESKIP}{AFTERSKIP}{HEADING} == + * BEGIN + * \par + * IF @nobreak = TRUE + * THEN \everypar == null + * ELSE \addpenalty{\@secpanalty} + * \addvspace{BEFORESKIP} + * FI + * \begingroup + * \sl HEADING\par + * \endgroup + * \@xsect{AFTERSKIP} + * END + */ + if (mst_flag) + { + (void)fprintf(file,"\\def\\indexname{\\masterindexname}\n"); + } + (void)fprintf (file, "\\makeatletter\n"); + (void)fprintf (file, "\\def\\indexhead#1#2#3{\\par\\if@nobreak \\everypar{}\\else\n"); + (void)fprintf (file, " \\addpenalty{\\@secpenalty}\\addvspace{#1}\\fi\n"); + (void)fprintf (file, " \\begingroup \\large\\bf \\hfil #3 \\hfil\\par \\endgroup\n"); + (void)fprintf (file, " \\@xsect{#2}}\n"); + (void)fprintf (file, "\\makeatother\n"); +/* + * Define the \indexindent macro: + * \indexindent == + * \par \hangindent 50pt \hspace*{40pt} + */ + (void)fprintf (file, "\\def\\indexindent{\\par\\hangindent 50pt\\hspace*{40pt}}\n"); +/* Start the index */ + (void)fprintf (file, "\\begin{theindex} \\raggedright\n"); + if (toc_flag == IDX_K_NONE) + { + if (mst_flag) + { + (void)fprintf(file, "\\typeout{Master Index.}\n"); + return; + } + return; + } + if (toc_flag == IDX_K_ARTICLE) + { + if (mst_flag) + { + (void)fprintf (file,"\\addcontentsline{toc}{section}{\\masterindexname}\\typeout{Master Index.}\n"); + } + else + { +(void)fprintf (file,"\\addcontentsline{toc}{section}{\\indexname}\\typeout{Index.}\n"); + } + } + if (toc_flag == IDX_K_REPORT) + { + if (mst_flag) + (void)fprintf (file,"\\addcontentsline{toc}{chapter}{\\masterindexname}\\typeout{Index.}\n"); + else + (void)fprintf (file,"\\addcontentsline{toc}{chapter}{\\indexname}\\typeout{Index.}\n"); + } + (void)printf("\nA Table of Contents entry will be made for the Index.\n"); +} + +/* + * Function Idx_New_Group - Documentation Section + * + * Discussion: + * Handle special processing at the boundaries between index entries + * which begin with different letters. + * + * Calling Synopsis: + * Call Idx_New_Group (test_char, node, file) + * + * Inputs: + * test_char -> is the character which is the first character + * of the current group. Passed by reference. + * + * node -> is the TREE_PTR for the current node. + * + * file -> is a file pointer for the output file. + * + * Outputs: + * test_char -> if a new group is declared, the test character + * is updated. + * + * Return Value: + * none + * + * Global Data: + * The Index Tree is read. + * + * Files Used: + * If a new group is declared, records are written to the output file. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Current_Char is the first character of the Spell String of the + * current node, or a space if the first character is not a letter. + * B. If Current_Char != Test_Char, + * 1. Generate commands. + * 2. Test_Char = Current_Char. + * + * Special Notes: + * none + */ +/* + * Function Idx_New_Group - Code Section + */ +void idx_new_group (test_char, node, file) + char *test_char; + TREE_PTR node; + FILE *file; +{ +/* + * Local Declarations + */ + char current_char = ' '; +/* + * Module Body + */ + if ((strlen(node->spell)) > 0) + current_char = node->spell[0]; + if (isalpha(current_char) == 0) current_char = ' '; + if ((current_char > 'a') && (current_char < 'z')) + current_char -= 32; + if (*test_char != current_char) { + if (current_char == ' ') + (void)fprintf (file, + "\\indexhead{2em}{1em}{--- \\symbolsname ---}\n"); + else + (void)fprintf (file, "\\indexhead{2em}{1em}{--- %c ---}\n", + current_char); + *test_char = current_char; + } +} + +/* + * Function Idx_Write - Documentation Section + * + * Discussion: + * Write the basic text line for the current entry. + * + * Calling Synopsis: + * Call Idx_Write (node, intro_str, file, mst_flag) + * + * Inputs: + * node -> TREE_PTR of the node whose data is to be reported. + * + * intro_str -> introductory character string, ASCIZ passed by ref. + * + * file -> file pointer for output file. + * + * mst_flag -> flag indicates if a master index is being generated. + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * The output file is written. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Print the first part of the string, containing the item. + * B. If there is at least one page number specified, + * 1. Print the first page number (which is formatted specially). + * 2. For all remaining page numbers, + * a. Print them. + * C. If there is at least one cross reference specified, + * 1. Print the "see" or "see also" line. + * 2. For all cross references, + * a. Print them. + * D. Print the record trailer. + * + * Special Notes: + * When printing page numbers, allow for page-no highlighting. The + * highlight code is specified in the pgnode list element. Recognized + * values are: + * IDX_K_NONE - No highlighting + * IDX_K_UNDERLINE - Underline the page number + * IDX_K_ITALIC - Italicize the page number + * IDX_K_BOLD - Boldface the page number + * IDX_K_FOLLOW - ff follows the page number + */ +/* + * Function Idx_Write - Code Section + */ +void idx_write (node, intro_str, file, mst_flag) + TREE_PTR node; + char *intro_str; + FILE *file; + int mst_flag; +{ +/* + * Local Declarations + */ + char string[256]; + int length; + PGNODE_PTR pgnode; + int highlight; + char *old_vol; +/* + * Module Body + */ + length = strlen(intro_str) + strlen(node->item) + 1; + (void)sprintf(string,"%s{%s",intro_str,node->item); + if (node->pghead != 0) { + idx_build_range(node); + pgnode = node->pghead; + if (mst_flag) { + (void)sprintf(&string[length], + "}\\indexindent{$\\bullet$ {\\sl %s}, ", + pgnode->vol); + length += strlen(pgnode->vol) + + strlen("}\\indexindent{$\\bullet$ {\\sl }, "); + old_vol = pgnode->vol; + } + else { + (void)sprintf (&string[length], ", "); + length += 2; + } + highlight = pgnode->highlight; + switch (highlight) { + case IDX_K_UNDERLINE : + (void)sprintf (&string[length], + "\\mbox{\\rm\\underline{%s}}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\rm\\underline{}}"); + break; + case IDX_K_ITALIC : + (void)sprintf (&string[length], "\\mbox{\\em %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\em }"); + break; + case IDX_K_BOLD : + (void)sprintf (&string[length], "\\mbox{\\bf %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\bf }"); + break; + case IDX_K_FOLLOW : + (void)sprintf (&string[length], "\\mbox{\\rm %s\\sf ff}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\rm \\sf ff}"); + break; + default : + (void)sprintf (&string[length], "\\mbox{\\rm %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\rm }"); + break; + } + while ((pgnode = pgnode->link) != 0) { + if (length > 62) { + (void)fprintf (file, "%s%%\n", string); + length = 0; + } + if (mst_flag) { + if ((strcmp(old_vol,pgnode->vol)) != 0) { + (void)sprintf (&string[length], + "}\\indexindent{$\\bullet$ {\\sl %s} ", + pgnode->vol); + length += strlen(pgnode->vol) + + strlen("}\\indexindent{$\\bullet$ {\\sl } "); + old_vol = pgnode->vol; + } + else { + (void)sprintf (&string[length], ", "); + length += 2; + } + } + else { + (void)sprintf (&string[length], ", "); + length += 2; + } + highlight = pgnode->highlight; + switch (highlight) { + case IDX_K_UNDERLINE : + (void)sprintf (&string[length], + "\\mbox{\\rm\\underline{%s}}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\rm\\underline{}}"); + break; + case IDX_K_ITALIC : + (void)sprintf (&string[length], "\\mbox{\\em %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\em "); + break; + case IDX_K_BOLD : + (void)sprintf(&string[length], "\\mbox{\\bf %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\bf "); + break; + case IDX_K_FOLLOW : + (void)sprintf(&string[length], + "\\mbox{\\rm %s\\sf ff}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\rm \\sf ff}"); + break; + default : + (void)sprintf (&string[length], "\\mbox{\\rm %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("\\mbox{\\rm }"); + break; + } + } + } + if (node->seehead != 0) { + pgnode = node->seehead; + if (mst_flag) { + if (node->pghead == 0) + (void)fprintf (file, "%s}\n\\indexindent{\\em \\seename", string); + else + (void)fprintf (file, "%s}\n\\indexindent{\\em \\alsoname", + string); + } + else { + if (node->pghead == 0) + (void)fprintf (file, "%s, {\\em \\seename}\n", string); + else + (void)fprintf (file, "%s; {\\em \\alsoname}\n", string); + } + length = 0; + while (pgnode != 0) { + if (length > 62) { + (void)fprintf (file, "%s%%\n", string); + length = 0; + } + highlight = pgnode->highlight; + switch(highlight) { + case IDX_K_UNDERLINE : + (void)sprintf (&string[length], + "}\\indexindent{\\ $\\bullet$ \\rm\\underline{%s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("}\\indexindent{\\ $\\bullet$ \\rm\\underline{}"); + break; + case IDX_K_ITALIC : + (void)sprintf (&string[length], + "}\\indexindent{\\ $\\bullet$ {\\em %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("}\\indexindent{\\ $\\bullet$ {\\em }"); + break; + case IDX_K_BOLD : + (void)sprintf (&string[length], + "}\\indexindent{\\ $\\bullet$ {\\bf %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("}\\indexindent{\\ $\\bullet$ {\\bf }"); + break; + default : + (void)sprintf (&string[length], + "}\\indexindent{\\ $\\bullet$ {\\rm %s}", + pgnode->page_dsc); + length += strlen(pgnode->page_dsc) + + strlen("}\\indexindent{\\ $\\bullet$ {\\rm }"); + break; + } + pgnode=pgnode->link; + } + } + (void)fprintf (file, "%s}\n", string); +} + +/* + * Function Idx_PostAmble - Documentation Sectionm + * + * Discussion: + * Write the lines which occur at the end of the file. + * + * Calling Synopsis: + * Call Idx_PostAmble (file); + * + * Inputs: + * file -> is the file pointer for the output file.* + * + * Outputs:r + * none + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * Output file is written. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Write the end-matter. + * + * Special Notes: + * none + */ +/* + * Function Idx_PostAmble - Code Section + */ +void idx_postamble (file) + FILE *file; +{ +/* + * Local Declarationst + */ +/* + * Module Body + */ + (void)fprintf (file, "\\end{theindex}\n"); +} diff --git a/indexing/glo+idxtex/idxmaster.c b/indexing/glo+idxtex/idxmaster.c new file mode 100644 index 0000000000..1244af462e --- /dev/null +++ b/indexing/glo+idxtex/idxmaster.c @@ -0,0 +1,246 @@ +/* #module IdxMaster "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ + +/* + * Module Name: IdxMaster + * + * Author: R L Aurbach CR&DS MIS Group 09-Apr-1987 + * + * Function: + * File processing routines for IdxTex + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 09-Apr-1987 Original Code + * 1-002 RLA 15-Apr-1987 Add support for cross-referencing + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxMaster - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define TRUE 1 +#define FALSE 0 +#define linebfsize 133 /* Maximum line buffer size */ +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +#ifdef MSDOS +void idx_process_file(char *filename, char *vol); +int idx_parse_master(char *linebf, char *filename, char *vol_ptr); +#else +void idx_process_file(); +int idx_parse_master(); +#endif +/* + * External References: + */ +#ifdef MSDOS +extern void idx_parse(char *linebf, char *token_1, char *token_2, + char *token_3, char *page_no, int *token_ct, int *flag); +extern void idx_build_tree(char *token_1, char *token_2, char *token_3, + char *page_no, char token_ct, char *vol, int flag); +extern int idx_extract(char *string, int *start, int *length); +#else +extern void idx_parse(); +extern void idx_build_tree(); +extern int idx_extract(); +#endif +/* + * Functions Called: + */ +/* + * Function Idx_Process_File - Documentation Section + * + * Discussion: + * Process an input file, building the internal tree structure. + * + * Calling Synopsis: + * call Idx_Process_File (filename, vol) + * + * Inputs: + * filename -> is a character string containing the file specification + * of the file to be processed. + * + * vol -> is a pointer to a character string descriptor for the + * volume name string of this volume. Used for processing + * master indices. + * + * Outputs: + * none + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * The specified input file is read. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * If the file does not exist, the file is ignored. + * + * Algorithm: + * A. Open the file. + * B. For all records in the file, + * 1. Read the next record. + * 2. Call Idx_Parse to parse the record into tokens. + * 3. Call Idx_Build_Tree to enter the information into the Index Tree. + * C. Close the file. + * + * Special Notes: + * none + */ +/* + * Function Idx_Process_File - Code Section + */ +void idx_process_file(filename, vol) + char *filename; /* Filename string */ + char *vol; /* Volume string pointer */ +{ +/* + * Local Declarations + */ + FILE *file; /* File pointer */ + char linebf[linebfsize]; /* I/O line buffer */ + char tok_1[linebfsize]; /* 1st token */ + char tok_2[linebfsize]; /* 2nd token */ + char tok_3[linebfsize]; /* 3rd token */ + char pg_no[linebfsize]; /* Page number ref */ + int tok_ct; /* Token count */ + int flag; /* Xref flag */ + char dna[133]; +/* + * Module Body + */ + (void)sprintf(dna, "%s.idx", filename); + if ((file = fopen(dna, "r")) == NULL) { + (void)printf("Could not open input file %s -- File ignored\n", + filename); + return; + } + while (fgets(linebf, linebfsize, file) != 0) { + idx_parse (linebf, tok_1, tok_2, tok_3, pg_no, &tok_ct, &flag); + idx_build_tree (tok_1, tok_2, tok_3, pg_no, (char)tok_ct, vol, flag); + } + (void)fclose(file); +} +/* + * Function Idx_Parse_Master - Documentation Section + * + * Discussion: + * Parse a line of the Master Index file and return a flag indicating + * whether a valid line of input was found. + * + * Calling Synopsis: + * ok = Idx_Parse_Master (linebf, filename, vol_ptr); + * + * Inputs: + * linebf -> is the input line buffer, passed as an ASCIZ string. + * + * Outputs: + * filename -> is the file specification of the input file to be + * processed, passed as an ASCIZ string. + * + * vol_ptr -> is a pointer to a character string descriptor which + * describes the label associated with this file, passed + * by reference. + * + * Return Value: + * ok -> is a boolean flag + * + * Global Data: + * none + * + * Files Used: + * In practice, the source of the input linebf is a file. However, the + * routine does no file I/O itself. + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * ok = TRUE A valid line was seen and parsed. + * ok = FALSE The line was not valid -- it is treated as a comment. + * + * Error Conditions: + * none + * + * Algorithm: + * A. Verify that the line has the form "\usefile{label}{file}" + * B. Parse "label" as the volume string. + * C. Parse "file" as the filename. + * + * Special Notes: + * none + */ +/* + * Function Idx_Parse_Master - Code Section + */ +int idx_parse_master(linebf, filename, vol_ptr) + char *linebf; /* Input line buffer */ + char *filename; /* Filename string */ + char *vol_ptr; /* Volume string pointer */ +{ +/* + * Local Declarations + */ + int i; /* Start of String index */ + int len; /* Length of string */ + int next; /* next substring index */ +/* + * Module Body + */ + if (strncmp(linebf, "\\usefile{", 9) != 0) return (FALSE); + if (vol_ptr == 0) return (FALSE); + i = 8; + next = idx_extract(linebf, &i, &len); + if (len > 0) (void)strncpy(vol_ptr,&linebf[i],len); + i = next; + next = idx_extract(linebf, &i, &len); + if (len == 0) return (FALSE); + (void)strncpy (filename, &linebf[i], len); + filename[len] = '\0'; + return (TRUE); +} diff --git a/indexing/glo+idxtex/idxparse.c b/indexing/glo+idxtex/idxparse.c new file mode 100644 index 0000000000..9e46e10229 --- /dev/null +++ b/indexing/glo+idxtex/idxparse.c @@ -0,0 +1,351 @@ +/* #module IdxParse "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ + +/* + * Module Name: IdxParse + * + * Author: R L Aurbach CR&DS MIS Group 26-Apr-1986 + * + * Function: + * Parse an input line produced by LaTeX \index command into a form usable + * for the generation of an automatic index. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 26-Apr-1986 Original Code + * 2-002 RLA 10-Apr-1987 Add support for the Idx_Extract routine. + * 2-003 RLA 15-Apr-1987 Add support for cross-referencing + * 2-004 RLA 20-Apr-1987 Change the cross reference symbol to + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxParse - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define TRUE 1 +#define FALSE 0 +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +#ifdef MSDOS +void idx_parse(char *linebf, char *token_1, char *token_2, + char *token_3, char *page_no, int *token_ct, int *flag); +int idx_extract(char *string, int *start, int *length); +#else +void idx_parse(); +int idx_extract(); +#endif +/* + * External References: + */ +/* + * Functions Called: + */ +/* + * Function Idx_Parse - Documentation Section + * + * Discussion: + * Parse an input line which is of the general form + * \indexentry{token_1>token_2>token_3}{page_no} + * into tokens for "token_1", "token_2", "token_3", and "page_no". + * Handle missing tokens and allow for imbedded LaTeX commands. + * + * Calling Synopsis: + * Call Idx_Parse (linebf, token_1, token_2, token_3, page_no, token_ct, + * flag) + * + * Inputs: + * linebf -> is the input string containing the line to parse. + * ASCIZ string passed by reference. + * + * Outputs: + * token_1 -> is the first token seen (if any). + * ASCIZ string passed by reference. + * + * token_2 -> is the second token seen (if any). + * ASCIZ string passed by reference. + * + * token_3 -> is the third token seen (if any). + * ASCIZ string passed by reference. + * + * page_no -> is the page number token (should always be present). + * ASCIZ string passed by refernce. + * + * token_ct -> is the number of tokens seen. + * Integer passed by reference. + * + * flag -> indicates if the page reference is a cross-reference. + * Boolean passed by reference. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * returns with the record processed. + * + * Error Conditions: + * none + * + * Algorithm: + * A. Initialize variables. + * B. Verify that the line begins with \indexentry. + * C. Extract the index item substring. + * D. Parse it into tokens. + * E. Extract the page reference substring. + * + * Special Notes: + * This logic is designed to: + * * copy sequences such as \{, \}, and $>$ from the input stream + * into tokens without recognizing them as token delimiters. + * * allow sequences such as {\bf text} in token without recognizing + * the special characters as delimiters. + * * allow up to three levels of index and one level of page-no, + * ignoring all other characters (which shouldn't exist...) + */ +/* + * Function Idx_Parse - Code Section + */ +void idx_parse(linebf,token_1,token_2,token_3,page_no,token_ct,flag) + char *linebf; /* Input string to be parsed */ + char *token_1; /* First token string */ + char *token_2; /* Second token string */ + char *token_3; /* Third token string */ + char *page_no; /* Page number token string */ + int *token_ct; /* Number of item tokens seen */ + int *flag; /* Cross-Reference flag */ +{ +/* + * Local Declarations + */ + int i; /* linebf counter */ + int next; /* beginning of next substring */ + int len; /* length of substring */ + int math_mode = FALSE; /* math-mode flag */ + char *ptr; /* pointer to token buffer */ + int index; /* index into token buffer */ + int end; /* end of substring */ + int dummy; +/* + * Module Body + */ +/* Initialize assorted variables, flags, etc. */ + token_1[0] = '\0'; + token_2[0] = '\0'; + token_3[0] = '\0'; + page_no[0] = '\0'; + *token_ct = 0; + *flag = FALSE; + ptr = token_1; + index = 0; +/* Verify that the string begins with \indexentry */ + if (strncmp(linebf, "\\indexentry{", 12) != 0) return; +/* Locate the first substring. */ + i = 11; + next = idx_extract(linebf, &i, &len); + if (len == 0) return; + *token_ct = 1; + end = i + len; +/* For all characters in the substring, parse out the tokens. */ + for ( ; i < end; i++) { + switch (linebf[i]) { + case '$' : + if (linebf[i-1] != '\\') { + if (math_mode) math_mode = FALSE; + else math_mode = TRUE; + } + ptr[index++] = linebf[i]; + break; + case '>' : + if (math_mode) ptr[index++] = linebf[i]; + else { + if (index == 0) break; + ptr[index] = '\0'; + index = 0; + switch (*token_ct) { + case 1 : + ptr = token_2; *token_ct = 2; break; + case 2 : + ptr = token_3; *token_ct = 3; break; + } + } + break; + case '&' : + if (linebf[i-1] == '\\') { + ptr[index++] = linebf[i]; + break; + } + ptr[index] = '\0'; + dummy = end-i; + (void)sprintf(page_no, "\\indexentry{%.*s}{}", + dummy, &linebf[++i]); + *flag = TRUE; + return; + default : + ptr[index++] = linebf[i]; break; + } + } + ptr[index] = '\0'; +/* Now parse the second substring and copy it to the page-ref. */ + i = next; + next = idx_extract(linebf, &i, &len); + (void)strncpy (page_no, &linebf[i], len); + page_no[len] = '\0'; +} + +/* + * Function Idx_Extract - Documentation Section + * + * Discussion: + * Extract a string contained within a {} pair, which may contain imbedded + * LaTeX commands. + * + * Calling Synopsis: + * next = Idx_Extract (string, start, length) + * + * Inputs: + * string -> is an ASCIZ string containing a substring enclosed in + * matching braces ({}). + * + * start -> is the string index of the first character of the + * string to be searched. It is passed by reference. + * + * Outputs: + * start -> is the string index of the first character of the + * substring, passed by reference. + * + * length -> is the number of characters in the substring, passed by + * reference. + * + * Return Value: + * next -> is the string index of the first character after the + * '}' which terminates the substring. If the substring + * is not terminated by '}', next is the string index of + * the '\0' character. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Scan the string for the first '{'. + * B. For all succeeding characters in the string, + * 1. If the character is '{' (not preceeded by '\\'), + * a. Increment the brace count. + * 2. If the character is '}' (not preceeded by '\\'), + * a. Decrement the brace count. + * b. If the brace count = 0, + * 1. Return the start and length of the substring. + * + * Special Notes: + * none + */ +/* + * Function Idx_Extract - Code Section + */ +int idx_extract (string, start, length) + char *string; + int *start; + int *length; +{ +/* + * Local Declarations + */ + int i; /* string index */ + int brace_ct = 0; /* brace count */ +/* + * Module Body + */ +/* + * Scan the string for the first occurrence of a '{' character which is not + * preceeded by a '\\'. The next character marks the beginning of the + * substring to be extracted. + */ + for (i = *start; string[i] != '\0'; i++) { + if (string[i] != '{') continue; + if (i > 0) if (string[i-1] == '\\') continue; + *start = i + 1; + brace_ct++; + break; + } +/* + * If brace_ct == 0, no leading { was found. This is an error. Return + * start = next = end-of-string and length = 0. + */ + if (brace_ct == 0) { + *start = sizeof(string); + *length = 0; + return (sizeof(string)); + } +/* + * Now search the string for a matching }. + */ + for (i = *start; string[i] != '\0'; i++) { + if ((string[i] == '{') && (string[i-1] != '\\')) brace_ct++; + if ((string[i] == '}') && (string[i-1] != '\\')) { + brace_ct--; + if (brace_ct == 0) { + *length = i - *start; + return (i + 1); + } + } + } +/* + * If we get here, no closing } was found. Treat the end of string as a + * matching }. + */ + *length = sizeof(string) - *start; + return (sizeof(string)); +} diff --git a/indexing/glo+idxtex/idxrange.c b/indexing/glo+idxtex/idxrange.c new file mode 100644 index 0000000000..b4d9fb6a8a --- /dev/null +++ b/indexing/glo+idxtex/idxrange.c @@ -0,0 +1,713 @@ +/* #module IdxRange "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: IdxRange + * + * Author: R L Aurbach CR&DS MIS Group 07-Apr-1987 + * + * Function: + * Examine the list of page references to build range references. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 07-Apr-1987 Original Code + * 1-002 RLA 14-Apr-1987 Fix algorithm for processing ranges + * which contain highlights. + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxRange - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +#endif +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define IDX_K_START 1 /* Start of range */ +#define IDX_K_MIDDLE 2 /* Middle of range */ +#define IDX_K_END 3 /* End of range */ +#define IDX_K_SIMPLE 0 /* Simple page-ref */ +#define IDX_K_COMPLEX 1 /* Complex page-ref */ +#define TRUE 1 +#define FALSE 0 +typedef struct { + char *vol; /* Volume string ptr */ + char *page_dsc; /* Page-ref string */ + char highlight; /* Highlight flag */ + char adjacent; /* Adjacency flag */ + char flag; /* Range type flag */ + char type; /* Page-ref type flag */ + int start; /* Start of range */ +} TABLE, *TABLE_PTR; +typedef struct { + char *vol; /* Volume string ptr */ + char *chapter; /* Chapter string */ + int page; /* Page number */ + char type; /* Page-ref type flag */ +} CMP, *CMP_PTR; +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +#ifdef MSDOS +void idx_build_range(TREE_PTR node); +void idx_page_parse(TABLE_PTR elem, CMP_PTR cmp); +int idx_is_adjacent(CMP_PTR curr, CMP_PTR prev); +void idx_deallocate_pglist(TREE_PTR node); +void idx_build_new_pglist(TREE_PTR node, TABLE_PTR table, int size); +void idx_allocate_new_pgnode(PGNODE_PTR *ptr, TREE_PTR node); +#else +void idx_build_range(); +void idx_page_parse(); +int idx_is_adjacent(); +void idx_deallocate_pglist(); +void idx_build_new_pglist(); +void idx_allocate_new_pgnode(); +#endif +static char *dash = "-"; +static char *simple = "--"; +static char *complex = " to "; +/* + * External References: + */ +#ifdef MSDOS +extern int strposition(char *str, char *e_array, int st); +#else +int strposition(); +#endif +/* + * Functions Called: + */ +/* + * Function Idx_Build_Range - Documentation Section + * + * Discussion: + * Examine a list of page references. If the list contains any pages + * which are in consecutive order, build a new list of page references + * which contain one or more range specifications. + * + * Calling Synopsis: + * Call Idx_Build_Range (node) + * + * Inputs: + * node -> pointer to the current node of the item tree. + * + * Outputs: + * none -> pointer to the current node of the item tree. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Count the number of page references in the current list. + * 1. If less than 2, there is nothing to do. + * B. Allocate a TABLE structure big enough to hold all the references. + * C. For each reference, + * 1. Fill in the TABLE entry. + * 2. Call Idx_Page_Parse to parse the page reference and place the + * results of the parse operation in the "new" CMP structure. + * 3. Call Idx_Is_Adjacent to compare the information in the "old" + * and "new" CMP structures to determine if the page number is + * adjacent to the previous one. + * 4. If it is, + * a. Set the adjacent flag in the TABLE entry. + * b. Set the "ranges_found" flag. + * D. If no ranges were found, + * 1. Deallocate the TABLE. + * 2. Return. + * E. Else, + * 1. Process the TABLE to set up the "flag" and "start" fields. + * 2. Call Idx_Deallocate_PgList to deallocate the old page-refs. + * 3. Call Idx_Build_New_PgList to allocate a new page-ref list. + * 4. Deallocate the TABLE. + * + * Special Notes: + * none + */ +/* + * Function Idx_Build_Range - Code Section + */ +void idx_build_range(node) + TREE_PTR node; /* Current tree node */ +{ +/* + * Local Declarations + */ + PGNODE_PTR pgnode; /* Current page node */ + int ref_ct = 0; /* Number of page nodes */ + TABLE_PTR table; /* Local structure pointer */ + int ranges_found = FALSE; /* Ranges found flag */ + CMP old; /* Parse struct for prev ref */ + CMP new; /* Parse struct for curr ref */ + int i, j; /* Table index */ +/* + * Module Body + */ +/* + * Count the number of page references for the current tree node. + * If there are less than 2, there is nothing to do -- no ranges are possible. + */ + pgnode = node->pghead; + while (pgnode != 0) { + ref_ct++; + pgnode = pgnode->link; + } + if (ref_ct < 2) return; +/* + * Allocate an internal data table sufficiently large to contain all of the + * existing page reference entries. + */ + table = (TABLE_PTR) malloc ((unsigned int)ref_ct * sizeof(TABLE)); + if (table == 0) return; +/* + * Initialize the previous page reference parse structure to null. + */ + old.vol = 0; + old.page = 0; + old.type = IDX_K_SIMPLE; + pgnode = node->pghead; +/* + * For each page reference in the page reference list, we must build the + * appropriate entry in the internal data table. To do this, we first + * initialize the entry using the available data. + */ + for (i = 0; i < ref_ct; i++) { + table[i].vol = pgnode->vol; + table[i].page_dsc = pgnode->page_dsc; + table[i].highlight = pgnode->highlight; + table[i].adjacent = FALSE; + table[i].flag = IDX_K_NONE; + table[i].type = IDX_K_SIMPLE; + table[i].start = 0; + pgnode = pgnode->link; +/* + * Now we parse the page descriptor and fill out the data structure used + * for comparison and compare it against the previous page reference. If + * the pages are consecutive, we flag the table entry and set the ranges_found + * flag. Finally, we copy the new structure to the old structure to prepare + * for the next iteration. + */ + idx_page_parse (&table[i], &new); + if (idx_is_adjacent (&new, &old)) { + table[i].adjacent = TRUE; + ranges_found = TRUE; + } + free((char *)&old.chapter); + old = new; + } +/* + * Since we are now done with the "old" and "new" structures, deallocate + * the dynamic strings they reference. (So that we don't forget). + */ + free((char *)&old.chapter); /* Just once, please! */ +/* + * If we haven't found any ranges, then all of this analysis was for nought. + * We just deallocate the table and leave, with the initial list intact. + */ + if (!ranges_found) { + free((char *)&table); + return; + } +/* + * At this point, we know we have found at least one range, so we have work + * to do. First, we need to process the table so that the "flag" and "start" + * fields are set up correctly. + */ + for (i = 1; i < ref_ct; i++) { +/* + * If the current entry is part of a range and has the FOLLOW highlight, then + * make sure that every element of the range has the same highlight. + */ + if (table[i].adjacent && table[i].highlight == IDX_K_FOLLOW) { + if (table[i-1].flag == IDX_K_NONE) + table[i-1].highlight = IDX_K_FOLLOW; + else + for (j = table[i-1].start; j < i; j++) + table[j].highlight = IDX_K_FOLLOW; + } +/* + * If the current entry is part of a range which has the FOLLOW highlight, then + * it should have that highlight also. + */ + if (table[i].adjacent && table[i-1].highlight == IDX_K_FOLLOW) + table[i].highlight = IDX_K_FOLLOW; +/* + * If the current entry is part of a range, then update the flag and start + * values in the table. + */ + if (table[i].adjacent && (table[i].highlight + == table[i-1].highlight)) { + if (table[i-1].flag == IDX_K_NONE) { + table[i-1].flag = IDX_K_START; + table[i-1].start = i-1; + } + table[i].flag = IDX_K_MIDDLE; + table[i].start = table[i-1].start; + } +/* + * If the entry is not part of a range, then if the preceeding entry was part + * of a range, it was the end of that range. Mark it so. + */ + else { + if (table[i-1].flag == IDX_K_MIDDLE) + table[i-1].flag = IDX_K_END; + } + } +/* + * If the last entry in the table was part of a range, it hasn't been correctly + * marked that way yet. Do so now. + */ + if (table[ref_ct-1].flag == IDX_K_MIDDLE) + table[ref_ct-1].flag = IDX_K_END; +/* + * At this point, we know we are going to create a new page-ref list, so we + * can deallocate the old list. Note that we don't need to free any strings, + * because they are all contained in the data table... + */ + idx_deallocate_pglist (node); +/* + * Now we use the information in the table to build the new page-ref list. + */ + idx_build_new_pglist (node, table, ref_ct); +/* + * We are done. To clean up correctly, we must deallocate the table. To + * do this, we first deallocate any strings which are defined in the table, + * then deallocate the table. This should clean up virtual memory usage + * nicely. + */ + for (i = 0; i < ref_ct; i++) free((char *)table[i].page_dsc); + free ((char *)&table); +} + +/* + * Function Idx_Page_Parse - Documentation Section + * + * Discussion: + * Parse a page number into its component parts. + * + * Calling Synopsis: + * call Idx_Page_Parse (elem, cmp) + * + * Inputs: + * elem -> is an element of the table array, describing the + * current page reference. It is passed by reference. + * + * Outputs: + * elem -> is an element of the table array, describing the + * current page reference. It is passed by reference. + * The "type" flag is updated. + * + * cmp -> is the comparison data structure into which the data + * for this page reference is parsed. It is passed by + * reference. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Initialize the output data structure. + * B. If the input string contains a '-', + * 1. Copy the characters prior to the '-' to the chapter string. + * 2. Set the flags to mark this page number as complex. + * C. Skip over any '-'s. + * D. Convert the rest of the string to an integer. + * + * Special Notes: + * none + */ + +/* + * Function Idx_Page_Parse - Code Section + */ +void idx_page_parse (elem, cmp) + TABLE_PTR elem; /* Pointer to a table entry */ + CMP_PTR cmp; /* Pointer to a CMP structure */ +{ +/* + * Local Declarations + */ + int i; /* String Index */ + char *temp; +/* + * Module Body + */ +/* Initialize the cmp structure. */ + cmp->vol = elem->vol; + cmp->page = 0; + cmp->type = IDX_K_SIMPLE; +/* + * This routine assumes that the chapter string is delimited by one or more + * "-" characters. Determine if the page reference string contains such a + * delimiter. If it does, then copy the chapter portion of the string to + * the output string and set the "type" field to IDX_K_COMPLEX. + */ + i = strposition(elem->page_dsc, dash, 0); + if (i != -1) { + i--; + (void)strncpy(cmp->chapter, elem->page_dsc, i); + cmp->type = IDX_K_COMPLEX; + elem->type = IDX_K_COMPLEX; + } +/* Skip all dash characters. */ + while (elem->page_dsc[i] == '-') i++; + if (i<0) i=0; +/* Convert the page number to an integer */ + temp = strdup(&elem->page_dsc[i]); + (void)sscanf(temp, "%d", &cmp->page); +} + +/* + * Function Idx_Is_Adjacent - Documentation Section + * + * Discussion: + * Compare two page references and determine if the first is adjacent + * to the second. + * + * Calling Synopsis: + * boolean = Idx_Is_Adjacent (curr, prev) + * + * Inputs: + * curr -> is the CMP data structure for the current page ref, + * passed by reference. + * + * prev -> is the CMP data structure for the previous page ref, + * passed by reference. + * + * Outputs: + * none + * + * Return Value: + * boolean -> is a boolean result, passed by value. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * boolean = TRUE Pages are consecutive. + * boolean = FALSE Pages are not consecutive. + * + * Error Conditions: + * none + * + * Algorithm: + * A. If the page refs don't have the same type, return FALSE. + * B. If the page refs don't have the same vol-string ptr, return FALSE. + * C. If the page ref type is COMPLEX, + * 1. If the two chapter strings are not the same, return FALSE. + * D. If the page numbers are not consecutive, return FALSE. + * E. Return TRUE. + * + * Special Notes: + * none + */ +/* + * Function Idx_Is_Adjacent - Code Section + */ +int idx_is_adjacent (curr, prev) + CMP_PTR curr; /* Current page-ref structure */ + CMP_PTR prev; /* Previous page-ref structure */ +{ +/* + * Local Declarations + */ +/* + * Module Body + */ + if (curr->type != prev->type) return(FALSE); + if (prev->vol == 0) return(FALSE); + if ((strcmp(curr->vol,prev->vol)) != 0) return(FALSE); + if (curr->type == IDX_K_COMPLEX) + if (strcmp(curr->chapter, prev->chapter) != 0) return(FALSE); + if ((curr->page == prev->page) + || (curr->page == (prev->page + 1))) return(TRUE); + return(FALSE); +} + +/* + * Function Idx_Deallocate_PgList - Documentation Section + * + * Discussion: + * Deallocate the old page list for the current tree node. + * + * Calling Synopsis: + * call Idx_Deallocate_PgList (node) + * + * Inputs: + * node -> is the current tree node, passed by ref. + * + * Outputs: + * node -> is the current tree node, passed by ref. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. While the page listhead is not empty, + * 1. Unlink the current top of the list. + * 2. Deallocate it. + * + * Special Notes: + * none + */ +/* + * Function Idx_Deallocate_PgList - Code Section + */ +void idx_deallocate_pglist (node) + TREE_PTR node; +{ +/* + * Local Declarations + */ + PGNODE_PTR curr; /* Current page node */ +/* + * Module Body + */ + while (node->pghead != 0) { + curr = node->pghead; + node->pghead = curr->link; + free((char *)curr); + } +} + +/* + * Function Idx_Build_New_PgList - Documentation Section + * + * Discussion: + * Use the data table to construct a new pagelist. + * + * Calling Synopsis: + * call Idx_Build_New_PgList (node, table, size) + * + * Inputs: + * node -> is the current tree node, passed by reference. + * + * table -> is the data table, passed by reference. + * + * size -> is the number of elements in the table, passed by value. + * + * Outputs: + * node -> is the current tree node, passed by reference. The + * new page list is linked to the pghead. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * The tree node has a null page list. + * + * Normal Exit State:* + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. For each entry in the table, + * 1. If the entry is not part of a range, + * a. Allocate a new element for the page list. + * b. Fill it out. + * 2. If the entry is the beginning of a range, + * a. Allocate a new element for the page list. + * b. Begin filling out the page list element. + * 3. If the entry is the middle of a range, + * a. Ignore it. + * 4. If the entry is the end of a range, + * a. Complete filling out the page list element. + * + * Special Notes:o + * nonet + */ +/* + * Function Idx_Build_New_PgList - Code Sectionm + */ +void idx_build_new_pglist (node, table, size) + TREE_PTR node; + TABLE_PTR table; + int size; +{ +/* + * Local Declarations + */ + PGNODE_PTR ptr = 0; /* New PageRef Pointer */ + int i; /* Current table entry */ +/* + * Module Body + */ + for (i = 0; i < size; i++) { + switch (table[i].flag) { + case IDX_K_NONE: + idx_allocate_new_pgnode(&ptr, node); + ptr->vol = table[i].vol; + (void)strcpy(ptr->page_dsc, table[i].page_dsc); + ptr->highlight = table[i].highlight; + break; + case IDX_K_START: + idx_allocate_new_pgnode(&ptr, node); + ptr->vol = table[i].vol; + (void)strcpy(ptr->page_dsc, table[i].page_dsc); + if ((ptr->highlight = table[i].highlight) == IDX_K_FOLLOW) + break; + if (table[i].type == IDX_K_SIMPLE) + (void)strcat(ptr->page_dsc, simple); + else (void)strcat(ptr->page_dsc, complex); + break; + case IDX_K_MIDDLE: + break; + case IDX_K_END: + if (ptr->highlight != IDX_K_FOLLOW) + (void)strcat(ptr->page_dsc, table[i].page_dsc); + break; + } + } +} + +/* + * Function Idx_Allocate_New_PgNode - Documentation Section + * + * Discussion: + * Allocate and link a new page-ref node into the current list. + * + * Calling Synopsis: + * call Idx_Allocate_New_PgNode(ptr, node) + * + * Inputs: + * ptr -> is the current page-ref node pointer, passed by ref. + * + * node -> is the current tree-node pointer. + * + * Outputs: + * ptr -> is the new page-ref pointer, passed by reference.r + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * nones + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none; + * + * Error Conditions: + * none + * + * Algorithm: + * A. Allocate a new pgnode. + * B. Link it into the chain after the current pointer. + * + * Special Notes: + * none + */ +/* + * Function Idx_Allocate_New_PgNode - Code Section + */ +void idx_allocate_new_pgnode (ptr, node) + PGNODE_PTR *ptr; /* Page-Ref Node Pointer */ + TREE_PTR node; /* Node pointer */ +{ +/* + * Local Declarations + */ + PGNODE_PTR new; /* New Page-Ref Node Ptr */ +/* + * Module Body + */ + new = (PGNODE_PTR) malloc(sizeof(PGNODE)); + new->link = 0; + new->vol = 0; + new->highlight = IDX_K_NONE; + if ((*ptr) == 0) node->pghead = new; + else (*ptr)->link = new; + new->page_dsc = malloc(133); + *ptr = new; +} diff --git a/indexing/glo+idxtex/idxspell.c b/indexing/glo+idxtex/idxspell.c new file mode 100644 index 0000000000..5e526a754e --- /dev/null +++ b/indexing/glo+idxtex/idxspell.c @@ -0,0 +1,989 @@ +/* #module IdxSpell "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: IdxSpell + * + * Author: R L Aurbach CR&DS MIS Group 07-May-1986 + * + * Function: + * Build the Spell String for an index term, properly handling LaTeX + * syntax and commands. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 07-May-1986 Original Code + * 1-002 RLA 17-Mar-1987 Fix \verb error + * 1-003 RLA 06-Apr-1987 Fix error processing emphasis + * 2-004 RLA 16-Apr-1987 Honor the \verb environment in spelling + * 2-005 RLA 20-Apr-1987 Enhance at-sign string + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxSpell - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +#include +extern char *sprintf(); +#endif +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define TRUE 1 +#define FALSE 0 +/* + * Global Declarations: + */ +/* + * Static Declarations: + */ +#ifdef MSDOS +void idx_build_spell_string(char *desc); +void idx_replace_string(char *string, int start, int length, char *replace); +void idx_collapse_string(char *string); +void idx_process_accent(char *string); +void idx_process_groups(char *string); +int idx_process_verb(char *string); +void idx_process_backslash(char *string); +void idx_process_emphasis(char *string); +int idx_is_verbatim(char *desc, int *ctx, int *index); +void strupcase(char *in, char *out); +void strprefix(char *str, char prefix); +int strposition(char *str, char *e_array, int st); +int chrposition(char str, char *e_array); +#else +void idx_build_spell_string(); +void idx_replace_string(); +void idx_collapse_string(); +void idx_process_accent(); +void idx_process_groups(); +int idx_process_verb(); +void idx_process_backslash(); +void idx_process_emphasis(); +int idx_is_verbatim(); +void strupcase(); +void strprefix(); +int strposition(); +int chrposition(); +#endif +static char *accent_set = "`'^\"~=.uvHtcdb"; +#define emphasis_array_count 18 + static char *emphasis_array[emphasis_array_count] = { + "\\rm", + "\\em", + "\\bf", + "\\it", + "\\sf", + "\\sl", + "\\sc", + "\\tt", + "\\normalsize", + "\\small", + "\\tiny", + "\\footnotesize", + "\\large", + "\\Large", + "\\LARGE", + "\\huge", + "\\Huge", + "\\cal"}; +static char at_sign = '@'; +static char *verb = "\\verb"; +/* + * External References: + */ +/* + * Functions Called: + */ +/* + * Function Idx_Build_Spell_String - Documentation Section + * + * Discussion: + * Create a string which can be used to put the token in the right place + * in a list of tokens. The string will be UPPERCASE, will exclude + * internal LaTeX commands which are included for emphasis, and will have + * whitespace collapsed into single spaces. + * + * Calling Synopsis: + * Call Idx_Build_Spell_String (token, desc) + * + * Inputs: + * token -> is the token to be processed. ASCIZ string passed by + * reference. + * + * Outputs: + * desc -> is the "Spell String", properly formulated. Passed by + * dynamic string descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Copy the token into a dynamic string. + * B. Process Accent commands in the string. + * C. Process emphasis commands in the string. + * D. Remove grouping characters in the string. + * E. Remove backslashes in the string. + * F. Process \verb commands in the string. + * G. Clean up the string. + * 1. Convert it to upper case. + * 2. Collapse the string -- i.e., remove non-essential whitespace. + * 3. If the string begins with a \, remove it. + * 4. Make sure that all strings beginning with symbols are in the + * right place. + * + * Special Notes: + * none + */ + +/* + * Function Idx_Build_Spell_String - Code Section + */ +void idx_build_spell_string (desc) + char *desc; +{ +/* + * Local Declarations + */ +/* + * Module Body + */ +/* Copy the token string into a dynamic string for processing */ +/* Process accent strings */ + idx_process_accent(desc); +/* Process emphasis commands */ + idx_process_emphasis(desc); +/* Remove grouping characters */ + idx_process_groups(desc); +/* Remove backslashes */ + idx_process_backslash(desc); +/* Process \verb commands */ + while (idx_process_verb(desc)) ; +/* Clean up the string */ + strupcase(desc, desc); + idx_collapse_string (desc); + if (desc[0] == '\\') idx_replace_string(desc, 1, 1, (char *)0); + if (desc[0] > 'Z') strprefix(desc, at_sign); +} + +/* + * Function Idx_Replace_String - Documentation Section + * + * Discussion: + * This function replaces a specified substring in a dynamic string with + * a specified replacement string. + * + * Calling Synopsis: + * Call Idx_Replace_String (string, start, length, replace) + * + * Inputs: + * string -> is the string to be updated. The string is a dynamic + * string, passed by descriptor. + * + * start -> is the starting position in the string. The first + * position in the string is position 1. Integer passed + * by value. + * + * length -> is the number of characters in the substring to be + * replaced. Integer passed by value. + * + * replace -> is the replacement text. ASCIZ string passed by + * reference. + * + * Outputs: + * string -> is the updated string. It is a dynamic string, passed + * by descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. Copy the characters up to the first character in the substring to + * be replaced into a temporary string. + * B. Copy the replacement string into the temporary string. + * C. Copy the remainder of the initial string into the temporary string. + * D. Update the initial string. + * + * Special Notes: + * It is assumed that the updated string will be no more than 132 + * characters long. + */ + +/* + * Function Idx_Replace_String - Code Section + */ +void idx_replace_string (string, start, length, replace) + char *string; + int start; + int length; + char *replace; +{ +/* + * Local Declarations + */ + int new_length; /* length of new string */ + int rpl_length; /* length of the replace string */ + int left; /* number of characters left */ + char temp[133]; /* temporary string */ +/* + * Module Body + */ + new_length = 0; + if (start > 1) { + (void)strncpy(temp, string, start-1); + new_length = start-1; + } + if (replace != 0) { + rpl_length = strlen(replace); + if (rpl_length > 0) { + (void)strncpy(&temp[new_length], replace, rpl_length); + new_length += rpl_length; + } + } + left = strlen(string) - (start - 1) - length; + if (left > 0) { + (void)strncpy(&temp[new_length], &string[start+length-1], left); + new_length += left; + } + temp[new_length] = '\0'; + string = strcpy(string, temp); +} + +/* + * Function Idx_Collapse_String - Documentation Section + * + * Discussion: + * Replace the string with a new string which as all extraneous whitespace + * removed. That is, there is no whitespace at the beginning or end of + * the string and every internal occurrence of whitespace is collapsed to + * a single space character. + * + * Calling Synopsis: + * Call Idx_Collapse_String (string) + * + * Inputs: + * string -> is the input string. It is a dynamic string, passed by + * descriptor. + * + * Outputs: + * string -> is the output string. It is a dynamic string, passed by + * descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. For all characters in the input string, + * 1. If the character is whitespace, + * a. If no characters have been transferred, + * 1. Ignore it. + * b. If the previous character transferred was a space, + * 1. Ignore it. + * c. Else, + * 1. Copy a space to the output string. + * 2. Else, + * a. Copy the character to the output string. + * B. If the last character in the output string is a space, + * 1. Remove it. + * C. Update the dynamic string. + * + * Special Notes: + * It is assumed that the collapsed string will be no more than 132 + * characters long. + */ + +/* + * Function Idx_Collapse_String - Code Section + */ +void idx_collapse_string (string) +char *string; +{ +/* + * Local Declarations + */ + char temp[133]; /* Working output string */ + char copy; /* Working character */ + int i; /* Array index in input string */ + int j; /* Array index in temp string */ +/* + * Module Body + */ + for (i=0, j=0; i 0) && (temp[j-1] == ' ')) j--; +/* Now copy the result to the output string */ + temp[j] = '\0'; + (void)strcpy(string, temp); +} + +/* + * Function Idx_Process_Accents - Documentation Section + * + * Discussion: + * This routine processes the spell string to remove all LaTeX commands + * which generate accents, without changing the spelling. For example, + * the string "se\~{n}or" is translated to "senor". Without special + * accent processing, the spell-string algorithm would produce "se n or", + * which might not appear in the proper place in the alphabetical listing. + * + * Calling Synopsis: + * call Idx_Process_Accents (string) + * + * Inputs: + * string -> is the spell-string to be processed. It is a dynamic + * string, passed by descriptor. + * + * Outputs: + * string -> is the resultant spell-string. It is a dynamic string, + * passed by descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm:. + * A. Search the string for an accent pattern: + * 1. The first character in the pattern is "\". + * 2. The next character in the pattern is one of the characters in + * the accent_set. + * 3. The next character in the pattern is "{". + * B. Mark the pattern and find the terminating "}". + * C. Replace the pattern with the string located within the braces. + * + * Special Notes: + * none + */ +/* + * Function Idx_Process_Accent - Code Section + */ +void idx_process_accent(string) +char *string; +{ +/* + * Local Declarations + */ + char accent_str = '\0'; + int start; /* Start of string to replace */ + char *replace; /* Replacement string */ + int i; /* Loop index */ + int ctx = 0; /* context variable */ +/* + * Module Body + */ + for (i = 0; i < strlen(string); i++) { + if (string[i] != '\\') continue; + start = ++i; + accent_str = string[i]; + if (chrposition(accent_str, accent_set) == 0) continue; + if (string[++i] != '{') continue; + if (idx_is_verbatim(string, &ctx, &i)) continue; + replace = &string[++i]; + while (i < strlen(string)) { + if (string[i++] != '}') continue; + string[i-1] = '\0'; + break; + } + idx_replace_string (string, start, i-start+1, replace); + } +} + +/* + * Function Idx_Process_Groups - Documentation Section + * + * Discussion: + * Process the characters which delimit groups ('{', '}', and '$') in the + * spell string. These characters are removed unless they are quoted + * (e.g., "{" is removed but "\{" is not). + * + * Calling Synopsis: + * Call Idx_Process_Groups (String) + * + * Inputs: + * string -> is the spell string. It is a dynamic string passed by + * descriptor. + * + * Outputs: + * string -> is the spell string. It is a dynamic string passed by + * descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * returns with spell string possibly modified. + * + * Error Conditions: + * none + * + * Algorithm: + * A. For all characters in the spell string, + * 1. If the character is '{', '}', or '$' and the preceeding + * character is not a '\', + * a. Remove the character. + * + * Special Notes: + * none + */ + +/* + * Function Idx_Process_Groups - Code Section + */ +void idx_process_groups(string) +char *string; +{ +/* + * Local Declarations + */ + int i; /* Loop index */ + int ctx = 0; /* Context variable */ +/* + * Module Body + */ + for (i = 0; i < strlen(string); i++) { + if ((string[i] == '{')||(string[i] == '}')||(string[i] == '$')) { + if ((i == 0) || (string[i-1] != '\\')) { + if (idx_is_verbatim(string, &ctx, &i)) continue; + idx_replace_string(string, i+1, 1, (char *)0); + i--; + } + } + } +} + +/* + * Function Idx_Process_Verb - Documentation Section + * + * Discussion: + * Process LaTeX \verb and \verb* commands in the spell string. This is + * done by removing the \verb command from the spell string. + * + * Calling Synopsis: + * status = Idx_Process_Verb (string) + * + * Inputs: + * string -> Spell string. A dynamic string passed by descriptor. + * + * Outputs: + * string -> Spell string. A dynamic string passed by descriptor. + * + * Return Value: + * status -> is a boolean integer passed by value. It indicates + * whether or not a \verb command was found in the spell + * string. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * status = TRUE A \verb command was processed in the string. + * status = FALSE No \verb command was processed. + * + * Error Conditions: + * none + * + * Algorithm: + * A. Search the string for a \verb command: + * 1. \verb [optionally followed by a *] + * 2. Next character is not alphabetic + * B. Mark the pattern and find the terminating character. + * C. Replace the pattern with its argument. + * + * Special Notes: + * none + */ + +/* + * Function Idx_Process_Verb - Code Section + */ +int idx_process_verb(string) +char *string; +{ +/* + * Local Declarations + */ + int i; /* Loop index */ + int start; /* Start of pattern */ + char delim; /* Delimiter character */ + char *replace; /* Pointer to replacement string */ +/* + * Module Body + */ + if ((strlen(string)) < 7) return (FALSE); + for (i = 0; i < (strlen(string)-7); i++) { + if (strncmp(&string[i], "\\verb", 5) != 0) continue; + start = i + 1; + i += 5; + if (string[i] == '*') i++; + delim = string[i++]; + if (isalpha(delim) != 0) continue; + replace = &string[i]; + while (i < strlen(string)) { + if (string[i++] != delim) continue; + if (i < (strlen(string)-1)) { + i = strlen(string); + string[i-1] = delim; + string[i] = '\0'; + i++; + } + else string[i-1] = '\0'; + break; + } + idx_replace_string (string, start, i-start+1, replace); + return (TRUE); + } + return (FALSE); +} + +/* + * Function Idx_Process_Backslash - Documentation Section + * + * Discussion: + * Remove all '\' characters. + * + * Calling Synopsis: + * Call Idx_Process_Backslash (string) + * + * Inputs: + * string -> Spell String. Dynamic string passed by descriptor. + * + * Outputs: + * string -> Spell String. Dynamic string passed by descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * return + * + * Error Conditions: + * none + * + * Algorithm: + * A. For all characters in the spell string, + * 1. If the character is a '\', + * a. Remove it. + * + * Special Notes: + * none + */ + +/* + * Function Idx_Process_Backslash - Code Section + */ +void idx_process_backslash(string) +char *string; +{ +/* + * Local Declarations + */ + int i; /* Loop index */ + int ctx = 0; /* Context variable */ +/* + * Module Body + */ + for (i = 0; i < strlen(string); i++) { + if (string[i] == '\\') { + if (idx_is_verbatim(string, &ctx, &i)) continue; + idx_replace_string(string, i+1, 1, (char *)0); + i--; + } + } +} + +/* + * Function Idx_Process_Emphasis - Documentation Section + * + * Discussion: + * Remove the normal LaTeX emphasis strings (\rm, \em, \bf, \it, \sf, + * \sl, \tt, \normalsize, \small, \tiny, \footnotesize, \large, \Large, + * \LARGE, \huge, \Huge, \cal). + * + * Calling Synopsis: + * call Idx_Process_Emphasis (string) + * + * Inputs: + * string -> Spell string. Dynamic string passed by descriptor. + * + * Outputs:, + * string -> Spell string. Dynamic string passed by descriptor. + * + * Return Value: + * none + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * nones + * + * Normal Exit State: + * none + * + * Error Conditions: + * none + * + * Algorithm: + * A. For each of the listed special commands, + * 1. For each occurence of the string which is not part of a word, + * a. Remove it. + * + * Special Notes: + * none + */ +/* + * Function Idx_Process_Emphasis - Code Sections + */ +void idx_process_emphasis(string) +char *string; +{ +/* + * Local Declarations + */ + int i; /* emphasis_array index */ + int start; /* starting position */ + int length; /* length of substring */ + int ctx; /* context variable */ + int index; /* string index */ + int rpl_start; /* start of string to replace */ +/* + * Module Body + */ + for (i = 0; i < emphasis_array_count; i++) { + ctx = 0; + start = 0; + while ((start = strposition(string, emphasis_array[i], start)) + != -1) { + rpl_start = start+1; + index = start; + length = strlen(emphasis_array[i]); + start += length; +/*@@@ if (((start) <= strlen(string)) && + (isalpha(string[start-1]) != 0)) continue;*/ + if (idx_is_verbatim(string, &ctx, &index)) continue; + idx_replace_string(string, rpl_start, length, (char *)0); + } + } +} + +/* + * Function Idx_Is_Verbatim - Documentation Sectione + * + * Discussion: + * Deterimine if the current string index is within a \verb or \verb* + * range. + * + * Calling Synopsis: + * boolean = Idx_Is_Verbatim (desc, ctx, index) + * + * Inputs: + * desc -> is the character string descriptor being processed. + * + * ctx -> is a context variable, passed by ref. Internally, + * it is the current starting value for the search. + * + * index -> is the string index being tested. + * + * Outputs: + * ctx -> is the value of the first character to follow the + * \verb or \verb* string. + * + * index -> is the new value of the string index. If the index) + * is not in a verbatim, then the value is unchanged. + * If it is in the string, then the index is updated to + * the end of the verbatim range. + * + * Return Value: + * boolean -> is a boolean value. + * + * Global Data: + * none + * + * Files Used: + * none + * + * Assumed Entry State: + * none + * + * Normal Exit State: + * boolean = TRUE Input index is within the range of a verbatim. + * Index is updated. Ctx may be updated. + * boolean = FALSE Input string is not within the range of a verbatim. + * Index and Ctx are unchanged. + * + * Error Conditions: + * none + * + * Algorithm: + * A. If index < ctx, then we know that we aren't in a verbatim. + * 1. Return FALSE. + * B. Find the next verbatim range. Save the start and end (= ctx). + * C. If index < start, + * 1. Return FALSE, + * D. Else, + * 1. Index = end of range. + * 2. Return TRUE. + * + * Special Notes: + * none + */ + +/* + * Function Idx_Is_Verbatim - Code Section + */ +int idx_is_verbatim(desc, ctx, index) +char *desc; +int *ctx; +int *index; +{ +/* + * Local Declarationsn + */ + int start; + int i; + char delim; +/* + * Module Body + */ + if (*index < *ctx) return(FALSE); +/* + * Find the next verbatim range. If there are less than seven characters left + * in the string, then the remainder of the string cannot contain a \verb + * command (because there isn't room). Set the ctx variable to point to the + * end of the string and report that we are not within a verbatim. + */ + if ((strlen(desc) - *ctx) < 7) { + *ctx = strlen(desc); + return (FALSE); + } +/* + * Search for the next \verb string. Note that the STR$POSITION routine uses + * the convention that the first character of the string is position 1 (not 0). + * If no string was found, then set the ctx to the end of the string and report + * that we aren't in a verbatim. + */ + i = *ctx; + start = strposition(desc, verb, i); + i = *ctx + 1; + if (start == -1) { + *ctx = strlen(desc); + return (FALSE); + } +/* + * There may be a verbatim in the string. Its potential starting position is + * "start" (adjusted to index the string from 0 rather than 1). If this is + * the case, then the delimiter character will not be an alpha. + */ +/* start--;*/ + i = start + 5; + if (desc[i] == '*') i++; + delim = desc[i]; +/* + * If the delimiter is an alpha, then we have not found a verbatim string (it + * is something else). If the index we are checking is within the range we've + * looked at, then we know that it isn't in a verbatim and we can so report. + * + * On the other hand, if we haven't gotten far enough into the string yet to + * know, we must keep looking. We do this by calling this routine recursively. + */ + if (isalpha(delim) != 0) { + *ctx = i; + if (*index < i) return (FALSE); + else return(idx_is_verbatim(desc, ctx, index)); + } +/* + * We have found a real verbatim string. We search for its end. + */ + while (i < strlen(desc)) if (desc[++i] == delim) break; + *ctx = ++i; +/* + * Now we can check to see if we're ok. If the index is before the start of + * the verbatim string, we aren't in it. If it is in the middle, we are. + * If it's after the end, we still don't know and have to call ourselves + * recursively to find out. + */ + if (*index < start) return(FALSE); + if (*index < *ctx) { + *index = *ctx - 1; + return(TRUE); + } + else return(idx_is_verbatim(desc, ctx, index)); +} + +int strposition(str, e_array, st) +char *str; +char *e_array; +int st; +{ + int i, slen, elen, found; + slen = strlen(str); + elen = strlen(e_array); + found = -1; + for (i=st; i < (slen-elen); i++) { + if (strncmp(&str[i],e_array,elen) == 0) { + found = i; + break; + } + } + return(found); +} + +int chrposition(str, e_array) +char str; +char *e_array; +{ + int i, elen, found; + elen = strlen(e_array); + found = 1; + for (i=0; i < elen; i++) + if (e_array[i] == str) { + found = 0; + break; + } + return(found); +} + +void strupcase(in,out) +char *in,*out; +{ + int i,len; + len = strlen(in); + for (i=0;i= 'a') && (in[i] <= 'z')) out[i] = in[i]-32; +} + +void strprefix(str,prefix) +char *str; +char prefix; +{ + int i,len; + char tmp,tmp2; + len = strlen(str); + i = 0; + tmp = str[i]; + str[i] = prefix; + for (i=1;i<=len;i++) { + tmp2 = str[i+1]; + str[i] = tmp; + tmp = tmp2; + } + str[i] = tmp; +} diff --git a/indexing/glo+idxtex/idxtex.c b/indexing/glo+idxtex/idxtex.c new file mode 100644 index 0000000000..c739fd3cd7 --- /dev/null +++ b/indexing/glo+idxtex/idxtex.c @@ -0,0 +1,222 @@ +/* #module IdxTeX "3-001" + *********************************************************************** + * * + * The software was developed at the Monsanto Company and is provided * + * "as-is". Monsanto Company and the auther disclaim all warranties * + * on the software, including without limitation, all implied warran- * + * ties of merchantabilitiy and fitness. * + * * + * This software does not contain any technical data or information * + * that is proprietary in nature. It may be copied, modified, and * + * distributed on a non-profit basis and with the inclusion of this * + * notice. * + * * + *********************************************************************** + */ +/* + * Module Name: IdxTeX + * + * Author: R L Aurbach CR&DS MIS Group 26-Apr-1986 + * + * Function: + * Main Line of the IdxTeX program. This program processes .idx files + * produced by LaTeX and generates files which will produce a properly + * formatted index. + * + * Modification History: + * + * Version Initials Date Description + * ------------------------------------------------------------------------ + * 1-001 RLA 26-Apr-1986 Original Code + * 1-002 RLA 13-Jun-1986 Add support for /TOC qualifier + * 1-003 RLA 06-Apr-1987 Change version number to 1.2 to reflect + * corrections with spelling processing + * 2-004 RLA 07-Apr-1987 Add range and master index support. + * 3-001 F.H. 17-May-1991 converted to portable C + */ +/* + * Module IdxTeX - Module-Wide Data Description Section + * + * Include Files: + */ +#ifdef MSDOS +#include +#include +#define F_OK 0 /* access(): File exists */ +#else +# include +extern char *sprintf(); +#endif +#include +#include +#include "IdxDef.h" +/* + * Module Definitions: + */ +#define TRUE 1 +#define FALSE 0 +#define linebfsize 133 /* Max size of a line */ +/* + * Global Declarations: + */ + TREE_PTR root = 0; /* Root of the Index Tree */ +/* + * Static Declarations: + */ +#ifdef MSDOS +main(int argc, char *argv[]); +#else +main(); +#endif +/* + * External References: + */ +#ifdef MSDOS +extern void idx_command(int argc, char *argv[], char *file, + int *toc_flag, int *mst_flag); +extern int idx_parse_master(char *linebf, char *filename, char *vol_ptr); +extern void idx_process_file(char *filename, char *vol); +extern void idx_generate(FILE *file, int toc_flag, int mst_flag); +#else +extern void idx_command(); +extern int idx_parse_master(); +extern void idx_process_file(); +extern void idx_generate(); +#endif +/* + * Functions Called: + */ +/* + * Function IdxTeX - Documentation Section + * + * Discussion: + * This is the main line of the IdxTeX program. It reads the input file, + * parsing the information, and generates an output file based on the + * information from the input file. + * + * Calling Synopsis: + * $ IdxTeX :== $Crl_Public:IdxTeX + * $ IdxTeX filespec [/TOC:{ARTICLE | REPORT}] [/MASTER] + * + * Inputs: + * filespec -> Name of the input file to be processed. The + * default filespec SYS$DISK:[].IDX is processed + * against this specification. If the /MASTER + * qualifier is present, the default file type is + * .MDX. + * + * Outputs: + * filespec -> The program produces an output file which is + * the resultant filespec from processing .IND as + * the primary file specification and the fully- + * qualified input filespec as the default. + * + * Return Value: + * returns SUCCESS + * + * Global Data: + * none + * + * Files Used: + * reads an input file as specified above. + * produces an output file as specified above. + * + * Assumed Entry State: + * Called from DCL level. + * + * Normal Exit State: + * Returns to DCL level. + * + * Error Conditions: + * Input file not found -- program issues a message and exits + * immediately. + * Input file format error -- program ignores any lines of the input file + * which it does not understand. + * + * Algorithm: + * A. Call Idx_Command to process the command line. + * B. If processing a master index, + * 1. Open the Master Index input file. + * 2. For all records in the file, + * a. Read the next record. + * b. Call Idx_Process_File to process it. + * 3. Close the Master Index input file. + * C. Else, + * 1. Call Idx_Process_File to process the input file. + * D. Open the output file. + * E. Call Idx_Generate to generate the output file. + * F. Close the output file. + * + * Special Notes: + * none + */ +/* + * Function IdxTeX - Code Section + */ +main(argc,argv) +int argc; +char *argv[]; +{ +/* + * Local Declarations + */ + FILE *file; /* file pointer */ + char dna[133]; /* Default filename arg */ + char linebf[linebfsize]; /* I/O line buffer */ + char filename[256]; /* Input file name */ + int toc_flag; /* /TOC qualifier flag */ + int mst_flag; /* /MASTER qualifier flag */ + FILE *mst_file; /* master file pointer */ + char *vol = 0; /* volume string descriptor ptr */ +/* + * Module Body + */ +/* Process the command line. The routine will force exit on error. */ + if (argc < 2) { + (void) printf("usage: idxtex file [/TOC={Article | Report}]\n"); + exit(1); + } + idx_command(argc, argv, filename, &toc_flag, &mst_flag); + (void)sprintf(dna, "%s.idx", filename); + (void)printf("\nIdxTeX, the automatic index generator for LaTeX, version 2.0\n"); +/* + * If doing master index processing, + * A. Open the master index file. + * B. For all records in the file, + * 1. Read the next record. + * 2. Call Idx_Process_File to process it. + * C. Close the file. + * + * Otherwise, + * A. Call Idx_Process_File to process the file. + */ + vol = malloc(linebfsize); + if (mst_flag) { + (void)sprintf(dna, "%s.mdx",filename); + if ((mst_file = fopen(dna, "r")) == NULL) { + (void)printf("Could not open the master file\n"); + exit(1); + } + (void)printf("\nProcessing Master File %s\n", dna); + while (fgets(linebf, linebfsize, mst_file) != 0) { + if (idx_parse_master (linebf, filename, vol)) { + (void)printf("\tProcessing index file %s.idx\n", filename); + idx_process_file(filename, vol); + } + } + (void)fclose(mst_file); + (void)sprintf(dna,"%s.mnd", filename); + } + else { + idx_process_file(filename, vol); + (void)sprintf(dna,"%s.ind", filename); + } +/* Now generate the output file... */ + if ((file = fopen(dna, "w")) == NULL) { + (void)printf("Could not open the output file\n"); + exit(1); + } + idx_generate (file, toc_flag, mst_flag); + (void)fclose(file); + (void)printf("\nDone.\n"); +} diff --git a/indexing/glo+idxtex/idxtex.mdx b/indexing/glo+idxtex/idxtex.mdx new file mode 100644 index 0000000000..0b2179207b --- /dev/null +++ b/indexing/glo+idxtex/idxtex.mdx @@ -0,0 +1,2 @@ +\usefile{\GloTeX}{glotex} +\usefile{\IdxTeX}{idxtex} diff --git a/indexing/glo+idxtex/idxtex.pdf b/indexing/glo+idxtex/idxtex.pdf new file mode 100644 index 0000000000..a22af7668c Binary files /dev/null and b/indexing/glo+idxtex/idxtex.pdf differ diff --git a/indexing/glo+idxtex/idxtex.tex b/indexing/glo+idxtex/idxtex.tex new file mode 100644 index 0000000000..ee8f8654d8 --- /dev/null +++ b/indexing/glo+idxtex/idxtex.tex @@ -0,0 +1,600 @@ +\documentstyle[oldlfont,glo_idx]{pamphlet} +\def\IdxTeX{Idx\TeX} +\pagestyle{headings} +\makeindex +\begin{document} +%\coverstyle{userguide} +\title{\IdxTeX\ Program} +\author{R L Aurbach} +\authorfacts{CR\&DS MIS Group \\ Monsanto Company \\ 800 N. Lindbergh Blvd. +\\ St. Louis, MO 63167 \\ (314)--694--5453} +\version{Version 2.0} +\file{IdxTeX} +\date{April 19, 1987} +\begin{thetitle} +\begin{abstract} +The \IdxTeX\ program is used to automate the generation of an Index in a +\LaTeX\ document. It uses the .IDX file generated by the \verb+\makeindex+ +command to create a file which is \verb+\input+ in the document to generate +the Index. +Version 2.0 improves the visual appearance of the Index and adds support +for page ranges, index cross references, and the generation of a Master Index. +\end{abstract} +\end{thetitle} + +\makeheading +\section{The Index Problem} + +The \LaTeX\ text formatting program is an extremely versatile tool for the +generation of high-quality documents. However, its handling of an Index is +incomplete. + +\subsection{\LaTeX\ Index Processing} + +To make an Index using \LaTeX, the writer includes the +\verb+\makeindex+\index{\verb+\makeindex+ Command} command +in the preamble\index{Preamble} of the document. This causes an auxiliary +file (with file type .IDX\index{IDX File}) to be generated. For every +\verb+\index+\index{\verb+\index+ Command} command in the document, a +\verb+\indexentry+\index{\verb+\indexentry+ Command} command is written to +the auxiliary file, containing the text supplied in the \verb+\index+ command +and the page number of the page on which the \verb+\index+ command occurred. + +It is then the writer's responsibility to use the auxiliary file to create the +series of commands needed to format an appropriate index and to insert these +commands into the document at the appropriate place. + +The entire process is described in Sections~4.5 and C.10.5 of the {\em \LaTeX\ +User's Guide and Reference Manual}. + +\subsection{The \IdxTeX\ Solution} + +While this procedure is capable of generating an effective, high-quality Index, +a substantial amount of work is required to convert the auxiliary .IDX file into +the appropriate set of commands. The \IdxTeX\ program was written to automate +this manual part of the process. + +\IdxTeX\ uses the .IDX\index{IDX File} auxiliary file to generate a new file +with file type .IND\index{IND File} which contains all of the necessary commands +to create an attractive, two-column index. This .IND file may then be included +in the document at the appropriate place to generate the Index. + +The \IdxTeX\ program +\begin{itemize} +\item Generates\index{\IdxTeX\ Features>Complete Index Generation} +all of the commands necessary to build the Index, including the +\verb+\begin{theindex}+\index{theindex Environment} and \verb+\end{theindex}+ +commands. +\item Generates\index{\IdxTeX\ Features>Alphabetized, Two-Column Index} +an alphabetized, two-column index. +\item Supports \index{\IdxTeX\ Features>Three Levels of Indexing} +three levels of indexing --- index items, index subitems, and +index subsubitems. +\item Supports \index{\IdxTeX\ Features>Page Number Ranges} special +formatting of ranges of consecutive page numbers, to enhance the visual +appearance of the Index. +\item Supports \index{\IdxTeX\ Features>Index Item Highlighting} +highlighting effects such as boldface, italics, etc., in the +index items, while maintaining proper alphabetization of entries. +\item Supports \index{\IdxTeX\ Features>Page Number Highlighting} +highlighting effects (boldface, italics, and underlining) of +page numbers. +\item Supports \index{\IdxTeX\ Features>\verb~\verb~ Command Supported} +the use of \LaTeX\ commands, including \verb+\verb+ commands, +in the index items, while maintaining proper alphabetization of entries. +\item Supports \index{\IdxTeX\ Features>Cross References} references within +one index entry to other index entries. +\item Supports \index{\IdxTeX\ Features>Master Index Generation} the generation +of a Master Index for a set of documents. +\end{itemize} + +\section{Using \IdxTeX} + +The \IdxTeX\ program is easy to use. However, like B{\sc ib}\TeX, there are a +number of steps necessary to generate the index and to get it included properly +in your document. + +\begin{infomap} +\item[Command \\ Definition] The \IdxTeX\ program is a foreign DCL +command.\footnote{On the Monsanto BB1T VAXcluster, the IdxTeX symbol is defined +by issuing the CRLSETUP command.} \vspace{2em} +\item[Preparing the \\ Document] +Include the \verb+\makeindex+\index{\verb+\makeindex+ Command} +command in the preamble\index{Preamble} area of the document +source file (i.e., between the \verb+\documentstyle+ and \verb+\begin{document}+ +commands). Also, include the appropriate \verb+\index+\index{\verb+\index+ +Command} commands (as described below) in the source file. +\item[Generate \\ the IDX File] +Use \LaTeX\ to generate an initial form of the document. \LaTeX\ will +generate an auxiliary file which has the same filename as the main document file +and a filetype of .IDX\index{IDX File}. +\item[Run \IdxTeX] +Use \IdxTeX\ to generate the formatted index file.\index{Syntax} +\begin{verbatim} + $ IdxTeX file [/TOC={ ARTICLE | REPORT }] +\end{verbatim} +where ``file''\index{Syntax>Filename Parameter} is the filename of the .IDX +file. \IdxTeX\ generates a file with the same filename as the .IDX file and a +filetype of .IND\index{IND File}. + +The \verb+/TOC+ qualifier\index{Syntax>/TOC Qualifier} is optional. If you +specify it, you must specify either the value \verb+ARTICLE+ or the value +\verb+REPORT+. The /TOC qualifier is used to add an entry into the Table of +Contents for the Index. The standard document styles ({\em article\/} and +{\em report\/}) do not automatically make a Table of Contents entry for the +Index. If you want the Index to be listed in the Table of Contents, you +{\bf must} use the /TOC qualifier. The value \verb+ARTICLE+ should be used +with documents which use the {\em article\/} document style or one of its +derivatives. The value \verb+REPORT+ should be used with documents which use +the {\em report\/} or {\em book\/} document styles. + +\begin{note} +A number of document styles have been developed which automatically include +a Table of Contents entry for the Index\footnote{Examples of these styles +include the Monsanto {\em pamphlet}, {\em manual}, and {\em memo\/} styles.}. +You {\bf should not} use the /TOC qualifier with one of these document styles. +If you do, the Index will be listed in the Table of Contents twice. +\end{note} + +\item[Generate\\the Document] +Insert the command \verb+\input{file.IND}+ into +\index{\verb+\input{file.IND}+} your document source file just before the +\verb+\end{document}+ command. + +Finally, run the document through \LaTeX\ twice (to make sure that the Table of +Contents includes the page reference for the Index). Your document is now +complete, including a formatted Index. +\end{infomap} + +\section{Special Features} + +The \IdxTeX\ program attempts to perform all of the operations needed to +generate an Index which you can be proud of. Of course, the quality of the +Index is a function of the amount of effort you put into your writing --- the +program can only generate index entries for items you tell it to index for you. +But if you do a good job of generating index entries, \IdxTeX\ should do a good +job formatting them for you. + +\begin{infomap} +\item[Index \\ Generation] \index{^\IdxTeX\ Features>Complete Index Generation} +The .IND\index{IND File} file generated by \IdxTeX\ contains all of the commands +necessary to generate the index. +The file contains a +\verb+\begin{theindex}+\index{\verb+\begin{theindex}+ Command} command. This +sets up the Index environment according to your current \verb+\documentstyle+. +For example, in the {\em article\/} \verb+\documentstyle+, the index is an +unnumbered section. In the {\em report\/} \verb+\documentstyle+, the index is +an unnumbered chapter. + +The last line in the file is a \verb+\end{theindex}+\index{\verb+\end{theindex}+ +Command} command. This command ends the Index environment. Between these lines +are found all of the commands needed to generate the Index. + +\item[Alphabetical\\Index] \index{^\IdxTeX\ Features>Alphabetized, Two-Column +Index} The index is generated in an alphabetized, two-column format by major +index entry. Special characters such as ``\verb+\+'' don't participate in the +alphabetization, so a term like \verb+\begin+ is indexed under ``B'', not +under ``\verb+\+''. + +For clarity, the group of index entries which begin with one letter of the +alphabet are set off from the index entries beginning with the next letter of +the alphabet with vertical spacing and a heading. See the index of this +document for examples. + +\item[Index Levels] \index{^\IdxTeX\ Features>Three Levels of Indexing} +Items are inserted into the Index by using the \verb+\index+ command. For +example, to index the term ``entry'', enter \verb+\index{Entry}+\index{Entry} +at the appropriate place in the text of your document. The information entered +as the argument to \verb+\index+\index{\verb+\index+ Command} will appear as +specified (special visual effects are discussed below). The page number on +which the \verb+\index+ command appeared will be displayed. + +This approach generates a simple Index. That is, all terms are on the same +footing. It is often convenient, however, to have terms appear as subindices +under an index term. For example, if you were discussing ``Commands'', you +might wish to have separate index entries for ``Add Command'' and ``Change +Command''. However, in addition, you should create an index entry for +``Commands'' and place ``Add'' and ``Change'' as subindices under it. This +technique generates an index which is more helpful for the person looking for +information. + +\IdxTeX\ actually supports three such levels of indexing --- a main index item, +a subindex item, and a subsubindex item. In analogy to the indexing +capabilities of the RUNOFF program, the +``\verb+>+''\index{SubIndex (\verb$>$) Command} +\index{\verb+\index+ Command>Use of \verb$>$} +symbol is used to separate +the index term from the subindex term and the subindex term from the subsubindex +term in the \verb+\index+ command. + +For example, + +\begin{verbatim} + \index{Top Level Item>SubItem>SubSubItem} +\end{verbatim} + +\index{Top Level Item>SubItem>SubSubItem}generates such three-level deep +index entry in the index. Look at the index of this document to see it. + +There are two important points to note here. + +\begin{itemize} +\item First, each \verb+\index+ command generates a single page number reference +in the index. The page number is associated with the lowest level of the index +specified. Therefore, in this example, the page number is associated with the +``SubSubItem'' entry, not any of the higher entries. If you want page numbers +at all levels, you must use several \verb+\index+ commands. + +All subitems are displayed in alphabetical order below their top-level item. +All subsubitems are displayed in alphabetical order below their second-level +item. + +\item Second, the \verb+>+ symbol used to separate items of different levels +is normally a math symbol. As such, it is possible that you will want to +index a math expression which contains it. This is okay, because \IdxTeX\ +is sensitive to the use of {\tt \$} as a command to enter or leave math mode and +will not consider \verb+>+ a level separator unless it is {\em not\/} in math +mode. + +\end{itemize} + +While \IdxTeX\ allows you to be pretty wordy in your index terms (there is a +practical limit of about 110 characters for the text contained in an +\verb+\index+ command), your index will be most effective if you select short +and concise index terms. People usually scan an index quickly, looking for +something that looks like what they are interested in. A lengthy exposition in +an index term makes this difficult. + +\item[Item \\ Highlighting] \index{^\IdxTeX\ Features>Index Item Highlighting} +Sometimes it is desirable to make a word or phrase (or even an entire index +entry) stand out in the Index. This is referred to as Item Highlighting, and +is an effective technique to make the Index more useful, if not overdone. + +Use the normal \LaTeX\ commands to generate the desired highlighting. For +example, the following commands appear in this document. + +\begin{verbatim} + \index{Highlighting>A {\bf boldface} entry} + \index{Highlighting>An {\em italic\/} entry} +\end{verbatim} + +\index{Highlighting>A {\bf boldface} entry}\index{Highlighting>An {\em italic\/} +entry} Look for the result in the index! + +From the standpoint of \IdxTeX, the item, subitem, and subsubitem are processed +as different text elements. Therefore, if you wish to highlight more than one +level of the index, you must handle each one independently. That is, + +\verb+\index{{\bf One>Two>Three}}+ \hfill WRONG! + +is incorrect, but + +\verb+\index{{\bf One}>{\bf Two}>{\bf Three}}+ \hfill CORRECT! + +will produce the desired result. + +\item[Page Number\\Highlighting] \index{^\IdxTeX\ Features>Page Number +Highlighting} Sometimes, when you are indexing the same term in many places in +a document, you may wish to help the reader decide which is the primary +reference and which are secondary references. One way of doing this is to +provide visual highlighting of important page numbers. + +\IdxTeX\ provides a mechanism to cause a page number of a reference to be +printed in {\bf boldface}, in {\em italics}, or \underline{underlined}. There +are three special characters recognized by \IdxTeX\ {\bf when they appear as the +first character of an \verb+\index+ command argument}. + +\begin{itemize} + +\item The \verb+^+ command\index{\verb+\index+ Command>Use of \verb+^+} is +used to make the page number reference appear in {\bf boldface}. +\item The \verb!~! command\index{\verb+\index+ Command>Use of \verb!~!} is +used to make the page number reference appear in {\em italics}. +\item The {\tt\_} command\index{\verb+\index+ Command>Use of {\tt\_}} is used to +make the page number reference appear \underline{underlined}. +\end{itemize} + +For example, in this document, the following \verb+index+ commands appear. + +\begin{verbatim} + \index{^Page Numbers>boldface} + \index{~Page Numbers>italics} + \index{_Page Numbers>underlined} +\end{verbatim} +\index{^Page Numbers>boldface}\index{~Page Numbers>italics} +\index{_Page Numbers>underlined} Look at the index to see the results! +\begin{note} +These special characters must appear as the first character of an \verb+\index+ +command argument. If they appear after a \verb+>+ (i.e., as the first character +of a subindex entry or a subsubindex entry), they will not work. In fact, they +will cause a \LaTeX\ error! +\end{note} + +\item[Special \\ \LaTeX \\ Commands] +\index{^\IdxTeX\ Features>\verb+\verb+ Command Supported} +Occasionally (such as in this document), it is desirable to include \LaTeX\ +commands in the index in an index entry to create special effects or because +the command itself is being referenced. \IdxTeX\ supports this --- just type +the entries as you would expect them to appear. + +The trick is that \IdxTeX\ tries to alphabetize your entries correctly. This +means that it must figure out how to alphabetize \LaTeX\ commands, whose +displayed images are different than the character strings which generate them. + +The following rules attempt to indicate how \IdxTeX\ treats \LaTeX\ commands +when it finds them. + +\begin{itemize} +\item Accents are ignored when figuring out how to spell a term. This means, +for example, that ``\verb+se\~{n}or+'' is treated as if it were spelled +``\verb+senor+''. + +\item Text contained in ``\verb+\verb+'' or ``\verb+\verb*+'' commands are +spelled as if the command were not present. For example, the index entry +``\verb~\verb+\Pi+~'' is treated as if it were spelled ``\verb+\Pi+''. + +\item Commands which affect font size or type style are ignored when figuring +out how something is spelled. For example, ``\verb+\sc term+'' is treated as if +it were spelled ``\verb+term+''. Note, however, that this applies only to +spelling. The term will be displayed as you want it. + +\item Case is ignored in spelling considerations. Terms like ``large'' and +``Large'' are treated as identical. Only one reference (with two page numbers) +will appear --- the first form seen will be used. + +\item \IdxTeX\ ignores the grouping commands ``\{'', ``\}'', and ``\$'' when +placing a term in alphabetical order. On the other hand, the sequences which +generate explicit characters (i.e., ``\verb+\{+'', ``\verb+\}+'', and +``\verb+\$+'') are handled as if they were the characters themselves --- the +``\verb+\+'' is ignored for spelling. For example, the term ``\verb+{\bf The \{ +Command}+'' will be alphabetized as if it were spelled ``\verb+The { Command+''. + +\item All ``\verb+\+'' characters are ignored. The term ``\verb+\begin+'' will +be located in the Index as if it began with the ``b'', not the ``\verb+\+''. +\end{itemize} +\end{infomap} + +\section{Page Ranges} + +\IdxTeX\ supports two types of page ranges\index{#Page Ranges} --- implicit and +explicit. + +An implicit page range is one which is discovered during index processing. For +example, if it turns out that a particular item is indexed on three consecutived +pages, then this is an implicit range. + +An explicit page range is one in which you specifically indicate that an item +being referenced is discussed on a particular page and succeeding pages. + +\subsection{Implicit Page Ranges} + +Suppose\index{#Page Ranges>Implicit} that you index the term ``Command'' a +number of times within your document and it turn out (when you use \LaTeX\ to +format it) that the references occur on pages 10, 15, 16, 17, 20, and 21. +\IdxTeX\ will recognize that there are two implicit page ranges here and will +display the reference in the index as +\begin{quote} +\qquad Command, 10, 15--17, 20--21 +\end{quote} +This processing occurs automatically --- you need not do anything special to +get it to occur (except, of course, insert the \verb+\index+ commands where +they are needed). + +In some document styles, chapter-oriented page numbering is used. From the +standpoint of \IdxTeX, a chapter oriented page number is any page number which +consists of a string (which is usually numeric) followed by one or more dashes, +followed by a page number. For example, \verb+2--6+ and \verb+Ref--12+ are +typical chapter oriented page numbers. + +Since the \IdxTeX\ program parses and recognizes page numbers in this format +as well as simple numeric page numbers, it is able to correctly build ranges +for chapter oriented documents. For example, if references to ``Command'' +occurred on pages 2--6, 3--7, 3--8, 3--9, and 4--10, then \IdxTeX\ would +build an index entry of the form +\begin{quote} +\qquad Command, 2--6, 3--7 to 3--9, 4--10 +\end{quote} + +So far, we have considered page numbers which have no visual highlights. If +one or more of the page number references in a range has a highlight, the range +is broken up into sub-ranges, so that each sub-range has the same visual +highlight. For example, if references to ``Noise'' occurred on pages 20 through +26, with the references on pages 22 and 23 flagged as underlined and the +references on pages 24 and 25 flagged as boldface, then \IdxTeX\ would generate +an index entry of the form +\begin{quote} +\qquad Noise, 20--21, \underline{22--23}, {\bf 24--25}, 26 +\end{quote} + +\subsection{Explicit Page Ranges} + +Another form of page range\index{#Page Ranges>Explicit} occurs when a single +reference indicates that a particular topic is covered on a particular page +and following pages. In this kind of reference, only one index item is +needed --- for the first page referenced. By convention, the letters {\sf ff} +follow that page reference to mean ``and following''. + +To specify this type of reference, use the {\tt \#} +\index{\verb+\index+ Command>Use of \verb+#+} symbol as the first +character in the index entry (just as if it were a special type of page +highlight). For example, the reference \verb+\index{#Page Ranges>Explicit}+ +was placed at the beginning of this section. Look to the index to see the +result. + +There are two special features of this notation. +\begin{itemize} +\item Explicit page ranges take precedence over implicit page ranges. That is, +if an explicit range entry occurs within an implicit range, then the whole +implicit range is condensed into a single explicit reference. For example, +if the reference to ``Command'' was made on pages 20 through 25 and the +reference on page 23 was explicit, then the output would have the form +\begin{quote} +\qquad Command, 20{\sf ff} +\end{quote} +rather than. +\begin{quote} +\qquad Command, 20--22, 23{\sf ff}, 24--25 +\end{quote} +\item Explicit page ranges take precedence over all page highlighting. If +\begin{verbatim} + \index{~Command}\index{#Command} +\end{verbatim} +occurs, for example, then the italic reference is ignored. +\end{itemize} + +\section{Cross References} + +It\index{#Cross References} is not uncommon in an index to want to reference a +term in a variety of different ways, so that people will be easily able to find +the reference they need. This is often a lot of work, however, because you +don't normally want to repeat a big list of \verb+\index+ commands for every +place where a term is referenced. Instead, a great deal of effort can be saved +if you can index the term thoroughly once, and then {\em cross reference\/} it +in all its synonyms. + +For example, suppose you are describing the syntax of a command. You index +the various forms of the command under the term ``Syntax''. However, you also +want to place an alternate entry in the index under ``Command Syntax'' in case +people look there first. Obviously, you'd rather not repeat all of your +index commands twice to get a complete set of references. Instead, you'd like +to {\bf refer} the reader who looks up ``Command Syntax'' to try ``Syntax'' +for the information. + +\IdxTeX\ supports this capability.\index{Command Syntax&Syntax} The special +symbol ``\verb+&+''\index{\verb+\index+ Command>Use of {\tt \&}} is used too +indicate the beginning of a cross reference, which is used {\bf instead of the +page reference} in the entry. In our example above, entering +\verb+\index{Command Syntax&Syntax}+ produces the desired result --- look at the +index. + +You can combine cross references with page references. For example, +\begin{verbatim} + \index{Combining References} + \index{Combining References&Cross References} +\end{verbatim} +\index{Combining References}\index{Combining References&Cross References} +contains a page reference and a cross reference, as is shown in the index. + +For convenience, the notation \verb+\index{aaa&bbb>ccc>ddd}+ generates a +cross reference to \verb+bbb, ccc, ddd+, so you can use the same syntax in +your cross references as you do in your index terms themselves. Note that the +text following the ``\verb+&+'' must obey all of the rules associated with +index entries in general. + +You can include as many cross references as you like. For example, the +sequence +\begin{verbatim} + \index{aaa&bbb} \index{aaa&ccc} \index{aaa&ddd} +\end{verbatim} +is perfectly acceptable. In the index, it generates +\begin{quote} +\hspace*{10pt}aaa, {\em see}\\ +\hspace*{40pt}$\bullet$ bbb\\d +\hspace*{40pt}$\bullet$ ccc\\e +\hspace*{42pt}$\bullet$ dddD +\end{quote} + +Also note that a cross-reference entry does not, in itself, contain any +page number information. Therefore, the index entries containing cross +referencing may appear anywhere. For example, you could build a basic index +in your document, then add all the appropriate cross reference entries later, +all in one place in your text. Note, however, that cross references in index +entries are treated like simple text --- \IdxTeX\ does not check to make sure +that a cross reference entry actually exists. So be careful when creating them, +to avoid misleading your reader. + +\section{Master Index Processing} + +A Master Index \index{Master Index}\index{Master Index>Definition} +is a document in a set of documents which contains a complete +index of all terms indexed in {\bf any} of the other volumes of the document +set. \IdxTeX\ provides support for the automatic generation of a Master +Index. + +\begin{infomap} + +\item[Prepare the \\ Individual Indices] +The first step is to run all of the other documents in the document set +through \LaTeX, so that all of the {\tt .IDX} files are generated. These +files are used by \IdxTeX\ to format the Master Index. + +\item[Build the \\ .MDX File] +\IdxTeX\ must be made aware of which {\tt .IDX} files to use to build the +Master Index. In addition, it is important to define a {\em label\/} which +is associated with each volume in the Master Index, so that the reader can +figure out which volume to look to find the reference. + +Both of these requirements are handled by a new auxiliary file called the +{\tt MDX} File.\index{Master Index}\index{Master Index>The {\tt .MDX} File} +The format of this file is quite simple. For each volume which you wish to +be included in the Master Index, insert a line in the {\tt .MDX} file of the +form +\begin{verbatim} + \usefile{label}{idx-file} +\end{verbatim} +Here, ``{\em label\/}'' is the label which you wish to be associated with +the volume in the Master Index and ``{\em idx-file\/}'' is the file +specification of the associated {\tt .IDX} file which contains the relevant +information. + +For example, suppose you have a document set containing four documents --- +a User's Guide, a Reference Manual, an Operations Manual, and an Installation +Guide. You wish to build an Introduction document which contains a Master +Index of the document set. In this case, you might build an {\tt .MDX} file +named {\tt INTRO.MDX} which contains the following lines +\begin{verbatim} + \usefile{User}{user_guide} + \usefile{Ref}{ref_manual} + \usefile{Operator}{op_manual} + \usefile{Install}{install} +\end{verbatim} +This example assumes that the {\tt .IDX} file for the User's Guide is +{\tt USER\_GUIDE.IDX}, etc. When \IdxTeX\ processes the Master Index, it +uses a default file specification of {\tt SYS\$DISK:[].IDX} with each file +specified in the {\tt .MDX} file. + +\item[Run \IdxTeX] \index{Master Index}\index{Master Index>The {\tt .MND} File} +\index{Syntax>/MASTER Qualifier} Next, process the {\tt .MDX} file with +\IdxTeX. +\begin{verbatim} + $ IDXTEX intro /MASTER +\end{verbatim} +The /MASTER qualifier indicates that \IdxTeX\ is to prepare a Master Index. +In this case, the filename parameter\index{Syntax>Filename Parameter} of the +\IdxTeX\ command is the specification of the {\tt .MDX} file. A default +file specification of {\tt SYS\$DISK:[].MDX} is used. + +\IdxTeX\ will read the specified {\tt .MDX} file and will read and process +each of the {\tt .IDX} files specified in it. It will generate a master +index output file which has the same name as the {\tt .MDX} file, but with +the {\tt .MND} filetype. In this example, \IdxTeX\ will generate the file +{\tt INTRO.MND}. + +\item[Build the \\ Master Index] \index{Master Index} +\index{Master Index>Generation} The final step in building the Master Index is +to include a \verb+\input+ command to incorporate the {\tt .MND} file into the +final volume and to run \LaTeX\ on it, just as in the normal index case. + +In our example, include the command +\begin{verbatim} + \input{intro.mnd} +\end{verbatim} +in the file {\tt INTRO.TEX} and process this file using \LaTeX\ as usual. +\end{infomap} + +The result will be a Master Index, which contains all of the index information +contained in the volume set, formatted so that users will easily be able to +find it. In particular, if a term is referenced in more than one volume of +the volume set, its references for each volume are clearly separated from each +other to make it clearer which volumes are associated with which page +references. + +In short, \IdxTeX\ now makes it as easy to generate an attractive Master Index +to a set of documents as it does to generate an Index to each volume of the +set. + +\input{idxtex.ind} + +\tableofcontents + +\end{document} diff --git a/indexing/glo+idxtex/makefile.msc b/indexing/glo+idxtex/makefile.msc new file mode 100644 index 0000000000..437fa9ee0a --- /dev/null +++ b/indexing/glo+idxtex/makefile.msc @@ -0,0 +1,32 @@ +CFILES= globldfi.c\ + globldla.c\ + glocmd.c\ + glomiss.c\ + gloscan.c\ + glotex.c +OFILES= globldfi.obj\ + globldla.obj\ + glocmd.obj\ + glomiss.obj\ + gloscan.obj\ + glotex.obj + +CFLAGS= -O + +all: glotex.exe + +glotex.exe: ${OFILES} + link /CO ${OFILES},glotex; + +globldfi.obj: globldfi.c + cl /AH /c /Zi globldfi.c +globldla.obj: globldla.c + cl /AH /c /Zi globldla.c +glocmd.obj: glocmd.c + cl /AH /c /Zi glocmd.c +glomiss.obj: glomiss.c + cl /AH /c /Zi glomiss.c +gloscan.obj: gloscan.c + cl /AH /c /Zi gloscan.c +glotex.obj: glotex.c + cl /AH /c /Zi glotex.c diff --git a/indexing/glo+idxtex/ms-dos/readme b/indexing/glo+idxtex/ms-dos/readme new file mode 100644 index 0000000000..ec9375110c --- /dev/null +++ b/indexing/glo+idxtex/ms-dos/readme @@ -0,0 +1,10 @@ +The files are executables of glotex and idxtex for msdos on 386. + +They have been compiled by djgcc 1.10c . +Run the programs by: + 1. move the DOS-extender go32.exe to a directory present in PATH. + run (glo|idx)tex.exe + 2. create self-running executables by: + copy go32.exe+glotex.exe glotex_autark.exe /b + copy go32.exe+idxtex.exe idxtex_autark.exe /b + run (glo|idx)tex_autark.exe diff --git a/indexing/glo+idxtex/pam11.sty b/indexing/glo+idxtex/pam11.sty new file mode 100644 index 0000000000..0a47f62bfd --- /dev/null +++ b/indexing/glo+idxtex/pam11.sty @@ -0,0 +1,112 @@ +% pam11.sty 29-Apr-1986 + +\lineskip 1pt \normallineskip 1pt +\def\baselinestretch{1} + +\def\@normalsize{\@setsize\normalsize{13.6pt}\xipt\@xipt +\abovedisplayskip 11pt plus3pt minus6pt\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6.5pt plus3.5pt +minus3pt} +\def\small{\@setsize\small{12pt}\xpt\@xpt +\abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt minus3pt +\def\@listi{\topsep 6pt plus 2pt minus 2pt\parsep 3pt plus 2pt minus 1pt +\itemsep \parsep}} +\def\footnotesize{\@setsize\footnotesize{11pt}\ixpt\@ixpt +\abovedisplayskip 8pt plus 2pt minus 4pt\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip \z@ plus 1pt\belowdisplayshortskip 4pt plus 2pt minus +2pt +\def\@listi{\topsep 4pt plus 2pt minus 2pt\parsep 2pt plus 1pt minus 1pt +\itemsep \parsep}} +\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt} +\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt} +\def\large{\@setsize\large{14pt}\xiipt\@xiipt} +\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt} +\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt} +\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt} +\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt} +\normalsize + +\oddsidemargin 36.135pt \marginparwidth 54.203pt \marginparsep 10pt +\if@twoside \evensidemargin -8.672pt \else \evensidemargin 36.135pt \fi +\topmargin -27.101pt \headheight 20pt \headsep 45.169pt \footheight 16pt +\footskip 61.213pt + +\textheight 8.25in \textwidth 6in \columnsep 10pt \columnseprule 0pt + +\footnotesep 7.7pt + +\skip\footins 10pt plus 4pt minus 2pt +\floatsep 12pt plus 2pt minus 2pt \textfloatsep 20pt plus 2pt minus 4pt +\intextsep 12pt plus 2pt minus 2pt \@maxsep 20pt \dblfloatsep 12pt plus 2pt +minus 2pt \dbltextfloatsep 20pt plus 2pt minus 4pt \@dblmaxsep 20pt +\@fptop 0pt plus 1fil \@fpsep 8pt plus 2fil \@fpbot 0pt plus 1fil +\@dblfptop 0pt plus 1fil \@dblfpsep 8pt plus 2fil \@dblfpbot 0pt plus 1fil +\marginparpush 5pt + +\parskip 1em plus 1pt \parindent 0pt \topsep .5em plus 3pt minus 5pt +\partopsep 3pt plus 1pt minus 2pt \itemsep 1em plus 2pt minus 1pt +\@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 + +\@beginparpenalty -\@lowpenalty \@endparpenalty -\@lowpenalty \@itempenalty +-\@lowpenalty + +\def\part{\par \addvspace{4ex} \@afterindentfalse \secdef\@part\@spart} + +\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne \refstepcounter{part} +\addcontentsline{toc}{part}{\thepart \hspace{1em}#1}\else +\addcontentsline{toc}{part}{#1}\fi { \parindent 0pt \raggedright + \ifnum \c@secnumdepth >\m@ne \LARGE \bf Part \thepart \par\nobreak \fi \huge +\bf #2\markboth{}{}\par } \nobreak \vskip 3ex \@afterheading } + +\def\@spart#1{{\parindent 0pt \raggedright + \huge \bf + #1\par} \nobreak \vskip 3ex \@afterheading } +\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus + -.2ex}{2.3ex plus .2ex}{\LARGE\bf}} +\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus + -.2ex}{1.5ex plus .2ex}{\Large\bf}} + +\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus + -1ex minus -.2ex}{1.5ex plus .2ex}{\large\bf}} + +\def\paragraph{\@startsection + {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}} + +\def\subparagraph{\@startsection + {subparagraph}{5}{\parindent}{3.25ex plus 1ex minus + .2ex}{-1em}{\normalsize\bf}} + +\setcounter{secnumdepth}{0} + +\def\appendix{\par + \setcounter{section}{0} + \setcounter{subsection}{0} + + \def\thesection{\Alph{section}}} + +\leftmargini 2.5em +\leftmarginii 2.2em \leftmarginiii 1.87em \leftmarginiv 1.7em \leftmarginv 1em +\leftmarginvi 1em +\leftmargin\leftmargini +\labelwidth\leftmargini\advance\labelwidth-\labelsep +\labelsep .5em +\parsep 4.5pt plus 2pt minus 1pt +\def\@listi{\leftmargin\leftmargini} +\def\@listii{\leftmargin\leftmarginii + \labelwidth\leftmarginii\advance\labelwidth-\labelsep + \topsep 4.5pt plus 2pt minus 1pt + \parsep 2pt plus 1pt minus 1pt + \itemsep \parsep} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii\advance\labelwidth-\labelsep + \topsep 2pt plus 1pt minus 1pt + \parsep \z@ \partopsep 1pt plus 0pt minus 1pt + \itemsep \topsep} +\def\@listiv{\leftmargin\leftmarginiv + \labelwidth\leftmarginiv\advance\labelwidth-\labelsep} +\def\@listv{\leftmargin\leftmarginv + \labelwidth\leftmarginv\advance\labelwidth-\labelsep} +\def\@listvi{\leftmargin\leftmarginvi + \labelwidth\leftmarginvi\advance\labelwidth-\labelsep} +% diff --git a/indexing/glo+idxtex/pamphlet.sty b/indexing/glo+idxtex/pamphlet.sty new file mode 100644 index 0000000000..ded53373ee --- /dev/null +++ b/indexing/glo+idxtex/pamphlet.sty @@ -0,0 +1,291 @@ +% pamphlet.sty 29-Apr-1986 +\typeout{Document Style 'pamphlet', by RL Aurbach. V1.0 released April 29, 1986} +\def\@ptsize{1} \@namedef{ds@10pt}{\def\@ptsize{0}} +\@namedef{ds@11pt}{\def\@ptsize{1}} \@namedef{ds@12pt}{\def\@ptsize{2}} +\def\ds@twoside{\@twosidetrue \@mparswitchtrue} \def\ds@draft{\overfullrule +5pt} +\@options +\input pam1\@ptsize.sty\relax +\input crlext.sty\relax + +\def\glossaryname{Glossary} +\def\labelenumi{\arabic{enumi}.} +\def\theenumi{\arabic{enumi}} +\def\labelenumii{(\alph{enumii})} +\def\theenumii{\alph{enumii}} +\def\p@enumii{\theenumi} +\def\labelenumiii{\roman{enumiii}.} +\def\theenumiii{\roman{enumiii}} +\def\p@enumiii{\theenumi(\theenumii)} +\def\labelenumiv{\Alph{enumiv}.} +\def\theenumiv{\Alph{enumiv}} +\def\p@enumiv{\p@enumiii\theenumiii} + +\def\labelitemi{$\bullet$} +\def\labelitemii{\bf --} +\def\labelitemiii{$\ast$} +\def\labelitemiv{$\cdot$} + +\def\verse{\let\\=\@centercr + \list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent + \rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]} +\let\endverse\endlist + +\def\quotation{\list{}{\listparindent 1.5em + \itemindent\listparindent + \rightmargin\leftmargin \parsep 0pt plus 1pt}\item[]} +\let\endquotation=\endlist + +\def\quote{\list{}{\rightmargin\leftmargin}\item[]} +\let\endquote=\endlist + +\def\descriptionlabel#1{\hspace\labelsep \bf #1} +\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\descriptionlabel}} +\let\enddescription\endlist + +\def\titlepage{\@restone\colfalse\if@twocolumn\@restonecoltrue\onecolumn + \else \newpage \fi \thispagestyle{empty}} +\def\endtitlepage{\cleardoublepage \if@restonecol\twocolumn \fi \c@page \@ne} + +\arraycolsep 5pt \tabcolsep 6pt \arrayrulewidth .4pt \doublerulesep 2pt +\tabbingsep \labelsep + +\skip\@mpfootins = \skip\footins +\fboxsep = 3pt \fboxrule = .4pt + +\newcounter{part} +\newcounter {section} +\newcounter {subsection}[section] +\newcounter {subsubsection}[subsection] +\newcounter {paragraph}[subsubsection] +\newcounter {subparagraph}[paragraph] + +\def\thepart{\Roman{part}} \def\thesection {\arabic{section}} +\def\thesubsection {\thesection.\arabic{subsection}} +\def\thesubsubsection {\thesubsection .\arabic{subsubsection}} +\def\theparagraph {\thesubsubsection.\arabic{paragraph}} +\def\thesubparagraph {\theparagraph.\arabic{subparagraph}} + +\def\@pnumwidth{1.55em} +\def\@tocrmarg {2.55em} +\def\@dotsep{4.5} +\setcounter{tocdepth}{5} + +\def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn + \fi\cleardoublepage\thispagestyle{plain} + \section*{Contents\markboth{Contents}{Contents}} + \typeout{Table of Contents.} + \begingroup \parskip \z@ plus 1 pt \@starttoc{toc} \endgroup + \if@restonecol\twocolumn\fi \cleardoublepage} + +\def\l@part#1#2{\addpenalty{\@secpenalty} + \addvspace{2.25em plus 1pt} \begingroup + \@tempdima 3em \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth + {\Large\bf \leavevmode #1\hfil \normalsize\rm \hbox to\@pnumwidth{\hss #2}}\par + \nobreak \endgroup} + +\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt} + \@tempdima 1.5em \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \large\bf \leavevmode #1\hfil \normalsize\rm \hbox to\@pnumwidth{\hss #2}\par + \endgroup} + +\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} + +\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}} + +\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}} + +\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}} + +\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi + \cleardoublepage\thispagestyle{plain} + \section*{List of Figures\markboth + {List of Figures}{List of Figures}} \typeout{List of Figures.} + \begingroup \parskip \z@ plus 1pt \@starttoc{lof} \endgroup + \if@restonecol\twocolumn \fi \cleardoublepage} + +\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}} + +\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi + \cleardoublepage\thispagestyle{plain} + \section*{List of Tables\markboth + {List of Tables}{List of Tables}} \typeout{List of Tables.} + \begingroup \parskip \z@ plus 1pt \@starttoc{lot} \endgroup + \if@restonecol\twocolumn \fi \cleardoublepage} + +\let\l@table\l@figure + +\def\thebibliography#1{\section{References} \list + + {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth + \advance\leftmargin\labelsep + \usecounter{enumi}} + \def\newblock{\hskip .11em plus .33em minus -.07em} + \sloppy + \sfcode`\.=1000\relax} + +\let\endthebibliography=\endlist + +\newif\if@restonecol +\def\theindex{\cleardoublepage\@restonecoltrue\if@twocolumn\@restonecolfalse\fi + \columnseprule \z@ + \columnsep 35pt\twocolumn[\section*{\indexname}] + \addcontentsline{toc}{section}{\indexname} \typeout{Index.} + \markboth{\indexname}{\indexname}\thispagestyle{plain}\parindent\z@ + \parskip\z@ plus .3pt\relax\let\item\@idxitem} +\def\@idxitem{\par\hangindent 40pt} +\def\subitem{\par\hangindent 40pt \hspace*{20pt}} +\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}} +\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi} +\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax} + +\def\theglossary{\section{\glossaryname} \typeout{Glossary.} \begin{infomap}} +\def\endtheglossary{\end{infomap}} + +\def\footnoterule{\kern-3\p@ + \hrule width .4\columnwidth + \kern 2.6\p@} + +\long\def\@makefntext#1{\parindent 1em\noindent + \hbox to 1.8em{\hss$^{\@thefnmark}$}#1} + +\setcounter{topnumber}{2} +\def\topfraction{.7} +\setcounter{bottomnumber}{1} +\def\bottomfraction{.3} +\setcounter{totalnumber}{3} +\def\textfraction{.2} +\def\floatpagefraction{.5} +\setcounter{dbltopnumber}{2} +\def\dbltopfraction{.7} +\def\dblfloatpagefraction{.5} + +\long\def\@makecaption#1#2{ + \vskip 10pt + \setbox\@tempboxa\hbox{#1: #2} + \ifdim \wd\@tempboxa >\hsize \unhbox\@tempboxa\par \else \hbox +to\hsize{\hfil\box\@tempboxa\hfil} + \fi} + +\newcounter{figure} +\def\thefigure{\@arabic\c@figure} +\def\fps@figure{tbp} +\def\ftype@figure{1} +\def\ext@figure{lof} +\def\fnum@figure{Figure \thefigure} +\def\figure{\@float{figure}} +\let\endfigure\end@float +\@namedef{figure*}{\@dblfloat{figure}} +\@namedef{endfigure*}{\end@dblfloat} +\newcounter{table} +\def\thetable{\@arabic\c@table} +\def\fps@table{tbp} +\def\ftype@table{2} +\def\ext@table{lot} +\def\fnum@table{Table \thetable} +\def\table{\@float{table}} +\let\endtable\end@float +\@namedef{table*}{\@dblfloat{table}} +\@namedef{endtable*}{\end@dblfloat} + +\mark{{}{}} + +\def\ps@headings{ + \def\@oddfoot{\rm \@pagedate \hfil {\small \@confidentiality} + \hfil {\large\bf \thepage}} + \def\@evenfoot{{\large\bf \thepage} \hfil {\small \@confidentiality} + \hfil \rm \@pagedate} + \def\@oddhead{\hbox{} \hfil \Large\bf \rightmark} + \def\@evenhead{\Large\bf \leftmark \hfil} + \def\sectionmark##1{\markboth {##1}{##1}} + \def\subsectionmark##1{}} + +\def\ps@myheadings{ + \def\@oddfoot{\rm \@pagedate \hfil {\small \@confidentiality} + \hfil {\large\bf \thepage}} + \def\@evenfoot{{\large\bf \thepage} \hfil {\small \@confidentiality} + \hfil \rm \@pagedate} + \def\@oddhead{\hbox{} \hfil \rightmark} \def\@evenhead{\leftmark \hfil} + \def\sectionmark##1{} \def\subsectionmark##1{}} + +\def\ps@plain{ + \def\@oddfoot{\rm \@pagedate \hfil {\small \@confidentiality} + \hfil {\large\bf \thepage}} + \def\@evenfoot{{\large\bf \thepage} \hfil {\small \@confidentiality} + \hfil \rm \@pagedate} + \def\@oddhead{} \def\@evenhead{} + \def\sectionmark##1{} \def\subsectionmark##1{}} + +\def\ps@empty{ + \def\@oddfoot{\hbox{} \hfil {\small \@confidentiality} \hfil} + \def\@evenfoot{\hbox{} \hfil {\small \@confidentiality} \hfil} + \def\@oddhead{} \def\@evenhead{} + \def\sectionmark##1{} \def\subsectionmark##1{}} + +\def\today{\@ifstar% + {\number\day-\ifcase\month\or Jan\or Feb\or Mar \or Apr\or May\or Jun\or + Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi-\number\year} + {\ifcase\month\or January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year}} + +\def\@pagedate{\hbox{}} \def\@confidentiality{\hbox{}} +\def\pagedate#1{\def\@pagedate{\hbox{#1}}} +\def\confidentiality#1{\def\@confidentiality{\hbox{#1}}} + +\def\theequation{\arabic{equation}} + +\ps@plain \pagenumbering{arabic} \onecolumn \raggedbottom +\def\title#1{\def\@title{#1}} \def\@title{} +\def\author#1{\def\@author{#1}} \def\@author{} +\def\authorfacts#1{\def\@authorfacts{#1}} \def\@authorfacts{} +\def\version#1{\def\@version{#1}} \def\@version{} +\def\date#1{\def\@date{#1}} \def\@date{\today} +\def\file#1{\def\@file{#1}} \def\@file{} + +\def\thetitle{\thispagestyle{empty}\begin{center} + \relax \vspace*{.5in} + \huge \bf + \begin{tabular}[t]{c} + User's Guide \\ + to the \\ + \end{tabular} \\ + \Huge \bf + \begin{tabular}{c} \@title \end{tabular} \\ + \vspace{2em} + {\Large \bf \@version}\\ + \end{center}} + +\def\abstract{\vspace{2em} \begin{center} \large\bf Abstract \end{center} \par + \list{}{\leftmargin 4em \rightmargin\leftmargin}\item[]} +\let\endabstract=\endlist + +\def\endthetitle{ + \vspace{2em} + \begin{center} + \begin{tabular}[t]{c} + \bf \@author \\ + \@authorfacts \\ + \end{tabular} \\ + \vspace{1em} + \@date + \vfill + [ File: \@file.QMS ] + \end{center} + \cleardoublepage} + +\def\makeheading{\pagenumbering{arabic} \thispagestyle{plain} + \begin{center} + \LARGE \bf + \begin{tabular}[t]{c} + User's Guide \\ + to the \\ + \end{tabular} \\ + \huge \bf + \begin{tabular}{c} \@title \end{tabular} \\ + \end{center} + \vspace{4em}} +% -- cgit v1.2.3