summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-08-06 23:37:15 +0000
committerKarl Berry <karl@freefriends.org>2008-08-06 23:37:15 +0000
commit7fe74d9b728f85523bb0a77b231fe16d379c6265 (patch)
tree4c55f17677758bd4ab08bb24a5fbcf58d3cb64f3 /Master/texmf-dist/source/latex
parentf26efa972afb0a49e7d84d043c942f138122752c (diff)
expl3 update (6aug08)
git-svn-id: svn://tug.org/texlive/trunk@10123 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3clist.dtx33
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3prg.dtx167
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3prop.dtx16
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3quark.dtx4
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3tlp.dtx30
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3vers.dtx4
6 files changed, 208 insertions, 46 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3clist.dtx b/Master/texmf-dist/source/latex/expl3/l3clist.dtx
index 1bee2934399..0155c64f394 100644
--- a/Master/texmf-dist/source/latex/expl3/l3clist.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3clist.dtx
@@ -36,7 +36,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3clist.dtx 725 2007-12-22 21:25:00Z mittelba $
+\GetIdInfo$Id: l3clist.dtx 745 2008-08-03 18:50:46Z morten $
{L3 Experimental comma separated lists}
%\iffalse
%<*driver>
@@ -736,7 +736,7 @@
% we did. If we didn't, place the function "#1" in front of the
% element "#2", which is surrounded by braces.
% \begin{macrocode}
-\def_new:Npn \clist_map_function_aux:Nw #1#2,{
+\def_long_new:Npn \clist_map_function_aux:Nw #1#2,{
\quark_if_recursion_tail_stop:n{#2}
#1{#2}
\clist_map_function_aux:Nw #1
@@ -760,13 +760,20 @@
% that all of the functions called have distict names. A simpler
% approach would of course be to use grouping and thus the save
% stack but then you lose the ability to do things locally.
+%
+% A funny little thing occured in one document: The command setting
+% up the first call of |\clist_map_inline:Nn| was used in a tabular
+% cell and the inline code used |\\| so the loop broke as soon as
+% this happened. Lesson to be learned from this: If you wish to have
+% group like structure but not using the groupings of \TeX, then do
+% every operation globally.
% \begin{macrocode}
-\int_new:N \l_clist_inline_level_int
-\def_new:Npn \clist_map_inline:Nn #1#2{
+\int_new:N \g_clist_inline_level_int
+\def_long_new:Npn \clist_map_inline:Nn #1#2{
\clist_if_empty:NF #1
{
- \int_incr:N \l_clist_inline_level_int
- \def:cpn {clist_map_inline_ \int_use:N \l_clist_inline_level_int :n}
+ \int_gincr:N \g_clist_inline_level_int
+ \gdef_long:cpn {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n}
##1{#2}
% \end{macrocode}
% Recall that the |E| in |\exp_args:NcE| means `single token expanded
@@ -776,22 +783,22 @@
% |\clist_map_function_aux:Nw| for the actual loop.
% \begin{macrocode}
\exp_args:NcE \clist_map_function_aux:Nw
- {clist_map_inline_ \int_use:N \l_clist_inline_level_int :n}
+ {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n}
#1 , \q_recursion_tail , \q_recursion_stop
- \int_decr:N \l_clist_inline_level_int
+ \int_gdecr:N \g_clist_inline_level_int
}
}
\def_new:Npn \clist_map_inline:cn{\exp_args:Nc\clist_map_inline:Nn}
-\def_new:Npn \clist_map_inline:nn #1#2{
+\def_long_new:Npn \clist_map_inline:nn #1#2{
\tlist_if_empty:nF {#1}
{
- \int_incr:N \l_clist_inline_level_int
- \def:cpn {clist_map_inline_ \int_use:N \l_clist_inline_level_int :n}
+ \int_gincr:N \g_clist_inline_level_int
+ \gdef_long:cpn {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n}
##1{#2}
\exp_args:Nc \clist_map_function_aux:Nw
- {clist_map_inline_ \int_use:N \l_clist_inline_level_int :n}
+ {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n}
#1 , \q_recursion_tail , \q_recursion_stop
- \int_decr:N \l_clist_inline_level_int
+ \int_gdecr:N \g_clist_inline_level_int
}
}
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/expl3/l3prg.dtx b/Master/texmf-dist/source/latex/expl3/l3prg.dtx
index 72084e07132..b99caf822d7 100644
--- a/Master/texmf-dist/source/latex/expl3/l3prg.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3prg.dtx
@@ -36,7 +36,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3prg.dtx 697 2007-11-27 14:14:54Z morten $
+\GetIdInfo$Id: l3prg.dtx 768 2008-08-05 19:45:06Z morten $
{L3 Experimental control structures}
%\iffalse
%<*driver>
@@ -364,6 +364,71 @@
% \end{quote}
% ultimately returns \m{true}.
% \end{function}
+%
+% \subsubsection{Case switches}
+%
+%
+% \begin{function}{
+% \prg_case_int:nnn |
+%
+% }
+% \begin{syntax}
+% "\prg_case_int:nnn" "{"<integer expr>"}" "{"
+% " {"\m{integer expr$\sb 1$}"}""{"\m{code$\sb 1$}"}""{"\m{integer expr$\sb 2$}"}""{"\m{code$\sb 2$}"}"\\
+% " ...""{"\m{integer expr$\sb n$}"}""{"\m{code$\sb n$}"}"\\
+% "}" "{"\m{else case}"}"
+% \end{syntax}
+% This function evaluates the first \meta{integer expr} and then compares it
+% to the values found in the list. Thus the expression
+% \begin{verbatim}
+% \prg_case:nnn{2*5}{
+% {5}{Small} {4+6}{Medium} {-2*10}{Negative}
+% }{Other}
+% \end{verbatim}
+% evaluates first the term to look for and then tries to find this
+% value in the list of values. If the value is found, the code on its
+% right is executed after removing the remainder of the list. If the
+% value is not found, the \meta{else case} is executed. The example
+% above will return ``Medium''.
+%
+% The function is expandable and is written in such a way that
+% \texttt{f} style expansion can take place cleanly, i.e., no tokens
+% from within the function are left over.
+% \end{function}
+%
+% \begin{function}{
+% \prg_case_dim:nnn |
+%
+% }
+% \begin{syntax}
+% "\prg_case_int:nnn" "{"<dim expr>"}" "{"
+% " {"\m{dim expr$\sb 1$}"}""{"\m{code$\sb 1$}"}""{"\m{dim expr$\sb 2$}"}""{"\m{code$\sb 2$}"}"\\
+% " ...""{"\m{dim expr$\sb n$}"}""{"\m{code$\sb n$}"}"\\
+% "}" "{"\m{else case}"}"
+% \end{syntax}
+% This function works just like |\prg_case_int:nnn| except it works
+% for \meta{dim} registers.
+% \end{function}
+%
+% \begin{function}{
+% \prg_case_str:nnn |
+%
+% }
+% \begin{syntax}
+% "\prg_case_str:nnn" "{"<string>"}" "{"
+% " {"\m{string$\sb 1$}"}""{"\m{code$\sb 1$}"}""{"\m{string$\sb 2$}"}""{"\m{code$\sb 2$}"}"\\
+% " ...""{"\m{string$\sb n$}"}""{"\m{code$\sb n$}"}"\\
+% "}" "{"\m{else case}"}"
+% \end{syntax}
+% This function works just like |\prg_case_int:nnn| except it
+% compares strings. Each string is evaluated fully using \texttt{x}
+% style expansion.
+%
+% The function is expandable\footnote{Provided you use pdfTeX v1.30 or
+% later} and is written in such a way that
+% \texttt{f} style expansion can take place cleanly, i.e., no tokens
+% from within the function are left over.
+% \end{function}
%
% \subsubsection{Generic loops}
%
@@ -701,25 +766,26 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\l_prg_inline_level_int}
+% \begin{macro}{\g_prg_inline_level_int}
% \begin{macro}{\prg_stepwise_inline:nnnn}
% \begin{macro}{\prg_stepwise_inline_decr:nnnn}
% \begin{macro}{\prg_stepwise_inline_incr:nnnn}
% This function uses the same approach as for instance
% |\clist_map_inline:Nn| to allow arbitrary nesting. First construct
% the special function and then call an auxiliary one which just
-% carries the newly constructed csname.
+% carries the newly constructed csname. Must make assignments global
+% when we maintain our own stack.
% \begin{macrocode}
-\int_new:N\l_prg_inline_level_int
+\int_new:N\g_prg_inline_level_int
\def_long_new:NNn\prg_stepwise_inline:nnnn 4{
- \int_incr:N \l_prg_inline_level_int
- \def:cpn{prg_stepwise_inline_\int_use:N\l_prg_inline_level_int :n}##1{#4}
+ \int_gincr:N \g_prg_inline_level_int
+ \gdef:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4}
\num_compare:nNnTF {#2}<\c_zero
{\exp_args:Nco \prg_stepwise_inline_decr:Nnnn }
{\exp_args:Nco \prg_stepwise_inline_incr:Nnnn }
- {prg_stepwise_inline_\int_use:N\l_prg_inline_level_int :n}
+ {prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}
{\int_use:N\int_eval:n{#1}} {#2} {#3}
- \int_decr:N \l_prg_inline_level_int
+ \int_gdecr:N \g_prg_inline_level_int
}
\def_long_new:NNn \prg_stepwise_inline_incr:Nnnn 4{
\num_compare:nNnF {#2}>{#4}
@@ -1091,6 +1157,91 @@
% \end{macrocode}
% \end{macro}
%
+% \subsubsection{Case switch}
+%
+% \begin{macro}{\prg_case_int:nnn}
+% \begin{macro}{\prg_case_int_aux:nnn}
+% This case switch is in reality quite simple. It takes three arguments:
+% \begin{enumerate}
+% \item An integer expression you wish to find.
+% \item A list of pairs of "{"\meta{integer
+% expr}"}""{"\meta{code}"}". The list can be as long as is desired
+% and \meta{integer expr} can be negative.
+% \item The code to be executed if the value wasn't found.
+% \end{enumerate}
+% We don't need the else case here yet, so leave it dangling in the
+% input stream.
+% \begin{macrocode}
+\def_long:Npn \prg_case_int:nnn #1 #2 {
+% \end{macrocode}
+% We will be parsing on |#1| for each step so we might as well
+% evaluate it first in case it is complicated.
+% \begin{macrocode}
+ \exp_args:No \prg_case_int_aux:nnn {\num_value:w \int_eval:n{#1}} #2
+% \end{macrocode}
+% The \texttt{?} below is just so there are enough arguments when we
+% reach the end. And it made you look.~\texttt{;-)}
+% \begin{macrocode}
+ \q_recursion_tail ? \q_recursion_stop
+}
+\def_long_new:Npn \prg_case_int_aux:nnn #1#2#3{
+% \end{macrocode}
+% If we reach the end, return the else case. We just remove braces.
+% \begin{macrocode}
+ \quark_if_recursion_tail_stop_do:nn{#2}{\use_arg_i:n}
+% \end{macrocode}
+% Otherwise we compare (which evaluates |#2| for us)
+% \begin{macrocode}
+ \num_compare:nNnTF{#1}={#2}
+% \end{macrocode}
+% If true, we want to remove the remainder of the list, the else case
+% and then execute the code specified. Why not use |#3\use_none:n|?
+% Because if we are doing |f| style expansion, we will get
+% leftovers. If the test was false, we try the next pair, carrying the
+% |#1|.
+% \begin{macrocode}
+ { \use_arg_i_delimit_by_q_recursion_stop:nw {\use_arg_i:nn{#3}} }
+ { \prg_case_int_aux:nnn {#1}}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\prg_case_dim:nnn}
+% \begin{macro}{\prg_case_dim_aux:nnn}
+% Same as |\prg_case_dim:nnn| except it is for \meta{dim} registers.
+% \begin{macrocode}
+\def_long:Npn \prg_case_dim:nnn #1 #2 {
+ \exp_args:No \prg_case_dim_aux:nnn {\dim_use:N \dim_eval:n{#1}} #2
+ \q_recursion_tail ? \q_recursion_stop
+}
+\def_long_new:Npn \prg_case_dim_aux:nnn #1#2#3{
+ \quark_if_recursion_tail_stop_do:nn{#2}{\use_arg_i:n}
+ \dim_compare:nNnTF{#1}={#2}
+ { \use_arg_i_delimit_by_q_recursion_stop:nw {\use_arg_i:nn{#3}} }
+ { \prg_case_dim_aux:nnn {#1}}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\prg_case_str:nnn}
+% \begin{macro}{\prg_case_str_aux:nnn}
+% Same as |\prg_case_dim:nnn| except it is for strings.
+% \begin{macrocode}
+\def_long:Npn \prg_case_str:nnn #1 #2 {
+ \prg_case_str_aux:nnn {#1} #2
+ \q_recursion_tail ? \q_recursion_stop
+}
+\def_long_new:Npn \prg_case_str_aux:nnn #1#2#3{
+ \quark_if_recursion_tail_stop_do:nn{#2}{\use_arg_i:n}
+ \tlist_if_eq:xxTF{#1}{#2}
+ { \use_arg_i_delimit_by_q_recursion_stop:nw {\use_arg_i:nn{#3}} }
+ { \prg_case_str_aux:nnn {#1}}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
% \subsubsection{Sorting}
%
diff --git a/Master/texmf-dist/source/latex/expl3/l3prop.dtx b/Master/texmf-dist/source/latex/expl3/l3prop.dtx
index 08aa9b4a075..d9c9e1271cc 100644
--- a/Master/texmf-dist/source/latex/expl3/l3prop.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3prop.dtx
@@ -36,7 +36,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3prop.dtx 742 2008-08-01 13:37:45Z morten $
+\GetIdInfo$Id: l3prop.dtx 745 2008-08-03 18:50:46Z morten $
{L3 Experimental Property Lists}
%\iffalse
%<*driver>
@@ -272,7 +272,7 @@
% \end{function}
%
% \begin{function}{%
-% \l_prop_inline_level_num |
+% \g_prop_inline_level_num |
% }
% Fake integer used in internal name for function used inside
% "\prop_map_inline:NN".
@@ -720,19 +720,19 @@
%
% \begin{macro}{\prop_map_inline:Nn}
% \begin{macro}{\prop_map_inline:cn}
-% \begin{macro}{\l_prop_inline_level_num}
+% \begin{macro}{\g_prop_inline_level_num}
% The inline functions are straight forward. It takes longer
% to test if the list is empty than to run it on an empty list so
% we don't waste time doing that.
% \begin{macrocode}
-\num_new:N \l_prop_inline_level_num
+\num_new:N \g_prop_inline_level_num
\def_new:Npn \prop_map_inline:Nn #1#2 {
- \num_incr:N \l_prop_inline_level_num
- \def_long:cpn {prop_map_inline_ \num_use:N \l_prop_inline_level_num :n}
+ \num_gincr:N \g_prop_inline_level_num
+ \gdef_long:cpn {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n}
##1##2{#2}
\prop_map_function:Nc #1
- {prop_map_inline_ \num_use:N \l_prop_inline_level_num :n}
- \num_decr:N \l_prop_inline_level_num
+ {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n}
+ \num_gdecr:N \g_prop_inline_level_num
}
\def_new:Npn \prop_map_inline:cN { \exp_args:Nc \prop_map_inline:NN }
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/expl3/l3quark.dtx b/Master/texmf-dist/source/latex/expl3/l3quark.dtx
index 5379adeeda2..80328f6a768 100644
--- a/Master/texmf-dist/source/latex/expl3/l3quark.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3quark.dtx
@@ -36,7 +36,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3quark.dtx 705 2007-12-02 22:14:25Z morten $
+\GetIdInfo$Id: l3quark.dtx 761 2008-08-04 21:35:13Z morten $
{L3 Experimental Quark Commands}
%\iffalse
%<*driver>
@@ -337,7 +337,7 @@
% \begin{macrocode}
\def_long_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 {
\exp_after:NN\if_meaning:NN
- \quark_if_recursion_tail_aux:w #1?\q_nil\q_recursion_tail
+ \quark_if_recursion_tail_aux:w #1?\q_nil\q_recursion_tail\q_recursion_tail
\exp_after:NN \use_arg_i_delimit_by_q_recursion_stop:nw
\else:
\exp_after:NN\use_none:n
diff --git a/Master/texmf-dist/source/latex/expl3/l3tlp.dtx b/Master/texmf-dist/source/latex/expl3/l3tlp.dtx
index ae3e72abe60..2d722a77624 100644
--- a/Master/texmf-dist/source/latex/expl3/l3tlp.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3tlp.dtx
@@ -36,7 +36,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3tlp.dtx 740 2008-08-01 13:25:38Z morten $
+\GetIdInfo$Id: l3tlp.dtx 767 2008-08-05 19:44:21Z morten $
{L3 Experimental Token List Pointers}
%\iffalse
%<*driver>
@@ -439,6 +439,7 @@
%
% \begin{function}{%
% \tlist_elt_count:n |
+% \tlist_elt_count:o |
% \tlp_elt_count:N |
% }
% \begin{syntax}
@@ -1413,33 +1414,33 @@
% \begin{macro}{\tlp_map_inline:Nn}
% \begin{macro}{\tlp_map_inline:cn}
% \begin{macro}{\tlist_map_inline_aux:n}
-% \begin{macro}{\l_tlp_inline_level_num}
+% \begin{macro}{\g_tlp_inline_level_num}
% The inline functions are straight forward by now. We use a little
-% a trick with the fake counter |\l_tlp_inline_level_num| to make
+% a trick with the fake counter |\g_tlp_inline_level_num| to make
% them nestable.\footnote{This should be a proper integer, but I
% don't want to mess with the dependencies right now\dots} We can
% also make use of |\tlist_map_function:Nn| from before.
% \begin{macrocode}
\def_long_new:Npn \tlist_map_inline:nn #1#2{
- \num_incr:N \l_tlp_inline_level_num
- \def_long:cpn {tlist_map_inline_ \num_use:N \l_tlp_inline_level_num :n}
+ \num_gincr:N \g_tlp_inline_level_num
+ \gdef_long:cpn {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n}
##1{#2}
\exp_args:Nc \tlist_map_function_aux:Nn
- {tlist_map_inline_ \num_use:N \l_tlp_inline_level_num :n}
+ {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n}
#1 \q_recursion_tail\q_recursion_stop
- \num_decr:N \l_tlp_inline_level_num
+ \num_gdecr:N \g_tlp_inline_level_num
}
\def_long_new:Npn \tlp_map_inline:Nn #1#2{
- \num_incr:N \l_tlp_inline_level_num
- \def_long:cpn {tlist_map_inline_ \num_use:N \l_tlp_inline_level_num :n}
+ \num_gincr:N \g_tlp_inline_level_num
+ \gdef_long:cpn {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n}
##1{#2}
\exp_args:NcE \tlist_map_function_aux:Nn
- {tlist_map_inline_ \num_use:N \l_tlp_inline_level_num :n}
+ {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n}
#1 \q_recursion_tail\q_recursion_stop
- \num_decr:N \l_tlp_inline_level_num
+ \num_gdecr:N \g_tlp_inline_level_num
}
\def_new:Npn\tlp_map_inline:cN{\exp_args:Nc\tlp_map_inline:NN}
-\tlp_new:Nn \l_tlp_inline_level_num{0}
+\tlp_new:Nn \g_tlp_inline_level_num{0}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1489,6 +1490,7 @@
%
%
% \begin{macro}{\tlist_elt_count:n}
+% \begin{macro}{\tlist_elt_count:o}
% \begin{macro}{\tlp_elt_count:n}
% Count number of elements within a token list or token list
% pointer. Brace groups within the list are read as a single
@@ -1501,6 +1503,7 @@
\tlist_map_function:nN {#1}\num_elt_count:n
\num_eval_end:
}
+\def_new:Npn \tlist_elt_count:o {\exp_args:No\tlist_elt_count:n}
\def_new:Npn \tlp_elt_count:N #1{
\num_value:w \num_eval:w 0
\tlp_map_function:NN #1 \num_elt_count:n
@@ -1509,6 +1512,7 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
%
%
@@ -1961,7 +1965,7 @@
% and putting it in front of the ones before it.
% \begin{macrocode}
\def_long_new:Npn \tlist_reverse:n #1{
- \tlist_reverse_aux:nN {} #1 \q_recursion_tail\q_stop
+ \tlist_reverse_aux:nN {} #1 \q_recursion_tail\q_recursion_stop
}
\def_long_new:Npn \tlist_reverse_aux:nN #1#2{
\quark_if_recursion_tail_stop_do:nn {#2}{ #1 }
diff --git a/Master/texmf-dist/source/latex/expl3/l3vers.dtx b/Master/texmf-dist/source/latex/expl3/l3vers.dtx
index 1bd308c2970..b3cbde577bd 100644
--- a/Master/texmf-dist/source/latex/expl3/l3vers.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3vers.dtx
@@ -35,7 +35,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3vers.dtx 743 2008-08-01 14:02:18Z morten $
+\GetIdInfo$Id: l3vers.dtx 769 2008-08-05 19:48:40Z morten $
{L3 Experimental LaTeX format version}
%\iffalse
%<*driver>
@@ -63,7 +63,7 @@
% \begin{macrocode}
%<*initex>
\def:Npn\c_format_name{Experimental~ LaTeX3}
-\def:Npn\c_format_date{2008/08/01}
+\def:Npn\c_format_date{2008/08/05}
%^^A\def:Npx\c_format_version{--release--date--goes--here--}
% \end{macrocode}
% \end{macro}