diff options
author | Karl Berry <karl@freefriends.org> | 2011-10-10 21:52:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-10-10 21:52:54 +0000 |
commit | 26a0070af35fa5652128c74fa1f126ec51def209 (patch) | |
tree | c3cb194fd4cc2dc13141e39c561dc5bc5d0b7a83 /Master/texmf-dist/source/latex | |
parent | 4d055293335b5b39f55edeff0c28700ebc2486eb (diff) |
l3kernel 2900 (10oct11)
git-svn-id: svn://tug.org/texlive/trunk@24256 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
22 files changed, 632 insertions, 340 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 9f9b88667ef..a5c7cde052a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -37,8 +37,8 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/09/15} -\def\ExplFileVersion{2828} +\def\ExplFileDate{2011/10/09} +\def\ExplFileVersion{2900} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -912,37 +912,41 @@ \RequirePackage{calc} % \end{macrocode} % -% The coffins system requires basic colour support along with graphics -% scaling and so on. When used as a package, it makes sense to load the -% \LaTeXe{} drivers. This is done on a \enquote{minimal} basis, to avoid -% for example option clashes. -% \begin{macrocode} -\RequirePackage{color,graphics} -% \end{macrocode} -% % Do the package identification: this will turn on code syntax. % \begin{macrocode} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % \end{macrocode} % -% \begin{macro}{\@l@expl@check@declarations@bool} -% \begin{macro}{\@l@expl@log@functions@bool} +% \begin{variable} +% { +% \l@expl@check@declarations@bool, +% \l@expl@log@functions@bool, +% \l@expl@native@drivers@bool +% } % A couple of package options to be provided. % These have to be done by hand as there is no \pkg{expl3} yet: the logging -% option -% is needed before loading \pkg{l3basics}! +% option is needed before loading \pkg{l3basics}! % \begin{macrocode} -\newcommand* \@l@expl@check@declarations@bool { 0 } -\newcommand*\@l@expl@log@functions@bool { 0 } +\newcommand* \l@expl@check@declarations@bool { 0 } +\newcommand* \l@expl@log@functions@bool { 0 } +\newcommand* \l@expl@native@drivers@bool { 0 } \DeclareOption { check-declarations } - { \def \@l@expl@check@declarations@bool { 1 } } + { \def \l@expl@check@declarations@bool { 1 } } \DeclareOption { log-functions } - {\def \@l@expl@log@functions@bool { 1 } } + { \def \l@expl@log@functions@bool { 1 } } +\DeclareOption { native-drivers } + { \def \l@expl@native@drivers@bool { 1 } } \ProcessOptions \relax % \end{macrocode} -% \end{macro} -% \end{macro} +% \end{variable} +% +% \begin{macrocode} +\ifodd \l@expl@native@drivers@bool \relax +\else + \RequirePackage { color , graphics } +\fi +% \end{macrocode} % % We already loaded \pkg{l3names} at the beginning of the \texttt{dtx} file. % We now load the base of \LaTeX3, stopping once token list variables are @@ -958,7 +962,7 @@ % inherit % the appropriate definitions. % \begin{macrocode} -\ifodd \@l@expl@check@declarations@bool \relax +\ifodd \l@expl@check@declarations@bool \relax \cs_new_protected:Npn \tl_check_exists:N #1 { \cs_if_exist:NF #1 @@ -1029,21 +1033,91 @@ % The error message for variables cannot be created before now: this means that % \pkg{expl3} itself may cause some odd errors. % \begin{macrocode} -\bool_if:nT { \@l@expl@check@declarations@bool } +\bool_if:nT { \l@expl@check@declarations@bool } { \msg_kernel_new:nnnn { check } { non-declared-variable } { The~variable~#1~has~not~been~declared~\msg_line_context:. } { Checking~is~active,~and~you~have~tried~do~so~something~like: \\ - \ \ \tl_set:Nn #1 ~ - \iow_char:N \{ ~ ... ~ \iow_char:N \} \\ + \ \ \tl_set:Nn ~ #1 ~ \iow_char:N \{ ~ ... ~ \iow_char:N \} \\ without~first~having: \\ - \ \ \tl_new:N #1 \\ + \ \ \tl_new:N ~ #1 \\ \\ LaTeX~will~create~the~variable~and~continue. } } % \end{macrocode} +% +% \begin{macro}{\color} +% If the native drivers are being used, they can be loaded now. The +% \cs{color} macro must be defined for showing coffin poles, so +% a no-op version is provided here. +% \begin{macrocode} +\bool_if:nTF { \l@expl@native@drivers@bool } + { + \xetex_if_engine:TF + { \file_input:n { l3xdvipdfmx.def } } + { + \RequirePackage { ifpdf } + \ifpdf + \file_input:n { l3pdfmode.def } + \else + \file_input:n { l3dvips.def } + \fi + } + \AtBeginDocument + { + \cs_if_free:NT \color + { \DeclareRobustCommand \color [2] [ ] { } } + } + } +% \end{macrocode} +% \end{macro} +% \begin{macro} +% { +% \box_rotate:Nn, +% \box_resize:Nnn, +% \box_resize_to_ht_plus_dp:Nn, +% \box_resize_to_wd:Nn, +% \box_scale:Nnn +% } +% If not, alter various definitions to use the \pkg{graphicx} package +% instead. +% \begin{macrocode} + { + \cs_set_protected_nopar:Npn \box_rotate:Nn #1#2 + { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } + \cs_set_protected_nopar:Npn \box_resize:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \resizebox * + { \etex_dimexpr:D #2 \scan_stop: } + { \etex_dimexpr:D #3 \scan_stop: } + { \box_use:N #1 } + } + } + \cs_set_protected_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \resizebox * { ! } { \etex_dimexpr:D #2 \scan_stop: } + { \box_use:N #1 } + } + } + \cs_set_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \resizebox * { \etex_dimexpr:D #2 \scan_stop: } { ! } + { \box_use:N #1 } + } + } + \cs_set_protected_nopar:Npn \box_scale:Nnn #1#2#3 + { \hbox_set:Nn #1 { \scalebox {#2} [#3] { \box_use:N #1 } } } + } +% \end{macrocode} +% \end{macro} % % \begin{macro}{\ExplSyntaxOff, \ExplSyntaxOn} % These are redefined here to reduce unnecessary work when switching. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index 76e9b809b98..f76fdcd07df 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3alloc.dtx 2776 2011-09-07 18:33:19Z joseph $ +\GetIdInfo$Id: l3alloc.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental register allocation} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 95440947255..51bbd55bfab 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2817 2011-09-12 14:16:56Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental basic definitions} %</driver|package> %<*driver> @@ -617,7 +617,7 @@ % There are occasions where control sequences need to be deleted. % This is handled in a very simple manner. % -% \begin{function}{\cs_undefine:N, \cs_undefine:c} +% \begin{function}[updated = 2011-09-15]{\cs_undefine:N, \cs_undefine:c} % \begin{syntax} % \cs{cs_undefine:N} \meta{control sequence} % \end{syntax} @@ -2282,7 +2282,7 @@ } } %<*package> -\tex_ifodd:D \@l@expl@log@functions@bool +\tex_ifodd:D \l@expl@log@functions@bool \cs_set_protected_nopar:Npn \chk_if_free_cs:N #1 { \cs_if_free:NF #1 @@ -2524,11 +2524,21 @@ % \begin{macro}{\cs_undefine:N, \cs_undefine:c} % The following function is used to free the main memory from the % definition of some function that isn't in use any longer. +% The \texttt{c} variant is careful not to add the control sequence +% to the hash table if it isn't there yet, and it also avoids nesting +% \TeX{} conditionals in case |#1| is unbalanced in this matter. % \begin{macrocode} \cs_new_protected_nopar:Npn \cs_undefine:N #1 { \cs_gset_eq:NN #1 \c_undefined:D } \cs_new_protected_nopar:Npn \cs_undefine:c #1 - { \cs_gset_eq:cN {#1} \c_undefined:D } + { + \if_cs_exist:w #1 \cs_end: + \exp_after:wN \use:n + \else: + \exp_after:wN \use_none:n + \fi: + { \cs_gset_eq:cN {#1} \c_undefined:D } + } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 539d04ed4b9..6dc66cd9c85 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2799 2011-09-10 15:46:33Z will $ +\GetIdInfo$Id: l3box.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -389,6 +389,20 @@ % \end{function} % % \section{The last box inserted} +% +% \begin{function} +% { +% \box_set_to_last:N, \box_set_to_last:c, +% \box_gset_to_last:N, \box_gset_to_last:c +% } +% \begin{syntax} +% \cs{box_set_to_last:N} \meta{box} +% \end{syntax} +% Sets the \meta{box} equal to the last item (box) added to the current +% partial list, removing the item from the list at the same time. When +% applied to the main vertical list, the \meta{box} will always be void as +% it is not possible to recover the last added item. +% \end{function} % % \begin{variable}{\l_last_box} % This is a box containing the last item added to the current partial @@ -1116,7 +1130,7 @@ \cs_new_protected_nopar:Npn \hbox_gset_to_wd:Nnn { \tex_global:D \hbox_set_to_wd:Nnn } \cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c } -\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn {cnn} +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn { c } % \end{macrocode} % \end{macro} % \end{macro} @@ -1515,14 +1529,6 @@ \box_use:N \l_box_tmp_box } % \end{macrocode} -% When loaded on top of \LaTeXe{} the \tn{rotatebox} function can be -% used. There is just a slight adjustment in the syntax. -% \begin{macrocode} -%<*package> -\cs_set_protected_nopar:Npn \box_rotate:Nn #1#2 - { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } -%</package> -% \end{macrocode} % \end{macro} % \end{macro} % A simple conversion from degrees to radians followed by calculation @@ -1709,22 +1715,6 @@ \box_resize_common:N #1 } % \end{macrocode} -% When loaded on top of \LaTeXe{} the \tn{resizebox} function can be -% used. There is just a slight adjustment in the syntax. -% \begin{macrocode} -%<*package> -\cs_set_protected_nopar:Npn \box_resize:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \resizebox * - { \etex_dimexpr:D #2 \scan_stop: } - { \etex_dimexpr:D #3 \scan_stop: } - { \box_use:N #1 } - } - } -%</package> -% \end{macrocode} % \end{macro} % \end{macro} % @@ -1778,25 +1768,6 @@ } \cs_generate_variant:Nn \box_resize_to_wd:Nn { c } % \end{macrocode} -% Again, in package mode the scaling can be handled by \tn{resizebox}. -% \begin{macrocode} -%<*package> -\cs_set_protected_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2 - { - \hbox_set:Nn #1 - { - \resizebox * { ! } { \etex_dimexpr:D #2 \scan_stop: } { \box_use:N #1 } - } - } -\cs_set_protected_nopar:Npn \box_resize_to_wd:Nn #1#2 - { - \hbox_set:Nn #1 - { - \resizebox * { \etex_dimexpr:D #2 \scan_stop: } { ! } { \box_use:N #1 } - } - } -%</package> -% \end{macrocode} % \end{macro} % \end{macro} % @@ -1849,14 +1820,6 @@ \box_resize_common:N #1 } % \end{macrocode} -% When loaded on top of \LaTeXe{} the \tn{scalebox} function can be -% used. There is just a slight adjustment in the syntax. -% \begin{macrocode} -%<*package> -\cs_set_protected_nopar:Npn \box_scale:Nnn #1#2#3 - { \hbox_set:Nn #1 { \scalebox {#2} [#3] { \box_use:N #1 } } } -%</package> -% \end{macrocode} % \end{macro} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 53823cde267..340c0af3f11 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2798 2011-09-10 15:42:13Z will $ +\GetIdInfo$Id: l3clist.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental comma separated lists} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 551abe0a6a3..c3f26a6d337 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2819 2011-09-12 17:26:47Z will $ +\GetIdInfo$Id: l3doc.dtx 2866 2011-10-01 05:16:55Z bruno $ {L3 Experimental documentation class} %</driver|class> % @@ -1146,7 +1146,9 @@ Do not distribute a modified version of this file. \tl_gset:Nx \g_doc_macro_tl { \l_doc_function_name_prefix_tl \l_doc_function_name_tl } \g_doc_macro_tl - \tl_if_empty:NF \l_doc_function_sig_tl { : \l_doc_function_sig_tl } + \int_compare:nT { \cs_get_arg_count_from_signature:N #1 >= 0 } + { : \l_doc_function_sig_tl } + \bool_if:NT \l_doc_meta_TF_bool { \doc_typeset_TF: } & @@ -1318,14 +1320,25 @@ Do not distribute a modified version of this file. \cs_set_eq:NN \testfile \doc_print_testfile:n - \group_begin: - \MakePrivateLetters - \char_set_catcode_letter:N \\ - \char_set_catcode_ignore:N \ % space - \char_set_catcode_ignore:N \^^M - \char_set_catcode_ignore:N \^^I - \doc_macro_aux:n + \peek_meaning_ignore_spaces:NTF \c_group_begin_token + { + \group_begin: + \MakePrivateLetters + \char_set_catcode_letter:N \\ + \char_set_catcode_ignore:N \ % space + \char_set_catcode_ignore:N \^^M + \char_set_catcode_ignore:N \^^I + \doc_macro_aux:n + } + { + \doc_macro_verbatim:w + } } +\NewDocumentCommand {\doc_macro_verbatim:w} {v} + { + \group_begin: % pretty useless + \doc_macro_aux:n {#1} + } \keys_define:nn { l3doc/macro } { unknown .code:n = { \use:c{doc_macro_opt_#1:} } @@ -1335,18 +1348,18 @@ Do not distribute a modified version of this file. % \begin{macrocode} \cs_new_nopar:Npn \doc_macro_aux:n #1 { \group_end: - \cs_set:Npn \l_doc_macro_input_clist {#1} + \clist_set:Nn \l_doc_macro_input_clist {#1} \bool_if:NTF \l_doc_macro_pTF_bool { - \clist_map_inline:nn {#1} + \clist_map_inline:Nn \l_doc_macro_input_clist { \exp_args:Nf \doc_macro_single { \doc_predicate_from_base:w ##1 } } \bool_set_true:N \l_doc_macro_TF_bool - \clist_map_function:nN {#1} \doc_macro_single + \clist_map_function:NN \l_doc_macro_input_clist \doc_macro_single \bool_set_false:N \l_doc_macro_TF_bool } - { \clist_map_function:nN {#1} \doc_macro_single } + { \clist_map_function:NN \l_doc_macro_input_clist \doc_macro_single } } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 5cf76d9b972..47b21713513 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -34,11 +34,11 @@ %% ----------------------------------------------------------------------- %% % -%<*driver> +%<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3drivers.dtx 2776 2011-09-07 18:33:19Z joseph $ +\GetIdInfo$Id: l3drivers.dtx 2862 2011-09-27 21:14:27Z joseph $ {L3 Experimental drivers} -%</driver> +%</driver|package> %<*driver> \documentclass[full]{l3doc} \begin{document} @@ -141,7 +141,26 @@ % \section{\pkg{l3drivers} Implementation} % % \begin{macrocode} -%<*initex> +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<*package> +\ProvidesExplFile +%<*dvips> + {l3pdfmode.def}{\ExplFileDate}{\ExplFileVersion} + {L3~Experimental~driver:~dvips} +%</dvips> +%<*pdfmode> + {l3pdfmode.def}{\ExplFileDate}{\ExplFileVersion} + {L3~Experimental~driver:~PDF~mode} +%</pdfmode> +%<*xdvipdfmx> + {l3pdfmode.def}{\ExplFileDate}{\ExplFileVersion} + {L3~Experimental~driver:~xdvipdfmx} +%</xdvipdfmx> +\package_check_loaded_expl: +%</package> % \end{macrocode} % % \subsection{Settings for direct PDF output} @@ -150,9 +169,11 @@ % (This may of course alter: it might be that the driver is picked based on the % value of \cs{pdfmode_pdfoutput:D}.) % \begin{macrocode} +%<*initex> %<*pdfmode> \pdftex_pdfoutput:D = 1 \scan_stop: %</pdfmode> +%</initex> % \end{macrocode} % % Set up the driver for direct PDF output to set the PDF origin equal to @@ -160,6 +181,7 @@ % is standard in \TeX{} Live 2011 and should be a reasonable baseline for % the future. % \begin{macrocode} +%<*initex> %<*pdfmode> \pdftex_pdfhorigin:D = 1 true in \scan_stop: \pdftex_pdfvorigin:D = 1 true in \scan_stop: @@ -169,6 +191,7 @@ \pdftex_pdfcompresslevel:D = 9 \scan_stop: \pdftex_pdfobjcompresslevel:D = 2 \scan_stop: %</pdfmode> +%</initex> % \end{macrocode} % % \subsection{Box rotation and scaling} @@ -371,7 +394,7 @@ % \end{macro} % % \begin{macrocode} -%</initex> +%</initex|package> % \end{macrocode} % % \end{implementation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index ee3d43b91b9..7aada65f41b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3expan.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental argument expansion} %</driver|package> %<*driver> @@ -115,7 +115,7 @@ % % \section{Methods for defining variants} % -% \begin{function}{\cs_generate_variant:Nn} +% \begin{function}[updated = 2011-09-15]{\cs_generate_variant:Nn} % \begin{syntax} % \cs{cs_generate_variant:Nn} \meta{parent control sequence} \Arg{variant argument specifiers} % \end{syntax} @@ -1188,8 +1188,8 @@ % shuffle is used to ensure that |#2| can be multiple tokens. % \begin{macrocode} \cs_new:Npn \exp_last_two_unbraced:Noo #1#2#3 - { \exp_after:wN \exp_last_two_unbraced_aux:nnN \exp_after:wN {#3} {#2} #1 } -\cs_new:Npn \exp_last_two_unbraced_aux:nnN #1#2#3 + { \exp_after:wN \exp_last_two_unbraced_aux:noN \exp_after:wN {#3} {#2} #1 } +\cs_new:Npn \exp_last_two_unbraced_aux:noN #1#2#3 { \exp_after:wN #3 #2 #1 } % \end{macrocode} % \end{macro} @@ -1233,11 +1233,14 @@ % \begin{macro}[aux]{\cs_generate_variant_aux:nnNNn} % \begin{macro}[aux]{\cs_generate_variant_aux:Nnnw} % \begin{macro}[aux]{\cs_generate_variant_aux:NNn} -% \begin{macro}[aux]{\cs_generate_variant_aux:N} % \begin{arguments} % \item Base form of a function; \emph{e.g.},~|\tl_set:Nn| % \item One or more variant argument specifiers; e.g., |{Nx,c,cx}| % \end{arguments} +% Test whether the base function is protected or not +% and define \cs{cs_tmp:w} as either \cs{cs_new_nopar:Npx} or +% \cs{cs_new_protected_nopar:Npx}, then used to define all the +% variants. % Split up the original base function to grab its name and signature % consisting of $k$ letters. Then we wish to iterate through the list % of variant argument specifiers, and for each one construct a new @@ -1249,6 +1252,7 @@ \cs_new_protected:Npn \cs_generate_variant:Nn #1 { \chk_if_exist_cs:N #1 + \cs_generate_variant_aux:N #1 \cs_split_function:NN #1 \cs_generate_variant_aux:nnNNn #1 } @@ -1266,9 +1270,9 @@ % In our example, we wanted to discard the first two letters of the % base signature because the variant form started with |cc|. This is % the same as putting first |cc| in the signature and then -% |\use_none:nn| followed by the base signature |NNn|. We therefore -% call a small loop that outputs an |n| for each letter in the variant -% signature and use this to call the correct |\use_none:| variant. +% |\use_none:nn| followed by the base signature |NNn|. Depending on +% the number of characters in |#4|, the relevant \cs{use_none:n\ldots{}n} +% is called. % % Firstly though, we check whether to terminate the loop. % Then build the variant function once, to avoid repeating this @@ -1281,7 +1285,23 @@ \fi: \exp_args:NNc \cs_generate_variant_aux:NNn #1 - { #2 : #4 \use:c { use_none: \cs_generate_variant_aux:N #4 ? } #3 } + { + #2 : #4 + \exp_after:wN \use_i_delimit_by_q_stop:nw + \use_none:nnnnnnnnn #4 + \use_none:nnnnnnnnn + \use_none:nnnnnnnn + \use_none:nnnnnnn + \use_none:nnnnnn + \use_none:nnnnn + \use_none:nnnn + \use_none:nnn + \use_none:nn + \use_none:n + { } + \q_stop + #3 + } {#4} \cs_generate_variant_aux:Nnnw #1 {#2} {#3} } @@ -1295,8 +1315,7 @@ { \cs_if_free:NTF #2 { - \cs_generate_variant_aux:NNpx #1 #2 - { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } + \cs_tmp:w #2 { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } \cs_generate_internal_variant:n {#3} } { @@ -1309,25 +1328,12 @@ } } % \end{macrocode} -% The small loop for defining the required number of |n|s. Break when -% seeing a |?|. -% \begin{macrocode} -\cs_new:Npn \cs_generate_variant_aux:N #1 - { - \if:w ? #1 - \exp_after:wN \use_none:nn - \fi: - n - \cs_generate_variant_aux:N - } -% \end{macrocode} -% \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% -% \begin{macro}[aux]{\cs_generate_variant_aux:NNpx} +% +% \begin{macro}[aux]{\cs_generate_variant_aux:N} % \begin{macro}[aux]{\cs_generate_variant_aux:w} % The idea here is to pick up protected parent functions, using the % nature of the meaning string that they generate. The test here is @@ -1348,18 +1354,19 @@ \tex_lowercase:D { \group_end: - \cs_new_nopar:Npn \cs_generate_variant_aux:NNpx #1 + \cs_new_nopar:Npn \cs_generate_variant_aux:N #1 { \exp_after:wN \cs_generate_variant_aux:w - \token_to_meaning:N #1 ? PROTECTEZ \q_stop + \token_to_meaning:N #1 + \q_mark \cs_new_protected_nopar:Npx + ? PROTECTEZ + \q_mark \cs_new_nopar:Npx + \q_stop } - \cs_new:Npn \cs_generate_variant_aux:w #1 ? PROTECTEZ #2 \q_stop + \cs_new:Npn \cs_generate_variant_aux:w + #1 ? PROTECTEZ #2 \q_mark #3 #4 \q_stop { - \if_catcode:w a \etex_detokenize:D \exp_after:wN {#1} a - \exp_after:wN \cs_new_protected_nopar:Npx - \else: - \exp_after:wN \cs_new_nopar:Npx - \fi: + \cs_set_eq:NN \cs_tmp:w #3 } } % \end{macrocode} @@ -1378,7 +1385,7 @@ { \cs_new:cpx { exp_args:N #1 } { \cs_generate_internal_variant_aux:N #1 : } - } + } } % \end{macrocode} % This command grabs char by char outputting |\::#1| (not expanded @@ -1389,7 +1396,7 @@ \cs_new:Npn \cs_generate_internal_variant_aux:N #1 { \exp_not:c { :: #1 } - \if_meaning:w #1 : + \if_meaning:w : #1 \exp_after:wN \use_none:n \fi: \cs_generate_internal_variant_aux:N diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 2c043f66ec0..79c83e830de 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 2776 2011-09-07 18:33:19Z joseph $ +\GetIdInfo$Id: l3file.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental file operations} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index 60cf7b81b84..48747513a4b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3final.dtx 2772 2011-09-07 15:07:41Z joseph $ +\GetIdInfo$Id: l3final.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental format finalisation} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 01c9c23adcb..85d3a91c533 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3fp.dtx 2857 2011-09-26 19:46:31Z joseph $ {L3 Experimental floating-point operations} %</driver|package> %<*driver> @@ -3299,19 +3299,21 @@ % \end{macro} % % \begin{macro}{\fp_trig_octant:} -% \begin{macro}[aux]{\fp_trig_octant_aux:} +% \begin{macro}[aux] +% {\fp_trig_octant_aux_i:, \fp_trig_octant_aux_ii:} % Here, the input is further reduced into the range -% $ 0 \le x < \pi / 4 $. This is pretty simple: check if +% $ 0 < x \le \pi / 4 $. This is pretty simple: check if % $ \pi / 4 $ can be taken off and if it can do it and loop. The % check at the end is to \enquote{mop up} values which are so close to % $ \pi / 4 $ that they should be treated as such. The test for % an even octant is needed as the `remainder' needed is from -% the nearest $ \pi / 2 $. +% the nearest $ \pi / 2 $. The check for octant $4$ is needed as an exact +% $\pi$ input will otherwise end up in the wrong place! % \begin{macrocode} \cs_new_protected_nopar:Npn \fp_trig_octant: { \l_fp_trig_octant_int \c_one - \fp_trig_octant_aux: + \fp_trig_octant_aux_i: \if_int_compare:w \l_fp_input_a_decimal_int < \c_ten \l_fp_input_a_decimal_int \c_zero \l_fp_input_a_extended_int \c_zero @@ -3326,7 +3328,17 @@ \l_fp_input_a_extended_int \fi: } -\cs_new_protected_nopar:Npn \fp_trig_octant_aux: +\cs_new_protected_nopar:Npn \fp_trig_octant_aux_i: + { + \if_int_compare:w \l_fp_trig_octant_int > \c_four + \l_fp_trig_octant_int \c_four + \l_fp_input_a_decimal_int \c_fp_pi_by_four_decimal_int + \l_fp_input_a_extended_int \c_fp_pi_by_four_extended_int + \else: + \exp_after:wN \fp_trig_octant_aux_ii: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_octant_aux_ii: { \if_int_compare:w \l_fp_input_a_integer_int > \c_zero \fp_sub:NNNNNNNNN @@ -3336,7 +3348,7 @@ \l_fp_input_a_integer_int \l_fp_input_a_decimal_int \l_fp_input_a_extended_int \tex_advance:D \l_fp_trig_octant_int \c_one - \exp_after:wN \fp_trig_octant_aux: + \exp_after:wN \fp_trig_octant_aux_i: \else: \if_int_compare:w \l_fp_input_a_decimal_int > \c_fp_pi_by_four_decimal_int @@ -3349,7 +3361,7 @@ \l_fp_input_a_extended_int \tex_advance:D \l_fp_trig_octant_int \c_one \exp_after:wN \exp_after:wN \exp_after:wN - \fp_trig_octant_aux: + \fp_trig_octant_aux_i: \fi: \fi: } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 525fb40cfe8..8e1eb820959 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3int.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental integers} %</driver|package> %<*driver> @@ -489,7 +489,7 @@ % stream as digits, with category code $12$ (other). % \end{function} % -% \begin{function}[rEXP]{\int_to_alph:n, \int_to_Alph:n} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_alph:n, \int_to_Alph:n} % \begin{syntax} % \cs{int_to_alph:n} \Arg{integer expression} % \end{syntax} @@ -515,7 +515,7 @@ % functions should not be modified. % \end{function} % -% \begin{function}[rEXP]{\int_to_symbols:nnn} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_symbols:nnn} % \begin{syntax} % \cs{int_to_symbols:nnn} % ~~\Arg{integer expression} \Arg{total symbols} @@ -532,7 +532,7 @@ % \begin{verbatim} % \cs_new:Npn \int_to_alph:n #1 % { -% \int_convert_to_sybols:nnn {#1} { 26 } +% \int_convert_to_symbols:nnn {#1} { 26 } % { % { 1 } { a } % { 2 } { b } @@ -543,7 +543,7 @@ % \end{verbatim} % \end{function} % -% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_binary:n} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_binary:n} % \begin{syntax} % \cs{int_to_binary:n} \Arg{integer expression} % \end{syntax} @@ -551,7 +551,7 @@ % the binary representation of the result in the input stream. % \end{function} % -% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_hexadecimal:n} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_hexadecimal:n} % \begin{syntax} % \cs{int_to_binary:n} \Arg{integer expression} % \end{syntax} @@ -560,7 +560,7 @@ % input stream. Upper case letters are used for digits beyond $9$. % \end{function} % -% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_octal:n} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_octal:n} % \begin{syntax} % \cs{int_to_octal:n} \Arg{integer expression} % \end{syntax} @@ -569,7 +569,7 @@ % stream. % \end{function} % -% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_base:nn} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_base:nn} % \begin{syntax} % \cs{int_to_base:nn} \Arg{integer expression} \Arg{base} % \end{syntax} @@ -742,7 +742,7 @@ % to sanitise sign tokens from the \meta{value} (which may be symbolic). % \end{function} % -% \begin{function}[EXP]{\int_to_letter:n} +% \begin{function}[updated = 2011-09-17, EXP]{\int_to_letter:n} % \begin{syntax} % \cs{int_to_letter:n} \meta{integer value} % \end{syntax} @@ -1472,20 +1472,27 @@ % zero. Using an \texttt{f}-type expansion, this is done so that the system % is recursive. The actual conversion function therefore gets a `nice' % number at each stage. Of course, if the initial input was small enough -% then there is no problem and everything is easy. This is more or less the -% same as \cs{int_convert_number_with_rule:nnN} but \enquote{pre-packaged}. +% then there is no problem and everything is easy. % \begin{macrocode} -\cs_new_nopar:Npn \int_to_symbols:nnn #1#2#3 +\cs_new:Npn \int_to_symbols:nnn #1#2#3 { \int_compare:nNnTF {#1} > {#2} { - \exp_args:Nf \int_to_symbols:nnn - { \int_div_truncate:nn { #1 - 1 } {#2} } {#2} {#3} - \exp_args:Nf \prg_case_int:nnn - { \int_eval:n { 1 + \int_mod:nn { #1 - 1 } {#2} } } - {#3} { } + \exp_args:NNo \exp_args:No \int_to_symbols_aux:nnnn + { + \prg_case_int:nnn + { 1 + \int_mod:nn { #1 - 1 } {#2} } + {#3} { } + } + {#1} {#2} {#3} } - { \exp_args:Nf \prg_case_int:nnn { \int_eval:n {#1} } {#3} { } } + { \prg_case_int:nnn {#1} {#3} { } } + } +\cs_new:Npn \int_to_symbols_aux:nnnn #1#2#3#4 + { + \exp_args:Nf \int_to_symbols:nnn + { \int_div_truncate:nn { #2 - 1 } {#3} } {#3} {#4} + #1 } % \end{macrocode} % \end{macro} @@ -1620,6 +1627,8 @@ % to use the \cs{if_case:w} primitive. The first \cs{exp_after:wN} % expands the conditional, jumping to the correct case, the second one % expands after the resulting character to close the conditional. +% Since |#1| might be an expression, and not directly a single digit, +% we need to evaluate it properly, and expand the trailing \cs{fi:}. % \begin{macrocode} \cs_new:Npn \int_to_letter:n #1 { @@ -1651,7 +1660,7 @@ \or: X \or: Y \or: Z - \else: #1 + \else: \int_value:w \int_eval:w #1 \exp_after:wN \int_eval_end: \fi: } % \end{macrocode} @@ -1886,7 +1895,7 @@ % \end{macrocode} % \end{macro} % -% \begin{variable}[aux] +% \begin{variable} % { % \c_int_from_roman_i_int, \c_int_from_roman_v_int, % \c_int_from_roman_x_int, \c_int_from_roman_l_int, diff --git a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx index e406ab611a0..b31b0a3f8c3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 2799 2011-09-10 15:46:33Z will $ +\GetIdInfo$Id: l3io.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental input-output operations} %</driver|package> %<*driver> @@ -86,9 +86,21 @@ % and is independent of the name of the file (except of course that % the file name is needed when the file is opened). % -% \section{Opening and closing streams} +% \section{Managing streams} +% +% \begin{function}[added = 2011-09-26] +% {\ior_new:N, \ior_new:c, \iow_new:N, \io_new:c} +% \begin{syntax} +% \cs{ior_new:Nn} \meta{stream} +% \end{syntax} +% Globally reserves the name of the \meta{stream}, either for reading +% or for writing as appropriate. The \meta{stream} is not opened until the +% appropriate \cs{\ldots_open:Nn} function is used. Attempting to use +% a \meta{stream} which has not been opened will result in a \TeX{} +% error. +% \end{function} % -% \begin{function}{\ior_open:Nn, \ior_open:cn} +% \begin{function}[updated = 2011-09-26]{\ior_open:Nn, \ior_open:cn} % \begin{syntax} % \cs{ior_open:Nn} \meta{stream} \Arg{file name} % \end{syntax} @@ -100,7 +112,7 @@ % is given or the file ends. % \end{function} % -% \begin{function}{\iow_open:Nn, \iow_open:cn} +% \begin{function}[updated = 2011-09-26]{\iow_open:Nn, \iow_open:cn} % \begin{syntax} % \cs{iow_open:Nn} \meta{stream} \Arg{file name} % \end{syntax} @@ -114,26 +126,22 @@ % additive). % \end{function} % -% \begin{function}{\ior_close:N, \ior_close:c} +% \begin{function}[updated = 2011-09-26]{\ior_close:N, \ior_close:c} % \begin{syntax} % \cs{ior_close:N} \meta{stream} % \end{syntax} % Closes the \meta{stream}. Streams should always be closed when % they are finished with as this ensures that they remain available -% to other programmer. The name of the \meta{stream} will be freed at -% this stage, to ensure that any further attempts to read from it results -% in an error. +% to other programmer. % \end{function} % -% \begin{function}{\iow_close:N, \iow_close:c} +% \begin{function}[updated = 2011-09-26]{\iow_close:N, \iow_close:c} % \begin{syntax} % \cs{iow_close:N} \meta{stream} % \end{syntax} % Closes the \meta{stream}. Streams should always be closed when % they are finished with as this ensures that they remain available -% to other programmer. The name of the \meta{stream} will be freed at -% this stage, to ensure that any further attempts to write to it results -% in an error. +% to other programmer. % \end{function} % % \begin{function}{\ior_list_streams:, \iow_list_streams:} @@ -237,7 +245,7 @@ % % \section{Wrapping lines in output} % -% \begin{function}[updated = 2011-06-03]{\iow_wrap:xnnnN} +% \begin{function}[updated = 2011-09-21]{\iow_wrap:xnnnN} % \begin{syntax} % \cs{iow_wrap:xnnnN} \Arg{text} \Arg{run-on text} \Arg{run-on length} \Arg{set up} \meta{function} % \end{syntax} @@ -251,9 +259,17 @@ % before the wrapping takes place. The result of the wrapping operation % is passed as a braced argument to the \meta{function}, which will % typically be a wrapper around a writing operation. Within the -% \meta{text}, |\\| may be used to force a new line and \verb|\ | may be -% used to represent a forced space (for example after a control -% sequence). Both the wrapping process and the subsequent write operation +% \meta{text}, +% \begin{itemize} +% \item |\\| may be used to force a new line, +% \item \verb|\ | may be used to represent a forced space +% (for example after a control sequence), +% \item |\#|, |\%|, |\{|, |\}|, |\~| may be used to represent +% the corresponding character, +% \item \cs{iow_indent:n} may be used to indent a part of the +% message. +% \end{itemize} +% Both the wrapping process and the subsequent write operation % will perform \texttt{x}-type expansion. For this reason, material which % is to be written \enquote{as is} should be given as the argument to % \cs{token_to_str:N} or \cs{tl_to_str:n} (as appropriate) within @@ -263,6 +279,18 @@ % output will \emph{not} expand further when written to a file. % \end{function} % +% \begin{function}[added = 2011-09-21]{\iow_indent:n} +% \begin{syntax} +% \cs{iow_indent:n} \Arg{text} +% \end{syntax} +% In the context of \cs{iow_wrap:xnnnN} (for instance in messages), +% indents \meta{text} by four spaces. This function will not cause +% a line break, and only affects lines which start within the scope +% of the \meta{text}. In case the indented \meta{text} should appear +% on separate lines from the surrounding text, use |\\| to force +% line breaks. +% \end{function} +% % \begin{variable}{\l_iow_line_length_int} % The maximum length of a line to be written by the \cs{iow_wrap:xxnnN} % function. This value depends on the \TeX{} system in use: the standard @@ -345,7 +373,7 @@ % \end{texnote} % \end{function} % -%\begin{function}[EXP,pTF]{\ior_if_eof:N} +%\begin{function}[updated = 2011-09-26, EXP,pTF]{\ior_if_eof:N} % \begin{syntax} % \cs{ior_if_eof_p:N} \meta{stream} \\ % \cs{ior_if_eof:NTF} \meta{stream} \Arg{true code} \Arg{false code} @@ -512,6 +540,21 @@ % \end{macrocode} % \end{macro} % \end{macro} +% +% \begin{macro}{\ior_new:N, \ior_new:c, \iow_new:N, \iow_new:c} +% Reserving a new stream is done by defining the stream as the $16$ (which +% must be in error). +% \begin{macrocode} +\cs_new_protected_nopar:Npn \ior_new:N #1 + { + \chk_if_free_cs:N #1 + \tex_global:D \tex_chardef:D #1 16 ~ + } +\cs_new_eq:NN \iow_new:N \ior_new:N +\cs_generate_variant:Nn \ior_new:N { c } +\cs_generate_variant:Nn \iow_new:N { c } +% \end{macrocode} +% \end{macro} % % \begin{macro}{\ior_open:Nn, \ior_open:cn} % \begin{macro}{\iow_open:Nn, \iow_open:cn} @@ -690,9 +733,10 @@ { \int_compare:nNnF #1 = \c_minus_one { - \tex_closein:D #1 + \int_compare:nNnF #1 = \c_sixteen + { \tex_closein:D #1 } \prop_gdel:NV \g_ior_streams_prop #1 - \cs_undefine:N #1 + \tex_global:D \tex_chardef:D #1 16 ~ } } } @@ -702,9 +746,10 @@ { \int_compare:nNnF #1 = \c_minus_one { - \tex_immediate:D \tex_closeout:D #1 + \int_compare:nNnF #1 = \c_sixteen + { \tex_closein:D #1 } \prop_gdel:NV \g_iow_streams_prop #1 - \cs_undefine:N #1 + \tex_global:D \tex_chardef:D #1 16 ~ } } } @@ -842,6 +887,23 @@ % \end{macrocode} % \end{macro} % +% \subsection{Special characters for writing} +% +% \begin{macro}{\iow_newline:} +% Global variable holding the character that forces a new line when +% something is written to an output stream +% \begin{macrocode} +\cs_new_nopar:Npn \iow_newline: { ^^J } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\iow_char:N} +% Function to write any escaped char to an output stream. +% \begin{macrocode} +\cs_new_eq:NN \iow_char:N \cs_to_str:N +% \end{macrocode} +% \end{macro} +% % \subsection{Hard-wrapping lines based on length} % % The code here implements a generic hard-wrapping function. This is @@ -849,7 +911,7 @@ % available for other uses. % % \begin{macro}{\l_iow_line_length_int} -% The is the \enquote{raw} length of a line which can be written to +% The is the \enquote{raw} length of a line which can be written to a % file. The standard value is the line length typically used by % \TeX{}Live and Mik\TeX{}. % \begin{macrocode} @@ -866,20 +928,29 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\l_iow_current_line_int, \l_iow_current_word_int} +% \begin{macro}[aux]{ +% \l_iow_current_line_int, +% \l_iow_current_word_int, +% \l_iow_current_indentation_int} % These store the number of characters in the line and word currently -% being constructed, respectively. +% being constructed, and the current indentation, respectively. % \begin{macrocode} \int_new:N \l_iow_current_line_int \int_new:N \l_iow_current_word_int +\int_new:N \l_iow_current_indentation_int % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\l_iow_current_line_tl, \l_iow_current_word_tl} -% These hold the current line of text and current word, respectively. +% \begin{macro}[aux]{ +% \l_iow_current_line_tl, +% \l_iow_current_word_tl, +% \l_iow_current_indentation_tl} +% These hold the current line of text and current word, +% and a number of spaces for indentation, respectively. % \begin{macrocode} \tl_new:N \l_iow_current_line_tl \tl_new:N \l_iow_current_word_tl +\tl_new:N \l_iow_current_indentation_tl % \end{macrocode} %\end{macro} % @@ -898,21 +969,14 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\q_iow_stop} -% A quark which will not appear elsewhere. -% \begin{macrocode} -\quark_new:N \q_iow_stop -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\l_iow_line_start_bool} -% Boolean to avoid adding a space at the beginning of lines. +% \begin{macro}[aux]{\l_iow_line_start_bool} +% Boolean to avoid adding a space at the beginning of forced newlines. % \begin{macrocode} \bool_new:N \l_iow_line_start_bool % \end{macrocode} % \end{macro} % -% \begin{macro}{\c_catcode_other_space_tl} +% \begin{macro}[aux]{\c_catcode_other_space_tl} % Lowercase a character with category code $12$ to produce an % \enquote{other} space. We can do everything within the group, % because \cs{tl_const:Nn} defines its argument globally. @@ -925,13 +989,68 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[aux]{\c_iow_wrap_marker_tl} +% \begin{macro}[aux]{ +% \c_iow_wrap_end_marker_tl, +% \c_iow_wrap_newline_marker_tl, +% \c_iow_wrap_indent_marker_tl, +% \c_iow_wrap_unindent_marker_tl} +% \begin{macro}[aux]{\iow_wrap_new_marker:n} +% Every special action of the wrapping code is preceeded by +% the same recognizable string, \cs{c_iow_wrap_marker_tl}. +% Upon seeing that \enquote{word}, the wrapping code reads +% one space-delimited argument to know what operation to +% perform. The setting of \tn{escapechar} here is not +% very important, but makes \cs{c_iow_wrap_marker_tl} look +% nicer. Note that \cs{iow_wrap_new_marker:n} does not +% survive the group, but all constants are defined globally. +% \begin{macrocode} +\group_begin: + \int_set_eq:NN \tex_escapechar:D \c_minus_one + \tl_const:Nx \c_iow_wrap_marker_tl + { \tl_to_str:n { \^^I \^^O \^^W \^^_ \^^W \^^R \^^A \^^P } } + \cs_set:Npn \iow_wrap_new_marker:n #1 + { + \tl_const:cx { c_iow_wrap_ #1 _marker_tl } + { + \c_catcode_other_space_tl + \c_iow_wrap_marker_tl + \c_catcode_other_space_tl + #1 + \c_catcode_other_space_tl + } + } + \iow_wrap_new_marker:n { end } + \iow_wrap_new_marker:n { newline } + \iow_wrap_new_marker:n { indent } + \iow_wrap_new_marker:n { unindent } +\group_end: +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\iow_indent:n} +% \begin{macro}[aux]{\iow_indent_expandable:n} +% We give a dummy (protected) definition to \cs{iow_indent:n} +% when outside messages. Within wrapped message, it places +% the instruction for increasing the indentation before its +% argument, and the instruction for unindenting afterwards. +% Note that there will be no forced line-break, so the indentation +% only changes when the next line is started. +% \begin{macrocode} +\cs_new_protected:Npn \iow_indent:n #1 { } +\cs_new:Npx \iow_indent_expandable:n #1 + { + \c_iow_wrap_indent_marker_tl + #1 + \c_iow_wrap_unindent_marker_tl + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\iow_wrap:xnnnN} -% \begin{macro}[aux]{\iow_wrap_loop:w} -% \begin{macro}[aux]{\iow_wrap_word:} -% \begin{macro}[aux]{\iow_wrap_word_fits:} -% \begin{macro}[aux]{\iow_wrap_word_newline:} -% \begin{macro}[aux]{\iow_wrap_newline:} -% \begin{macro}[aux]{\iow_wrap_end:} % The main wrapping function works as follows. The target number of % characters in a line is calculated, before fully-expanding the input % such that |\\| and \verb*|\ | are converted into the appropriate @@ -949,13 +1068,22 @@ { \group_begin: \int_set:Nn \l_iow_target_length_int { \l_iow_line_length_int - ( #3 ) } + \int_zero:N \l_iow_current_indentation_int + \tl_clear:N \l_iow_current_indentation_tl \int_zero:N \l_iow_current_line_int \tl_clear:N \l_iow_current_line_tl \tl_clear:N \l_iow_wrap_tl \bool_set_true:N \l_iow_line_start_bool - \cs_set:Npx \\ - { \c_catcode_other_space_tl \iow_newline: \c_catcode_other_space_tl } + \int_set_eq:NN \tex_escapechar:D \c_minus_one + \cs_set_nopar:Npx \{ { \token_to_str:N \{ } + \cs_set_nopar:Npx \# { \token_to_str:N \# } + \cs_set_nopar:Npx \} { \token_to_str:N \} } + \cs_set_nopar:Npx \% { \token_to_str:N \% } + \cs_set_nopar:Npx \~ { \token_to_str:N \~ } + \int_set:Nn \tex_escapechar:D { 92 } + \cs_set_eq:NN \\ \c_iow_wrap_newline_marker_tl \cs_set_eq:NN \ \c_catcode_other_space_tl + \cs_set_eq:NN \iow_indent:n \iow_indent_expandable:n #4 %<*initex> \tl_set:Nx \l_iow_wrap_tl {#1} @@ -966,53 +1094,61 @@ \cs_set:Npn \\ { \iow_newline: #2 } \use:x { - \exp_not:N \iow_wrap_loop:w - \tl_to_str:N \l_iow_wrap_tl \c_space_tl - \exp_not:N \q_iow_stop \c_space_tl + \iow_wrap_loop:w + \tl_to_str:N \l_iow_wrap_tl + \tl_to_str:N \c_iow_wrap_end_marker_tl + \c_space_tl \c_space_tl + \exp_not:N \q_stop } \exp_args:NNo \group_end: #5 \l_iow_wrapped_tl } % \end{macrocode} -% The loop grabs one word in the input, and checks whether it is -% the end, or a forced new line, or a normal word. +% \end{macro} +% +% \begin{macro}[aux]{\iow_wrap_loop:w} +% The loop grabs one word in the input, and checks whether it is +% the special marker, or a normal word. % \begin{macrocode} \cs_new_protected:Npn \iow_wrap_loop:w #1 ~ % { \tl_set:Nn \l_iow_current_word_tl {#1} - \tl_if_eq:NNTF \l_iow_current_word_tl \iow_newline: - { \iow_wrap_newline: } - { - \tl_if_eq:NNTF \l_iow_current_word_tl \q_iow_stop - { \iow_wrap_end: } - { \iow_wrap_word: } - } + \tl_if_eq:NNTF \l_iow_current_word_tl \c_iow_wrap_marker_tl + { \iow_wrap_special:w } + { \iow_wrap_word: } } % \end{macrocode} -% For a normal word, update the line length, then test if the current -% word would fit in the current line, and call the appropriate function. +% \end{macro} +% +% \begin{macro}[aux]{\iow_wrap_word:} +% \begin{macro}[aux]{\iow_wrap_word_fits:} +% \begin{macro}[aux]{\iow_wrap_word_newline:} +% For a normal word, update the line length, then test if the current +% word would fit in the current line, and call the appropriate function. +% If the word fits in the current line, add it to the line, preceded by +% a space unless it is the first word of the line. +% Otherwise, the current line is added to the result, with the run-on text. +% The current word (and its length) are then put in the new line. % \begin{macrocode} \cs_new_protected_nopar:Npn \iow_wrap_word: { \int_set:Nn \l_iow_current_word_int { \str_length_skip_spaces:N \l_iow_current_word_tl } \int_add:Nn \l_iow_current_line_int { \l_iow_current_word_int } - \int_compare:nNnTF \l_iow_current_line_int - < \l_iow_target_length_int + \int_compare:nNnTF \l_iow_current_line_int < \l_iow_target_length_int { \iow_wrap_word_fits: } { \iow_wrap_word_newline: } \iow_wrap_loop:w } -% \end{macrocode} -% If the word fits in the current line, add it to the line, preceded by -% a space unless it is the first word of the line. -% \begin{macrocode} \cs_new_protected_nopar:Npn \iow_wrap_word_fits: { \bool_if:NTF \l_iow_line_start_bool { \bool_set_false:N \l_iow_line_start_bool - \tl_set_eq:NN \l_iow_current_line_tl \l_iow_current_word_tl + \tl_put_right:Nx \l_iow_current_line_tl + { \l_iow_current_indentation_tl \l_iow_current_word_tl } + \int_add:Nn \l_iow_current_line_int + { \l_iow_current_indentation_int } } { \tl_put_right:Nx \l_iow_current_line_tl @@ -1020,21 +1156,51 @@ \int_incr:N \l_iow_current_line_int } } -% \end{macrocode} -% Otherwise, the current line is added to the result, with the run-on text. -% The current word (and its length) are then put in the new line. -% \begin{macrocode} \cs_new_protected_nopar:Npn \iow_wrap_word_newline: { \tl_put_right:Nx \l_iow_wrapped_tl { \l_iow_current_line_tl \\ } - \int_set_eq:NN \l_iow_current_line_int \l_iow_current_word_int - \tl_set_eq:NN \l_iow_current_line_tl \l_iow_current_word_tl + \int_set:Nn \l_iow_current_line_int + { + \l_iow_current_word_int + + \l_iow_current_indentation_int + } + \tl_set:Nx \l_iow_current_line_tl + { \l_iow_current_indentation_tl \l_iow_current_word_tl } } % \end{macrocode} -% Forced newlines are almost identical to those caused by overflow, -% except that here the word is empty. And remember to continue the loop! +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux]{\iow_wrap_special:w} +% \begin{macro}[aux]{\iow_wrap_newline:w} +% \begin{macro}[aux]{\iow_wrap_indent:w} +% \begin{macro}[aux]{\iow_wrap_unindent:w} +% \begin{macro}[aux]{\iow_wrap_end:w} +% When the \enquote{special} marker is encountered, +% read what operation to perform, as a space-delimited +% argument, perform it, and remember to loop. +% In fact, to avoid spurious spaces when two special +% actions follow each other, we look ahead for another +% copy of the marker. +% Forced newlines are almost identical to those caused by overflow, +% except that here the word is empty. +% To indent more, add four spaces to the start of the indentation +% token list. To reduce indentation, rebuild the indentation token +% list using \cs{prg_replicate:nn}. +% At the end, we simply save the last line (without the run-on text), +% and prevent the loop. % \begin{macrocode} +\cs_new_protected_nopar:Npn \iow_wrap_special:w #1 ~ #2 ~ #3 ~ % + { + \cs_if_exist:cTF { iow_wrap_#1: } + { \use:c { iow_wrap_#1: } } + { \msg_expandable_error:n {#1} } + \str_if_eq:xxTF { #2~#3 } { ~ \c_iow_wrap_marker_tl } + { \iow_wrap_special:w } + { \iow_wrap_loop:w #2 ~ #3 ~ } + } \cs_new_protected_nopar:Npn \iow_wrap_newline: { \tl_put_right:Nx \l_iow_wrapped_tl @@ -1042,15 +1208,24 @@ \int_zero:N \l_iow_current_line_int \tl_clear:N \l_iow_current_line_tl \bool_set_true:N \l_iow_line_start_bool - \iow_wrap_loop:w } -% \end{macrocode} -% At the end, we simply save the last line (without the run-on text). -% \begin{macrocode} +\cs_new_protected_nopar:Npx \iow_wrap_indent: + { + \int_add:Nn \l_iow_current_indentation_int \c_four + \tl_put_right:Nx \exp_not:N \l_iow_current_indentation_tl + { \c_space_tl \c_space_tl \c_space_tl \c_space_tl } + } +\cs_new_protected_nopar:Npn \iow_wrap_unindent: + { + \int_sub:Nn \l_iow_current_indentation_int \c_four + \tl_set:Nx \l_iow_current_indentation_tl + { \prg_replicate:nn \l_iow_current_indentation_int { ~ } } + } \cs_new_protected_nopar:Npn \iow_wrap_end: { \tl_put_right:Nx \l_iow_wrapped_tl { \l_iow_current_line_tl } + \use_none_delimit_by_q_stop:w } % \end{macrocode} % \end{macro} @@ -1058,12 +1233,10 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\str_length_skip_spaces:N} -% \begin{macro}{\str_length_skip_spaces:n} -% \begin{macro}{\str_length_loop:NNNNNNNNN} +% \begin{macro}[aux]{\str_length_skip_spaces:N} +% \begin{macro}[aux]{\str_length_skip_spaces:n} +% \begin{macro}[aux]{\str_length_loop:NNNNNNNNN} % The wrapping code requires to measure the number of character % in each word. This could be done with \cs{tl_length:n}, but % it is ten times faster (literally) to use the code below. @@ -1091,23 +1264,6 @@ % \end{macro} % \end{macro} % -% \subsection{Special characters for writing} -% -% \begin{macro}{\iow_newline:} -% Global variable holding the character that forces a new line when -% something is written to an output stream -% \begin{macrocode} -\cs_new_nopar:Npn \iow_newline: { ^^J } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\iow_char:N} -% Function to write any escaped char to an output stream. -% \begin{macrocode} -\cs_new_eq:NN \iow_char:N \cs_to_str:N -% \end{macrocode} -% \end{macro} -% % \subsection{Reading input} % % \begin{macro}[pTF]{\ior_if_eof_p:N} @@ -1119,10 +1275,14 @@ { \cs_if_exist:NTF #1 { - \if_eof:w #1 + \if_int_compare:w #1 = \c_sixteen \prg_return_true: - \else: - \prg_return_false: + \else: + \if_eof:w #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: \fi: } { \prg_return_true: } @@ -1171,21 +1331,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\ior_new:N, \ior_new:c} -% \begin{macro}{\iow_new:N, \iow_new:c} -% As input--output operations are done using a stack, |new| operations seem -% out-of-place. They are therefore set up just to gobble the input. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \ior_new:N \use_none:n -\cs_new_eq:NN \ior_new:c \use_none:n -\cs_new_eq:NN \iow_new:N \use_none:n -\cs_new_eq:NN \iow_new:c \use_none:n -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}{\ior_open_streams:} % \begin{macro}{\iow_open_streams:} % Slightly misleading names. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 4b75c2ce925..0e1eb8e072e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3msg.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental messages} %</driver|package> %<*driver> @@ -102,8 +102,7 @@ % % \begin{function}[updated = 2011-08-16]{\msg_new:nnnn, \msg_new:nnn} % \begin{syntax} -% \cs{msg_new:nnnn} \Arg{module} \Arg{message} \Arg{text} -% ~~\Arg{more text} +% \cs{msg_new:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Creates a \meta{message} for a given \meta{module}. % The message will be defined to first give \meta{text} and then @@ -118,8 +117,7 @@ % % \begin{function}{\msg_set:nnnn, \msg_set:nnn} % \begin{syntax} -% \cs{msg_set:nnnn} \Arg{module} \Arg{message} \Arg{text} -% ~~\Arg{more text} +% \cs{msg_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Sets up the text for a \meta{message} for a given \meta{module}. % The message will be defined to first give \meta{text} and then @@ -811,7 +809,7 @@ % \subsection{Showing messages: low level mechanism} % % \begin{variable}{\c_msg_hide_tl} -% \begin{variable}[aux]{\c_msg_hide_tl<dots>} +% \begin{variable}{\c_msg_hide_tl<dots>} % An empty variable with a number of (category code 11) periods at the % end of its name. This is used to push the \TeX{} part of an error % message \enquote{off the screen}. Using two variables here means that @@ -827,6 +825,13 @@ % \end{variable} % \end{variable} % +% \begin{variable}{\l_msg_text_tl} +% For wrapping message text. +% \begin{macrocode} +\tl_new:N \l_msg_text_tl +% \end{macrocode} +%\end{variable} +% % \begin{macro}{\msg_interrupt:xxx} % \begin{macro}[aux]{\msg_interrupt_no_details:xx} % \begin{macro}[aux]{\msg_interrupt_details:xxx} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 54b31433dca..17dc2376d4b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -35,7 +35,7 @@ % %<*package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3names.dtx 2776 2011-09-07 18:33:19Z joseph $ +\GetIdInfo$Id: l3names.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental namespace for primitives} %</package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index b57e130efd2..9881cc3ef64 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2827 2011-09-15 19:37:32Z joseph $ +\GetIdInfo$Id: l3prg.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -500,7 +500,7 @@ % For cases where a number of cases need to be considered a family of % case-selecting functions are available. % -% \begin{function}[updated = 2011-07-06, EXP]{\prg_case_int:nnn} +% \begin{function}[updated = 2011-09-17, EXP]{\prg_case_int:nnn} % \begin{syntax} % \cs{prg_case_int:nnn} \Arg{test integer expression} \\ % ~~|{| \\ @@ -551,7 +551,7 @@ % left in the input stream. % \end{function} % -% \begin{function}[updated = 2011-08-12, EXP] +% \begin{function}[updated = 2011-09-17, EXP] % {\prg_case_str:nnn, \prg_case_str:onn, \prg_case_str:xxn} % \begin{syntax} % \cs{prg_case_str:nnn} \Arg{test string} \\ @@ -572,7 +572,7 @@ % in the same way as the underlying \cs{str_if_eq:xxTF} test. % \end{function} % -% \begin{function}[updated = 2011-07-06, EXP] +% \begin{function}[updated = 2011-09-17, EXP] % {\prg_case_tl:Nnn, \prg_case_tl:cnn} % \begin{syntax} % \cs{prg_case_tl:Nnn} \meta{test token list variable} \\ @@ -1402,9 +1402,10 @@ % \begin{macro}[aux]{\prg_case_end:nw} % In all cases the end statement is the same. Here, |#1| will be the % code needed, |#2| the other cases to throw away, including the -% \enquote{else} case. +% \enquote{else} case. The \cs{c_zero} marker stops the expansion of +% \tn{romannumeral} which begins each \cs{prg_case_...} function. % \begin{macrocode} -\cs_new_eq:NN \prg_case_end:nw \use_i_delimit_by_q_recursion_stop:nw +\cs_new:Npn \prg_case_end:nw #1 #2 \q_recursion_stop { \c_zero #1 } % \end{macrocode} % \end{macro} % @@ -1415,10 +1416,14 @@ % condition. After that, a loop is started to compare each possible % value and stop if the test is true. The tested value is put at the % end to ensure that there is necessarily a match, which will fire the -% \enquote{else} pathway. +% \enquote{else} pathway. The leading \tn{romannumeral} triggers an +% expansion which is then stopped in \cs{prg_case_end:nw}. % \begin{macrocode} \cs_new:Npn \prg_case_int:nnn #1 - { \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n {#1} } } + { + \tex_romannumeral:D + \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n {#1} } + } \cs_new:Npn \prg_case_int_aux:nnn #1 #2 #3 { \prg_case_int_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } \cs_new:Npn \prg_case_int_aux:nw #1#2#3 @@ -1438,7 +1443,10 @@ % method. % \begin{macrocode} \cs_new:Npn \prg_case_dim:nnn #1 - { \exp_args:Nf \prg_case_dim_aux:nnn { \dim_eval:n {#1} } } + { + \tex_romannumeral:D + \exp_args:Nf \prg_case_dim_aux:nnn { \dim_eval:n {#1} } + } \cs_new:Npn \prg_case_dim_aux:nnn #1 #2 #3 { \prg_case_dim_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } \cs_new:Npn \prg_case_dim_aux:nw #1#2#3 @@ -1457,7 +1465,10 @@ % No calculations for strings, otherwise no surprises. % \begin{macrocode} \cs_new:Npn \prg_case_str:nnn #1#2#3 - { \prg_case_str_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } + { + \tex_romannumeral:D + \prg_case_str_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop + } \cs_new:Npn \prg_case_str_aux:nw #1#2#3 { \str_if_eq:nnTF {#1} {#2} @@ -1466,7 +1477,10 @@ } \cs_generate_variant:Nn \prg_case_str:nnn { o } \cs_new:Npn \prg_case_str:xxn #1#2#3 - { \prg_case_str_x_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } + { + \tex_romannumeral:D + \prg_case_str_x_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop + } \cs_new:Npn \prg_case_str_x_aux:nw #1#2#3 { \str_if_eq:xxTF {#1} {#2} @@ -1483,7 +1497,10 @@ % Similar again, but this time with some variants. % \begin{macrocode} \cs_new:Npn \prg_case_tl:Nnn #1#2#3 - { \prg_case_tl_aux:Nw #1 #2 #1 {#3} \q_recursion_stop } + { + \tex_romannumeral:D + \prg_case_tl_aux:Nw #1 #2 #1 {#3} \q_recursion_stop + } \cs_new:Npn \prg_case_tl_aux:Nw #1#2#3 { \tl_if_eq:NNTF #1 #2 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 9a8624bc7c7..a7e2b28cee8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 2820 2011-09-12 18:56:29Z bruno $ +\GetIdInfo$Id: l3prop.dtx 2839 2011-09-17 20:18:23Z bruno $ {L3 Experimental property lists} %</driver|package> %<*driver> @@ -300,7 +300,7 @@ % Tests if the \meta{property list} is empty (containing no entries). % \end{function} % -% \begin{function}[EXP,pTF] +% \begin{function}[updated = 2011-09-15, EXP, pTF] % { % \prop_if_in:Nn, \prop_if_in:NV, \prop_if_in:No, % \prop_if_in:cn, \prop_if_in:cV, \prop_if_in:co @@ -464,7 +464,7 @@ % property list while keeping track of a given key. % \end{function} % -% \begin{function}[updated = 2011-08-18,EXP]{\prop_get:Nn, \prop_get:cn} +% \begin{function}[updated = 2011-09-15,EXP]{\prop_get:Nn, \prop_get:cn} % \begin{syntax} % \cs{prop_get:Nn} \meta{property list} \Arg{key} % \end{syntax} @@ -875,7 +875,7 @@ % \prop_if_in:Nn, \prop_if_in:NV, \prop_if_in:No, % \prop_if_in:cn, \prop_if_in:cV, \prop_if_in:co % } -% \begin{macro}[aux]{\prop_if_in_aux:w} +% \begin{macro}[aux]{\prop_if_in_aux:nwn,\prop_if_in_aux:Nw} % Testing expandably if a key is in a property list % requires to go through the key--value pairs one by one. % This is rather slow, and a faster test would be @@ -892,9 +892,14 @@ % \end{verbatim} % but \cs{prop_split:NnTF} is non-expandable. % -% Instead, the key is compared to each key in turn using \cs{str_if_eq:nn}, -% which is expandable. The mapping is stopped using |A|, which cannot appear -% within a key of the property list, since keys are strings. +% Instead, the key is compared to each key in turn using \cs{str_if_eq:xx}, +% which is expandable. To terminate the mapping, we add the key that +% is search for at the end of the property list. This second +% \cs{tl_to_str:n} is not expanded at the start, but only when included +% in the \cs{str_if_eq:xx}. It cannot make the breaking mechanism choke, +% because the arbitrary token list material is enclosed in braces. +% When ending, we test the next token: it is either \cs{q_prop} +% or \cs{q_recursion_tail} in the case of a missing key. % Here, \cs{prop_map_function:NN} is not sufficient for the mapping, % since it can only map a single token, and cannot carry the key that % is searched for. @@ -903,20 +908,22 @@ { \exp_last_unbraced:Noo \prop_if_in_aux:nwn { \tl_to_str:n {#2} } #1 - A \q_prop { } \q_stop + \tl_to_str:n {#2} \q_prop { } + \q_recursion_tail \q_recursion_stop } \cs_new:Npn \prop_if_in_aux:nwn #1 \q_prop #2 \q_prop #3 { - \if_meaning:w A #2 - \prg_return_false: - \exp_after:wN \use_none_delimit_by_q_stop:w + \str_if_eq:xxTF {#1} {#2} + { \prop_if_in_aux:Nw } + { \prop_if_in_aux:nwn {#1} } + } +\cs_new:Npn \prop_if_in_aux:Nw #1 #2 \q_recursion_stop + { + \if_meaning:w \q_prop #1 + \prg_return_true: + \else: + \prg_return_false: \fi: - \str_if_eq:nnT {#1} {#2} - { - \prg_return_true: - \use_none_delimit_by_q_stop:w - } - \prop_if_in_aux:nwn {#1} } \cs_generate_variant:Nn \prop_if_in_p:Nn { NV , No } \cs_generate_variant:Nn \prop_if_in_p:Nn { c , cV , co } @@ -973,16 +980,16 @@ % \begin{macro}[aux]{\prop_map_function_aux:Nwn} % The fastest way to do a recursion here is to use an % \cs{if_meaning:w} test: the keys are strings, and thus -% cannot match the marker |A| (which has catcode \enquote{letter}). +% cannot match the marker \cs{q_recursion_tail}. % \begin{macrocode} \cs_new_nopar:Npn \prop_map_function:NN #1#2 { \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 - #1 A \q_prop { } \q_recursion_stop + #1 \q_recursion_tail \q_prop { } \q_recursion_stop } \cs_new:Npn \prop_map_function_aux:Nwn #1 \q_prop #2 \q_prop #3 { - \if_meaning:w A #2 + \if_meaning:w \q_recursion_tail #2 \exp_after:wN \prop_map_break: \fi: #1 {#2} {#3} @@ -1125,18 +1132,18 @@ % \begin{macro}[rEXP]{\prop_map_tokens:Nn, \prop_map_tokens:cn} % \begin{macro}[aux]{\prop_map_tokens_aux:nwn} % The mapping grabs one key--value pair at a time, and stops when -% reaching the marker key |A|, with catcode \enquote{letter}, which +% reaching the marker key \cs{q_recursion_tail}, which % cannot appear in normal keys since those are strings. The odd % construction |\use:n {#1}| allows |#1| to contain any token. % \begin{macrocode} \cs_new:Npn \prop_map_tokens:Nn #1#2 { \exp_last_unbraced:Nno \prop_map_tokens_aux:nwn {#2} #1 - A \q_prop { } \q_recursion_stop + \q_recursion_tail \q_prop { } \q_recursion_stop } \cs_new:Npn \prop_map_tokens_aux:nwn #1 \q_prop #2 \q_prop #3 { - \if_meaning:w A #2 + \if_meaning:w \q_recursion_tail #2 \exp_after:wN \prop_map_break: \fi: \use:n {#1} {#2} {#3} @@ -1147,8 +1154,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\prop_get:Nn, \prop_get:Nn} -% \begin{macro}[aux]{\prop_get_aux:nnn} +% \begin{macro}[EXP]{\prop_get:Nn, \prop_get:cn} +% \begin{macro}[aux]{\prop_get_Nn_aux:nwn} % Getting the value corresponding to a key in a property list in an % expandable fashion is a simple instance of mapping some tokens. % Map the function \cs{prop_get_aux:nnn} which takes as its three @@ -1158,9 +1165,18 @@ % to nothing. % \begin{macrocode} \cs_new:Npn \prop_get:Nn #1#2 - { \prop_map_tokens:Nn #1 { \prop_get_aux:nnn {#2} } } -\cs_new:Npn \prop_get_aux:nnn #1#2#3 - { \str_if_eq:nnT {#1} {#2} { \prop_map_break:n {#3} } } + { + \exp_last_unbraced:Noo \prop_get_Nn_aux:nwn + { \tl_to_str:n {#2} } #1 + \tl_to_str:n {#2} \q_prop { } + \q_recursion_stop + } +\cs_new:Npn \prop_get_Nn_aux:nwn #1 \q_prop #2 \q_prop #3 + { + \str_if_eq:xxTF {#1} {#2} + { \use_i_delimit_by_q_recursion_stop:nw {#3} } + { \prop_get_Nn_aux:nwn {#1} } + } \cs_generate_variant:Nn \prop_get:Nn { c } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index bf414270bb6..6f87a8a08f5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 2798 2011-09-10 15:42:13Z will $ +\GetIdInfo$Id: l3quark.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental quarks} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 84ae0a4de56..6739c5e3ce0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3seq.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental sequences and stacks} %</driver|package> %<*driver> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 5c3263f4227..3ca229a89ca 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 2818 2011-09-12 14:47:38Z will $ +\GetIdInfo$Id: l3skip.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental dimensions and skips} %</driver|package> %<*driver> @@ -1010,7 +1010,7 @@ \cs_new_nopar:Npn \dim_ratio:nn #1#2 { \dim_ratio_aux:n {#1} / \dim_ratio_aux:n {#2} } \cs_new_nopar:Npn \dim_ratio_aux:n #1 - { \exp_after:wN \int_value:w \dim_eval:w #1 \dim_eval_end: } + { \int_value:w \dim_eval:w #1 \dim_eval_end: } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index af58f1055ea..4601ed05408 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2812 2011-09-12 09:19:26Z bruno $ +\GetIdInfo$Id: l3tl.dtx 2831 2011-09-16 03:47:54Z bruno $ {L3 Experimental token lists} %</driver|package> %<*driver> @@ -1893,7 +1893,6 @@ % \end{macro} % % \begin{macro}{\tl_use:N, \tl_use:c} -% \begin{macro}[aux]{\tl_error_message:} % Token lists which are simply not defined will give a clear \TeX{} % error here. No such luck for ones equal to \cs{scan_stop:} so % instead a test is made and if there is an issue an error is forced. @@ -1909,7 +1908,6 @@ } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Working with the contents of token lists} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index e267c8c07f5..44ff767fa04 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 2819 2011-09-12 17:26:47Z will $ +\GetIdInfo$Id: l3token.dtx 2896 2011-10-09 20:36:50Z joseph $ {L3 Experimental token manipulation} %</driver|package> %<*driver> |