diff options
author | Karl Berry <karl@freefriends.org> | 2006-09-20 20:18:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-09-20 20:18:14 +0000 |
commit | dad02ee82f18038f3bd4ec41020f572345ed9b5a (patch) | |
tree | a005f24dd78b4dd4ce4d184b8699264434eb0143 /Master/texmf-dist/tex/generic/eijkhout | |
parent | b277fa4d17b91ca6c4874ae9de103d8e728e4e13 (diff) |
eijkhout update (20sep06)
git-svn-id: svn://tug.org/texlive/trunk@2172 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/eijkhout')
-rw-r--r-- | Master/texmf-dist/tex/generic/eijkhout/CD_labeler.tex | 3 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/eijkhout/repeat.tex | 158 |
2 files changed, 84 insertions, 77 deletions
diff --git a/Master/texmf-dist/tex/generic/eijkhout/CD_labeler.tex b/Master/texmf-dist/tex/generic/eijkhout/CD_labeler.tex index 989cd9a4a3f..520ff16246e 100644 --- a/Master/texmf-dist/tex/generic/eijkhout/CD_labeler.tex +++ b/Master/texmf-dist/tex/generic/eijkhout/CD_labeler.tex @@ -1,8 +1,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% CD labeling macros, version 0.93, unreleased +% CD labeling macros, version 0.93, February 2001. % Copyright Victor Eijkhout 2001 % file name: CD_labeler.tex +% CTAN location: macros/generic/eijkhout % uses: repeat.tex % % Author: diff --git a/Master/texmf-dist/tex/generic/eijkhout/repeat.tex b/Master/texmf-dist/tex/generic/eijkhout/repeat.tex index 6d149e15ee7..0bbb0785f6c 100644 --- a/Master/texmf-dist/tex/generic/eijkhout/repeat.tex +++ b/Master/texmf-dist/tex/generic/eijkhout/repeat.tex @@ -1,31 +1,18 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% Repeat loop macro, version 0.92, December 2000 -% Copyright Victor Eijkhout 2000 +% Repeat loop macro, version 0.93a, September 2006 +% Copyright Victor Eijkhout 1999-2006 % file name: repeat.tex % % Author: % Victor Eijkhout -% Department of Computer Science -% University of Tennessee, Knoxville TN 37996 +% Texas Advanced Computing Center +% The University of Texas at Austin, Austin TX 78758, USA % % victor@eijkhout.net % -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. -% -% This program is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% For a copy of the GNU General Public License, write to the -% Free Software Foundation, Inc., -% 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, -% or find it on the net, for instance at -% http://www.gnu.org/copyleft/gpl.html +% This program is released under the LaTeX Project Public License +% see <http://www.latex-project.org/lppl/> for further information. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -35,8 +22,6 @@ % \until{<cond>} \while{<cond>} % \do { <loop body> } % where all control sequences in between \repeat and \do are optional. -% The space after each argument is mandatory! -% (This implies that you will have to write "\from\i" as "\from{\i}".) % % var: characters to form a control sequence; % after \for{index} you can access the loop counter as \index. @@ -52,10 +37,12 @@ % at the beginning of the loop body. % % Exit from middle of loop: \breakrepeat -% use this at any place in the loop; in case of a conditional, use +% use this at any place in the loop; in case of a conditional use % \ifsomething ... \expandafter \breakrepeat \fi % -% There are some examples at the end of this file, after the \endinput line. +% There are some examples at the end of this file, after the \endinput line; +% remove the \endinput statement to see the examples executed. +% Note that the line ends do not cause spaces in the output. % % Technical details: % The loop body is not executed in a group: the braces are those @@ -69,8 +56,9 @@ % csarg-like control sequences made REP... % counter update made global in case the body issues grouping, % copyright notice, February 1999 -% 0.92 installed trace switches, eliminated unwanted space caused by -% "\for{ijk} \do{...}" +% 0.92 installed trace switches +% 0.93 spaces are now ignored after each argument group. Author info updated. +% 0.93a removed \bye from \endinput line. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -78,7 +66,7 @@ %% Prevent multiple loading of this file %% \expandafter\ifx\csname REPdepth\endcsname\relax - \message{Loading loop macro, version 0.92}% + \message{Loading loop macro, version 0.93a}% \else \endinput \fi %% @@ -87,9 +75,6 @@ \def\REPcsarg#1#2{\expandafter#1\csname#2\endcsname} \def\REPcsrom#1{\csname #1\romannumeral\REPdepth\endcsname} \def\REPcsargrom#1#2{\expandafter#1\csname#2\romannumeral\REPdepth\endcsname} -%\def\cscsarg#1#2#3{\expandafter#1\expandafter#2\csname#3\endcsname} -%\def\REPcsREPcsargrom#1#2#3{\expandafter#1\expandafter#2% -% \csname#3\romannumeral\REPdepth\endcsname} \newcount\REPdepth \let\endrepeat\relax \def\csprotect{} @@ -104,8 +89,7 @@ %% - scoop up body in token list; after the assignment define and %% execute body %% -\def\repeat#1\do{ - \REPtraceinit % exit in \breakrepeat +\def\repeat#1\do{\REPtraceinit % exit in \breakrepeat \advance\REPdepth by 1\relax \REPcsargrom\ifx{REPcount}\relax \REPcsargrom{\csname newcount\expandafter\endcsname}{REPcount}% @@ -124,10 +108,10 @@ \REPcsargrom\the{REPwtest}% \noexpand\the\REPcsargrom\noexpand{REPtoks}% \REPcsargrom\the{REPutest}% - \global\REPcsargrom\advance{REPcount} by \REPsign\REPcsrom{REPinc}\relax% + \global\REPcsargrom\advance{REPcount} by \REPsign\REPcsrom{REPinc}\relax \noexpand\endrepeat \REPcsargrom\noexpand{REPrepeat}}% - \REPcsrom{REPbody}} + \REPcsrom{REPbody}\ignorespaces} %% %% Stop test %% In order to stop, issue a @@ -142,24 +126,34 @@ %% \def\REPsetup#1{% \begingroup - \def\for##1 {\edef\REPtmp{% - \global\let\REPcsarg\noexpand{##1}\REPcsrom{REPcount}}\REPtmp}% - \def\from##1 {\REPcsargrom\global{REPcount}##1\relax}% - \def\to##1 {\edef\REPtmp{\global\REPcsargrom\noexpand{REPwtest}= + \def\for##1{% + \edef\REPtmp{% + \global\let\REPcsarg\noexpand{##1}\REPcsrom{REPcount}\ignorespaces}% + \REPtmp}% + \def\from##1{\REPcsargrom\global{REPcount}##1\ignorespaces}% + \def\to##1{% + \edef\REPtmp{\global\REPcsargrom\noexpand{REPwtest}= {\REPcsargrom\the{REPwtest}% \noexpand\ifnum\REPcsargrom\noexpand{REPcount}\REPcomp##1\relax - \noexpand\expandafter \noexpand\breakrepeat \noexpand\fi}}\REPtmp}% - \def\downto##1 {\gdef\REPsign{-}\gdef\REPcomp{<}\to{##1}}% - \def\by##1 {\ifnum##1<0 \message{REPEAT: increment has to be >0}% + \noexpand\expandafter \noexpand\breakrepeat + \noexpand\fi}\ignorespaces}% + \REPtmp}% + \def\downto##1{% + \gdef\REPsign{-}\gdef\REPcomp{<}\to{##1}\ignorespaces}% + \def\by##1{\ifnum##1<0 \message{REPEAT: increment has to be >0}% \REPcsargrom\gdef{REPinc}{-##1}\else - \REPcsargrom\gdef{REPinc}{##1}\fi} - \def\until##1 {\edef\REPtmp{\global\REPcsargrom\noexpand{REPutest}= - {\noexpand##1\relax - \noexpand\expandafter \noexpand\breakrepeat \noexpand\fi}}\REPtmp}% - \def\while##1 {\edef\REPtmp{\global\REPcsargrom\noexpand{REPwtest}= - {\noexpand##1\relax \noexpand\else - \noexpand\expandafter \noexpand\breakrepeat \noexpand\fi}}\REPtmp}% - \from{1} \by{1} #1% + \REPcsargrom\gdef{REPinc}{##1}\fi\ignorespaces}% + \def\until##1{% + \edef\REPtmp{\global\REPcsargrom\noexpand{REPutest}= + {\noexpand##1\relax + \noexpand\expandafter \noexpand\breakrepeat \noexpand\fi}\ignorespaces}% + \REPtmp}% + \def\while##1{% + \edef\REPtmp{\global\REPcsargrom\noexpand{REPwtest}= + {\noexpand##1\relax \noexpand\else + \noexpand\expandafter \noexpand\breakrepeat \noexpand\fi}\ignorespaces}% + \REPtmp}% + \from{1}\by{1}#1% \endgroup} \def\REPzero {\REPcsrom{REPtoks}{}\REPcsrom{REPutest}{}\REPcsrom{REPwtest}{}% @@ -168,37 +162,49 @@ \endinput %\tracingmacros2 -\repeat \for{i} \by{2} \do { - \ifnum\i=13 \expandafter\breakrepeat \fi - \message{doing \number\i} -} - -\repeat \for{iii} \to{8} \do {} -\message{After loop: \number\iii} - -\repeat \for{i} \from{10} \by{2} \downto{0} \do { - \message{countdown \number\i} -} - -\repeat \for{x} \while{\ifnum\x<7} \do { - \message{going \number\x} -} - -\repeat \to{3} \do { - \message{hello there!} -} - -\newcount\tmpcount +\newcount\tmpcount % used in some examples below +1 +\repeat \for{i} + \by{2} + \do {% + \ifnum\i=13 \expandafter\breakrepeat \fi + \message{doing \number\i}% +}% +2 +\repeat \for{iii} + \to{8} + \do {} +\message{After loop: \number\iii}% +3 +\repeat \for{i} + \from{10} + \by{2} + \downto{0} + \do {\message{countdown \number\i}} +4 +\repeat \for{x} \while{\ifnum\x<7} + \do {\message{going \number\x}} +5 +\repeat \to{3} \do {\message{hello there!}} +6 \repeat \for{j} \until{\tmpcount\j \divide\tmpcount by 37 \noexpand\ifnum\tmpcount=1} - \do { - \message{testing \number\j} -} - + \do {\message{testing \number\j}} +7 \repeat \for{i} \by{2} \to{10} \do - {\repeat \for{j} \from{\i} \by{3} \to{18} \do - {\message{(\number\i.\number\j)} - }} + {\repeat \for{j} \from{\i} \by{3} \to{18} + \do {\message{(\number\i.\number\j)}} + } +8 + +1 +2 +3 +4 +5 +6 +7 +8 % infinite loop %\repeat \do {} |