summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:46:03 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:46:03 +0000
commit873660d1a83ece926fe7206288dda9c36b349c1b (patch)
treea48f77125c309a355b5d0eb58d6b24446abe9d62 /Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht
parent2939242967231097459df0fc3150fabc2f639111 (diff)
generic 1
git-svn-id: svn://tug.org/texlive/trunk@613 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht')
-rw-r--r--Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht169
1 files changed, 169 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht b/Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht
new file mode 100644
index 00000000000..09710d1c94c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/tex4ht/idxmake.4ht
@@ -0,0 +1,169 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% idxmake.4ht 2005-10-23-04:19 %
+% Copyright (C) 2000--2005 Eitan M. Gurari %
+% %
+% This work may be distributed and/or modified under the %
+% conditions of the LaTeX Project Public License, either %
+% version 1.3 of this license or (at your option) any %
+% later version. The latest version of this license is %
+% in %
+% http://www.latex-project.org/lppl.txt %
+% and version 1.3 or later is part of all distributions %
+% of LaTeX version 2003/12/01 or later. %
+% %
+% This work has the LPPL maintenance status "maintained".%
+% %
+% This Current Maintainer of this work %
+% is Eitan M. Gurari. %
+% %
+% If you modify this program your changing its signature %
+% with a directive of the following form will be %
+% appreciated. %
+% \message{signature} %
+% %
+% gurari@cse.ohio-state.edu %
+% http://www.cse.ohio-state.edu/~gurari %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\immediate\write-1{version 2005-10-23-04:19}
+
+
+\def\SourceInd#1#2#3#4{#1.#2}
+\def\MakefileInd#1#2#3#4{#1.#4}
+
+\newcount\cnt
+\newtoks\split
+
+\def\noXcatcodes{%
+ \cnt=0
+ \def\noXXcatcodes{%
+ \catcode\cnt12
+ \ifnum\cnt<255
+ \advance\cnt 1 \expandafter\noXXcatcodes
+ \fi }%
+ \noXXcatcodes }
+
+\newwrite\idx
+\newwrite\indexes
+\def\MakefileIn#1#2#3#4{#1.#3}
+\def\MakefileIndexes#1#2#3#4{#1.4ix}
+\immediate\openout\idx=\expandafter\MakefileIn\filename\relax
+\immediate\openout\indexes=\expandafter\MakefileIndexes\filename\relax
+
+\def\beforeentry#1#2#3#4{
+ \def\file{#1}\def\anchor{#2}\def\pointer{#3}\def\indexentry{\string#4}
+ \begingroup \noXcatcodes
+ \catcode`\s=11 \catcode`\e=11 `%for \see`%
+ \catcode`\^^M=10 \catcode`\ =10 \catcode`\^^I=10
+ \catcode`\{=1 \catcode`\}=2 \futurelet\next\preGetentries
+}
+\def\bparent#1|(#2!*?: {\def\core{#1}\def\parent{#2}}
+\def\eparent#1|)#2!*?: {\def\core{#1}\def\parent{#2}}
+\def\see#1|see#2|see#3!*?: {\def\preSee{#1}\def\isSee{#2}}
+\newcount\entryNum
+\def\preGetentries{\ifx [\next \expandafter\opGetentries
+ \else \global\split={}\expandafter\getentries\fi}
+\def\opGetentries[#1]{\global\split={[#1]}\getentries}
+
+\def\getentries#1#2{\endgroup
+ \advance\entryNum by 1
+ \let\parent=\empty
+ \bparent#1|(!*?: \ifx \parent\empty
+ \eparent#1|)!*?: \ifx \parent\empty
+ \see#1|see|see!*?: %
+\ifx \isSee\empty
+ \hasBar#1|!*?: {#1}{#2}%
+\else
+ \immediate\write\idx{\indexentry\the\split{%
+ \preSee|see{\string\LNK{\file}{\anchor}{\isSee}{}}}{\the\entryNum
+}}%
+ \immediate\write\indexes{\string \indexmark\the\split{%
+ \preSee}{\the\entryNum
+}}%
+\fi
+%
+ \else
+ \immediate\write\idx{\indexentry\the\split{%
+ \core|LNK\csname \core|(\endcsname
+ --\string\LNK{\file}{\anchor}{\pointer}}{\the\entryNum
+}}%
+ \immediate\write\indexes{\string \indexmark\the\split{%
+ \core}{\the\entryNum
+}}%
+ \fi
+ \else
+ \expandafter\edef\csname \core|(\endcsname
+ {{\file}{\anchor}{\pointer}{\the\entryNum
+}}%
+ \fi
+}
+\def\hasBar#1|#2!*?: #3#4{%
+ \def\temp{#2}\ifx \temp\empty
+ \immediate\write\idx{\indexentry\the\split{%
+ #3|LNK{\file}{\anchor}{\pointer}}{\the\entryNum
+}}%
+ \immediate\write\indexes{\string \indexmark\the\split{%
+ #3}{\the\entryNum
+}}%
+ \else \yeshasBar#3!*?: {\the\entryNum
+}\fi
+}
+\def\yeshasBar#1|#2!*?: #3{%
+ \immediate\write\idx{\indexentry\the\split{%
+ #1\string\let\string\LNKidx\expandafter\string\csname
+ #2\endcsname|LNK{\file}{\anchor}{\pointer}}{\the\entryNum
+}}%
+ \immediate\write\indexes{\string \indexmark\the\split{%
+ #2}{\the\entryNum
+}}%
+}
+
+\newcount\GetentriesN
+\GetentriesN=0
+\def\indexentry{\string\indexentry}
+\def\Ganchor{\ifnum \GetentriesN<10 0\fi
+ \ifnum \GetentriesN<100 0\fi
+ \ifnum \GetentriesN<1000 0\fi
+ \the\GetentriesN}
+\def\Beforeentry{\let\getentries=\Getentries
+ \let\Beforeentry=\beforeentry \Beforeentry}
+\def\Getentries#1#2{\endgroup
+ \advance\GetentriesN by 1
+ \let\parent=\empty
+ \bparent#1|(!*?: \ifx \parent\empty
+ \eparent#1|)!*?: \ifx \parent\empty
+ \see#1|see|see!*?: %
+ \ifx \isSee\empty \immediate\write\idx{\indexentry\the\split{%
+ \string\indNum{\Ganchor}%
+%
+ #1\string\indNum{\Ganchor}%
+\string\comNum}{#2}}%
+%
+ \else \immediate\write\idx{\indexentry\the\split{%
+ {\Ganchor}%
+ \preSee\string\gobble|see{\isSee}}{#2}}%
+\fi
+ \else
+ \immediate\write\idx{\indexentry\the\split{%
+ \string\indNum{\Ganchor}%
+\string\erange{\csname \core|(\endcsname}
+ \core\string\indNum{\Ganchor}%
+\string\comNum}{#2}}%
+ \fi
+ \else
+ \immediate\write\idx{\indexentry\the\split{%
+ \string\indNum{\Ganchor}%
+\string\brange{\Ganchor}
+ \core\string\indNum{\Ganchor}%
+\string\comNum}{#2}}%
+ \expandafter\edef\csname \core|(\endcsname{\Ganchor}%
+ \fi
+}
+
+\input \expandafter\SourceInd\filename\relax
+\immediate\closeout\idx
+\immediate\closeout\indexes
+
+
+\bye
+\endinput
+