diff options
author | Karl Berry <karl@freefriends.org> | 2009-01-27 01:57:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-01-27 01:57:19 +0000 |
commit | 859083925d4a5369db7c4336785eab6ce24a155e (patch) | |
tree | b74e89145a103dc019dbd7bd8f679dea60ea79a9 /Master | |
parent | 0eafc5607fb62a88e9dba8e8ef3a11efae9fd904 (diff) |
xfor 1.04 (26jan09)
git-svn-id: svn://tug.org/texlive/trunk@11989 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/CHANGES | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/README | 50 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/sample.tex | 90 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/xfor.pdf | bin | 108179 -> 117739 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/xfor/xfor.dtx | 283 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/xfor/xfor.ins | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xfor/xfor.sty | 82 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkginfo | 2 |
8 files changed, 332 insertions, 187 deletions
diff --git a/Master/texmf-dist/doc/latex/xfor/CHANGES b/Master/texmf-dist/doc/latex/xfor/CHANGES index 1899d18a565..926dfd76f44 100644 --- a/Master/texmf-dist/doc/latex/xfor/CHANGES +++ b/Master/texmf-dist/doc/latex/xfor/CHANGES @@ -1,5 +1,9 @@ xfor change log: +v1.04 (25 January 2009): + rewrite of internals to improve loop efficiency + (code provided by Morten Høgholm) + v1.03 (21 August 2007): fixed license text diff --git a/Master/texmf-dist/doc/latex/xfor/README b/Master/texmf-dist/doc/latex/xfor/README index b8980b3caea..a4c8c8ac0f8 100644 --- a/Master/texmf-dist/doc/latex/xfor/README +++ b/Master/texmf-dist/doc/latex/xfor/README @@ -1,25 +1,25 @@ -LaTeX Package : xfor - -Last Modified : 21 August 2007 -Version : 1.03 -Author : Nicola Talbot - -This package redefines \@for so that it is possible to -prematurely terminate the loop. There is also a look ahead -facility to access the next element before moving on to the -next iteration. - -The package is supplied using the TeX Directory Structure (TDS). -Files in texmf directory should go in the corresponding -$LOCALTEXMF directories. - -*Remember to refresh TeX's database* - -The package and documentation source code is also supplied as a -dtx and ins file located in texmf/source. - -This material is subject to the LaTeX Project Public License. -See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license. - -http://theoval.cmp.uea.ac.uk/~nlct/ - +LaTeX Package : xfor
+
+Last Modified : 25 January 2009
+Version : 1.04
+Author : Nicola Talbot
+
+This package redefines \@for so that it is possible to
+prematurely terminate the loop. There is also a look ahead
+facility to access the next element before moving on to the
+next iteration.
+
+The package is supplied using the TeX Directory Structure (TDS).
+Files in texmf directory should go in the corresponding
+$LOCALTEXMF directories.
+
+*Remember to refresh TeX's database*
+
+The package and documentation source code is also supplied as a
+dtx and ins file located in texmf/source.
+
+This material is subject to the LaTeX Project Public License.
+See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license.
+
+http://theoval.cmp.uea.ac.uk/~nlct/
+
diff --git a/Master/texmf-dist/doc/latex/xfor/sample.tex b/Master/texmf-dist/doc/latex/xfor/sample.tex index b1027185b18..f740bdbc66f 100644 --- a/Master/texmf-dist/doc/latex/xfor/sample.tex +++ b/Master/texmf-dist/doc/latex/xfor/sample.tex @@ -1,16 +1,57 @@ -\errorcontextlines=100 +%% +%% This is file `sample.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xfor.dtx (with options: `sample.tex,package') +%% +%% xfor.dtx +%% Copyright 2009 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (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 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files xfor.dtx and xfor.ins and the derived files xfor.sty, sample.tex. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\listfiles \documentclass{article} \usepackage{xfor} \makeatletter -% \insertinto{new value}{list} + + +\newtoks\tmptok + \newcommand{\insertinto}[2]{% \def\nlst{}% \@for\n:=#2\do{% -% store new list in \toks@ -\expandafter\toks@\expandafter{\nlst}% -% test current value against new value +\expandafter\tmptok\expandafter{\nlst}% \ifnum\n>#1\relax \edef\newstuff{\number#1,\n}% % end for loop at the end of this iteration @@ -18,14 +59,12 @@ \else \edef\newstuff{\n}% \fi -% append new stuff to new list \ifx\nlst\@empty \edef\nlst{\newstuff}% \else - \edef\nlst{\the\toks@,\newstuff}% + \edef\nlst{\the\tmptok,\newstuff}% \fi }% -% check to see if for loop was prematurely terminated \if@endfor % loop may have been terminated during final iteration, in % which case \@forremainder is empty. @@ -34,39 +73,48 @@ \else % loop prematurely ended, append remainder of original list % to new list - \expandafter\toks@\expandafter{\nlst}% - \edef\nlst{\the\toks@,\@forremainder}% + \expandafter\tmptok\expandafter{\nlst}% + \edef\nlst{\the\tmptok,\@forremainder}% \fi \else - % wasn't prematurely terminated, so new value hasn't been added - % add now. - \expandafter\toks@\expandafter{\nlst}% + % wasn't prematurely terminated, so new value hasn't been added. + % Add now. + \expandafter\tmptok\expandafter{\nlst}% \ifx\nlst\@empty \edef\nlst{\number#1}% \else - \edef\nlst{\the\toks@,\number#1}% + \edef\nlst{\the\tmptok,\number#1}% \fi \fi \global\let#2=\nlst } + \newcommand{\insertionsort}[1]{% \def\sortedlist{}% \@for\val:=#1\do{{\insertinto{\val}{\sortedlist}}}% \let#1=\sortedlist} + \makeatother \begin{document} -\def\mylist{1,2,5,9,12,15,18,20}% -\def\newval{11}% -Original list: \mylist. New value: \newval. - -\insertinto{\newval}{\mylist} -New list: \mylist. - Unsorted list: \def\mylist{4,2,7,1,10,11,20,15}\mylist. \insertionsort{\mylist}% Sorted list: \mylist. + +Iterate through the list (next element in parentheses): +\makeatletter +\@for\n:=\mylist\do{% +\n +\ifx\@xfor@nextelement\@nnil + % last iteration +\else + (\@xfor@nextelement); +\fi +}. \end{document} +\endinput +%% +%% End of file `sample.tex'. diff --git a/Master/texmf-dist/doc/latex/xfor/xfor.pdf b/Master/texmf-dist/doc/latex/xfor/xfor.pdf Binary files differindex 1ec378b63a9..8f4b34ccb17 100644 --- a/Master/texmf-dist/doc/latex/xfor/xfor.pdf +++ b/Master/texmf-dist/doc/latex/xfor/xfor.pdf diff --git a/Master/texmf-dist/source/latex/xfor/xfor.dtx b/Master/texmf-dist/source/latex/xfor/xfor.dtx index c49c8f2de61..9c5986dd6d2 100644 --- a/Master/texmf-dist/source/latex/xfor/xfor.dtx +++ b/Master/texmf-dist/source/latex/xfor/xfor.dtx @@ -1,12 +1,13 @@ %\iffalse % xfor.dtx generated using makedtx version 0.94b (c) Nicola Talbot % Command line args: -% -src "xfor.sty=>xfor.sty" -% -doc "manual.tex" +% -src "xfor.sty\Z=>xfor.sty" +% -src "sample.tex\Z=>sample.tex" +% -doc "xfor-manual.tex" % -author "Nicola Talbot" % -dir "source" % xfor -% Created on 2007/8/21 17:28 +% Created on 2009/1/26 14:47 %\fi %\iffalse %<*package> @@ -29,7 +30,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2007 Nicola Talbot, all rights reserved. +% Copyright (C) 2009 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -41,10 +42,10 @@ bookmarks, hyperindex=false, pdfauthor={Nicola L.C. Talbot}, - pdftitle={xfor: redefinition of '@for}, + pdftitle={xfor: redefinition of \string\@for}, pdfkeywords={LaTeX,package development}]{hyperref} -\CheckSum{117} +\CheckSum{197} \PageIndex \RecordChanges \newcommand*{\sty}[1]{\textsf{#1}} @@ -56,7 +57,7 @@ %\fi %\MakeShortVerb{"} % -% \title{xfor v1.03: Reimplementation of \cs{@for} to allow +% \title{xfor v1.04: Reimplementation of \cs{@for} to allow %premature termination of the loop} % \author{Nicola L.C. Talbot\\[10pt] %School of Computing Sciences\\ @@ -65,7 +66,7 @@ %NR4 7TJ. United Kingdom.\\ %\url{http://theoval.cmp.uea.ac.uk/~nlct/}} % -%\date{21st August 2007} +%\date{25th January 2009} %\maketitle %\tableofcontents % @@ -125,12 +126,13 @@ %which uses this method: %\begin{verbatim} % \newcommand{\insertinto}[2]{% -% \def\nlst{}% +% \def\nlst{}% new list initially empty % \@for\n:=#2\do{% % % store new list in \toks@ % \expandafter\toks@\expandafter{\nlst}% % % test current value against new value % \ifnum\n>#1\relax +% % new value needs to be inserted before current value % \edef\newstuff{\number#1,\n}% % % end for loop at the end of this iteration % \@endfortrue @@ -158,7 +160,7 @@ % \fi % \else % % wasn't prematurely terminated, so new value hasn't been added -% % add now. +% % so add now. % \expandafter\toks@\expandafter{\nlst}% % \ifx\nlst\@empty % \edef\nlst{\number#1}% @@ -232,7 +234,12 @@ %\ifx\@xfor@nextelement\@nnil \else ;\fi} %\makeatother % -% \StopEventually{\clearpage\phantomsection +%\section{Acknowledgements} +% +%Many thanks to Morten~H\o gholm for providing code to improve +%efficiency. +% +% \StopEventually{\phantomsection %\addcontentsline{toc}{section}{Change History} %\PrintChanges\phantomsection %\addcontentsline{toc}{section}{Index} @@ -246,123 +253,229 @@ %<*xfor.sty> % \end{macrocode} %\fi -% Declare package: +% Note that the internal macros used by \cs{@for} have changed +% in version 1.04. +% % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xfor}[2007/08/21 v1.03 (NLCT)] +\ProvidesPackage{xfor}[2009/01/25 v1.04 (NLCT)] % \end{macrocode} -% Define a switch to determine if the for loop should be -% terminated: %\begin{macro}{\if@endfor} +% Define a switch to determine if the for loop should be +% stopped prematurely. % \begin{macrocode} \newif\if@endfor % \end{macrocode} %\end{macro} -% Redefine \cs{@for}, so that it resets \cs{if@endfor} -% and \cs{@forremainder}: +%\begin{macro}{\@gobbleseven} +%\changes{1.04}{2009 January 25}{added by Morten H\o gholm} +% Ignore seven arguments. +% \begin{macrocode} +\long\def\@gobbleseven#1#2#3#4#5#6#7{} +% \end{macrocode} +%\end{macro} %\begin{macro}{\@for} +% \cs{@for}\meta{cmd}":="\meta{list}\cs{do}\marg{body} +% test if the list is empty and then re-arrange +%\changes{1.04}{2009 January 25}{Modified by Morten H\o gholm to +% improve efficiency} % \begin{macrocode} -\long\def\@for#1:=#2\do#3{% -\@endforfalse -\def\@forremainder{}% -\expandafter\def\expandafter\@fortmp\expandafter{#2}% -\ifx\@fortmp\@empty -\else - \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}% -\fi +\long\def\@for#1:=#2\do{% +% \end{macrocode} +% Initialise +% \begin{macrocode} + \@endforfalse + \def\@forremainder{}% + \expandafter\def\expandafter\@fortmp\expandafter{#2}% +% \end{macrocode} +% If list is empty do nothing +% \begin{macrocode} + \ifx\@fortmp\@empty + \expandafter\@gobbleseven + \fi + \expandafter\@@for\expandafter#1\expandafter{#2}% } % \end{macrocode} %\end{macro} -% Redefine \cs{@fornoop} to be a long command: -%\begin{macro}{\@fornoop} +% +%\begin{macro}{\@@for} +% Initialise for loop +%\changes{1.04}{2009 January 25}{Added by Morten H\o gholm} % \begin{macrocode} -\long\def\@fornoop#1\@@#2#3{} +\long\def\@@for#1#2#3{% + \@forloop#1{#3}#2,\@nil,\@nil,% + \@xfor@endmarker% magic end marker +} % \end{macrocode} %\end{macro} -% Redefine \cs{@forloop} to check for \cs{if@endfor}: -%\begin{macro}{\@forloop} +% +%\begin{macro}{\@xfornoop} +%\changes{1.04}{2009 January 25}{second and third arguments dropped (MH)} +%\changes{1.04}{2009 January 25}{\cs{@fornoop} replaced by +% \cs{@xfornoop} to prevent conflict with \cs{@tfor}} +% Read up until magic end marker. % \begin{macrocode} -\long\def\@forloop#1,#2,#3\@@#4#5{% -\def#4{#1}% -\ifx#4\@nnil -\else - \@xfor@storenext#2,#3\@@% - #5% - \if@endfor - \@iforgatherrest#2,#3% - \else - \def#4{#2}% - \ifx#4\@nnil - \else - \@xfor@storenext#3,\@nil\@@% - #5% - \if@endfor - \@iforgatherrest#3% - \else - \@iforloop#3\@@#4{#5}% - \fi - \fi - \fi -\fi -} +\long\def\@xfornoop#1\@xfor@endmarker{} % \end{macrocode} %\end{macro} -%\changes{1.02}{2007 August 16}{Added \cs{@xfor@storenext}}% -%\begin{macro}{\@xfor@storenext} -% Stores first argument in \cs{@xfor@nextelement}. +%\begin{macro}{\@forloop} +%\cs{@forloop}\marg{var}\marg{action} +%\changes{1.04}{2009 January 25}{Modified by Morten H\o gholm to +% improve efficiency} +% \begin{macrocode} +\long\def\@forloop#1#2#3,#4,{% + \def#1{#3}% + \ifx#1\@nnil +% \end{macrocode} +% Grab the \cs{@xfor@endmarker} at the very end % \begin{macrocode} -\def\@xfor@storenext#1,#2\@@{% -\def\@xfor@nextelement{#1}% + \expandafter\@xfornoop + \fi +% \end{macrocode} +% Removed |\@xfor@storenext#4,\@nil|. Instead store next element +% in \cs{@xfor@nextelement}. +% \begin{macrocode} + \def\@xfor@nextelement{#4}% + #2% + \if@endfor + \expandafter\@iforgatherrest + \fi + \@forloop#1{#2}{#4},% } % \end{macrocode} %\end{macro} % -%\begin{macro}{\@forgatherrest} -% Get remainder of list (stores in \cs{@forremainder}): +%\begin{macro}{\@iforgatherrest} +% Gather the remainder (and store in \cs{@forremainder}) %\changes{1.01}{2007 July 11}{made long}% +%\changes{1.04}{2009 January 25}{argument syntax changed (MH)} % \begin{macrocode} -\long\def\@forgatherrest#1,\@nil,\@nil{\def\@forremainder{#1}} +\long\def\@iforgatherrest \@forloop#1#2#3,#4\@xfor@endmarker{% + \def\@fortmp{#3}% + \ifx\@fortmp\@nnil + \def\@forremainder{}% + \else + \@forgatherrest{#3},#4\@xfor@endmarker% + \fi +} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@iforgatherrest} -% As above, but there may not be anything before \cs{@nil}: +%\begin{macro}{\@forgatherrest} +% Get remainder of list (stored in \cs{@forremainder}): %\changes{1.01}{2007 July 11}{made long}% +%\changes{1.04}{2009 January 25}{argument syntax changed (MH)} % \begin{macrocode} -\long\def\@iforgatherrest#1\@nil,\@nil{% -\def\@fortmp{#1}% -\ifx\@fortmp\@empty - \def\@forremainder{}% -\else - \@forgatherrest#1\@nil,\@nil -\fi +\long\def\@forgatherrest#1,\@nil,\@nil,\@xfor@endmarker{% + \def\@forremainder{#1}% } % \end{macrocode} %\end{macro} -% Redefine \cs{@iforloop} to check \cs{if@endfor}: -%\begin{macro}{\@iforloop} +% +%\changes{1.02}{2007 August 16}{Added \cs{@xfor@storenext}}% +%\changes{1.04}{2009 January 25}{Removed \cs{\@xfor@storenext}}% +%\changes{1.04}{2009 January 25}{removed \cs{@iforloop}} + +%\iffalse +% \begin{macrocode} +%</xfor.sty> +% \end{macrocode} +%\fi +%\iffalse % \begin{macrocode} -\long\def\@iforloop#1,#2\@@#3#4{% -\def#3{#1}% -\ifx#3\@nnil - \let\@ifornext\@fornoop +%<*sample.tex> +% \end{macrocode} +%\fi +%\section{Sample Document (sample.tex)} +% \begin{macrocode} +\listfiles +\documentclass{article} + +\usepackage{xfor} + +\makeatletter + +% \insertinto{new value}{list} + +\newtoks\tmptok + +\newcommand{\insertinto}[2]{% +\def\nlst{}% +\@for\n:=#2\do{% +% store new list in \tmptok +\expandafter\tmptok\expandafter{\nlst}% +% test current value against new value +\ifnum\n>#1\relax + \edef\newstuff{\number#1,\n}% + % end for loop at the end of this iteration + \@endfortrue +\else + \edef\newstuff{\n}% +\fi +% append new stuff to new list +\ifx\nlst\@empty + \edef\nlst{\newstuff}% \else - \@xfor@storenext#2,\@nil\@@% - #4\relax - \if@endfor - \@iforgatherrest#2\relax - \let\@ifornext\@fornoop + \edef\nlst{\the\tmptok,\newstuff}% +\fi +}% +% check to see if for loop was prematurely terminated +\if@endfor + % loop may have been terminated during final iteration, in + % which case \@forremainder is empty. + \ifx\@forremainder\@empty + % do nothing \else - \let\@ifornext\@iforloop + % loop prematurely ended, append remainder of original list + % to new list + \expandafter\tmptok\expandafter{\nlst}% + \edef\nlst{\the\tmptok,\@forremainder}% \fi +\else + % wasn't prematurely terminated, so new value hasn't been added. + % Add now. + \expandafter\tmptok\expandafter{\nlst}% + \ifx\nlst\@empty + \edef\nlst{\number#1}% + \else + \edef\nlst{\the\tmptok,\number#1}% + \fi \fi -\@ifornext#2\@@#3{#4}% +\global\let#2=\nlst } + +% \insertionsort{list} +% replaces list with sorted list + +\newcommand{\insertionsort}[1]{% +\def\sortedlist{}% +\@for\val:=#1\do{{\insertinto{\val}{\sortedlist}}}% +\let#1=\sortedlist} + +\makeatother + +\begin{document} +Unsorted list: +\def\mylist{4,2,7,1,10,11,20,15}\mylist. + +\insertionsort{\mylist}% +Sorted list: \mylist. + +Iterate through the list (next element in parentheses): +\makeatletter +\@for\n:=\mylist\do{% +\n +\ifx\@xfor@nextelement\@nnil + % last iteration +\else + (\@xfor@nextelement); +\fi +}. +\end{document} % \end{macrocode} -%\end{macro} %\iffalse % \begin{macrocode} -%</xfor.sty> +%</sample.tex> % \end{macrocode} %\fi %\Finale diff --git a/Master/texmf-dist/source/latex/xfor/xfor.ins b/Master/texmf-dist/source/latex/xfor/xfor.ins index 3269a9fd46d..606e514bfcf 100644 --- a/Master/texmf-dist/source/latex/xfor/xfor.ins +++ b/Master/texmf-dist/source/latex/xfor/xfor.ins @@ -1,10 +1,10 @@ -% xfor.ins generated using makedtx version 0.94b 2007/8/21 17:28 +% xfor.ins generated using makedtx version 0.94b 2009/1/26 14:47 \input docstrip \preamble xfor.dtx - Copyright 2007 Nicola Talbot + Copyright 2009 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -18,7 +18,7 @@ The Current Maintainer of this work is Nicola Talbot. - This work consists of the files xfor.dtx and xfor.ins and the derived file xfor.sty. + This work consists of the files xfor.dtx and xfor.ins and the derived files xfor.sty, sample.tex. \endpreamble @@ -26,6 +26,8 @@ \generate{\file{xfor.sty}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{xfor.dtx}{xfor.sty,package}} +\file{sample.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{xfor.dtx}{sample.tex,package}} } \endbatchfile diff --git a/Master/texmf-dist/tex/latex/xfor/xfor.sty b/Master/texmf-dist/tex/latex/xfor/xfor.sty index 87f899aaaf5..8c64bba73fd 100644 --- a/Master/texmf-dist/tex/latex/xfor/xfor.sty +++ b/Master/texmf-dist/tex/latex/xfor/xfor.sty @@ -7,7 +7,7 @@ %% xfor.dtx (with options: `xfor.sty,package') %% %% xfor.dtx -%% Copyright 2007 Nicola Talbot +%% Copyright 2009 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files xfor.dtx and xfor.ins and the derived file xfor.sty. +%% This work consists of the files xfor.dtx and xfor.ins and the derived files xfor.sty, sample.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -39,69 +39,47 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xfor}[2007/08/21 v1.03 (NLCT)] +\ProvidesPackage{xfor}[2009/01/25 v1.04 (NLCT)] \newif\if@endfor -\long\def\@for#1:=#2\do#3{% +\long\def\@gobbleseven#1#2#3#4#5#6#7{} +\long\def\@for#1:=#2\do{% \@endforfalse \def\@forremainder{}% \expandafter\def\expandafter\@fortmp\expandafter{#2}% \ifx\@fortmp\@empty -\else - \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}% +\expandafter\@gobbleseven \fi +\expandafter\@@for\expandafter#1\expandafter{#2}% } -\long\def\@fornoop#1\@@#2#3{} -\long\def\@forloop#1,#2,#3\@@#4#5{% -\def#4{#1}% -\ifx#4\@nnil -\else - \@xfor@storenext#2,#3\@@% - #5% - \if@endfor - \@iforgatherrest#2,#3% - \else - \def#4{#2}% - \ifx#4\@nnil - \else - \@xfor@storenext#3,\@nil\@@% - #5% - \if@endfor - \@iforgatherrest#3% - \else - \@iforloop#3\@@#4{#5}% - \fi - \fi - \fi -\fi +\long\def\@@for#1#2#3{% +\@forloop#1{#3}#2,\@nil,\@nil,% + \@xfor@endmarker% magic end marker } -\def\@xfor@storenext#1,#2\@@{% -\def\@xfor@nextelement{#1}% -} -\long\def\@forgatherrest#1,\@nil,\@nil{\def\@forremainder{#1}} -\long\def\@iforgatherrest#1\@nil,\@nil{% -\def\@fortmp{#1}% -\ifx\@fortmp\@empty - \def\@forremainder{}% -\else - \@forgatherrest#1\@nil,\@nil +\long\def\@xfornoop#1\@xfor@endmarker{} +\long\def\@forloop#1#2#3,#4,{% +\def#1{#3}% +\ifx#1\@nnil +\expandafter\@xfornoop +\fi +\def\@xfor@nextelement{#4}% +#2% +\if@endfor +\expandafter\@iforgatherrest \fi +\@forloop#1{#2}{#4},% } -\long\def\@iforloop#1,#2\@@#3#4{% -\def#3{#1}% -\ifx#3\@nnil - \let\@ifornext\@fornoop +\long\def\@iforgatherrest \@forloop#1#2#3,#4\@xfor@endmarker{% +\def\@fortmp{#3}% +\ifx\@fortmp\@nnil +\def\@forremainder{}% \else - \@xfor@storenext#2,\@nil\@@% - #4\relax - \if@endfor - \@iforgatherrest#2\relax - \let\@ifornext\@fornoop - \else - \let\@ifornext\@iforloop - \fi +\@forgatherrest{#3},#4\@xfor@endmarker% \fi -\@ifornext#2\@@#3{#4}% } +\long\def\@forgatherrest#1,\@nil,\@nil,\@xfor@endmarker{% +\def\@forremainder{#1}% +} + \endinput %% %% End of file `xfor.sty'. diff --git a/Master/tlpkg/bin/tlpkginfo b/Master/tlpkg/bin/tlpkginfo index 07662ac0369..0370f3ffb08 100755 --- a/Master/tlpkg/bin/tlpkginfo +++ b/Master/tlpkg/bin/tlpkginfo @@ -18,7 +18,7 @@ sub main # erroneous tds files (warn Robin about them) # list format: pkg1|pkg2|etc - $erroneous_tds = "bidi|elsarticle|xetexref|xstring"; + $erroneous_tds = "bidi|elsarticle|xetexref|xfor|xstring"; # special packages from latex-tds project (used by prepare()) $corelatex_tds_pkgs = "babel|cyrillic|graphics|latex|psnfss|tools"; |