blob: 1a24e9a6e5cd48a066f0f98973726f347b5ccddf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
#!/usr/bin/env perl
# $Id: makeindex4,v 1.9 2005/05/02 20:19:34 jschrod Exp $
#----------------------------------------------------------------------
#
# This is a perl-script that wraps xindy into a makeindex-like
# interface.
#
# NOTE: Usage of this script is depreciated. Use texindy instead.
# Yes, this is Perl 4 code -- it is as old. I don't plan to change
# that, as there's a better replacement available anyhow. Let's tell
# this with each usage... ;-)
print STDERR <<'_EOF_'
NOTE: Usage of makindex4 is depreciated. This script is not supported
any more. Please consider switching to the supported command texindy.
_EOF_
;
($progname = $0) =~ s#.*/##;
$Date = `date`;
require "getopts.pl";
# $debug = 1;
$numArgs = $#ARGV; # save number of Commandline-Arguments
# parse for makeindex command-line options
&Getopts( "dcgilo:p:qrs:t:" );
$debug = $opt_d;
# some debug-output
print STDERR "\@ARGV: @ARGV\n" if $debug;
print STDERR "\$#ARGV: $#ARGV\n" if $debug;
sub welcome {
print STDERR "\nusage:\t$progname [makeindex options] tex-index-file\n";
print STDERR <<EOMSG;
This file is a wrapper that makes `xindy' somehow behave as
`makeindex' does. Currenly it does not parse all command-line
arguments and some of the flags are differently implemented in the
xindy system. So don't expect it to be a plug-in replacement for the
makeindex-system.
EOMSG
exit(1);
}
$numArgs = $#ARGV; # number of Commandline-Arguments
if ( $numArgs eq 0 ) # only one argument
{ $Index = $ARGV[0]; } # the index
else { &welcome; }
print "Index = $Index\n" if $debug;
$IndexBase = $Index;
$IndexBase =~ s#\.[^\.]*$##;
print "IndexBase = $IndexBase\n" if $debug;
$TmpStyle = $IndexBase . ".xdy";
open(STY, ">$TmpStyle");
print STY <<EOSTY;
;; This file is generated automatically by `makeindex4'.
;; Date: $Date
;;
;; It is a temporary style-file that is necessary to run `xindy' properly.
EOSTY
if ($opt_c) { print STY <<EOSTY;
;; These lines implement the blank compression defined by
;; the -c switch of makeindex.
(merge-rule " +" " " :eregexp)
(merge-rule "^[ \t]+" "" :again :eregexp)
(merge-rule "[ \t]+$" "" :again :eregexp)
EOSTY
}
if ($opt_g) { print STDERR "The option -g not supported!\n"; }
if ($opt_i) { $UseStdin = 1; }
if ($opt_l) { print STY <<EOSTY;
(sort-rule \" \" \"\")
EOSTY
}
if ($opt_q) { print STDERR "The option -q not supported!\n"; }
if ($opt_r) { print STDERR "The option -r not supported!\n"; }
if ($opt_o) { $OutputFile = $opt_o; }
if ($opt_p) { print STDERR "The option -p not supported!\n"; }
if ($opt_s) { print STDERR "The option -s not supported!\n"; }
if ($opt_t) { $LogFile = $opt_t; }
if ( $Index eq $IndexBase ) { $Index = $IndexBase . ".idx"; }
print "Index = $Index\n" if $debug;
unless ($OutputFile) { $OutputFile = $IndexBase . ".ind"; }
print "Outputfile = $OutputFile\n" if $debug;
unless ($LogFile) { $LogFile = $IndexBase . ".ilg"; }
print "Logfile = $LogFile\n" if $debug;
$RawIndex = $IndexBase . ".raw";
$RawIndexStat = $IndexBase . ".sta";
$CmdLine = "tex2xindy $RawIndexStat < $Index > $RawIndex";
print "\nRunning tex2xindy...\n";
print "+ $CmdLine\n";
system($CmdLine);
open(STA, "sort $RawIndexStat | uniq |");
$Attr = "(define-attributes ((";
while( <STA> ) {
chop;
($attr, $type) = split(/\t/);
if ($type eq "locref") {
unless ($attr eq "") {
$LocAttrs .= "\"$attr\" ";
$LocMarkup .= "(markup-locref :open \"\\$attr" .
"{\" :close \"}\" :attr \"$attr\")\n";
}
} else {
if (! $attr eq "see" ) {
$XrefAttrNames .= "\"$attr\" ";
$XrefAttrs .= "(define-crossref-class \"$attr\")\n";
$XrefMarkup .= "(markup-crossref-list :open \"\\$attr" .
"{\" :close \"}{}\")\n";
}
}
}
print STY <<EOSTY;
;; The following attributes were detected.
(define-attributes (($LocAttrs\"default\")))
;; This is the markup as generated by makeindex.
$LocMarkup
;; The following cross-referernces were detected.
(define-crossref-class "see")
$XrefAttrs
;; This is the markup as generated by makeindex.
(markup-crossref-list :open "\see{" :close "}{}" :class "see")
$XrefMarkup
;; Here are the location-classes
(define-location-class "arabic-page-numbers" ("arabic-numbers"))
(define-location-class "roman-page-numbers" ("roman-numbers-lowercase"))
(define-location-class "Roman-page-numbers" ("roman-numbers-uppercase"))
(define-location-class "alpha-page-numbers" ("alpha"))
(define-location-class "Alpha-page-numbers" ("ALPHA"))
(define-location-class-order ("roman-page-numbers"
"arabic-page-numbers"
"alpha-page-numbers"
"Roman-page-numbers"
"Alpha-page-numbers"
"see" $XrefAttrNames))
;; Now load the rest of the makeindex-module...
(require "tex/makeidx4.xdy")
;; End
EOSTY
close(STY);
$CmdLine = "xindy.v2 -o $OutputFile -l $LogFile $TmpStyle $RawIndex";
print "\nRunning xindy...\n";
print "+ $CmdLine\n";
exec($CmdLine);
# ============================================================
#
# $Log: makeindex4,v $
# Revision 1.9 2005/05/02 20:19:34 jschrod
# Old xindy command is called xindy.v2.
#
# Revision 1.8 2004/10/05 21:13:21 jschrod
# Notes that its usage is depreciated. Doesn't reference the Quick
# Guide any more.
# Assumes /usr/bin/perl to exist.
#
# Revision 1.7 1999/04/27 08:56:59 kehr
# Another checkin.
#
# Revision 1.6 1997/04/03 13:49:05 kehr
# Removed a UNIX platform dependency from the code.
#
# Revision 1.5 1997/02/13 14:42:47 kehr
# Minor changes.
#
# Revision 1.4 1997/02/13 13:57:54 kehr
# makeindex4 now uses the module `makeidx4.xdy'.
#
# Revision 1.3 1997/01/21 16:44:33 kehr
# Bugfix: State <print> was not changed back to <key> if {LEVEL} was found.
#
# Revision 1.2 1997/01/17 16:30:35 kehr
# Rewrote makeindex4 and heavily modified tex2xindy.
#
#
|