diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/expl3.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 427 |
1 files changed, 93 insertions, 334 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 9aa2421de31..64cb3935853 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -23,7 +23,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2019-09-19}% +\def\ExplFileDate{2019-09-28}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -622,6 +622,16 @@ % text of an~\tn{edef}, and the expansion is passed to the function as % a braced token list. Expansion takes place until only unexpandable % tokens are left. |x|-type arguments cannot be nested. +% \item[e] Fully-expanded token or braced token list which does +% not require doubled |#| tokens. This expansions is very similar +% to |x|-type but may be nested and does not require that |#| +% tokens are doubled. +% \item[f] Expanding the first token recursively in a braced token +% list.\\ Almost the same as the |x| type except here the token list +% is expanded fully until the first unexpandable token is found and +% the rest is left unchanged. Note that if this function finds a +% space at the beginning of the argument it gobbles it and does not +% expand the next token. % \item[o] One-level-expanded token or braced token list.\\ % This means that the argument is expanded one level, as by % \tn{expandafter}, and the expansion is passed to the function as a @@ -629,12 +639,6 @@ % token list then only the first token in that list is expanded. % In general, using \texttt{V} should be preferred to using % \texttt{o} for simple variable retrieval. -% \item[f] Expanding the first token recursively in a braced token -% list.\\ Almost the same as the |x| type except here the token list -% is expanded fully until the first unexpandable token is found and -% the rest is left unchanged. Note that if this function finds a -% space at the beginning of the argument it gobbles it and does not -% expand the next token. % \end{description} % % \subsection{Simpler means better} @@ -948,15 +952,10 @@ % These functions can only be used if \pkg{expl3} is loaded with the % \texttt{enable-debug} option. % -% \DescribeOption{driver} -% Selects the driver to be used for color, graphics and related operations that -% are driver-dependent. Options available are +% \DescribeOption{backend} +% Selects the backend to be used for color, graphics and related operations that +% are backend-dependent. Options available are % \begin{itemize}[font = \texttt] -% \item[auto] Let \LaTeX3 determine the correct driver. With DVI output, this -% selects the \texttt{dvips} back-end for \pdfTeX{} and \LuaTeX{}, and -% \texttt{dvipdfmx} for \pTeX{} and \upTeX{}. This is the standard setting. -% \item[latex2e] Use the \pkg{graphics} package to select the driver, rather -% than \LaTeX3 code. % \item[dvips] Use the \texttt{dvips} driver. % \item[dvipdfmx] Use the \texttt{dvipdfmx} driver. % \item[dvisvgm] Use the \texttt{dvisvgm} driver. @@ -1172,64 +1171,6 @@ ]% % \end{macrocode} % -% \begin{macro}[int]{\expl@create@bool@option} -% \begin{variable}[int] -% { -% \l@expl@undo@recent@deprecations@bool , -% \l@expl@check@declarations@bool , -% \l@expl@log@functions@bool , -% \l@expl@enable@debug@bool -% } -% \begin{variable}[int]{\l@expl@options@clist} -% Options to be set up. These have to be done by hand as there is no -% \pkg{expl3} yet: the logging option is needed before loading -% \pkg{l3basics}! Only a minimal set of options are handled here: -% others are left for a proper key--value approach once the kernel is -% loaded. After processing the options we set the -% \texttt{enable-debug} boolean so that the options -% \texttt{check-declarations} and \texttt{log-functions} imply -% \texttt{enable-debug}: otherwise the necessary debugging code would -% not be set up properly. -% \begin{macrocode} -\newcommand\expl@create@bool@option[2]% - {% - \DeclareOption{#1}{\chardef #2=1 }% - \DeclareOption{#1=true}{\chardef #2=1 }% - \DeclareOption{#1=false}{\chardef #2=0 }% - \newcommand*#2{}% - \chardef #2=0 % - }% -\expl@create@bool@option - {undo-recent-deprecations}\l@expl@undo@recent@deprecations@bool -\expl@create@bool@option{check-declarations}\l@expl@check@declarations@bool -\expl@create@bool@option{log-functions}\l@expl@log@functions@bool -\expl@create@bool@option{enable-debug}\l@expl@enable@debug@bool -\let\expl@create@bool@option\@undefined -\chardef\l@expl@enable@debug@bool=0 % -\newcommand*\l@expl@options@clist{}% -\DeclareOption* - {% - \ifx\l@expl@options@clist\@empty - \let\l@expl@options@clist\CurrentOption - \else - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter\l@expl@options@clist - \expandafter\expandafter\expandafter - {\expandafter\l@expl@options@clist\expandafter,\CurrentOption} - \fi - }% -\ProcessOptions\relax -\ifodd\l@expl@check@declarations@bool - \chardef\l@expl@enable@debug@bool=1 % -\fi -\ifodd\l@expl@log@functions@bool - \chardef\l@expl@enable@debug@bool=1 % -\fi -% \end{macrocode} -% \end{variable} -% \end{variable} -% \end{macro} -% % \begin{macro}{\ProvidesExplPackage, \ProvidesExplClass, \ProvidesExplFile} % For other packages and classes building on this one it is convenient % not to need \cs{ExplSyntaxOn} each time. @@ -1266,245 +1207,86 @@ \fi % \end{macrocode} % -% \begin{variable}{\l__expl_driver_tl} -% \begin{variable}{\l__expl_native_drivers_bool} -% With the code now loaded, options can be handled using a real key--value -% interpreter. The \enquote{faked} options are also included so that any -% erroneous input is mopped up (\emph{e.g.}~\texttt{log-function = -% foo}). The checks on driver choice are set up here, so when actually -% the driver it's a straight forward operation. % \begin{macrocode} -\__kernel_msg_new:nnnn { expl } { wrong-driver } - { Driver~request~inconsistent~with~engine:~using~'#2'~driver. } - { - You~have~requested~driver~'#1',~but~this~is~not~suitable~for~use~with~the~ - active~engine.~LaTeX3~will~use~the~'#2'~driver~instead. - } -\tl_new:N \l__expl_driver_tl -\keys_define:nn { expl } - { - driver .choice:, - driver / auto .code:n = - { - \tl_set:Nx \l__expl_driver_tl - { - \sys_if_engine_xetex:TF - { xdvipdfmx } - { - \sys_if_output_pdf:TF - { pdfmode } - { - \bool_lazy_or:nnTF - { \sys_if_engine_pdftex_p: } - { \sys_if_engine_luatex_p: } - { dvips } - { dvipdfmx } - } - } - } - }, - driver / dvipdfmx .code:n = - { - \tl_set:Nn \l__expl_driver_tl { dvipdfmx } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvipdfmx } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:T - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvipdfmx } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - } - }, - driver / dvips .code:n = - { - \tl_set:Nn \l__expl_driver_tl { dvips } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:T - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - } - }, - driver / dvisvgm .code:n = - { - \tl_set:Nn \l__expl_driver_tl { dvisvgm } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:T - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - } - }, - driver / latex2e .code:n = - { \tl_set:Nn \l__expl_driver_tl { latex2e } }, - driver / pdfmode .code:n = - { - \tl_set:Nn \l__expl_driver_tl { pdfmode } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { pdfmode } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:F - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { pdfmode } { dvips } - \tl_set:Nn \l__expl_driver_tl { dvips } - } - } - }, - driver / xdvipdfmx .code:n = - { - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - \sys_if_engine_xetex:F - { - \sys_if_output_pdf:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { xdvipdfmx } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { xdvipdfmx } { dvips } - \tl_set:Nn \l__expl_driver_tl { dvips } - } - } - }, - driver .initial:n = { auto } , - native-drivers .choice:, - native-drivers .default:n = { true }, - native-drivers / false .meta:n = { driver = latex2e }, - native-drivers / true .meta:n = { driver = auto } - } +%<@@=expl> % \end{macrocode} -% Mop up any incorrect settings for the other options. +% +% \begin{variable}{\c_@@_def_ext_tl} +% Needed by \LaTeXe{}. % \begin{macrocode} -\keys_define:nn { expl } - { - undo-recent-deprecations .bool_set:N = \l@expl@undo@recent@deprecations@bool, - check-declarations .bool_set:N = \l@expl@check@declarations@bool, - log-functions .bool_set:N = \l@expl@log@functions@bool - } -\keys_set:nV { expl } \l@expl@options@clist +\tl_const:Nn \c_@@_def_ext_tl { def } % \end{macrocode} % \end{variable} -% \end{variable} % -% \begin{macro} -% { -% \box_rotate:Nn, -% \box_resize_to_wd_and_ht_plus_dp:Nnn, -% \box_resize_to_ht_plus_dp:Nn, -% \box_resize_to_wd:Nn, -% \box_scale:Nnn -% } -% For the \LaTeXe{} drivers, -% alter various definitions to use the \pkg{graphics} package -% instead. The package is loaded right at the start of the hook -% as there is otherwise a potential issue with \pkg{(x)color}: see -% \url{http://groups.google.com/group/comp.text.tex/msg/c9de8913c756ef4c}. +% \begin{macro}{\__kernel_sys_configuration_load:n} +% For \LaTeXe{}, option loading uses the built-in functionality: as this +% may be a reload we have to force the issue. % \begin{macrocode} -\str_if_eq:VnTF \l__expl_driver_tl { latex2e } +\cs_new_protected:Npn \__kernel_sys_configuration_load:n #1 { - \tl_gput_left:Nn \@begindocumenthook { \RequirePackage { graphics } } - \__kernel_msg_new:nnnn { box } { clipping-not-available } - { Box~clipping~not~available. } - { - The~\box_clip:N~function~is~only~available~when~loading~expl3~ - with~the~"native-drivers"~option. - } - \cs_set_protected:Npn \box_clip:N #1 - { - \hbox_set:Nn #1 { \box_use:N #1 } - \__kernel_msg_error:nn { box } { clipping-not-available } - } - \cs_set_protected:Npn \box_rotate:Nn #1#2 - { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } - \cs_set_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \resizebox * - { \dim_eval:n {#2} } - { \dim_eval:n {#3} } - { \box_use:N #1 } - } - } - \cs_set_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 - { - \hbox_set:Nn #1 - { - \resizebox * { ! } { \dim_eval:n {#2} } - { \box_use:N #1 } - } - } - \cs_set_protected:Npn \box_resize_to_wd:Nn #1#2 + \group_begin: + \cs_set_protected:Npn \ProvidesExplFile { - \hbox_set:Nn #1 - { - \resizebox * { \dim_eval:n {#2} } { ! } - { \box_use:N #1 } - } + \char_set_catcode_space:n { `\ } + \ProvidesExplFileAux } - \cs_set_protected:Npn \__box_scale_aux:N #1 + \cs_set_protected:Npn \ProvidesExplFileAux ##1##2##3##4 { - \exp_last_unbraced:Nx \scalebox - { { \fp_use:N \l__box_scale_x_fp } [ \fp_use:N \l__box_scale_y_fp ] } - { \box_use:N #1 } + \group_end: + \ProvidesFile {##1} [ ##2~v##3~##4 ] } - \cs_set_protected:Npn \color_ensure_current: { \set@color } + \cs_undefine:c { ver@ #1 .def } + \@onefilewithoptions {#1} [ ] [ ] + \c_@@_def_ext_tl } % \end{macrocode} % \end{macro} -% For native drivers, just load the appropriate file. As \cs{expl3} syntax -% is already on and the full mechanism is only engaged at the end of the -% loader, \cs{ProvidesExplFile} is temporarily redefined here. +% +% \begin{variable}{\l_@@_options_clist} % \begin{macrocode} +\clist_new:N \l_@@_options_clist +\DeclareOption* + { \clist_put_right:NV \l_@@_options_clist \CurrentOption } +\ProcessOptions \relax +% \end{macrocode} +% \end{variable} +% +% Pretty standard setting creation. +% \begin{macrocode} +\keys_define:nn { sys } { - \group_begin: - \cs_set_protected:Npn \ProvidesExplFile + backend .choices:nn = + { dvipdfmx , dvips , dvisvgm , pdfmode , xdvipdfmx } + { \sys_load_backend:n {#1} } , + check-declarations .code:n = { - \char_set_catcode_space:n { `\ } - \ProvidesExplFileAux - } - \cs_set_protected:Npn \ProvidesExplFileAux #1#2#3#4 + \sys_load_debug: + \debug_on:n { check-declarations } + } , + driver .meta:n = { backend = #1 } , + enable-debug .code:n = + \sys_load_debug: , + log-functions .code:n = { - \group_end: - \ProvidesFile {#1} [ #2~v#3~#4 ] + \sys_load_debug: + \debug_on:n { log-functions } + } , + undo-recent-deprecations .code:n = + { + \sys_load_deprecation: + \bool_gset_true:N \g__kernel_deprecation_undo_recent_bool } - \tl_const:Nn \c__expl_def_ext_tl { def } - \@onefilewithoptions { l3backend- \l__expl_driver_tl } [ ] [ ] - \c__expl_def_ext_tl } % \end{macrocode} % +% \begin{macrocode} +\keys_set:nV { sys } \l_@@_options_clist +\str_if_exist:NF \c_sys_backend_str + { \sys_load_backend:n { } } +% \end{macrocode} +% % \begin{macro}{\@pushfilename, \@popfilename} -% \begin{macro}{\__expl_status_pop:w} +% \begin{macro}{\@@_status_pop:w} % The idea here is to use \LaTeXe{}'s \tn{@pushfilename} and % \tn{@popfilename} to track the current syntax status. This can be % achieved by saving the current status flag at each push to a stack, @@ -1541,14 +1323,14 @@ \__kernel_file_input_pop: \tl_if_empty:NTF \l__expl_status_stack_tl { \ExplSyntaxOff } - { \exp_after:wN \__expl_status_pop:w \l__expl_status_stack_tl \q_stop } + { \exp_after:wN \@@_status_pop:w \l__expl_status_stack_tl \q_stop } } % \end{macrocode} % The pop auxiliary function removes the first item from the stack, % saves the rest of the stack and then does the test. The flag here % is not a proper \texttt{bool}, so a low-level test is used. % \begin{macrocode} -\cs_new_protected:Npn \__expl_status_pop:w #1#2 \q_stop +\cs_new_protected:Npn \@@_status_pop:w #1#2 \q_stop { \tl_set:Nn \l__expl_status_stack_tl {#2} \int_if_odd:nTF {#1} @@ -1639,24 +1421,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}[int] -% { -% \l@expl@undo@recent@deprecations@bool , -% \l@expl@check@declarations@bool , -% \l@expl@log@functions@bool , -% \l@expl@enable@debug@bool -% } -% In generic mode, there is no convenient option handling and so instead -% the two variables are defined to do nothing. -% Appropriate value before input of the loader. -% \begin{macrocode} -\chardef \l@expl@undo@recent@deprecations@bool = 0 % -\chardef \l@expl@check@declarations@bool = 0 % -\chardef \l@expl@log@functions@bool = 0 % -\chardef \l@expl@enable@debug@bool = 0 % -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\AtBeginDocument} % \begin{macro}[int]{\expl@AtBeginDocument} % There are a few uses of \cs{AtBeginDocument} in the package code: the @@ -1690,35 +1454,30 @@ \fi % \end{macrocode} % -% For driver loading in generic mode, there are no options: pick the most -% appropriate case! To allow this loading to take place a temporary -% definition of \cs{ProvidesExplFile} is provided +% \begin{macro}{\__kernel_sys_configuration_load:n} +% Very basic. % \begin{macrocode} -\cs_set_protected:Npn \ProvidesExplFile +\cs_new_protected:Npn \__kernel_sys_configuration_load:n #1 { \group_begin: - \char_set_catcode_space:n { `\ } - \ProvidesExplFileAux - } -\cs_set_protected:Npn \ProvidesExplFileAux #1#2#3#4 - { - \group_end: - \iow_log:x { File:~#1~#2~v#3~#4 } + \cs_set_protected:Npn \ProvidesExplFile + { + \char_set_catcode_space:n { `\ } + \ProvidesExplFileAux + } + \cs_set_protected:Npn \ProvidesExplFileAux ##1##2##3##4 + { + \group_end: + \iow_log:x { File:~##1~##2~v##3~##4 } + } + \tex_input:D #1 .def \scan_stop: } -\tex_input:D - l3backend- - \sys_if_engine_xetex:TF - { xdvipdfmx } - { - \bool_lazy_and:nnTF - { \cs_if_exist_p:N \tex_pdfoutput:D } - { \int_compare_p:nNn \tex_pdfoutput:D > 0 } - { pdfmode } - { dvips } - } - .def \scan_stop: -\cs_undefine:N \ProvidesExplFile -\cs_undefine:N \ProvidesExplFileAux +% \end{macrocode} +% \end{macro} +% +% Load the standard back-end. +% \begin{macrocode} +\sys_load_backend:n { } % \end{macrocode} % % For the generic loader, a few final steps to take. Turn of \cs{expl3} |