From c5986713ad700e9170a486a46cba3bdfdc8ec1de Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 26 Sep 2010 18:38:29 +0000
Subject: vhistory (19jul10)

git-svn-id: svn://tug.org/texlive/trunk@19901 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/vhistory/sets.sty | 57 ++++++++++++++++-----------
 1 file changed, 33 insertions(+), 24 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/vhistory/sets.sty')

diff --git a/Master/texmf-dist/tex/latex/vhistory/sets.sty b/Master/texmf-dist/tex/latex/vhistory/sets.sty
index 4042752545c..a2c26bd103c 100644
--- a/Master/texmf-dist/tex/latex/vhistory/sets.sty
+++ b/Master/texmf-dist/tex/latex/vhistory/sets.sty
@@ -3,8 +3,8 @@
 %% FILE: sets.sty                                                           %%
 %%                                                                          %%
 %% AUTHOR: Jochen Wertenauer                                                %%
-%% VERSION: 1.2                                                             %%
-%% DATE: 2009-03-01                                                         %%
+%% VERSION: 1.3                                                             %%
+%% DATE: 2010-07-17                                                         %%
 %%                                                                          %%
 %% LICENSE: This program may be distributed and/or modified under the       %%
 %% conditions of the LaTeX Project Public License, either version 1.2       %%
@@ -53,18 +53,17 @@
 
 %% Helper Methods ------------------------------------------------------------
 
-\let \sets@xpa \expandafter
-\def \sets@xxpa{\sets@xpa\sets@xpa\sets@xpa}
+\def \sets@xxpa{\expandafter\expandafter\expandafter}
 
 \def \sets@empty{\empty}
 
 %% Appends #1 to the definition of macro #2.
-\def \sets@append #1\to#2{\sets@xpa \def \sets@xpa #2\sets@xpa{#2#1}}
+\def \sets@append #1\to#2{\expandafter \def \expandafter #2\expandafter{#2#1}}
 
 %% Removes the first character of the content of #2 and stores the result in
-%% #1. Note that \sets@xpa\sets@xpa\sets@xpa cannot be replaced by \sets@xxpa here!
+%% #1. Note that \expandafter\expandafter\expandafter cannot be replaced by \sets@xxpa here!
 \def \sets@gobblefirst #1#2{%
-  \sets@xxpa \def \sets@xpa\sets@xpa\sets@xpa #1\sets@xpa\sets@xpa\sets@xpa {\sets@xpa\@gobble #2}}
+  \sets@xxpa \def \expandafter\expandafter\expandafter #1\expandafter\expandafter\expandafter {\expandafter\@gobble #2}}
 
 %% Deletes everthing to the next occurance of > inludung the >.
 \def \sets@erasetobrace #1>{}
@@ -77,7 +76,7 @@
 %%   \if ...
 %% \repeat  
 \def \sets@loop #1\repeat{%
