1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
% idxmake.4ht 2005-03-27-10:43 %
3
% Copyright (C) 2000--2005 Eitan M. Gurari %
5
% This work may be distributed and/or modified under the %
6
% conditions of the LaTeX Project Public License, either %
7
% version 1.3 of this license or (at your option) any %
8
% later version. The latest version of this license is %
10
% http://www.latex-project.org/lppl.txt %
11
% and version 1.3 or later is part of all distributions %
12
% of LaTeX version 2003/12/01 or later. %
14
% This work has the LPPL maintenance status "maintained".%
16
% This Current Maintainer of this work %
17
% is Eitan M. Gurari. %
19
% If you modify this program your changing its signature %
20
% with a directive of the following form will be %
22
% \message{signature} %
24
% gurari@cse.ohio-state.edu %
25
% http://www.cse.ohio-state.edu/~gurari %
26
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
\immediate\write-1{version 2005-03-27-10:43}
30
\def\SourceInd#1#2#3#4{#1.#2}
31
\def\MakefileInd#1#2#3#4{#1.#4}
41
\advance\cnt 1 \expandafter\noXXcatcodes
47
\def\MakefileIn#1#2#3#4{#1.#3}
48
\def\MakefileIndexes#1#2#3#4{#1.4ix}
49
\immediate\openout\idx=\expandafter\MakefileIn\filename\relax
50
\immediate\openout\indexes=\expandafter\MakefileIndexes\filename\relax
52
\def\beforeentry#1#2#3#4{
53
\def\file{#1}\def\anchor{#2}\def\pointer{#3}
54
\begingroup \noXcatcodes
55
\catcode`\s=11 \catcode`\e=11 `%for \see`%
56
\catcode`\^^M=10 \catcode`\ =10 \catcode`\^^I=10
57
\catcode`\{=1 \catcode`\}=2 \futurelet\next\preGetentries
59
\def\bparent#1|(#2!*?: {\def\core{#1}\def\parent{#2}}
60
\def\eparent#1|)#2!*?: {\def\core{#1}\def\parent{#2}}
61
\def\see#1|see#2|see#3!*?: {\def\preSee{#1}\def\isSee{#2}}
63
\def\preGetentries{\ifx [\next \expandafter\opGetentries
64
\else \global\split={}\expandafter\getentries\fi}
65
\def\opGetentries[#1]{\global\split={[#1]}\getentries}
67
\def\getentries#1#2{\endgroup
68
\advance\entryNum by 1
70
\bparent#1|(!*?: \ifx \parent\empty
71
\eparent#1|)!*?: \ifx \parent\empty
74
\hasBar#1|!*?: {#1}{#2}%
76
\immediate\write\idx{\string \indexentry\the\split{%
77
\preSee|see{\string\LNK{\file}{\anchor}{\isSee}{}}}{\the\entryNum
79
\immediate\write\indexes{\string \indexmark\the\split{%
80
\preSee}{\the\entryNum
85
\immediate\write\idx{\string \indexentry\the\split{%
86
\core|LNK\csname \core|(\endcsname
87
--\string\LNK{\file}{\anchor}{\pointer}}{\the\entryNum
89
\immediate\write\indexes{\string \indexmark\the\split{%
94
\expandafter\edef\csname \core|(\endcsname
95
{{\file}{\anchor}{\pointer}{\the\entryNum
99
\def\hasBar#1|#2!*?: #3#4{%
100
\def\temp{#2}\ifx \temp\empty
101
\immediate\write\idx{\string \indexentry\the\split{%
102
#3|LNK{\file}{\anchor}{\pointer}}{\the\entryNum
104
\immediate\write\indexes{\string \indexmark\the\split{%
107
\else \yeshasBar#3!*?: {\the\entryNum
110
\def\yeshasBar#1|#2!*?: #3{%
111
\immediate\write\idx{\string \indexentry\the\split{%
112
#1\string\let\string\LNKidx\expandafter\string\csname
113
#2\endcsname|LNK{\file}{\anchor}{\pointer}}{\the\entryNum
115
\immediate\write\indexes{\string \indexmark\the\split{%
120
\newcount\GetentriesN
122
\def\Ganchor{\ifnum \GetentriesN<10 0\fi
123
\ifnum \GetentriesN<100 0\fi
124
\ifnum \GetentriesN<1000 0\fi
126
\def\Beforeentry{\let\getentries=\Getentries
127
\let\Beforeentry=\beforeentry \Beforeentry}
128
\def\Getentries#1#2{\endgroup
129
\advance\GetentriesN by 1
131
\bparent#1|(!*?: \ifx \parent\empty
132
\eparent#1|)!*?: \ifx \parent\empty
134
\ifx \isSee\empty \immediate\write\idx{\string \indexentry\the\split{%
135
\string\indNum{\Ganchor}%
137
#1\string\indNum{\Ganchor}%
138
\string\comNum}{#2}}%
140
\else \immediate\write\idx{\string \indexentry\the\split{%
142
\preSee\string\gobble|see{\isSee}}{#2}}%
145
\immediate\write\idx{\string \indexentry\the\split{%
146
\string\indNum{\Ganchor}%
147
\string\erange{\csname \core|(\endcsname}
148
\core\string\indNum{\Ganchor}%
149
\string\comNum}{#2}}%
152
\immediate\write\idx{\string \indexentry\the\split{%
153
\string\indNum{\Ganchor}%
154
\string\brange{\Ganchor}
155
\core\string\indNum{\Ganchor}%
156
\string\comNum}{#2}}%
157
\expandafter\edef\csname \core|(\endcsname{\Ganchor}%
161
\input \expandafter\SourceInd\filename\relax
162
\immediate\closeout\idx
163
\immediate\closeout\indexes