diff options
author | Karl Berry <karl@freefriends.org> | 2014-06-17 22:32:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-06-17 22:32:09 +0000 |
commit | 3c2f50b92407533aabaef1823006032eedd6ef90 (patch) | |
tree | eb67245dd952c951b95c485a5eb66f9539ac83df /Master/texmf-dist/source/latex/l3kernel | |
parent | 4aa0b8110f2fdb3044d8b26d54e12cbb49a9a3dc (diff) |
l3
git-svn-id: svn://tug.org/texlive/trunk@34268 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel')
25 files changed, 1391 insertions, 1394 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 9a757ce9240..a36906f5137 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -36,8 +36,8 @@ %<*driver|generic|package> \def\ExplFileName{expl3} \def\ExplFileDescription{L3 programming layer} -\def\ExplFileDate{2014/05/20} -\def\ExplFileVersion{4814} +\def\ExplFileDate{2014/06/10} +\def\ExplFileVersion{5105} %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -946,10 +946,10 @@ % Selects the driver to be used for color, graphics and related operations that % are driver-dependent. Options available are % \begin{itemize}[font = \texttt] -% \item[latex2e] Use the \pkg{graphics} package to select the driver, rather -% than \LaTeX3 code. This is the standard setting. % \item[auto] Let \LaTeX3 determine the correct driver. With DVI output, this -% will select the \texttt{dvips} back-end. +% will select the \texttt{dvips} back-end. 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[pdfmode] Use the \texttt{pdfmode} driver (direct PDF output from @@ -1156,13 +1156,6 @@ ] % \end{macrocode} % -% For handling driver options the \pkg{ifpdf} package will be needed. To -% avoid issues during package loading, it's most convenient to load this before -% setting up any of the code environment. -% \begin{macrocode} -\RequirePackage{ifpdf} -% \end{macrocode} -% % \begin{macro}[aux]{\expl@create@bool@option} % \begin{variable}[int] % { @@ -1253,6 +1246,7 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[int, TF]{\__expl_if_pdf:} % \begin{variable}[int]{\l__expl_driver_tl} % \begin{variable}[int]{\l__expl_native_drivers_bool} % With the code now loaded, options can be handled using a real key--value @@ -1268,19 +1262,35 @@ active~engine.~LaTeX3~will~use~the~'#2'~driver~instead. } \tl_new:N \l__expl_driver_tl +\bool_if:nTF + { + \cs_if_exist_p:N \pdftex_pdfoutput:D + && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero + } + { + \cs_new_eq:NN \__expl_if_pdf:T \use:n + \cs_new_eq:NN \__expl_if_pdf:F \use_none:n + \cs_new_eq:NN \__expl_if_pdf:TF \use_i:nn + } + { + \cs_new_eq:NN \__expl_if_pdf:T \use_none:n + \cs_new_eq:NN \__expl_if_pdf:F \use:n + \cs_new_eq:NN \__expl_if_pdf:TF \use_ii:nn + } \keys_define:nn { expl } { driver .choice:, driver / auto .code:n = { - \xetex_if_engine:TF - { \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } } + \tl_set:Nx \l__expl_driver_tl { - \ifpdf - \tl_set:Nn \l__expl_driver_tl { pdfmode } - \else - \tl_set:Nn \l__expl_driver_tl { dvips } - \fi + \xetex_if_engine:TF + { xdvipdfmx } + { + \__expl_if_pdf:TF + { pdfmode } + { dvips } + } } }, driver / dvipdfmx .code:n = @@ -1290,14 +1300,15 @@ { \__msg_kernel_error:nnnn { expl } { wrong-driver } { dvipdfmx } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdmx } + \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } } { - \ifpdf - \__msg_kernel_error:nnnn { expl } { wrong-driver } - { dvipdfmx } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - \fi + \__expl_if_pdf:T + { + \__msg_kernel_error:nnnn { expl } { wrong-driver } + { dvipdfmx } { pdfmode } + \tl_set:Nn \l__expl_driver_tl { pdfmode } + } } }, driver / dvips .code:n = @@ -1310,11 +1321,12 @@ \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } } { - \ifpdf - \__msg_kernel_error:nnnn { expl } { wrong-driver } - { dvips } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - \fi + \__expl_if_pdf:T + { + \__msg_kernel_error:nnnn { expl } { wrong-driver } + { dvips } { pdfmode } + \tl_set:Nn \l__expl_driver_tl { pdfmode } + } } }, driver / latex2e .code:n = @@ -1329,12 +1341,12 @@ \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } } { - \ifpdf - \else - \__msg_kernel_error:nnnn { expl } { wrong-driver } - { pdfmode } { dvips } - \tl_set:Nn \l__expl_driver_tl { dvips } - \fi + \__expl_if_pdf:F + { + \__msg_kernel_error:nnnn { expl } { wrong-driver } + { pdfmode } { dvips } + \tl_set:Nn \l__expl_driver_tl { dvips } + } } }, driver / xdvipdfmx .code:n = @@ -1342,18 +1354,20 @@ \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } \xetex_if_engine:F { - \ifpdf - \__msg_kernel_error:nnnn { expl } { wrong-driver } - { xdvipdfmx } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - \else - \__msg_kernel_error:nnnn { expl } { wrong-driver } - { xdvipdfmx } { dvips } - \tl_set:Nn \l__expl_driver_tl { dvips } - \fi + \__expl_if_pdf:TF + { + \__msg_kernel_error:nnnn { expl } { wrong-driver } + { xdvipdfmx } { pdfmode } + \tl_set:Nn \l__expl_driver_tl { pdfmode } + } + { + \__msg_kernel_error:nnnn { expl } { wrong-driver } + { xdvipdfmx } { dvips } + \tl_set:Nn \l__expl_driver_tl { dvips } + } } }, - driver .initial:n = { latex2e } , + driver .initial:n = { auto } , native-drivers .choice:, native-drivers .default:n = { true }, native-drivers / false .meta:n = { driver = latex2e }, @@ -1371,6 +1385,7 @@ % \end{macrocode} % \end{variable} % \end{variable} +% \end{macro} % % \begin{macro} % { @@ -1446,8 +1461,17 @@ % loader, \cs{ProvidesExplFile} is temporarily redefined here. % \begin{macrocode} { - \cs_set_protected:Npn \ProvidesExplFile #1#2#3#4 - { \ProvidesFile {#1} [ #2~v#3~#4 ] } + \cs_set_protected:Npn \ProvidesExplFile + { + \group_begin: + \char_set_catcode_space:n { `\ } + \ProvidesExplFileAux + } + \cs_set_protected:Npn \ProvidesExplFileAux #1#2#3#4 + { + \group_end: + \ProvidesFile {#1} [ #2~v#3~#4 ] + } \tl_const:Nn \c__expl_def_ext_tl { def } \@onefilewithoptions { l3 \l__expl_driver_tl } [ ] [ ] \c__expl_def_ext_tl \cs_set_protected:Npn \ProvidesExplFile #1#2#3#4 @@ -1455,6 +1479,7 @@ \ProvidesFile {#1} [ #2~v#3~#4 ] \ExplSyntaxOn } + \cs_undefine:N \ProvidesExplFileAux } % \end{macrocode} % \end{variable} @@ -1649,11 +1674,13 @@ \xetex_if_engine:TF { xdvipdfmx } { - \ifpdf - pdfmode - \else - dvips - \fi + \bool_if:nTF + { + \cs_if_exist_p:N \pdftex_pdfoutput:D + && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero + } + { pdfmode } + { dvips } } .def \scan_stop: \cs_undefine:N \ProvidesExplFile diff --git a/Master/texmf-dist/source/latex/l3kernel/interface3.tex b/Master/texmf-dist/source/latex/l3kernel/interface3.tex new file mode 100644 index 00000000000..4c0a2761e92 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/interface3.tex @@ -0,0 +1,89 @@ +% \iffalse meta-comment +% +%% File: interfaces3.tex Copyright (C) 1990-2011 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +% +% \fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This document will typeset the LaTeX3 interface descriptions a single +% document. This will produce quite a large file (more than 170 pages +% currently). +% +% There is also a full version of the sources (source3.tex) which additionally +% also typesets the command implementations. +% +% Do not forget to generate the index (as explained on the terminal output +% near the end of the run)! +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\documentclass{l3doc} +\listfiles + +\begin{document} + +\title{The \LaTeX3 Interfaces} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org} + {latex-team@latex-project.org}% + }% +} + +\pagenumbering{roman} +\maketitle + +% +% First load all modules and typeset the documentation parts +% + +\input{source3body} % all the individual modules + +\clearpage + +\begingroup + \def\endash{--} + \catcode`\-\active + \def-{\futurelet\temp\indexdash} + \def\indexdash{\ifx\temp-\endash\fi} + \DelayPrintIndex +\endgroup + +\end{document} + + diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins new file mode 100644 index 00000000000..72b9fa583c3 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins @@ -0,0 +1,96 @@ +\iffalse meta-comment + +File l3.ins Copyright (C) 2011,2012,2014 The 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 +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\let\jobname\relax +\input l3docstrip.dtx +\askforoverwritefalse + +\preamble + +EXPERIMENTAL CODE + +Do not distribute this file without also distributing the +source files specified above. + +Do not distribute a modified version of this file. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +\generate + { + \file{expl3-code.tex} + { + % ======== PACKAGE ONLY ======== + \from{expl3.dtx} {package} + % ============================== + \from{l3bootstrap.dtx} {package} + \from{l3names.dtx} {package} + \from{l3basics.dtx} {package} + \from{l3expan.dtx} {package} + \from{l3tl.dtx} {package} + \from{l3seq.dtx} {package} + \from{l3int.dtx} {package} + \from{l3quark.dtx} {package} + \from{l3prg.dtx} {package} + \from{l3clist.dtx} {package} + \from{l3token.dtx} {package} + \from{l3prop.dtx} {package} + \from{l3msg.dtx} {package} + \from{l3file.dtx} {package} + \from{l3skip.dtx} {package} + \from{l3keys.dtx} {package} + \from{l3fp.dtx} {package} + \from{l3fp-aux.dtx} {package} + \from{l3fp-traps.dtx} {package} + \from{l3fp-round.dtx} {package} + \from{l3fp-parse.dtx} {package} + \from{l3fp-logic.dtx} {package} + \from{l3fp-basics.dtx} {package} + \from{l3fp-extended.dtx}{package} + \from{l3fp-expo.dtx} {package} + \from{l3fp-trig.dtx} {package} + \from{l3fp-convert.dtx} {package} + \from{l3fp-assign.dtx} {package} + \from{l3box.dtx} {package} + \from{l3coffins.dtx} {package} + \from{l3color.dtx} {package} + \from{l3candidates.dtx} {package} + } + } + +\generate{\file{expl3.sty} {\from{expl3.dtx} {package,loader}}} +\generate{\file{expl3-generic.tex}{\from{expl3.dtx} {generic,loader}}} + +\generate{\file{l3doc.cls} {\from{l3doc.dtx} {class}}} +\generate{\file{l3doc.ist} {\from{l3doc.dtx} {docist}}} + +\generate{\file{l3dvipdfmx.def} {\from{l3drivers.dtx} {package,dvipdfmx} }} +\generate{\file{l3dvips.def} {\from{l3drivers.dtx} {package,dvips} }} +\generate{\file{l3pdfmode.def} {\from{l3drivers.dtx} {package,pdfmode} }} +\generate{\file{l3xdvipdfmx.def} {\from{l3drivers.dtx} {package,xdvipdfmx}}} + +\generate{\file{l3docstrip.tex} {\from{l3docstrip.dtx} {program}}} + +\generate{\file{l3names.def} {\from{l3names.dtx} {names}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 54fcf80009b..339eb9eacb1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3basics.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3basics.dtx 5033 2014-06-04 05:32:44Z joseph $ {L3 Basic definitions} %</driver|package> %<*driver> @@ -1367,7 +1367,7 @@ % such that internal parts of the mechanism are not visible. % \end{function} % -% \begin{function}{\__prg_case_end:nw} +% \begin{function}[EXP]{\__prg_case_end:nw} % \begin{syntax} % \cs{__prg_case_end:nw} \Arg{code} \meta{tokens} \cs{q_mark} \Arg{true code} \cs{q_mark} \Arg{false code} \cs{q_stop} % \end{syntax} @@ -1377,8 +1377,18 @@ % case (if one is found) and either the \texttt{true code} or % \texttt{false code} for the over all outcome, as appropriate. % \end{function} +% +% \begin{function}[EXP]{\__str_if_eq_x:nn} +% \begin{syntax} +% \cs{__str_if_eq_x:nn} \Arg{tl_1} \Arg{tl_2} +% \end{syntax} +% Compares the full expansion of two \meta{token lists} on a character by +% character basis, and is \texttt{true} if the two lists contain the same +% characters in the same order. Leaves |0| in the input stream if the +% condition is true, and |+1| or |-1| otherwise. +% \end{function} % -% \begin{function}{\__str_if_eq_x_return:nn} +% \begin{function}[EXP]{\__str_if_eq_x_return:nn} % \begin{syntax} % \cs{__str_if_eq_x_return:nn} \Arg{tl_1} \Arg{tl_2} % \end{syntax} @@ -2506,6 +2516,7 @@ % \cs_new_protected_nopar:Npn , \cs_new_protected_nopar:Npx , % \cs_new_protected:Npn , \cs_new_protected:Npx % } +% \begin{macro}[int]{\__cs_tmp:w} % Function which check that the control sequence is free before % defining it. % \begin{macrocode} @@ -2527,6 +2538,7 @@ \__cs_tmp:w \cs_new_protected:Npx \cs_gset_protected:Npx % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro} % { @@ -3063,6 +3075,47 @@ % \end{macro} % % \subsection{String comparisons} +% +% \begin{macro}[int, EXP]{\__str_if_eq_x:nn} +% \begin{macro}[aux, EXP]{\__str_escape_x:n} +% String comparisons rely on the primitive \cs{(pdf)strcmp} if available: +% \LuaTeX{} does not have it, so emulation is required. As the net result +% is that we do not \emph{always} use the primitive, the correct approach +% is to wrap up in a function with defined behaviour. That's done by +% providing a wrapper and then redefining in the \LuaTeX{} case. Note that +% the necessary Lua code is covered in \pkg{l3boostrap}: long-term this may +% need to go into a separate Lua file, but at present it's somewhere that +% spaces are not skipped for ease-of-input. The need to detokenize and force +% expansion of input arises from the case where a |#| token is used in the +% input, \emph{e.g.}~|\__str_if_eq_x:nn {#} { \tl_to_str:n {#} }|, which +% otherwise will fail as \cs{luatex_luaescapestring:D} does not double +% such tokens. +% \begin{macrocode} +\cs_new:Npn \__str_if_eq_x:nn #1#2 { \pdftex_strcmp:D {#1} {#2} } +\luatex_if_engine:T + { + \cs_set:Npn \__str_if_eq_x:nn #1#2 + { + \luatex_directlua:D + { + l3kernel.strcmp + ( + " \__str_escape_x:n {#1} " , + " \__str_escape_x:n {#2} " + ) + } + } + \cs_new:Npn \__str_escape_x:n #1 + { + \luatex_luaescapestring:D + { + \etex_detokenize:D \exp_after:wN { \luatex_expanded:D {#1} } + } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} % % \begin{macro}[pTF, EXP]{\str_if_eq:nn, \str_if_eq_x:nn} % Modern engines provide a direct way of comparing two token lists, @@ -3073,13 +3126,13 @@ % \begin{macrocode} \prg_new_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF } { - \if_int_compare:w \pdftex_strcmp:D { \exp_not:n {#1} } { \exp_not:n {#2} } + \if_int_compare:w \__str_if_eq_x:nn { \exp_not:n {#1} } { \exp_not:n {#2} } = \c_zero \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \str_if_eq_x:nn #1#2 { p , T , F , TF } { - \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#1} {#2} = \c_zero \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -3093,7 +3146,7 @@ % \begin{macrocode} \cs_new:Npn \__str_if_eq_x_return:nn #1 #2 { - \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#1} {#2} = \c_zero \prg_return_true: \else: \prg_return_false: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 9e27324cbc1..4ff6c7dd5cf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -145,7 +145,7 @@ % \end{macro} % \end{macro} % \end{macro} -\GetIdInfo$Id: l3bootstrap.dtx 4782 2014-05-16 22:12:19Z joseph $ +\GetIdInfo$Id: l3bootstrap.dtx 4889 2014-05-26 19:59:25Z joseph $ {L3 Bootstrap code} %</driver|package> %<*driver> @@ -241,15 +241,6 @@ % % \subsection{Internal functions and variables} % -% \begin{function}{\__expl_package_check:} -% \begin{syntax} -% \cs{__expl_package_check:} -% \end{syntax} -% Used to ensure that all parts of \pkg{expl3} are loaded together -% (\emph{i.e.}~as part of \pkg{expl3}). Issues an error if a kernel package -% is loaded independently of the bundle. -% \end{function} -% % \begin{variable}{\l__kernel_expl_bool} % A boolean which records the current code syntax status: \texttt{true} if % currently inside a code environment. This variable should only be @@ -297,6 +288,7 @@ %<*initex> \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname directlua\endcsname\relax +\else \directlua{tex.enableprimitives ('', tex.extraprimitives ( ))} \fi %</initex> @@ -314,23 +306,21 @@ \fi % \end{macrocode} % -% \begin{macro}{\expl_pdfstrcmp} % If \LuaTeX{} is in use then no primitive \cs{(pdf)strcmp} is available. -% However, it can be emulated using some Lua code. Since this is not -% the primitive, we do not use a misleading name: instead, a temporary -% version is set up as \cs{expl_pdfstrcmp}. The latter is then picked up -% and moved to the correct place by \pkg{l3names}. In earlier versions of +% However, it can be emulated using some Lua code. In earlier versions of % the code, the \pkg{pdftexcmds} package was loaded to do this task. However, % that raises some issues in \enquote{generic} (it fails with Con\TeX{}t -% MkIV), and also adds a hardly-needed dependency. -% -% Note that \LuaTeX{} prior to version $0.36$ is not supported by -% \pkg{expl3}: here that means simply skipping the definition, which will -% then be picked up later. This definition may need to be done twice: one -% \enquote{now} and once at the start of every job. The latter can occur -% in package mode if for example a custom format is being constructed. -% To achieve this while not requiring a separate file, the Lua code is saved -% into a macro then used twice. +% MkIV), and also adds a hardly-needed dependency. Note that \LuaTeX{} +% prior to version $0.36$ is not supported by \pkg{expl3}: here that means +% simply skipping the definition, which will then be picked up later. This +% definition may need to be done twice: one \enquote{now} and once at the +% start of every job. The latter can occur in package mode if for example a +% custom format is being constructed. To achieve this while not requiring a +% separate file, the Lua code is saved into a macro then used twice. +% (In the long term, the Lua code here may be best moved to a separate +% file.) +% +% No macro definition is given just yet: that is left until \pkg{l3basics}. % \begin{macrocode} \begingroup \expandafter\ifx\csname directlua\endcsname\relax @@ -369,29 +359,16 @@ \expandafter\luatex_directlua:D\expandafter{\tempa}% } \fi - \long\gdef\expl_pdfstrcmp#1#2% - {% - \luatex_directlua:D - {% - l3kernel.strcmp - ( - "\luatex_luaescapestring:D {#1}" , - "\luatex_luaescapestring:D {#2}" - ) - }% - } \fi \fi \endgroup % \end{macrocode} -% \end{macro} % % \subsection{Engine requirements} % % The code currently requires functionality equivalent to \tn{pdfstrcmp} % in addition to \eTeX{}. This is picked up by testing for the \cs{pdfstrcmp} -% primitive or emulation as \cs{expl_pdfstrcmp}, as the \eTeX{} primitives -% must be available if it is. +% primitive or a version of \LuaTeX{} capable of emulating it. % \begin{macrocode} \begingroup \def\next{\endgroup} @@ -408,46 +385,48 @@ \LineBreak }% \expandafter\ifx\csname pdfstrcmp\endcsname\relax - \catcode`\_=11 % - \expandafter\ifx\csname expl_pdfstrcmp\endcsname\relax + \expandafter\ifx\csname directlua\endcsname\relax + \else + \ifnum\luatexversion<36 % %<*initex> - \def\LineBreak{^^J}% - \edef\next - {% - \newlinechar`\noexpand\^^J\relax - \errhelp - {% - \LongText - For pdfTeX and XeTeX the '-etex' command-line switch is also - needed.\LineBreak - \LineBreak - Format building will abort!\LineBreak - }% - \errmessage{\ShortText}% - \endgroup - \noexpand\end - }% + \def\LineBreak{^^J}% + \edef\next + {% + \newlinechar`\noexpand\^^J\relax + \errhelp + {% + \LongText + For pdfTeX and XeTeX the '-etex' command-line switch is also + needed.\LineBreak + \LineBreak + Format building will abort!\LineBreak + }% + \errmessage{\ShortText}% + \endgroup + \noexpand\end + }% %</initex> %<*package> - \def\LineBreak{\noexpand\MessageBreak}% - \expandafter\ifx\csname PackageError\endcsname\relax - \def\LineBreak{^^J}% - \begingroup - \def\PackageError#1#2#3% - {% - \endgroup - \errhelp{#3}% - \errmessage{#1 Error: #2!} - }% - \fi - \edef\next - {% - \noexpand\PackageError{expl3}{\ShortText} - {\LongText Loading of expl3 will abort!}% - \endgroup - \noexpand\endinput - }% + \def\LineBreak{\noexpand\MessageBreak}% + \expandafter\ifx\csname PackageError\endcsname\relax + \def\LineBreak{^^J}% + \begingroup + \def\PackageError#1#2#3% + {% + \endgroup + \errhelp{#3}% + \errmessage{#1 Error: #2!} + }% + \fi + \edef\next + {% + \noexpand\PackageError{expl3}{\ShortText} + {\LongText Loading of expl3 will abort!}% + \endgroup + \noexpand\endinput + }% %</package> + \fi \fi \fi \next @@ -492,25 +471,6 @@ %</package> % \end{macrocode} % -% If \LuaTeX{} is in use there are more allocators to create. Con\TeX{}t -% already does that, so skip any loading in that case: this is done using the -% \cs{newattribute} allocator. Otherwise, there is a need for a test to -% differentiate between \LaTeXe{} and plain. -% \begin{macrocode} -%<*package> -\ifdefined\directlua - \ifdefined\newattribute - \else - \ifdefined\RequirePackage - \RequirePackage{luatex} - \else - \input luatex.sty % - \fi - \fi -\fi -%</package> -% \end{macrocode} -% % \subsection{The \LaTeX3 code environment} % % The code environment is now set up. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 6c481ee323f..3ca5609396d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3box.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3box.dtx 4974 2014-05-31 18:28:43Z mittelba $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -341,14 +341,14 @@ % % \begin{function}[added = 2012-05-11]{\box_log:N, \box_log:c} % \begin{syntax} -% \cs{box_show:N} \meta{box} +% \cs{box_log:N} \meta{box} % \end{syntax} % Writes full details of the content of the \meta{box} to the log. % \end{function} % % \begin{function}[added = 2012-05-11]{\box_log:Nnn, \box_log:cnn} % \begin{syntax} -% \cs{box_show:Nnn} \meta{box} \meta{intexpr_1} \meta{intexpr_2} +% \cs{box_log:Nnn} \meta{box} \meta{intexpr_1} \meta{intexpr_2} % \end{syntax} % Writes the contents of \meta{box} to the log, showing the first % \meta{intexpr_1} items of the box, and descending into \meta{intexpr_2} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 2c77af11e46..a65e95aaca8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3candidates.dtx 4734 2014-05-04 21:48:49Z joseph $ +\GetIdInfo$Id: l3candidates.dtx 4972 2014-05-31 16:42:18Z bruno $ {L3 Experimental additions to l3kernel} %</driver|package> %<*driver> @@ -78,28 +78,6 @@ % the kernel. We encourage programmers to test them out and report back on % the \texttt{LaTeX-L} mailing list. % -% \section{Additions to \pkg{l3basics}} -% -% \begin{function}[EXP,TF]{\cs_if_exist_use:N, \cs_if_exist_use:c} -% \begin{syntax} -% \cs{cs_if_exist_use:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} -% \end{syntax} -% If the \meta{control sequence} exists, leave it in the input stream, -% followed by the \meta{true code} (unbraced). Otherwise, leave the -% \meta{false} code in the input stream. For example, -% \begin{verbatim} -% \cs_set:Npn \mypkg_use_character:N #1 -% { \cs_if_exist_use:cF { mypkg_#1:n } { \mypkg_default:N #1 } } -% \end{verbatim} -% calls the function |\mypkg_#1:n| if it exists, and falls back to -% a default action otherwise. This could also be done (more slowly) -% using \cs{str_case_x:nnn}. -% \begin{texnote} -% The \texttt{c} variants do not introduce the \meta{control sequence} -% in the hash table if it is not there. -% \end{texnote} -% \end{function} -% % \section{Additions to \pkg{l3box}} % % \subsection{Affine transformations} @@ -120,8 +98,10 @@ % the box. The updated \meta{box} will be an hbox, irrespective of the nature % of the \meta{box} before the resizing is applied. Negative sizes will % cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. The resizing applies -% within the current \TeX{} group level. +% reference point of the \meta{box} will be unchanged. +% Thus negative $y$-sizes will result in a box a depth dependent on the +% height of the original box a height dependent on the depth. +% The resizing applies within the current \TeX{} group level. % \end{function} % % \begin{function} @@ -136,8 +116,10 @@ % The updated \meta{box} will be an hbox, irrespective of the nature % of the \meta{box} before the resizing is applied. A negative size will % cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. The resizing applies -% within the current \TeX{} group level. +% reference point of the \meta{box} will be unchanged. +% Thus negative $y$-sizes will result in a box a depth dependent on the +% height of the original box a height dependent on the depth. +% The resizing applies within the current \TeX{} group level. % \end{function} % % \begin{function}{\box_resize_to_wd:Nn, \box_resize_to_wd:cn} @@ -149,8 +131,10 @@ % The updated \meta{box} will be an hbox, irrespective of the nature % of the \meta{box} before the resizing is applied. A negative size will % cause the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. The resizing applies -% within the current \TeX{} group level. +% reference point of the \meta{box} will be unchanged. +% Thus negative $y$-sizes will result in a box a depth dependent on the +% height of the original box a height dependent on the depth. +% The resizing applies within the current \TeX{} group level. % \end{function} % % \begin{function}{\box_rotate:Nn, \box_rotate:cn} @@ -176,7 +160,9 @@ % of the nature of the \meta{box} before the scaling is applied. Negative % scalings will cause the material in the \meta{box} to be reversed in % direction, but the reference point of the \meta{box} will be unchanged. -% The scaling applies within the current \TeX{} group level. +% Thus negative $y$-scales will result in a box a depth dependent on the +% height of the original box a height dependent on the depth. +% The resizing applies within the current \TeX{} group level. % \end{function} % % \subsection{Viewing part of a box} @@ -457,76 +443,6 @@ % before being assigned to the \meta{floating point variable}. % \end{function} % -% \begin{function}[EXP]{\fp_function:Nw} -% \begin{syntax} -% \cs{fp_eval:n} -% ~~|{| -% ~~~~\cs{fp_function:Nw} \meta{function} -% ~~~~~~|(| \meta{fpexpr_1} |,| \ldots{} |,| \meta{fpexpr_n} |)| -% ~~|}| -% \end{syntax} -% Finds one or more arguments \meta{fpexpr_1} \ldots{} \meta{fpexpr_n} -% following the \meta{function}, and evaluate them. Then calls the -% \meta{function} followed by a single brace group containing -% \Arg{result_1} \ldots{} \Arg{result_n}. For instance, -% \begin{verbatim} -% \cs_new_nopar:Npn \mypkg_log:w -% { \fp_function:Nw \__mypkg_log:n } -% \cs_new:Npn \__mypkg_log:n #1 -% { -% \int_case:nnF { \tl_count:n {#1} } -% { -% { 1 } { \__mypkg_log_aux:nn #1 { 10 } } -% { 2 } { \__mypkg_log_aux:nn #1 } -% } -% { \ERROR \c_nan_fp } -% } -% \cs_new:Npn \__mypkg_log_aux:nn #1#2 { ln(#1) / ln(#2) } -% \fp_show:n { \mypkg_log:w (8, 2) + \mypkg_log:w (1e17) } -% \end{verbatim} -% shows $20 = \log_2(8) + \log(10^{17})$. The function |\mypkg_log:w| -% behaves like other built-in functions such as |ln|, but allows $1$ -% or~$2$ arguments, and computes either the base~$10$ logarithm or the -% logarithm of the first argument in a base given by the second -% argument. Checking the number of arguments is acheived by -% |\__mypkg_log:n|, which provides the default base~$10$ when there is -% only one argument. The computation itself is done by -% |\__mypkg_log_aux:nn|. -% \end{function} -% -% \begin{function}{\fp_new_function:Npn} -% \begin{syntax} -% \cs{fp_new_function:Npn} \meta{function} \meta{parameters} \Arg{code} -% \cs{fp_eval:n} |{| \meta{function} |(| \meta{fpexpr_1} |,| \ldots{} |,| \meta{fpexpr_n} |)| |}| -% \end{syntax} -% Defines the \meta{function} for use within floating point -% expressions, expecting some \meta{parameters}, and evaluating the -% \meta{code}, which must be expandable. When the \meta{function} -% appears in a floating point expression, arguments \meta{fpexpr_1}, -% \ldots{}, \meta{fpexpr_n} are found and evaluated in the same way as -% for built-in functions such as~|max|. If the number of arguments -% matches the number of \meta{parameters}, the arguments replace |#1|, -% \ldots{}, |#|$n$ in the \meta{code}, which is then evaluated to -% produce a floating point result. Otherwise, the result is -% \texttt{nan} after an error. The \meta{parameter text} must not -% contain delimited arguments, that is, it must be empty or one of -% |#1|, |#1#2|, |#1#2#3|, \ldots{} |#1#2#3#4#5#6#7#8#9|. The -% arguments replacing parameters in the \meta{code} are internal -% floating point numbers; operations such as |#1^2| thus correctly -% take into account the sign of~|#1|. For instance, -% \begin{verbatim} -% \fp_new_function:Npn \mypkg_sqrt:w #1 { #1^.5 } -% \fp_new_function:Npn \mypkg_veclen:w #1#2 -% { \mypkg_sqrt:w ( #1^2 + #2^2 ) } -% \fp_show:n { \mypkg_veclen:w ( 42 / 7 , 2 * 4 - 0 ) } -% \end{verbatim} -% shows~$10$. In the example, |\mypkg_veclen:w| receives the -% arguments $6=42/7$ and~$8=2\times 4-0$, thus expands to -% |\mypkg_sqrt:w ( 6^2 + 8^2 )|, then |\mypkg_sqrt:w| receives -% $100=6^2+8^2$ as an argument, and evaluates the square root $10 = -% 100^{0.5}$. -% \end{function} -% % \section{Additions to \pkg{l3prop}} % % \begin{function}[rEXP] @@ -664,7 +580,8 @@ % % \section{Additions to \pkg{l3skip}} % -% \begin{function}[added = 2013-05-06, EXP]{\dim_to_pt:n} +% \begin{function}[added = 2013-05-06, updated=2014-05-31, EXP] +% {\dim_to_pt:n} % \begin{syntax} % \cs{dim_to_pt:n} \Arg{dimexpr} % \end{syntax} @@ -674,16 +591,16 @@ % places. If the decimal part of the result is zero, it is omitted, % together with the decimal marker. % -% If the \meta{dimension expression} contains additional tokens such -% as redundant units, these will be ignored, so for example +% For example % \begin{verbatim} -% \dim_to_pt:n { 1 bp pt } +% \dim_to_pt:n { 1 bp } % \end{verbatim} % leaves |1.00374| in the input stream, \emph{i.e.}~the magnitude of % one \enquote{big point} when converted to points. % \end{function} % -% \begin{function}[added = 2013-05-06, EXP]{\dim_to_unit:nn} +% \begin{function}[added = 2013-05-06, updated=2014-05-31, EXP] +% {\dim_to_unit:nn} % \begin{syntax} % \cs{dim_to_unit:nn} \Arg{dimexpr_1} \Arg{dimexpr_2} % \end{syntax} @@ -693,10 +610,9 @@ % to four or five decimal places. If the decimal part of the result % is zero, it is omitted, together with the decimal marker. % -% If the \meta{dimension expressions} contain additional tokens such -% as redundant units, these will be ignored, so for example +% For example % \begin{verbatim} -% \dim_to_unit:nn { 1 bp pt } { 1 mm } +% \dim_to_unit:nn { 1 bp } { 1 mm } % \end{verbatim} % leaves |0.35277| in the input stream, \emph{i.e.}~the magnitude of % one \enquote{big point} when converted to millimeters. @@ -1311,8 +1227,15 @@ % \end{macrocode} % The new height and depth can be applied directly. % \begin{macrocode} - \box_set_ht:Nn \l_@@_internal_box { \l_@@_top_new_dim } - \box_set_dp:Nn \l_@@_internal_box { \l_@@_bottom_new_dim } + \fp_compare:nNnTF \l_@@_scale_y_fp > \c_zero_fp + { + \box_set_ht:Nn \l_@@_internal_box { \l_@@_top_new_dim } + \box_set_dp:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } + } + { + \box_set_dp:Nn \l_@@_internal_box { \l_@@_top_new_dim } + \box_set_ht:Nn \l_@@_internal_box { -\l_@@_bottom_new_dim } + } % \end{macrocode} % Things are not quite as obvious for the width, as the reference point % needs to remain unchanged. For positive scaling factors resizing the @@ -2528,7 +2451,6 @@ % \end{macro} % % \begin{macro}[EXP]{\dim_to_unit:nn} -% \begin{macro}[aux, EXP]{\@@_to_unit:n} % An analog of \cs{dim_ratio:nn} that produces a decimal number as its % result, rather than a rational fraction for use within dimension % expressions. The naive implementation as @@ -2543,15 +2465,14 @@ { \dim_to_pt:n { - 1pt * \@@_to_unit:n { \dim_to_pt:n {#1} pt } - / \@@_to_unit:n { \dim_to_pt:n {#2} pt } + 1pt * + \dim_ratio:nn + { \dim_to_pt:n {#1} pt } + { \dim_to_pt:n {#2} pt } } } -\cs_new:Npn \@@_to_unit:n #1 - { \__int_value:w \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macrocode} %<@@=skip> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index f9c0d414665..c81c35070d3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3coffins.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3coffins.dtx 4899 2014-05-28 20:13:51Z joseph $ {L3 Coffin code layer} %</driver|package> %<*driver> @@ -1687,7 +1687,7 @@ \__msg_kernel_new:nnnn { kernel } { no-pole-intersection } { No~intersection~between~coffin~poles. } { - \c_msg_coding_error_text_tl + \c__msg_coding_error_text_tl LaTeX~was~asked~to~find~the~intersection~between~two~poles,~ but~they~do~not~have~a~unique~meeting~point:~ the~value~(0~pt,~0~pt)~will~be~used. @@ -1698,7 +1698,7 @@ \__msg_kernel_new:nnnn { kernel } { unknown-coffin-pole } { Pole~'#1'~unknown~for~coffin~'#2'. } { - \c_msg_coding_error_text_tl + \c__msg_coding_error_text_tl LaTeX~was~asked~to~find~a~typesetting~pole~for~a~coffin,~ but~either~the~coffin~does~not~exist~or~the~pole~name~is~wrong. } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 45bb0ec7adf..2c9210f8d76 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3file.dtx 4737 2014-05-05 07:37:48Z joseph $ +\GetIdInfo$Id: l3file.dtx 4890 2014-05-26 20:59:31Z joseph $ {L3 File and I/O operations} %</driver|package> %<*driver> @@ -83,8 +83,9 @@ % may contain both literal items and expandable content, which should on % full expansion be the desired file name. Any active characters (as % declared in \cs{l_char_active_seq}) will \emph{not} be expanded, -% allowing the direct use of these in file names. -% Spaces are not allowed in file names. +% allowing the direct use of these in file names. File names will be quoted +% using |"| tokens if they contain spaces: as a result, |"| tokens are +% \emph{not} permitted in file names. % % \section{File operation functions} % @@ -500,7 +501,7 @@ % % \subsection{Internal file functions and variables} % -% \begin{variable}{\l__file_internal_name_ior} +% \begin{variable}{\g__file_internal_ior} % Used to test for the existence of files when opening. % \end{variable} % @@ -638,9 +639,13 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}[aux]{\@@_name_sanitize:nn} +% \begin{macro}[int]{\@@_name_sanitize:nn} +% \begin{macro}[int, aux]{\@@_name_sanitize_aux:n} % For converting a token list to a string where active characters are treated -% as strings from the start. +% as strings from the start. The logic to the quoting normalisation is the +% same as used by \texttt{lualatexquotejobname}: check for balanced |"|, and +% assuming they balance strip all of them out before quoting the entire name +% if it contains spaces. % \begin{macrocode} \cs_new_protected:Npn \@@_name_sanitize:nn #1#2 { @@ -650,20 +655,42 @@ \tl_set:Nx \l_@@_internal_name_tl {#1} \tl_set:Nx \l_@@_internal_name_tl { \tl_to_str:N \l_@@_internal_name_tl } - \tl_if_in:NnT \l_@@_internal_name_tl { ~ } + \int_compare:nNnTF { - \__msg_kernel_error:nnx { kernel } { space-in-file-name } - { \l_@@_internal_name_tl } - \tl_remove_all:Nn \l_@@_internal_name_tl { ~ } + \int_mod:nn + { + 0 \tl_map_function:NN \l_@@_internal_name_tl + \@@_name_sanitize_aux:n + } + \c_two } + = \c_zero + { + \tl_remove_all:Nn \l_@@_internal_name_tl { " } + \tl_if_in:NnT \l_@@_internal_name_tl { ~ } + { + \tl_set:Nx \l_@@_internal_name_tl + { " \exp_not:V \l_@@_internal_name_tl " } + } + } + { + \__msg_kernel_error:nnx { kernel } { unbalanced-quote-in-filename } + { \l_@@_internal_name_tl } + } \use:x { \group_end: \exp_not:n {#2} { \l_@@_internal_name_tl } } } +\cs_new:Npn \@@_name_sanitize_aux:n #1 + { + \str_if_eq:nnT {#1} { " } + { + \c_one } + } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\file_add_path:nN} % \begin{macro}[aux]{\@@_add_path:nN, \@@_add_path_search:nN} @@ -1710,11 +1737,10 @@ All~16~are~currently~in~use,~and~something~wanted~to~open~ another~one. } -\__msg_kernel_new:nnnn { kernel } { space-in-file-name } - { Space~in~file~name~'#1'. } +\__msg_kernel_new:nnnn { kernel } { unbalanced-quote-in-filename } + { Unbalanced~quotes~in~file~name~'#1'. } { - Spaces~are~not~permitted~in~files~loaded~by~LaTeX: \\ - Further~errors~may~follow! + File~names~must~contain~balanced~numbers~of~quotes~("). } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins new file mode 100644 index 00000000000..defd3b714c3 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3format.ins @@ -0,0 +1,90 @@ +\iffalse meta-comment + +File l3format.ins Copyright (C) 2011,2012,2014 The 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 +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\let\jobname\relax +\input l3docstrip.dtx +\askforoverwritefalse + +\preamble + +EXPERIMENTAL CODE + +Do not distribute this file without also distributing the +source files specified above. + +Do not distribute a modified version of this file. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +\generate + { + \file{l3format.ltx} + { + \from{l3bootstrap.dtx} {initex} + \from{l3names.dtx} {initex} + \from{l3basics.dtx} {initex} + \from{l3expan.dtx} {initex} + \from{l3tl.dtx} {initex} + \from{l3seq.dtx} {initex} + % ======== FORMAT ONLY ========= + \from{l3alloc.dtx} {initex} + % ============================== + \from{l3int.dtx} {initex} + \from{l3quark.dtx} {initex} + \from{l3prg.dtx} {initex} + \from{l3clist.dtx} {initex} + \from{l3token.dtx} {initex} + \from{l3prop.dtx} {initex} + \from{l3msg.dtx} {initex} + \from{l3file.dtx} {initex} + \from{l3skip.dtx} {initex} + \from{l3keys.dtx} {initex} + \from{l3fp.dtx} {initex} + \from{l3fp-aux.dtx} {initex} + \from{l3fp-traps.dtx} {initex} + \from{l3fp-round.dtx} {initex} + \from{l3fp-parse.dtx} {initex} + \from{l3fp-logic.dtx} {initex} + \from{l3fp-basics.dtx} {initex} + \from{l3fp-extended.dtx}{initex} + \from{l3fp-expo.dtx} {initex} + \from{l3fp-trig.dtx} {initex} + \from{l3fp-convert.dtx} {initex} + \from{l3fp-assign.dtx} {initex} + \from{l3box.dtx} {initex} + \from{l3coffins.dtx} {initex} + \from{l3color.dtx} {initex} + \from{l3candidates.dtx} {initex} + % ======== FORMAT ONLY ========= + \from{l3final.dtx} {initex} + % ============================== + } + } + +\generate{\file{l3dvips.ltx} {\from{l3drivers.dtx}{initex,dvips} }} +\generate{\file{l3pdfmode.ltx} {\from{l3drivers.dtx}{initex,pdfmode} }} +\generate{\file{l3xdvipdfmx.ltx}{\from{l3drivers.dtx}{initex,xdvipdfmx}}} + +\generate{\file{l3docstrip.tex}{\from{l3docstrip.dtx}{program}}} + +\endbatchfile
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 8c834488183..ec7ac32602d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-expo.dtx 4712 2014-04-30 08:17:49Z joseph $ +\GetIdInfo$Id: l3fp-expo.dtx 4889 2014-05-26 19:59:25Z joseph $ {L3 Floating-point exponential-related functions} \begin{document} \DocInput{\jobname.dtx} @@ -988,7 +988,7 @@ % \begin{macrocode} \cs_new:Npn \@@_pow_normal:ww \s_@@ \@@_chk:w 1 #1#2#3; \s_@@ \@@_chk:w #4#5 { - \if_int_compare:w \pdftex_strcmp:D { #2 #3 } + \if_int_compare:w \__str_if_eq_x:nn { #2 #3 } { 1 {1000} {0000} {0000} {0000} } = \c_zero \if_int_compare:w #4 #1 = 32 \exp_stop_f: \exp_after:wN \@@_case_return_ii_o:ww diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx deleted file mode 100644 index 229840bfcf1..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx +++ /dev/null @@ -1,288 +0,0 @@ -% \iffalse meta-comment -% -%% File: l3fp-old.dtx Copyright (C) 2012,2014 The 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 -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the "l3kernel bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX3 Project Team. -%% -%% ----------------------------------------------------------------------- -%% -% -%<*driver> -\documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-old.dtx 4712 2014-04-30 08:17:49Z joseph $ - {L3 Experimental floating-points (old)} -\begin{document} - \DocInput{\jobname.dtx} -\end{document} -%</driver> -% \fi -% -% \title{^^A -% The \pkg{l3fp-old} package\\ Floating-points (old)^^A -% \thanks{This file describes v\ExplFileVersion, -% last revised \ExplFileDate.}^^A -% } -% -% \author{^^A -% The \LaTeX3 Project\thanks -% {^^A -% E-mail: -% \href{mailto:latex-team@latex-project.org} -% {latex-team@latex-project.org}^^A -% }^^A -% } -% -% \date{Released \ExplFileDate} -% -% \maketitle -% -% \begin{documentation} -% -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3fp-old} implementation} -% -% \begin{macrocode} -%<*initex|package> -% \end{macrocode} -% -% \begin{macrocode} -%<@@=fp> -% \end{macrocode} -% -% \subsection{Compatibility} -% -% \begin{variable}{\c_undefined_fp} -% The old floating point number \cs{c_undefined_fp} is now implemented -% as a \texttt{nan}. -% \begin{macrocode} -\fp_const:Nn \c_undefined_fp { nan } -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[pTF]{\fp_if_undefined:N} -% An old floating point is undefined if it is \texttt{inf} or -% \texttt{nan}, \emph{i.e.}, if its type is $2$ or $3$. -% \begin{macrocode} -\prg_new_conditional:Npnn \fp_if_undefined:N #1 { p , T , F , TF } - { \exp_after:wN \@@_if_undefined:w #1 } -\cs_new:Npn \@@_if_undefined:w \s_@@ \@@_chk:w #1#2; - { - \if_int_compare:w #1 > \c_one - \prg_return_true: \else: \prg_return_false: \fi: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[pTF]{\fp_if_zero:N} -% An old floating point is zero if it is $\pm 0$, \emph{i.e.}, its -% type is $0$. -% \begin{macrocode} -\prg_new_conditional:Npnn \fp_if_zero:N #1 { p , T , F , TF } - { \exp_after:wN \@@_if_zero:w #1 } -\cs_new:Npn \@@_if_zero:w \s_@@ \@@_chk:w #1#2; - { \if_meaning:w #1 0 \prg_return_true: \else: \prg_return_false: \fi: } -% \end{macrocode} -% \end{macro} -% -% \begin{macro} -% { -% \fp_abs:N , \fp_abs:c , \fp_gabs:N , \fp_gabs:c , -% \fp_neg:N , \fp_neg:c , \fp_gneg:N , \fp_gneg:c , -% } -% \begin{macro}[aux]{\@@_abs:NNN} -% Simply expand the floating point variable to feed it to -% \cs{@@_abs_o:w} or \cs{@@_-_o:w}, expanded within an expanding -% token list assignment. The \cs{prg_do_nothing:} is not necessary, -% but it reminds us more clearly that \cs{@@_abs_o:w} and -% \cs{@@_-_o:w} expand after their result. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \fp_abs:N { \@@_abs:NNN \tl_set:Nx \@@_abs_o:w } -\cs_new_protected_nopar:Npn \fp_gabs:N { \@@_abs:NNN \tl_gset:Nx \@@_abs_o:w } -\cs_new_protected_nopar:Npx \fp_neg:N - { - \exp_not:N \@@_abs:NNN - \exp_not:N \tl_set:Nx - \exp_not:c { @@_-_o:w } - } -\cs_new_protected_nopar:Npx \fp_gneg:N - { - \exp_not:N \@@_abs:NNN - \exp_not:N \tl_gset:Nx - \exp_not:c { @@_-_o:w } - } -\cs_new_protected:Npn \@@_abs:NNN #1#2#3 - { #1 #3 { \exp_after:wN #2 #3 \prg_do_nothing: } } -\cs_generate_variant:Nn \fp_abs:N { c } -\cs_generate_variant:Nn \fp_gabs:N { c } -\cs_generate_variant:Nn \fp_neg:N { c } -\cs_generate_variant:Nn \fp_gneg:N { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% { -% \fp_mul:Nn, \fp_mul:cn, \fp_gmul:Nn, \fp_gmul:cn, -% \fp_div:Nn, \fp_div:cn, \fp_gdiv:Nn, \fp_gdiv:cn, -% \fp_pow:Nn, \fp_pow:cn, \fp_gpow:Nn, \fp_gpow:cn, -% } -% \begin{macro}[aux]{\@@_mul:NNNn} -% See \cs{fp_add:Nn} for details. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \fp_mul:Nn { \@@_mul:NNNn \fp_set:Nn * } -\cs_new_protected_nopar:Npn \fp_gmul:Nn { \@@_mul:NNNn \fp_gset:Nn * } -\cs_new_protected_nopar:Npn \fp_div:Nn { \@@_mul:NNNn \fp_set:Nn / } -\cs_new_protected_nopar:Npn \fp_gdiv:Nn { \@@_mul:NNNn \fp_gset:Nn / } -\cs_new_protected_nopar:Npn \fp_pow:Nn { \@@_mul:NNNn \fp_set:Nn ^ } -\cs_new_protected_nopar:Npn \fp_gpow:Nn { \@@_mul:NNNn \fp_gset:Nn ^ } -\cs_new_protected:Npn \@@_mul:NNNn #1#2#3#4 - { #1 #3 { #3 #2 \@@_parse:n {#4} } } -\cs_generate_variant:Nn \fp_mul:Nn { c } -\cs_generate_variant:Nn \fp_gmul:Nn { c } -\cs_generate_variant:Nn \fp_div:Nn { c } -\cs_generate_variant:Nn \fp_gdiv:Nn { c } -\cs_generate_variant:Nn \fp_pow:Nn { c } -\cs_generate_variant:Nn \fp_gpow:Nn { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% { -% \fp_exp:Nn, \fp_exp:cn, \fp_gexp:Nn, \fp_gexp:cn, -% \fp_ln:Nn , \fp_ln:cn , \fp_gln:Nn , \fp_gln:cn , -% \fp_sin:Nn, \fp_sin:cn, \fp_gsin:Nn, \fp_gsin:cn, -% \fp_cos:Nn, \fp_cos:cn, \fp_gcos:Nn, \fp_gcos:cn, -% \fp_tan:Nn, \fp_tan:cn, \fp_gtan:Nn, \fp_gtan:cn, -% } -% \begin{macro}[aux] -% {\@@_assign_to:nNNNn, \@@_assign_to_i:wNNNn, \@@_assign_to_ii:NnNNN} -% Here, an added twist is that each value computed by these expensive -% unary operations is stored as a constant floating point number. -% \begin{macrocode} -\cs_set_protected:Npn \@@_tmp:w #1#2#3#4#5 - { - \cs_new_protected_nopar:Npn #1 { #5 {#4} \tl_set_eq:NN #3 } - \cs_new_protected_nopar:Npn #2 { #5 {#4} \tl_gset_eq:NN #3 } - \cs_generate_variant:Nn #1 { c } - \cs_generate_variant:Nn #2 { c } - } -\@@_tmp:w \fp_exp:Nn \fp_gexp:Nn \@@_exp_o:w {exp} \@@_assign_to:nNNNn -\@@_tmp:w \fp_ln:Nn \fp_gln:Nn \@@_ln_o:w {ln } \@@_assign_to:nNNNn -\@@_tmp:w \fp_sin:Nn \fp_gsin:Nn \@@_sin_o:w {sin} \@@_assign_to:nNNNn -\@@_tmp:w \fp_cos:Nn \fp_gcos:Nn \@@_cos_o:w {cos} \@@_assign_to:nNNNn -\@@_tmp:w \fp_tan:Nn \fp_gtan:Nn \@@_tan_o:w {tan} \@@_assign_to:nNNNn -\cs_new_protected:Npn \@@_assign_to:nNNNn #1#2#3#4#5 - { - \exp_after:wN \@@_assign_to_i:wNNNn - \tex_romannumeral:D -`0 \@@_parse:n {#5} {#1} #2#3#4 - } -\cs_new_protected:Npn \@@_assign_to_i:wNNNn \s_@@ \@@_chk:w #1#2#3; #4 - { - \exp_args:Nc \@@_assign_to_ii:NnNNN - { c_@@_ #4 [ #1 # 2 \if_meaning:w 1 #1 #3 \fi: ] _fp } - { #1#2#3 } - } -\cs_new_protected:Npn \@@_assign_to_ii:NnNNN #1#2#3#4#5 - { - \cs_if_exist:NF #1 - { \tl_const:Nx #1 { #4 \s_@@ \@@_chk:w #2; } } - #3 #5 #1 - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[TF]{\fp_compare:NNN} -% Comparisons used to be easier between floating points stored in -% variables. No more. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \fp_compare:NNNTF { \fp_compare:nNnTF } -\cs_new_protected_nopar:Npn \fp_compare:NNNT { \fp_compare:nNnT } -\cs_new_protected_nopar:Npn \fp_compare:NNNF { \fp_compare:nNnF } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\fp_round_places:Nn, \fp_ground_places:Nn} -% \begin{macro}[aux]{\@@_round_places:NNn} -% Rounding to a given number of places is easy, since it is provided -% by the \pkg{l3fp-round} module. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \fp_round_places:Nn - { \@@_round_places:NNn \tl_set:Nx } -\cs_new_protected_nopar:Npn \fp_ground_places:Nn - { \@@_round_places:NNn \tl_gset:Nx } -\cs_new_protected:Npn \@@_round_places:NNn #1#2#3 - { - #1 #2 - { - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_round:Nwn - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_round_to_nearest:NNN - \exp_after:wN #2 - \exp_after:wN { \int_use:N \__int_eval:w #3 } - } - } -\cs_generate_variant:Nn \fp_round_places:Nn { c } -\cs_generate_variant:Nn \fp_ground_places:Nn { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\fp_round_figures:Nn, \fp_ground_figures:Nn} -% Rounding to a given number of figures is the same as rounding to a -% number of places, after shifting by the exponent of the argument. -% \begin{macrocode} -\cs_new_protected:Npn \fp_round_figures:Nn #1#2 - { - \@@_round_places:NNn \tl_set:Nx #1 - { #2 - \exp_after:wN \@@_exponent:w #1 } - } -\cs_new_protected:Npn \fp_ground_figures:Nn #1#2 - { - \@@_round_places:NNn \tl_gset:Nx #1 - { #2 - \exp_after:wN \@@_exponent:w #1 } - } -\cs_generate_variant:Nn \fp_round_figures:Nn { c } -\cs_generate_variant:Nn \fp_ground_figures:Nn { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -%</initex|package> -% \end{macrocode} -% -% \end{implementation} -% -% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 755d9020d82..f0cdec7ffbb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-parse.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3fp-parse.dtx 4975 2014-05-31 19:26:32Z bruno $ {L3 Floating-point expression parsing} \begin{document} \DocInput{\jobname.dtx} @@ -474,7 +474,7 @@ % \begin{itemize} % \item % \item If the next token is a control sequence, it could be the -% end-marker \cs{s_@@_mark}, which has the lowest precedence, and +% special marker \cs{s_@@_mark}, and % otherwise it is a case of juxtaposing numbers, such as % |2\c_three|, with an implied multiplication. % \item If the next token is a letter, it is also a case of @@ -1646,7 +1646,7 @@ \if_catcode:w \scan_stop: \exp_not:N #1 \if_meaning:w \scan_stop: #1 \if_int_compare:w - \pdftex_strcmp:D { \s_@@ } { \exp_not:N #1 } = \c_zero + \__str_if_eq_x:nn { \s_@@ } { \exp_not:N #1 } = \c_zero 0 \__msg_kernel_expandable_error:nnn { kernel } { fp-after-e } { floating~point~ } @@ -1659,7 +1659,7 @@ \fi: \else: \if_int_compare:w - \pdftex_strcmp:D { \__int_value:w #1 } { \tex_the:D #1 } + \__str_if_eq_x:nn { \__int_value:w #1 } { \tex_the:D #1 } = \c_zero \__int_value:w #1 \else: @@ -2039,8 +2039,12 @@ % Start a \tn{romannumeral} expansion so that \cs{@@_parse:n} expands % in two steps. The \cs{@@_parse_operand:Nw} function will perform % computations until reaching an operation with precedence -% \cs{c_minus_one} or less. Then stop the initial expansion with -% \cs{c_zero}. +% \cs{c_minus_one} or less, namely, the end of the expression. The +% marker \cs{s_@@_mark} indicates that the next token is an already +% parsed version of an infix operator, and \cs{@@_parse_infix_end:N} +% has infinitely negative precedence. Finally, clean up a +% (well-defined) set of extra tokens and stop the initial expansion +% with \cs{c_zero}. % \begin{macrocode} \cs_new:Npn \@@_parse:n #1 { @@ -2048,11 +2052,12 @@ \exp_after:wN \@@_parse_after:ww \tex_romannumeral:D \@@_parse_operand:Nw \c_minus_one - \@@_parse_expand:w #1 \s_@@_mark + \@@_parse_expand:w #1 + \s_@@_mark \@@_parse_infix_end:N \s_@@_stop } \cs_new:Npn \@@_parse_after:ww - #1@ \@@_parse_infix_end:N \s_@@_mark \s_@@_stop + #1@ \@@_parse_infix_end:N \s_@@_stop { \c_zero #1 } % \end{macrocode} % \end{macro} @@ -2111,10 +2116,10 @@ { \if_catcode:w \scan_stop: \exp_not:N #2 \if_int_compare:w - \pdftex_strcmp:D { \s_@@_mark } { \exp_not:N #2 } + \__str_if_eq_x:nn { \s_@@_mark } { \exp_not:N #2 } = \c_zero \exp_after:wN \exp_after:wN - \exp_after:wN \@@_parse_infix_end:N + \exp_after:wN \@@_parse_infix_mark:NNN \else: \exp_after:wN \exp_after:wN \exp_after:wN \@@_parse_infix_juxtapose:N @@ -2158,6 +2163,16 @@ % % \subsubsection{Closing parentheses and commas} % +% \begin{macro}[aux, EXP]{\@@_parse_infix_mark:NNN} +% As an infix operator, \cs{s_@@_mark} means that the next +% token~(|#3|) has already gone through \cs{@@_parse_infix:NN} and +% should be provided the precedence~|#1|. The scan mark~|#2| is +% discarded. +% \begin{macrocode} +\cs_new:Npn \@@_parse_infix_mark:NNN #1#2#3 { #3 #1 } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[aux, EXP]{\@@_parse_infix_end:N} % This one is a little bit odd: force every previous operator to end, % regardless of the precedence. @@ -2571,41 +2586,56 @@ % \subsection{Candidate: defining new \pkg{l3fp} functions} % % \begin{macro}[EXP]{\fp_function:Nw} -% This relies on the definition of the null character as a prefix -% operator with very specific semantics. +% Parse the argument of the function~|#1| using +% \cs{@@_parse_operand:Nw} with a precedence of~$16$, and pass the +% function and argument to \cs{@@_function_apply:nw}. % \begin{macrocode} -\group_begin: - \char_set_catcode_other:N \^^@ - \cs_new:Npn \fp_function:Nw #1 { ^^@ ; { \exp_after:wN #1 } } -\group_end: +\cs_new:Npn \fp_function:Nw #1 + { + \exp_after:wN \@@_function_apply:nw + \exp_after:wN #1 + \tex_romannumeral:D + \@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w + } % \end{macrocode} % \end{macro} % % \begin{macro}{\fp_new_function:Npn} +% \begin{macro}[aux]{\@@_new_function:NNnnn, \@@_new_function:Ncfnn} % \begin{macro}[aux]{\@@_function_args:Nwn} -% This relies on the definition of the null character as a prefix -% operator with very specific semantics. -% \begin{macrocode} -\group_begin: - \char_set_catcode_other:N \^^@ - \cs_new_protected:Npn \fp_new_function:Npn #1#2# - { - \cs_new:Npx #1 - { - ^^@ ; - { - \exp_not:N \exp_after:wN - \exp_not:N \@@_function_args:Nwn - \exp_not:N \exp_after:wN - \exp_not:c { @@_user_ \cs_to_str:N #1 } - \exp_not:N \__int_value:w - \int_eval:n { \tl_count:n {#2} / \c_two } - \exp_not:N \exp_after:wN ; - } - } - \cs_new:cpn { @@_user_ \cs_to_str:N #1 } #2 - } -\group_end: +% Save the code provided by the user in the control sequence +% |\__fp_user_#1|. Define |#1| to call \cs{@@_function_apply:nw} +% after parsing one operand using \cs{@@_parse_operand:Nw} with +% precedence~$16$. The auxiliary \cs{@@_function_args:Nwn} receives +% the user function and the number of arguments (half of the number of +% tokens in the parameter text~|#2|), followed by the operand (as a +% token list of floating points). It checks the number of arguments, +% and applies the user function to the arguments (without the outer +% brace group). +% \begin{macrocode} +\cs_new_protected:Npn \fp_new_function:Npn #1#2# + { + \@@_new_function:Ncfnn #1 + { @@_user_ \cs_to_str:N #1 } + { \int_eval:n { \tl_count:n {#2} / \c_two } } + {#2} + } +\cs_new_protected:Npn \@@_new_function:NNnnn #1#2#3#4#5 + { + \cs_new_nopar:Npn #1 + { + \exp_after:wN \@@_function_apply:nw \exp_after:wN + { + \exp_after:wN \@@_function_args:Nwn + \exp_after:wN #2 + \__int_value:w #3 \exp_after:wN ; \exp_after:wN + } + \tex_romannumeral:D + \@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w + } + \cs_new:Npn #2 #4 {#5} + } +\cs_generate_variant:Nn \@@_new_function:NNnnn { Ncf } \cs_new:Npn \@@_function_args:Nwn #1#2; #3 { \int_compare:nNnTF { \tl_count:n {#3} } = {#2} @@ -2619,49 +2649,44 @@ % \end{macrocode} % \end{macro} % \end{macro} -% -% \begingroup\catcode`\^^@=12\relax % ^^A hack -% \begin{macro}[EXP, aux]{\@@_parse_prefix_^^@:Nw} -% \begin{macrocode} -\group_begin: - \char_set_catcode_other:N \^^@ - \cs_new:cpn { @@_parse_prefix_ ^^@ :Nw } #1 ; #2 - { - \exp_after:wN \@@_function_apply:NnwN - \exp_after:wN #1 - \exp_after:wN { #2 \exp_after:wN } - \tex_romannumeral:D - \@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w - } -\group_end: -% \end{macrocode} % \end{macro} -% \endgroup % % \begin{macro}[aux, EXP] % { -% \@@_function_apply:NnwN, +% \@@_function_apply:nw, % \@@_function_store:wwNwnn, % \@@_function_store_end:wnnn % } -% \begin{macrocode} -\cs_new:Npn \@@_function_apply:NnwN #1#2#3@#4 - { - \exp_after:wN \@@_exp_after_array_f:w - \tex_romannumeral:D -`0 - \@@_function_store:wwNwnn #3 - \s_@@_mark \@@_function_store:wwNwnn ; - \s_@@_mark \@@_function_store_end:wnnn - \s_@@_stop { } { } {#2} - \s_@@_stop - #4 #1 +% The auxiliary \cs{@@_function_apply:nw} is called after parsing an +% operand, so it receives some code~|#1|, then the operand ending +% with~|@|, then a function such as \cs{@@_parse_infix_+:N} (but not +% always of this form, see comparisons for instance). Package the +% operand (an array) into a token list with floating point items: this +% is the role of \cs{@@_function_store:wwNwnn} and +% \cs{@@_function_store_end:wnnn}. Then apply \cs{@@_parse:n} to the +% code~|#1| followed by a brace group with this token list. This +% results in a floating point result, which will correctly be parsed +% as the next operand of whatever was looking for one. The trailing +% \cs{s_@@_mark} is used as a special infix operator to indicate that +% the next token has already gone through \cs{@@_parse_infix:NN}. +% \begin{macrocode} +\cs_new:Npn \@@_function_apply:nw #1#2 @ + { + \@@_parse:n + { + \@@_function_store:wwNwnn #2 + \s_@@_mark \@@_function_store:wwNwnn ; + \s_@@_mark \@@_function_store_end:wnnn + \s_@@_stop { } { } {#1} + } + \s_@@_mark } \cs_new:Npn \@@_function_store:wwNwnn #1; #2 \s_@@_mark #3#4 \s_@@_stop #5#6 { #3 #2 \s_@@_mark #3#4 \s_@@_stop { #5 #6 } { { #1; } } } \cs_new:Npn \@@_function_store_end:wnnn #1 \s_@@_stop #2#3#4 - { \@@_parse:n { #4 {#2} } } + { #4 {#2} } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index c5b6d966ae5..5cf8a36cd56 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3int.dtx 4776 2014-05-16 14:46:44Z joseph $ +\GetIdInfo$Id: l3int.dtx 4966 2014-05-31 00:44:34Z bruno $ {L3 Integers} %</driver|package> %<*driver> @@ -121,8 +121,8 @@ % \cs{int_div_round:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} % Evaluates the two \meta{integer expressions} as described earlier, -% then calculates the result of dividing the first value by the -% second, rounding any remainder. Ties are rounded away from zero. +% then divides the first value by the second, and rounds the result +% to the closest integer. Ties are rounded away from zero. % Note that this is identical to using % |/| directly in an \meta{integer expression}. The result is left in % the input stream as an \meta{integer denotation} after two expansions. @@ -133,8 +133,8 @@ % \cs{int_div_truncate:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} % Evaluates the two \meta{integer expressions} as described earlier, -% then calculates the result of dividing the first value by the -% second, truncating any remainder. Note that division using |/| +% then divides the first value by the second, and rounds the result +% towards zero. Note that division using |/| % rounds the result. The result is left in the input stream as an % \meta{integer denotation} after two expansions. % \end{function} @@ -156,8 +156,12 @@ % \end{syntax} % Evaluates the two \meta{integer expressions} as described earlier, % then calculates the integer remainder of dividing the first -% expression by the second. This is left in the input stream as an -% \meta{integer denotation} after two expansions. +% expression by the second. This is obtained by subtracting +% \cs{int_div_truncate:nn} \Arg{intexpr_1} \Arg{intexpr_2} times +% \meta{intexpr_2} from \meta{intexpr_1}. Thus, the result has the +% same sign as \meta{intexpr_1} and its absolute value is strictly +% less than that of \meta{intexpr_2}. The result is left in the input +% stream as an \meta{integer denotation} after two expansions. % \end{function} % % \section{Creating and initialising integers} @@ -488,7 +492,7 @@ % % \section{Integer step functions} % -% \begin{function}[added = 2012-06-04, updated = 2012-06-29, rEXP] +% \begin{function}[added = 2012-06-04, updated = 2014-05-30, rEXP] % {\int_step_function:nnnN} % \begin{syntax} % \cs{int_step_function:nnnN} \Arg{initial value} \Arg{step} \Arg{final value} \meta{function} @@ -497,7 +501,11 @@ % and \meta{final value}, all of which should be integer expressions. % The \meta{function} is then placed in front of each \meta{value} % from the \meta{initial value} to the \meta{final value} in turn -% (using \meta{step} between each \meta{value}). Thus \meta{function} +% (using \meta{step} between each \meta{value}). The \meta{step} must +% be non-zero. If the \meta{step} is positive, the loop stops when +% the \meta{value} becomes larger than the \meta{final value}. If the +% \meta{step} is negative, the loop stops when the \meta{value} +% becomes smaller than the \meta{final value}. The \meta{function} % should absorb one numerical argument. For example % \begin{verbatim} % \cs_set:Npn \my_func:n #1 { [I~saw~#1] \quad } @@ -513,20 +521,21 @@ % \end{quote} % \end{function} % -% \begin{function}[added = 2012-06-04, updated = 2012-06-29] +% \begin{function}[added = 2012-06-04, updated = 2014-05-30] % {\int_step_inline:nnnn} % \begin{syntax} % \cs{int_step_inline:nnnn} \Arg{initial value} \Arg{step} \Arg{final value} \Arg{code} % \end{syntax} % This function first evaluates the \meta{initial value}, \meta{step} % and \meta{final value}, all of which should be integer expressions. -% The \meta{code} is then placed in front of each \meta{value} -% from the \meta{initial value} to the \meta{final value} in turn -% (using \meta{step} between each \meta{value}). Thus the \meta{code} -% should define a function of one argument (|#1|). +% Then for each \meta{value} from the \meta{initial value} to the +% \meta{final value} in turn (using \meta{step} between each +% \meta{value}), the \meta{code} is inserted into the input stream +% with |#1| replaced by the current \meta{value}. Thus the +% \meta{code} should define a function of one argument~(|#1|). % \end{function} % -% \begin{function}[added = 2012-06-04, updated = 2012-06-29] +% \begin{function}[added = 2012-06-04, updated = 2014-05-30] % {\int_step_variable:nnnNn} % \begin{syntax} % \cs{int_step_variable:nnnNn} \\ @@ -534,9 +543,11 @@ % \end{syntax} % This function first evaluates the \meta{initial value}, \meta{step} % and \meta{final value}, all of which should be integer expressions. -% The \meta{code} is inserted into the input stream, with the -% \meta{tl~var} defined as the current \meta{value}. Thus the -% \meta{code} should make use of the \meta{tl~var}. +% Then for each \meta{value} from the \meta{initial value} to the +% \meta{final value} in turn (using \meta{step} between each +% \meta{value}), the \meta{code} is inserted into the input stream, +% with the \meta{tl~var} defined as the current \meta{value}. Thus +% the \meta{code} should make use of the \meta{tl~var}. % \end{function} % % \section{Formatting integers} @@ -920,11 +931,19 @@ % % \TestFiles{m3int001,m3int002,m3int03} % +% \begin{variable}{\c_max_register_int} +% Done in \pkg{l3basics}. +% \end{variable} +% % \begin{macro}{\@@_to_roman:w} % \begin{macro}{\if_int_compare:w} % Done in \pkg{l3basics}. % \end{macro} % \end{macro} +% +% \begin{macro}{\or:} +% Done in \pkg{l3basics}. +% \end{macro} % % \begin{macro}{\@@_value:w} % \begin{macro}{\@@_eval:w} @@ -1286,7 +1305,7 @@ % % \subsection{Integer expression conditionals} % -% \begin{macro}[aux, EXP]{\__prg_compare_error:, \__prg_compare_error:NNw} +% \begin{macro}[int, EXP]{\__prg_compare_error:, \__prg_compare_error:Nw} % Those functions are used for comparison tests which use a simple % syntax where only one set of braces is required and additional % operators such as |!=| and |>=| are supported. The tests first @@ -1383,7 +1402,8 @@ % the argument becomes non-positive: its roman numeral representation % is then empty. Then probe the first two tokens with % \cs{@@_compare:NNw} to determine the relation symbol, building a -% control sequence from it. All the extended forms have an extra |=| +% control sequence from it (\cs{token_to_str:N} gives better errors if +% |#1| is not a character). All the extended forms have an extra |=| % hence the test for that as a second token. If the relation symbol % is unknown, then the control sequence is turned by \TeX{} into % \cs{scan_stop:}, ignored thanks to \tn{unexpanded}, and @@ -1398,7 +1418,12 @@ \cs_new:Npn \@@_compare:NNw #1#2#3 \q_mark { \etex_unexpanded:D - \use:c { @@_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } + \use:c + { + @@_compare_ \token_to_str:N #1 + \if_meaning:w = #2 = \fi: + :NNw + } \__prg_compare_error:Nw #1 } % \end{macrocode} @@ -1633,26 +1658,34 @@ % \subsection{Integer step functions} % % \begin{macro}{\int_step_function:nnnN} -% \begin{macro}[aux]{\@@_step:NnnnN} +% \begin{macro}[aux]{\@@_step:wwwN, \@@_step:NnnnN} +% Before all else, evaluate the initial value, step, and final value. % Repeating a function by steps first needs a check on the direction -% of the steps. After that, do the function for the start value -% then step and loop around. It would be more symmetrical to test -% for a step size of zero before checking the sign, but we optimize -% for the most frequent case (positive step). +% of the steps. After that, do the function for the start value then +% step and loop around. It would be more symmetrical to test for a +% step size of zero before checking the sign, but we optimize for the +% most frequent case (positive step). % \begin{macrocode} -\cs_new:Npn \int_step_function:nnnN #1#2#3#4 +\cs_new:Npn \int_step_function:nnnN #1#2#3 + { + \exp_after:wN \@@_step:wwwN + \int_use:N \@@_eval:w #1 \exp_after:wN ; + \int_use:N \@@_eval:w #2 \exp_after:wN ; + \int_use:N \@@_eval:w #3 ; + } +\cs_new:Npn \@@_step:wwwN #1; #2; #3; #4 { \int_compare:nNnTF {#2} > \c_zero - { \exp_args:NNf \@@_step:NnnnN > } + { \@@_step:NnnnN > } { \int_compare:nNnTF {#2} = \c_zero { \__msg_kernel_expandable_error:nnn { kernel } { zero-step } {#4} \use_none:nnnn } - { \exp_args:NNf \@@_step:NnnnN < } + { \@@_step:NnnnN < } } - { \int_eval:n {#1} } {#2} {#3} #4 + {#1} {#2} {#3} #4 } \cs_new:Npn \@@_step:NnnnN #1#2#3#4#5 { @@ -1829,7 +1862,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\int_to_base:nn} +% \begin{macro}{\int_to_base:nn, \int_to_Base:nn} % \UnitTested % \begin{macro}[aux]{\@@_to_base:nn, \@@_to_Base:nn, % \@@_to_base:nnN,\@@_to_Base:nnN,\@@_to_base:nnnN,\@@_to_Base:nnnN} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 4aa9f0d1692..b13c1a32ff0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3keys.dtx 4753 2014-05-08 20:12:49Z joseph $ +\GetIdInfo$Id: l3keys.dtx 5093 2014-06-08 20:33:14Z joseph $ {L3 Key-value interfaces} %</driver|package> %<*driver> @@ -1312,32 +1312,76 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_choice_make:} +% \begin{macro}[int]{\@@_choice_make:, \@@_multichoice_make:} +% \begin{macro}[int]{\@@_choice_make:N} +% \begin{macro}[aux]{\@@_choice_make_aux:N} +% \begin{macro}[aux]{\@@_parent:n, \@@_parent:o} +% \begin{macro}[aux]{\@@_parent:wn} % To make a choice from a key, two steps: set the code, and set the -% unknown key. +% unknown key. There is one point to watch here: choice keys cannot be +% nested! As multichoices and choices are essentially the same bar one +% function, the code is given together. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_choice_make: + { \@@_choice_make:N \@@_choice_find:n } +\cs_new_protected_nopar:Npn \@@_multichoice_make: + { \@@_choice_make:N \@@_multichoice_find:n } +\cs_new_protected_nopar:Npn \@@_choice_make:N #1 + { + \prop_if_exist:cTF { \c_@@_info_root_tl \@@_parent:o \l_keys_path_tl } + { + \prop_get:cnNTF { \c_@@_info_root_tl \@@_parent:o \l_keys_path_tl } + { choice } \l_keys_value_tl + { + \__msg_kernel_error:nnxx { kernel } { nested-choice-key } + { \l_keys_path_tl } { \@@_parent:o \l_keys_path_tl } + } + { \@@_choice_make_aux:N #1 } + } + { \@@_choice_make_aux:N #1 } + } +\cs_new_protected_nopar:Npn \@@_choice_make_aux:N #1 { - \@@_cmd_set:nn { \l_keys_path_tl } - { \@@_choice_find:n {##1} } + \@@_cmd_set:nn { \l_keys_path_tl } { #1 {##1} } + \prop_put:cnn { \c__keys_info_root_tl \l_keys_path_tl } { choice } + { true } \@@_cmd_set:nn { \l_keys_path_tl / unknown } { \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } +\cs_new:Npn \@@_parent:n #1 + { \@@_parent:wn #1 / / \q_stop { } } +\cs_generate_variant:Nn \@@_parent:n { o } +\cs_new:Npn \@@_parent:wn #1 / #2 / #3 \q_stop #4 + { + \tl_if_blank:nTF {#2} + { \use_none:n #4 } + { + \@@_parent:wn #2 / #3 \q_stop { #4 / #1 } + } + } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % -% \begin{macro}[int]{\@@_choices_make:nn} +% \begin{macro}[int]{\@@_choices_make:nn, \@@_multichoices_make:nn} +% \begin{macro}[aux]{\@@_choices_make:Nnn} % Auto-generating choices means setting up the root key as a choice, then % defining each choice in turn. % \begin{macrocode} -\cs_new_protected:Npn \@@_choices_make:nn #1#2 +\cs_new_protected_nopar:Npn \@@_choices_make:nn + { \@@_choices_make:Nnn \@@_choice_make: } +\cs_new_protected_nopar:Npn \@@_multichoices_make:nn + { \@@_choices_make:Nnn \@@_multichoice_make: } +\cs_new_protected:Npn \@@_choices_make:Nnn #1#2#3 { - \@@_choice_make: + #1 \int_zero:N \l_keys_choice_int - \clist_map_inline:nn {#1} + \clist_map_inline:nn {#2} { \int_incr:N \l_keys_choice_int \@@_cmd_set:nx { \l_keys_path_tl / ##1 } @@ -1345,12 +1389,13 @@ \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } - \exp_not:n {#2} + \exp_not:n {#3} } } } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[int] % {\@@_cmd_set:nn, \@@_cmd_set:nx, \@@_cmd_set:Vn, \@@_cmd_set:Vo} @@ -1423,47 +1468,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_multichoice_find:n} -% \begin{macro}[int]{\@@_multichoice_make:} -% \begin{macro}[int]{\@@_multichoices_make:nn} -% Choices where several values can be selected are very similar to normal -% exclusive choices. There is just a slight change in implementation to -% map across a comma-separated list. This then requires that the appropriate -% set up takes place elsewhere. -% \begin{macrocode} -\cs_new:Npn \@@_multichoice_find:n #1 - { \clist_map_function:nN {#1} \@@_choice_find:n } -\cs_new_protected_nopar:Npn \@@_multichoice_make: - { - \@@_cmd_set:nn { \l_keys_path_tl } - { \@@_multichoice_find:n {##1} } - \@@_cmd_set:nn { \l_keys_path_tl / unknown } - { - \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } - { \l_keys_path_tl } {##1} - } - } -\cs_new_protected:Npn \@@_multichoices_make:nn #1#2 - { - \@@_multichoice_make: - \int_zero:N \l_keys_choice_int - \clist_map_inline:nn {#1} - { - \int_incr:N \l_keys_choice_int - \@@_cmd_set:nx { \l_keys_path_tl / ##1 } - { - \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} - \int_set:Nn \exp_not:N \l_keys_choice_int - { \int_use:N \l_keys_choice_int } - \exp_not:n {#2} - } - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}[int]{\@@_value_requirement:n} % Values can be required or forbidden by having the appropriate marker % set. First, both the required and forbidden ones are clear, just in case! @@ -2079,17 +2083,22 @@ % \end{macro} % % \begin{macro}[int, EXP]{\@@_choice_find:n} +% \begin{macro}[int, EXP]{\@@_multichoice_find:n} % Executing a choice has two parts. First, try the choice given, then % if that fails call the unknown key. That will exist, as it is created % when a choice is first made. So there is no need for any escape code. +% For multiple choices, the same code ends up used in a mapping. % \begin{macrocode} \cs_new:Npn \@@_choice_find:n #1 { \@@_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } { \@@_execute:nn { \l_keys_path_tl / unknown } { } } } +\cs_new:Npn \@@_multichoice_find:n #1 + { \clist_map_function:nN {#1} \@@_choice_find:n } % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Utilities} % @@ -2146,7 +2155,7 @@ \__msg_kernel_new:nnnn { kernel } { key-no-property } { No~property~given~in~definition~of~key~'#1'. } { - \c_msg_coding_error_text_tl + \c__msg_coding_error_text_tl Inside~\keys_define:nn each~key~name~ needs~a~property: \\ \\ \iow_indent:n { #1 .<property> } \\ \\ @@ -2158,17 +2167,23 @@ The~module~'#2'~does~not~have~a~key~called~#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } +\__msg_kernel_new:nnnn { kernel } { nested-choice-key } + { Attempt~to~define~'#1'~as~a~nested~choice~key. } + { + The~key~'#1'~cannot~be~defined~as~a~choice~as~the~parent~key~'#2'~is~ + itself~a~choice. + } \__msg_kernel_new:nnnn { kernel } { property-requires-value } { The~property~'#1'~requires~a~value. } { - \c_msg_coding_error_text_tl + \c__msg_coding_error_text_tl LaTeX~was~asked~to~set~property~'#1'~for~key~'#2'.\\ No~value~was~given~for~the~property,~and~one~is~required. } \__msg_kernel_new:nnnn { kernel } { property-unknown } { The~key~property~'#1'~is~unknown. } { - \c_msg_coding_error_text_tl + \c__msg_coding_error_text_tl LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } @@ -2240,7 +2255,7 @@ \__msg_kernel_new:nnnn { kernel } { generate-choices-before-code } { No~code~available~to~generate~choices~for~key~'#1'. } { - \c_msg_coding_error_text_tl + \c__msg_coding_error_text_tl Before~using~.generate_choices:n~the~code~should~be~defined~ with~'.choice_code:n'~or~'.choice_code:x'. } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx deleted file mode 100644 index ccecf9c4f48..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ /dev/null @@ -1,501 +0,0 @@ -% \iffalse meta-comment -% -%% File: l3luatex.dtx Copyright (C) 2010-2014 The 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 -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the "l3kernel bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX3 Project. -%% -%% ----------------------------------------------------------------------- -% -%<*driver> -\documentclass[full]{l3doc} -%</driver> -%<*driver|package> -\GetIdInfo$Id: l3luatex.dtx 4712 2014-04-30 08:17:49Z joseph $ - {L3 Experimental LuaTeX-specific functions} -%</driver|package> -%<*driver> -\begin{document} - \DocInput{\jobname.dtx} -\end{document} -%</driver> -% \fi -% -% \title{^^A -% The \pkg{l3luatex} package\\ LuaTeX-specific functions^^A -% \thanks{This file describes v\ExplFileVersion, -% last revised \ExplFileDate.}^^A -% } -% -% \author{^^A -% The \LaTeX3 Project\thanks -% {^^A -% E-mail: -% \href{mailto:latex-team@latex-project.org} -% {latex-team@latex-project.org}^^A -% }^^A -% } -% -% \date{Released \ExplFileDate} -% -% \maketitle -% -% \begin{documentation} -% -% \section{Breaking out to \Lua{}} -% -% The \LuaTeX{} engine provides access to the \Lua{} programming language, -% and with it access to the \enquote{internals} of \TeX{}. In order to use -% this within the framework provided here, a family of functions is -% available. When used with \pdfTeX{} or \XeTeX{} these will raise an -% error: use \cs{luatex_if_engine:T} to avoid this. Details of coding -% the \LuaTeX{} engine are detailed in the \LuaTeX{} manual. -% -% \begin{function}[EXP, updated = 2012-08-02]{\lua_now:n, \lua_now:x} -% \begin{syntax} -% \cs{lua_now:n} \Arg{token list} -% \end{syntax} -% The \meta{token list} is first tokenized by \TeX{}, which will include -% converting line ends to spaces in the usual \TeX{} manner and which -% respects currently-applicable \TeX{} category codes. The resulting -% \meta{\Lua{} input} is passed to the \Lua{} interpreter for processing. -% Each \cs{lua_now:n} block is treated by \Lua{} as a separate chunk. -% The \Lua{} interpreter will execute the \meta{\Lua{} input} immediately, -% and in an expandable manner. -% \end{function} -% -% \begin{function}[EXP, added = 2012-08-02]{\lua_now_x:n, \lua_now_x:x} -% \begin{syntax} -% \cs{lua_now_x:n} \Arg{token list} -% \end{syntax} -% The \meta{token list} is first tokenized and expanded by \TeX{}, which -% will include converting line ends to spaces in the usual \TeX{} manner and -% which respects currently-applicable \TeX{} category codes. The resulting -% \meta{\Lua{} input} is passed to the \Lua{} interpreter for processing. -% Each \cs{lua_now_x:n} block is treated by \Lua{} as a separate chunk. -% The \Lua{} interpreter will execute the \meta{\Lua{} input} immediately, -% and in an expandable manner. -% \begin{texnote} -% \cs{lua_now_x:n} is the \LuaTeX{} primitive \tn{directlua} renamed. -% \end{texnote} -% \end{function} -% -% \begin{function}{\lua_shipout:n, \lua_shipout:x} -% \begin{syntax} -% \cs{lua_shipout:n} \Arg{token list} -% \end{syntax} -% The \meta{token list} is first tokenized by \TeX{}, which will include -% converting line ends to spaces in the usual \TeX{} manner and which -% respects currently-applicable \TeX{} category codes. The resulting -% \meta{\Lua{} input} is passed to the \Lua{} interpreter when the -% current page is finalised (\emph{i.e.}~at shipout). Each -% \cs{lua_shipout:n} block is treated by \Lua{} as a separate chunk. -% The \Lua{} interpreter will execute the \meta{\Lua{} input} during the -% page-building routine: no \TeX{} expansion of the \meta{\Lua{} input} -% will occur at this stage. -% \begin{texnote} -% At a \TeX{} level, the \meta{\Lua{} input} is stored as a -% \enquote{whatsit}. -% \end{texnote} -% \end{function} -% -% \begin{function}{\lua_shipout_x:n, \lua_shipout_x:x} -% \begin{syntax} -% \cs{lua_shipout:n} \Arg{token list} -% \end{syntax} -% The \meta{token list} is first tokenized by \TeX{}, which will include -% converting line ends to spaces in the usual \TeX{} manner and which -% respects currently-applicable \TeX{} category codes. The resulting -% \meta{\Lua{} input} is passed to the \Lua{} interpreter when the -% current page is finalised (\emph{i.e.}~at shipout). Each -% \cs{lua_shipout:n} block is treated by \Lua{} as a separate chunk. -% The \Lua{} interpreter will execute the \meta{\Lua{} input} during the -% page-building routine: the \meta{\Lua{} input} is expanded during this -% process in addition to any expansion when the argument was read. This -% makes these functions suitable for including material finalised -% during the page building process (such as the page number). -% \begin{texnote} -% \cs{lua_shipout_x:n} is the \LuaTeX{} primitive \tn{latelua} -% named using the \LaTeX3 scheme. -% -% At a \TeX{} level, the \meta{\Lua{} input} is stored as a -% \enquote{whatsit}. -% \end{texnote} -% \end{function} -% -% \section{Category code tables} -% -% As well as providing methods to break out into \Lua{}, there are -% places where additional \LaTeX3 functions are provided by the -% \LuaTeX{} engine. In particular, \LuaTeX{} provides category code -% tables. These can be used to ensure that a set of category codes -% are in force in a more robust way than is possible with other -% engines. These are therefore used by \cs{ExplSyntaxOn} and -% \pkg{ExplSyntaxOff} when using the \LuaTeX{} engine. -% -% \begin{function}{\cctab_new:N} -% \begin{syntax} -% \cs{cctab_new:N} \meta{category code table} -% \end{syntax} -% Creates a new category code table, initially with the codes as -% used by \IniTeX{}. -% \end{function} -% -% \begin{function}{\cctab_gset:Nn} -% \begin{syntax} -% \cs{cctab_gset:Nn} \meta{category code table} \Arg{category code set up} -% \end{syntax} -% Sets the \meta{category code table} to apply the category codes -% which apply when the prevailing r{\'e}gime is modified by the -% \meta{category code set up}. Thus within a standard code block -% the starting point will be the code applied by \cs{c_code_cctab}. -% The assignment of the table is global: the underlying primitive does -% not respect grouping. -% \end{function} -% -% \begin{function}{\cctab_begin:N} -% \begin{syntax} -% \cs{cctab_begin:N} \meta{category code table} -% \end{syntax} -% Switches the category codes in force to those stored in the -% \meta{category code table}. The prevailing codes before the -% function is called are added to a stack, for use with -% \cs{cctab_end:}. -% \end{function} -% -% \begin{function}{\cctab_end:} -% \begin{syntax} -% \cs{cctab_end:} -% \end{syntax} -% Ends the scope of a \meta{category code table} started using -% \cs{cctab_begin:N}, retuning the codes to those in force before the -% matching \cs{cctab_begin:N} was used. -% \end{function} -% -% \begin{variable}{\c_code_cctab} -% Category code table for the code environment. This does not include -% setting the behaviour of the line-end character, which is only -% altered by \cs{ExplSyntaxOn}. -% \end{variable} -% -% \begin{variable}{\c_document_cctab} -% Category code table for a standard \LaTeX{} document. This does not -% include setting the behaviour of the line-end character, which is -% only altered by \cs{ExplSyntaxOff}. -% \end{variable} -% -% \begin{variable}{\c_initex_cctab} -% Category code table as set up by \IniTeX{}. -% \end{variable} -% -% \begin{variable}{\c_other_cctab} -% Category code table where all characters have category code $12$ -% (other). -% \end{variable} -% -% \begin{variable}{\c_str_cctab} -% Category code table where all characters have category code $12$ -% (other) with the exception of spaces, which have category code -% $10$ (space). -% \end{variable} -% -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3luatex} implementation} -% -% \begin{macrocode} -%<*initex|package> -% \end{macrocode} -% -% \begin{macro}{\lua_now_x:n, \lua_now_x:x} -% \begin{macro}{\lua_now:n, \lua_now:x} -% \begin{macro}{\lua_shipout_x:n, \lua_shipout_x:x} -% \begin{macro}{\lua_shipout:n, \lua_shipout:x} -% When \LuaTeX{} is in use, this is all a question of primitives with new -% names. On the other hand, for \pdfTeX{} and \XeTeX{} the argument should -% be removed from the input stream before issuing an error. This is -% expandable, using \cs{__msg_kernel_expandable_error:nnn} -% as done for \texttt{V}-type expansion in \pkg{l3expan}. -% \begin{macrocode} -\luatex_if_engine:TF - { - \cs_new_eq:NN \lua_now_x:n \luatex_directlua:D - \cs_new_eq:NN \lua_shipout_x:n \luatex_latelua:D - } - { - \cs_new:Npn \lua_now_x:n #1 - { - \__msg_kernel_expandable_error:nnn - { kernel } { bad-engine } { \lua_now_x:n } - } - \cs_new_protected:Npn \lua_shipout_x:n #1 - { - \__msg_kernel_expandable_error:nnn - { kernel } { bad-engine } { \lua_shipout_x:n } - } - } -\cs_generate_variant:Nn \lua_now_x:n { x } -\cs_new:Npn \lua_now:n #1 - { \lua_now_x:n { \exp_not:n {#1} } } -\cs_generate_variant:Nn \lua_now:n { x } -\cs_generate_variant:Nn \lua_shipout_x:n { x } -\cs_new_protected:Npn \lua_shipout:n #1 - { \lua_shipout_x:n { \exp_not:n {#1} } } -\cs_generate_variant:Nn \lua_shipout:n { x } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Category code tables} -% -% \begin{macrocode} -%<@@=cctab> -% \end{macrocode} -% -% \begin{variable}{\g_@@_allocate_int} -% \begin{variable}{\g_@@_stack_int} -% \begin{variable}{\g_@@_stack_seq} -% To allocate category code tables, both the read-only and stack -% tables need to be followed. There is also a sequence stack for the -% dynamic tables themselves. -% \begin{macrocode} -\int_new:N \g_@@_allocate_int -\int_set:Nn \g_@@_allocate_int { \c_minus_one } -\int_new:N \g_@@_stack_int -\seq_new:N \g_@@_stack_seq -% \end{macrocode} -% \end{variable} -% \end{variable} -% \end{variable} -% -% \begin{macro}{\cctab_new:N} -% Creating a new category code table is done slightly differently -% from other registers. Low-numbered tables are more efficiently-stored -% than high-numbered ones. There is also a need to have a stack of -% flexible tables as well as the set of read-only ones. To satisfy both -% of these requirements, odd numbered tables are used for read-only -% tables, and even ones for the stack. Here, therefore, the odd numbers -% are allocated. -% \begin{macrocode} -\cs_new_protected:Npn \cctab_new:N #1 - { - \__chk_if_free_cs:N #1 - \int_gadd:Nn \g_@@_allocate_int { \c_two } - \int_compare:nNnTF - \g_@@_allocate_int < { \c_max_register_int + \c_one } - { - \tex_global:D \tex_chardef:D #1 \g_@@_allocate_int - \luatex_initcatcodetable:D #1 - } - { \__msg_kernel_fatal:nnx { kernel } { out-of-registers } { cctab } } - } -\luatex_if_engine:F - { - \cs_set_protected:Npn \cctab_new:N #1 - { - \__msg_kernel_error:nnx { kernel } { bad-engine } - { \exp_not:N \cctab_new:N } - } - } -%<*package> -\luatex_if_engine:T - { - \cs_set_protected:Npn \cctab_new:N #1 - { - \__chk_if_free_cs:N #1 - \newcatcodetable #1 - \luatex_initcatcodetable:D #1 - } - } -%</package> -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\cctab_begin:N} -% \begin{macro}{\cctab_end:} -% \begin{variable}{\l_@@_internal_tl} -% The aim here is to ensure that the saved tables are read-only. This is -% done by using a stack of tables which are not read only, and actually -% having them as \enquote{in use} copies. -% \begin{macrocode} -\cs_new_protected:Npn \cctab_begin:N #1 - { - \seq_gpush:Nx \g_@@_stack_seq { \tex_the:D \luatex_catcodetable:D } - \luatex_catcodetable:D #1 - \int_gadd:Nn \g_@@_stack_int { \c_two } - \int_compare:nNnT \g_@@_stack_int > \c_max_register_int - { \__msg_kernel_fatal:nn { kernel } { cctab-stack-full } } - \luatex_savecatcodetable:D \g_@@_stack_int - \luatex_catcodetable:D \g_@@_stack_int - } -\cs_new_protected_nopar:Npn \cctab_end: - { - \int_gsub:Nn \g_@@_stack_int { \c_two } - \seq_if_empty:NTF \g_@@_stack_seq - { \tl_set:Nn \l_@@_internal_tl { 0 } } - { \seq_gpop:NN \g_@@_stack_seq \l_@@_internal_tl } - \luatex_catcodetable:D \l_@@_internal_tl \scan_stop: - } -\luatex_if_engine:F - { - \cs_set_protected:Npn \cctab_begin:N #1 - { - \__msg_kernel_error:nnxx { kernel } { bad-engine } - { \exp_not:N \cctab_begin:N } {#1} - } - \cs_set_protected_nopar:Npn \cctab_end: - { - \__msg_kernel_error:nnx { kernel } { bad-engine } - { \exp_not:N \cctab_end: } - } - } -%<*package> -\luatex_if_engine:T - { - \cs_set_protected:Npn \cctab_begin:N #1 { \BeginCatcodeRegime #1 } - \cs_set_protected_nopar:Npn \cctab_end: { \EndCatcodeRegime } - } -%</package> -\tl_new:N \l_@@_internal_tl -% \end{macrocode} -% \end{variable} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cctab_gset:Nn} -% Category code tables are always global, so only one version is needed. -% The set up here is simple, and means that at the point of use there is -% no need to worry about escaping category codes. -% \begin{macrocode} -\cs_new_protected:Npn \cctab_gset:Nn #1#2 - { - \group_begin: - #2 - \luatex_savecatcodetable:D #1 - \group_end: - } -\luatex_if_engine:F - { - \cs_set_protected:Npn \cctab_gset:Nn #1#2 - { - \__msg_kernel_error:nnxx { kernel } { bad-engine } - { \exp_not:N \cctab_gset:Nn } { #1 {#2} } - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{variable}{\c_code_cctab} -% \begin{variable}{\c_document_cctab} -% \begin{variable}{\c_initex_cctab} -% \begin{variable}{\c_other_cctab} -% \begin{variable}{\c_str_cctab} -% Creating category code tables is easy using the function above. -% The \texttt{other} and \texttt{string} ones are done by completely -% ignoring the existing codes as this makes life a lot less complex. The -% table for \pkg{expl3} category codes is always needed, whereas when in -% package mode the rest can be copied from the existing \LaTeXe{} package -% \pkg{luatex}. -% \begin{macrocode} -\luatex_if_engine:T - { - \cctab_new:N \c_code_cctab - \cctab_gset:Nn \c_code_cctab { } - } -%<*package> -\luatex_if_engine:T - { - \cs_new_eq:NN \c_document_cctab \CatcodeTableLaTeX - \cs_new_eq:NN \c_initex_cctab \CatcodeTableIniTeX - \cs_new_eq:NN \c_other_cctab \CatcodeTableOther - \cs_new_eq:NN \c_str_cctab \CatcodeTableString - } -%</package> -%<*initex> -\luatex_if_engine:T - { - \cctab_new:N \c_document_cctab - \cctab_new:N \c_other_cctab - \cctab_new:N \c_str_cctab - \cctab_gset:Nn \c_document_cctab - { - \char_set_catcode_space:n { 9 } - \char_set_catcode_space:n { 32 } - \char_set_catcode_other:n { 58 } - \char_set_catcode_math_subscript:n { 95 } - \char_set_catcode_active:n { 126 } - } - \cctab_gset:Nn \c_other_cctab - { - \int_step_inline:nnnn { 0 } { 1 } { 127 } - { \char_set_catcode_other:n {#1} } - } - \cctab_gset:Nn \c_str_cctab - { - \int_step_inline:nnnn { 0 } { 1 } { 127 } - { \char_set_catcode_other:n {#1} } - \char_set_catcode_space:n { 32 } - } - } -%</initex> -% \end{macrocode} -% \end{variable} -% \end{variable} -% \end{variable} -% \end{variable} -% \end{variable} -% -% \subsection{Messages} -% -% \begin{macrocode} -\__msg_kernel_new:nnnn { kernel } { bad-engine } - { LuaTeX~engine~not~in~use!~Ignoring~#1. } - { - The~feature~you~are~using~is~only~available~ - with~the~LuaTeX~engine.~LaTeX3~ignored~`#1#2'. - } -\__msg_kernel_new:nnnn { kernel } { cctab-stack-full } - { The~category~code~table~stack~is~exhausted. } - { - LaTeX~has~been~asked~to~switch~to~a~new~category~code~table,~ - but~there~is~no~more~space~to~do~this! - } -% \end{macrocode} -% -% \begin{macrocode} -%</initex|package> -% \end{macrocode} -% -%\end{implementation} -% -%\PrintIndex diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 44a558917aa..1adc34d8e17 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3msg.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3msg.dtx 4943 2014-05-30 17:26:32Z bruno $ {L3 Messages} %</driver|package> %<*driver> @@ -759,6 +759,14 @@ % the \cs{__msg_show_item:nn} and \cs{__msg_show_item_unbraced:nn} versions % for key--value like data structures. % \end{function} +% +% \begin{variable}{\c__msg_coding_error_text_tl} +% The text +% \begin{verbatim} +% This is a coding error. +% \end{verbatim} +% used by kernel functions when erroneous programming input is encountered. +% \end{variable} % % \end{documentation} % @@ -878,45 +886,45 @@ % % \begin{variable} % { -% \c_msg_coding_error_text_tl , -% \c_msg_continue_text_tl , -% \c_msg_critical_text_tl , -% \c_msg_fatal_text_tl , -% \c_msg_help_text_tl , -% \c_msg_no_info_text_tl , -% \c_msg_on_line_text_tl , -% \c_msg_return_text_tl , -% \c_msg_trouble_text_tl +% \c_@@_coding_error_text_tl , +% \c_@@_continue_text_tl , +% \c_@@_critical_text_tl , +% \c_@@_fatal_text_tl , +% \c_@@_help_text_tl , +% \c_@@_no_info_text_tl , +% \c_@@_on_line_text_tl , +% \c_@@_return_text_tl , +% \c_@@_trouble_text_tl % } % Simple pieces of text for messages. % \begin{macrocode} -\tl_const:Nn \c_msg_coding_error_text_tl +\tl_const:Nn \c_@@_coding_error_text_tl { This~is~a~coding~error. \\ \\ } -\tl_const:Nn \c_msg_continue_text_tl +\tl_const:Nn \c_@@_continue_text_tl { Type~<return>~to~continue } -\tl_const:Nn \c_msg_critical_text_tl - { Reading~the~current~file~will~stop. } -\tl_const:Nn \c_msg_fatal_text_tl +\tl_const:Nn \c_@@_critical_text_tl + { Reading~the~current~file~'\g_file_current_name_tl'~will~stop. } +\tl_const:Nn \c_@@_fatal_text_tl { This~is~a~fatal~error:~LaTeX~will~abort. } -\tl_const:Nn \c_msg_help_text_tl +\tl_const:Nn \c_@@_help_text_tl { For~immediate~help~type~H~<return> } -\tl_const:Nn \c_msg_no_info_text_tl +\tl_const:Nn \c_@@_no_info_text_tl { LaTeX~does~not~know~anything~more~about~this~error,~sorry. - \c_msg_return_text_tl + \c_@@_return_text_tl } -\tl_const:Nn \c_msg_on_line_text_tl { on~line } -\tl_const:Nn \c_msg_return_text_tl +\tl_const:Nn \c_@@_on_line_text_tl { on~line } +\tl_const:Nn \c_@@_return_text_tl { \\ \\ Try~typing~<return>~to~proceed. \\ If~that~doesn't~work,~type~X~<return>~to~quit. } -\tl_const:Nn \c_msg_trouble_text_tl +\tl_const:Nn \c_@@_trouble_text_tl { \\ \\ More~errors~will~almost~certainly~follow: \\ @@ -932,7 +940,7 @@ \cs_new_nopar:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D } \cs_gset_nopar:Npn \msg_line_context: { - \c_msg_on_line_text_tl + \c_@@_on_line_text_tl \c_space_tl \msg_line_number: } @@ -953,12 +961,12 @@ { \tl_if_empty:nTF {#3} { - \@@_interrupt_wrap:nn { \\ \c_msg_no_info_text_tl } - {#1 \\\\ #2 \\\\ \c_msg_continue_text_tl } + \@@_interrupt_wrap:nn { \\ \c_@@_no_info_text_tl } + {#1 \\\\ #2 \\\\ \c_@@_continue_text_tl } } { \@@_interrupt_wrap:nn { \\ #3 } - {#1 \\\\ #2 \\\\ \c_msg_help_text_tl } + {#1 \\\\ #2 \\\\ \c_@@_help_text_tl } } } % \end{macrocode} @@ -1171,7 +1179,7 @@ \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} \msg_see_documentation_text:n {#1} } - { \c_msg_fatal_text_tl } + { \c_@@_fatal_text_tl } \tex_end:D } % \end{macrocode} @@ -1199,7 +1207,7 @@ \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} \msg_see_documentation_text:n {#1} } - { \c_msg_critical_text_tl } + { \c_@@_critical_text_tl } \tex_endinput:D } % \end{macrocode} @@ -1732,25 +1740,25 @@ \@@_kernel_new:nnnn { kernel } { message-already-defined } { Message~'#2'~for~module~'#1'~already~defined. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~was~asked~to~define~a~new~message~called~'#2'\ by~the~module~'#1':~this~message~already~exists. - \c_msg_return_text_tl + \c_@@_return_text_tl } \@@_kernel_new:nnnn { kernel } { message-unknown } { Unknown~message~'#2'~for~module~'#1'. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~was~asked~to~display~a~message~called~'#2'\\ by~the~module~'#1':~this~message~does~not~exist. - \c_msg_return_text_tl + \c_@@_return_text_tl } \@@_kernel_new:nnnn { kernel } { message-class-unknown } { Unknown~message~class~'#1'. } { LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\ this~was~never~defined. - \c_msg_return_text_tl + \c_@@_return_text_tl } \@@_kernel_new:nnnn { kernel } { message-redirect-loop } { @@ -1770,7 +1778,7 @@ \@@_kernel_new:nnnn { kernel } { bad-number-of-arguments } { Function~'#1'~cannot~be~defined~with~#2~arguments. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~define~a~function~'#1'~with~ #2~arguments.~ TeX~allows~between~0~and~9~arguments~for~a~single~function. @@ -1778,7 +1786,7 @@ \@@_kernel_new:nnnn { kernel } { command-already-defined } { Control~sequence~#1~already~defined. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~create~a~new~control~sequence~'#1'~ but~this~name~has~already~been~used~elsewhere. \\ \\ The~current~meaning~is:\\ @@ -1787,14 +1795,14 @@ \@@_kernel_new:nnnn { kernel } { command-not-defined } { Control~sequence~#1~undefined. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~use~a~command~#1,~but~this~has~not~ been~defined~yet. } \@@_kernel_new:nnnn { kernel } { empty-search-pattern } { Empty~search~pattern. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~ would~lead~to~an~infinite~loop! } @@ -1808,7 +1816,7 @@ \@@_kernel_new:nnnn { kernel } { missing-colon } { Function~'#1'~contains~no~':'. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl Code-level~functions~must~contain~':'~to~separate~the~ argument~specification~from~the~function~name.~This~is~ needed~when~defining~conditionals~or~variants,~or~when~building~a~ @@ -1817,17 +1825,18 @@ \@@_kernel_new:nnnn { kernel } { protected-predicate } { Predicate~'#1'~must~be~expandable. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~define~'#1'~as~a~protected~predicate.~ Only~expandable~tests~can~have~a~predicate~version. } \@@_kernel_new:nnnn { kernel } { conditional-form-unknown } { Conditional~form~'#1'~for~function~'#2'~unknown. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. } +%<*package> \bool_if:NT \l@expl@check@declarations@bool { \@@_kernel_new:nnnn { check } { non-declared-variable } @@ -1841,24 +1850,25 @@ LaTeX~will~create~the~variable~and~continue. } } +%</package> \@@_kernel_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~create~a~new~scan~mark~'#1'~ but~this~name~has~already~been~used~for~a~scan~mark. } \@@_kernel_new:nnnn { kernel } { variable-not-defined } { Variable~#1~undefined. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ been~defined~yet. } \@@_kernel_new:nnnn { kernel } { variant-too-long } { Variant~form~'#1'~longer~than~base~signature~of~'#2'. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ with~a~signature~starting~with~'#1',~but~that~is~longer~than~ the~signature~(part~after~the~colon)~of~'#2'. @@ -1866,7 +1876,7 @@ \@@_kernel_new:nnnn { kernel } { invalid-variant } { Variant~form~'#1'~invalid~for~base~form~'#2'. } { - \c_msg_coding_error_text_tl + \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~ from~type~'#3'~to~type~'#4'. @@ -1885,7 +1895,7 @@ \@@_kernel_new:nnn { kernel } { negative-replication } { Negative~argument~for~\prg_replicate:nn. } \@@_kernel_new:nnn { kernel } { unknown-comparison } - { Relation~symbol~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } + { Relation~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } \@@_kernel_new:nnn { kernel } { zero-step } { Zero~step~size~for~step~function~#1. } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index b2e834d843c..1132202df40 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3names.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3names.dtx 4993 2014-06-02 09:39:35Z joseph $ {L3 Namespace for primitives} %</driver|package> %<*driver> @@ -146,6 +146,12 @@ % \end{macrocode} %\end{macro} % +% To allow extracting \enquote{just the names}, a bit of DocStrip fiddling. +% \begin{macrocode} +%</initex|package> +%<*initex|names|package> +% \end{macrocode} +% % In the current incarnation of this package, all \TeX{} primitives % are given a new name of the form |\tex_|\emph{oldname}|:D|. % But first three special cases which have symbolic original names. @@ -593,6 +599,7 @@ % \begin{macrocode} \__kernel_primitive:NN \catcodetable \luatex_catcodetable:D \__kernel_primitive:NN \directlua \luatex_directlua:D + \__kernel_primitive:NN \expanded \luatex_expanded:D \__kernel_primitive:NN \initcatcodetable \luatex_initcatcodetable:D \__kernel_primitive:NN \latelua \luatex_latelua:D \__kernel_primitive:NN \luaescapestring \luatex_luaescapestring:D @@ -611,20 +618,16 @@ \__kernel_primitive:NN \pardir \luatex_pardir:D \__kernel_primitive:NN \textdir \luatex_textdir:D % \end{macrocode} -% The job is done: close the group (using the primitive renamed!). +% +% End of the \enquote{just the names} part of the source. % \begin{macrocode} -\tex_endgroup:D +%</initex|names|package> +%<*initex|package> % \end{macrocode} -% If the underlying engine is Lua\TeX{} then the \tn{pdfstrcmp} primitive -% is emulated as \cs{expl_pdfstrcmp} as part of the bootstrap process. -% That can be detected as \cs{pdftex_strcmp:D} will not be defined: is -% that is the case, copy the code and then remove the temporary emulation. +% +% The job is done: close the group (using the primitive renamed!). % \begin{macrocode} -\etex_ifdefined:D \pdftex_strcmp:D -\tex_else:D - \tex_let:D \pdftex_strcmp:D \expl_pdfstrcmp - \tex_let:D \expl_pdfstrcmp \tex_undefined:D -\tex_fi:D +\tex_endgroup:D % \end{macrocode} % % \LaTeXe{} will have moved a few primitives, so these are sorted out. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index e204fe0dec2..29352c0212b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3quark.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3quark.dtx 4889 2014-05-26 19:59:25Z joseph $ {L3 Quarks} %</driver|package> %<*driver> @@ -264,28 +264,6 @@ % ended. % \end{function} % -% \section{Clearing quarks away} -% -% \begin{function}{\use_none_delimit_by_q_recursion_stop:w} -% \begin{syntax} -% \cs{use_none_delimit_by_q_recursion_stop:w} \meta{tokens} \cs{q_recursion_stop} -% \end{syntax} -% Used to prematurely terminate a recursion using \cs{q_recursion_stop} -% as the end marker, removing any remaining \meta{tokens} from the -% input stream. -% \end{function} -% -% \begin{function}{\use_i_delimit_by_q_recursion_stop:nw} -% \begin{syntax} -% \cs{use_i_delimit_by_q_recursion_stop:nw} \Arg{insertion} -% ~~\meta{tokens} \cs{q_recursion_stop} -% \end{syntax} -% Used to prematurely terminate a recursion using \cs{q_recursion_stop} -% as the end marker, removing any remaining \meta{tokens} from the -% input stream. The \meta{insertion} is then made into the input -% stream after the end of the recursion. -% \end{function} -% % \section{An example of recursion with quarks} % \label{sec:l3quark:quark-example} % @@ -488,14 +466,14 @@ % \begin{macrocode} \cs_new:Npn \quark_if_recursion_tail_stop:n #1 { - \if_int_compare:w \pdftex_strcmp:D + \if_int_compare:w \__str_if_eq_x:nn { \exp_not:N \q_recursion_tail } { \exp_not:n {#1} } = \c_zero \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: } \cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1 { - \if_int_compare:w \pdftex_strcmp:D + \if_int_compare:w \__str_if_eq_x:nn { \exp_not:N \q_recursion_tail } { \exp_not:n {#1} } = \c_zero \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw \else: @@ -521,7 +499,7 @@ } \cs_new:Npn \__quark_if_recursion_tail_break:nN #1#2 { - \if_int_compare:w \pdftex_strcmp:D + \if_int_compare:w \__str_if_eq_x:nn { \exp_not:N \q_recursion_tail } { \exp_not:n {#1} } = \c_zero \exp_after:wN #2 \fi: @@ -572,7 +550,7 @@ % \begin{macrocode} \prg_new_conditional:Nnn \quark_if_nil:n { p, T , F , TF } { - \if_int_compare:w \pdftex_strcmp:D + \if_int_compare:w \__str_if_eq_x:nn { \exp_not:N \q_nil } { \exp_not:n {#1} } = \c_zero \prg_return_true: \else: @@ -581,7 +559,7 @@ } \prg_new_conditional:Nnn \quark_if_no_value:n { p, T , F , TF } { - \if_int_compare:w \pdftex_strcmp:D + \if_int_compare:w \__str_if_eq_x:nn { \exp_not:N \q_no_value } { \exp_not:n {#1} } = \c_zero \prg_return_true: \else: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index abd4bac865d..f773f3e2867 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3skip.dtx 4738 2014-05-05 08:00:05Z joseph $ +\GetIdInfo$Id: l3skip.dtx 4972 2014-05-31 16:42:18Z bruno $ {L3 Dimensions and skips} %</driver|package> %<*driver> @@ -900,7 +900,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2011-11-11, EXP] +% \begin{function}[added = 2011-11-11, updated=2014-05-31, EXP] % {\__dim_strip_bp:n, \__dim_strip_pt:n} % \begin{syntax} % \cs{__dim_strip_bp:n} \Arg{dimension expression} @@ -912,15 +912,11 @@ % and applying the standard mathematical rules. The magnitude of the % result, expressed in big points (\texttt{bp}) or points (\texttt{pt}), % will be left in the input stream with \emph{no units}. If the decimal -% part of the magnitude is zero, this will be omitted. -% -% If the \Arg{dimension expression} contains additional units, these will -% be ignored, so for example +% part of the magnitude is zero, it will be omitted. For example, % \begin{verbatim} -% \__dim_strip_pt:n { 1 bp pt } +% \__dim_strip_pt:n { 2.5 pt * 2 } % \end{verbatim} -% will leave |1.00374| in the input stream (\emph{i.e.}~the magnitude of -% one \enquote{big point} when converted to points). +% will leave~|5| in the input stream. % \end{function} % % \end{documentation} @@ -1349,38 +1345,34 @@ % integer fraction for $72/72.27$. % \begin{macrocode} \cs_new:Npn \@@_strip_bp:n #1 - { - \__dim_strip_pt:n - { - \__dim_eval:w ( #1 ) * 800 / 803 \__dim_eval_end: - } - } + { \@@_strip_pt:n { ( #1 ) * 800 / 803 } } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP]{\@@_strip_pt:n} % \begin{macro}[EXP, aux]{\@@_strip_pt:w} -% A function which comes up often enough to deserve a place in the kernel. -% The idea here is that the input is assumed to be in \texttt{pt}, but can -% be given in other units, while the output is the value of the dimension -% in \texttt{pt} but with no units given. This is used a lot by low-level +% A function which comes up often enough to deserve a place in the +% kernel. Evaluate the dimension expression~|#1| then remove the +% trailing \texttt{pt}. The argument is put in parentheses as this +% prevents the dimension expression from terminating early and leaving +% extra tokens lying around. This is used a lot by low-level % manipulations. % \begin{macrocode} \cs_new:Npn \@@_strip_pt:n #1 { \exp_after:wN - \@@_strip_pt:w \dim_use:N \@@_eval:w #1 \@@_eval_end: \q_stop + \@@_strip_pt:w \dim_use:N \@@_eval:w (#1) \@@_eval_end: } \use:x { \cs_new:Npn \exp_not:N \@@_strip_pt:w - ##1 . ##2 \tl_to_str:n { pt } ##3 \exp_not:N \q_stop + ##1 . ##2 \tl_to_str:n { pt } + } { - ##1 - \exp_not:N \int_compare:nNnT {##2} > \c_zero - { . ##2 } + \int_compare:nNnTF {#2} > \c_zero + { #1 . #2 } + { #1 } } - } % \end{macrocode} % \end{macro} % \end{macro} @@ -1562,7 +1554,7 @@ \prg_new_conditional:Npnn \skip_if_eq:nn #1#2 { p , T , F , TF } { \if_int_compare:w - \pdftex_strcmp:D { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } + \__str_if_eq_x:nn { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } = \c_zero \prg_return_true: \else: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3styleguide.tex b/Master/texmf-dist/source/latex/l3kernel/l3styleguide.tex new file mode 100644 index 00000000000..6a3a9d122e6 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3styleguide.tex @@ -0,0 +1,242 @@ +\iffalse meta-comment + +File l3styleguide.tex Copyright (C) 2011,2012 The 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 +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\documentclass{l3doc} +\usepackage{svn-multi} + +\svnid{$Id: l3styleguide.tex 2772 2011-09-07 15:07:41Z joseph $} +\def\filedate{\svnfileyear/\svnfilemonth/\svnfileday} + +\title{% + The \LaTeX3 kernel: style guide for code authors% + \thanks + {% + This file describes v\svnfilerev, + last revised \filedate. + }% +} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org}% + {latex-team@latex-project.org}% + }% +} +\date{Released \filedate} + +\begin{document} + +\maketitle + +\tableofcontents + +\section{Introduction} + +This document is intended as a style guide for authors of code and +documentation for the \LaTeX3 kernel. It covers both aspects of coding +style and the formatting of the sources. The aim of providing these +guidelines is help ensure consistency of the code and sources from +different authors. Experience suggests that in the long-term this helps +with maintenance. There will of course be places where there are +exceptions to these guidelines: common sense should always be +applied! + +\section{Documentation style} + +\LaTeX3 source and documentation should be written using the document +class \cls{l3doc} in \file{dtx} format. This class provides a number +of logical mark up elements, which should be used where possible. +In the main, this is standard \LaTeX{} practice, but there are a +few points to highlight: +\begin{itemize} + \item + Where possible, use \cs{cs} to mark up control sequences + rather than using a verbatim environment. + \item + Arguments which are given in braces should be marked using + \cs{Arg} when code-level functions are discussed, but using + \cs{marg} for document functions. + \item + The names \TeX{}, \LaTeX{}, \emph{etc}.\ use the normal logical mark + up followed by an empty group (|{}|), with the exception of |\LaTeX3|, + where the number should follow directly. + \item + Where in line verbatim text is used, it should be marked up + using the \verb=|...|= construct (\emph{i.e.}~vertical bars delimit + the verbatim text). + \item In line quotes should be marked up using the \cs{enquote} + function. + \item + Where numbers in the source have a mathematical meaning, + they should be included in math mode. Such in-line math mode + material should be marked up using |$...$| and \emph{not} + |\(...\)|. +\end{itemize} + +Line length in the source files should to be under $80$ +characters where possible, as this helps keep everything on the screen +when editing files. In the \file{dtx} format, documentation lines start +with a \texttt{\%}, which is usually followed by a space to leave a +\enquote{comment margin} at the start of each line. + +As with code indenting (see later), nested environments and arguments +should be indented by (at least) two spaces to make the nature of the nesting +clear. Thus for example a typical arrangement for the \env{function} +environment might be +\begin{verbatim*} +\begin{function}{\seq_gclear:N, \seq_gclear:c} + \begin{syntax} + \cs{seq_gclear:N} \meta{sequence} + \end{syntax} + Clears all entries from the \meta{sequence} globally. +\end{function} +\end{verbatim*} +The \enquote{outer} \verb*|% \begin{function}| should have the customary +space after the |%| character at the start of the line. + +In general, a single \env{function} or \env{macro} environment should be +used for a group of closely-related functions, for example argument +specification variants. In such cases, a comma-separated list should be +used, as shown in the preceding example. + +\section{Format of the code itself} + +The requirement for less than $80$ characters per line applies to the code +itself as well as the surrounding documentation. A number of the general +style principals for \LaTeX3 code apply: these are described in the following +paragraph and an example is then given. + +With the exception of simple runs of parameter (|{#1}|, |#1#2|, +\emph{etc.}), everything should divided up using spaces to make the code +more readable. In general, these will be single spaces, but in some +places it makes more sense to align parts of the code to emphasise +similarity. (Tabs should not be used for introducing white space.) + +Each conceptually-separate step in a function should be on a separate +line, to make the meaning clearer. Hence the \texttt{false} branch +in the example uses two lines for the two auxiliary function uses. + +Within the definition, a two-space indent should be used to show each +\enquote{level} of code. Thus in the example \cs{tl_if_empty:nTF} is +indented by two spaces, but the two branches are indented by four +spaces. Within the \texttt{false} branch, the need for multiple lines +means that an additional two-space indent should be used to show that +these lines are all part of the brace group. + +The result of these lay-out conventions is code which will in general +look like the example: +\begin{verbatim*} +\cs_new:Npn \module_foo:nn #1#2 + { + \tl_if_empty:nTF {#1} + { \module_foo_aux:n { X #2 } } + { + \module_foo_aux:nn {#1} {#2} + \module_foo_aux:n {#1#2} + } + } +\end{verbatim*} + +\section{Code conventions} + +All code-level functions should be \enquote{long} if they accept any +arguments, even if it seems \enquote{very unlikely} that a \cs{par} token +will be passed. Thus \cs{cs_new_nopar:Npn} and so forth should only be used +to create functions which accept no arguments at all. + +The expandability of each function should be well-defined. Functions which +cannot be fully expanded must be \texttt{protected}. This means that expandable +functions must themselves only contain expandable material. Functions which +use any non-expandable material must be defined using \cs{cs_new_protected:Npn} +or similar. + +When using \cs{cs_generate_variant:Nn}, group related variants together +to make the pattern clearer. A common example is variants of a function +which has an \texttt{N}-type first argument: +\begin{verbatim} + \cs_generate_variant:Nn \foo:Nn { NV , No } + \cs_generate_variant:Nn \foo:Nn { c , cV , co } +\end{verbatim} + +There are cases where omitting braces from \texttt{o}-type arguments +is desirable for performance reasons. This should only be done if the +argument is a single token, thus for example +\begin{verbatim} + \tl_set:No \l_some_tl \l_some_other_tl +\end{verbatim} +remains clear and can be used where appropriate. + +\section{Private and internal functions} + +Private functions (those starting \cs{__}) should not be used between modules. +The only exception is where a \enquote{family} of modules share some +\enquote{internal} methods: this happens most obviously in the kernel itself. +Any internal functions or variables \emph{must} be documented in the same way +as public ones. + +The \pkg{l3docstrip} method should be used for internal functions in a module. +This requires a line +\begin{quote} + \ttfamily + \%<@@=\meta{module}> +\end{quote} +at the start of the source (\texttt{.dtx}) file, with internal functions +then written in the form +\begin{verbatim} + \cs_new_protected:Npn \@@_function:nn #1#2 + ... +\end{verbatim} + +\section{Auxiliary functions} + +In general, the team encourage the use of descriptive names in \LaTeX3 code. +Thus many helper functions will have names which describe briefly what they do, +rather than simply indicating that they are auxiliary to some higher-level +function. However, there are places where one or more \texttt{aux} functions +are required. Where possible, these should be differentiated by signature +\begin{verbatim} + \cs_new_protected:Npn \@@_function:nn #1#2 + { + ... + } + \cs_new_protected:Npn \@@_function_aux:nn #1#2 + { + ... + } + \cs_new_protected:Npn \@@_function_aux:w #1#2 \q_stop + { + ... + } +\end{verbatim} +Where more than one auxiliary shares the same signature, the recommended naming +scheme is \texttt{auxi}, \texttt{auxii} and so on. +\begin{verbatim} + \cs_new_protected:Npn \@@_function_auxi:nn #1#2 + { + ... + } + \cs_new_protected:Npn \@@_function_auxii:nn #1#2 + { + ... + } +\end{verbatim} +The use of \texttt{aux_i}, \texttt{aux_ii}, \emph{etc.}\ is discouraged as this +conflicts with the convention used by \cs{use_i:nn} and related functions. + +\end{document} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3syntax-changes.tex b/Master/texmf-dist/source/latex/l3kernel/l3syntax-changes.tex new file mode 100644 index 00000000000..4dfc70e0e97 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3syntax-changes.tex @@ -0,0 +1,110 @@ +\iffalse meta-comment + +File l3syntax-changes.tex Copyright (C) 2011-2012 The 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 +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\documentclass{l3doc} + +\usepackage{svn-multi} + +\svnid{$Id: l3syntax-changes.tex 4048 2012-08-02 09:49:10Z joseph $} +\def\filedate{\svnfileyear/\svnfilemonth/\svnfileday} + +\title{% + Syntax changes in \LaTeX3 functions + \thanks + {% + This file describes v\svnfilerev, + last revised \filedate. + }% +} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org}% + {latex-team@latex-project.org}% + }% +} +\date{Released \filedate} + +\newcommand{\TF}{\textit{(TF)}} + +\begin{document} + +\maketitle + +This file lists functions whose syntax has changed after August 2011, +with an approximate date. + +\section{August 2011} + +\begin{itemize} + \item \cs{tl_if_single:n\TF} recognized any non-zero number of + explicit spaces as \meta{true}, and did not ignore trailing spaces. + Now it is \meta{true} for + \[ + \meta{optional spaces} + \meta{normal token or brace group} + \meta{optional spaces}. + \] + \item \cs{tl_reverse:n} stripped outer braces and lost unprotected spaces. + Now it keeps spaces, leaves unbraced single tokens unbraced, and + braced groups braced. + \item \cs{tl_trim_spaces:n} only removed one leading and trailing space. + Now removes recursively. Also, on the left it used to strip implicit + and explicit spaces with any character code. Now it strips only explicit + space characters $(32,10)$. +\end{itemize} + +\section{September 2011} + +\begin{itemize} +\item clist functions which receive an \texttt{n}-type comma list argument + now trim spaces from each item in the argument. +\end{itemize} + +\section{June 2012} + +\begin{itemize} + \item Access to list functions now indexes from~$1$, not from~$0$. + This applies to multiple choices in the \pkg{l3keys} module and + the \cs{clist_item:Nn}, \cs{seq_item:Nn} and \cs{tl_item:Nn} + functions. + \item \cs{tl_trim_spaces:n} now requires a variable number of + expansions to fully expand, rather than exactly two. Of course, + \texttt{x}-type expansion still correctly evaluates this function. +\end{itemize} + +\section{July 2012} + +\begin{itemize} + \item The \cs{tl_if_head_eq_meaning:nN}, \cs{tl_if_head_eq_catcode:nN} + and \cs{tl_if_head_eq_charcode:nN} conditionals now never match when + their first argument is empty. +\end{itemize} + +\section{August 2012} + +\begin{itemize} + \item \cs{lua_now:x} is now a standard \texttt{x}-type expansion of + \cs{lua_now:n}, which does no expansion. Engine-level expansion is moved + to \cs{lua_now_x:n}, reflecting the fact that this is non-standard in the + same way as for example \cs{str_if_eq_x:nn(TF)}. +\end{itemize} + + +\end{document} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index befa072b22d..88874c36241 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3tl.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3tl.dtx 5070 2014-06-06 18:00:24Z bruno $ {L3 Token lists} %</driver|package> %<*driver> @@ -657,7 +657,8 @@ % \begin{itemize} % \item an escape character, whose character code is given by the % internal parameter \tn{escapechar}, absent if the -% \tn{escapechar} is negative; +% \tn{escapechar} is negative or greater than the largest +% character code; % \item the control sequence name, as defined by \cs{cs_to_str:N}; % \item a space, unless the control sequence name is a single % character whose category at the time of expansion of @@ -1434,18 +1435,10 @@ % \begin{variable}{\c_@@_rescan_marker_tl} % The rescanning code needs a special token list containing the same % character with two different category codes. This is set up here, -% while the detail is described below. -% \begin{macrocode} -\group_begin: - \tex_lccode:D `\A = `\@ \scan_stop: - \tex_lccode:D `\B = `\@ \scan_stop: - \tex_catcode:D `\A = 8 \scan_stop: - \tex_catcode:D `\B = 3 \scan_stop: -\tex_lowercase:D - { - \group_end: - \tl_const:Nn \c_@@_rescan_marker_tl { A B } - } +% while the detail is described below. Note that we are sure that the +% colon has category letter at this stage. +% \begin{macrocode} +\tl_const:Nx \c_@@_rescan_marker_tl { : \token_to_str:N : } % \end{macrocode} % \end{variable} % @@ -1471,9 +1464,9 @@ % When expanding a token list this can be handled using \cs{exp_not:N} % but this fails if the token list is not being expanded. So instead % a delimited argument is used with an end marker which cannot appear -% within the token list which is scanned: two |@| symbols with different +% within the token list which is scanned: two `|:|' symbols with different % category codes. The rescanned token list cannot contain the end marker, -% because all |@| present in the token list are read with the same category +% because all `|:|' present in the token list are read with the same category % code. As every character with charcode \tn{newlinechar} is replaced % by the \tn{endlinechar}, and an extra \tn{endlinechar} is % added at the end, we need to set both of those to $-1$, @@ -1675,15 +1668,10 @@ % \begin{macro}[aux]{\@@_if_blank_p:NNw} % \TeX{} skips spaces when reading a non-delimited arguments. Thus, % a \meta{token list} is blank if and only if \cs{use_none:n} -% \meta{token list} |?| is empty. For performance reasons, we hard-code -% the emptiness test done in \cs{tl_if_empty:n(TF)}: convert to harmless -% characters with \cs{tl_to_str:n}, and then use +% \meta{token list} |?| is empty after one expansion. The auxiliary +% \cs{@@_if_empty_return:o} is a fast emptyness test, converting its +% argument to a string (after one expansion) and using the test % \cs{if_meaning:w} \cs{q_nil} |...| \cs{q_nil}. -% Note that converting to a string is done after reading the delimited -% argument for \cs{use_none:n}. The similar construction -% \cs{exp_after:wN} \cs{use_none:n} \cs{tl_to_str:n} \Arg{token list} |?| -% would fail if the token list contains the control sequence \cs{ }, -% while \tn{escapechar} is a space or is unprintable. % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_blank:n #1 { p , T , F , TF } { \@@_if_empty_return:o { \use_none:n #1 ? } } @@ -1720,18 +1708,18 @@ % \end{macro} % % \begin{macro}[pTF]{\tl_if_empty:n,\tl_if_empty:V} -% It would be tempting to just use |\if_meaning:w \q_nil #1 \q_nil| as -% a test since this works really well. However, it fails on a token +% Convert the argument to a string: this will be empty if and only if +% the argument is. Then |\if_meaning:w \q_nil ... \q_nil| is +% \texttt{true} if and only if the string |...| is empty. +% It could be tempting to use |\if_meaning:w \q_nil #1 \q_nil| directly. +% This fails on a token % list starting with \cs{q_nil} of course but more troubling is the % case where argument is a complete conditional such as \cs{if_true:} % a \cs{else:} b \cs{fi:} because then \cs{if_true:} is used by % \cs{if_meaning:w}, the test turns out \texttt{false}, the \cs{else:} % executes the \texttt{false} branch, the \cs{fi:} ends it and the % \cs{q_nil} at the end -% starts executing\dots{} A safer route is to convert the entire -% token list into harmless characters first and then compare -% that. This way the test will even accept \cs{q_nil} as the first -% token. +% starts executing\dots{} % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_empty:n #1 { p , TF , T , F } { @@ -1751,7 +1739,7 @@ % \begin{macro}[pTF]{\tl_if_empty:o} % \begin{macro}[EXP,aux]{\@@_if_empty_return:o} % The auxiliary function \cs{@@_if_empty_return:o} is for use -% in conditionals on token lists, which mostly reduce to testing +% in various token list conditionals which reduce to testing % if a given token list is empty after applying a simple function % to it. % The test for emptiness is based on \cs{tl_if_empty:n(TF)}, but @@ -1831,7 +1819,7 @@ % \end{macro} % % \begin{macro}[TF]{\tl_if_in:nn, \tl_if_in:Vn, \tl_if_in:on, \tl_if_in:no} -% Once more, the test relies on \cs{tl_to_str:n} for robustness. +% Once more, the test relies on the emptiness test for robustness. % The function \cs{@@_tmp:w} removes tokens until the first occurrence % of |#2|. If this does not appear in |#1|, then the final |#2| is removed, % leaving an empty token list. Otherwise some tokens remain, and the @@ -1868,18 +1856,37 @@ % \end{macro} % % \begin{macro}[EXP,pTF]{\tl_if_single:n} -% A token list has exactly one item if it is a single token or a -% single brace group, surrounded by optional explicit spaces. -% The naive -% version of this test would do \cs{use_none:n} |#1|, and -% test if the result is empty. However, this will fail when -% the token list is empty. Furthermore, it does not allow optional -% trailing spaces. +% \begin{macro}[EXP,pTF,aux]{\@@_if_single:n} +% This test is similar to \cs{tl_if_empty:nTF}. Expanding +% \cs{use_none:nn} |#1| |??| once yields an empty result if |#1| is +% blank, a single~|?| if |#1| has a single item, and otherwise yields +% some tokens ending with |??|. Then, \cs{tl_to_str:n} makes sure +% there are no odd category codes. An earlier version would compare +% the result to a single~|?| using string comparison, but the Lua call +% is slow in \LuaTeX{}. Instead, \cs{@@_if_single:nnw} picks the +% second token in front of it. If |#1| is empty, this token will be +% the trailing~|?| and the catcode test yields \texttt{false}. If +% |#1| has a single item, the token will be~|^| and the catcode test +% yields \texttt{true}. Otherwise, it will be one of the characters +% resulting from \cs{tl_to_str:n}, and the catcode test yields +% \texttt{false}. Note that \cs{if_catcode:w} takes care of the +% expansions, and that \cs{tl_to_str:n} (the \tn{detokenize} +% primitive) actually expands tokens until finding a begin-group +% token. % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } - { \__str_if_eq_x_return:nn { \exp_not:o { \use_none:nn #1 ?? } } {?} } + { + \if_catcode:w ^ \exp_after:wN \@@_if_single:nnw + \tl_to_str:n \exp_after:wN { \use_none:nn #1 ?? } ^ ? \q_stop + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \@@_if_single:nnw #1#2#3 \q_stop {#2} % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[EXP]{\tl_case:Nn, \tl_case:cn} % \begin{macro}[EXP, TF]{\tl_case:Nn, \tl_case:cn} @@ -2060,7 +2067,7 @@ % variable. Brace groups within the list are read as a single % element. Spaces are ignored. % \cs{@@_count:n} grabs the element and replaces it by |+1|. -% The |0| to ensure it works on an empty list. +% The |0| ensures that it works on an empty list. % \begin{macrocode} \cs_new:Npn \tl_count:n #1 { @@ -2636,13 +2643,16 @@ % % \begin{macro}[EXP,pTF]{\tl_if_head_is_space:n} % \begin{macro}[EXP,aux]{\@@_if_head_is_space:w} -% If the first token of the token list is an explicit space, i.e., -% a character token with character code $32$ and category code $10$, -% then this test will be \texttt{true}. It is \texttt{false} if the token -% list is empty, if the first token is an implicit space token, -% such as \cs{c_space_token}, or any token other than an explicit space. -% The slightly convoluted approach with \tn{romannumeral} ensures that -% each expansion step gives a balanced token list. +% The auxiliary's argument is all that is before the first explicit +% space in |?#1?~|. If that is a single~|?| the test yields +% \texttt{true}. Otherwise, that is more than one token, and the test +% yields \texttt{false}. The work is done within braces (with an +% |\if_false: { \fi: ... }| construction) both to hide potential +% alignment tab characters from \TeX{} in a table, and to allow for +% removing what remains of the token list after its first space. The +% \cs{tex_romannumeral:D} and \cs{c_zero} ensure that the result of a +% single step of expansion directly yields a balanced token list (no +% trailing closing brace). % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_is_space:n #1 { p , T , F , TF } { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index ff569c8e8c0..36d2a427ac5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -37,7 +37,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3token.dtx 4728 2014-05-04 13:25:37Z joseph $ +\GetIdInfo$Id: l3token.dtx 4889 2014-05-26 19:59:25Z joseph $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -1455,7 +1455,7 @@ } \cs_new:Npn \@@_if_macro_p:w #1 MA #2 ; #3 \q_stop { - \if_int_compare:w \pdftex_strcmp:D { #2 } { cro } = \c_zero + \if_int_compare:w \__str_if_eq_x:nn { #2 } { cro } = \c_zero \prg_return_true: \else: \prg_return_false: diff --git a/Master/texmf-dist/source/latex/l3kernel/source3.tex b/Master/texmf-dist/source/latex/l3kernel/source3.tex new file mode 100644 index 00000000000..22c3c44048d --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/source3.tex @@ -0,0 +1,106 @@ +% \iffalse meta-comment +% +%% File: source3.tex Copyright (C) 1990-2011 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +% +% \fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This document will typeset the LaTeX3 sources as a single document. +% This will produce quite a large file (more than 780 pages). +% +% There is also a shorter version (interface3.tex) that only typesets the +% command % interface descriptions. +% +% Do not forget to generate the index (as explained on the terminal output +% near the end of the run)! +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass{l3doc} +\listfiles + +\begin{document} + +\title{The \LaTeX3 Sources} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org} + {latex-team@latex-project.org}% + }% +} + +\pagenumbering{roman} +\maketitle + +% +% First load all modules and typeset the documentation parts +% + +\input{source3body} % all the individual modules + +% +% Now reload all modules and typeset the implementation parts +% + +\part{Implementation} + +\def\maketitle{} +\EnableImplementation +\DisableDocumentation +\DocInputAgain + +\clearpage +\pagestyle{headings} + +% Make TeX shut up. +\hbadness=10000 +\newcount\hbadness +\hfuzz=\maxdimen + +\PrintChanges +\clearpage + +\begingroup + \def\endash{--} + \catcode`\-\active + \def-{\futurelet\temp\indexdash} + \def\indexdash{\ifx\temp-\endash\fi} + + \DelayPrintIndex +\endgroup + +\end{document} |