-  \def \iterate {#1\sets@xpa \iterate\fi}%
+  \def \iterate {#1\expandafter \iterate\fi}%
   \iterate \let\iterate\relax}
 
 \long\def \sets@ReturnFi #1\fi{\fi #1}
@@ -99,11 +98,11 @@
 %% The macros are based on a sort algorithm by Klaus Lagally.
 \def \sets@compStrings #1#2{%
   \def \sets@CSti{#1}%
-  \edef\sets@ctempi{\sets@xpa\sets@erasetobrace\meaning \sets@CSti}%
+  \edef\sets@ctempi{\expandafter\sets@erasetobrace\meaning \sets@CSti}%
   \def \sets@CStii{#2}%
-  \edef\sets@ctempii{\sets@xpa\sets@erasetobrace\meaning \sets@CStii}%
+  \edef\sets@ctempii{\expandafter\sets@erasetobrace\meaning \sets@CStii}%
   \sets@lessfalse\sets@greaterfalse
-  \sets@xxpa\sets@compI \sets@xpa\sets@ctempi\sets@xpa|\sets@xpa\\\sets@ctempii|\relax
+  \sets@xxpa\sets@compI \expandafter\sets@ctempi\expandafter|\expandafter\\\sets@ctempii|\relax
 }
 
 
@@ -153,7 +152,7 @@
 %% Stores the size of set #1 in the LaTeX counter #2. #2 has to be existing.
 \def \sizeofset #1\is#2{%
   \setcounter{#2}{0}%
-  \sets@xpa\sets@sizeofset #1|\endset{#2}%
+  \expandafter\sets@sizeofset #1|\endset{#2}%
 }
 
 % Helper method for \sizeofset. Recursively calls itself. Implemented straight
@@ -178,15 +177,25 @@
 \def \setseparator{, } 
 
 %% Prints the contents of set #1. Elements will be separated by \setseparator.
-\def \listset #1{\sets@xpa\sets@listset #1|\empty\endset}
+%\def \listset #1{\expandafter\sets@listset #1|\empty\endset}
+\def \listset #1{\expandafter\sets@listset #1|\endset|}
+
 
 %% Helper method for \listset.
-\def \sets@listset #1|#2\endset{%
+%\def \sets@listset #1|#2\endset{%
+%  #1%
+%  \def\temps@t{#2}%
+%  \ifx \temps@t\sets@empty{}\else
+%    \setseparator
+%    \sets@ReturnFi{\sets@listset #2\endset}%
+%  \fi
+%}
+
+\def \sets@listset #1|#2|{%
   #1%
-  \def\temps@t{#2}%
-  \ifx \temps@t\sets@empty{}\else
-    \setseparator
-    \sets@ReturnFi{\sets@listset #2\endset}%
+  \ifx\endset #2%
+  \else
+    \setseparator\sets@ReturnFi{\sets@listset#2|}%
   \fi
 }
 %-----------------------------------------------------------------------------
@@ -211,7 +220,7 @@
       \endgroup
       \sets@Returntrue
     \fi}%
-  \sets@xpa\lookup \sets@xpa |#2|#1|\endset%
+  \expandafter\lookup \expandafter |#2|#1|\endset%
 }
 %-----------------------------------------------------------------------------
 
@@ -221,7 +230,7 @@
 
 %% This macro finds alle duplicate elements in the SORTED set #1 and removes
 %% them. The result set (still sorted) is stored in #2.
-\def \deleteduplicates #1#2{\sets@xpa\sets@duplicates#1|\endset#2}
+\def \deleteduplicates #1#2{\expandafter\sets@duplicates#1|\endset#2}
 
 %% Helper method for \deleteduplicates. Does some preparations and catches the
 %% special case of an set with size <= 1. Parameter #3 is the result set.
@@ -295,7 +304,7 @@
 \def \sets@sortset #1#2{%
   \let \sorttemps@t #1%
   \sets@loop
-    \sets@xpa\sets@bubblesortRun \sorttemps@t|\endset\sorttemps@t
+    \expandafter\sets@bubblesortRun \sorttemps@t|\endset\sorttemps@t
     \addtocounter{s@tlength}{-1}%
     \ifnum 1<\value{s@tlength}\relax
   \repeat
@@ -358,7 +367,7 @@
   \else
     \let \uniontemps@t=\uniont@mpi
     \ifx \uniont@mpii\empty \else
-      \sets@xpa\sets@append\sets@xpa{\sets@xpa|#2}\to\uniontemps@t
+      \expandafter\sets@append\expandafter{\expandafter|#2}\to\uniontemps@t
     \fi
   \fi
   \sortset{\uniontemps@t}{\uniontemps@t}%
@@ -373,7 +382,7 @@
 %% sorted, too. If #1 contains duplicates, #3 may also contain duplicates.
 \def \intersectsets #1#2\to#3{%
   \def \tempinters@ct{}%
-  \sets@xpa \sets@intersectsets #1|\endset#2\tempinters@ct
+  \expandafter \sets@intersectsets #1|\endset#2\tempinters@ct
   \ifx \tempinters@ct\empty
     \def #3{}%
   \else
@@ -404,7 +413,7 @@
 %% will be part if it is in #2.
 \def \minussets #1\minus#2\to#3{%
   \def \@tempminus{}%
-  \sets@xpa \sets@minussets #1|\endset#2\@tempminus
+  \expandafter \sets@minussets #1|\endset#2\@tempminus
   \ifx \@tempminus\empty
     \def #3{}%
   \else
-- 
cgit v1.2.3

