% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 29.1.5, p. III-492.
% Original source in file "io2.TEX", starting line 209.
\wlog{L: "ts-wind.tip" ["io2.TEX," l. 209, p. III-492]}%
% This file DOES belong to format "texip."
\InputD{verb-bas.tip}
\InputD{cstostr.tip}
\InputD{compst.tip}
\newif\ifIndexSpecial
\IndexSpecialfalse
\catcode`\@ = 11
\newwrite\IdxStream
\newwrite\IdxStreamSource
\newif\if@IndexFilesOpen
\@IndexFilesOpenfalse
\def\OpenIndexFiles #1{%
\if\EmptyStringConditional{#1}%
\gdef\@IndexFileBaseName{\jobname}%
\else
\gdef\@IndexFileBaseName{#1}%
\fi
\if@IndexFilesOpen
\message{\string\OpenIndexFiles: index files
already open.}%
\message{\string\OpenIndexFiles: will close
old files, open new ones with basename
"\@IndexFileBaseName".}%
\immediate\closeout\IdxStream
\immediate\closeout\IdxStreamSource
\fi
\@IndexFilesOpentrue
\immediate\openout\IdxStream = \@IndexFileBaseName.idx
\immediate\openout\IdxStreamSource = \@IndexFileBaseName.idx2
\SetIndexStream{\IdxStream}%
}
\def\CloseIndexFiles{%
\if@IndexFilesOpen
\immediate\closeout\IdxStream
\immediate\closeout\IdxStreamSource
\@IndexFilesOpenfalse
\fi
}
\def\SetIndexStream #1{%
\let\IdxStreamUse = #1%
}
\def\Index{%
\begingroup
\MkOthersNoCB
\@Index
}
\xdef\@IndexSuffixMod{}%
\def\@Index #1{%
\let\PrintCounter = \relax
\xdef\IndexTemp{%
\write\IdxStreamUse{%
\string\indexentry{#1\@IndexSuffixMod}%
{\PrintCounter{SWPageNo}}}%
}%
\ifIndexSpecial
\SideNoteText{I: #1}%
\fi
\xdef\@IndexSuffixMod{}%
\endgroup
\IndexTemp
}
\def\IndexP #1{%
\Index{#1}%
#1%
}
\def\IndexCS #1{%
\CSToString{\@IndexCSTemp}{#1}%
\expandafter\expandafter\expandafter
\Index{%
\@IndexCSTemp
@%
{%
\string\tt
\string\string
\string#1%
}%
}%
}
\def\IndexCSX #1{%
\CSToString{\@IndexCSTemp}{#1}%
\expandafter\expandafter\expandafter
\Index{%
#1%
@%
{%
\string\tt
\string\string
\Backslash#1%
}%
}%
}
\def\IndexCSP #1{%
\IndexCS{#1}%
{\tt\string#1}%
}
\def\IndexPrim #1{%
\CSToString{\@IndexCSTemp}{#1}%
\expandafter\expandafter\expandafter
\Index{\@IndexCSTemp @%
{\string\tt\string\string\string#1}|PRIMITIVE}%
}
\def\IndexPrimP #1{%
\IndexPrim{#1}%
{\tt\string #1}%
}
\def\IndexPar{\Index{par@\string\PrintParPrimitive}}
\def\PrintParPrimitive{\BackslashTt{\tt par}}
\def\IndexBye{\Index{bye@\string\PrintByePrimitive}}
\def\PrintByePrimitive{\BackslashTt{\tt bye}}
\def\IndexIf{\Index{if@\string\PrintIf|PRIMITIVE}}
\def\PrintIf{{\tt\string\if}}
\def\IndexElse{\Index{else@\string\PrintElse|PRIMITIVE}}
\def\PrintElse{{\tt\string\else}}
\def\IndexFi{\Index{fi@\string\PrintFi|PRIMITIVE}}
\def\PrintFi{{\tt\string\fi}}
\def\IndexIfCase{\Index{ifcase@\string\PrintIfCase|PRIMITIVE}}
\def\PrintIfCase{{\tt\string\ifcase}}
\def\IndexIfCat{\Index{ifcat@\string\PrintIfCat|PRIMITIVE}}
\def\PrintIfCat{{\tt\string\ifcat}}
\def\IndexIfX{\Index{ifx@\string\PrintIfX|PRIMITIVE}}
\def\PrintIfX{{\tt\string\ifx}}
\def\IndexIfOdd{\Index{ifodd@\string\PrintIfOdd|PRIMITIVE}}
\def\PrintIfOdd{{\tt\string\ifodd}}
\def\IndexIfHbox{\Index{ifhbox@\string\PrintIfHbox|PRIMITIVE}}
\def\PrintIfHbox{{\tt\string\ifhbox}}
\def\IndexIfVbox{\Index{ifvbox@\string\PrintIfVbox|PRIMITIVE}}
\def\PrintIfVbox{{\tt\string\ifvbox}}
\def\IndexIfVoid{\Index{ifvoid@\string\PrintIfVoid|PRIMITIVE}}
\def\PrintIfVoid{{\tt\string\ifvoid}}
\def\IndexIfNum{\Index{ifnum@\string\PrintIfNum|PRIMITIVE}}
\def\PrintIfNum{{\tt\string\ifnum}}
\def\IndexIfDim{\Index{ifdim@\string\PrintIfDim|PRIMITIVE}}
\def\PrintIfDim{{\tt\string\ifdim}}
\def\IndexIfHmode{\Index{ifhmode@\string\PrintIfHmode|PRIMITIVE}}
\def\PrintIfHmode{{\tt\string\ifhmode}}
\def\IndexIfVmode{\Index{ifvmode@\string\PrintIfVmode|PRIMITIVE}}
\def\PrintIfVmode{{\tt\string\ifvmode}}
\def\IndexIfMmode{\Index{ifvmode@\string\PrintIfMmode|PRIMITIVE}}
\def\PrintIfMmode{{\tt\string\ifvmode}}
\def\IndexIfInner{\Index{ifinner@\string\PrintIfInner|PRIMITIVE}}
\def\PrintIfInner{{\tt\string\ifinner}}
\def\IndexIfEof{\Index{ifeof@\string\PrintIfEof|PRIMITIVE}}
\def\PrintIfEof{{\tt\string\ifeof}}%
\def\IndexIfTrue{\Index{iftrue@\string\PrintIfTrue|PRIMITIVE}}
\def\PrintIfTrue{{\tt\string\iftrue}}%
\def\IndexIfFalse{\Index{iffalse@\string\PrintIfFalse|PRIMITIVE}}
\def\PrintIfFalse{{\tt\string\iffalse}}%
\def\IndexRepeat{\Index{repeat@\string\PrintRepeat}}
\def\PrintRepeat{{\tt\string\repeat}}%
\xdef\@IndexSuffixMod{}%
\def\IndexPSet #1{%
\CSToString{\@IndexPSetResult}{#1}%
\xdef\@IndexSuffixMod{|IndexP\@IndexPSetResult}%
}
\def\IndexPit #1{{\it #1}}
\def\IndexPbf #1{{\bf #1}}
\catcode`\@ = 12