diff options
author | Karl Berry <karl@freefriends.org> | 2006-07-18 23:01:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-07-18 23:01:09 +0000 |
commit | 89128513e8c72c5c04c3284a7758fc333a761aec (patch) | |
tree | c64b7c4039d3f195ca5dd7adcb579209eab3bcd4 /Master/texmf-dist/source/latex/splitindex | |
parent | fc2c7ab430ef4b878fd3455118daa831e76db681 (diff) |
splitindex update (8mar06)
git-svn-id: svn://tug.org/texlive/trunk@1879 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/splitindex')
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/install.sh | 178 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitidx.dtx | 137 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitidx.ins | 20 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitindex-Linux-i386 | bin | 9924 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitindex-OpenBSD-i386 | bin | 16384 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitindex.class | bin | 9303 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitindex.exe | bin | 18944 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitindex.java | 415 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/splitindex/splitindex.pl | 186 |
9 files changed, 136 insertions, 800 deletions
diff --git a/Master/texmf-dist/source/latex/splitindex/install.sh b/Master/texmf-dist/source/latex/splitindex/install.sh deleted file mode 100644 index 5d75fb85f7e..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/install.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/sh - -while [ $# -gt 0 ]; do - case $1 in - --prefix) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --prefix" >&2 - exit 1 - else - prefix=$2 - shift 2 - fi - ;; - --prefix=*) - prefix=${1#--prefix=} - shift 1 - ;; - --bindir) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --bindir" >&2 - exit 1 - else - bindir=$2 - shift 2 - fi - ;; - --bindir=*) - bindir=${1#--bindir=} - shift 1 - ;; - --mandir) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --mandir" >&2 - exit 1 - else - mandir=$2 - shift 2 - fi - ;; - --mandir=*) - mandir=${1#--mandir=} - shift 1 - ;; - --texmf) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --texmf" >&2 - exit 1 - else - texmf=$2 - shift 2 - fi - ;; - --texmf=*) - texmf=${1#--texmf=} - shift 1 - ;; - --version|-v) - echo "install.sh v0.1" - echo "Copyright (c) Markus Kohm 2002" - exit 0 - ;; - --help|-h) - echo "Usage: install.sh [OPTIONS]" - echo - echo "Installs SplitIndex for all unix like environments." - echo - echo "OPTIONS:" - echo "--prefix=<DIR> install binaries at <DIR>/bin and manuals at <DIR>/man" - echo " (default: /usr/local)" - echo "--bindir=<DIR> install binaries at <DIR>" - echo "--mandir=<DIR> install manuals at <DIR>" - echo "--texmf=<DIR> install packages and TeX programs at <DIR>/tex/latex/misc," - echo " documentation (dvi and pdf) at <DIR>/doc/latex/splitidx and" - echo " sources at <DIR>/source/latex/splitidx" - echo " (default: \$TEXMFLOCAL if you are root and \$HOMETEXMF if" - echo " you are not root)" - exit 0 - ;; - --dist) - mkdir splitidx - cp -a splitindex splitindex-Linux-i386 - cp -a splitindex.tex splitindex.pl splitindex.c splitindex.java \ - splitindex.class splitindex.exe splitidx.dtx splitidx.ins \ - splitindex-Linux-i386 splitindex-OpenBSD-i386 \ - splitindex.1 install.txt manifest.txt install.sh \ - README splitidx - tar jcvf splitidx-`date -I`.tar.bz2 splitidx - cd splitidx - ./install.sh --prefix ../chroot --texmf ../chroot/texmf - cd .. - rm -r splitidx - find chroot | sed 's/chroot\//+-/g;s/[a-z0-9]*\//-/g' - exit 0 - ;; - *) - echo "unkown option \`$1'" >&2 - echo "Try \`./install.sh --help' for more information." >&2 - exit 1; - ;; - esac -done - -case `uname -s -m` in - OpenBSD*i?86*) - cp -pf splitindex-OpenBSD-i386 splitindex - splitindex=splitindex - ;; - Linux*i?86*) - cp -pf splitindex-Linux-i386 splitindex - splitindex=splitindex - ;; - CYGWIN*i?86*) - splitindex=splitindex.exe - ;; - *) - if ! ./splitindex -V; then - echo 'Os '`uname -s -m`' not supported!' - echo 'Trying to compile the source:' - gcc -O3 -Wall -o splitindex splitindex.c || \ - gcc -O3 -Wall -DNO_LONGOPT -o splitindex splitindex.c || \ - echo 'You have to compile splitindex.c by your own!' - fi - if ./splitindex -V; then - splitindex=splitindex - fi - ;; -esac - -if [ -z "$prefix" ]; then - prefix=/usr/local -fi -if [ -z "$bindir" ]; then - bindir=$prefix/bin -fi -if [ -z "$mandir" ]; then - mandir=$prefix/man -fi -if [ -z "$texmf" ]; then - if [ "r$USER" = "rroot" ]; then - texmf=`kpsexpand '$TEXMFLOCAL'` - else - texmf=`kpsexpand '$HOMETEXMF'` - fi - if [ -z "$texmf" ]; then - echo "kpsexpand '$TEXMFLOCAL' or kpsexpand '$HOMETEXMF' failed!" >&2 - echo "You have to use option --texmf=<DIR>." >&2 - echo "This error is fatal!" >&2 - exit 1 - fi -fi - -latex splitidx.ins - -latex splitidx.dtx -latex splitidx.dtx -mkindex splitidx -latex splitidx.dtx - -pdflatex splitidx.dtx -pdflatex splitidx.dtx -mkindex splitidx -pdflatex splitidx.dtx - -install -m 755 -d $bindir -install -m 755 -d $mandir/man1 -install -m 755 -d $texmf/tex/latex/misc -install -m 755 -d $texmf/source/latex/splitidx -install -m 755 -d $texmf/doc/latex/splitidx -install -m 755 $splitindex splitindex.pl $bindir -install -m 644 splitindex.class $bindir -install -m 644 splitindex.1 $mandir/man1 -install -m 644 splitindex.tex splitidx.sty $texmf/tex/latex/misc -install -m 644 splitidx.dvi splitidx.pdf $texmf/doc/latex/splitidx - -install README splitindex.c splitindex.java splitindex.exe \ - splitindex-Linux-i386 splitindex-OpenBSD-i386 \ - splitidx.dtx manifest.txt install.txt install.sh \ - $texmf/source/latex/splitidx diff --git a/Master/texmf-dist/source/latex/splitindex/splitidx.dtx b/Master/texmf-dist/source/latex/splitindex/splitidx.dtx index 68f775c2c26..dc1dd2be757 100644 --- a/Master/texmf-dist/source/latex/splitindex/splitidx.dtx +++ b/Master/texmf-dist/source/latex/splitindex/splitidx.dtx @@ -1,21 +1,24 @@ -% \CheckSum{487} +% \CheckSum{551} % \iffalse % ====================================================================== % splitindex.dtx -% Copyright (c) Markus Kohm, 2002 +% Copyright (c) Markus Kohm, 2002-2006 % -% $Id: splitidx.dtx,v 1.14 2003/01/05 10:50:42 mjk Exp $ +% $Id: splitidx.dtx,v 1.2 2006/03/07 10:41:51 mjk Exp $ % % This file is part of the `SplitIndex bundle'. % --------------------------------------------- % % This file can be redistributed and/or modified under the conditions -% of the LaTeX Project Public License, either version 1.2 of this +% of the LaTeX Project Public License, either version 1.3a 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.2 or later is part of all distributions of LaTeX -% version 1999/12/01 or later. +% and version 1.3a or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has status 'maintained'. +% Maintainer is Markus Kohm <komascript@gmx.info>. % % You are not allowed to redistribute this file without all the % other files of the `SplitIndex bundle'. The list of all files @@ -31,7 +34,7 @@ %<driver>\ProvidesFile{splitidx.drv}[% %<package>\ProvidesPackage{splitidx}[% % \fi - 2003/01/05 v0.2a multiple indices for LaTeX] + 2006/03/07 v0.9 multiple indices for LaTeX] % \iffalse %<*driver> \documentclass{ltxdoc} @@ -236,6 +239,20 @@ % \cs{sindex}\oarg{shortcut}\marg{indexentry} will result in % \cs{index}\marg{indexentry}. % +% If you like, you may also declare that \cs{index} should be the same +% like command \cs{sindex}. In this case, you may use package +% option \texttt{useindex}, e.g.: +% \begin{verbatim} +% \usepackage[useindex]{splitidx} +% \end{verbatim}\vspace{-\baselineskip} +% This may be usefull using packages like \textsf{jurabib} that expects +% \cs{index} to be the index command. +% +% \emph{Note: Currently only one of the options \texttt{allatone} and +% \texttt{useindex} can be used at same time. If you are using both +% \texttt{useindex} will be disabled! This may result in many error +% messages!} +% % % \subsection{Printing an index} % @@ -272,6 +289,52 @@ % command. And if you are using this option, the characters of the shortcuts % must be letters. % +% \DescribeMacro{\newprotectedindex} +% Using standard index package \textsf{makeidx} the \LaTeX{} kernel command +% \cs{index} may expand the argument of \cs{index}. The kernel uses +% \cs{@santize} to avoid this in some cases. But this fails, if the argument +% was already read e.g. by another macro. So if you define a macro, that reads +% an argument, does something with the argument and write it to the index this +% may expand the argument. Try following: +% \begin{verbatim} +% \documentclass{article} +% \usepackage{ngerman} +% \usepackage{makeidx}\makeindex +% \newcommand*{\Test}[1]{#1\index{#1}} +% \begin{document} +% \Test{"Anderung} +% "Anderung\index{"Anderung} +% \end{document} +% \end{verbatim}\vspace{-\baselineskip} +% This will result in two entries at the \texttt{.idx} file: +% \begin{verbatim} +% \indexentry{\active@dq \dq@prtct{A}nderung}{1} +% \indexentry{"Anderung}{1} +% \end{verbatim}\vspace{-\baselineskip} +% The first one is something expanded that is not wanted. Package +% \textsf{splitindx} behaves same by default. But if you are using +% \cs{newprotectedindex} to define a new index, it uses a trick so avoid +% expansion. If all indices should behave like this, you may simply use +% package option \texttt{protected}. +% \begin{verbatim} +% \documentclass{article} +% \usepackage{ngerman} +% \usepackage[protected,useindex,makeindex]{makeidx} +% \newcommand*{\Test}[1]{#1\index{#1}} +% \begin{document} +% \Test{"Anderung} +% "Anderung\index{"Anderung} +% \end{document} +% \end{verbatim}\vspace{-\baselineskip} +% Will result in two entries at the \texttt{.idx} file: +% \begin{verbatim} +% \indexentry{"Anderung}{1} +% \indexentry{"Anderung}{1} +% \end{verbatim}\vspace{-\baselineskip} +% If you want to know more about the trick, see command +% \cs{@onelevel@sanitize} at the \LaTeX{} kernel documentation, +% \texttt{source2e}. +% % % \DescribeMacro{\printindex} % \changes{v0.2a}{2003/01/05}{fix of documentation bug} @@ -932,10 +995,25 @@ \DeclareOption{makeindex}{\AtEndOfPackage{\makeindex}} % \end{macrocode} % +% \changes{v0.9}{2006/05/07}{new option \texttt{useindex}} +% With option \texttt{useindex} the original command \cs{index} behaves like +% \cs{sindex}. +% \begin{macrocode} +\DeclareOption{useindex}{% + \def\@se@nd@xc@d@{\let\index\sindex}% + \AtEndOfPackage{\@se@nd@xc@d@}% +} +\let\@se@nd@xc@d@\relax +% \end{macrocode} +% % There is also an option to make \cs{sindex} ignores it optional argument and % behaves like \cs{index}. % \begin{macrocode} \DeclareOption{allatone}{% + \ifx\@se@nd@xc@d@\relax\else + \PackageInfo{splitidx}{option `allatone' overwrites option `useindex'}% + \let\@se@nd@xc@d@\relax + \fi \AtEndOfPackage{% \renewcommand*{\sindex}[1][]{\index}% \g@addto@macro\makeindex{\renewcommand*{\sindex}[1][]{\index}}% @@ -943,6 +1021,13 @@ } % \end{macrocode} % +% \changes{v0.9}{2006/05/07}{new option \texttt{protected}} +% Do not expand index arguments. +% \begin{macrocode} +\newif\if@verbindex\@verbindexfalse +\DeclareOption{protected}{\@verbindextrue} +% \end{macrocode} +% % \changes{v0.2}{2002/11/15}{new option \texttt{idxcommands}} % With option \texttt{idxcommands} every \cs{newindex} also defines a new index % command. @@ -987,6 +1072,7 @@ % % \begin{macro}{\sindex} % \begin{macro}{\@wrsindex} +% \changes{v0.9}{2006/03/07}{optionally do not expand the index argument} % \begin{macro}{\@@wrsindex} % This works similar to original \cs{index} but uses a splitted index. So it % allows an optional argument. @@ -1000,6 +1086,7 @@ \@wrsindex }% \typeout{Using splitted index at \jobname.idx}% + \@se@nd@xc@d@ } % \end{macrocode} % At the following \cs{@@wrsindex} is used as a hook. If it is defines, it is @@ -1012,13 +1099,17 @@ \if@splitidx \@wrsindex[idx]{#2}% \else - \@wrindex{#2}% + \def\@tempa{#2}% + \if@verbindex\@onelevel@sanitize\@tempa\fi + \@wrindex{\@tempa}% \fi \else + \def\@tempa{#2}% + \csname index@#1@hook\endcsname \expandafter\ifx\csname @@wrsindex\endcsname\relax - \@@@wrsindex{#1}{{#2}{\thepage}}% + \@@@wrsindex{#1}{{\@tempa}{\thepage}}% \else - \@@wrsindex{#1}#2||\\% + \@@wrsindex{#1}\@tempa||\\% \fi \endgroup \@esphack @@ -1208,6 +1299,13 @@ % \begin{macrocode} \newcommand*{\newindex}[2][\relax]{% \@ifundefined{index@#2@name}{% + \if@verbindex + \expandafter\gdef\csname index@#2@hook\endcsname{% + \@onelevel@sanitize\@tempa + }% + \else + \expandafter\gdef\csname index@#2@hook\endcsname{}% + \fi \ifx\@indices\@empty \xdef\@indices{#2}% \else @@ -1219,14 +1317,15 @@ \expandafter\xdef\csname index@#2@name\endcsname{#1}% \fi \if@newidxcmd - \expandafter\newcommand\expandafter*\csname #2\endcsname{% + \expandafter\newcommand\expandafter*\csname #2\endcsname{}% + \expandafter\gdef\csname #2\endcsname{% \sindex[#2]% }% \fi \if@splitidx \def\@tempa{#2}\def\@tempb{idx}% \ifx\@tempa\@tempb - \let\@indexfile@idx=\@indexfile + \global\let\@indexfile@idx=\@indexfile \else \expandafter\newwrite\csname @indexfile@#2\endcsname \expandafter\immediate\expandafter\openout @@ -1246,13 +1345,23 @@ The new definition will be ignored.% }% }% -} +} \if@splitidx \@onlypreamble\newindex \fi % \end{macrocode} % \end{macro} % +% \begin{macro}{\newprotectedindex} +% \changes{v0.9}{2006/07/03}{new command} +% Same like \cs{newindex} but always define an index with protected arguments. +% \begin{macrocode} +\newcommand*{\newprotectedindex}[2][\relax]{% + \begingroup\@verbindextrue\newindex[{#1}]{#2}\endgroup +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@indices} % This macro stores a list of the index shortcuts. This is needed by % e.g. \cs{printindices} and build by \cs{newindex}. @@ -1388,6 +1497,6 @@ % % end of file `splitindex.dtx' %%% Local Variables: -%%% mode: latex +%%% mode: doctex %%% TeX-master: t %%% End: diff --git a/Master/texmf-dist/source/latex/splitindex/splitidx.ins b/Master/texmf-dist/source/latex/splitindex/splitidx.ins index 529b3777771..a46c36533e2 100644 --- a/Master/texmf-dist/source/latex/splitindex/splitidx.ins +++ b/Master/texmf-dist/source/latex/splitindex/splitidx.ins @@ -2,18 +2,21 @@ %% splitindex.ins %% Copyright (c) Markus Kohm, 2002 %% -%% $Id: splitidx.ins,v 1.1 2002/11/08 10:37:38 mjk Exp $ +%% $Id: splitidx.ins,v 1.2 2006/03/07 10:41:51 mjk Exp $ %% %% This file is part of the `SplitIndex bundle'. %% --------------------------------------------- %% %% This file can be redistributed and/or modified under the conditions -%% of the LaTeX Project Public License, either version 1.2 of this +%% of the LaTeX Project Public License, either version 1.3a 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.2 or later is part of all distributions of LaTeX -%% version 1999/12/01 or later. +%% and version 1.3a or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has status 'maintained'. +%% Maintainer is Markus Kohm <komascript@gmx.info>. %% %% In particular, NO PERMISSION is granted to modify the contents of this %% file since it contains the legal notices that are placed in the files @@ -44,12 +47,15 @@ This file was generated from file(s) of the `SplitIndex bundle'. ---------------------------------------------------------------- It may be distributed and/or modified under the conditions of -the LaTeX Project Public License, either version 1.2 of this +the LaTeX Project Public License, either version 1.3a 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.2 or later is part of all distributions of LaTeX -version 1999/12/01 or later. +and version 1.3a or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has status 'maintained'. +Maintainer is Markus Kohm <komascript@gmx.info>. This file may only be distributed together with a copy of the `SplitIndex bundle'. You may however distribute the `SpitIndex diff --git a/Master/texmf-dist/source/latex/splitindex/splitindex-Linux-i386 b/Master/texmf-dist/source/latex/splitindex/splitindex-Linux-i386 Binary files differdeleted file mode 100644 index 42566f25083..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/splitindex-Linux-i386 +++ /dev/null diff --git a/Master/texmf-dist/source/latex/splitindex/splitindex-OpenBSD-i386 b/Master/texmf-dist/source/latex/splitindex/splitindex-OpenBSD-i386 Binary files differdeleted file mode 100644 index 17e865dd061..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/splitindex-OpenBSD-i386 +++ /dev/null diff --git a/Master/texmf-dist/source/latex/splitindex/splitindex.class b/Master/texmf-dist/source/latex/splitindex/splitindex.class Binary files differdeleted file mode 100644 index 288ad25d588..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/splitindex.class +++ /dev/null diff --git a/Master/texmf-dist/source/latex/splitindex/splitindex.exe b/Master/texmf-dist/source/latex/splitindex/splitindex.exe Binary files differdeleted file mode 100644 index 08aa74d1291..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/splitindex.exe +++ /dev/null diff --git a/Master/texmf-dist/source/latex/splitindex/splitindex.java b/Master/texmf-dist/source/latex/splitindex/splitindex.java deleted file mode 100644 index 9b52f9f7fdf..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/splitindex.java +++ /dev/null @@ -1,415 +0,0 @@ -/* - * splitindex.java - * Copyright (c) Markus Kohm, 2002 - * - * $Id: splitindex.java,v 1.2 2003/01/05 15:05:46 mjk Exp $ - * - * This file is part of the SplitIndex package - * - * This file can be redistributed and/or modified under the conditions - * of the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX - * version 1999/12/01 or later. - * - * You are not allowed to redistribute this file without all the - * other files of the SplitIndex package - */ - -/* - I know, I should never write an application in a single static class - like I do here. But I wanted the program at earch language to be one - file. -*/ - -import java.util.*; -import java.util.regex.*; -import java.io.*; - -public final class splitindex { - private static ArrayList MakeIndexArgs = new ArrayList(); -// private static String Identify = "^(.*)\\\\UseIndex *\\{([^\\}]*)\\}(.*)$"; - private static String Identify = "^(\\\\indexentry)\\[([^\\]]*)\\](.*)$"; - private static String ResultIs = "$1$3"; - private static String SuffixIs = "-$2"; - private static int Verbose = 0; - private static String IDX = null; - private static String Jobname = null; - private static HashMap IDXwriters = new HashMap(); - - private static void ShowHelp() { - String nl = System.getProperty( "line.separator" ); - ShowVersion(); - System.out.println(); - ShowUsage(); - System.out.println( - "Split a single raw index file into multiple raw index files." +nl+ - "Example: java splitindex foo.idx." +nl+ - nl+ - "Options:" +nl+ - " -h, --help " + - "\tshow this help and terminate" +nl+ - " -m, --makeindex PROGNAME" +nl+ - "\t\t\tcall PROGNAME instead of default `makeindex'." +nl+ - " -i, --identify EXPRESSION" +nl+ - "\t\t\tuse regular EXPRESSION to match entries" +nl+ - "\t\t\t(see also option --resultis and --suffixis)." +nl+ - "\t\t\tDefault is \'" + Identify + "\'." +nl+ - " -r, --resultis PATTERN" +nl+ - "\t\t\tcreate line to be written from PATTERN after matching" +nl+ - "\t\t\tlines (see also option --identify)." +nl+ - "\t\t\tDefault is \'" + ResultIs + "\'." +nl+ - " -s, --suffixis PATTERN" +nl+ - "\t\t\tcreate suffix to be used from PATTERN after matching" +nl+ - "\t\t\tlines (see also option --identify)." +nl+ - "\t\t\tDefault is \'" + SuffixIs +"\'." +nl+ - " -v, --verbose " + - "\tbe more verbose" +nl+ - "\t\t\t(can be used multiple to increase verbosity)" +nl+ - " --version " + - "\tshow version and terminate" - ); - System.exit( 0 ); - } - - private static void ShowVersion() { - System.out.println( "splitindex.pl 0.1" ); - System.out.println( "Copyright (c) 2002 Markus Kohm <kohm@gmx.de>" ); - } - - private static void ShowUsage( PrintStream out ) { - out.println( "Usage: java splitindex [OPTION]... RAWINDEXFILE [MAKEINDEXOPTION]..." ); - } - - private static void ShowUsage() { - ShowUsage( System.out ); - } - - private static void UsageError( String msg ) { - System.err.println( msg ); - System.err.println( "Try `java splitindex --help' for more information." ); - System.exit( 1 ); - } - - private static void ScanArguments(String[] args) { - String MakeIndex = "makeindex"; - for (int i = 0; i < args.length; i++) { - if ( args[i].charAt(0) == '-' ) { - // Option - if ( args[i].charAt(1) == '-' ) { - // Long Option - if ( args[i].substring(2).equals( "help" ) ) { - ShowHelp(); - System.exit(0); - } else if ( args[i].substring(2).equals( "version" ) ) { - ShowVersion(); - System.exit(0); - } else if ( args[i].substring(2).equals( "verbose" ) ) { - Verbose++; - } else if ( args[i].substring(2).equals( "makeindex" ) ) { - if ( ++i >= args.length ) { - UsageError( "Option makeindex requires an argument" ); - } - MakeIndex = args[i]; - } else if ( ( args[i].length() >= 11 ) && - ( args[i].substring(2,11).equals( "makeindex=" ) ) ) { - MakeIndex = args[i].substring(12); - } else if ( args[i].substring(2).equals( "identify" ) ) { - if ( ++i >= args.length ) { - UsageError( "Option identify requires an argument" ); - } - Identify = args[i]; - } else if ( ( args[i].length() >= 10 ) && - ( args[i].substring(2,10).equals( "identify=" ) ) ) { - Identify = args[i].substring(11); - } else if ( args[i].substring(2).equals( "resultis" ) ) { - if ( ++i >= args.length ) { - UsageError( "Option resultis requires an argument" ); - } - ResultIs = args[i]; - } else if ( ( args[i].length() >= 10 ) && - ( args[i].substring(2,10).equals( "resultis=" ) ) ) { - ResultIs = args[i].substring(11); - } else if ( args[i].substring(2).equals( "suffixis" ) ) { - if ( ++i >= args.length ) { - UsageError( "Option suffixis requires an argument" ); - } - SuffixIs = args[i]; - } else if ( ( args[i].length() >= 10 ) && - ( args[i].substring(2,10).equals( "suffixis=" ) ) ) { - SuffixIs = args[i].substring(11); - } else if ( args[i].equals( "--" ) ) { - while ( ++i < args.length ) { - MakeIndexArgs.add( args[i] ); - } - } else { - UsageError( "Unknown option " + args[i].substring(2) ); - } - } else { - // Short Option - for ( int n = 1; n < args[i].length(); ) { - switch( args[i].charAt(n++) ) { - case 'h': - ShowHelp(); - System.exit(0); - case 'm': - if ( n >= args[i].length() ) { - if ( ++i >= args.length ) { - UsageError( "Option makeindex requires an argument" ); - } else { - MakeIndex = args[i]; - n = args[i].length(); - } - } else { - MakeIndex = args[i].substring( n ); - n = args[i].length(); - } - break; - case 'i': - if ( n >= args[i].length() ) { - if ( ++i >= args.length ) { - UsageError( "Option identify requires an argument" ); - } else { - Identify = args[i]; - n = args[i].length(); - } - } else { - Identify = args[i].substring( n ); - n = args[i].length(); - } - break; - case 'r': - if ( n >= args[i].length() ) { - if ( ++i >= args.length ) { - UsageError( "Option resultis requires an argument" ); - } else { - ResultIs = args[i]; - n = args[i].length(); - } - } else { - ResultIs = args[i].substring( n ); - n = args[i].length(); - } - break; - case 's': - if ( n >= args[i].length() ) { - if ( ++i >= args.length ) { - UsageError( "Option suffixis requires an argument" ); - } else { - SuffixIs = args[i]; - n = args[i].length(); - } - } else { - SuffixIs = args[i].substring( n ); - n = args[i].length(); - } - break; - case 'v': - Verbose++; - break; - } - } - } - } else { - MakeIndexArgs.add( args[i] ); - } - } - - // Args --> IDX + Stringarray - if ( MakeIndexArgs.isEmpty() ) { - UsageError( "missing raw index file" ); - } else { - IDX = (String)MakeIndexArgs.get(0); - MakeIndexArgs.remove(0); - MakeIndexArgs.add( 0, MakeIndex ); - } - - if ( IDX.endsWith( ".idx" ) ) { - Jobname = IDX.substring( 0, IDX.length() - 4 ); - } else { - Jobname = IDX; - } - } - - public static void main(String[] args) { - ScanArguments(args); - - if ( Verbose > 0 ) { - ShowVersion(); - System.out.println(); - if ( Verbose > 9 ) { - System.out.println( "Identify: \"" + Identify + "\"" ); - System.out.println( "ResultIs: \"" + ResultIs + "\"" ); - System.out.println( "SuffixIs: \"" + SuffixIs + "\"" ); - System.out.println( "IDX: \"" + IDX + "\"" ); - System.out.println( "Jobname: \"" + Jobname + "\"" ); - System.out.print( "MakeIndex:" ); - for ( int i = 0; i < MakeIndexArgs.size(); i++ ) - System.out.print( " \"" + (String)MakeIndexArgs.get(i) + "\"" ); - System.out.println(); - } - } - - ProcessIDXFile(); - } - - private static void ProcessIDXFile() { - File fIDX = new File( IDX ); - LineNumberReader rIDX = null; - boolean error = false; - if ( !fIDX.canRead() ) { - if ( IDX.equals( Jobname ) ) { - IDX = IDX.concat( ".idx" ); - fIDX = new File( IDX ); - if ( !fIDX.canRead() ) { - System.err.println( "Can read neither file " + Jobname + - " nor file " + IDX ); - System.exit( 1 ); - } - } else { - System.err.println( "Can't read file " + Jobname ); - System.exit( 1 ); - } - } - - try { - FileReader reader = new FileReader( fIDX ); - rIDX = new LineNumberReader( reader ); - } catch ( FileNotFoundException ex ) { - System.err.println( ex.getMessage() ); - System.exit( 1 ); - } - - try { - Pattern search = Pattern.compile( Identify ); - while ( rIDX.ready() ) { - String line = rIDX.readLine(); - Matcher match = search.matcher( line ); - String suffix, result; - - try { - if ( match.find() ) { - suffix = match.replaceFirst( SuffixIs ); - result = match.replaceFirst( ResultIs ); - } else { - result = line; - suffix = SuffixIs.replaceFirst( "\\$\\d", "idx" ); - } - WriteToIndex( Jobname + suffix + ".idx", result ); - } catch ( Exception ex ) { - System.err.println( ex.getMessage() ); - error = true; - break; - } - } - - if ( ! CloseAllIndex() ) - error = true; - else if ( ! CallAllMakeIndex() ) - error = true; - } catch ( IOException ex ) { - System.err.println( ex.getMessage() ); - } - - try { - rIDX.close(); - } catch ( IOException ex ) { - System.err.println( ex.getMessage() ); - System.exit( 1 ); - } - - if ( error ) - System.exit( 1 ); - - } - - static void WriteToIndex( String Name, String line ) - throws FileNotFoundException, SecurityException { - PrintWriter fOut; - if ( ( fOut = (PrintWriter)IDXwriters.get( Name ) ) == null ) { - if ( Verbose > 1 ) { - System.out.println( "New index file " + Name ); - } - fOut = new PrintWriter( new FileOutputStream( Name ) ); - IDXwriters.put( Name, fOut ); - } - fOut.println( line ); - } - - static boolean CloseAllIndex() { - Iterator all = IDXwriters.entrySet().iterator(); - boolean retVal = true; - while ( all.hasNext() ) { - Map.Entry entry = (Map.Entry)all.next(); - PrintWriter writer = (PrintWriter)entry.getValue(); - if ( Verbose > 1 ) { - System.out.println( "Close " + entry.getKey() ); - } - writer.close(); - if ( writer.checkError() ) { - System.err.println( "Error writing " + entry.getKey() ); - retVal = false; - } - } - return retVal; - } - - static boolean CallAllMakeIndex() { - Iterator all = IDXwriters.entrySet().iterator(); - boolean retVal = true; - ArrayList processes = new ArrayList(); - while ( all.hasNext() ) { - Map.Entry entry = (Map.Entry)all.next(); - String name = (String)entry.getKey(); - try { - MakeIndexArgs.add(name); - String Args[] = new String[MakeIndexArgs.size()]; - Args = (String[])MakeIndexArgs.toArray( Args ); - MakeIndexArgs.remove(MakeIndexArgs.size()-1); - if ( Verbose > 1 ) { - System.out.print( "MakeIndex:" ); - for ( int i = 0; i < Args.length; i++ ) - System.out.print( " \"" + Args[i] + "\"" ); - System.out.println(); - } - processes.add(Runtime.getRuntime().exec( Args )); - } catch ( Exception ex ) { - System.err.println( ex.getMessage() ); - retVal = false; - } - } - - for ( int i = 0; i < processes.size(); i++ ) { - Process p = (Process)processes.get( i ); - InputStream out = p.getInputStream(); - byte[] buffer = new byte[1024]; - for ( boolean oncemore = true; oncemore; ) { - oncemore = false; - try { - while ( out.available() > 0 ) { - out.read( buffer ); - System.out.print( new String(buffer) ); - } - for ( out = p.getErrorStream(); - out.available() > 0; ) { - out.read( buffer ); - System.err.print( new String( buffer ) ); - } - } catch ( Exception ex ) { - System.err.println( ex.getMessage() ); - retVal = false; - } - try { - if ( p.exitValue() != 0 ) - retVal = false; - } catch ( IllegalThreadStateException ex ) { - oncemore = true; - } - } - } - - return retVal; - } -} diff --git a/Master/texmf-dist/source/latex/splitindex/splitindex.pl b/Master/texmf-dist/source/latex/splitindex/splitindex.pl deleted file mode 100644 index 378fb25e68c..00000000000 --- a/Master/texmf-dist/source/latex/splitindex/splitindex.pl +++ /dev/null @@ -1,186 +0,0 @@ -#! /usr/bin/perl -w -eval 'exec perl -S $0 ${1+"$@"}' - if 0; #$running_under_some_shell - -# ====================================================================== -# splitindex.pl -# Copyright (c) Markus Kohm, 2002 -# -# $Id: splitindex.pl,v 1.5 2002/11/05 10:54:27 mjk Exp $ -# -# This file is part of the SplitIndex package -# -# This file can be redistributed and/or modified under the conditions -# of the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX -# version 1999/12/01 or later. -# -# You are not allowed to redistribute this file without all the -# other files of the SplitIndex package -# ====================================================================== - -use strict; -use Getopt::Long; - -my $makeindex = "makeindex"; -# my $identify = "^(.*)\\\\UseIndex *\\{([^\\}]*)\\}(.*)\$"; -my $identify = "^(\\\\indexentry)\\[([^]]*)\\](.*)\$"; -my $suffixis = "-\$2"; -my $lineis = "\$1\$3"; -my $verbose = 0; # option verbose with default value -my $result = GetOptions( - 'help' => sub { help() }, - 'makeindex=s' => \$makeindex, - 'identify=s' => \$identify, - 'resultis=s' => \$lineis, - 'suffixis=s' => \$suffixis, - 'verbose|v+' => \$verbose, - 'version' => sub { version(); exit 0; } - ); - -usage("missing raw index file") if ( $#ARGV < 0 ); - -my $indexinput = shift; -my $jobname = ( $indexinput =~ /^(.*)\.idx$/ ) ? $1 : $indexinput; - -my %idxfile; -my %linesatidxfile; - -version() if ($verbose > 0); - -if ( !( open (IDX,"<$indexinput") ) ) { - if ( $indexinput ne "$jobname.idx" ) { - open (IDX,"<$jobname.idx") || - die "Cannot read raw index file $indexinput nor $jobname.idx"; - $indexinput = "$jobname.idx"; - } else { - die "Cannot read raw index file $indexinput"; - } -} - -while (<IDX>) { - my $line; - my $suffix; - if ( /$identify/ ) { - my $eval = "\$line = \"$lineis\n\""; - eval $eval; - $eval = "\$suffix = \"$suffixis\""; - eval $eval; - } else { - $line = $_; - $suffix = ""; - $suffix .= "$1" if ( $suffixis =~ /^(.*)\$/ ); - $suffix .= "idx"; - $suffix .= "$1" if ( $suffixis =~ /\$[123456789](.*)$/ ); - } - while ( $suffix =~ /(^[^,]+)(.*)$/ ) { - $suffix = $2; - writetoidx ($1,$line); - } -} - -closeallind(); - -close(IDX); - -generateallind(@ARGV); - -exit 0; - -sub generateallind { - my $name; - my $file; - - if ( $makeindex ne "" ) { - while (($name,$file) = each %idxfile) { - system( "$makeindex @ARGV $jobname$name.idx" ); - } - } -} - -sub closeallind { - my $name; - my $file; - my $lines; - while (($name,$file) = each %idxfile) { - print "Close $jobname$name.idx\n" - if ( $verbose > 1 ); - close( $file ); - $idxfile{$name}=0; - } - if ( $verbose > 0 ) { - print "\n"; - while (($name,$lines) = each %linesatidxfile) { - print "$jobname$name.idx with $lines lines\n"; - } - } -} - -sub writetoidx { - my $suffix = $_[0]; - my $line = $_[1]; - my $file = $idxfile{$suffix}; - if ( ! $file ) { - open ( $file, ">$jobname$suffix.idx" ) || - die "Cannot write to file $jobname$suffix.idx"; - $idxfile{$suffix} = $file; - $linesatidxfile{$suffix} = 0; - print( "New index file $jobname$suffix.idx\n" ) - if ( $verbose > 1 ); - } - print ($file $line); - $linesatidxfile{$suffix}++; -} - -sub help { - version(); - print "\n"; - usage(); - print - "Split a single raw index file into multiple raw index files.\n". - "Example: splitindex.pl foo.idx.\n". - "\n". - "Options:\n" . - " -h, --help " . - "\tshow this help and terminate\n" . - " -m, --makeindex PROGNAME\n" . - "\t\t\tcall PROGNAME instead of default \`makeindex\'.\n" . - " -i, --identify EXPRESSION\n" . - "\t\t\tuse regular EXPRESSION to match entries\n". - "\t\t\t(see also option --resultis and --suffixis).\n". - "\t\t\tDefault is \'$identify\'.\n". - " -r, --resultis PATTERN\n" . - "\t\t\tcreate line to be written from PATTERN after matching\n". - "\t\t\tlines (see also option --identify).\n". - "\t\t\tDefault is \'$lineis\'.\n". - " -s, --suffixis PATTERN\n" . - "\t\t\tcreate suffix to be used from PATTERN after matching\n". - "\t\t\tlines (see also option --identify).\n". - "\t\t\tDefault is \'$suffixis\'.\n". - " -v, --verbose " . - "\tbe more verbose\n". - "\t\t\t(can be used multiple to increase verbosity)\n" . - " --version " . - "\tshow version and terminate\n"; - exit 0; -} - -sub version { - print "splitindex.pl 0.1\n" . - "Copyright (c) 2002 Markus Kohm \<kohm\@gmx.de\>\n"; -} - -sub usage { - my $text = "Usage: splitindex.pl [OPTION]... RAWINDEXFILE [MAKEINDEXOPTION]...\n"; - if ( $#_ >= 0 ) { - print STDERR @_; - print STDERR "\n$text"; - print STDERR "Try \`splitindex.pl --help\' for more information.\n"; - exit 1; - } else { - print $text; - } -} |