From 4562c8ef52feafaa80dee3acb04703260908e35f Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Sun, 22 Jun 2008 11:23:03 +0000 Subject: xbase 2008/06/20 git-svn-id: svn://tug.org/texlive/trunk@8930 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/xbase/ldcsetup.dtx | 45 ++++---- Master/texmf-dist/source/latex/xbase/template.dtx | 130 +++++++++++----------- Master/texmf-dist/source/latex/xbase/xparse.dtx | 41 +++---- 3 files changed, 104 insertions(+), 112 deletions(-) (limited to 'Master/texmf-dist/source/latex/xbase') diff --git a/Master/texmf-dist/source/latex/xbase/ldcsetup.dtx b/Master/texmf-dist/source/latex/xbase/ldcsetup.dtx index 7ebb1d59830..7d2d729d622 100644 --- a/Master/texmf-dist/source/latex/xbase/ldcsetup.dtx +++ b/Master/texmf-dist/source/latex/xbase/ldcsetup.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: ldcsetup.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle -%% (C) Copyright 2004-2006 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2007 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -33,22 +33,18 @@ %% %% ----------------------------------------------------------------------- %% -%\RequirePackage{l3names} -%<*dtx> +%<*driver|package> +\RequirePackage{l3names} +% %\fi -\def\GetIdInfo$Id: #1.dtx #2 #3-#4-#5 #6 #7$#8{% - \def\fileversion{#2}% - \def\filedate{#3/#4/#5}% - \ProvidesFile{#1.dtx}[#3/#4/#5 v#2 #8]% -} -%\iffalse -% -%\fi -\GetIdInfo$Id: ldcsetup.dtx 574 2006-08-21 23:30:10Z morten $ +\GetIdInfo$Id: ldcsetup.dtx 636 2007-09-12 20:03:06Z mittelba $ {coding conventions and stuff} -% -% \iffalse +%\iffalse %<*driver> +%\fi +\ProvidesFile{\filename.\filenameext} + [\filedate\space v\fileversion\space\filedescription] +%\iffalse \documentclass{ltxdoc} \begin{document} \DocInput{ldcsetup.dtx} @@ -73,12 +69,12 @@ % % \begin{macrocode} %<*package> +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} % \end{macrocode} -% |\CodeStart| is in effect here so we better stop it again. % \begin{macrocode} -\CodeStop -\RequirePackage{keyval,calc} -\makeatletter +\RequirePackage{keyval,l3calc} +\ExplSyntaxOff % \end{macrocode} % % \section{Ignoring White Space} @@ -152,7 +148,8 @@ % % Do it for this package. % \begin{macrocode} -\IgnoreWhiteSpace +%\InternalSyntaxOn +\ExplSyntaxOn % \end{macrocode} % % \section{KV fixes} @@ -301,9 +298,8 @@ % Count Register assignments via calc. Here we also provide some % global versions since a normal global prefix won't have any effect. % \begin{macrocode} -\let\SetInternalCounter\calc@assign@count -\def\GsetInternalCounter#1{\SetInternalCounter{\global#1}} -\def\gsetlength#1{\setlength{\global#1}} +\let:NN \SetInternalCounter \calc_int_set:Nn +\let:NN \GSetInternalCounter\calc_int_gset:Nn % \end{macrocode} % % @@ -319,9 +315,8 @@ % the space gets reclaimed. % \begin{macrocode} \def\UndeclareRobustCommand#1{% - \global\let#1\undefined - \global\expandafter - \let\csname\expandafter\@gobble\string#1~\endcsname\undefined + \cs_gundefine:N #1 + \exp_args:Nc \cs_gundefine:N {\cs_to_str:N #1~} } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/xbase/template.dtx b/Master/texmf-dist/source/latex/xbase/template.dtx index 3e6a4050454..68e27966fa4 100644 --- a/Master/texmf-dist/source/latex/xbase/template.dtx +++ b/Master/texmf-dist/source/latex/xbase/template.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: template.dtx (C) Copyright 1999-2001 David Carlisle, Frank Mittelbach -%% (C) Copyright 2004-2006 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2007 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -33,23 +33,18 @@ %% %% ----------------------------------------------------------------------- %% -%\RequirePackage{l3names} -%<*dtx> +%<*driver|package> +\RequirePackage{l3names} +% %\fi -\def\GetIdInfo$Id: #1.dtx #2 #3-#4-#5 #6 #7$#8{% - \def\fileversion{#2}% - \def\filedate{#3/#4/#5}% - \ProvidesFile{#1.dtx}[#3/#4/#5 v#2 #8]% -} -%\iffalse -% -%\fi -\GetIdInfo$Id: template.dtx 584 2006-12-12 17:29:34Z morten $ +\GetIdInfo$Id: template.dtx 652 2007-09-21 20:35:36Z morten $ {template} -% \iffalse -% -% +%\iffalse %<*driver> +%\fi +\ProvidesFile{\filename.\filenameext} + [\filedate\space v\fileversion\space\filedescription] +%\iffalse \documentclass{ltxdoc} \makeatletter \newenvironment{decl}[1][]% @@ -474,7 +469,7 @@ % passed to the internal parameter list (this has to happen explicitly % from within the code). |#1| may be used to access the value % specified. - +% % The main purpose for this type is of historical nature (originally % most of the other types have been implemented internally using |g|). % @@ -1126,17 +1121,15 @@ % \section{Implementation} % \begin{macrocode} %<*package> +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} % \end{macrocode} % % \begin{macrocode} \RequirePackage{ldcsetup,xparse} -\RequirePackage{l3toks,l3tlp,l3skip,l3int,l3clist,l3token} +\RequirePackage{l3toks,l3tlp,l3skip,l3int,l3clist,l3token,l3calc} % \end{macrocode} % -% Ignore white space in this package. -% \begin{macrocode} -\CodeStart -% \end{macrocode} % % Declare a private token register for building parameter lists. % Having the number saves a few expandafters @@ -1236,38 +1229,26 @@ % \end{macro} % % \begin{macro}{\TP_push_assignments:n} -% Store a list of parameter assignments given as an argument -% in |\l_TP_KV_assignments_toks| and -% then push it -% onto the |\g_TP_assignments_stack_toks|. (My assumption is that -% the somewhat strange -% way to do this is in fact neccesary to preserve the |#| marks -% which would otherwise need doubling --- check). -% \begin{macrocode} -\def_new:Npn \TP_push_assignments:n{ - \tex_afterassignment:D \TP_push_assignments: - \l_TP_KV_assignments_toks} -% \end{macrocode} -% -% \end{macro} -% % \begin{macro}{\TP_push_assignments:} -% Pushes the parameter assignment list stored in -% |\l_TV_KV_assignments_toks| onto the stack -% |\g_TP_assignments_stack_toks|. +% Push a list of parameter assignments onto the +% |\g_TP_assignments_stack_toks|. As it all happens in token +% registers |#|s need no doubling. |\TP_push_assignments:| expects +% it to be |\l_TP_KV_assignments_toks| (needs fixing). % \begin{macrocode} +\def_long_new:Npn \TP_push_assignments:n#1{ + \toks_gput_left:Nn\g_TP_assignments_stack_toks{{#1}} +} \def_new:Npn \TP_push_assignments:{ \toks_gset:No \g_TP_assignments_stack_toks {\exp_after:NN -% \end{macrocode} -% this misuses the fact that |\toks_use:N| is really |\the| so expands -% a little strangely (fix). -% \begin{macrocode} {\toks_use:N\exp_after:NN\l_TP_KV_assignments_toks\exp_after:NN} - \toks_use:N\g_TP_assignments_stack_toks}} + \toks_use:N\g_TP_assignments_stack_toks} +} % \end{macrocode} % \end{macro} +% \end{macro} % +% % \begin{macro}{\DeclareTemplateType} % |{type}{nofarg}| % \begin{macrocode} @@ -2022,8 +2003,17 @@ \group_begin: \TP_templdecl_multiselection:nnnn ##1 \group_end: +% \end{macrocode} +% Extracting the correct item from the |\if_case:w| we are building +% requires a bit of care. Firstly we want to expand the appropirate +% number of times to get to the item but we also want to ensure we do +% not have any unwanted leftover |\fi:|s or other junk which is bound +% to cause errors later on. Therefore we start an |f| expansion (so we +% don't have to count |\exp_after:NN|s and then stop it again when we +% want to. +% \begin{macrocode} \toks_put_right:Nx\l_TP_KV_assignments_toks { - \exp_not:n{\tlp_set:No #1} { \toks_use:N \g_TP_multiselection_toks} + \exp_not:n{\tlp_set:Nf #1} { \toks_use:N \g_TP_multiselection_toks} } } { @@ -2037,12 +2027,18 @@ % \end{macro} % % \begin{macro}{\TP_templdecl_multiselection:nnnn} -% Start the |\if_case:w| +% Start the |\if_case:w|. When the item is retrieved using an |f| +% type expansion we better stop it at the right place once we have +% emerged on the other side of the conditional. % \begin{macrocode} \def_new:Npn \TP_templdecl_multiselection:nnnn #1#2#3#4{ \toks_gset:Nn \g_TP_multiselection_toks {\if_case:w #2} - \clist_map_inline:nn {#3}{ \TP_multiselection_add_or_case:n {##1} } - \toks_gput_right:Nn\g_TP_multiselection_toks { \else: #4\fi: } + \clist_map_inline:nn {#3}{ + \TP_multiselection_add_or_case:n {\exp_stop_f:##1} + } + \toks_gput_right:Nn\g_TP_multiselection_toks { + \else: \use_arg_i_after_fi:nw { \exp_stop_f: #4} \fi: + } } % \end{macrocode} % \end{macro} @@ -2182,9 +2178,9 @@ % {#1#2{##1}\def:Npx #3{\toks_use:N#2}} \toks_set:No \l_tmpa_toks {\use_arg_ii:nn ##1} \toks_put_right:Nx \l_TP_KV_assignments_toks { - {\exp_not:n{#1#2}{\toks_use:N \l_tmpa_toks} + \exp_not:n{#1#2}{\toks_use:N \l_tmpa_toks} \exp_not:n{ \def:Npx #3{\toks_use:N#2} } - } + } } % \end{macrocode} @@ -2232,12 +2228,12 @@ % \marg{operation} \marg{register} |\MultiSelection| % \marg{selector} \marg{case-list} \marg{else-case} % -% This command builds up the |\if_case:w| code from the three arguments -% of |\MultiSelection| and stores it in -% |\g_TP_multiselection_toks|. This code is supposed to be run in -% a group so a) we don't have to initialise -% |\g_TP_multiselection_toks| and b) all changes to the used -% registers not affecting the outside. +% This command builds up the |\if_case:w| code from the three +% arguments of |\MultiSelection| and stores it in +% |\g_TP_multiselection_toks|. This code is supposed to be run in a +% group so a) we don't have to initialise |\g_TP_multiselection_toks| +% and b) all changes to the used registers not affecting the +% outside. % % \begin{macrocode} \def_new:Npn \TP_multiselection_add:nnnnnn #1#2#3#4#5#6{ @@ -2249,28 +2245,28 @@ } { #1#2{##1} - \TP_multiselection_add_or_case:n { \toks_use:N #2 } + \TP_multiselection_add_or_case:o { \toks_use:N #2 } } } - \toks_gput_right:Nn \g_TP_multiselection_toks { \else: #6\fi: } + \toks_gput_right:Nn \g_TP_multiselection_toks { + \else: \use_arg_i_after_fi:nw{#6}\fi: + } } % \end{macrocode} % % \end{macro} % % \begin{macro}{\TP_multiselection_add_or_case:o} -% Since we intend to add |\or:| to |\g_TP_multiselection_toks| -% within the |\_for| loop we have to hide it carefully or else we -% will get some unmatched conditionals. -% -% Actually the |:o| is a slight lie here since the expanion happens -% when we add things to the toks register inside. +% No need to worry about where |\or:| is allowed to be added since +% all loops in \LaTeX3 process the item outside conditionals. % \begin{macrocode} \def_new:Npn \TP_multiselection_add_or_case:n #1 { - \toks_gput_right:Nn \g_TP_multiselection_toks { \or: #1 } + \toks_gput_right:Nn \g_TP_multiselection_toks { + \or: \use_arg_i_after_orelse:nw{#1} + } } \def_new:Npn \TP_multiselection_add_or_case:o { - \exp_args:NNo \TP_multiselection_add_or_case:n + \exp_args:No \TP_multiselection_add_or_case:n } % \end{macrocode} % \end{macro} @@ -2342,7 +2338,7 @@ % adds stuff to \l_TP_KV_assignments_toks \setkeys {\cs:w TPO>/#1/#3\cs_end:}{#4} - \tlp_set:co { TPR>/#1/#2 } + \tlp_set:cx { TPR>/#1/#2 } { \toks_use:N \l_TP_KV_assignments_toks } \cs_if_free:cTF { TPO>/#1/#3 } { \tlp_set:cn {TPO>/#1/#2}{#1/#3} } diff --git a/Master/texmf-dist/source/latex/xbase/xparse.dtx b/Master/texmf-dist/source/latex/xbase/xparse.dtx index 90346556975..0ecd05af7bc 100644 --- a/Master/texmf-dist/source/latex/xbase/xparse.dtx +++ b/Master/texmf-dist/source/latex/xbase/xparse.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: xparse.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle -%% (C) Copyright 2004-2006 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2007 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -33,21 +33,18 @@ %% %% ----------------------------------------------------------------------- %% -%\RequirePackage{l3names} -%<*dtx> +%<*driver|package> +\RequirePackage{l3names} +% %\fi -\def\GetIdInfo$Id: #1.dtx #2 #3-#4-#5 #6 #7$#8{% - \def\fileversion{#2}% - \def\filedate{#3/#4/#5}% - \ProvidesFile{#1.dtx}[#3/#4/#5 v#2 #8]% -} -%\iffalse -% -%\fi -\GetIdInfo$Id: xparse.dtx 574 2006-08-21 23:30:10Z morten $ +\GetIdInfo$Id: xparse.dtx 700 2007-11-27 14:18:29Z morten $ {generic document command parser} -% \iffalse +%\iffalse %<*driver> +%\fi +\ProvidesFile{\filename.\filenameext} + [\filedate\space v\fileversion\space\filedescription] +%\iffalse \documentclass{ltxdoc} \usepackage[T1]{fontenc} \usepackage{textcomp} @@ -65,7 +62,7 @@ % % \fi % -% \CheckSum{621} +% \CheckSum{626} % % % \title{The \textsf{xparse} package\thanks{This file @@ -691,7 +688,8 @@ % square brackets this often leads to errors. The following example % definition works (I \emph{did} try it). % \begin{verbatim} -% \CodeStart +% \ExplSyntaxOn +% \makeatletter % \cs_gundefine:N \math@cr % \DeclareDocumentCommand\math@cr{>{W}s >{W}O{\z@}}{ % \IfBooleanTF{#1} @@ -706,7 +704,8 @@ % \math@cr@@@ % \noalign{\vskip#2\relax} % } -% \CodeStop +% \makeatother +% \ExplSyntaxOn % \end{verbatim} % Note that this definition automatically avoids problems within the % alignments even if it is called as |\\&|. @@ -835,6 +834,8 @@ % First the required packages. % \begin{macrocode} %<*package> +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} \RequirePackage{l3tlp,l3num,l3toks,l3prg,l3int,l3seq,l3token} % \end{macrocode} % @@ -1946,11 +1947,11 @@ % \begin{macro}{\IfBooleanF} % The logical \meta{true} and \meta{false} statements are just our % normal |\c_true| and |\c_false| so testing for them is done with -% our usual |\prg_if_predicate:nTF| functions from \textsf{l3prg}. +% our usual |\bool_if:NTF| functions from \textsf{l3prg}. % \begin{macrocode} -\let_new:NN \IfBooleanTF \prg_if_predicate:nTF -\let_new:NN \IfBooleanT \prg_if_predicate:nT -\let_new:NN \IfBooleanF \prg_if_predicate:nF +\let_new:NN \IfBooleanTF \bool_if:NTF +\let_new:NN \IfBooleanT \bool_if:NT +\let_new:NN \IfBooleanF \bool_if:NF % \end{macrocode} % \end{macro} % \end{macro} -- cgit v1.2.3