diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-15 21:27:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-15 21:27:01 +0000 |
commit | b1ce47fe4d0e1f06d1b019c3c6eb5f1b0ecd5e14 (patch) | |
tree | 58362abe4b603bb5f6db898b9b835bc8af730b3e /Master | |
parent | 03b8dcfa3435f0265dfad4fd09aaab8f4ff9c617 (diff) |
l3 (15jul17)
git-svn-id: svn://tug.org/texlive/trunk@44813 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
104 files changed, 5899 insertions, 3774 deletions
diff --git a/Master/texmf-dist/doc/latex/l3experimental/README.md b/Master/texmf-dist/doc/latex/l3experimental/README.md index ccac875f177..81a36e7abea 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/README.md +++ b/Master/texmf-dist/doc/latex/l3experimental/README.md @@ -1,7 +1,7 @@ Experimental LaTeX3 Concepts ============================ -Release 2017/05/29 +Release 2017/07/15 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf Binary files differindex 0ff1e19524b..a34ab877ee5 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf Binary files differindex a84ed19f4fc..6fa85398db8 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf Binary files differindex b0474719904..439eb182dfb 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf Binary files differindex 4f6675280b8..d3636444b4f 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf Binary files differindex 1b9b2c657dc..42baade9067 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/README.md b/Master/texmf-dist/doc/latex/l3kernel/README.md index 1e941253eee..bd25e8d24f7 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/README.md +++ b/Master/texmf-dist/doc/latex/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2017/05/29 +Release 2017/07/15 Overview -------- @@ -30,15 +30,14 @@ Requirements The `l3kernel` bundle requires the e-TeX extensions and additional functionality to support string comparisons, expandable character generation with arbitrary category codes (for Unicode engines) and PDF support primitives (where direct -PDF generation is used). The bundle will therefore only work with the following -engines: +PDF generation is used). The bundle only works with the following engines: * pdfTeX v1.40 or later * XeTeX v0.9994 or later * LuaTeX v0.70 or later * e-(u)pTeX from mid-2012 onward pdfTeX v1.40 was released in 2007, and so any recent TeX distribution -will support `l3kernel`. Both XeTeX and LuaTeX have developed more +supports `l3kernel`. Both XeTeX and LuaTeX have developed more actively over the past few years, and for this reason only recent releases of these engines are supported. diff --git a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf Binary files differindex 374371230f6..b68a5d86840 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf Binary files differindex 18de9660f4d..a94745436db 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.tex b/Master/texmf-dist/doc/latex/l3kernel/interface3.tex new file mode 100644 index 00000000000..d71383d0c9f --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.tex @@ -0,0 +1,88 @@ +% \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 typesets the LaTeX3 interface descriptions a single document. +% This produces 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/doc/latex/l3kernel/l3docstrip.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf Binary files differindex 0dd679911d9..365f3beb8a4 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt b/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt index 5d8e254af51..981f95f5303 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt +++ b/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt @@ -18,7 +18,16 @@ Function Expires end \c_minus_one 2018 \box_resize:cnn 2018 \box_resize:Nnn 2018 +\file_add_path:nN 2018 +\file_list: 2018 +\file_path_include:n 2018 +\file_path_remove:n 2018 +\g_file_current_name_tl 2018 \ior_get_str:NN 2017 +\ior_list_streams: 2018 +\ior_log_streams: 2018 +\iow_list_streams: 2018 +\iow_log_streams: 2018 \sort_ordered: 2018 \sort_reversed: 2018 \tl_to_lowercase:n 2017 diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf Binary files differindex 0a9b12ea552..a28e2302945 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex new file mode 100644 index 00000000000..49f32251b4a --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex @@ -0,0 +1,274 @@ +\iffalse meta-comment + +File l3styleguide.tex Copyright (C) 2011,2012,2015-2017 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} + + +\title{% + The \LaTeX3 kernel: style guide for code authors% +} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org}% + {latex-team@latex-project.org}% + }% +} +\date{Released 2017/07/15} + +\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 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 fewer than $80$ characters per line applies to the code +itself as well as the surrounding documentation. A number of the general +style principles 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 be 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 in general +looks 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 interfaces at the document level (where trapping \cs{par} tokens +may be appropriate) or where comparison to other code known not to be +\enquote{long} is required (\emph{e.g.}~when working with mixed +\LaTeXe{}/\pkg{expl3} situations). + +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 may be 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} + +\subsection{Access from other modules} + +There may be cases where it is useful to use an internal function from +a third-party module (this includes cases where you are the author of both +but they are not part of the same \enquote{family}). In these cases, you should +\emph{copy} the definition of the internal function to your code: this avoids +relying on non-documented interfaces. At the same time, it is strongly +encouraged that you discuss your requirements with the author of the +code you need to access. The best long-term solution to these cases is for +new documented interfaces to be added to the parent module. + +\subsection{Access to primitives} + +As \pkg{expl3} is still a developing system, there are places where direct +access to engine primitives is required. These are all marked as +\enquote{do not use} in the code and so require special handling. Where a +programmer is sure that they need to use a primitive (for example where the +team have not yet covered access to an area) then a local copy of the +primitive should be made, for example +\begin{verbatim} + \cs_new_eq:NN \__module_message:w \tex_message:D + % ... + \cs_new_protected:Npn \__module_fancy_msg:n #1 + { \__module_message:w { *** #1 *** } } +\end{verbatim} +This approach makes it possible for the team and others to find such +usage (by searching for the \texttt{:D} argument type) but avoids +multiple uses in general code. + +At the same time, the team ask that these use cases are raised on the +\texttt{LaTeX-L} mailing list. The team are keen to collect use cases for +areas that have not yet been addressed and to provide new code where the +required interfaces become clear. + +Programmers using primitives should be ready to make updates to their +code as the team develop additional interfaces. + +\section{Auxiliary functions} + +In general, the team encourages the use of descriptive names in \LaTeX3 code. +Thus many helper functions would 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/doc/latex/l3kernel/l3syntax-changes.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf Binary files differindex 878e47efdf5..0caa11d028d 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex new file mode 100644 index 00000000000..3e93fa0704f --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex @@ -0,0 +1,101 @@ +\iffalse meta-comment + +File l3syntax-changes.tex Copyright (C) 2011-2012,2017 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} + + +\title{% + Syntax changes in \LaTeX3 functions% +} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org}% + {latex-team@latex-project.org}% + }% +} +\date{Released 2017/07/15} + +\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/doc/latex/l3kernel/source3.pdf b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf Binary files differindex ac3ebd9ad71..75cfec6429d 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.tex b/Master/texmf-dist/doc/latex/l3kernel/source3.tex new file mode 100644 index 00000000000..3a97669a2c5 --- /dev/null +++ b/Master/texmf-dist/doc/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 typesets the LaTeX3 sources as a single document. +% This produces 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} diff --git a/Master/texmf-dist/doc/latex/l3packages/README.md b/Master/texmf-dist/doc/latex/l3packages/README.md index 4a157fa5454..27bdaf3c5ef 100644 --- a/Master/texmf-dist/doc/latex/l3packages/README.md +++ b/Master/texmf-dist/doc/latex/l3packages/README.md @@ -1,7 +1,7 @@ LaTeX3 High-Level Concepts ========================== -Release 2017/05/29 +Release 2017/07/15 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf Binary files differindex 31796912bb4..f9bb3681534 100644 --- a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf b/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf Binary files differindex b8f1965546a..1722e823e6f 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf Binary files differindex f253fe27bd6..0cca078e3af 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf Binary files differindex ee5762fe637..e0c26f86b2f 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf Binary files differindex d62d369132e..d038dd6763e 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx index 5d0300e6f4b..66fdbfa57ad 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -252,7 +252,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3str-convert}{2017/05/29}{} +\ProvidesExplPackage{l3str-convert}{2017/07/15}{} {L3 Experimental string encoding conversions} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index 56111fade54..f2fa9a21e75 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -163,7 +163,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3str-format}{2017/05/29}{} +\ProvidesExplPackage{l3str-format}{2017/07/15}{} {L3 Experimental string formatting} \RequirePackage{l3str} %</package> diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx index 7f57f213d87..c7d7306c484 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx @@ -54,7 +54,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -673,7 +673,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xcoffins}{2017/05/29}{} +\ProvidesExplPackage{xcoffins}{2017/07/15}{} {L3 Experimental design level coffins} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index b030677562f..1ce666677fb 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/29] -%<package>\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +%<package>\@ifpackagelater{expl3}{2017/07/15} %<package> {} %<package> {% %<package> \PackageError{l3galley}{Support package l3kernel too old} @@ -59,7 +59,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -685,7 +685,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3galley}{2017/05/29}{} +\ProvidesExplPackage{l3galley}{2017/07/15}{} {L3 Experimental galley code} %</package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index 23a75e2c37d..8a5209af0fd 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -732,7 +732,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xgalley}{2017/05/29}{} +\ProvidesExplPackage{xgalley}{2017/07/15}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index cc7493c71e3..8af4d9ce93f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2017/05/29}% +\def\ExplFileDate{2017/07/15}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -97,7 +97,7 @@ % The \pkg{expl3} bundle provides this new programming interface for % \LaTeX{}. To make programming systematic, \LaTeX3 uses some very % different conventions to \LaTeXe{} or plain \TeX{}. As a result, -% programmers starting with \LaTeX3 will need to become familiar with +% programmers starting with \LaTeX3 need to become familiar with % the syntax of the new language. % % The next section shows where this language fits into a complete @@ -239,11 +239,11 @@ % \subsection{Formal naming syntax} % % We shall now look in more detail at the syntax of these names. A -% function name in \LaTeX3 will have a name consisting of three parts: +% function name in \LaTeX3 has a name consisting of three parts: % \begin{quote} % |\|\meta{module}|_|\meta{description}|:|\meta{arg-spec} % \end{quote} -% while a variable will have (up to) four distinct parts to its name: +% while a variable has (up to) four distinct parts to its name: % \begin{quote} % |\|\meta{scope}|_|\meta{module}|_|\meta{description}|_|\meta{type} % \end{quote} @@ -262,7 +262,8 @@ % as needed; the programmer can choose any unused name, consisting % of letters only, for a module. In general, the module name and module % prefix should be related: for example, the kernel module containing -% \texttt{box} functions is called \texttt{l3box}. +% \texttt{box} functions is called \texttt{l3box}. Module names and +% programmers' contact details are listed in \pkg{l3prefixes.csv}. % % The \emph{description} gives more detailed information about the % function or parameter, and provides a unique name for it. It should @@ -351,7 +352,7 @@ % \tl_new:N \l_@@_my_tl % % \end{macrocode} % \end{verbatim} -% will be converted by \pkg{l3docstrip} to +% is converted by \pkg{l3docstrip} to % \begin{verbatim} % \cs_new:Npn \__foo_function:n #1 % ... @@ -383,7 +384,7 @@ % stack.\footnote{See \emph{The \TeX{}book}, p.\,301, for further % information.} % -% The \meta{type} will be in the list of available +% The \meta{type} is in the list of available % \emph{data-types};\footnote{Of course, if a totally new data type is % needed then this will not be the case. However, it is hoped that only % the kernel team will need to create new data types.} these include the @@ -461,7 +462,7 @@ % behaviour}. The \LaTeX3 coding convention is that all variables must % be declared before use. % -% The \pkg{expl3} package can be loaded with the |check-declarations| +% The \pkg{expl3} package can be loaded with the \texttt{check-declarations} % option to verify that all variables are declared before use. This has % a performance implication and is therefore intended for testing during % development and not for use in production documents. @@ -537,7 +538,7 @@ % \begin{quote} % \cs{seq_gpush:Nn} |\g_ior_file_name_seq| |\l_ior_curr_file_tl| % \end{quote} -% we will not get the value of the variable pushed onto the stack, +% we do not get the value of the variable pushed onto the stack, % only the variable name itself. Instead a suitable number of % \cs{exp_after:wN} would be necessary (together with extra braces) to % change the order of expansion,\footnote{\cs{exp_after:wN} is @@ -588,7 +589,7 @@ % \end{quote} % Remember that \texttt{c} arguments are \emph{fully expanded} by % \TeX{} when creating csnames. This means that (a) the entire -% argument must be expandable and (b) any variables will be +% argument must be expandable and (b) any variables are % converted to their content. So the preceding examples are also % equivalent to % \begin{quote} @@ -629,7 +630,7 @@ % list.\\ Almost the same as the |x| type except here the token list % is expanded fully until the first unexpandable token is found and % the rest is left unchanged. Note that if this function finds a -% space at the beginning of the argument it will gobble it and not +% space at the beginning of the argument it gobbles it and does not % expand the next token. % \end{description} % @@ -691,21 +692,21 @@ % within its second argument, according to our conventions. Such a % function takes two normal \enquote{\texttt{n}} arguments and operates % on token lists: it might reasonably be named |\tl_test_in:nn|. Thus -% the variant function we need will be defined with the appropriate -% argument types and its name will be |\tl_test_in:cV|. Now this code -% fragment will be simply: +% the variant function we need would be defined with the appropriate +% argument types and its name would be |\tl_test_in:cV|. Now this code +% fragment would be simply: % \begin{verbatim} % \tl_test_in:cV { sym #3 } \group@list % \end{verbatim} % This code could be improved further by using a sequence |\l_group_seq| % rather than the bare token list |\group@list|. Note that, in addition -% to the lack of \tn{expandafter}, the space after the~|}| will be +% to the lack of \tn{expandafter}, the space after the~|}| is % silently ignored since all white space is ignored in this programming % environment. % % \subsection{New functions from old} % -% For many common functions the \LaTeX3 kernel will provide variants +% For many common functions the \LaTeX3 kernel provides variants % with a range of argument forms, and similarly it is expected that % extension packages providing new functions will make them available in % all the commonly needed forms. @@ -761,7 +762,7 @@ % % This extension mechanism is written so that if the same new form of % some existing command is implemented by two extension packages then the -% two definitions will be identical and thus no conflict will occur. +% two definitions are identical and thus no conflict occurs. % % \section{The distribution} % @@ -836,7 +837,7 @@ % } % \explpkg{l3quark}{ % A \enquote{quark} is a command that is defined to expand to -% itself! Therefore they must never be expanded as this will generate +% itself! Therefore they must never be expanded as this would generate an % infinite recursion; they do however have many uses, \emph{e.g.}~as % special markers and delimiters within code. % } @@ -919,21 +920,30 @@ % which are constructed using macros as the underlying storage system. The % \texttt{check-declarations} option enables checking for all variable % assignments, issuing an error if any variables are assigned without being -% initialised. +% initialised. See also the function \cs{debug_check_declarations_on:}. % % \DescribeOption{log-functions} % The \texttt{log-functions} option is used to enable recording of every new % function name in the \texttt{.log} file. This is useful for debugging % purposes, as it means that there is a complete list of all functions % created by each module loaded (with the exceptions of a very small number -% required by the bootstrap code for \LaTeX3). +% required by the bootstrap code for \LaTeX3). See also the function +% \cs{debug_log_functions_on:}. +% +% \DescribeOption{enable-debug} +% To allow more localized checking and logging than provided by +% \texttt{check-declarations} and \texttt{log-functions}, \pkg{expl3} +% provides a few \cs[no-index]{debug_\ldots{}} functions (described +% elsewhere) that turn on the corresponding checks within a group. +% These functions can only be used if \pkg{expl3} is loaded with the +% \texttt{enable-debug} option. % % \DescribeOption{driver} % Selects the driver to be used for color, graphics and related operations that % are driver-dependent. Options available are % \begin{itemize}[font = \texttt] % \item[auto] Let \LaTeX3 determine the correct driver. With DVI output, this -% will select the \texttt{dvips} back-end for \pdfTeX{} and \LuaTeX{}, and +% selects the \texttt{dvips} back-end for \pdfTeX{} and \LuaTeX{}, and % \texttt{dvipdfmx} for \pTeX{} and \upTeX{}. This is the standard setting. % \item[latex2e] Use the \pkg{graphics} package to select the driver, rather % than \LaTeX3 code. @@ -952,17 +962,17 @@ % \begin{verbatim} % \input expl3-generic % % \end{verbatim} -% This will enable the programming layer to work with the other formats. +% This enables the programming layer to work with the other formats. % As no options are available loading in this way, the \enquote{native} % drivers are automatically used. If this \enquote{generic} loader is -% used with \LaTeXe{} the code will automatically switch to the appropriate +% used with \LaTeXe{} the code automatically switches to the appropriate % package route. % % After loading the programming layer using the generic interface, the % commands \cs{ExplSyntaxOn} and \cs{ExplSyntaxOff} and the code-level -% functions and variables detailed in \pkg{interface3} will be available. -% Note that other \LaTeXe{} packages \emph{using} \pkg{expl3} will not -% be loadable: package loading is dependent on the \LaTeXe{} package-management +% functions and variables detailed in \pkg{interface3} are available. +% Note that other \LaTeXe{} packages \emph{using} \pkg{expl3} are not +% loadable: package loading is dependent on the \LaTeXe{} package-management % mechanism. % % \section{Engine/primitive requirements} @@ -1174,14 +1184,19 @@ % \begin{variable}[int] % { % \l@expl@check@declarations@bool , -% \l@expl@log@functions@bool +% \l@expl@log@functions@bool , +% \l@expl@enable@debug@bool % } % \begin{variable}[int]{\l@expl@options@clist} -% Options to be set up. -% These have to be done by hand as there is no \pkg{expl3} yet: the logging -% option is needed before loading \pkg{l3basics}! Only a minimal set of -% options are handled here: others are left for a proper key--value approach -% once the kernel is loaded. +% Options to be set up. These have to be done by hand as there is no +% \pkg{expl3} yet: the logging option is needed before loading +% \pkg{l3basics}! Only a minimal set of options are handled here: +% others are left for a proper key--value approach once the kernel is +% loaded. After processing the options we set the +% \texttt{enable-debug} boolean so that the options +% \texttt{check-declarations} and \texttt{log-functions} imply +% \texttt{enable-debug}: otherwise the necessary debugging code would +% not be set up properly. % \begin{macrocode} \newcommand\expl@create@bool@option[2]% {% @@ -1193,7 +1208,9 @@ } \expl@create@bool@option{check-declarations}\l@expl@check@declarations@bool \expl@create@bool@option{log-functions}\l@expl@log@functions@bool +\expl@create@bool@option{enable-debug}\l@expl@enable@debug@bool \let\expl@create@bool@option\@undefined +\chardef\l@expl@enable@debug@bool=0 % \newcommand*\l@expl@options@clist{} \DeclareOption* {% @@ -1207,6 +1224,12 @@ \fi } \ProcessOptions\relax +\ifodd\l@expl@check@declarations@bool + \chardef\l@expl@enable@debug@bool=1 % +\fi +\ifodd\l@expl@log@functions@bool + \chardef\l@expl@enable@debug@bool=1 % +\fi % \end{macrocode} % \end{variable} % \end{variable} @@ -1238,7 +1261,7 @@ % \end{macrocode} % \end{macro} % -% Load the business end: this will leave \cs{expl3} syntax on. +% Load the business end: this leaves \cs{expl3} syntax on. % \begin{macrocode} \input{expl3-code.tex} % \end{macrocode} @@ -1268,7 +1291,7 @@ % \begin{variable}[int]{\l__expl_native_drivers_bool} % With the code now loaded, options can be handled using a real key--value % interpreter. The \enquote{faked} options are also included so that any -% erroneous input will be mopped up (\emph{e.g.}~\texttt{log-function = +% erroneous input is mopped up (\emph{e.g.}~\texttt{log-function = % foo}). The checks on driver choice are set up here, so when actually % the driver it's a straight forward operation. % \begin{macrocode} @@ -1509,6 +1532,11 @@ % \begin{macrocode} \tl_put_left:Nn \@pushfilename { + \exp_args:Nx \__file_input_push:n + { + \tl_to_str:N \@currname + \tl_to_str:N \@currext + } \tl_put_left:Nx \l__expl_status_stack_tl { \bool_if:NTF \l__kernel_expl_bool @@ -1517,8 +1545,19 @@ } \ExplSyntaxOff } +\tl_put_right:Nn \@pushfilename { \@pushfilenameaux } +% \end{macrocode} +% This bit of trickery is needed to grab the name of the file being loaded +% so we can record it. +% \begin{macrocode} +\cs_set_protected:Npn \@pushfilenameaux #1#2#3 + { + \str_gset:Nn \g_file_curr_name_str {#3} + #1 #2 {#3} + } \tl_put_right:Nn \@popfilename { + \__file_input_pop: \tl_if_empty:NTF \l__expl_status_stack_tl { \ExplSyntaxOff } { \exp_after:wN \__expl_status_pop:w \l__expl_status_stack_tl \q_stop } @@ -1572,7 +1611,7 @@ % \end{macrocode} % The \cs{relax} stops \cs{RequirePackage} from scanning for a date % argument. Putting \tn{endinput} \emph{after} loading the package is -% crucial, as otherwise \tn{endinput} will close the file +% crucial, as otherwise \tn{endinput} would close the file % \file{expl3.sty} at the end of its first line: indeed, as long as % \file{expl3.sty} is open it is impossible to close the file % \file{expl3-generic.tex}. @@ -1622,14 +1661,16 @@ % \begin{variable}[int] % { % \l@expl@check@declarations@bool , -% \l@expl@log@functions@bool +% \l@expl@log@functions@bool , +% \l@expl@enable@debug@bool % } % In generic mode, there is no convenient option handling and so instead % the two variables are defined to do nothing. -% appropriate value before input of the loader. +% Appropriate value before input of the loader. % \begin{macrocode} \chardef \l@expl@check@declarations@bool = 0 % \chardef \l@expl@log@functions@bool = 0 % +\chardef \l@expl@enable@debug@bool = 0 % % \end{macrocode} % \end{variable} % @@ -1652,7 +1693,7 @@ % \end{macro} % \end{macro} % -% Load the business end: this will leave \cs{expl3} syntax on. +% Load the business end: this leaves \cs{expl3} syntax on. % \begin{macrocode} \input expl3-code.tex % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index 989cd514177..35abf3765d7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index f37f4bcc4b4..260e328e5c8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -98,11 +98,11 @@ % \end{syntax} % Adds \meta{token} to the list of \meta{tokens} to be inserted % when the current group level ends. The list of \meta{tokens} to be -% inserted will be empty at the beginning of a group: multiple +% inserted is empty at the beginning of a group: multiple % applications of \cs{group_insert_after:N} may be used to build % the inserted list one \meta{token} at a time. The current group % level may be closed by a \cs{group_end:} function or by a token -% with category code $2$ (close-group). The later will be a ^^A{ +% with category code $2$ (close-group), namely a ^^A{ % |}| if standard category codes apply. % \end{function} % @@ -115,7 +115,7 @@ % arguments absorbed by the function. In the following, \meta{code} % is therefore used as a shorthand for \enquote{replacement text}. % -% Functions which are not \enquote{protected} will be fully expanded +% Functions which are not \enquote{protected} are fully expanded % inside an \texttt{x} expansion. In contrast, \enquote{protected} % functions are not expanded within \texttt{x} expansions. % @@ -124,7 +124,7 @@ % Functions can be created with no requirement that they are declared % first (in contrast to variables, which must always be declared). % Declaring a function before setting up the code means that the name -% chosen will be checked and an error raised if it is already in use. +% chosen is checked and an error raised if it is already in use. % The name of a function can be checked at the point of definition using % the \cs[no-index]{cs_new\ldots} functions: this is recommended for all % functions which are defined for the first time. @@ -136,17 +136,17 @@ % \begin{description} % \item[\texttt{new}] % Create a new function with the \texttt{new} scope, -% such as \cs{cs_new:Npn}. The definition is global and will result in +% such as \cs{cs_new:Npn}. The definition is global and results in % an error if it is already defined. % \item[\texttt{set}] % Create a new function with the \texttt{set} scope, % such as \cs{cs_set:Npn}. The definition is restricted to the current -% \TeX{} group and will not result in an error if the function is already +% \TeX{} group and does not result in an error if the function is already % defined. % \item[\texttt{gset}] % Create a new function with the \texttt{gset} scope, % such as \cs{cs_gset:Npn}. The definition is global and -% will not result in an error if the function is already defined. +% does not result in an error if the function is already defined. % \end{description} % % Within each set of scope there are different ways to define a function. @@ -193,7 +193,7 @@ % Creates \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. -% The definition is global and an error will result if the +% The definition is global and an error results if the % \meta{function} is already defined. % \end{function} % @@ -210,7 +210,7 @@ % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The definition is global and -% an error will result if the \meta{function} is already defined. +% an error results if the \meta{function} is already defined. % \end{function} % % \begin{function} @@ -225,7 +225,7 @@ % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % The \meta{function} will not expand within an \texttt{x}-type -% argument. The definition is global and an error will result if the +% argument. The definition is global and an error results if the % \meta{function} is already defined. % \end{function} % @@ -243,7 +243,7 @@ % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The \meta{function} will not % expand within an \texttt{x}-type argument. The definition is global -% and an error will result if the \meta{function} is already defined. +% and an error results if the \meta{function} is already defined. % \end{function} % % \begin{function}{\cs_set:Npn, \cs_set:cpn, \cs_set:Npx, \cs_set:cpx} @@ -388,7 +388,7 @@ % automatically from the function signature. These \meta{parameters} % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. The definition is global and -% an error will result if the \meta{function} is already defined. +% an error results if the \meta{function} is already defined. % \end{function} % % \begin{function} @@ -405,7 +405,7 @@ % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. When the \meta{function} is used the \meta{parameters} % absorbed cannot contain \cs{par} tokens. The definition is global and -% an error will result if the \meta{function} is already defined. +% an error results if the \meta{function} is already defined. % \end{function} % % \begin{function} @@ -422,7 +422,7 @@ % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. The \meta{function} will not expand within an \texttt{x}-type % argument. The definition is global and -% an error will result if the \meta{function} is already defined. +% an error results if the \meta{function} is already defined. % \end{function} % % \begin{function} @@ -440,7 +440,7 @@ % function. When the \meta{function} is used the \meta{parameters} % absorbed cannot contain \cs{par} tokens. The \meta{function} will not % expand within an \texttt{x}-type argument. The definition is global and -% an error will result if the \meta{function} is already defined. +% an error results if the \meta{function} is already defined. % \end{function} % % \begin{function} @@ -670,8 +670,7 @@ % \cs{cs_meaning:N} \meta{control sequence} % \end{syntax} % This function expands to the \emph{meaning} of the \meta{control sequence} -% control sequence. This will show the \meta{replacement text} for a -% macro. +% control sequence. For a macro, this includes the \meta{replacement text}. % \begin{texnote} % This is \TeX{}'s \tn{meaning} primitive. % The \texttt{c} variant correctly reports undefined arguments. @@ -710,8 +709,8 @@ % The content for \meta{control sequence name} may be literal % material or from other expandable functions. The % \meta{control sequence name} must, when fully expanded, consist -% of character tokens which are not active: typically, they will -% be of category code $10$ (space), $11$ (letter) +% of character tokens which are not active: typically +% of category code $10$ (space), $11$ (letter) % or $12$ (other), or a mixture of these. % \end{function} % @@ -752,8 +751,8 @@ % The content for \meta{control sequence name} may be literal % material or from other expandable functions. The % \meta{control sequence name} must, when fully expanded, consist -% of character tokens which are not active: typically, they will -% be of category code $10$ (space), $11$ (letter) +% of character tokens which are not active: typically +% of category code $10$ (space), $11$ (letter) % or $12$ (other), or a mixture of these. % \begin{texnote} % These are the \TeX{} primitives \tn{csname} and \tn{endcsname}. @@ -782,22 +781,22 @@ % \end{syntax} % Converts the given \meta{control sequence} into a series of % characters with category code $12$ (other), except spaces, -% of category code $10$. The sequence will \emph{not} include -% the current escape token, \emph{cf.}~\cs{token_to_str:N}. +% of category code $10$. The result does \emph{not} include +% the current escape token, contrarily to \cs{token_to_str:N}. % Full expansion of this function requires exactly $2$ expansion % steps, and so an \texttt{x}-type expansion, or two -% \texttt{o}-type expansions will be required to +% \texttt{o}-type expansions are required to % convert the \meta{control sequence} to a sequence of characters % in the input stream. In most cases, an \texttt{f}-expansion -% will be correct as well, but this loses a space at the start +% is correct as well, but this loses a space at the start % of the result. % \end{function} % % \section{Using or removing tokens and arguments} % % Tokens in the input can be read and used or read and discarded. -% If one or more tokens are wrapped in braces then in absorbing them -% the outer set will be removed. At the same time, the category code +% If one or more tokens are wrapped in braces then when absorbing them +% the outer set is removed. At the same time, the category code % of each token is set when the token is read by a function (if it % is read more than once, the category code is determined by % the situation in force when first function absorbs the token). @@ -809,21 +808,21 @@ % \cs{use:nnn} \Arg{group_1} \Arg{group_2} \Arg{group_3} % \cs{use:nnnn} \Arg{group_1} \Arg{group_2} \Arg{group_3} \Arg{group_4} % \end{syntax} -% As illustrated, these functions will absorb between one and four +% As illustrated, these functions absorb between one and four % arguments, as indicated by the argument specifier. The braces -% surrounding each argument will be removed leaving the remaining -% tokens in the input stream. The category code of these tokens will -% also be fixed by this process (if it has not already been by some +% surrounding each argument are removed and the remaining tokens are +% left in the input stream. The category code of these tokens is +% also fixed by this process (if it has not already been by some % other absorption). All of these functions require only a single % expansion to operate, so that one expansion of % \begin{verbatim} % \use:nn { abc } { { def } } % \end{verbatim} -% will result in the input stream containing +% results in the input stream containing % \begin{verbatim} % abc { def } % \end{verbatim} -% \emph{i.e.} only the outer braces will be removed. +% \emph{i.e.} only the outer braces are removed. % \end{function} % % \begin{function}[EXP]{\use_i:nn, \use_ii:nn} @@ -836,7 +835,7 @@ % the first argument and leaves the content of the second argument in % the input stream. % The category code -% of these tokens will also be fixed (if it has not already been by +% of these tokens is also fixed (if it has not already been by % some other absorption). A single expansion is needed for the % functions to take effect. % \end{function} @@ -851,7 +850,7 @@ % \cs{use_ii:nnn} and \cs{use_iii:nnn} work similarly, leaving the % content of second or third arguments in the input stream, respectively. % The category code -% of these tokens will also be fixed (if it has not already been by +% of these tokens is also fixed (if it has not already been by % some other absorption). A single expansion is needed for the % functions to take effect. % \end{function} @@ -868,7 +867,7 @@ % \cs{use_ii:nnnn}, \cs{use_iii:nnnn} and \cs{use_iv:nnnn} work similarly, % leaving the content of second, third or fourth arguments in the input % stream, respectively. The category code -% of these tokens will also be fixed (if it has not already been by +% of these tokens is also fixed (if it has not already been by % some other absorption). A single expansion is needed for the % functions to take effect. % \end{function} @@ -877,20 +876,20 @@ % \begin{syntax} % \cs{use_i_ii:nnn} \Arg{arg_1} \Arg{arg_2} \Arg{arg_3} % \end{syntax} -% This functions will absorb three arguments and leave the content of the +% This function absorbs three arguments and leaves the content of the % first and second in the input stream. The category code of -% these tokens will also be fixed (if it has not already been by +% these tokens is also fixed (if it has not already been by % some other absorption). A single expansion is needed for the -% functions to take effect. An example: +% function to take effect. An example: % \begin{verbatim} % \use_i_ii:nnn { abc } { { def } } { ghi } % \end{verbatim} -% will result in the input stream containing +% results in the input stream containing % \begin{verbatim} % abc { def } % \end{verbatim} -% \emph{i.e.} the outer braces will be removed and the third group -% will be removed. +% \emph{i.e.} the outer braces are removed and the third group +% is removed. % \end{function} % % \begin{function}[EXP] @@ -974,17 +973,17 @@ % \begin{quote} % |\cs_if_free:cTF {abc}| \Arg{true code} \Arg{false code} % \end{quote} -% a function that will turn the first argument into a control sequence +% a function that turns the first argument into a control sequence % (since it's marked as |c|) then checks whether this control sequence -% is still free and then depending on the result carry out the code in +% is still free and then depending on the result carries out the code in % the second argument (true case) or in the third argument (false % case). % % These type of functions are known as \enquote{conditionals}; -% whenever a |TF| function is defined it will usually be accompanied by +% whenever a |TF| function is defined it is usually accompanied by % |T| and |F| functions as well. These are provided for convenience when % the branch only needs to go a single way. Package writers are free to -% choose which types to define but the kernel definitions will always +% choose which types to define but the kernel definitions always % provide all three versions. % % Important to note is that these branching conditionals with \meta{true @@ -993,7 +992,7 @@ % the input stream. % % These conditional functions may or may not be fully expandable, but if -% they are expandable they will be accompanied by a \enquote{predicate} +% they are expandable they are accompanied by a \enquote{predicate} % for the same test as described below. % % \item[Predicates] @@ -1016,8 +1015,8 @@ % \Arg{true code} \Arg{false code} % \end{quote} % -% For each predicate defined, a \enquote{branching conditional} will -% also exist that behaves like a conditional described above. +% For each predicate defined, a \enquote{branching conditional} +% also exists that behaves like a conditional described above. % % \item[Primitive conditionals] % There is a third variety of conditional, which is the original @@ -1052,7 +1051,7 @@ % \end{syntax} % Tests whether the \meta{control sequence} is currently defined % (whether as a function or another control sequence type). Any -% valid definition of \meta{control sequence} will evaluate as +% valid definition of \meta{control sequence} evaluates as % \texttt{true}. % \end{function} % @@ -1062,7 +1061,7 @@ % \cs{cs_if_free:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} % \end{syntax} % Tests whether the \meta{control sequence} is currently free to -% be defined. This test will be \texttt{false} if the +% be defined. This test is \texttt{false} if the % \meta{control sequence} currently exists (as defined by % \cs{cs_if_exist:N}). % \end{function} @@ -1071,13 +1070,13 @@ % % The \eTeX{} engine itself provides many different conditionals. Some % expand whatever comes after them and others don't. Hence the names -% for these underlying functions will often contain a |:w| part but +% for these underlying functions often contains a |:w| part but % higher level functions are often available. See for instance % \cs{int_compare_p:nNn} which is a wrapper for \cs{if_int_compare:w}. % % Certain conditionals deal with specific data types like boxes and % fonts and are described there. The ones described below are either -% the universal conditionals or deal with control sequences. We will +% the universal conditionals or deal with control sequences. We % prefix primitive conditionals with |\if_|. % % \begin{function}[EXP] @@ -1116,7 +1115,7 @@ % "\if:w" <token_1> <token_2> <true code> "\else:" <false code> "\fi:" \\ % "\if_catcode:w" <token_1> <token_2> <true code> "\else:" <false code> "\fi:" % \end{syntax} -% These conditionals will expand any following tokens until two +% These conditionals expand any following tokens until two % unexpandable tokens are left. If you wish to prevent this expansion, % prefix the token in question with "\exp_not:N". "\if_catcode:w" % tests if the category codes of the two tokens are the same whereas @@ -1178,21 +1177,39 @@ % \texttt{check-declarations} is active. % \end{function} % -% \begin{function}{\__chk_log:x} +% \begin{function}{\__debug_log:x} % \begin{syntax} -% \cs{__chk_log:x} \Arg{message text} +% \cs{__debug_log:x} \Arg{message text} % \end{syntax} -% If the \texttt{log-functions} option is active, this function writes -% the \meta{message text} to the log file using \cs{iow_log:x}. -% Otherwise, the \meta{message text} is ignored using \cs{use_none:n}. +% Only defined when debugging is enabled (hence only in package mode +% with the right options). If the \texttt{log-functions} option is +% active, this function writes the \meta{message text} to the log file +% using \cs{iow_log:x}. Otherwise, the \meta{message text} is ignored +% using \cs{use_none:n}. % \end{function} % -% \begin{function}{\__chk_suspend_log:, \__chk_resume_log:} +% \begin{function}{\__debug_suspend_log:, \__debug_resume_log:} % \begin{syntax} -% \cs{__chk_suspend_log:} \ldots{} \cs{__chk_log:x} \ldots{} \cs{__chk_resume_log:} +% \cs{__debug_suspend_log:} \ldots{} \cs{__debug_log:x} \ldots{} \cs{__debug_resume_log:} % \end{syntax} -% Any \cs{__chk_log:x} command between \cs{__chk_suspend_log:} and -% \cs{__chk_resume_log:} is suppressed. These commands can be nested. +% Any \cs{__debug_log:x} command between \cs{__debug_suspend_log:} and +% \cs{__debug_resume_log:} is suppressed. These two commands can be +% nested and do nothing when debugging is disabled. +% \end{function} +% +% \begin{function}{\__debug_patch:nnNw} +% \begin{syntax} +% \cs{__debug_patch:nnNw} \Arg{before} \Arg{after} \meta{definition} \ldots{} +% \end{syntax} +% If debugging is enabled (by one of few \pkg{expl3} options that +% imply \texttt{enable-debug}), adds the \meta{before} and +% \meta{after} tokens (which can involve |#1| and so on) in the +% \meta{definition} that follows. Otherwise ignore the \meta{before} +% and \meta{after} code and perform the \meta{definition} with no +% patching. The \meta{definition} must start with \cs{cs_new:Npn} or +% \cs{cs_set:Npn} or \cs{cs_gset:Npn} or \cs{prg_new_conditional:Npnn} +% or their protected counterparts. Other cases could be added as +% needed. % \end{function} % % \begin{function}[EXP]{\__cs_count_signature:N, \__cs_count_signature:c} @@ -1216,7 +1233,7 @@ % \meta{processor} function in three parts: the \meta{name}, the % \meta{signature} and a logic token indicating if a colon was found % (to differentiate variables from function names). The \meta{name} -% will not include the escape character, and both the \meta{name} and +% does not include the escape character, and both the \meta{name} and % \meta{signature} are made up of tokens with category code $12$ % (other). The \meta{processor} should be a function with argument % specification \texttt{:nnN} (plus any trailing arguments needed). @@ -1291,7 +1308,7 @@ % % Having given all the \TeX{} primitives a consistent name, we need to % give sensible names to the ones we actually want to use. -% These will be defined as needed in the appropriate modules, but +% These will be defined as needed in the appropriate modules, but we % do a few now, just to get started.\footnote{This renaming gets expensive % in terms of csname usage, an alternative scheme would be to just use % the \cs[no-index]{tex_\ldots:D} name in the cases where no good alternative exists.} @@ -1633,7 +1650,7 @@ % following the |:| in the name. Although we could define functions to % remove ten arguments or more using separate calls of % \cs{use_none:nnnnn}, this is very non-intuitive to the programmer -% who will assume that expanding such a function once will take care +% who will assume that expanding such a function once takes care % of gobbling all the tokens in one go. % \begin{macrocode} \cs_set:Npn \use_none:n #1 { } @@ -1673,9 +1690,9 @@ % interface. % % \begin{macro}[EXP]{\prg_return_true:, \prg_return_false:} -% The idea here is that \cs{exp:w} will expand fully any -% \cs{else:} and the \cs{fi:} that are waiting to be discarded, -% before reaching the \cs{exp_end:} which will leave the expansion null. +% The idea here is that \cs{exp:w} expands fully any +% \cs{else:} and \cs{fi:} that are waiting to be discarded, +% before reaching the \cs{exp_end:} which leaves an empty expansion. % The code can then leave either the first or second argument in the % input stream. This means that all of the branching code has to contain % at least two tokens: see how the logical tests are actually implemented @@ -1688,7 +1705,7 @@ % \end{macrocode} % An extended state space could be implemented by including a more % elaborate function in place of \cs{use_i:nn}/\cs{use_ii:nn}. Provided -% two arguments are absorbed then the code will work. +% two arguments are absorbed then the code would work. % \end{macro} % % \begin{macro} @@ -1853,7 +1870,7 @@ % text (or empty), 6: replacement. Remember that the logic-returning % functions expect two arguments to be present after \cs{exp_end:}: % notice the construction of the different variants relies on this, -% and that the |TF| variant will be slightly faster than the |T| +% and that the |TF| and |F| variants will be slightly faster than the |T| % version. The |p| form is only valid for expandable tests, we check % for that by making sure that the second argument is empty. % \begin{macrocode} @@ -2261,7 +2278,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Defining and checking (new) functions} +% \subsection{Checking and patching (new) functions} % % We provide two kinds of functions that can be used to define % control sequences. On the one hand we have functions that check @@ -2269,63 +2286,10 @@ % |\..._new|. The second type of defining functions doesn't check % if the argument is already defined. % -% Before we can define them, we need some auxiliary macros that -% allow us to generate error messages. The definitions here are +% Before we can define them, we need some auxiliary macros that allow +% us to generate error messages. The next few definitions here are % only temporary, they will be redefined later on. % -% \begin{macro}[documented-as=\iow_log:n]{\iow_log:x, \iow_term:x} -% We define a routine to write only to the log file. And a -% similar one for writing to both the log file and the terminal. -% These will be redefined later by \pkg{l3io}. -% \begin{macrocode} -\cs_set_protected:Npn \iow_log:x - { \tex_immediate:D \tex_write:D -1 } -\cs_set_protected:Npn \iow_term:x - { \tex_immediate:D \tex_write:D 16 } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\__chk_log:x, \__chk_suspend_log:, \__chk_resume_log:} -% This function is used to write some information to the \texttt{log} -% file in case the |log-function| option is set. Otherwise its -% argument is ignored. Using this function rather than directly using -% \cs{iow_log:x} allows for \cs{__chk_suspend_log:} which disables -% such messages until the matching \cs{__chk_resume_log:}. These two -% commands are used to improve the logging for complicated datatypes. -% They should come in pairs, which can be nested. The function -% \cs{exp_not:o} is defined in \pkg{l3expan} later on but -% \cs{__chk_suspend_log:} and \cs{__chk_resume_log:} are not used -% before that point. -% \begin{macrocode} -%<*initex> -\cs_set_protected:Npn \__chk_log:x { \use_none:n } -\cs_set_protected:Npn \__chk_suspend_log: { } -\cs_set_protected:Npn \__chk_resume_log: { } -%</initex> -%<*package> -\tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \__chk_log:x { \iow_log:x } - \cs_set_protected:Npn \__chk_suspend_log: - { - \cs_set_protected:Npx \__chk_resume_log: - { - \cs_set_protected:Npn \__chk_resume_log: - { \exp_not:o { \__chk_resume_log: } } - \cs_set_protected:Npn \__chk_log:x - { \exp_not:o { \__chk_log:x } } - } - \cs_set_protected:Npn \__chk_log:x { \use_none:n } - } - \cs_set_protected:Npn \__chk_resume_log: { } -\else: - \cs_set_protected:Npn \__chk_log:x { \use_none:n } - \cs_set_protected:Npn \__chk_suspend_log: { } - \cs_set_protected:Npn \__chk_resume_log: { } -\fi: -%</package> -% \end{macrocode} -% \end{macro} -% % \begin{macro}[int] % {\__msg_kernel_error:nnxx, \__msg_kernel_error:nnx, \__msg_kernel_error:nn} % If an internal error occurs before \LaTeX3 has loaded \pkg{l3msg} then @@ -2362,6 +2326,142 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[documented-as=\iow_log:n]{\iow_log:x, \iow_term:x} +% We define a routine to write only to the log file. And a +% similar one for writing to both the log file and the terminal. +% These will be redefined later by \pkg{l3io}. +% \begin{macrocode} +\cs_set_protected:Npn \iow_log:x + { \tex_immediate:D \tex_write:D -1 } +\cs_set_protected:Npn \iow_term:x + { \tex_immediate:D \tex_write:D 16 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\debug_log_functions_on:, \debug_log_functions_off:} +% \begin{macro}[int]{\__debug_log:x, \__debug_suspend_log:, \__debug_resume_log:} +% When debugging is not enabled at all (including in the format), the +% \cs[index=debug_log_functions_on:]{debug_log_functions_on/off:} +% functions simply produce errors, while \cs{__debug_suspend_log:} and +% \cs{__debug_resume_log:} do nothing. +% \begin{macrocode} +\cs_set_protected:Npn \debug_log_functions_on: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_log_functions_on: } + } +\cs_set_protected:Npn \debug_log_functions_off: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_log_functions_off: } + } +\cs_set_protected:Npn \__debug_suspend_log: { } +\cs_set_protected:Npn \__debug_resume_log: { } +% \end{macrocode} +% Otherwise, they set up \cs{__debug_log:x}, +% \cs{__debug_suspend_log:}, and \cs{__debug_resume_log:} to have the +% following behaviour. The function \cs{__debug_log:x} is used to +% write some information to the \texttt{log} file in case the +% \texttt{log-function} option is active and to otherwise ignore its +% argument. Using this function rather than directly using +% \cs{iow_log:x} allows for \cs{__debug_suspend_log:} which disables +% such messages until the matching \cs{__debug_resume_log:}. These +% two commands are used to improve the logging for datatypes with +% multiple parts (currently only coffins). They should come in pairs, +% which can be nested. The function \cs{exp_not:o} is defined in +% \pkg{l3expan} later on but \cs{__debug_suspend_log:} and +% \cs{__debug_resume_log:} are not used before that point. Once +% everything is defined, turn logging on or off depending on what +% option was given. +% \begin{macrocode} +%<*package> +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \debug_log_functions_on: + { + \cs_set_protected:Npn \__debug_log:x { \iow_log:x } + \cs_set_protected:Npn \__debug_suspend_log: + { + \cs_set_protected:Npx \__debug_resume_log: + { + \cs_set_protected:Npn \__debug_resume_log: + { \exp_not:o { \__debug_resume_log: } } + \cs_set_protected:Npn \__debug_log:x + { \exp_not:o { \__debug_log:x } } + } + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \cs_set_protected:Npn \debug_log_functions_off: + { + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + \cs_set_protected:Npn \__debug_suspend_log: { } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \tex_ifodd:D \l@expl@log@functions@bool + \debug_log_functions_on: + \else: + \debug_log_functions_off: + \fi: +\fi: +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\__debug_patch:nnNw} +% \begin{macro}[aux] +% { +% \__debug_patch_param:NNnnNnp, +% \__debug_patch_new:nnNNnn, +% \__debug_patch_new_conditional:nnNNnnn +% } +% When debugging is not enabled, \cs{__debug_patch:nnNw} throws the +% patch away. Otherwise it can be followed by \cs{cs_new:Npn} or +% \cs{prg_new_conditional:Npnn} or their protected counterparts. In +% each case, grab the name of the function to be defined and its +% parameters using \cs{__debug_patch_param:w} then insert tokens +% before and after the definition. Of course for a conditional one +% should likely not insert anything after the code. +% \begin{macrocode} +\cs_set_protected:Npn \__debug_patch:nnNw #1#2 { } +%<*package> +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \__debug_patch:nnNw #1#2#3 + { + \tex_ifcase:D + \if_meaning:w #3 \cs_new_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_new:Npn 1~ \fi: + \if_meaning:w #3 \cs_set_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_set:Npn 1~ \fi: + \if_meaning:w #3 \cs_gset_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_gset:Npn 1~ \fi: + \if_meaning:w #3 \prg_new_protected_conditional:Npnn 2~ \fi: + \if_meaning:w #3 \prg_new_conditional:Npnn 2~ \fi: + \__msg_kernel_error:nnx { kernel } { debug-unpatchable } + { \token_to_str:N #3 } + \or: + \exp_after:wN \__debug_patch_param:NNnnNnp + \exp_after:wN \__debug_patch_new:nnNNnn + \else: + \exp_after:wN \__debug_patch_param:NNnnNnp + \exp_after:wN \__debug_patch_new_conditional:nnNNnnn + \fi: + \use_none:nn {#1} {#2} #3 + } + \cs_set_protected:Npn \__debug_patch_param:NNnnNnp #1#2#3#4#5#6#7# + { #1 {#3} {#4} #5 #6 {#7} } + \cs_set_protected:Npn \__debug_patch_new:nnNNnn #1#2#3#4#5#6 + { #3 #4 #5 { #1 #6 #2 } } + \cs_set_protected:Npn \__debug_patch_new_conditional:nnNNnnn + #1#2#3#4#5#6#7 + { #3 #4 #5 {#6} { #1 #7 #2 } } +\fi: +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}[int]{\__chk_if_free_cs:N, \__chk_if_free_cs:c} % This command is called by \cs{cs_new_nopar:Npn} and \cs{cs_new_eq:NN} % \emph{etc.}\ @@ -2371,6 +2471,8 @@ % issued. We have to make sure we don't put the argument into the % conditional processing since it may be an |\if...| type function! % \begin{macrocode} +\__debug_patch:nnNw { } + { \__debug_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \cs_set_protected:Npn \__chk_if_free_cs:N #1 { \cs_if_free:NF #1 @@ -2378,43 +2480,54 @@ \__msg_kernel_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } -} -%<*package> -\tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \__chk_if_free_cs:N #1 - { - \cs_if_free:NF #1 - { - \__msg_kernel_error:nnxx { kernel } { command-already-defined } - { \token_to_str:N #1 } { \token_to_meaning:N #1 } - } - \__chk_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } - } -\fi: -%</package> + } \cs_set_protected:Npn \__chk_if_free_cs:c { \exp_args:Nc \__chk_if_free_cs:N } % \end{macrocode} % \end{macro} % +% \begin{macro}{\debug_check_declarations_on:, \debug_check_declarations_off:} % \begin{macro}[int]{\__chk_if_exist_var:N} -% Create the checking function for variable definitions when the option -% is set. +% When debugging is not active these two user functions produce an +% error. Otherwise they set up \cs{__chk_if_exist_var:N}, a function +% which when \texttt{check-declarations} is active tests that a given +% variable is defined. % \begin{macrocode} +\cs_set_protected:Npn \debug_check_declarations_on: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_check_declarations_on: } + } +\cs_set_protected:Npn \debug_check_declarations_off: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_check_declarations_off: } + } %<*package> -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \__chk_if_exist_var:N #1 +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \debug_check_declarations_on: { - \cs_if_exist:NF #1 + \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { - \__msg_kernel_error:nnx { check } { non-declared-variable } - { \token_to_str:N #1 } + \cs_if_exist:NF ##1 + { + \__msg_kernel_error:nnx { check } { non-declared-variable } + { \token_to_str:N ##1 } + } } } + \cs_set_protected:Npn \debug_check_declarations_off: + { \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { } } + \tex_ifodd:D \l@expl@check@declarations@bool + \debug_check_declarations_on: + \else: + \debug_check_declarations_off: + \fi: \fi: %</package> % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[int]{\__chk_if_exist_cs:N, \__chk_if_exist_cs:c} % This function issues an error message when the control sequence @@ -2433,7 +2546,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{More new definitions} +% \subsection{Defining new functions} % % \begin{macro} % { @@ -2478,8 +2591,8 @@ % stands for csname argument, see the expansion module). Global % versions are also provided. % -% \cs{cs_set_nopar:cpn}\meta{string}\meta{rep-text} will turn \meta{string} -% into a csname and then assign \meta{rep-text} to it by using +% \cs{cs_set_nopar:cpn}\meta{string}\meta{rep-text} turns \meta{string} +% into a csname and then assigns \meta{rep-text} to it by using % \cs{cs_set_nopar:Npn}. This means that there might be a parameter % string between the two arguments. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 11032c534dd..161ac10180d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -24,10 +24,9 @@ % \begin{macro}{\GetIdInfo} % \begin{macro}[aux]{\GetIdInfoAuxI, \GetIdInfoAuxII, \GetIdInfoAuxIII} % The idea here is to extract out the information needed from a standard -% \textsc{svn} \texttt{Id} line, but without a line that will get -% changed when the file is checked in. Hence the fact that there is -% not a line which includes both a dollar sign and the \texttt{Id} -% keyword together! +% \textsc{svn} \texttt{Id} line, but to avoid a line that would get +% changed when the file is checked in. Hence the fact that none of the +% lines here include both a dollar sign and the \texttt{Id} keyword! % % At this stage, no test has taken place for the \eTeX{} extensions, and % so using \tn{protected} could give an error. To avoid that, it is used @@ -80,7 +79,7 @@ % Here, |#1| is |Id|, |#2| is the file name, |#3| is the extension, % |#4| is the version, |#5| is the check in date and |#6| is the check in % time and user, plus some trailing spaces. If |#4| is the marker |-1| value -% then |#5| and |#6| will be empty. +% then |#5| and |#6| are empty. % \begin{macrocode} \csname protected\endcsname\gdef\GetIdInfoAuxII$#1 #2.#3 #4 #5 #6$% {% @@ -139,7 +138,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -282,7 +281,7 @@ local t = { } for _,i in pairs(tex.extraprimitives("luatex")) do if string.match(i,"^U") then - if not string.match(i,"^Uchar$") then + if not string.match(i,"^Uchar$") then %$ table.insert(t,i) end end @@ -339,7 +338,7 @@ % \end{macrocode} % As the user might be making a custom format, no assumption is made about % matching package mode with only loading the \Lua{} code once. Instead, a -% query to \Lua{} will reveal what mode is in operation. +% query to \Lua{} reveals what mode is in operation. % \begin{macrocode} \ifnum 0% \directlua{ @@ -579,7 +578,7 @@ % \begin{macro}{\ExplSyntaxOff} % Before changing any category codes, in package mode we need to save % the situation before loading. Note the set up here means that once applied -% \cs{ExplSyntaxOff} will be a \enquote{do nothing} command until +% \cs{ExplSyntaxOff} becomes a \enquote{do nothing} command until % \cs{ExplSyntaxOn} is used. For format mode, there is no need to save % category codes so that step is skipped. % \begin{macrocode} @@ -629,7 +628,7 @@ % The idea here is that multiple \cs{ExplSyntaxOn} calls are not % going to mess up category codes, and that multiple calls to % \cs{ExplSyntaxOff} are also not wasting time. Applying -% \cs{ExplSyntaxOn} will alter the definition of \cs{ExplSyntaxOff} +% \cs{ExplSyntaxOn} alters the definition of \cs{ExplSyntaxOff} % and so in package mode this function should not be used until after % the end of the loading process! % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 5bc3bd3c2ce..7b27571dee6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -58,8 +58,8 @@ % \cs{box_new:N} \meta{box} % \end{syntax} % Creates a new \meta{box} or raises an error if the name is -% already taken. The declaration is global. The \meta{box} will -% initially be void. +% already taken. The declaration is global. The \meta{box} is +% initially void. % \end{function} % % \begin{function}{\box_clear:N, \box_clear:c, \box_gclear:N, \box_gclear:c} @@ -274,7 +274,7 @@ % \end{syntax} % Sets the \meta{box} equal to the last item (box) added to the current % partial list, removing the item from the list at the same time. When -% applied to the main vertical list, the \meta{box} will always be void as +% applied to the main vertical list, the \meta{box} is always void as % it is not possible to recover the last added item. % \end{function} % @@ -338,7 +338,7 @@ % \section{Boxes and color} % % All \LaTeX{}3 boxes are \enquote{color safe}: a color set inside the box -% will not apply after the end of the box has occurred. +% stops applying after the end of the box has occurred. % % \section{Horizontal mode boxes} % @@ -393,8 +393,7 @@ % \cs{hbox_overlap_right:n} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} into a horizontal box of zero width -% such that material will protrude to the right of the insertion -% point. +% such that material protrudes to the right of the insertion point. % \end{function} % % \begin{function}[updated = 2017-04-05]{\hbox_overlap_left:n} @@ -402,8 +401,7 @@ % \cs{hbox_overlap_left:n} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} into a horizontal box of zero width -% such that material will protrude to the left of the insertion -% point. +% such that material protrudes to the left of the insertion point. % \end{function} % % \begin{function}[updated = 2017-04-05] @@ -423,6 +421,21 @@ % where the \meta{content} may not be a simple argument. % \end{function} % +% \begin{function}[added = 2017-06-08] +% { +% \hbox_set_to_wd:Nnw, \hbox_set_to_wd:cnw, +% \hbox_gset_to_wd:Nnw, \hbox_gset_to_wd:cnw +% } +% \begin{syntax} +% \cs{hbox_set_to_wd:Nnw} \meta{box} \Arg{dimexpr} \meta{contents} \cs{hbox_set_end:} +% \end{syntax} +% Typesets the \meta{contents} to the width given by the \meta{dimexpr} +% and then stores the result inside the \meta{box}. In contrast +% to \cs{hbox_set_to_wd:Nnn} this function does not absorb the argument +% when finding the \meta{content}, and so can be used in circumstances +% where the \meta{content} may not be a simple argument +% \end{function} +% % \begin{function}{\hbox_unpack:N, \hbox_unpack:c} % \begin{syntax} % \cs{hbox_unpack:N} \meta{box} @@ -451,11 +464,11 @@ % Vertical boxes inherit their baseline from their contents. The % standard case is that the baseline of the box is at the same position % as that of the last item added to the box. This means that the box -% will have no depth unless the last item added to it had depth. As a +% has no depth unless the last item added to it had depth. As a % result most vertical boxes have a large height value and small or % zero depth. The exception are |_top| boxes, where the reference point % is that of the first item added. These tend to have a large depth and -% small height, although the latter will typically be non-zero. +% small height, although the latter is typically non-zero. % % \begin{function}[updated = 2017-04-05]{\vbox:n} % \begin{syntax} @@ -471,7 +484,7 @@ % \end{syntax} % Typesets the \meta{contents} into a vertical box of natural height % and includes this box in the current list for typesetting. The -% baseline of the box will be equal to that of the \emph{first} +% baseline of the box is equal to that of the \emph{first} % item added to the box. % \end{function} % @@ -507,7 +520,7 @@ % \cs{vbox_set_top:Nn} \meta{box} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The baseline of the box will be equal +% result inside the \meta{box}. The baseline of the box is equal % to that of the \emph{first} item added to the box. % \end{function} % @@ -540,6 +553,22 @@ % where the \meta{content} may not be a simple argument. % \end{function} % +% \begin{function}[added = 2017-06-08] +% { +% \vbox_set_to_ht:Nnw, \vbox_set_to_ht:cnw, +% \vbox_gset_to_ht:Nnw, \vbox_gset_to_ht:cnw +% } +% \begin{syntax} +% \cs{vbox_set_to_wd:Nnw} \meta{box} \Arg{dimexpr} \meta{contents} \cs{vbox_set_end:} +% \end{syntax} +% Typesets the \meta{contents} to the height given by the \meta{dimexpr} +% and then stores the result inside the \meta{box}. In contrast +% to \cs{vbox_set_to_ht:Nnn} this function does not absorb the argument +% when finding the \meta{content}, and so can be used in circumstances +% where the \meta{content} may not be a simple argument +% \end{function} +% +% % \begin{function}[updated = 2011-10-22]{\vbox_set_split_to_ht:NNn} % \begin{syntax} % \cs{vbox_set_split_to_ht:NNn} \meta{box_1} \meta{box_2} \Arg{dimexpr} @@ -591,13 +620,13 @@ % Resizes the \meta{box} to fit within the given \meta{x-size} (horizontally) % and \meta{y-size} (vertically); both of the sizes are dimension % expressions. The \meta{y-size} is the height only: it does not include any -% depth. The updated \meta{box} will be an |hbox|, irrespective of the nature +% depth. The updated \meta{box} is an |hbox|, irrespective of the nature % of the \meta{box} before the resizing is applied. The final size of the -% \meta{box} will be the smaller of \Arg{x-size} and \Arg{y-size}, -% \emph{i.e.}~the result will fit within the dimensions specified. 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. Thus a negative -% \meta{y-size} will result in the \meta{box} having a depth dependent on the +% \meta{box} is the smaller of \Arg{x-size} and \Arg{y-size}, +% \emph{i.e.}~the result fits within the dimensions specified. Negative +% sizes cause the material in the \meta{box} to be reversed in direction, +% but the reference point of the \meta{box} is unchanged. Thus a negative +% \meta{y-size} results in the \meta{box} having a depth dependent on the % height of the original and \emph{vice versa}. The resizing applies within % the current \TeX{} group level. % \end{function} @@ -610,13 +639,13 @@ % Resizes the \meta{box} to fit within the given \meta{x-size} (horizontally) % and \meta{y-size} (vertically); both of the sizes are dimension % expressions. The \meta{y-size} is the total vertical size (height plus -% depth). The updated \meta{box} will be an |hbox|, irrespective of the nature +% depth). The updated \meta{box} is an |hbox|, irrespective of the nature % of the \meta{box} before the resizing is applied. The final size of the -% \meta{box} will be the smaller of \Arg{x-size} and \Arg{y-size}, -% \emph{i.e.}~the result will fit within the dimensions specified. 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. Thus a negative -% \meta{y-size} will result in the \meta{box} having a depth dependent on the +% \meta{box} is the smaller of \Arg{x-size} and \Arg{y-size}, +% \emph{i.e.}~the result fits within the dimensions specified. Negative +% sizes cause the material in the \meta{box} to be reversed in direction, +% but the reference point of the \meta{box} is unchanged. Thus a negative +% \meta{y-size} results in the \meta{box} having a depth dependent on the % height of the original and \emph{vice versa}. The resizing applies within % the current \TeX{} group level. % \end{function} @@ -629,11 +658,11 @@ % Resizes the \meta{box} to \meta{y-size} (vertically), scaling the horizontal % size by the same amount; \meta{y-size} is a dimension expression. The % \meta{y-size} is the height only: it does not include any depth. The updated -% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} -% before the resizing is applied. A negative \meta{y-size} will cause the +% \meta{box} is an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. A negative \meta{y-size} causes the % material in the \meta{box} to be reversed in direction, but the reference -% point of the \meta{box} will be unchanged. Thus a negative \meta{y-size} -% will result in the \meta{box} having a depth dependent on the height of the +% point of the \meta{box} is unchanged. Thus a negative \meta{y-size} +% results in the \meta{box} having a depth dependent on the height of the % original and \emph{vice versa}. The resizing applies within the current % \TeX{} group level. % \end{function} @@ -646,11 +675,11 @@ % Resizes the \meta{box} to \meta{y-size} (vertically), scaling the horizontal % size by the same amount; \meta{y-size} is a dimension expression. The % \meta{y-size} is the total vertical size (height plus depth). The updated -% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} -% before the resizing is applied. A negative \meta{y-size} will cause +% \meta{box} is an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. A negative \meta{y-size} causes % the material in the \meta{box} to be reversed in direction, but the -% reference point of the \meta{box} will be unchanged. Thus a negative -% \meta{y-size} will result in the \meta{box} having a depth dependent on the +% reference point of the \meta{box} is unchanged. Thus a negative +% \meta{y-size} results in the \meta{box} having a depth dependent on the % height of the original and \emph{vice versa}. The resizing applies within % the current \TeX{} group level. % \end{function} @@ -661,11 +690,11 @@ % \end{syntax} % Resizes the \meta{box} to \meta{x-size} (horizontally), scaling the vertical % size by the same amount; \meta{x-size} is a dimension expression. The updated -% \meta{box} will be an |hbox|, irrespective of the nature of the \meta{box} -% before the resizing is applied. A negative \meta{x-size} will cause the +% \meta{box} is an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. A negative \meta{x-size} causes the % material in the \meta{box} to be reversed in direction, but the reference -% point of the \meta{box} will be unchanged. Thus a negative \meta{x-size} -% will result in the \meta{box} having a depth dependent on the height of the +% point of the \meta{box} is unchanged. Thus a negative \meta{x-size} +% results in the \meta{box} having a depth dependent on the height of the % original and \emph{vice versa}. The resizing applies within the current % \TeX{} group level. % \end{function} @@ -678,10 +707,10 @@ % Resizes the \meta{box} to \meta{x-size} (horizontally) and \meta{y-size} % (vertically): both of the sizes are dimension expressions. The % \meta{y-size} is the height only and does not include any depth. 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 +% \meta{box} is an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. Negative sizes cause the material in % the \meta{box} to be reversed in direction, but the reference point of the -% \meta{box} will be unchanged. Thus a negative \meta{y-size} will result in +% \meta{box} is unchanged. Thus a negative \meta{y-size} results in % the \meta{box} having a depth dependent on the height of the original and % \emph{vice versa}. The resizing applies within the current \TeX{} group % level. @@ -695,10 +724,10 @@ % Resizes the \meta{box} to \meta{x-size} (horizontally) and \meta{y-size} % (vertically): both of the sizes are dimension expressions. The % \meta{y-size} is the total vertical size (height plus depth). 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 +% \meta{box} is an |hbox|, irrespective of the nature of the \meta{box} +% before the resizing is applied. Negative sizes cause the material in % the \meta{box} to be reversed in direction, but the reference point of the -% \meta{box} will be unchanged. Thus a negative \meta{y-size} will result in +% \meta{box} is unchanged. Thus a negative \meta{y-size} results in % the \meta{box} having a depth dependent on the height of the original and % \emph{vice versa}. The resizing applies within the current \TeX{} group % level. @@ -709,9 +738,9 @@ % \cs{box_rotate:Nn} \meta{box} \Arg{angle} % \end{syntax} % Rotates the \meta{box} by \meta{angle} (in degrees) anti-clockwise about -% its reference point. The reference point of the updated box will be moved +% its reference point. The reference point of the updated box is moved % horizontally such that it is at the left side of the smallest rectangle -% enclosing the rotated material. The updated \meta{box} will be an |hbox|, +% enclosing the rotated material. The updated \meta{box} is an |hbox|, % irrespective of the nature of the \meta{box} before the rotation is applied. % The rotation applies within the current \TeX{} group level. % \end{function} @@ -722,11 +751,11 @@ % \end{syntax} % Scales the \meta{box} by factors \meta{x-scale} and \meta{y-scale} in % the horizontal and vertical directions, respectively (both scales are -% integer expressions). The updated \meta{box} will be an |hbox|, irrespective +% integer expressions). The updated \meta{box} is an |hbox|, irrespective % 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. -% Thus a negative \meta{y-scale} will result in the \meta{box} having a depth +% scalings cause the material in the \meta{box} to be reversed in +% direction, but the reference point of the \meta{box} is unchanged. +% Thus a negative \meta{y-scale} results in the \meta{box} having a depth % dependent on the height of the original and \emph{vice versa}. The resizing % applies within the current \TeX{} group level. % \end{function} @@ -1196,6 +1225,24 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\hbox_set_to_wd:Nnw, \hbox_set_to_wd:cnw} +% \begin{macro}{\hbox_gset_to_wd:Nnw, \hbox_gset_to_wd:cnw} +% Combining the above ideas. +% \begin{macrocode} +\cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2 + { + \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: + \c_group_begin_token + \group_begin: + } +\cs_new_protected:Npn \hbox_gset_to_wd:Nnw + { \tex_global:D \hbox_set_to_wd:Nnw } +\cs_generate_variant:Nn \hbox_set_to_wd:Nnw { c } +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnw { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\hbox_to_wd:nn} % \begin{macro}{\hbox_to_zero:n} % \testfile* @@ -1358,6 +1405,24 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\vbox_set_to_ht:Nnw, \vbox_set_to_ht:cnw} +% \begin{macro}{\vbox_gset_to_ht:Nnw, \vbox_gset_to_ht:cnw} +% A combination of the above ideas. +% \begin{macrocode} +\cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2 + { + \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: + \c_group_begin_token + \group_begin: + } +\cs_new_protected:Npn \vbox_gset_to_ht:Nnw + { \tex_global:D \vbox_set_to_ht:Nnw } +\cs_generate_variant:Nn \vbox_set_to_ht:Nnw { c } +\cs_generate_variant:Nn \vbox_gset_to_ht:Nnw { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\vbox_unpack:N, \vbox_unpack:c} % \begin{macro}{\vbox_unpack_clear:N, \vbox_unpack_clear:c} % \testfile* @@ -1457,8 +1522,8 @@ } } % \end{macrocode} -% The edges of the box are then recorded: the left edge will -% always be at zero. Rotation of the four edges then takes place: this is +% The edges of the box are then recorded: the left edge is +% always at zero. Rotation of the four edges then takes place: this is % most efficiently done on a quadrant by quadrant basis. % \begin{macrocode} \cs_new_protected:Npn \@@_rotate:N #1 @@ -1523,7 +1588,7 @@ % The position of the box edges are now known, but the box at this % stage be misplaced relative to the current \TeX{} reference point. So the % content of the box is moved such that the reference point of the -% rotated box will be in the same place as the original. +% rotated box is in the same place as the original. % \begin{macrocode} \hbox_set:Nn \l_@@_internal_box { \box_use:N #1 } \hbox_set:Nn \l_@@_internal_box @@ -1862,8 +1927,8 @@ % \end{macro} % % \begin{macro}[aux]{\@@_resize_common:N} -% The main resize function places in input into a box which will start -% of with zero width, and includes the handles for engine rescaling. +% The main resize function places its input into a box which start +% off with zero width, and includes the handles for engine rescaling. % \begin{macrocode} \cs_new_protected:Npn \@@_resize_common:N #1 { @@ -1917,7 +1982,7 @@ % % \subsection{Deprecated functions} % -% \begin{macro}{\box_resize:Nnn, \box_resize:cnn} +% \begin{macro}[deprecated = 2018-12-31]{\box_resize:Nnn, \box_resize:cnn} % \begin{macrocode} \cs_new_eq:NN \box_resize:Nnn \box_resize_to_wd_and_ht_plus_dp:Nnn \cs_new_eq:NN \box_resize:cnn \box_resize_to_wd_and_ht_plus_dp:cnn diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index aeb2ce1469b..e8f04f06024 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -82,6 +82,51 @@ % into the kernel. However, real use sometimes leads to better ideas, so functions from this module are % \textbf{not necessarily stable} and we may have to adjust them! % +% \section{Additions to \pkg{l3basics}} +% +% \begin{function}[added = 2017-07-14] +% {\debug_check_declarations_on:, \debug_check_declarations_off:} +% \begin{syntax} +% \cs{debug_check_declarations_on:} +% \cs{debug_check_declarations_off:} +% \end{syntax} +% Turn on and off within a group the code that checks that all +% \pkg{expl3} variables used were previously declared, as done +% globally by the \texttt{check-declarations} option. This can only +% be used if \pkg{expl3} is loaded with one of the options +% \texttt{check-declarations}, \texttt{log-functions}, or +% \texttt{enable-debug}. +% \end{function} +% +% \begin{function}[added = 2017-07-14] +% {\debug_log_functions_on:, \debug_log_functions_off:} +% \begin{syntax} +% \cs{debug_log_functions_on:} +% \cs{debug_log_functions_off:} +% \end{syntax} +% Turn on and off within a group the code that logs function +% definitions, as done globally by the \texttt{log-functions} option. +% This can only be used if \pkg{expl3} is loaded with one of the +% options \texttt{check-declarations}, \texttt{log-functions}, or +% \texttt{enable-debug}. +% \end{function} +% +% \begin{function}[added = 2017-07-04]{\mode_leave_vertical:} +% \begin{syntax} +% \cs{mode_leave_vertical:} +% \end{syntax} +% Ensures that \TeX{} is not in vertical (inter-paragraph) mode. In +% horizontal or math mode this command has no effect, in vertical mode it +% switches to horizontal mode, and inserts a box of width +% \tn{parindent}, followed by the \tn{everypar} token list. +% \begin{texnote} +% This results in the contents of the \tn{everypar} token register being +% inserted, after \cs{mode_leave_vertical:} is complete. Notice that in +% contrast to the \LaTeXe{} \tn{leavevmode} approach, no box is used +% by the method implemented here. +% \end{texnote} +% \end{function} +% % \section{Additions to \pkg{l3box}} % % \subsection{Viewing part of a box} @@ -91,11 +136,11 @@ % \cs{box_clip:N} \meta{box} % \end{syntax} % Clips the \meta{box} in the output so that only material inside the -% bounding box is displayed in the output. The updated \meta{box} will be an +% bounding box is displayed in the output. The updated \meta{box} is an % hbox, irrespective of the nature of the \meta{box} before the clipping is % applied. The clipping applies within the current \TeX{} group level. % -% \textbf{These functions require the \LaTeX3 native drivers: they will +% \textbf{These functions require the \LaTeX3 native drivers: they do % not work with the \LaTeXe{} \pkg{graphics} drivers!} % % \begin{texnote} @@ -113,9 +158,9 @@ % Adjusts the bounding box of the \meta{box} \meta{left} is removed from % the left-hand edge of the bounding box, \meta{right} from the right-hand % edge and so fourth. All adjustments are \meta{dimension expressions}. -% Material output of the bounding box will still be displayed in the output +% Material outside of the bounding box is still displayed in the output % unless \cs{box_clip:N} is subsequently applied. -% The updated \meta{box} will be an +% The updated \meta{box} is an % hbox, irrespective of the nature of the \meta{box} before the trim % operation is applied. The adjustment applies within the current \TeX{} % group level. The behavior of the operation where the trims requested is @@ -129,10 +174,10 @@ % Adjusts the bounding box of the \meta{box} such that it has lower-left % co-ordinates (\meta{llx}, \meta{lly}) and upper-right co-ordinates % (\meta{urx}, \meta{ury}). All four co-ordinate positions are -% \meta{dimension expressions}. Material output of the bounding box will -% still be displayed in the output unless \cs{box_clip:N} is +% \meta{dimension expressions}. Material outside of the bounding box is +% still displayed in the output unless \cs{box_clip:N} is % subsequently applied. -% The updated \meta{box} will be an +% The updated \meta{box} is an % hbox, irrespective of the nature of the \meta{box} before the viewport % operation is applied. The adjustment applies within the current \TeX{} % group level. @@ -152,7 +197,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -172,8 +217,8 @@ % \cs{coffin_rotate:Nn} \meta{coffin} \Arg{angle} % \end{syntax} % Rotates the \meta{coffin} by the given \meta{angle} (given in -% degrees counter-clockwise). This process will rotate both the -% coffin content and poles. Multiple rotations will not result in +% degrees counter-clockwise). This process rotates both the +% coffin content and poles. Multiple rotations do not result in % the bounding box of the coffin growing unnecessarily. % \end{function} % @@ -188,6 +233,46 @@ % % \section{Additions to \pkg{l3file}} % +% \begin{function}[added = 2017-07-11]{\file_get_mdfive_hash:nN} +% \begin{syntax} +% \cs{file_get_mdfive_hash:nN} \Arg{file name} \meta{str var} +% \end{syntax} +% Searches for \meta{file name} using the current \TeX{} search +% path and the additional paths controlled by \cs{file_path_include:n}. +% If found, sets the \meta{str var} to the MD5 sum generated from the +% content of the file. +% Where the file is not found, the \meta{str var} will be empty. +% \end{function} +% +% \begin{function}[added = 2017-07-09]{\file_get_size:nN} +% \begin{syntax} +% \cs{file_get_size:nN} \Arg{file name} \meta{str var} +% \end{syntax} +% Searches for \meta{file name} using the current \TeX{} search +% path and the additional paths controlled by \cs{file_path_include:n}. +% If found, sets the \meta{str var} to the size of the file in bytes. +% Where the file is not found, the \meta{str var} will be empty. +% \begin{texnote} +% The \XeTeX{} engine provides no way to implement this function. +% \end{texnote} +% \end{function} +% +% \begin{function}[added = 2017-07-09]{\file_get_timestamp:nN} +% \begin{syntax} +% \cs{file_get_timestamp:nN} \Arg{file name} \meta{str var} +% \end{syntax} +% Searches for \meta{file name} using the current \TeX{} search +% path and the additional paths controlled by \cs{file_path_include:n}. +% If found, sets the \meta{str var} to the modification timestamp of +% the file in the form |D:|\meta{year}\meta{month}\meta{day}\meta{hour}^^A +% \meta{minute}\meta{second}\meta{offset}, where the latter may be |Z| +% (UTC) or \meta{plus-minus}\meta{hours}|'|\meta{minutes}|'|. +% Where the file is not found, the \meta{str var} will be empty. +% \begin{texnote} +% The \XeTeX{} engine provides no way to implement this function. +% \end{texnote} +% \end{function} +% % \begin{function}[TF, added = 2014-07-02]{\file_if_exist_input:n} % \begin{syntax} % \cs{file_if_exist_input:n} \Arg{file name} @@ -195,20 +280,30 @@ % \end{syntax} % Searches for \meta{file name} using the current \TeX{} search % path and the additional paths controlled by -% \cs{file_path_include:n}). If found, inserts the \meta{true code} then +% \cs{file_path_include:n}. If found, inserts the \meta{true code} then % reads in the file as additional \LaTeX{} source as described for % \cs{file_input:n}. Note that \cs{file_if_exist_input:n} does not raise % an error if the file is not found, in contrast to \cs{file_input:n}. % \end{function} % -% \begin{function}[added = 2014-08-22] -% {\ior_log_streams:, \iow_log_streams:} +% \begin{function}[added = 2017-07-07]{\file_input_stop:} % \begin{syntax} -% \cs{ior_log_streams:} -% \cs{iow_log_streams:} +% \cs{file_input_stop:} % \end{syntax} -% Writes in the log file a list of the file names associated with each -% open stream: intended for tracking down problems. +% Ends the reading of a file started by \cs{file_input:n} or similar before +% the end of the file is reached. Where the file reading is being terminated +% due to an error, \cs{msg_critical:nn(nn)} should be preferred. +% \begin{texnote} +% This function must be used on a line on its own: \TeX{} reads files +% line-by-line and so any additional tokens in the \enquote{current} line +% will still be read. +% +% This is also true if the function is hidden inside another function +% (which will be the normal case), i.e., all tokens on the same line +% in the source file are still processed. Putting it on a line by itself +% in the definition doesn't help as it is the line where it is used that +% counts! +% \end{texnote} % \end{function} % % \section{Additions to \pkg{l3int}} @@ -283,7 +378,7 @@ % \begin{verbatim} % \prop_map_tokens:Nn \l_my_prop { \str_if_eq:nnT { mykey } } % \end{verbatim} -% will expand to the value corresponding to \texttt{mykey}: for each +% expands to the value corresponding to \texttt{mykey}: for each % pair in |\l_my_prop| the function \cs{str_if_eq:nnT} receives % \texttt{mykey}, the \meta{key} and the \meta{value} as its three % arguments. For that specific task, \cs{prop_item:Nn} is faster. @@ -301,7 +396,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{value} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -318,9 +413,9 @@ % \end{syntax} % Applies \meta{function} to every pair of items % \meta{seq_1-item}--\meta{seq_2-item} from the two sequences, returning -% items from both sequences from left to right. The \meta{function} will -% receive two \texttt{n}-type arguments for each iteration. The mapping -% will terminate when +% items from both sequences from left to right. The \meta{function} +% receives two \texttt{n}-type arguments for each iteration. The mapping +% terminates when % the end of either sequence is reached (\emph{i.e.}~whichever sequence has % fewer items determines how many iterations % occur). @@ -331,13 +426,13 @@ % \cs{seq_set_filter:NNn} \meta{sequence_1} \meta{sequence_2} \Arg{inline boolexpr} % \end{syntax} % Evaluates the \meta{inline boolexpr} for every \meta{item} stored -% within the \meta{sequence_2}. The \meta{inline boolexpr} will -% receive the \meta{item} as |#1|. The sequence of all \meta{items} +% within the \meta{sequence_2}. The \meta{inline boolexpr} +% receives the \meta{item} as |#1|. The sequence of all \meta{items} % for which the \meta{inline boolexpr} evaluated to \texttt{true} % is assigned to \meta{sequence_1}. % \begin{texnote} % Contrarily to other mapping functions, \cs{seq_map_break:} cannot -% be used in this function, and will lead to low-level \TeX{} errors. +% be used in this function, and would lead to low-level \TeX{} errors. % \end{texnote} % \end{function} % @@ -355,7 +450,7 @@ % in \meta{inline function} should be expandable. % \begin{texnote} % Contrarily to other mapping functions, \cs{seq_map_break:} cannot -% be used in this function, and will lead to low-level \TeX{} errors. +% be used in this function, and would lead to low-level \TeX{} errors. % \end{texnote} % \end{function} % @@ -369,7 +464,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -438,8 +533,8 @@ % \cs{sys_if_shell_p:} % \cs{sys_if_shell:TF} \Arg{true code} \Arg{false code} % \end{syntax} -% Performs a check for whether shell escape is enabled. This will -% return true if either of restricted or unrestircted shell escape +% Performs a check for whether shell escape is enabled. This +% returns true if either of restricted or unrestricted shell escape % is enabled. % \end{function} % @@ -458,7 +553,7 @@ % \cs{sys_if_shell_restricted:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Performs a check for whether \emph{restricted} shell escape is -% enabled. This will return false if unrestricted shell escape is +% enabled. This returns false if unrestricted shell escape is % enabled. Unrestricted shell escape is not considered a superset % of restricted shell escape in this case. To find whether any % shell escape is enabled use \cs{sys_if_shell:}. @@ -495,8 +590,8 @@ % \cs{tl_reverse_tokens:n} \Arg{tokens} % \end{syntax} % This function, which works directly on \TeX{} tokens, reverses -% the order of the \meta{tokens}: the first will be the last and -% the last will become first. Spaces are preserved. The reversal +% the order of the \meta{tokens}: the first becomes the last and +% the last becomes first. Spaces are preserved. The reversal % also operates within brace groups, but the braces themselves % are not exchanged, as this would lead to an unbalanced token % list. For instance, \cs{tl_reverse_tokens:n} |{a~{b()}}| @@ -505,7 +600,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the token -% list will not expand further when appearing in an \texttt{x}-type +% list does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -534,7 +629,7 @@ % These functions are intended to be applied to input which may be % regarded broadly as \enquote{text}. They traverse the \meta{tokens} and % change the case of characters as discussed below. The character code of -% the characters replaced may be arbitrary: the replacement characters will +% the characters replaced may be arbitrary: the replacement characters % have standard document-level category codes ($11$ for letters, $12$ for % letter-like characters which can also be case-changed). Begin-group and % end-group characters in the \meta{tokens} are normalized and become |{| @@ -547,16 +642,16 @@ % \end{function} % % The functions perform expansion on the input in most cases. In particular, -% input in the form of token lists or expandable functions will be expanded +% input in the form of token lists or expandable functions is expanded % \emph{unless} it falls within one of the special handling classes described % below. This expansion approach means that in general the result of case -% changing will match the \enquote{natural} outcome expected from a +% changing matches the \enquote{natural} outcome expected from a % \enquote{functional} approach to case modification. For example % \begin{verbatim} % \tl_set:Nn \l_tmpa_tl { hello } % \tl_upper_case:n { \l_tmpa_tl \c_space_tl world } % \end{verbatim} -% will produce +% produces % \begin{verbatim} % HELLO WORLD % \end{verbatim} @@ -566,11 +661,11 @@ % from the \pkg{etoolbox} package. % % \begin{variable}{\l_tl_case_change_math_tl} -% Case changing will not take place within math mode material so for example +% Case changing does not take place within math mode material so for example % \begin{verbatim} % \tl_upper_case:n { Some~text~$y = mx + c$~with~{Braces} } % \end{verbatim} -% will become +% becomes % \begin{verbatim} % SOME TEXT $y = mx + c$ WITH {BRACES} % \end{verbatim} @@ -682,7 +777,7 @@ % engine treats input outside of this range as east Asian. % % Context-sensitive mappings are enabled: language-dependent cases are -% discussed below. Context detection will expand input but treats any +% discussed below. Context detection expands input but treats any % unexpandable control sequences as \enquote{failures} to match a context. % % Language-sensitive conversions are enabled using the \meta{language} @@ -755,7 +850,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -778,7 +873,7 @@ % \iow_term:x { \tl_range:nnn { abcdef } { -2 } { -1 } } % \iow_term:x { \tl_range:nnn { abcdef } { 0 } { -1 } } % \end{verbatim} -% will print \texttt{{b}{c}{d}{e}}, \texttt{{c}{d}{e}{f}}, \texttt{{e}{f}}, and an empty +% prints \texttt{{b}{c}{d}{e}}, \texttt{{c}{d}{e}{f}}, \texttt{{e}{f}}, and an empty % line to the terminal. The \meta{start index} must always be smaller than % or equal to the \meta{end index}: if this is not the case then no output % is generated. Thus @@ -790,7 +885,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -802,7 +897,7 @@ % \cs{peek_N_type:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the next \meta{token} in the input stream can be safely -% grabbed as an \texttt{N}-type argument. The test will be \meta{false} +% grabbed as an \texttt{N}-type argument. The test is \meta{false} % if the next \meta{token} is either an explicit or implicit % begin-group or end-group token (with any character code), or % an explicit or implicit space character (with character code $32$ @@ -810,9 +905,9 @@ % and \meta{true} in all other cases. % Note that a \meta{true} result ensures that the next \meta{token} is % a valid \texttt{N}-type argument. However, if the next \meta{token} -% is for instance \cs{c_space_token}, the test will take the +% is for instance \cs{c_space_token}, the test takes the % \meta{false} branch, even though the next \meta{token} is in fact -% a valid \texttt{N}-type argument. The \meta{token} will be left +% a valid \texttt{N}-type argument. The \meta{token} is left % in the input stream after the \meta{true code} or \meta{false code} % (as appropriate to the result of the test). % \end{function} @@ -827,6 +922,36 @@ %<*initex|package> % \end{macrocode} % +% \subsection{Additions to \pkg{l3basics}} +% +% \begin{macro}{\mode_leave_vertical:} +% The approach here is different to that used by \LaTeXe{} or plain \TeX{}, +% which unbox a void box to force horizontal mode. That inserts the +% \tn{everypar} tokens \emph{before} the re-inserted unboxing tokens. The +% approach here uses either the \tn{quitvmode} primitive or the equivalent +% protected macro. In vertical mode, the \tn{indent} primitive is inserted: +% this will switch to horizontal mode and insert \tn{everypar} tokens and +% nothing else. Unlike the \LaTeXe{} version, the availability of \eTeX{} +% means using a mode test can be done at for example the start of an +% \tn{halign}. The \tn{quitvmode} primitive essentially wraps the same +% code up at the engine level. +% \begin{macrocode} +\cs_new_protected:Npx \mode_leave_vertical: + { + \cs_if_exist:NTF \pdftex_quitvmode:D + { \pdftex_quitvmode:D } + { + \exp_not:n + { + \if_mode_vertical: + \exp_after:wN \tex_indent:D + \fi: + } + } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Additions to \pkg{l3box}} % % \begin{macrocode} @@ -1355,7 +1480,7 @@ \prop_map_inline:cn { l_@@_poles_ \__int_value:w #1 _prop } { \@@_scale_pole:Nnnnnn #1 {##1} ##2 } % \end{macrocode} -% Negative $x$-scaling values will place the poles in the wrong +% Negative $x$-scaling values place the poles in the wrong % location: this is corrected here. % \begin{macrocode} \fp_compare:nNnT \l_@@_scale_x_fp < \c_zero_fp @@ -1463,51 +1588,121 @@ %<@@=file> % \end{macrocode} % +% \begin{macro} +% {\file_get_mdfive_hash:nN, \file_get_size:nN, \file_get_timestamp:nN} +% \begin{macro}[aux]{\@@_get_details:nnN} +% These are all wrappers around the \pdfTeX{} primitives doing the same +% jobs: as we want consistent file paths to be found, they are all set up +% using \cs{file_get_full_name:nN} and so are non-expandable \texttt{get} +% functions. Much of the code is repetitive but we need to branch for +% \LuaTeX{} (emulation in Lua), for the slightly different syntax +% needed for \tn{pdftex_mdfivesum:D} and for the fact that primitive +% coverage varies in other engines. +% \begin{macrocode} +\cs_new_protected:Npn \file_get_mdfive_hash:nN #1#2 + { \@@_get_details:nnN {#1} { mdfivesum } {#2} } +\cs_new_protected:Npn \file_get_size:nN #1#2 + { \@@_get_details:nnN {#1} { size } {#2} } +\cs_new_protected:Npn \file_get_timestamp:nN #1#2 + { \@@_get_details:nnN {#1} { moddate } {#2} } +\cs_new_protected:Npn \@@_get_details:nnN #1#2#3 + { + \file_get_full_name:nN {#1} \l_@@_full_name_str + \str_set:Nx #3 + { + \use:c { pdftex_file #2 :D } \exp_after:wN + { \l_@@_full_name_str } + } + } +\cs_if_exist:NTF \luatex_directlua:D + { + \cs_set_protected:Npn \@@_get_details:nnN #1#2#3 + { + \file_get_full_name:nN {#1} \l_@@_full_name_str + \str_set:Nx #3 + { + \lua_now_x:n + { + l3kernel.file#2 + ( " \lua_escape_x:n { \l_@@_full_name_str } " ) + } + } + } + } + { + \cs_set_protected:Npn \file_get_mdfive_hash:nN #1#2 + { + \file_get_full_name:nN {#1} \l_@@_full_name_str + \tl_set:Nx #2 + { + \pdftex_mdfivesum:D file \exp_after:wN + { \l_@@_full_name_str } + } + } + \cs_if_exist:NT \xetex_XeTeXversion:D + { + \cs_set_protected:Npn \@@_get_details:nnN #1#2#3 + { + \tl_clear:N #3 + \__msg_kernel_error:nnx + { kernel } { xetex-primitive-not-available } + { \exp_not:c { pdffile #2 } } + } + } + } +\__msg_kernel_new:nnnn { kernel } { xetex-primitive-not-available } + { Primitive~\token_to_str:N #1 not~available } + { + XeTeX~does~not~currently~provide~functionality~equivalent~to~the~ + \token_to_str:N #1 primitive. + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}[TF]{\file_if_exist_input:n} % Input of a file with a test for existence cannot be done the usual % way as the tokens to insert are in an odd place. % \begin{macrocode} \cs_new_protected:Npn \file_if_exist_input:n #1 { - \file_if_exist:nT {#1} - { \@@_input:V \l_@@_internal_name_tl } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str + { \@@_input:V \l__file_full_name_str } } \cs_new_protected:Npn \file_if_exist_input:nT #1#2 { - \file_if_exist:nT {#1} + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str { #2 - \@@_input:V \l_@@_internal_name_tl + \@@_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nF #1 +\cs_new_protected:Npn \file_if_exist_input:nF #1#2 { - \file_if_exist:nTF {#1} - { \@@_input:V \l_@@_internal_name_tl } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + {#2} + { \@@_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nTF #1#2 +\cs_new_protected:Npn \file_if_exist_input:nTF #1#2#3 { - \file_if_exist:nTF {#1} + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + {#3} { #2 - \@@_input:V \l_@@_internal_name_tl + \@@_input:V \l__file_full_name_str } } % \end{macrocode} % \end{macro} -% \begin{macro}{\ior_log_streams:} -% Redirect output of \cs{ior_list_streams:} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \ior_log_streams: - { \__msg_log_next: \ior_list_streams: } -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\iow_log_streams:} -% Redirect output of \cs{iow_list_streams:} to the log. +% \begin{macro}{\file_input_stop:} +% A simple rename. % \begin{macrocode} -\cs_new_protected:Npn \iow_log_streams: - { \__msg_log_next: \iow_list_streams: } +\cs_new_protected:Npn \file_input_stop: { \tex_endinput:D } % \end{macrocode} % \end{macro} % @@ -1761,10 +1956,10 @@ % usual |{ ? \__prg_break: } { }| to the end of each one. This is % most conveniently done in two steps using an auxiliary function. % The mapping then throws away the first tokens of |#2| and |#5|, -% which for items in the sequences will both be \cs{s_@@} -% \cs{@@_item:n}. The function to be mapped will then be applied to +% which for items in both sequences are \cs{s_@@} +% \cs{@@_item:n}. The function to be mapped are then be applied to % the two entries. When the code hits the end of one of the -% sequences, the break material will stop the entire loop and tidy up. +% sequences, the break material stops the entire loop and tidy up. % This avoids needing to find the count of the two sequences, or % worrying about which is longer. % \begin{macrocode} @@ -1937,8 +2132,8 @@ % \end{variable} % % \begin{macro}[EXP, pTF]{\sys_if_shell:} -% Performs a check for whether shell escape is enabled. This will -% return true if either of restricted or unrestricted shell escape +% Performs a check for whether shell escape is enabled. This +% returns true if either of restricted or unrestricted shell escape % is enabled. % \begin{macrocode} \prg_new_conditional:Nnn \sys_if_shell: { p , T , F , TF } @@ -1969,7 +2164,7 @@ % % \begin{macro}[EXP, pTF]{\sys_if_shell_unrestricted:} % Performs a check for whether \emph{restricted} shell escape is -% enabled. This will return false if unrestricted shell escape is +% enabled. This returns false if unrestricted shell escape is % enabled. Unrestricted shell escape is not considered a superset % of restricted shell escape in this case. To find whether any % shell escape is enabled use \cs{sys_if_shell:}. @@ -2162,7 +2357,9 @@ \cs_generate_variant:Nn \tl_gset_from_file:Nnn { c } \cs_new_protected:Npn \@@_set_from_file:NNnn #1#2#3#4 { - \__file_if_exist:nT {#4} + \file_get_full_name:nN {#4} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#4} } { \group_begin: \exp_args:No \etex_everyeof:D @@ -2170,7 +2367,7 @@ #3 \scan_stop: \exp_after:wN \@@_from_file_do:w \exp_after:wN \prg_do_nothing: - \tex_input:D \l__file_internal_name_tl \scan_stop: + \tex_input:D \l__file_full_name_str \scan_stop: \exp_args:NNNo \group_end: #1 #2 \l_@@_internal_a_tl } @@ -2204,13 +2401,15 @@ \cs_generate_variant:Nn \tl_gset_from_file_x:Nnn { c } \cs_new_protected:Npn \@@_set_from_file_x:NNnn #1#2#3#4 { - \__file_if_exist:nT {#4} + \file_get_full_name:nN {#4} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#4} } { \group_begin: \etex_everyeof:D { \exp_not:N } #3 \scan_stop: \tl_set:Nx \l_@@_internal_a_tl - { \tex_input:D \l__file_internal_name_tl \c_space_token } + { \tex_input:D \l__file_full_name_str \c_space_token } \exp_args:NNNo \group_end: #1 #2 \l_@@_internal_a_tl } @@ -2237,16 +2436,14 @@ % \begin{macro}[EXP]{\tl_lower_case:n, \tl_upper_case:n, \tl_mixed_case:n} % \begin{macro}[EXP]{\tl_lower_case:nn, \tl_upper_case:nn, \tl_mixed_case:nn} % The user level functions here are all wrappers around the internal -% functions for case changing. Note that \cs{tl_mixed_case:nn} could be -% done without an internal, but this way the logic is slightly clearer as -% everything essentially follows the same path. +% functions for case changing. % \begin{macrocode} \cs_new:Npn \tl_lower_case:n { \@@_change_case:nnn { lower } { } } \cs_new:Npn \tl_upper_case:n { \@@_change_case:nnn { upper } { } } -\cs_new:Npn \tl_mixed_case:n { \@@_mixed_case:nn { } } +\cs_new:Npn \tl_mixed_case:n { \@@_change_case:nnn { mixed } { } } \cs_new:Npn \tl_lower_case:nn { \@@_change_case:nnn { lower } } \cs_new:Npn \tl_upper_case:nn { \@@_change_case:nnn { upper } } -\cs_new:Npn \tl_mixed_case:nn { \@@_mixed_case:nn } +\cs_new:Npn \tl_mixed_case:nn { \@@_change_case:nnn { mixed } } % \end{macrocode} % \end{macro} % \end{macro} @@ -2264,6 +2461,12 @@ % } % \begin{macro}[aux, EXP]{\@@_change_case_end:wn} % \begin{macro}[aux, EXP]{\@@_change_case_group:nwnn} +% \begin{macro}[aux, EXP] +% { +% \@@_change_case_group_lower:nnnn , +% \@@_change_case_group_upper:nnnn , +% \@@_change_case_group_mixed:nnnn +% } % \begin{macro}[aux, EXP]{\@@_change_case_space:wnn} % \begin{macro}[aux, EXP]{\@@_change_case_N_type:Nwnn} % \begin{macro}[aux, EXP]{\@@_change_case_N_type:NNNnnn} @@ -2273,17 +2476,29 @@ % \begin{macro}[aux, EXP]{\@@_change_case_math_group:nwNNnn} % \begin{macro}[aux, EXP]{\@@_change_case_math_space:wNNnn} % \begin{macro}[aux, EXP]{\@@_change_case_N_type:Nnnn} -% \begin{macro}[aux, EXP]{\@@_change_case_char:Nnn} +% \begin{macro}[aux, EXP] +% { +% \@@_change_case_char_lower:Nnn , +% \@@_change_case_char_upper:Nnn , +% \@@_change_case_char_mixed:Nnn +% } % \begin{macro}[aux, EXP]{\@@_change_case_char:nN} % \begin{macro}[aux, EXP] % {\@@_change_case_char_auxi:nN, \@@_change_case_char_auxii:nN} +% \begin{macro}[aux, EXP] +% { +% \@@_change_case_char_mixed:N, +% \@@_change_case_char_lower:N, +% \@@_change_case_char_upper:N +% } % \begin{macro}[aux] -% {\@@_lookup_lower:N, \@@_lookup_upper:N, \@@_lookup_title:N} +% {\@@_lookup_mixed:N, \@@_lookup_lower:N, \@@_lookup_upper:N} % \begin{macro}[aux, EXP]{\@@_change_case_char_UTFviii:nNN} % \begin{macro}[aux, EXP]{\@@_change_case_char_UTFviii:nNNN} % \begin{macro}[aux, EXP]{\@@_change_case_char_UTFviii:nNNNN} % \begin{macro}[aux, EXP]{\@@_change_case_char_UTFviii:nn} -% \begin{macro}[aux, EXP]{\@@_change_case_cs_letterlike:Nnn} +% \begin{macro}[aux, EXP]{\@@_change_case_cs_letterlike:Nn} +% \begin{macro}[aux, EXP]{\@@_change_case_cs_letterlike:NnN} % \begin{macro}[aux, EXP]{\@@_change_case_cs_accents:NN} % \begin{macro}[aux, EXP]{\@@_change_case_cs:N} % \begin{macro}[aux, EXP]{\@@_change_case_cs:NN} @@ -2292,6 +2507,10 @@ % \begin{macro}[aux, EXP]{\@@_change_case_if_expandable:NTF} % \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:Nnw} % \begin{macro}[aux, EXP]{\@@_change_case_cs_expand:NN} +% \begin{macro}[aux, EXP]{\@@_change_case_mixed_skip:N} +% \begin{macro}[aux, EXP]{\@@_change_case_mixed_skip:NN} +% \begin{macro}[aux, EXP]{\@@_change_case_mixed_skip_tidy:Nwn} +% \begin{macro}[aux, EXP]{\@@_change_case_mixed_switch:w} % The mechanism for the core conversion of case is based on the idea that % we can use a loop to grab the entire token list plus a quark: the latter is % used as an end marker and to avoid any brace stripping. Depending on the @@ -2356,6 +2575,10 @@ % \begin{macrocode} \cs_new:Npn \@@_change_case_group:nwnn #1#2 \q_recursion_stop #3#4 { + \use:c { @@_change_case_group_ #3 : nnnn } {#1} {#2} {#3} {#4} + } +\cs_new:Npn \@@_change_case_group_lower:nnnn #1#2#3#4 + { \@@_change_case_output:own { \exp_after:wN @@ -2366,6 +2589,26 @@ } \@@_change_case_loop:wnn #2 \q_recursion_stop {#3} {#4} } +\cs_new_eq:NN \@@_change_case_group_upper:nnnn + \@@_change_case_group_lower:nnnn +% \end{macrocode} +% For the \enquote{mixed} case, a group is taken as forcing a switch to lower +% casing. That means we need a separate auxiliary. (Tracking whether we have +% found a first character inside a group and transferring the information out +% looks pretty horrible.) +% \begin{macrocode} +\cs_new:Npn \@@_change_case_group_mixed:nnnn #1#2#3#4 + { + \@@_change_case_output:own + { + \exp_after:wN + { + \exp:w + \@@_change_case_aux:nnn {#3} {#4} {#1} + } + } + \@@_change_case_loop:wnn #2 \q_recursion_stop { lower } {#4} + } \exp_last_unbraced:NNo \cs_new:Npn \@@_change_case_space:wnn \c_space_tl { \@@_change_case_output:nwn { ~ } @@ -2397,8 +2640,8 @@ % be either the standard case-changing one or the mixed-case alternative, % it is not hard-coded into the math loop but is rather passed as argument % |#3| to \cs{@@_change_case_math:NNNnnn}. If no close-math token is found -% then the final clean-up will be forced (\emph{i.e.}~there is no assumption -% of \enquote{well-behaved} code in terms of math mode). +% then the final clean-up is forced (\emph{i.e.}~there is no assumption +% of \enquote{well-behaved} input in terms of math mode). % \begin{macrocode} \cs_new:Npn \@@_change_case_N_type:NNNnnn #1#2#3 { @@ -2463,8 +2706,8 @@ \cs_new:Npn \@@_change_case_N_type:Nnnn #1#2#3#4 { \token_if_cs:NTF #1 - { \@@_change_case_cs_letterlike:Nnn #1 {#3} { } } - { \@@_change_case_char:Nnn #1 {#3} {#4} } + { \@@_change_case_cs_letterlike:Nn #1 {#3} } + { \use:c { @@_change_case_char_ #3 :Nnn } #1 {#3} {#4} } \@@_change_case_loop:wnn #2 \q_recursion_stop {#3} {#4} } % \end{macrocode} @@ -2477,7 +2720,7 @@ % whereas the core lookup table does not and also guarantees an output so % \texttt{f}-type expansion may be used to obtain the case-changed result. % \begin{macrocode} -\cs_new:Npn \@@_change_case_char:Nnn #1#2#3 +\cs_new:Npn \@@_change_case_char_lower:Nnn #1#2#3 { \cs_if_exist_use:cF { @@_change_case_ #2 _ #3 :Nnw } { \use_ii:nn } @@ -2487,6 +2730,24 @@ { \@@_change_case_char:nN {#2} #1 } } } +\cs_new_eq:NN \@@_change_case_char_upper:Nnn + \@@_change_case_char_lower:Nnn +% \end{macrocode} +% For mixed case, the code is somewhat different: there is a need to +% look up both mixed and upper case chars and we have to cover the +% situation where there is a character to skip over. +% \begin{macrocode} +\cs_new:Npn \@@_change_case_char_mixed:Nnn #1#2#3 + { + \@@_change_case_mixed_switch:w + \cs_if_exist_use:cF { @@_change_case_mixed_ #3 :Nnw } + { + \cs_if_exist_use:cF { @@_change_case_upper_ #3 :Nnw } + { \use_ii:nn } + } + #1 + { \@@_change_case_mixed_skip:N #1 } + } % \end{macrocode} % For Unicode engines we can handle all characters directly. However, for % the $8$-bit engines the aim is to deal with (a subset of) Unicode (UTF-8) @@ -2517,14 +2778,37 @@ { \@@_change_case_char_auxi:nN {#1} #2 } } } +% \end{macrocode} +% To allow for the special case of mixed case, we insert here a +% action-dependent auxiliary. +% \begin{macrocode} \cs_new:Npn \@@_change_case_char_auxi:nN #1#2 + { \use:c { @@_change_case_char_ #1 :N } #2 } +\cs_new:Npn \@@_change_case_char_lower:N #1 + { + \@@_change_case_output:fwn + { + \cs_if_exist_use:cF { c__unicode_lower_ \token_to_str:N #1 _tl } + { \@@_change_case_char_auxii:nN { lower } #1 } + } + } +\cs_new:Npn \@@_change_case_char_upper:N #1 { \@@_change_case_output:fwn { - \cs_if_exist_use:cF { c__unicode_ #1 _ \token_to_str:N #2 _tl } - { \@@_change_case_char_auxii:nN {#1} #2 } + \cs_if_exist_use:cF { c__unicode_upper_ \token_to_str:N #1 _tl } + { \@@_change_case_char_auxii:nN { upper } #1 } } } +\cs_new:Npn \@@_change_case_char_mixed:N #1 + { + \cs_if_exist:cTF { c__unicode_mixed_ \token_to_str:N #1 _tl } + { + \@@_change_case_output:fwn + { \tl_use:c { c__unicode_mixed_ \token_to_str:N #1 _tl } } + } + { \@@_change_case_char_upper:N #1 } + } \cs_if_exist:NTF \utex_char:D { \cs_new:Npn \@@_change_case_char_auxii:nN #1#2 @@ -2539,7 +2823,7 @@ } \cs_new_protected:Npn \@@_lookup_lower:N #1 { \tex_lccode:D `#1 } \cs_new_protected:Npn \@@_lookup_upper:N #1 { \tex_uccode:D `#1 } - \cs_new_eq:NN \@@_lookup_title:N \@@_lookup_upper:N + \cs_new_eq:NN \@@_lookup_mixed:N \@@_lookup_upper:N } { \cs_new:Npn \@@_change_case_char_auxii:nN #1#2 { \exp_stop_f: #2 } @@ -2565,10 +2849,19 @@ % ones to deal with. Letter-like control sequences are a simple look-up, % while for accents the loop is much as done elsewhere. Notice that % we have a no-op test to make sure there is no unexpected expansion of -% letter-like input. The third argument here is needed for mixed casing, -% where it if there is a hit there has to be a change-of-path. +% letter-like input. The split into two parts here allows us to insert +% the \enquote{switch} code for mixed casing. % \begin{macrocode} -\cs_new:Npn \@@_change_case_cs_letterlike:Nnn #1#2#3 +\cs_new:Npn \@@_change_case_cs_letterlike:Nn #1#2 + { + \str_if_eq:nnTF {#2} { mixed } + { + \@@_change_case_cs_letterlike:NnN #1 { upper } + \@@_change_case_mixed_switch:w + } + { \@@_change_case_cs_letterlike:NnN #1 {#2} \prg_do_nothing: } + } +\cs_new:Npn \@@_change_case_cs_letterlike:NnN #1#2#3 { \cs_if_exist:cTF { c_@@_change_case_ #2 _ \token_to_str:N #1 _tl } { @@ -2650,10 +2943,10 @@ % When a control sequence is not on the exclude list the other test if % to see if it is expandable. Once again, if there is a hit then the loop % function is grabbed as part of the clean-up and reinserted before the -% now expanded material. The test for expandablity has to check for +% now expanded material. The test for expandability has to check for % end-of-recursion as it is needed by the look-ahead code which might hit % the end of the input. The test is done in two parts as \cs{bool_if:nTF} -% will choke if |#1| is |(|! +% would choke if |#1| was |(|! % \begin{macrocode} \cs_new:Npn \@@_change_case_if_expandable:NTF #1 { @@ -2679,6 +2972,51 @@ \cs_new:Npn \@@_change_case_cs_expand:NN #1#2 { \exp_after:wN #2 #1 } % \end{macrocode} +% For mixed case, there is an additional list of exceptions to deal with: +% once that is sorted, we can move on back to the main loop. +% \begin{macrocode} +\cs_new:Npn \@@_change_case_mixed_skip:N #1 + { + \exp_after:wN \@@_change_case_mixed_skip:NN + \exp_after:wN #1 \l_tl_mixed_case_ignore_tl + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_change_case_mixed_skip:NN #1#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} + { \@@_change_case_char:nN { mixed } #1 } + \int_compare:nNnT { `#1 } = { `#2 } + { + \use_i_delimit_by_q_recursion_stop:nw + { + \@@_change_case_output:nwn {#1} + \@@_change_case_mixed_skip_tidy:Nwn + } + } + \@@_change_case_mixed_skip:NN #1 + } +\cs_new:Npn \@@_change_case_mixed_skip_tidy:Nwn #1#2 \q_recursion_stop #3 + { + \@@_change_case_loop:wnn #2 \q_recursion_stop { mixed } + } +% \end{macrocode} +% Needed to switch from mixed to lower casing when we have found a +% first character in the former mode. +% \begin{macrocode} +\cs_new:Npn \@@_change_case_mixed_switch:w + #1 \@@_change_case_loop:wnn #2 \q_recursion_stop #3 + { + #1 + \@@_change_case_loop:wnn #2 \q_recursion_stop { lower } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % \end{macro} % \end{macro} @@ -3030,10 +3368,10 @@ % \begin{macro}[EXP, aux]{\__unicode_codepoint_to_UTFviii_auxi:n} % \begin{macro}[EXP, aux]{\__unicode_codepoint_to_UTFviii_auxii:Nnn} % \begin{macro}[EXP, aux]{\__unicode_codepoint_to_UTFviii_auxiii:n} -% This code will convert a codepoint into the correct UTF-8 representation. +% This code converts a codepoint into the correct UTF-8 representation. % As there are a variable number of octets, the result starts with the % numeral |1|--|4| to indicate the nature of the returned value. Note that -% this code will cover the full range even though at this stage it is not +% this code covers the full range even though at this stage it is not % required here. Also note that longer-term this is likely to need a public % interface and/or moving to \pkg{l3str} (see experimental string % conversions). In terms of the algorithm itself, see @@ -3338,7 +3676,7 @@ \group_end: } \@@_tmp:w { 00DF } { SS } { upper } - \@@_tmp:w { 00DF } { Ss } { title } + \@@_tmp:w { 00DF } { Ss } { mixed } \@@_tmp:w { 0131 } { I } { upper } } \group_end: @@ -3382,188 +3720,6 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}[aux, EXP]{\@@_mixed_case:nn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_aux:nn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_loop:wn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_group:nwn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_space:wn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_N_type:Nwn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_N_type:NNNnn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_N_type:Nnn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_letterlike:Nw} -% \begin{macro}[aux, EXP]{\@@_mixed_case_char:N} -% \begin{macro}[aux, EXP]{\@@_mixed_case_skip:N} -% \begin{macro}[aux, EXP]{\@@_mixed_case_skip:NN} -% \begin{macro}[aux, EXP]{\@@_mixed_case_skip_tidy:Nwn} -% \begin{macro}[aux, EXP]{\@@_mixed_case_char:nN} -% Mixed (title) casing requires some custom handling of the case changing -% of the first letter in the input followed by a switch to the normal -% lower casing routine. That could be covered by passing a set of functions -% to generic routines, but at the cost of making the process rather opaque. -% Instead, the approach taken here is to use a dedicated set of functions -% which keep the different loop requirements clearly separate. -% -% The main loop looks for the first \enquote{real} char in the input -% (skipping any pre-letter chars). Once one is found, it is case changed to -% upper case but first checking that there is not an entry in the exceptions -% list. Note that simply grabbing the first token in the input is no good -% here: it can't handle pre-letter tokens or any special treatment of the -% first letter found (\emph{e.g.}~words starting with \texttt{i} in -% Turkish). Spaces at the start of the input are passed through without -% counting as being the \enquote{start} of the first word, while a brace -% group is assumed to be contain the first char with everything after the -% brace therefore lower cased. -% \begin{macrocode} -\cs_new:Npn \@@_mixed_case:nn #1#2 - { - \etex_unexpanded:D \exp_after:wN - { - \exp:w - \@@_mixed_case_aux:nn {#1} {#2} - } - } -\cs_new:Npn \@@_mixed_case_aux:nn #1#2 - { - \group_align_safe_begin: - \@@_mixed_case_loop:wn - #2 \q_recursion_tail \q_recursion_stop {#1} - \@@_change_case_result:n { } - } -\cs_new:Npn \@@_mixed_case_loop:wn #1 \q_recursion_stop - { - \tl_if_head_is_N_type:nTF {#1} - { \@@_mixed_case_N_type:Nwn } - { - \tl_if_head_is_group:nTF {#1} - { \@@_mixed_case_group:nwn } - { \@@_mixed_case_space:wn } - } - #1 \q_recursion_stop - } -\cs_new:Npn \@@_mixed_case_group:nwn #1#2 \q_recursion_stop #3 - { - \@@_change_case_output:own - { - \exp_after:wN - { - \exp:w - \@@_mixed_case_aux:nn {#3} {#1} - } - } - \@@_change_case_loop:wnn #2 \q_recursion_stop { lower } {#3} - } -\exp_last_unbraced:NNo \cs_new:Npn \@@_mixed_case_space:wn \c_space_tl - { - \@@_change_case_output:nwn { ~ } - \@@_mixed_case_loop:wn - } -\cs_new:Npn \@@_mixed_case_N_type:Nwn #1#2 \q_recursion_stop - { - \quark_if_recursion_tail_stop_do:Nn #1 - { \@@_change_case_end:wn } - \exp_after:wN \@@_mixed_case_N_type:NNNnn - \exp_after:wN #1 \l_tl_case_change_math_tl - \q_recursion_tail ? \q_recursion_stop {#2} - } -\cs_new:Npn \@@_mixed_case_N_type:NNNnn #1#2#3 - { - \quark_if_recursion_tail_stop_do:Nn #2 - { \@@_mixed_case_N_type:Nnn #1 } - \token_if_eq_meaning:NNTF #1 #2 - { - \use_i_delimit_by_q_recursion_stop:nw - { - \@@_change_case_math:NNNnnn - #1 #3 \@@_mixed_case_loop:wn - } - } - { \@@_mixed_case_N_type:NNNnn #1 } - } -% \end{macrocode} -% The business end of the loop is here: there is first a need to deal -% with any control sequence cases before looking for characters to skip. -% If there is a hit for a letter-like control sequence, switch to lower -% casing. -% \begin{macrocode} -\cs_new:Npn \@@_mixed_case_N_type:Nnn #1#2#3 - { - \token_if_cs:NTF #1 - { - \@@_change_case_cs_letterlike:Nnn #1 { upper } - { \@@_mixed_case_letterlike:Nw } - \@@_mixed_case_loop:wn #2 \q_recursion_stop {#3} - } - { - \@@_mixed_case_char:Nn #1 {#3} - \@@_change_case_loop:wnn #2 \q_recursion_stop { lower } {#3} - } - } -\cs_new:Npn \@@_mixed_case_letterlike:Nw #1#2 \q_recursion_stop - { \@@_change_case_loop:wnn #2 \q_recursion_stop { lower } } -% \end{macrocode} -% As detailed above, handling a mixed case char means first looking for -% exceptions then treating as an upper cased letter, but with a list of -% tokens to skip over too. -% \begin{macrocode} -\cs_new:Npn \@@_mixed_case_char:Nn #1#2 - { - \cs_if_exist_use:cF { @@_change_case_mixed_ #2 :Nnw } - { - \cs_if_exist_use:cF { @@_change_case_upper_ #2 :Nnw } - { \use_ii:nn } - } - #1 - { \@@_mixed_case_skip:N #1 } - } -\cs_new:Npn \@@_mixed_case_skip:N #1 - { - \exp_after:wN \@@_mixed_case_skip:NN - \exp_after:wN #1 \l_tl_mixed_case_ignore_tl - \q_recursion_tail \q_recursion_stop - } -\cs_new:Npn \@@_mixed_case_skip:NN #1#2 - { - \quark_if_recursion_tail_stop_do:nn {#2} - { \@@_mixed_case_char:N #1 } - \int_compare:nNnT { `#1 } = { `#2 } - { - \use_i_delimit_by_q_recursion_stop:nw - { - \@@_change_case_output:nwn {#1} - \@@_mixed_case_skip_tidy:Nwn - } - } - \@@_mixed_case_skip:NN #1 - } -\cs_new:Npn \@@_mixed_case_skip_tidy:Nwn #1#2 \q_recursion_stop #3 - { - \@@_mixed_case_loop:wn #2 \q_recursion_stop - } -\cs_new:Npn \@@_mixed_case_char:N #1 - { - \cs_if_exist:cTF { c__unicode_title_ #1 _tl } - { - \@@_change_case_output:fwn - { \tl_use:c { c__unicode_title_ #1 _tl } } - } - { \@@_change_case_char:nN { upper } #1 } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}[aux, EXP]{\@@_change_case_mixed_nl:Nnw} % \begin{macro}[aux, EXP]{\@@_change_case_mixed_nl:Nw} % \begin{macro}[aux, EXP]{\@@_change_case_mixed_nl:NNw} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 3ae99922226..52e656a701d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -66,7 +66,7 @@ % \clist_put_right:Nn \l_my_clist { , ~ , , } % \clist_if_empty:NTF \l_my_clist { true } { false } % \end{verbatim} -% will leave \texttt{true} in the input stream. To include an item +% leaves \texttt{true} in the input stream. To include an item % which contains a comma, or starts or ends with a space, % surround it with braces. The sequence data type should be preferred % to comma lists if items are to contain |{|, |}|, or |#| (assuming the @@ -79,8 +79,8 @@ % \cs{clist_new:N} \meta{comma list} % \end{syntax} % Creates a new \meta{comma list} or raises an error if the name is -% already taken. The declaration is global. The \meta{comma list} will -% initially contain no items. +% already taken. The declaration is global. The \meta{comma list} +% initially contains no items. % \end{function} % % \begin{function}[added = 2014-07-05] @@ -93,7 +93,7 @@ % \end{syntax} % Creates a new constant \meta{clist~var} or raises an error % if the name is already taken. The value of the -% \meta{clist~var} will be set globally to the +% \meta{clist~var} is set globally to the % \meta{comma list}. % \end{function} % @@ -158,7 +158,7 @@ % \end{syntax} % Concatenates the content of \meta{comma list_2} and \meta{comma list_3} % together and saves the result in \meta{comma list_1}. The items in -% \meta{comma list_2} will be placed at the left side of the new comma list. +% \meta{comma list_2} are placed at the left side of the new comma list. % \end{function} % % \begin{function}[EXP, pTF, added=2012-03-03] @@ -250,7 +250,7 @@ % This function iterates through every item in the \meta{comma list} and % does a comparison with the \meta{items} already checked. It is therefore % relatively slow with large comma lists. -% Furthermore, it will not work if any of the items in the +% Furthermore, it does not work if any of the items in the % \meta{comma list} contains |{|, |}|, or |#| % (assuming the usual \TeX{} category codes apply). % \end{texnote} @@ -292,7 +292,7 @@ % reverse order. Braces and spaces are preserved by this process. % \begin{texnote} % The result is returned within \tn{unexpanded}, which means that the -% comma list will not expand further when appearing in an +% comma list does not expand further when appearing in an % \texttt{x}-type argument expansion. % \end{texnote} % \end{function} @@ -380,7 +380,7 @@ % \cs{clist_map_function:NN} \meta{comma list} \meta{function} % \end{syntax} % Applies \meta{function} to every \meta{item} stored in the -% \meta{comma list}. The \meta{function} will receive one argument for +% \meta{comma list}. The \meta{function} receives one argument for % each iteration. The \meta{items} are returned from left to right. % The function \cs{clist_map_inline:Nn} is in general more efficient % than \cs{clist_map_function:NN}. @@ -394,7 +394,7 @@ % \end{syntax} % Applies \meta{inline function} to every \meta{item} stored % within the \meta{comma list}. The \meta{inline function} should -% consist of code which will receive the \meta{item} as |#1|. +% consist of code which receives the \meta{item} as |#1|. % One in line mapping can be nested inside another. The \meta{items} % are returned from left to right. % \end{function} @@ -406,7 +406,7 @@ % \end{syntax} % Stores each entry in the \meta{comma list} in turn in the % \meta{tl~var.}\ and applies the \meta{function using tl~var.} -% The \meta{function} will usually consist of code making use of +% The \meta{function} usually consists of code making use of % the \meta{tl~var.}, but this is not enforced. One variable % mapping can be nested inside another. The \meta{items} % are returned from left to right. @@ -417,8 +417,8 @@ % \cs{clist_map_break:} % \end{syntax} % Used to terminate a |\clist_map_...| function before all -% entries in the \meta{comma list} have been processed. This will -% normally take place within a conditional statement, for example +% entries in the \meta{comma list} have been processed. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \clist_map_inline:Nn \l_my_clist % { @@ -429,12 +429,12 @@ % } % } % \end{verbatim} -% Use outside of a |\clist_map_...| scenario will lead to low +% Use outside of a |\clist_map_...| scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before further items are taken -% from the input stream. This will depend on the design of the mapping +% from the input stream. This depends on the design of the mapping % function. % \end{texnote} % \end{function} @@ -445,8 +445,8 @@ % \end{syntax} % Used to terminate a |\clist_map_...| function before all % entries in the \meta{comma list} have been processed, inserting -% the \meta{tokens} after the mapping has ended. This will -% normally take place within a conditional statement, for example +% the \meta{tokens} after the mapping has ended. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \clist_map_inline:Nn \l_my_clist % { @@ -457,13 +457,13 @@ % } % } % \end{verbatim} -% Use outside of a |\clist_map_...| scenario will lead to low +% Use outside of a |\clist_map_...| scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are % inserted into the input stream. -% This will depend on the design of the mapping function. +% This depends on the design of the mapping function. % \end{texnote} % \end{function} % @@ -474,7 +474,7 @@ % \end{syntax} % Leaves the number of items in the \meta{comma list} in the input % stream as an \meta{integer denotation}. The total number of items -% in a \meta{comma list} will include those which are duplicates, +% in a \meta{comma list} includes those which are duplicates, % \emph{i.e.}~every item in a \meta{comma list} is unique. % \end{function} % @@ -492,7 +492,7 @@ % the comma list has exactly two items, then they are placed in the input % stream separated by the \meta{separator between two}. If the comma % list has a single item, it is placed in the input stream, and a comma -% list with no items produces no output. An error will be raised if +% list with no items produces no output. An error is raised if % the variable does not exist or if it is invalid. % % For example, @@ -500,13 +500,13 @@ % \clist_set:Nn \l_tmpa_clist { a , b , , c , {de} , f } % \clist_use:Nnnn \l_tmpa_clist { ~and~ } { ,~ } { ,~and~ } % \end{verbatim} -% will insert \enquote{\texttt{a, b, c, de, and f}} in the input +% inserts \enquote{\texttt{a, b, c, de, and f}} in the input % stream. The first separator argument is not used in this case % because the comma list has more than $2$ items. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{items} -% will not expand further when appearing in an \texttt{x}-type +% do not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -518,7 +518,7 @@ % Places the contents of the \meta{clist~var} in the input stream, % with the \meta{separator} between the items. If the comma % list has a single item, it is placed in the input stream, and a comma -% list with no items produces no output. An error will be raised if +% list with no items produces no output. An error is raised if % the variable does not exist or if it is invalid. % % For example, @@ -526,12 +526,12 @@ % \clist_set:Nn \l_tmpa_clist { a , b , , c , {de} , f } % \clist_use:Nn \l_tmpa_clist { ~and~ } % \end{verbatim} -% will insert \enquote{\texttt{a and b and c and de and f}} in the input +% inserts \enquote{\texttt{a and b and c and de and f}} in the input % stream. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{items} -% will not expand further when appearing in an \texttt{x}-type +% do not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -552,8 +552,8 @@ % Stores the left-most item from a \meta{comma list} in the % \meta{token list variable} without removing it from the % \meta{comma list}. The \meta{token list variable} is assigned locally. -% If the \meta{comma list} is empty the \meta{token list variable} will -% contain the marker value \cs{q_no_value}. +% If the \meta{comma list} is empty the \meta{token list variable} +% is set to the marker value \cs{q_no_value}. % \end{function} % % \begin{function}[TF, added = 2012-05-14]{\clist_get:NN, \clist_get:cN} @@ -638,17 +638,17 @@ % \cs{clist_item:Nn} \meta{comma list} \Arg{integer expression} % \end{syntax} % Indexing items in the \meta{comma list} from~$1$ at the top (left), this -% function will evaluate the \meta{integer expression} and leave the +% function evaluates the \meta{integer expression} and leaves the % appropriate item from the comma list in the input stream. If the % \meta{integer expression} is negative, indexing occurs from the % bottom (right) of the comma list. When the \meta{integer expression} % is larger than the number of items in the \meta{comma list} (as -% calculated by \cs{clist_count:N}) then the function will expand to +% calculated by \cs{clist_count:N}) then the function expands to % nothing. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -1404,7 +1404,7 @@ % by blank spaces (besides, this particular variant of % the emptiness test is optimized). If the item of the % comma list is blank, grab the next one. As soon as one -% item is non-blank, exit: the second auxiliary will grab +% item is non-blank, exit: the second auxiliary grabs % \cs{prg_return_false:} as |#2|, unless every item in % the comma list was blank and the loop actually got broken % by the trailing |\q_mark \prg_return_false:| item. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index c571516ea79..9e37e602bf8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -58,8 +58,8 @@ % \cs{coffin_new:N} \meta{coffin} % \end{syntax} % Creates a new \meta{coffin} or raises an error if the name is -% already taken. The declaration is global. The \meta{coffin} will -% initially be empty. +% already taken. The declaration is global. The \meta{coffin} is +% initially empty. % \end{function} % % \begin{function}[added = 2011-08-17]{\coffin_clear:N, \coffin_clear:c} @@ -146,7 +146,7 @@ % ~~\Arg{pole} \Arg{offset} % \end{syntax} % Sets the \meta{pole} to run horizontally through the \meta{coffin}. -% The \meta{pole} will be located at the \meta{offset} from the +% The \meta{pole} is placed at the \meta{offset} from the % bottom edge of the bounding box of the \meta{coffin}. The % \meta{offset} should be given as a dimension expression. % \end{function} @@ -157,7 +157,7 @@ % \cs{coffin_set_vertical_pole:Nnn} \meta{coffin} \Arg{pole} \Arg{offset} % \end{syntax} % Sets the \meta{pole} to run vertically through the \meta{coffin}. -% The \meta{pole} will be located at the \meta{offset} from the +% The \meta{pole} is placed at the \meta{offset} from the % left-hand edge of the bounding box of the \meta{coffin}. The % \meta{offset} should be given as a dimension expression. % \end{function} @@ -201,7 +201,7 @@ % \end{syntax} % This function joins <coffin_2> to <coffin_1> such that the bounding box % of \meta{coffin_1} may expand. The new bounding -% box will cover the area containing the bounding boxes of the two +% box covers the area containing the bounding boxes of the two % original coffins. The alignment is carried out by first calculating % \meta{handle_1}, the point of intersection of \meta{coffin_1-pole_1} and % \meta{coffin_1-pole_2}, and \meta{handle_2}, the point of intersection @@ -265,7 +265,7 @@ % the \meta{poles} of the \meta{coffin} to give a set of % \meta{handles}. It then prints the \meta{coffin} at the current % location in the source, with the position of the \meta{handles} -% marked on the coffin. The \meta{handles} will be labelled as part +% marked on the coffin. The \meta{handles} are labelled as part % of this process: the locations of the \meta{handles} and the labels % are both printed in the \meta{color} specified. % \end{function} @@ -278,7 +278,7 @@ % This function first calculates the \meta{handle} for the % \meta{coffin} as defined by the intersection of \meta{pole_1} and % \meta{pole_2}. It then marks the position of the \meta{handle} -% on the \meta{coffin}. The \meta{handle} will be labelled as part of +% on the \meta{coffin}. The \meta{handle} are labelled as part of % this process: the location of the \meta{handle} and the label are % both printed in the \meta{color} specified. % \end{function} @@ -447,7 +447,7 @@ % structures. % % \begin{macro}[EXP, pTF]{\coffin_if_exist:N, \coffin_if_exist:c} -% Several of the higher-level coffin functions will give multiple +% Several of the higher-level coffin functions would give multiple % errors if the coffin does not exist. A cleaner way to handle this % is provided here: both the box and the coffin structure are % checked. @@ -470,7 +470,7 @@ % \end{macro} % % \begin{macro}{\@@_if_exist:NT} -% Several of the higher-level coffin functions will give multiple +% Several of the higher-level coffin functions would give multiple % errors if the coffin does not exist. So a wrapper is provided to deal % with this correctly, issuing an error on erroneous use. % \begin{macrocode} @@ -512,14 +512,14 @@ \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 - \__chk_suspend_log: + \__debug_suspend_log: \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop } \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop } \prop_gset_eq:cN { l_@@_corners_ \__int_value:w #1 _prop } \c_@@_corners_prop \prop_gset_eq:cN { l_@@_poles_ \__int_value:w #1 _prop } \c_@@_poles_prop - \__chk_resume_log: + \__debug_resume_log: } \cs_generate_variant:Nn \coffin_new:N { c } % \end{macrocode} @@ -910,7 +910,7 @@ % the intersection depends on the directions of the poles, which are % given by $d / c$ and $d' / c'$. However, if one of the poles % is either horizontal or vertical then one or more of $c$, $d$, -% $c'$ and $d'$ will be zero and a special case is needed. +% $c'$ and $d'$ are zero and a special case is needed. % \begin{macrocode} \cs_new_protected:Npn \@@_calculate_intersection:nnnnnnnn #1#2#3#4#5#6#7#8 @@ -918,7 +918,7 @@ \dim_compare:nNnTF {#3} = { \c_zero_dim } % \end{macrocode} % The case where the first pole is vertical. So the $x$-component -% of the interaction will be at $a$. There is then a test on the +% of the interaction is at $a$. There is then a test on the % second pole: if it is also vertical then there is an error. % \begin{macrocode} { @@ -927,7 +927,7 @@ { \bool_set_true:N \l_@@_error_bool } % \end{macrocode} % The second pole may still be horizontal, in which case the -% $y$-component of the intersection will be $b'$. If not, +% $y$-component of the intersection is $b'$. If not, % \[ % y = \frac{d'}{c'} \left ( x - a' \right ) + b' % \] @@ -1078,7 +1078,7 @@ % } % This command joins two coffins, using a horizontal and vertical pole % from each coffin and making an offset between the two. The result -% is stored as the as a third coffin, which will have all of its handles +% is stored as the as a third coffin, which has all of its handles % reset to standard values. First, the more basic alignment function is % used to get things started. % \begin{macrocode} @@ -1090,7 +1090,7 @@ % Correct the placement of the reference point. If the $x$-offset % is negative then the reference point of the second box is to the left % of that of the first, which is corrected using a kern. On the right -% side the first box might stick out, which will show up if it is wider +% side the first box might stick out, which would show up if it is wider % than the sum of the $x$-offset and the width of the second box. % So a second kern may be needed. % \begin{macrocode} @@ -1115,7 +1115,7 @@ % \end{macrocode} % The structures of the parent coffins are now transferred to the new % coffin, which requires that the appropriate offsets are applied. That -% will then depend on whether any shift was needed. +% then depends on whether any shift was needed. % \begin{macrocode} \dim_compare:nNnTF \l_@@_offset_x_dim < \c_zero_dim { @@ -1192,7 +1192,7 @@ % storage area to be used for the second coffin. The `real' box % offsets are then calculated, before using these to re-box the % input coffins. The default poles are then set up, but the final result -% will depend on how the bounding box is being handled. +% depends on how the bounding box is being handled. % \begin{macrocode} \cs_new_protected:Npn \@@_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 { @@ -1279,7 +1279,7 @@ % \begin{macro}{\@@_update_vertical_poles:NNN} % \begin{macro}[aux]{\@@_update_T:nnnnnnnnN} % \begin{macro}[aux]{\@@_update_B:nnnnnnnnN} -% The \texttt{T} and \texttt{B} poles will need to be recalculated +% The \texttt{T} and \texttt{B} poles need to be recalculated % after alignment. These functions find the larger absolute value for % the poles, but this is of course only logical when the poles are % horizontal. @@ -1331,7 +1331,7 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { - \hbox_unpack:N \c_empty_box + \mode_leave_vertical: \@@_align:NnnNnnnnN \c_empty_coffin { H } { l } #1 {#2} {#3} {#4} {#5} \l_@@_aligned_coffin \box_use:N \l_@@_aligned_coffin diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx index 7201aac2abc..6fca2d5caf0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -70,12 +70,33 @@ % \begin{syntax} % \cs{color_ensure_current:} % \end{syntax} -% Ensures that material inside a box will use the foreground color +% Ensures that material inside a box uses the foreground color % at the point where the box is set, rather than that in force when the % box is used. This function should usually be used within a % \cs{color_group_begin:} \ldots \cs{color_group_end:} group. % \end{function} % +% \subsection{Internal functions} +% +% \begin{variable}[added = 2017-06-15]{\l__color_current_tl} +% The color currently active for foreground (text, \emph{etc.}) material. +% This is stored in the form of a color model followed by one or more +% values in the range $[0,1]$: these determine the color. The model and +% applicable data format must be one of the following: +% \begin{itemize} +% \item \texttt{gray \meta{gray}} Grayscale color with the \meta{gray} +% value running from $0$ (fully black) to $1$ (fully white) +% \item \texttt{cmyk \meta{cyan} \meta{magenta} \meta{yellow} \meta{black}} +% \item \texttt{rgb \meta{red} \meta{green} \meta{blue}} +% \end{itemize} +% Notice that the value are separated by spaces. +% \begin{texnote} +% This format is the native one for \texttt{dvips} color specials: +% other drivers are expected to convert to their own format when +% writing color data to output. +% \end{texnote} +% \end{variable} +% % \end{documentation} % % \begin{implementation} @@ -105,10 +126,22 @@ % current color \enquote{now}. % \begin{macrocode} \cs_new_protected:Npn \color_ensure_current: - { \__driver_color_ensure_current: } + { + \__driver_color_ensure_current: + \group_insert_after:N \__driver_color_reset: + } % \end{macrocode} % \end{macro} % +% \begin{variable}{\l__color_current_tl} +% The current color: the format here is taken from \texttt{dvips} but it +% is easy enough to convert to \texttt{pdfmode} as required. +% \begin{macrocode} +\tl_new:N \l__color_current_tl +\tl_set:Nn \l__color_current_tl { gray~0 } +% \end{macrocode} +% \end{variable} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index 4b6f1c28f3a..b8a7f5fdee2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -74,7 +74,7 @@ % \end{macrocode} % % \begin{macro}[aux]{\@@_error:Nnn} -% The \tn{outer} definition here ensures the command will not appear +% The \tn{outer} definition here ensures the command cannot appear % in an argument. Use this auxiliary on all commands that have been % removed since 2015. % \begin{macrocode} @@ -145,6 +145,17 @@ \@@_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } \@@_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } \@@_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } + \@@_error:Nnn \g_file_current_name_tl { \g_file_curr_name_str } { 2018-12-31 } + \@@_error:Nnn \file_add_path:nN { \file_get_full_name:nN } { 2018-12-31 } + \@@_error:Nnn \file_path_include:n + { \seq_put_right:Nn \l_file_search_path_seq } { 2018-12-31 } + \@@_error:Nnn \file_path_remove:n + { \seq_remove_all:Nn \l_file_search_path_seq } { 2018-12-31 } + \@@_error:Nnn \file_list: { \file_log_list: } { 2018-12-31 } + \@@_error:Nnn \ior_list_streams: { \ior_show_list: } { 2018-12-31 } + \@@_error:Nnn \ior_log_streams: { \ior_log_list: } { 2018-12-31 } + \@@_error:Nnn \iow_list_streams: { \iow_show_list: } { 2018-12-31 } + \@@_error:Nnn \iow_log_streams: { \iow_log_list: } { 2018-12-31 } \cs_set_eq:NN \__fp_parse_round:Nw \__fp_parse_round_deprecation_error:Nw \cs_set_eq:NN \deprecation_error: \scan_stop: } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 489a6a68f93..08ae366efed 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -70,14 +70,14 @@ and all files in that bundle must be distributed together. % This isn't included in the typeset documentation because it's a bit % ugly: %<*class> -\ProvidesExplClass{l3doc}{2017/05/29}{} +\ProvidesExplClass{l3doc}{2017/07/15}{} {L3 Experimental documentation class} %</class> % \fi % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % \maketitle % \tableofcontents % @@ -96,7 +96,7 @@ and all files in that bundle must be distributed together. % Use at own risk!} % % It is written as a \enquote{self-contained} docstrip file: executing -% |latex l3doc.dtx| will generate the \file{l3doc.cls} file and typeset +% |latex l3doc.dtx| generates the \file{l3doc.cls} file and typesets % this documentation; execute |tex l3doc.dtx| to only generate % \file{l3doc.cls}. % @@ -233,7 +233,7 @@ and all files in that bundle must be distributed together. % Use |\begin{documentation}...\end{documentation}| around the % documentation, and |\begin{implementation}...\end{implementation}| % around the implementation. The -% \cs{EnableDocumentation}/\cs{EnableImplementation} will cause them to +% \cs{EnableDocumentation}/\cs{EnableImplementation} causes them to % be typeset when the \file{.dtx} file is \cs{DocInput}; use % \cs{DisableDocumentation}/\cs{DisableImplementation} to omit the % contents of those environments. @@ -259,7 +259,7 @@ and all files in that bundle must be distributed together. % recommended. % % These commands are aware of the |@@| \pkg{l3docstrip} syntax and -% will replace such instances correctly in the typeset documentation. +% replace such instances correctly in the typeset documentation. % This only happens after a |%<@@=|\meta{module}|>| declaration. % % Additionally, commands can be used in the argument of \cs{cs}. For @@ -269,10 +269,10 @@ and all files in that bundle must be distributed together. % The \meta{options} are a key--value list which can contain the % following keys: % \begin{itemize} -% \item |index=|\meta{name}: the \meta{csname} will be indexed as if +% \item |index=|\meta{name}: the \meta{csname} is indexed as if % one had written \cs{cs}\Arg{name}. -% \item |no-index|: the \meta{csname} will not be indexed. -% \item |module=|\meta{module}: the \meta{csname} will be indexed in +% \item |no-index|: the \meta{csname} is not indexed. +% \item |module=|\meta{module}: the \meta{csname} is indexed in % the list of commands from the \meta{module}; the \meta{module} % can in particular be |TeX| for \enquote{\TeX{} and \LaTeXe{}} % commands, or empty for commands which should be placed in the @@ -289,7 +289,7 @@ and all files in that bundle must be distributed together. % \cs{tn} \oarg{options} \marg{csname} % \end{syntax} % Analoguous to \cs{cs} but intended for \enquote{traditional} \TeX{} -% or \LaTeXe{} commands; they will be indexed accordingly. This is in +% or \LaTeXe{} commands; they are indexed accordingly. This is in % fact equivalent to \cs{cs} |[module=TeX, replace=false,| % \meta{options}|]| \Arg{csname}. % \end{function} @@ -415,22 +415,25 @@ and all files in that bundle must be distributed together. % necessary to highlight it as much and you also don't need to check it % for, say, having a test function and having a documentation chunk % earlier in a \env{function} environment. In this case, write -% |\begin{macro}[aux]| and it will be marked as such; its margin -% call-out will be printed in grey. +% |\begin{macro}[aux]| to mark it as such; its margin +% call-out is then printed in grey. % % Similarly, an internal package function still requires documentation -% but usually will not be documented for users to see; these can be +% but usually is not documented for users to see; these can be % marked as such with |\begin{macro}[int]|. % % For documenting \pkg{expl3}-type conditionals, you may also pass this % environment a |TF| option (and omit it from the function name) to % denote that the function is provided with |T|, |F|, and |TF| suffixes. -% A similar |pTF| option will print both |TF| and |_p| predicate forms. +% A similar |pTF| option prints both |TF| and |_p| predicate forms. +% An option |noTF| prints both the |TF| forms and a form with neither +% |T| nor |F|, to document functions such as \cs[no-index]{prop_get:NN} +% which also have conditional forms (\cs[no-index]{prop_get:NNTF}). % % % \DescribeMacro{\TestFiles} % \cs{TestFiles}\marg{list of files} is used to indicate which test -% files are used for the current code; they will be printed in the +% files are used for the current code; they are printed in the % documentation. % % \DescribeMacro{\UnitTested} @@ -449,14 +452,14 @@ and all files in that bundle must be distributed together. % \DescribeMacro{\TestMissing} % If a function is missing a test, this may be flagged by writing (as % many times as needed) \cs{TestMissing} \marg{explanation of test -% required}. These missing tests will be summarised in the listing +% required}. These missing tests are summarised in the listing % printed at the end of the compilation run. % % \DescribeEnv{variable} % When documenting variable definitions, use the \env{variable} -% environment instead. It will, here, behave identically to the +% environment instead. Here it behaves identically to the % \env{macro} environment, except that if the class option |checktest| -% is enabled, variables will not be required to have a test file. +% is enabled, variables are not required to have a test file. % % \DescribeEnv{arguments} % Within a \env{macro} environment, you may use the \env{arguments} @@ -749,9 +752,9 @@ and all files in that bundle must be distributed together. % } % When analyzing a control sequence found within a \env{macrocode} % environment, \cs{l_@@_index_macro_tl} holds the control sequence -% (partially a string), \cs{l_@@_index_key_tl} holds what will be used -% as a sort key in the index, and \cs{l_@@_index_module_tl} is the -% subindex in which the control sequence will be listed. Finally, +% (partially a string), \cs{l_@@_index_key_tl} holds the future +% sort key in the index, and \cs{l_@@_index_module_tl} is the +% subindex in which the control sequence should be listed. Finally, % \cs{l_@@_index_internal_bool} indicates when the control sequence is % internal and should be indexed in a slightly different subindex. % \begin{macrocode} @@ -939,7 +942,7 @@ and all files in that bundle must be distributed together. % % \begin{macro}[int,TF]{\@@_if_almost_str:n} % Used to test if the argument of |\cmd| or other macros to be indexed -% is almost a string or not: for instance this will be wrong if |#1| +% is almost a string or not: for instance this is \texttt{false} if |#1| % contains |\meta{...}|. The surprising |f|-expansion are there to % cope with the case of |#1| starting with \cs{c_@@_backslash_tl} % which should be expanded and considered to be \enquote{normal}. @@ -2929,7 +2932,7 @@ and all files in that bundle must be distributed together. \@@_test_missing_aux:Nxn \g_@@_missing_tests_prop { \seq_use:Nn \l_@@_names_seq { , } } - { { \g_file_current_name_tl \iow_char:N \ (#1) } } + { { \g_file_curr_name_str \iow_char:N \ (#1) } } } \cs_new_protected:Npn \@@_test_missing_aux:Nnn #1#2#3 { @@ -3125,7 +3128,7 @@ and all files in that bundle must be distributed together. % \end{macrocode} % \end{macro} % -% Here are some definitions for additional markup that will help to +% Here are some definitions for additional markup that helps to % structure your documentation. % % \begin{environment}{danger} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index dd8b978269a..73912b764a1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -95,8 +95,8 @@ % % To extract the code using \pkg{l3docstrip}, the \enquote{guard} concept % used by \textsf{DocStrip} is extended by introduction of the syntax -% \texttt{\%<@@=\meta{module}>}. The \meta{module} name will be used when the -% code is extracted to replace the |@@|, so that +% \texttt{\%<@@=\meta{module}>}. The \meta{module} name then replaces +% the |@@| when the code is extracted, so that % \begin{verbatim} % %<*package> % %<@@=foo> @@ -107,7 +107,7 @@ % \tl_new:N \l_@@_internal_tl % %</package> % \end{verbatim} -% will be extracted as +% is extracted as % \begin{verbatim} % \cs_new_protected:Npn \__foo_some_function:nn #1#2 % { @@ -170,8 +170,8 @@ % % \begin{macro}{\moduleOption} % In the case where the line starts |%<@|: the defined syntax requires that -% this continues to |%<@@=|. At the moment, we assume that the syntax will -% be correct and |#1| here is the module name for substitution into any +% this continues to |%<@@=|. At the moment, we assume that the syntax is +% correct and |#1| here is the module name for substitution into any % internal functions in the extracted material. % \begin{macrocode} \def\moduleOption @@=#1>#2\endLine{% @@ -186,7 +186,7 @@ % Here, we set up to do the search-and-replace when doing the extraction. % The argument (|#1|) is the replacement text to use, or if empty an % indicator that no replacement should be done. The search material is -% one of |__@@|, |_@@| or |@@|, done in order such that all three will end +% one of |__@@|, |_@@| or |@@|, done in order such that all three end % up the same in the output. The string |@@@@| is hidden from these % replacements by temporarily turning it into a pair of letters with % different category codes, not produced by \pkg{docstrip}; this allows to diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 68bb90ec8cc..c6ecb231a2f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -81,7 +81,7 @@ % \cs{__driver_box_use_clip:N} \meta{box} % \end{syntax} % Inserts the content of the \meta{box} at the current insertion point -% such that any material outside of the bounding box will not be displayed +% such that any material outside of the bounding box is not displayed % by the driver. The material in the \meta{box} is still placed in the % output stream: the clipping takes place at a driver level. % @@ -156,7 +156,7 @@ % \meta{content} % \cs{__driver_draw_end:} % \end{syntax} -% Defines a drawing environment. This will be a scope for the purposes of +% Defines a drawing environment. This is a scope for the purposes of % the graphics state. Depending on the driver, other set up may or may not % take place here. The natural size of the \meta{content} should be zero % from the \TeX{} perspective: allowance for the size of the content must @@ -186,7 +186,7 @@ % \cs{__driver_draw_move:nn} \Arg{x} \Arg{y} % \end{syntax} % Moves the current drawing reference point to (\meta{x}, \meta{y}); -% any active transformation matrix will apply. +% any active transformation matrix applies. % \end{function} % % \begin{function}{\__driver_draw_lineto:nn} @@ -194,7 +194,7 @@ % \cs{__driver_draw_lineto:nn} \Arg{x} \Arg{y} % \end{syntax} % Adds a path from the current drawing reference point to -% (\meta{x}, \meta{y}); any active transformation matrix will apply. Note +% (\meta{x}, \meta{y}); any active transformation matrix applies. Note % that nothing is drawn until a fill or stroke operation is applied, and that % the path may be discarded or used as a clip without appearing itself. % \end{function} @@ -207,7 +207,7 @@ % Adds a Bezier curve path from the current drawing reference point to % (\meta{x_3}, \meta{y_3}), using (\meta{x_1}, \meta{y_1}) and % (\meta{x_2}, \meta{y_2}) as control points; any active transformation -% matrix will apply. Note that nothing is drawn until a fill or stroke +% matrix applies. Note that nothing is drawn until a fill or stroke % operation is applied, and that the path may be discarded or used as a clip % without appearing itself. % \end{function} @@ -217,7 +217,7 @@ % \cs{__driver_draw_rectangle:nnnn} \Arg{x} \Arg{y} \Arg{width} \Arg{height} % \end{syntax} % Adds rectangular path from (\meta{x_1}, \meta{y_1}) of \meta{height} -% and \meta{width}; any active transformation matrix will apply. Note that +% and \meta{width}; any active transformation matrix applies. Note that % nothing is drawn until a fill or stroke operation is applied, and that the % path may be discarded or used as a clip without appearing itself. % \end{function} @@ -239,8 +239,8 @@ % \meta{path construction} % \cs{__driver_draw_stroke:} % \end{syntax} -% Draws a line alone the current path, which will also be closed when -% \cs{__driver_draw_closestroke:} is used. The nature of the line drawn +% Draws a line along the current path, which is also closed by +% \cs{__driver_draw_closestroke:}. The nature of the line drawn % is influenced by settings for % \begin{itemize} % \item Line thickness @@ -259,8 +259,8 @@ % \cs{__driver_draw_fill:} % \end{syntax} % Fills the area surrounded by the current path: this will be closed prior -% to filling if it is not already. The \texttt{fillstroke} version will also -% stroke the path as described for \cs{__driver_draw_stroke:}. The fill is +% to filling if it is not already. The \texttt{fillstroke} version also +% strokes the path as described for \cs{__driver_draw_stroke:}. The fill is % influenced by the setting for fill color (or the current color if no % specific stroke color is set). The path may also be used for clipping. % For paths which are self-intersecting or comprising multiple parts, the @@ -325,7 +325,7 @@ % \texttt{3pt, 3pt}. An empty pattern yields a solid line. % % The \meta{phase} specifies an offset at the start of the cycle. For -% example, with a pattern \texttt{3pt} a phase of \texttt{1pt} will mean +% example, with a pattern \texttt{3pt} a phase of \texttt{1pt} means % that the output is $2$\,pt on, $3$\,pt off, $3$\,pt on, $3$\,pt on, % \emph{etc.} % \end{function} @@ -422,12 +422,12 @@ % \Arg{a} \Arg{b} \Arg{c} \Arg{d} \Arg{x} \Arg{y} % \end{syntax} % Inserts the \meta{box} as an hbox with the box reference point placed -% at ($x$, $y$). The transformation matrix $[a b c d]$ will be applied +% at ($x$, $y$). The transformation matrix $[a b c d]$ is applied % to the box, allowing it to be in synchronisation with any scaling, rotation % or skewing applying more generally. Note that \TeX{} material should not -% be inserted directly into a drawing as it will not be in the correct -% location. Also note that as for other drawing elements the box here will -% have no size from a \TeX{} perspective. +% be inserted directly into a drawing as it would not be in the correct +% location. Also note that as for other drawing elements the box here +% has no size from a \TeX{} perspective. % \end{function} % % \subsection{Coordinate system transformations} @@ -438,7 +438,7 @@ % \Arg{x} \Arg{y} % \end{syntax} % Applies the transformation matrix $[a b c d]$ and offset vector -% ($x$, $y$) to the current graphic state. This will affect any subsequent +% ($x$, $y$) to the current graphic state. This affects any subsequent % items in the same scope but not those already given. % \end{function} % @@ -487,6 +487,752 @@ %</package> % \end{macrocode} % +% The order of the driver code here is such that we get somewhat logical +% outcomes in terms of code sharing whilst keeping things readable. (Trying to +% mix all of the code by concept is almost unmanageable.) The key parts which +% are shared are +% \begin{itemize} +% \item Color support is either \texttt{dvips}-like or \texttt{pdfmode}-like. +% \item \texttt{pdfmode} and \texttt{(x)dvipdfmx} share drawing routines. +% \item \texttt{xdvipdfmx} is largely the same as \texttt{dvipdfmx} so +% takes most of the same code. +% \end{itemize} +% +% \subsection{Color support} +% +% Whilst \texttt{(x)dvipdfmx} does have its own approach to color specials, +% it is easier to use \texttt{dvips}-like ones for all cases except direct +% PDF output. As such the color code is collected here in two blocks. +% +% \subsubsection{\texttt{dvips}-style} +% +% \begin{macrocode} +%<*dvisvgm|dvipdfmx|dvips|xdvipdfmx> +% \end{macrocode} +% +% \begin{macro}[aux]{\@@_color_pickup:} +% Allow for \LaTeXe{}. +% \begin{macrocode} +%<*package> +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \@@_color_pickup: + { \tl_set_eq:NN \l__color_current_tl \current@color } + } + { \cs_new_protected:Npn \@@_color_pickup: { } } + } +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_color_ensure_current:} +% \begin{macro}[aux]{\@@_color_reset:} +% Directly set the color using the specials: no optimisation here. +% \begin{macrocode} +\cs_new_protected:Npn \@@_color_ensure_current: + { +%<*package> + \@@_color_pickup: +%</package> + \tex_special:D { color~push~\l__color_current_tl } + } +\cs_new_protected:Npn \@@_color_reset: + { \tex_special:D { color~pop } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +%</dvisvgm|dvipdfmx|dvips|xdvipdfmx> +% \end{macrocode} +% +% \subsubsection{\texttt{pdfmode}} +% +% \begin{macrocode} +%<*pdfmode> +% \end{macrocode} +% +% \begin{macro}[aux]{\@@_color_pickup:} +% \begin{macro}[aux]{\@@_color_pickup_aux:} +% The current color in driver-dependent format: pick up the package-mode +% data if available. We end up converting back and forward in this route as +% we store our color data in \texttt{dvips} format. +% \begin{macrocode} +%<*package> +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \@@_color_pickup: + { + \tl_set:Nx \l__color_current_tl + { + \exp_after:wN \@@_color_pickup_aux:w + \current@color ~ 0 ~ 0 ~ 0 \q_stop + } + } + \cs_new:Npn \@@_color_pickup_aux:w #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \q_stop + { + \str_if_eq:nnTF {#2} { g } + { gray ~ #1 } + { + \str_if_eq:nnTF {#4} { rg } + { rgb ~ #1 ~ #2 ~ #3 } + { + \str_if_eq:nnTF {#5} { k } + { cmyk ~ #1 ~ #2 ~ #3 ~ #4 } + { gray ~ #1 } + } + } + } + } + { \cs_new_protected:Npn \@@_color_pickup: { } } + } +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{variable}{\l_@@_color_stack_int} +% \pdfTeX{} and \LuaTeX{} have multiple stacks available, and to track +% which one is in use a variable is required. +% \begin{macrocode} +\int_new:N \l_@@_color_stack_int +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[int]{\@@_color_ensure_current:} +% \begin{macro}[aux, EXP] +% { +% \@@_color_convert:w, \@@_color_convert_gray:w, +% \@@_color_convert_cmyk:w, \@@_color_convert_rgb:w +% } +% \begin{macro}[aux]{\@@_color_reset:} +% There is a dedicated primitive/primitive interface for setting colors. +% As with scoping, this approach is not suitable for cached operations. +% Since we are using the \texttt{dvips} format to store color, there is a +% bit of work to correctly place it in the output. +% \begin{macrocode} +\cs_new_protected:Npx \@@_color_ensure_current: + { +%<*package> + \exp_not:N \@@_color_pickup: +%</package> + \cs_if_exist:NTF \luatex_pdfextension:D + { \luatex_pdfextension:D colorstack } + { \pdftex_pdfcolorstack:D } + \exp_not:N \l_@@_color_stack_int push + { + \exp_not:N \exp_after:wN + \exp_not:N \@@_color_convert:w + \exp_not:N \l__color_current_tl + \c_space_tl 0 ~ 0 ~ 0 + \exp_not:N \q_stop + } + } +\cs_new:Npn \@@_color_convert:w #1 ~ + { \use:c { @@_color_convert_ #1 :w } } +\cs_new:Npn \@@_color_convert_gray:w #1 ~ #2 \q_stop + { #1 ~ g ~ #1 ~ G } +\cs_new:Npn \@@_color_convert_cmyk:w #1 ~ #2 ~ #3 ~ #4 \q_stop + { #1 ~ #2 ~ #3 ~ rg ~ #1 ~ #2 ~ #3 ~ RG } +\cs_new:Npn \@@_color_convert_rgb:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop + { #1 ~ #2 ~ #3 ~ #4 ~ k ~ #1 ~ #2 ~ #3 ~ #4 ~ K } +\cs_new_protected:Npx \@@_color_reset: + { + \cs_if_exist:NTF \luatex_pdfextension:D + { \luatex_pdfextension:D colorstack } + { \pdftex_pdfcolorstack:D } + \exp_not:N \l_@@_color_stack_int pop \scan_stop: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +%</pdfmode> +% \end{macrocode} +% +% \subsection{\texttt{dvips} driver} +% +% \begin{macrocode} +%<*dvips> +% \end{macrocode} +% +% \subsubsection{Basics} +% +% \begin{macro}[int]{\@@_literal:n} +% In the case of \texttt{dvips} there is no build-in saving of the current +% position, and so some additional PostScript is required to set up the +% transformation matrix and also to restore it afterwards. Notice the use +% of the stack to save the current position \enquote{up front} and to +% move back to it at the end of the process. +% \begin{macrocode} +\cs_new_protected:Npn \@@_literal:n #1 + { + \tex_special:D + { + ps: + currentpoint~ + currentpoint~translate~ + #1 ~ + neg~exch~neg~exch~translate + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_scope_begin:, \@@_scope_end:} +% Scope saving/restoring is done directly with no need to worry about the +% transformation matrix. General scoping is only for the graphics stack so +% the lower-cost |gsave|/|grestore| pair are used. +% \begin{macrocode} +\cs_new_protected:Npn \@@_scope_begin: + { \tex_special:D { ps:gsave } } +\cs_new_protected:Npn \@@_scope_end: + { \tex_special:D { ps:grestore } } +% \end{macrocode} +% \end{macro} +% +% \subsection{Driver-specific auxiliaries} +% +% \begin{macro}[int, EXP]{\@@_absolute_lengths:n} +% The \texttt{dvips} driver scales all absolute dimensions based +% on the output resolution selected and any \TeX{} magnification. Thus +% for any operation involving absolute lengths there is a correction to +% make. This is based on \texttt{normalscale} from \texttt{special.pro} +% but using the stack rather than a definition to save the current matrix. +% \begin{macrocode} +\cs_new:Npn \@@_absolute_lengths:n #1 + { + matrix~currentmatrix~ + Resolution~72~div~VResolution~72~div~scale~ + DVImag~dup~scale~ + #1 ~ + setmatrix + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Box operations} +% +% \begin{macro}{\@@_box_use_clip:N} +% Much the same idea as for the PDF mode version but with a slightly +% different syntax for creating the clip path. To avoid any scaling +% issues we need the absolute length auxiliary here. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_clip:N #1 + { + \@@_scope_begin: + \@@_literal:n + { + \@@_absolute_lengths:n + { + 0 ~ + \dim_to_decimal_in_bp:n { \box_dp:N #1 } ~ + \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~ + \dim_to_decimal_in_bp:n { -\box_ht:N #1 - \box_dp:N #1 } ~ + rectclip + } + } + \hbox_overlap_right:n { \box_use:N #1 } + \@@_scope_end: + \skip_horizontal:n { \box_wd:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_box_use_rotate:Nn} +% Rotating using \texttt{dvips} does not require that the box dimensions +% are altered and has a very convenient built-in operation. Zero rotation +% must be written as |0| not |-0| so there is a quick test. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 + { + \@@_scope_begin: + \@@_literal:n + { + \fp_compare:nNnTF {#2} = \c_zero_fp + { 0 } + { \fp_eval:n { round ( -#2 , 5 ) } } ~ + rotate + } + \box_use:N #1 + \@@_scope_end: + } +% \end{macro} +% +% \begin{macro}{\@@_box_use_scale:Nnn} +% The \texttt{dvips} driver once again has a dedicated operation we can +% use here. +% \begin{macrocode} +\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 + { + \@@_scope_begin: + \@@_literal:n + { + \fp_eval:n { round ( #2 , 5 ) } ~ + \fp_eval:n { round ( #3 , 5 ) } ~ + scale + } + \hbox_overlap_right:n { \box_use:N #1 } + \@@_scope_end: + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Images} +% +% \begin{macro}[int]{\@@_image_getbb_eps:n} +% Simply use the generic function. +% \begin{macrocode} +\cs_new_eq:NN \@@_image_getbb_eps:n \__image_read_bb:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_image_include_eps:n} +% The special syntax is relatively clear here: remember we need PostScript +% sizes here. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_include_eps:n #1 + { + \tex_special:D { PSfile = #1 } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Drawing} +% +% \begin{macro}[aux]{\@@_draw_literal:n, \@@_draw_literal:x} +% Literals with no positioning (using |ps:| each one is positioned but +% cut off from everything else, so no good for the stepwise approach needed +% here). +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_literal:n #1 + { \tex_special:D { ps:: ~ #1 } } +\cs_generate_variant:Nn \@@_draw_literal:n { x } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_begin:, \@@_draw_end:} +% The |ps::[begin]| special here deals with positioning but allows us to +% continue on to a matching |ps::[end]|: contrast with |ps:|, which positions +% but where we can't split material between separate calls. The +% |@beginspecial|/|@endspecial| pair are from |special.pro| and correct the +% scale and $y$-axis direction. The reference point at the start of the box +% is saved (as |l3x|/|l3y|) as it is needed when inserting various items. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_begin: + { + \tex_special:D { ps::[begin] } + \tex_special:D { ps::~save } + \tex_special:D { ps::~/l3x~currentpoint~/l3y~exch~def~def } + \tex_special:D { ps::~@beginspecial } + } +\cs_new_protected:Npn \@@_draw_end: + { + \tex_special:D { ps::~@endspecial } + \tex_special:D { ps::~restore } + \tex_special:D { ps::[end] } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_scope_begin:, \@@_draw_scope_end:} +% Scope here may need to contain saved definitions, so the entire memory +% rather than just the graphic state has to be sent to the stack. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_scope_begin: + { \@@_draw_literal:n { save } } +\cs_new_protected:Npn \@@_draw_scope_end: + { \@@_draw_literal:n { restore } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_moveto:nn, \@@_draw_lineto:nn} +% \begin{macro}[int]{\@@_draw_rectangle:nnnn} +% \begin{macro}[int]{\@@_draw_curveto:nnnnnn} +% Path creation operations mainly resolve directly to PostScript primitive +% steps, with only the need to convert to \texttt{bp}. Notice that +% \texttt{x}-type expansion is included here to ensure that any variable +% values are forced to literals before any possible caching. There is +% no native rectangular path command (without also clipping, filling or +% stroking), so that task is done using a small amount of PostScript. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_moveto:nn #1#2 + { + \@@_draw_literal:x + { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ moveto } + } +\cs_new_protected:Npn \@@_draw_lineto:nn #1#2 + { + \@@_draw_literal:x + { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ lineto } + } +\cs_new_protected:Npn \@@_draw_rectangle:nnnn #1#2#3#4 + { + \@@_draw_literal:x + { + \dim_to_decimal_in_bp:n {#4} ~ \dim_to_decimal_in_bp:n {#3} ~ + \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ + moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~closepath + } + } +\cs_new_protected:Npn \@@_draw_curveto:nnnnnn #1#2#3#4#5#6 + { + \@@_draw_literal:x + { + \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ + \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ + \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ + curveto + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_evenodd_rule:, \@@_draw_nonzero_rule:} +% \begin{variable}[aux]{\g_@@_draw_eor_bool} +% The even-odd rule here can be implemented as a simply switch. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_evenodd_rule: + { \bool_gset_true:N \g_@@_draw_eor_bool } +\cs_new_protected:Npn \@@_draw_nonzero_rule: + { \bool_gset_false:N \g_@@_draw_eor_bool } +\bool_new:N \g_@@_draw_eor_bool +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% \begin{macro}[int] +% { +% \@@_draw_closepath: , +% \@@_draw_stroke: , +% \@@_draw_closestroke: , +% \@@_draw_fill: , +% \@@_draw_fillstroke: , +% \@@_draw_clip: , +% \@@_draw_discardpath: +% } +% \begin{variable}[aux]{\g_@@_draw_clip_bool} +% Unlike PDF, PostScript doesn't track separate colors for strokes and other +% elements. It is also desirable to have the |clip| keyword after a stroke or +% fill. To achieve those outcomes, there is some work to do. For color, if a +% stroke or fill color is defined it is used for the relevant operation, with +% a graphic scope inserted as required. That does mean that once such a color +% is set all further uses inside the same scope have to use scoping: see also +% the color set up functions. For clipping, the required ordering is achieved +% using a \TeX{} switch. All of the operations end with a new path instruction +% as they do not terminate (again in contrast to PDF). +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_closepath: + { \@@_draw_literal:n { closepath } } +\cs_new_protected:Npn \@@_draw_stroke: + { + \@@_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if } + \@@_draw_literal:n { stroke } + \@@_draw_literal:n { currentdict~/l3sc~known~{grestore}~if } + \bool_if:NT \g_@@_draw_clip_bool + { + \@@_draw_literal:x + { + \bool_if:NT \g_@@_draw_eor_bool { eo } + clip + } + } + \@@_draw_literal:n { newpath } + \bool_gset_false:N \g_@@_draw_clip_bool + } +\cs_new_protected:Npn \@@_draw_closestroke: + { + \@@_draw_closepath: + \@@_draw_stroke: + } +\cs_new_protected:Npn \@@_draw_fill: + { + \@@_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if } + \@@_draw_literal:x + { + \bool_if:NT \g_@@_draw_eor_bool { eo } + fill + } + \@@_draw_literal:n { currentdict~/l3fc~known~{grestore}~if } + \bool_if:NT \g_@@_draw_clip_bool + { + \@@_draw_literal:x + { + \bool_if:NT \g_@@_draw_eor_bool { eo } + clip + } + } + \@@_draw_literal:n { newpath } + \bool_gset_false:N \g_@@_draw_clip_bool + } +\cs_new_protected:Npn \@@_draw_fillstroke: + { + \@@_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if } + \@@_draw_literal:x + { + \bool_if:NT \g_@@_draw_eor_bool { eo } + fill + } + \@@_draw_literal:n { currentdict~/l3fc~known~{grestore}~if } + \@@_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if } + \@@_draw_literal:n { stroke } + \@@_draw_literal:n { currentdict~/l3sc~known~{grestore}~if } + \bool_if:NT \g_@@_draw_clip_bool + { + \@@_draw_literal:x + { + \bool_if:NT \g_@@_draw_eor_bool { eo } + clip + } + } + \@@_draw_literal:n { newpath } + \bool_gset_false:N \g_@@_draw_clip_bool + } +\cs_new_protected:Npn \@@_draw_clip: + { \bool_gset_true:N \g_@@_draw_clip_bool } +\bool_new:N \g_@@_draw_clip_bool +\cs_new_protected:Npn \@@_draw_discardpath: + { + \bool_if:NT \g_@@_draw_clip_bool + { + \@@_draw_literal:x + { + \bool_if:NT \g_@@_draw_eor_bool { eo } + clip + } + } + \@@_draw_literal:n { newpath } + \bool_gset_false:N \g_@@_draw_clip_bool + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_dash:nn} +% \begin{macro}[aux]{\@@_draw_dash:n} +% \begin{macro}[int]{\@@_draw_linewidth:n} +% \begin{macro}[int]{\@@_draw_miterlimit:n} +% \begin{macro}[int] +% { +% \@@_draw_cap_butt:, \@@_draw_cap_round:, \@@_draw_cap_rectangle:, +% \@@_draw_join_miter:, \@@_draw_join_round:, \@@_draw_join_bevel: +% } +% Converting paths to output is again a case of mapping directly to +% PostScript operations. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_dash:nn #1#2 + { + \@@_draw_literal:x + { + [ ~ + \clist_map_function:nN {#1} \@@_draw_dash:n + ] ~ + \dim_to_decimal_in_bp:n {#2} ~ setdash + } + } +\cs_new:Npn \@@_draw_dash:n #1 + { \dim_to_decimal_in_bp:n {#1} ~ } +\cs_new_protected:Npn \@@_draw_linewidth:n #1 + { + \@@_draw_literal:x + { \dim_to_decimal_in_bp:n {#1} ~ setlinewidth } + } +\cs_new_protected:Npn \@@_draw_miterlimit:n #1 + { \@@_draw_literal:x { \fp_eval:n {#1} ~ setmiterlimit } } +\cs_new_protected:Npn \@@_draw_cap_butt: + { \@@_draw_literal:n { 0 ~ setlinecap } } +\cs_new_protected:Npn \@@_draw_cap_round: + { \@@_draw_literal:n { 1 ~ setlinecap } } +\cs_new_protected:Npn \@@_draw_cap_rectangle: + { \@@_draw_literal:n { 2 ~ setlinecap } } +\cs_new_protected:Npn \@@_draw_join_miter: + { \@@_draw_literal:n { 0 ~ setlinejoin } } +\cs_new_protected:Npn \@@_draw_join_round: + { \@@_draw_literal:n { 1 ~ setlinejoin } } +\cs_new_protected:Npn \@@_draw_join_bevel: + { \@@_draw_literal:n { 2 ~ setlinejoin } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux]{\_@@_draw_color_reset:} +% \begin{macro}[int] +% { +% \@@_draw_color_cmyk:nnnn , +% \@@_draw_color_cmyk_fill:nnnn , +% \@@_draw_color_cmyk_stroke:nnnn +% } +% \begin{macro}[int] +% { +% \@@_draw_color_gray:n , +% \@@_draw_color_gray_fill:n , +% \@@_draw_color_gray_stroke:n +% } +% \begin{macro}[int] +% { +% \@@_draw_color_rgb:nnn , +% \@@_draw_color_rgb_fill:nnn , +% \@@_draw_color_rgb_stroke:nnn +% } +% To allow color to be defined for strokes and fills separately and to +% respect scoping, the data needs to be stored at the PostScript level. +% We cannot undefine (local) fill/stroke colors once set up but we can +% set them blank to improve performance slightly. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_color_reset: + { + \@@_draw_literal:n { currentdic~/l3fc~known~{ /l3fc~ { } ~def }~if } + \@@_draw_literal:n { currentdic~/l3sc~known~{ /l3sc~ { } ~def }~if } + } +\cs_new_protected:Npn \@@_draw_color_cmyk:nnnn #1#2#3#4 + { + \@@_draw_literal:x + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ + setcmykcolor ~ + } + \@@_draw_color_reset: + } +\cs_new_protected:Npn \@@_draw_color_cmyk_fill:nnnn #1#2#3#4 + { + \@@_draw_literal:x + { + /l3fc ~ + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ + setcmykcolor + } ~ + def + } + } +\cs_new_protected:Npn \@@_draw_color_cmyk_stroke:nnnn #1#2#3#4 + { + \__driver_draw_literal:x + { + /l3sc ~ + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ + setcmykcolor + } ~ + def + } + } +\cs_new_protected:Npn \@@_draw_color_gray:n #1 + { + \@@_draw_literal:x { fp_eval:n {#1} ~ setgray } + \@@_draw_color_reset: + } +\cs_new_protected:Npn \@@_draw_color_gray_fill:n #1 + { \@@_draw_literal:x { /l3fc ~ { \fp_eval:n {#1} ~ setgray } ~ def } } +\cs_new_protected:Npn \@@_draw_color_gray_stroke:n #1 + { \@@_draw_literal:x { /l3sc ~ { \fp_eval:n {#1} ~ setgray } ~ def } } +\cs_new_protected:Npn \@@_draw_color_rgb:nnn #1#2#3 + { + \@@_draw_literal:x + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ + setrgbcolor + } + \@@_draw_color_reset: + } +\cs_new_protected:Npn \@@_draw_color_rgb_fill:nnn #1#2#3 + { + \@@_draw_literal:x + { + /l3fc ~ + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ + setrgbcolor + } ~ + def + } + } +\cs_new_protected:Npn \@@_draw_color_rgb_stroke:nnn #1#2#3 + { + \@@_draw_literal:x + { + /l3sc ~ + { + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ + setrgbcolor + } ~ + def + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_transformcm:nnnnnn} +% The first four arguments here are floats (the affine matrix), the last +% two are a displacement vector. Once again, force evaluation to allow for +% caching. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_transformcm:nnnnnn #1#2#3#4#5#6 + { + \@@_draw_literal:x + { + [ + \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ + \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ + \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ + ] ~ + concat + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_draw_hbox:Nnnnnnn} +% Inside a picture |@beginspecial|/|@endspecial| are active, which is +% normally a good thing but means that the position and scaling would be off +% if the box was inserted directly. Instead, we need to reverse the effect of +% the (normally desirable) shift/scaling within the box. That requires +% knowing where the reference point for the drawing is: saved as |l3x|/|l3y| +% at the start of the picture. Transformation here is relative to the +% drawing origin so has to be done purely in driver code not using \TeX{} +% offsets. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 + { + \@@_scope_begin: + \tex_special:D { ps::[end] } + \@@_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7} + \tex_special:D { ps::~72~Resolution~div~72~VResolution~div~neg~scale } + \tex_special:D { ps::~magscale~{1~DVImag~div~dup~scale}~if } + \tex_special:D { ps::~l3x~neg~l3y~neg~translate } + \group_begin: + \box_set_wd:Nn #1 { 0pt } + \box_set_ht:Nn #1 { 0pt } + \box_set_dp:Nn #1 { 0pt } + \box_use:N #1 + \group_end: + \tex_special:D { ps::[begin] } + \@@_scope_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</dvips> +% \end{macrocode} +% % \subsection{\texttt{pdfmode} driver} % % \begin{macrocode} @@ -638,58 +1384,6 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{Color} -% -% \begin{variable}{\l_@@_color_current_tl} -% The current color in driver-dependent format: pick up the package-mode -% data if available. -% \begin{macrocode} -\tl_new:N \l_@@_color_current_tl -\tl_set:Nn \l_@@_color_current_tl { 0~g~0~G } -%<*package> -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_color_current_tl { \current@color } } - { } - } -%</package> -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_@@_color_stack_int} -% \pdfTeX{} and \LuaTeX{} have multiple stacks available, and to track -% which one is in use a variable is required. -% \begin{macrocode} -\int_new:N \l_@@_color_stack_int -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[int]{\@@_color_ensure_current:} -% \begin{macro}[aux]{\@@_color_reset:} -% There is a dedicated primitive/primitive interface for setting colors. -% As with scoping, this approach is not suitable for cached operations. -% \begin{macrocode} -\cs_new_protected:Npx \@@_color_ensure_current: - { - \cs_if_exist:NTF \luatex_pdfextension:D - { \luatex_pdfextension:D colorstack } - { \pdftex_pdfcolorstack:D } - \exp_not:N \l_@@_color_stack_int push - { \exp_not:N \l_@@_color_current_tl } - \group_insert_after:N \exp_not:N \@@_color_reset: - } -\cs_new_protected:Npx \@@_color_reset: - { - \cs_if_exist:NTF \luatex_pdfextension:D - { \luatex_pdfextension:D colorstack } - { \pdftex_pdfcolorstack:D } - \exp_not:N \l_@@_color_stack_int pop \scan_stop: - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Images} % % \begin{variable}{\l_@@_image_attr_tl} @@ -713,64 +1407,84 @@ % and vector images but keeping the common parts, there is a little work % to do in terms of auxiliaries. The key here is to notice that we need % two forms of the attributes: a \enquote{short} set to allow us to -% track for caching, and the full form to pass to the primitive. Note that -% in |pdftex.def| the short reference is stored to be used in the inclusion -% stage: may be required when there are more aspects to track. +% track for caching, and the full form to pass to the primitive. % \begin{macrocode} \cs_new_protected:Npn \@@_image_getbb_jpg:n #1 { \int_zero:N \l__image_page_int + \tl_clear:N \l__image_pagebox_tl \tl_set:Nx \l_@@_image_attr_tl { + \tl_if_empty:NF \l__image_decode_tl + { :D \l__image_decode_tl } \bool_if:NT \l__image_interpolate_bool { :I } } + \tl_clear:N \l_@@_image_attr_tl \@@_image_getbb_auxi:n {#1} } \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n \cs_new_protected:Npn \@@_image_getbb_pdf:n #1 { + \tl_clear:N \l__image_decode_tl \bool_set_false:N \l__image_interpolate_bool \tl_set:Nx \l_@@_image_attr_tl { - \int_compare:nNnT \l__image_page_int > 0 + : \l__image_pagebox_tl + \int_compare:nNnT \l__image_page_int > 1 { :P \int_use:N \l__image_page_int } } \@@_image_getbb_auxi:n {#1} } \cs_new_protected:Npn \@@_image_getbb_auxi:n #1 { - \dim_if_exist:cTF { c__image_ #1 \l_@@_image_attr_tl _ht_dim } + \dim_zero:N \l__image_llx_dim + \dim_zero:N \l__image_lly_dim + \dim_if_exist:cTF { c__image_ #1 \l_@@_image_attr_tl _urx_dim } { - \dim_set_eq:Nc \l__image_ht_dim - { c__image_ #1 \l_@@_image_attr_tl _ht_dim } - \dim_set_eq:Nc \l__image_wd_dim - { c__image_ #1 \l_@@_image_attr_tl _wd_dim } + \dim_set_eq:Nc \l__image_urx_dim + { c__image_ #1 \l_@@_image_attr_tl _urx_dim } + \dim_set_eq:Nc \l__image_ury_dim + { c__image_ #1 \l_@@_image_attr_tl _ury_dim } } { \@@_image_getbb_auxii:n {#1} } } % \begin{macrocode} % Measuring the image is done by boxing up: for PDF images we could % use |\pdftex_pdfximagebbox:D|, but if doesn't work for other types. +% As the box always starts at $(0,0)$ there is no need to worry about +% the lower-left position. % \begin{macrocode} \cs_new_protected:Npn \@@_image_getbb_auxii:n #1 { \tex_immediate:D \pdftex_pdfximage:D - \bool_if:NT \l__image_interpolate_bool - { attr ~ { /Interpolate~true } } + \bool_lazy_or:nnT + { \l__image_interpolate_bool } + { ! \tl_if_empty_p:N \l__image_decode_tl } + { + attr ~ + { + \tl_if_empty:NF \l__image_decode_tl + { /Decode~[ \l__image_decode_tl ] } + \bool_if:NT \l__image_interpolate_bool + { /Interpolate~true } + } + } \int_compare:nNnT \l__image_page_int > 0 { page ~ \int_use:N \l__image_page_int } + \tl_if_empty:NF \l__image_pagebox_tl + { \l__image_pagebox_tl } {#1} \hbox_set:Nn \l__image_tmp_box { \pdftex_pdfrefximage:D \pdftex_pdflastximage:D } - \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } - \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } + \dim_set:Nn \l__image_urx_dim { \box_wd:N \l__image_tmp_box } + \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box } \int_const:cn { c__image_ #1 \l_@@_image_attr_tl _int } { \tex_the:D \pdftex_pdflastximage:D } - \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _ht_dim } - { \l__image_ht_dim } - \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _wd_dim } - { \l__image_wd_dim } + \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _urx_dim } + { \l__image_urx_dim } + \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _ury_dim } + { \l__image_ury_dim } } % \end{macrocode} % \end{macro} @@ -858,7 +1572,7 @@ % \begin{macro}[int]{\@@_box_use_rotate:Nn} % Rotating in \texttt{(x)}dvipdmfx can be implemented using either PDF or % driver-specific code. The former approach however is not \enquote{aware} -% of the content of boxes: this means that any links embded will not be +% of the content of boxes: this means that any embedded links would not be % adjusted by the rotation. As such, the driver-native approach is prefered: % the code therefore is similar (though not identical) to the \texttt{dvips} % version (notice the rotation angle here is positive). As for @@ -899,39 +1613,6 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{Color} -% -% \begin{variable}{\l_@@_color_current_tl} -% The current color in driver-dependent format. -% \begin{macrocode} -\tl_new:N \l_@@_color_current_tl -\tl_set:Nn \l_@@_color_current_tl { [ 0 ] } -%<*package> -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_color_current_tl { \current@color } } - { } - } -%</package> -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[int]{\@@_color_ensure_current:} -% \begin{macro}[aux]{\@@_color_reset:} -% Directly set the color using the specials with optimisation support. -% \begin{macrocode} -\cs_new_protected:Npn \@@_color_ensure_current: - { - \tex_special:D { pdf:bcolor~\l_@@_color_current_tl } - \group_insert_after:N \@@_color_reset: - } -\cs_new_protected:Npn \@@_color_reset: - { \tex_special:D { pdf:ecolor } } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Images} % % \begin{macro}[int] @@ -947,12 +1628,14 @@ \cs_new_protected:Npn \@@_image_getbb_jpg:n #1 { \int_zero:N \l__image_page_int + \tl_clear:N \l__image_pagebox_tl \__image_extract_bb:n {#1} } \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n \cs_new_protected:Npn \@@_image_getbb_pdf:n #1 { - \bool_set_false:N \l__image_interpolate_tl + \tl_clear:N \l__image_decode_tl + \bool_set_false:N \l__image_interpolate_bool \__image_extract_bb:n {#1} } %</dvipdfmx> @@ -974,7 +1657,10 @@ % \begin{macro}[aux]{\@@_image_include_auxi:nn} % \begin{macro}[aux]{\@@_image_include_auxii:nnn, \@@_image_include_auxii:xnn} % \begin{macro}[aux]{\@@_image_include_auxiii:nn} -% The special syntax depends on the file type. +% The special syntax depends on the file type. There is a difference in +% how PDF images are best handled between |dvipdfmx| and |xdvipdfmx|: for +% the latter it is better to use the primitive route. The relevant code for +% that is included later in this file. % \begin{macrocode} \cs_new_protected:Npn \@@_image_include_eps:n #1 { @@ -982,9 +1668,11 @@ } \cs_new_protected:Npn \@@_image_include_jpg:n #1 { \@@_image_include_auxi:nn {#1} { image } } -\cs_new_eq:NN \@@_image_include_png:n \@@_image_include_png:n +\cs_new_eq:NN \@@_image_include_png:n \@@_image_include_jpg:n +%<*dvipdfmx> \cs_new_protected:Npn \@@_image_include_pdf:n #1 { \@@_image_include_auxi:nn {#1} { epdf } } +%</dvipdfmx> % \end{macrocode} % Image inclusion is set up to use the fact that each image is stored in % the PDF as an XObject. This means that we can include repeated images @@ -995,8 +1683,12 @@ { \@@_image_include_auxii:xnn { - \int_compare:nNnT \l__image_page_int > 0 + \tl_if_empty:NF \l__image_pagebox_tl + { : \l__image_pagebox_tl } + \int_compare:nNnT \l__image_page_int > 1 { :P \int_use:N \l__image_page_int } + \tl_if_empty:NF \l__image_decode_tl + { :D \l__image_decode_tl } \bool_if:NT \l__image_interpolate_bool { :I } } @@ -1012,6 +1704,12 @@ { \@@_image_include_auxiii:nn {#2} {#1} {#3} } } \cs_generate_variant:Nn \@@_image_include_auxii:nnn { x } +% \end{macrocode} +% Inclusion using the specials is relatively straight-forward, but there +% is one wrinkle. To get the |pagebox| correct for PDF images in all cases, +% it is necessary to provide both that information and the |bbox| argument: +% odd things happen otherwise! +% \begin{macrocode} \cs_new_protected:Npn \@@_image_include_auxiii:nnn #1#2#3 { \int_gincr:N \g_@@_image_int @@ -1020,11 +1718,29 @@ { pdf:#3~ @image \int_use:c { c__image_ #1#2 _int } - \int_compare:nNnT \l__image_page_int > 0 + \int_compare:nNnT \l__image_page_int > 1 { page ~ \int_use:N \l__image_page_int \c_space_tl } + \tl_if_empty:NF \l__image_pagebox_tl + { + pagebox ~ \l__image_pagebox_tl \c_space_tl + bbox ~ + \dim_to_decimal_in_bp:n \l__image_llx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_lly_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_urx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_ury_dim \c_space_tl + } (#1) - \bool_if:NT \l__image_interpolate_bool - { <</Interpolate~true>> } + \bool_lazy_or:nnT + { \l__image_interpolate_bool } + { ! \tl_if_empty_p:N \l__imge_decode_tl } + { + << + \tl_if_empty:NF \l__imge_decode_tl + { /Decode~[ \l__imge_decode_tl ] } + \bool_if:NT \l__image_interpolate_bool + { /Interpolate~true> } + >> + } } } % \end{macrocode} @@ -1043,41 +1759,6 @@ %<*xdvipdfmx> % \end{macrocode} % -% \subsubsection{Color} -% -% \begin{macro}[int]{\@@_color_ensure_current:} -% \begin{macro}[aux]{\@@_color_reset:} -% Older \LaTeXe{} drivers uses \texttt{dvips}-like specials so there has to -% be a change of set up if \pkg{color} is loaded and if the current color -% doesn't match the pattern expected for |dvipdfmx|. -% \begin{macrocode} -%<*package> -\AtBeginDocument - { - \@ifpackageloaded { color } - { - \cs_set_protected:Npn \@@_tmp:w #1 [ #2 ] #3 \q_stop - { - \tl_if_empty:nT {#2} - { - \cs_set_protected:Npn \@@_color_ensure_current: - { - \tex_special:D { color~push~\l_@@_color_current_tl } - \group_insert_after:N \@@_color_reset: - } - \cs_set_protected:Npn \@@_color_reset: - { \tex_special:D { color~pop } } - } - } - \exp_after:wN \@@_tmp:w \current@color [ ] \q_stop - } - { } - } -%</package> -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Images} % % \begin{macro}[int] @@ -1085,50 +1766,99 @@ % \begin{macro}[aux]{\@@_image_getbb_auxi:nN} % \begin{macro}[aux]{\@@_image_getbb_auxii:nnN, \@@_image_getbb_auxii:VnN} % \begin{macro}[aux]{\@@_image_getbb_auxiii:nNnn} +% \begin{macro}[aux]{\@@_image_getbb_auxiv:nnNnn, \@@_image_getbb_auxiv:VnNnn} +% \begin{macro}[aux]{\@@_image_getbb_auxv:nNnn, \@@_image_getbb_auxv:nNnn} +% \begin{macro}[aux, EXP]{\@@_image_getbb_pagebox:w} % For \texttt{xdvipdfmx}, there are two primitives that allow us to obtain -% the bounding box without needing \texttt{extractbb}. +% the bounding box without needing \texttt{extractbb}. The only complexity +% is passing the various minor variations to a common core process. The +% \XeTeX{} primitive omits the text |box| from the page box specification, +% so there is also some \enquote{trimming} to do here. % \begin{macrocode} \cs_new_protected:Npn \@@_image_getbb_jpg:n #1 { \int_zero:N \l__image_page_int + \tl_clear:N \l__image_pagebox_tl \@@_image_getbb_auxi:nN {#1} \xetex_picfile:D } \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n \cs_new_protected:Npn \@@_image_getbb_pdf:n #1 - { \@@_image_getbb_auxi:nN {#1} \xetex_pdffile:D } + { + \tl_clear:N \l__image_decode_tl + \bool_set_false:N \l__image_interpolate_bool + \@@_image_getbb_auxi:nN {#1} \xetex_pdffile:D + } \cs_new_protected:Npn \@@_image_getbb_auxi:nN #1#2 { - \int_compare:nNnTF \l__image_page_int > 0 + \int_compare:nNnTF \l__image_page_int > 1 { \@@_image_getbb_auxii:VnN \l__image_page_int {#1} #2 } { \@@_image_getbb_auxiii:nNnn {#1} #2 } } \cs_new_protected:Npn \@@_image_getbb_auxii:nnN #1#2#3 - { \@@_image_getbb_auxiii:nNnn {#2} #3 { :P #1 } { page #1 } } + { \@@_image_getbb_aux:nNnn {#2} #3 { :P #1 } { page #1 } } \cs_generate_variant:Nn \@@_image_getbb_auxii:nnN { V } \cs_new_protected:Npn \@@_image_getbb_auxiii:nNnn #1#2#3#4 { - \dim_if_exist:cTF { c__image_ #1#3 _ht_dim } + \tl_if_empty:NTF \l__image_pagebox_tl + { \@@_image_getbb_auxiv:VnNnn \l__image_pagebox_tl } + { \@@_image_getbb_auxv:nNnn } + {#1} #2 {#3} {#4} + } +\cs_new_protected:Npn \@@_image_getbb_auxiv:nnNnn #1#2#3#4#5 + { + \use:x + { + \@@_image_getbb_auxv:nNnn {#2} #3 { : #1 #4 } + { #5 ~ \@@_image_getbb_pagebox:w #1 } + } + } +\cs_generate_variant:Nn \@@_image_getbb_auxiv:nnNnn { V } +\cs_new_protected:Npn \@@_image_getbb_auxv:nNnn #1#2#3#4 + { + \dim_zero:N \l__image_llx_dim + \dim_zero:N \l__image_lly_dim + \dim_if_exist:cTF { c__image_ #1#3 _urx_dim } { - \dim_set_eq:Nc \l__image_ht_dim { c__image_ #1#3 _ht_dim } - \dim_set_eq:Nc \l__image_wd_dim { c__image_ #1#3 _wd_dim } + \dim_set_eq:Nc \l__image_urx_dim { c__image_ #1#3 _urx_dim } + \dim_set_eq:Nc \l__image_ury_dim { c__image_ #1#3 _ury_dim } } { \@@_image_getbb_auxvi:nNnn {#1} #2 {#3} {#4} } } \cs_new_protected:Npn \@@_image_getbb_auxvi:nNnn #1#2#3#4 { \hbox_set:Nn \l__image_tmp_box { #2 #1 ~ #4 } - \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } - \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } - \dim_const:cn { c__image_ #1#3 _ht_dim } - { \l__image_ht_dim } - \dim_const:cn { c__image_ #1#3 _wd_dim } - { \l__image_wd_dim } + \dim_set:Nn \l__image_utx_dim { \box_wd:N \l__image_tmp_box } + \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box } + \dim_const:cn { c__image_ #1#3 _urx_dim } + { \l__image_urx_dim } + \dim_const:cn { c__image_ #1#3 _ury_dim } + { \l__image_ury_dim } } +\cs_new:Npn \@@_image_getbb_pagebox:w #1 box {#1} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\@@_image_include_pdf:n} +% For PDF images, properly supporting the |pagebox| concept in \XeTeX{} +% is best done using the |\xetex_pdffile:D| primitive. The syntax here +% is the same as for the image measurement part, although we know at this +% stage that there must be some valid setting for \cs{l__image_pagebox_tl}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_include_pdf:n #1 + { + \xetex_pdffile:D "#1" ~ + \int_compare:nNnT \l__image_page_int > 0 + { page~ \int_use:N \l__image_page_int } + \@@_image_getbb_auxiv:VnNnn \l__image_pagebox_tl + } +% \end{macrocode} +% \end{macro} % % \begin{macrocode} %</xdvipdfmx> @@ -1474,616 +2204,6 @@ %</dvipdfmx|pdfmode|xdvipdfmx> % \end{macrocode} % -% \subsection{\texttt{dvips} driver} -% -% \begin{macrocode} -%<*dvips> -% \end{macrocode} -% -% \subsubsection{Basics} -% -% \begin{macro}[int]{\@@_literal:n} -% In the case of \texttt{dvips} there is no build-in saving of the current -% position, and so some additional PostScript is required to set up the -% transformation matrix and also to restore it afterwards. Notice the use -% of the stack to save the current position \enquote{up front} and to -% move back to it at the end of the process. -% \begin{macrocode} -\cs_new_protected:Npn \@@_literal:n #1 - { - \tex_special:D - { - ps: - currentpoint~ - currentpoint~translate~ - #1 ~ - neg~exch~neg~exch~translate - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_scope_begin:, \@@_scope_end:} -% Scope saving/restoring is done directly with no need to worry about the -% transformation matrix. General scoping is only for the graphics stack so -% the lower-cost |gsave|/|grestore| pair are used. -% \begin{macrocode} -\cs_new_protected:Npn \@@_scope_begin: - { \tex_special:D { ps:gsave } } -\cs_new_protected:Npn \@@_scope_end: - { \tex_special:D { ps:grestore } } -% \end{macrocode} -% \end{macro} -% -% \subsection{Driver-specific auxiliaries} -% -% \begin{macro}[int, EXP]{\@@_absolute_lengths:n} -% The \texttt{dvips} driver scales all absolute dimensions based -% on the output resolution selected and any \TeX{} magnification. Thus -% for any operation involving absolute lengths there is a correction to -% make. This is based on \texttt{normalscale} from \texttt{special.pro} -% but using the stack rather than a definition to save the current matrix. -% \begin{macrocode} -\cs_new:Npn \@@_absolute_lengths:n #1 - { - matrix~currentmatrix~ - Resolution~72~div~VResolution~72~div~scale~ - DVImag~dup~scale~ - #1 ~ - setmatrix - } -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Box operations} -% -% \begin{macro}{\@@_box_use_clip:N} -% Much the same idea as for the PDF mode version but with a slightly -% different syntax for creating the clip path. To avoid any scaling -% issues we need the absolute length auxiliary here. -% \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_clip:N #1 - { - \@@_scope_begin: - \@@_literal:n - { - \@@_absolute_lengths:n - { - 0 ~ - \dim_to_decimal_in_bp:n { \box_dp:N #1 } ~ - \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~ - \dim_to_decimal_in_bp:n { -\box_ht:N #1 - \box_dp:N #1 } ~ - rectclip - } - } - \hbox_overlap_right:n { \box_use:N #1 } - \@@_scope_end: - \skip_horizontal:n { \box_wd:N #1 } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_box_use_rotate:Nn} -% Rotating using \texttt{dvips} does not require that the box dimensions -% are altered and has a very convenient built-in operation. Zero rotation -% must be written as |0| not |-0| so there is a quick test. -% \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2 - { - \@@_scope_begin: - \@@_literal:n - { - \fp_compare:nNnTF {#2} = \c_zero_fp - { 0 } - { \fp_eval:n { round ( -#2 , 5 ) } } ~ - rotate - } - \box_use:N #1 - \@@_scope_end: - } -% \end{macro} -% -% \begin{macro}{\@@_box_use_scale:Nnn} -% The \texttt{dvips} driver once again has a dedicated operation we can -% use here. -% \begin{macrocode} -\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3 - { - \@@_scope_begin: - \@@_literal:n - { - \fp_eval:n { round ( #2 , 5 ) } ~ - \fp_eval:n { round ( #3 , 5 ) } ~ - scale - } - \hbox_overlap_right:n { \box_use:N #1 } - \@@_scope_end: - } -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Color} -% -% \begin{variable}{\l_@@_color_current_tl} -% The current color in driver-dependent format. -% \begin{macrocode} -\tl_new:N \l_@@_color_current_tl -\tl_set:Nn \l_@@_color_current_tl { gray~0 } -%<*package> -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_color_current_tl { \current@color } } - { } - } -%</package> -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[int]{\@@_color_ensure_current:} -% \begin{macro}[aux]{\@@_color_reset:} -% Directly set the color using the specials: no optimisation here. -% \begin{macrocode} -\cs_new_protected:Npn \@@_color_ensure_current: - { - \tex_special:D { color~push~\l_@@_color_current_tl } - \group_insert_after:N \@@_color_reset: - } -\cs_new_protected:Npn \@@_color_reset: - { \tex_special:D { color~pop } } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Images} -% -% \begin{macro}[int]{\@@_image_getbb_eps:n} -% Simply use the generic function. -% \begin{macrocode} -\cs_new_eq:NN \@@_image_getbb_eps:n \__image_read_bb:n -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_image_include_eps:n} -% The special syntax is relatively clear here: remember we need PostScript -% sizes here. -% \begin{macrocode} -\cs_new_protected:Npn \@@_image_include_eps:n #1 - { - \tex_special:D { PSfile = #1 } - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Drawing} -% -% \begin{macro}[aux]{\@@_draw_literal:n, \@@_draw_literal:x} -% Literals with no positioning (using |ps:| each one is positioned but -% cut off from everything else, so no good for the stepwise approach needed -% here). -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_literal:n #1 - { \tex_special:D { ps:: ~ #1 } } -\cs_generate_variant:Nn \@@_draw_literal:n { x } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_begin:, \@@_draw_end:} -% The |ps::[begin]| special here deals with positioning but allows us to -% continue on to a matching |ps::[end]|: contrast with |ps:|, which positions -% but where we can't split material between separate calls. The -% |@beginspecial|/|@endspecial| pair are from |special.pro| and correct the -% scale and $y$-axis direction. The reference point at the start of the box -% is saved (as |l3x|/|l3y|) as it is needed when inserting various items. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_begin: - { - \tex_special:D { ps::[begin] } - \tex_special:D { ps::~save } - \tex_special:D { ps::~/l3x~currentpoint~/l3y~exch~def~def } - \tex_special:D { ps::~@beginspecial } - } -\cs_new_protected:Npn \@@_draw_end: - { - \tex_special:D { ps::~@endspecial } - \tex_special:D { ps::~restore } - \tex_special:D { ps::[end] } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_scope_begin:, \@@_draw_scope_end:} -% Scope here may need to contain saved definitions, so the entire memory -% rather than just the graphic state has to be sent to the stack. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_scope_begin: - { \@@_draw_literal:n { save } } -\cs_new_protected:Npn \@@_draw_scope_end: - { \@@_draw_literal:n { restore } } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_moveto:nn, \@@_draw_lineto:nn} -% \begin{macro}[int]{\@@_draw_rectangle:nnnn} -% \begin{macro}[int]{\@@_draw_curveto:nnnnnn} -% Path creation operations mainly resolve directly to PostScript primitive -% steps, with only the need to convert to \texttt{bp}. Notice that -% \texttt{x}-type expansion is included here to ensure that any variable -% values are forced to literals before any possible caching. There is -% no native rectangular path command (without also clipping, filling or -% stroking), so that task is done using a small amount of PostScript. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_moveto:nn #1#2 - { - \@@_draw_literal:x - { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ moveto } - } -\cs_new_protected:Npn \@@_draw_lineto:nn #1#2 - { - \@@_draw_literal:x - { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ lineto } - } -\cs_new_protected:Npn \@@_draw_rectangle:nnnn #1#2#3#4 - { - \@@_draw_literal:x - { - \dim_to_decimal_in_bp:n {#4} ~ \dim_to_decimal_in_bp:n {#3} ~ - \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ - moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~clospath - } - } -\cs_new_protected:Npn \@@_draw_curveto:nnnnnn #1#2#3#4#5#6 - { - \@@_draw_literal:x - { - \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ - \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ - \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ - curveto - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_evenodd_rule:, \@@_draw_nonzero_rule:} -% \begin{variable}[aux]{\g_@@_draw_eor_bool} -% The even-odd rule here can be implemented as a simply switch. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_evenodd_rule: - { \bool_gset_true:N \g_@@_draw_eor_bool } -\cs_new_protected:Npn \@@_draw_nonzero_rule: - { \bool_gset_false:N \g_@@_draw_eor_bool } -\bool_new:N \g_@@_draw_eor_bool -% \end{macrocode} -% \end{variable} -% \end{macro} -% -% \begin{macro}[int] -% { -% \@@_draw_closepath: , -% \@@_draw_stroke: , -% \@@_draw_closestroke: , -% \@@_draw_fill: , -% \@@_draw_fillstroke: , -% \@@_draw_clip: , -% \@@_draw_discardpath: -% } -% \begin{variable}[aux]{\g_@@_draw_clip_bool} -% Unlike PDF, PostScript doesn't track separate colors for strokes and other -% elements. It is also desirable to have the |clip| keyword after a stroke or -% fill. To achieve those outcomes, there is some work to do. For color, if a -% stroke or fill color is defined it is used for the relevant operation, with -% a graphic scope inserted as required. That does mean that once such a color -% is set all further uses inside the same scope have to use scoping: see also -% the color set up functions. For clipping, the required ordering is achieved -% using a \TeX{} switch. All of the operations end with a new path instruction -% as they do not terminate (again in contrast to PDF). -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_closepath: - { \@@_draw_literal:n { closepath } } -\cs_new_protected:Npn \@@_draw_stroke: - { - \@@_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if } - \@@_draw_literal:n { stroke } - \@@_draw_literal:n { currentdict~/l3sc~known~{grestore}~if } - \bool_if:NT \g_@@_draw_clip_bool - { - \@@_draw_literal:x - { - \bool_if:NT \g_@@_draw_eor_bool { eo } - clip - } - } - \@@_draw_literal:n { newpath } - \bool_gset_false:N \g_@@_draw_clip_bool - } -\cs_new_protected:Npn \@@_draw_closestroke: - { - \@@_draw_closepath: - \@@_draw_stroke: - } -\cs_new_protected:Npn \@@_draw_fill: - { - \@@_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if } - \@@_draw_literal:x - { - \bool_if:NT \g_@@_draw_eor_bool { eo } - fill - } - \@@_draw_literal:n { currentdict~/l3fc~known~{grestore}~if } - \bool_if:NT \g_@@_draw_clip_bool - { - \@@_draw_literal:x - { - \bool_if:NT \g_@@_draw_eor_bool { eo } - clip - } - } - \@@_draw_literal:n { newpath } - \bool_gset_false:N \g_@@_draw_clip_bool - } -\cs_new_protected:Npn \@@_draw_fillstroke: - { - \@@_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if } - \@@_draw_literal:x - { - \bool_if:NT \g_@@_draw_eor_bool { eo } - fill - } - \@@_draw_literal:n { currentdict~/l3fc~known~{grestore}~if } - \@@_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if } - \@@_draw_literal:n { stroke } - \@@_draw_literal:n { currentdict~/l3sc~known~{grestore}~if } - \bool_if:NT \g_@@_draw_clip_bool - { - \@@_draw_literal:x - { - \bool_if:NT \g_@@_draw_eor_bool { eo } - clip - } - } - \@@_draw_literal:n { newpath } - \bool_gset_false:N \g_@@_draw_clip_bool - } -\cs_new_protected:Npn \@@_draw_clip: - { \bool_gset_true:N \g_@@_draw_clip_bool } -\bool_new:N \g_@@_draw_clip_bool -\cs_new_protected:Npn \@@_draw_discardpath: - { - \bool_if:NT \g_@@_draw_clip_bool - { - \@@_draw_literal:x - { - \bool_if:NT \g_@@_draw_eor_bool { eo } - clip - } - } - \@@_draw_literal:n { newpath } - \bool_gset_false:N \g_@@_draw_clip_bool - } -% \end{macrocode} -% \end{variable} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_dash:nn} -% \begin{macro}[aux]{\@@_draw_dash:n} -% \begin{macro}[int]{\@@_draw_linewidth:n} -% \begin{macro}[int]{\@@_draw_miterlimit:n} -% \begin{macro}[int] -% { -% \@@_draw_cap_butt:, \@@_draw_cap_round:, \@@_draw_cap_rectangle:, -% \@@_draw_join_miter:, \@@_draw_join_round:, \@@_draw_join_bevel: -% } -% Converting paths to output is again a case of mapping directly to -% PostScript operations. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_dash:nn #1#2 - { - \@@_draw_literal:x - { - [ ~ - \clist_map_function:nN {#1} \@@_draw_dash:n - ] ~ - \dim_to_decimal_in_bp:n {#2} ~ setdash - } - } -\cs_new:Npn \@@_draw_dash:n #1 - { \dim_to_decimal_in_bp:n {#1} ~ } -\cs_new_protected:Npn \@@_draw_linewidth:n #1 - { - \@@_draw_literal:x - { \dim_to_decimal_in_bp:n {#1} ~ setlinewidth } - } -\cs_new_protected:Npn \@@_draw_miterlimit:n #1 - { \@@_draw_literal:x { \fp_eval:n {#1} ~ setmiterlimit } } -\cs_new_protected:Npn \@@_draw_cap_butt: - { \@@_draw_literal:n { 0 ~ setlinecap } } -\cs_new_protected:Npn \@@_draw_cap_round: - { \@@_draw_literal:n { 1 ~ setlinecap } } -\cs_new_protected:Npn \@@_draw_cap_rectangle: - { \@@_draw_literal:n { 2 ~ setlinecap } } -\cs_new_protected:Npn \@@_draw_join_miter: - { \@@_draw_literal:n { 0 ~ setlinejoin } } -\cs_new_protected:Npn \@@_draw_join_round: - { \@@_draw_literal:n { 1 ~ setlinejoin } } -\cs_new_protected:Npn \@@_draw_join_bevel: - { \@@_draw_literal:n { 2 ~ setlinejoin } } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[aux]{\_@@_draw_color_reset:} -% \begin{macro}[int] -% { -% \@@_draw_color_cmyk:nnnn , -% \@@_draw_color_cmyk_fill:nnnn , -% \@@_draw_color_cmyk_stroke:nnnn -% } -% \begin{macro}[int] -% { -% \@@_draw_color_gray:n , -% \@@_draw_color_gray_fill:n , -% \@@_draw_color_gray_stroke:n -% } -% \begin{macro}[int] -% { -% \@@_draw_color_rgb:nnn , -% \@@_draw_color_rgb_fill:nnn , -% \@@_draw_color_rgb_stroke:nnn -% } -% To allow color to be defined for strokes and fills separately and to -% respect scoping, the data needs to be stored at the PostScript level. -% We cannot undefine (local) fill/stroke colors once set up but we can -% set them blank to improve performance slightly. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_color_reset: - { - \@@_draw_literal:n { currentdic~/l3fc~known~{ /l3fc~ { } ~def }~if } - \@@_draw_literal:n { currentdic~/l3sc~known~{ /l3sc~ { } ~def }~if } - } -\cs_new_protected:Npn \@@_draw_color_cmyk:nnnn #1#2#3#4 - { - \@@_draw_literal:x - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ - setcmykcolor ~ - } - \@@_draw_color_reset: - } -\cs_new_protected:Npn \@@_draw_color_cmyk_fill:nnnn #1#2#3#4 - { - \@@_draw_literal:x - { - /l3fc ~ - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ - setcmykcolor - } ~ - def - } - } -\cs_new_protected:Npn \@@_draw_color_cmyk_stroke:nnnn #1#2#3#4 - { - \__driver_draw_literal:x - { - /l3sc ~ - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ - setcmykcolor - } ~ - def - } - } -\cs_new_protected:Npn \@@_draw_color_gray:n #1 - { - \@@_draw_literal:x { fp_eval:n {#1} ~ setgray } - \@@_draw_color_reset: - } -\cs_new_protected:Npn \@@_draw_color_gray_fill:n #1 - { \@@_draw_literal:x { /l3fc ~ { \fp_eval:n {#1} ~ setgray } ~ def } } -\cs_new_protected:Npn \@@_draw_color_gray_stroke:n #1 - { \@@_draw_literal:x { /l3sc ~ { \fp_eval:n {#1} ~ setgray } ~ def } } -\cs_new_protected:Npn \@@_draw_color_rgb:nnn #1#2#3 - { - \@@_draw_literal:x - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ - setrgbcolor - } - \@@_draw_color_reset: - } -\cs_new_protected:Npn \@@_draw_color_rgb_fill:nnn #1#2#3 - { - \@@_draw_literal:x - { - /l3fc ~ - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ - setrgbcolor - } ~ - def - } - } -\cs_new_protected:Npn \@@_draw_color_rgb_stroke:nnn #1#2#3 - { - \@@_draw_literal:x - { - /l3sc ~ - { - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~ - setrgbcolor - } ~ - def - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_transformcm:nnnnnn} -% The first four arguments here are floats (the affine matrix), the last -% two are a displacement vector. Once again, force evaluation to allow for -% caching. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_transformcm:nnnnnn #1#2#3#4#5#6 - { - \@@_draw_literal:x - { - [ - \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ - \fp_eval:n {#3} ~ \fp_eval:n {#4} ~ - \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ - ] ~ - concat - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_draw_hbox:Nnnnnnn} -% Inside a picture |@beginspecial|/|@endspecial| are active, which is -% normally a good thing but means that the position and scaling will be off -% if the box is inserted directly. Instead, we need to reverse the effect of -% the (normally desirable) shift/scaling within the box. That requires -% knowing where the reference point for the drawing is: saved as |l3x|/|l3y| -% at the start of the picture. Transformation here is relative to the -% drawing origin so has to be done purely in driver code not using \TeX{} -% offsets. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7 - { - \@@_scope_begin: - \tex_special:D { ps::[end] } - \@@_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7} - \tex_special:D { ps::~72~Resolution~div~72~VResolution~div~neg~scale } - \tex_special:D { ps::~magscale~{1~DVImag~div~dup~scale}~if } - \tex_special:D { ps::~l3x~neg~l3y~neg~translate } - \group_begin: - \box_set_wd:Nn #1 { 0pt } - \box_set_ht:Nn #1 { 0pt } - \box_set_dp:Nn #1 { 0pt } - \box_use:N #1 - \group_end: - \tex_special:D { ps::[begin] } - \@@_scope_end: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -%</dvips> -% \end{macrocode} -% % \subsection{\texttt{dvisvgm} driver} % % \begin{macrocode} @@ -2253,36 +2373,37 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{Color} +% \subsection{Images} % -% \begin{variable}{\l_@@_color_current_tl} -% The current color in driver-dependent format: the same as for -% \texttt{dvips}. +% \begin{macro}[int]{\@@_image_getbb_png:n, \@@_image_getbb_jpg:n} +% These can be included by extracting the bounding box data. % \begin{macrocode} -\tl_new:N \l_@@_color_current_tl -\tl_set:Nn \l_@@_color_current_tl { gray~0 } -%<*package> -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_color_current_tl { \current@color } } - { } - } -%</package> +\cs_new_eq:NN \@@_image_getbb_png:n \__image_extract_bb:n +\cs_new_eq:NN \@@_image_getbb_jpg:n \__image_extract_bb:n % \end{macrocode} -% \end{variable} +% \end{macro} % -% \begin{macro}[int]{\@@_color_ensure_current:} -% \begin{macro}[aux]{\@@_color_reset:} -% Directly set the color: same as \texttt{dvips}. +% \begin{macro}[int]{\@@_image_include_png:n, \@@_image_include_jpg:n} +% \begin{macro}[aux]{\@@_image_include_bitmap_quote:w} +% The driver here has built-in support for basic image inclusion (see +% \texttt{dvisvgm.def} for a more complex approach, needed if clipping, +% \emph{etc.}, is covered at the image driver level). The only issue is +% that |#1| must be quote-corrected. The \texttt{dvisvgm:img} operation +% quotes the file name, but if it is already quoted (contains spaces) +% then we have an issue: we simply strip off any quotes as a result. % \begin{macrocode} -\cs_new_protected:Npn \@@_color_ensure_current: +\cs_new_protected:Npn \@@_image_include_png:n #1 { - \tex_special:D { color~push~\l_@@_color_current_tl } - \group_insert_after:N \@@_color_reset: + \tex_special:D + { + dvisvgm:img~ + \dim_to_decimal:n { \l__image_ury_dim } ~ + \dim_to_decimal:n { \l__image_ury_dim } ~ + \@@_image_include_bitmap_quote:w #1 " " \q_stop + } } -\cs_new_protected:Npn \@@_color_reset: - { \tex_special:D { color~pop } } +\cs_new_eq:NN \@@_image_include_jpg:n \@@_image_include_png:n +\cs_new:Npn \@@_image_include_bitmap_quote:w #1 " #2 " #3 \q_stop { #1#2 } % \end{macrocode} % \end{macro} % \end{macro} @@ -2361,7 +2482,7 @@ % Once again, some work is needed to get path constructs correct. Rather % then write the values as they are given, the entire path needs to be % collected up before being output in one go. For that we use a dedicated -% storage routine, which will add spaces as required. Since paths should +% storage routine, which adds spaces as required. Since paths should % be fully expanded there is no need to worry about the internal % \texttt{x}-type expansion. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index ae03bfb7cb8..c5c7a073aaa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -68,7 +68,7 @@ % |\exp_| module. They all look alike, an example would be % \cs{exp_args:NNo}. This function has three arguments, the first and the % second are a single tokens, while the third argument should be given -% in braces. Applying \cs{exp_args:NNo} will expand the content of third +% in braces. Applying \cs{exp_args:NNo} expands the content of third % argument once before any expansion of the first and second arguments. % If \cs{seq_gpush:No} was not defined it could be coded in the following way: % \begin{verbatim} @@ -118,24 +118,24 @@ % then used to define variants of the % \meta{original argument specifier} where these are not already % defined. For each \meta{variant} given, a function is created -% which will expand its arguments as detailed and pass them +% which expands its arguments as detailed and passes them % to the \meta{parent control sequence}. So for example % \begin{verbatim} % \cs_set:Npn \foo:Nn #1#2 { code here } % \cs_generate_variant:Nn \foo:Nn { c } % \end{verbatim} -% will create a new function |\foo:cn| which will expand its first -% argument into a control sequence name and pass the result to +% creates a new function |\foo:cn| which expands its first +% argument into a control sequence name and passes the result to % |\foo:Nn|. Similarly % \begin{verbatim} % \cs_generate_variant:Nn \foo:Nn { NV , cV } % \end{verbatim} -% would generate the functions |\foo:NV| and |\foo:cV| in the same +% generates the functions |\foo:NV| and |\foo:cV| in the same % way. The \cs{cs_generate_variant:Nn} function can only be applied if % the \meta{parent control sequence} is already defined. Only |n|~and % |N| arguments can be changed to other types. If the \meta{parent % control sequence} is protected or if the \meta{variant} involves -% |x|~arguments, then the \meta{variant control sequence} will also be +% |x|~arguments, then the \meta{variant control sequence} is also % protected. The \meta{variant} is created globally, as is any % \cs[no-index]{exp_args:N\meta{variant}} function needed to carry out the % expansion. @@ -157,12 +157,12 @@ % \item % Arguments that need full expansion (\emph{i.e.}, are denoted % with |x|) should be avoided if possible as they can not be -% processed expandably, \emph{i.e.}, functions of this type will -% not work correctly in arguments that are themselves subject to |x| +% processed expandably, \emph{i.e.}, functions of this type +% cannot work correctly in arguments that are themselves subject to |x| % expansion. % \item % In general, unless in the last position, multi-token arguments -% |n|, |f|, and |o| will need special processing when more than +% |n|, |f|, and |o| need special processing when more than % one argument is being expanded. This special processing is not fast. % Therefore it is best to use the optimized functions, namely % those that contain only |N|, |c|, |V|, and |v|, and, in the last @@ -206,7 +206,7 @@ % \begin{quote} % |\example:f { \int_eval:n { 1 + 2 } , \int_eval:n { 3 + 4 } }| % \end{quote} -% will result in the call |\example:n { 3 , \int_eval:n { 3 + 4 } }| +% results in the call |\example:n { 3 , \int_eval:n { 3 + 4 } }| % while using |\example:x| instead results in |\example:n { 3 , 7 }| % at the cost of being protected. % If you use this type of expansion in conditional processing then @@ -246,7 +246,7 @@ % the \meta{tokens}). The \meta{tokens} are expanded once, and the result % is inserted in braces into the input stream \emph{after} reinsertion % of the \meta{function}. Thus the \meta{function} may take more than -% one argument: all others will be left unchanged. +% one argument: all others are left unchanged. % \end{function} % % \begin{function}[EXP]{\exp_args:Nc, \exp_args:cc} @@ -256,10 +256,10 @@ % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}). The \meta{tokens} are expanded until only characters % remain, and are then turned into a control sequence. (An internal error -% will occur if such a conversion is not possible). The result +% occurs if such a conversion is not possible). The result % is inserted into the input stream \emph{after} reinsertion % of the \meta{function}. Thus the \meta{function} may take more than -% one argument: all others will be left unchanged. +% one argument: all others are left unchanged. % % The |:cc| variant constructs the \meta{function} name in the same % manner as described for the \meta{tokens}. @@ -273,7 +273,7 @@ % the \meta{variable}). The content of the \meta{variable} are recovered % and placed inside braces into the input stream \emph{after} reinsertion % of the \meta{function}. Thus the \meta{function} may take more than -% one argument: all others will be left unchanged. +% one argument: all others are left unchanged. % \end{function} % % \begin{function}[EXP]{\exp_args:Nv} @@ -283,12 +283,12 @@ % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}). The \meta{tokens} are expanded until only characters % remain, and are then turned into a control sequence. (An internal error -% will occur if such a conversion is not possible). This control sequence +% occurs if such a conversion is not possible). This control sequence % should % be the name of a \meta{variable}. The content of the \meta{variable} are % recovered and placed inside braces into the input stream \emph{after} % reinsertion of the \meta{function}. Thus the \meta{function} may take more -% than one argument: all others will be left unchanged. +% than one argument: all others are left unchanged. % \end{function} % % \begin{function}[EXP]{\exp_args:Nf} @@ -300,7 +300,7 @@ % first non-expandable token or space is found, and the result % is inserted in braces into the input stream \emph{after} reinsertion % of the \meta{function}. Thus the \meta{function} may take more than -% one argument: all others will be left unchanged. +% one argument: all others are left unchanged. % \end{function} % % \begin{function}{\exp_args:Nx} @@ -312,7 +312,7 @@ % second. The result is inserted in braces into the input stream % \emph{after} reinsertion of the \meta{function}. % Thus the \meta{function} may take more -% than one argument: all others will be left unchanged. +% than one argument: all others are left unchanged. % \end{function} % % \section{Manipulating two arguments} @@ -499,10 +499,8 @@ % \cs{exp_after:wN} \meta{token_1} \meta{token_2} % \end{syntax} % Carries out a single expansion of \meta{token_2} (which may consume -% arguments) prior to the expansion -% of \meta{token_1}. If \meta{token_2} is a \TeX{} primitive, it will -% be executed rather than expanded, while if \meta{token_2} has not -% expansion (for example, if it is a character) then it will be left +% arguments) prior to the expansion of \meta{token_1}. If \meta{token_2} has +% no expansion (for example, if it is a character) then it is left % unchanged. It is important to notice that \meta{token_1} may be % \emph{any} single token, including group-opening and -closing % tokens (|{| or |}| assuming normal \TeX{} category codes). Unless @@ -519,7 +517,7 @@ % % Despite the fact that the following functions are all about preventing % expansion, they're designed to be used in an expandable context and hence -% are all marked as being `expandable' since they themselves will not appear +% are all marked as being `expandable' since they themselves disappear % after the expansion has completed. % % \begin{function}[EXP]{\exp_not:N} @@ -599,10 +597,10 @@ % \end{syntax} % This function terminates an \texttt{f}-type expansion. Thus if % a function |\foo_bar:f| starts an \texttt{f}-type expansion -% and all of \meta{tokens} are expandable \cs{exp_stop_f:} will -% terminate the expansion of tokens even if \meta{more tokens} +% and all of \meta{tokens} are expandable \cs{exp_stop_f:} +% terminates the expansion of tokens even if \meta{more tokens} % are also expandable. The function itself is an implicit space -% token. Inside an \texttt{x}-type expansion, it will retain its +% token. Inside an \texttt{x}-type expansion, it retains its % form, but when typeset it produces the underlying space (\verb*| |). % \end{function} % @@ -619,8 +617,8 @@ % Of course, deep down \TeX{} is using expansion as always and there % are cases where a programmer needs to control that expansion % directly; typical situations are basic data manipulation tools. This -% section documents the functions for that level. You will find these -% commands used throughout the kernel code, but we hope that outside +% section documents the functions for that level. These +% commands are used throughout the kernel code, but we hope that outside % the kernel there will be little need to resort to them. Instead the % argument manipulation methods document above should usually be sufficient. % @@ -649,7 +647,7 @@ % prematurely and as a result \cs{exp_end:} will be misinterpreted % later on.\footnotemark % -% In typical use cases the \cs{exp_end:} will be hidden somewhere +% In typical use cases the \cs{exp_end:} is hidden somewhere % in the replacement text of \meta{expandable-tokens} rather than % being on the same expansion level than \cs{exp:w}, e.g., you may % see code such as @@ -672,11 +670,11 @@ % \cs{exp:w} \meta{expandable-tokens} \cs{exp_end_continue_f:w} \meta{further-tokens} % \end{syntax} % Expands \meta{expandable-tokens} until reaching \cs{exp_end_continue_f:w} at -% which point expansion continues as an f-type expansion expanding +% which point expansion continues as an \texttt{f}-type expansion expanding % \meta{further-tokens} until an unexpandable token is encountered (or -% the f-type expansion is explicitly terminated by -% \cs{exp_stop_f:}). As with all f-type expansions a space ending -% the expansion will get removed. +% the \texttt{f}-type expansion is explicitly terminated by +% \cs{exp_stop_f:}). As with all \texttt{f}-type expansions a space ending +% the expansion gets removed. % % The full expansion of \meta{expandable-tokens} has to be empty. % If any token in \meta{expandable-tokens} or any token generated by @@ -701,7 +699,7 @@ % \begin{quote} % \cs{exp:w} \meta{expandable-tokens} \cs{exp_end:} % \end{quote} -% can be alternatively achieved through an f-type expansion by using +% can be alternatively achieved through an \texttt{f}-type expansion by using % \cs{exp_stop_f:}, i.e. % \begin{quote} % \cs{exp:w} \cs{exp_end_continue_f:w} \meta{expandable-tokens} \cs{exp_stop_f:} @@ -728,7 +726,7 @@ % \meta{further-tokens} starts with a brace group then the braces % are removed. If on the other hand it starts with space tokens then % these space tokens are removed while searching for the -% argument. Thus such space tokens will not terminate the f-type expansion. +% argument. Thus such space tokens will not terminate the \texttt{f}-type expansion. % \end{function} % % \section{Internal functions and variables} @@ -808,7 +806,7 @@ % argument manipulations and |#3| is the current result of the % expansion chain. This auxiliary function moves |#1| back after % |#3| in the input stream and checks if any expansion is left to -% be done by calling |#2|. In by far the most cases we will require +% be done by calling |#2|. In by far the most cases we need % to add a set of braces to the result of an argument manipulation % so it is more effective to do it directly here. Actually, so far % only the |c| of the final argument manipulation variants does not @@ -916,7 +914,7 @@ % expects a single token whereas |v| like |c| creates a csname from % its argument given in braces and then evaluates it as if it was a % |V|. The \cs{exp:w} sets off an expansion -% similar to an |f| type expansion, which we will terminate using +% similar to an |f|-type expansion, which we terminate using % \cs{exp_end:}. The argument is returned in braces. % \begin{macrocode} \cs_new:Npn \::V #1 \::: #2#3 @@ -942,12 +940,12 @@ % register such as |\count|. For the \TeX{} registers we have to % utilize a \tn{the} whereas for the macros we merely have to % expand them once. The trick is to find out when to use -% \tn{the} and when not to. What we do here is try to find out -% whether the token will expand to something else when hit with +% \tn{the} and when not to. What we want here is to find out +% whether the token expands to something else when hit with % \cs{exp_after:wN}. The technique is to compare the meaning of the -% register in question when it has been prefixed with \cs{exp_not:N} -% and the register itself. If it is a macro, the prefixed -% \cs{exp_not:N} will temporarily turn it into the primitive +% token in question when it has been prefixed with \cs{exp_not:N} +% and the token itself. If it is a macro, the prefixed +% \cs{exp_not:N} temporarily turns it into the primitive % \cs{scan_stop:}. % \begin{macrocode} \cs_new:Npn \@@_eval_register:N #1 @@ -1419,7 +1417,7 @@ % \end{macrocode} % So to stop the expansion sequence in a controlled way all we need % to provide is a constant integer zero as part of expanded tokens. As this is -% an integer constant it will immediately stop +% an integer constant it immediately stops % \cs{tex_romannumerl:D}'s search for a number. % \begin{macrocode} %\int_const:Nn \exp_end: { 0 } @@ -1431,10 +1429,10 @@ % generated. Or if we do then the programmer made a mistake.) % % If on the other hand we want to stop the initial expansion -% sequence but continue with an f-type expansion we provide the +% sequence but continue with an \texttt{f}-type expansion we provide the % alphabetic constant |`^^@| that also represents |0| but this time -% \TeX's syntax for a \meta{number} will continue searching for an -% optional space (and it will continue expansion doing that) --- +% \TeX's syntax for a \meta{number} continues searching for an +% optional space (and it continues expansion doing that) --- % see \TeX{}book page~269 for details. % \begin{macrocode} \tex_catcode:D `\^^@=13 @@ -1612,7 +1610,7 @@ % signature} \cs{q_mark} \meta{errors} \cs{q_stop} \meta{base % function} \meta{new function}. If all went well, \meta{errors} % is empty; otherwise, it is a kernel error message, followed by -% some clean-up code (\cs{use_none:nnnn}). +% some clean-up code (\cs{use_none:nnn}). % % Note the space after |#3| and after the following brace group. % Those are ignored by \TeX{} when fetching the last argument for @@ -1737,7 +1735,7 @@ \q_mark \__msg_kernel_error:nnxx { kernel } { variant-too-long } {#5} { \token_to_str:N #3 } - \use_none:nnnn + \use_none:nnn \q_stop #3 #3 @@ -1752,7 +1750,7 @@ \q_mark \__msg_kernel_error:nnxxxx { kernel } { invalid-variant } {#7} { \token_to_str:N #5 } {#1} {#2} - \use_none:nnnn + \use_none:nnn \q_stop #5 #5 @@ -1783,30 +1781,36 @@ % \end{macro} % % \begin{macro}[aux]{\@@_generate_variant:wwNN} -% If the variant form has already been defined, log its existence. +% If the variant form has already been defined, log its existence +% (provided \texttt{log-functions} is active). % Otherwise, make sure that the |\exp_args:N #3| form is defined, and % if it contains |x|, change \cs{@@_tmp:w} locally to % \cs{cs_new_protected:Npx}. Then define the variant by % combining the |\exp_args:N #3| variant and the base function. % \begin{macrocode} +\__debug_patch:nnNw + { + \cs_if_free:NF #4 + { + \__debug_log:x + { + Variant~\token_to_str:N #4~% + already~defined;~ not~ changing~ it~ \msg_line_context: + } + } + } + { } \cs_new_protected:Npn \@@_generate_variant:wwNN #1 \q_mark #2 \q_stop #3#4 { #2 - \cs_if_free:NTF #4 + \cs_if_free:NT #4 { \group_begin: \@@_generate_internal_variant:n {#1} \@@_tmp:w #4 { \exp_not:c { exp_args:N #1 } \exp_not:N #3 } \group_end: } - { - \__chk_log:x - { - Variant~\token_to_str:N #4~% - already~defined;~ not~ changing~ it~ \msg_line_context: - } - } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index a3ceb04d1cf..8f6235bca9c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -23,7 +23,8 @@ %<*driver> \documentclass[full]{l3doc} \begin{document} - \DocInput{\jobname.dtx} +\DocInput{\jobname.dtx} +\PrintIndex \end{document} %</driver> % \fi @@ -41,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -52,28 +53,54 @@ % others are used to work with files on a line by line basis and have prefix % \cs[no-index]{ior_\ldots} (reading) or \cs[no-index]{iow_\ldots} (writing). % -% It is important to remember that when reading external files \TeX{} will -% attempt to locate them both the operating system path and entries in the +% It is important to remember that when reading external files \TeX{} +% attempts to locate them both the operating system path and entries in the % \TeX{} file database (most \TeX{} systems use such a database). Thus the % \enquote{current path} for \TeX{} is somewhat broader than that for other % programs. % % For functions which expect a \meta{file name} argument, this argument % 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. File names will be quoted +% full expansion be the desired file name. Active characters (as +% declared in \cs{l_char_active_seq}) are \emph{not} be expanded, +% allowing the direct use of these in file names. File names are quoted % using |"| tokens if they contain spaces: as a result, |"| tokens are % \emph{not} permitted in file names. % % \section{File operation functions} % -% \begin{variable}{\g_file_current_name_tl} -% Contains the name of the current \LaTeX{} file. This variable -% should not be modified: it is intended for information only. It -% will be equal to \cs{c_sys_jobname_str} at the start of a \LaTeX{} -% run and will be modified each time a file is read using -% \cs{file_input:n}. +% \begin{variable}[added = 2017-06-21] +% { +% \g_file_curr_dir_str, +% \g_file_curr_name_str, +% \g_file_curr_ext_str +% } +% Contain the directory, name and extension of the current file. The +% directory is empty if the file was loaded without an explicit +% path (\emph{i.e.}~if it is in the \TeX{} search path), and does +% \emph{not} end in |/| other than the case that it is exactly equal +% to the root directory. The \meta{name} and \meta{ext} parts together +% make up the file name, thus the \meta{name} part may be thought of +% as the \enquote{job name} for the current file. Note that \TeX{} does +% not provide information on the \meta{ext} part for the main (top +% level) file and that this file always has an empty \meta{dir} component. +% Also, the \meta{name} here will be equal to \cs{c_sys_jobname_str}, +% which may be different from the real file name (if set using +% |--jobname|, for example). +% \end{variable} +% +% \begin{variable}[added = 2017-06-18]{\l_file_search_path_seq} +% Each entry is the path to a directory which should be searched when +% seeking a file. Each path can be relative or absolute, and should +% not include the trailing slash. The entries are not expanded when +% used so may contain active characters but should not feature any +% variable content. Spaces need not be quoted. +% +% \begin{texnote} +% When working as a package in \LaTeXe{}, \pkg{expl3} will +% automatically append the current \tn{input@path} to the +% set of values from \cs{l_file_search_path_seq}. +% \end{texnote} % \end{variable} % % \begin{function}[TF, updated = 2012-02-10]{\file_if_exist:n} @@ -82,21 +109,48 @@ % \end{syntax} % Searches for \meta{file name} using the current \TeX{} search % path and the additional paths controlled by -% \cs{file_path_include:n}). +% \cs{l_file_search_path_seq}. % \end{function} % -% \begin{function}[updated = 2012-02-10]{\file_add_path:nN} +% \begin{function}[updated = 2017-06-26] +% {\file_get_full_name:nN, \file_get_full_name:VN} % \begin{syntax} -% \cs{file_add_path:nN} \Arg{file name} \meta{tl var} +% \cs{file_get_full_name:nN} \Arg{file name} \meta{str var} % \end{syntax} % Searches for \meta{file name} in the path as detailed for -% \cs{file_if_exist:nTF}, and if found sets the \meta{tl var} the +% \cs{file_if_exist:nTF}, and if found sets the \meta{str var} the % fully-qualified name of the file, \emph{i.e.}~the path and file name. -% If the file is not found then the \meta{tl var} will contain the -% marker \cs{q_no_value}. +% This includes an extension |.tex| when the given \meta{file name} +% has no extension but the file found has that extension. +% If the file is not found then the \meta{str var} is empty. % \end{function} % -% \begin{function}[updated = 2012-02-17]{\file_input:n} +% \begin{function}[added = 2017-06-23, updated = 2017-06-26] +% {\file_parse_full_name:nNNN} +% \begin{syntax} +% \cs{file_parse_full_name:nNNN} \Arg{full name} \meta{dir} \meta{name} \meta{ext} +% \end{syntax} +% Parses the \meta{full name} and splits it into three parts, each of +% which is returned by setting the appropriate local string variable: +% \begin{itemize} +% \item The \meta{dir}: everything up to the last |/| (path separator) +% in the \meta{file path}. As with system \texttt{PATH} variables +% and related functions, the \meta{dir} does \emph{not} include the +% trailing |/| unless it points to the root directory. If there is no path (only +% a file name), \meta{dir} is empty. +% \item The \meta{name}: everything after the last |/| up to the last |.|, +% where both of those characters are optional. The \meta{name} may +% contain multiple |.| characters. It is empty if \meta{full name} +% consists only of a directory name. +% \item The \meta{ext}: everything after the last |.| (including the dot). +% The \meta{ext} is empty if there is no |.| after the last |/|. +% \end{itemize} +% This function does not expand the \meta{full name} before turning it +% to a string. It assume that the \meta{full name} either contains no +% quote (|"|) characters or is surrounded by a pair of quotes. +% \end{function} +% +% \begin{function}[updated = 2017-06-26]{\file_input:n} % \begin{syntax} % \cs{file_input:n} \Arg{file name} % \end{syntax} @@ -104,42 +158,23 @@ % \cs{file_if_exist:nTF}, and if found reads in the file as % additional \LaTeX{} source. All files read are recorded % for information and the file name stack is updated by this -% function. An error will be raised if the file is not found. +% function. An error is raised if the file is not found. % \end{function} % -% \begin{function}[updated = 2012-07-04]{\file_path_include:n} +% \begin{function}{\file_show_list:, \file_log_list:} % \begin{syntax} -% \cs{file_path_include:n} \Arg{path} +% \cs{file_show_list:} +% \cs{file_log_list:} % \end{syntax} -% Adds \meta{path} to the list of those used to search when reading -% files. The assignment is local. -% The \meta{path} is processed in the same way as a \meta{file name}, -% \emph{i.e.}, with \texttt{x}-type expansion except active -% characters. -% \end{function} -% -% \begin{function}[updated = 2012-07-04]{\file_path_remove:n} -% \begin{syntax} -% \cs{file_path_remove:n} \Arg{path} -% \end{syntax} -% Removes \meta{path} from the list of those used to search when reading -% files. The assignment is local. -% The \meta{path} is processed in the same way as a \meta{file name}, -% \emph{i.e.}, with \texttt{x}-type expansion except active -% characters. -% \end{function} -% -% \begin{function}{\file_list:} -% \begin{syntax} -% \cs{file_list:} -% \end{syntax} -% This function will list all files loaded using \cs{file_input:n} -% in the log file. +% These functions list all files loaded by \LaTeXe{} commands that +% populate \tn{@filelist} or by \cs{file_input:n}. While +% \cs{file_show_list:} displays the list in the terminal, +% \cs{file_log_list:} outputs it to the log file only. % \end{function} % % \subsection{Input--output stream management} % -% As \TeX{} is limited to $16$ input streams and $16$ output streams, direct +% As \TeX{} engines have a limited number of input and output streams, direct % use of the streams by the programmer is not supported in \LaTeX3. Instead, an % internal pool of streams is maintained, and these are allocated and % deallocated as needed by other modules. As a result, the programmer should @@ -172,6 +207,7 @@ % \meta{stream} is available for access immediately and will remain % allocated to \meta{file name} until a \cs{ior_close:N} instruction % is given or the \TeX{} run ends. +% If the file is not found, an error is raised. % \end{function} % % \begin{function}[added = 2013-01-12, TF]{\ior_open:Nn, \ior_open:cn} @@ -197,7 +233,7 @@ % open it is closed before the new operation begins. The % \meta{stream} is available for access immediately and will remain % allocated to \meta{file name} until a \cs{iow_close:N} instruction -% is given or the \TeX{} run ends. Opening a file for writing will clear +% is given or the \TeX{} run ends. Opening a file for writing clears % any existing content in the file (\emph{i.e.}~writing is \emph{not} % additive). % \end{function} @@ -213,13 +249,20 @@ % to other programmers. % \end{function} % -% \begin{function}[updated = 2015-08-01]{\ior_list_streams:, \iow_list_streams:} +% \begin{function}[added = 2017-06-27] +% { +% \ior_show_list:, \ior_log_list:, +% \iow_show_list:, \iow_log_list: +% } % \begin{syntax} -% \cs{ior_list_streams:} -% \cs{iow_list_streams:} +% \cs{ior_show_list:} +% \cs{ior_log_list:} +% \cs{iow_show_list:} +% \cs{iow_log_list:} % \end{syntax} -% Displays a list of the file names associated with each open -% stream: intended for tracking down problems. +% Display (to the terminal or log file) a list of the file names +% associated with each open (read or write) stream. This is intended +% for tracking down problems. % \end{function} % % \subsection{Reading from files} @@ -232,15 +275,15 @@ % and right braces are found) from the input \meta{stream} and stores % the result locally in the \meta{token list} variable. If the % \meta{stream} is not open, input is requested from the terminal. -% The material read from the \meta{stream} will be tokenized by \TeX{} +% The material read from the \meta{stream} is tokenized by \TeX{} % according to the category codes and \tn{endlinechar} in force when % the function is used. Assuming normal settings, any lines which do -% not end in a comment character~|%| will have the line ending +% not end in a comment character~|%| have the line ending % converted to a space, so for example input % \begin{verbatim} % a b c % \end{verbatim} -% will result in a token list \verb*|a b c |. Any blank line is +% results in a token list \verb*|a b c |. Any blank line is % converted to the token \cs{par}. Therefore, blank lines can be % skipped by using a test such as % \begin{verbatim} @@ -273,15 +316,15 @@ % The material is read from the \meta{stream} as a series of tokens with % category code $12$ (other), with the exception of space % characters which are given category code $10$ (space). -% Multiple whitespace characters are retained by this process. It will -% always only read one line and any blank lines in the input -% will result in the \meta{token list variable} being empty. Unlike +% Multiple whitespace characters are retained by this process. It +% always only reads one line and any blank lines in the input +% result in the \meta{token list variable} being empty. Unlike % \cs{ior_get:NN}, line ends do not receive any special treatment. Thus % input % \begin{verbatim} % a b c % \end{verbatim} -% will result in a token list |a b c| with the letters |a|, |b|, and |c| +% results in a token list |a b c| with the letters |a|, |b|, and |c| % having category code~12. % \begin{texnote} % This protected macro is a wrapper around the \eTeX{} primitive @@ -299,8 +342,8 @@ % Applies the \meta{inline function} to each set of \meta{lines} % obtained by calling \cs{ior_get:NN} until reaching the end of the % file. \TeX{} ignores any trailing new-line marker from the file it -% reads. The \meta{inline function} should consist of code which will -% receive the \meta{line} as |#1|. +% reads. The \meta{inline function} should consist of code which +% receives the \meta{line} as |#1|. % \end{function} % % \begin{function}[added = 2012-02-11]{\ior_str_map_inline:Nn} @@ -312,7 +355,7 @@ % as a series of tokens with category code $12$ (other), with the % exception of space characters which are given category code $10$ % (space). The \meta{inline function} should consist of code which -% will receive the \meta{line} as |#1|. +% receives the \meta{line} as |#1|. % Note that \TeX{} removes trailing space and tab characters % (character codes 32 and 9) from every line upon input. \TeX{} also % ignores any trailing new-line marker from the file it reads. @@ -323,8 +366,8 @@ % \cs{ior_map_break:} % \end{syntax} % Used to terminate a \cs[no-index]{ior_map_\ldots} function before all -% lines from the \meta{stream} have been processed. This will -% normally take place within a conditional statement, for example +% lines from the \meta{stream} have been processed. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \ior_map_inline:Nn \l_my_ior % { @@ -335,12 +378,12 @@ % } % } % \end{verbatim} -% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{ior_map_\ldots} scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before further items are taken -% from the input stream. This will depend on the design of the mapping +% from the input stream. This depends on the design of the mapping % function. % \end{texnote} % \end{function} @@ -351,8 +394,8 @@ % \end{syntax} % Used to terminate a \cs[no-index]{ior_map_\ldots} function before all % lines in the \meta{stream} have been processed, inserting -% the \meta{tokens} after the mapping has ended. This will -% normally take place within a conditional statement, for example +% the \meta{tokens} after the mapping has ended. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \ior_map_inline:Nn \l_my_ior % { @@ -363,13 +406,13 @@ % } % } % \end{verbatim} -% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{ior_map_\ldots} scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are % inserted into the input stream. -% This will depend on the design of the mapping function. +% This depends on the design of the mapping function. % \end{texnote} % \end{function} % @@ -379,7 +422,7 @@ % \cs{ior_if_eof:NTF} \meta{stream} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the end of a \meta{stream} has been reached during a reading -% operation. The test will also return a \texttt{true} value if +% operation. The test also returns a \texttt{true} value if % the \meta{stream} is not open. %\end{function} % @@ -410,7 +453,11 @@ % file immediately: it is a dedicated version of \cs{iow_now:Nn}. % \end{function} % -% \begin{function}{\iow_shipout:Nn, \iow_shipout:Nx, \iow_shipout:cn, \iow_shipout:cx} +% \begin{function} +% { +% \iow_shipout:Nn, \iow_shipout:Nx, +% \iow_shipout:cn, \iow_shipout:cx +% } % \begin{syntax} % \cs{iow_shipout:Nn} \meta{stream} \Arg{tokens} % \end{syntax} @@ -423,13 +470,17 @@ % \begin{texnote} % When using \pkg{expl3} with a format other than \LaTeX{}, new line % characters inserted using \cs{iow_newline:} or using the -% line-wrapping code \cs{iow_wrap:nnnN} will not be recognized in +% line-wrapping code \cs{iow_wrap:nnnN} are not recognized in % the argument of \cs{iow_shipout:Nn}. This may lead to the -% insertion of additionnal unwanted line-breaks. +% insertion of additional unwanted line-breaks. % \end{texnote} % \end{function} % -% \begin{function}[updated = 2012-09-08]{\iow_shipout_x:Nn, \iow_shipout_x:Nx, \iow_shipout_x:cn, \iow_shipout_x:cx} +% \begin{function}[updated = 2012-09-08] +% { +% \iow_shipout_x:Nn, \iow_shipout_x:Nx, +% \iow_shipout_x:cn, \iow_shipout_x:cx +% } % \begin{syntax} % \cs{iow_shipout_x:Nn} \meta{stream} \Arg{tokens} % \end{syntax} @@ -443,9 +494,9 @@ % This is a wrapper around the \TeX{} primitive \tn{write}. % When using \pkg{expl3} with a format other than \LaTeX{}, new line % characters inserted using \cs{iow_newline:} or using the -% line-wrapping code \cs{iow_wrap:nnnN} will not be recognized in +% line-wrapping code \cs{iow_wrap:nnnN} are not recognized in % the argument of \cs{iow_shipout:Nn}. This may lead to the -% insertion of additionnal unwanted line-breaks. +% insertion of additional unwanted line-breaks. % \end{texnote} % \end{function} % @@ -472,8 +523,8 @@ % expansion (\emph{e.g.}~in the second argument of \cs{iow_now:Nn}). % \begin{texnote} % When using \pkg{expl3} with a format other than \LaTeX{}, the -% character inserted by \cs{iow_newline:} will not be recognized by -% \TeX{}, which may lead to the insertion of additionnal unwanted +% character inserted by \cs{iow_newline:} is not recognized by +% \TeX{}, which may lead to the insertion of additional unwanted % line-breaks. This issue only affects \cs{iow_shipout:Nn}, % \cs{iow_shipout_x:Nn} and direct uses of primitive operations. % \end{texnote} @@ -485,10 +536,10 @@ % \begin{syntax} % \cs{iow_wrap:nnnN} \Arg{text} \Arg{run-on text} \Arg{set up} \meta{function} % \end{syntax} -% This function will wrap the \meta{text} to a fixed number of +% This function wraps the \meta{text} to a fixed number of % characters per line. At the start of each line which is wrapped, -% the \meta{run-on text} will be inserted. The line character count -% targeted will be the value of \cs{l_iow_line_count_int} minus the +% the \meta{run-on text} is inserted. The line character count +% targeted is the value of \cs{l_iow_line_count_int} minus the % number of characters in the \meta{run-on text} for all lines except % the first, for which the target number of characters is simply % \cs{l_iow_line_count_int} since there is no run-on text. The @@ -512,12 +563,12 @@ % \cs{tl_to_str:n}, \cs{tl_to_str:N}, \emph{etc.} % % The result of the wrapping operation is passed as a braced argument to the -% \meta{function}, which will typically be a wrapper around a write +% \meta{function}, which is typically a wrapper around a write % operation. The output of \cs{iow_wrap:nnnN} (\emph{i.e.}~the argument -% passed to the \meta{function}) will consist of characters of category +% passed to the \meta{function}) consists of characters of category % \enquote{other} (category code~12), with the exception of spaces which -% will have category \enquote{space} (category code~10). This means that the -% output will \emph{not} expand further when written to a file. +% have category \enquote{space} (category code~10). This means that the +% output does \emph{not} expand further when written to a file. % % \begin{texnote} % Internally, \cs{iow_wrap:nnnN} carries out an \texttt{x}-type expansion @@ -534,7 +585,7 @@ % \cs{iow_indent:n} \Arg{text} % \end{syntax} % In the first argument of \cs{iow_wrap:nnnN} (for instance in messages), -% indents \meta{text} by four spaces. This function will not cause +% indents \meta{text} by four spaces. This function does not cause % a line break, and only affects lines which start within the scope % of the \meta{text}. In case the indented \meta{text} should appear % on separate lines from the surrounding text, use |\\| to force @@ -558,7 +609,7 @@ % % \begin{variable}{\c_term_ior} % Constant input stream for reading from the terminal. Reading from this -% stream using \cs{ior_get:NN} or similar will result in a prompt from +% stream using \cs{ior_get:NN} or similar results in a prompt from % \TeX{} of the form % \begin{verbatim} % <tl>= @@ -593,23 +644,39 @@ % Used to test for the existence of files when opening. % \end{variable} % -% \begin{variable}{\l__file_internal_name_tl} -% Used to return the full name of a file for internal use. This is -% set by \cs{file_if_exist:nTF} and \cs{__file_if_exist:nT}, and -% the value may then be used to load a file directly provided no -% further operations intervene. +% \begin{variable}{\l__file_base_name_str, \l__file_full_name_str} +% Used to store and transfer the file name (including extension) +% and (partial) file path whilst reading files. (The file base is the +% base name plus any preceding directory name.) % \end{variable} % -% \begin{function}[added = 2012-02-09]{\__file_name_sanitize:nn} +% \begin{function}[added = 2017-06-25]{\__file_missing:n} % \begin{syntax} -% \cs{__file_name_sanitize:nn} \Arg{name} \Arg{tokens} +% \cs{__file_missing:n} \Arg{name} +% \end{syntax} +% Expands the \meta{name} as per \cs{__file_name_sanitize:nN} then +% produces an error message indicating that that file was not found. +% \end{function} +% +% \begin{function}[added = 2017-06-19]{\__file_name_sanitize:nN} +% \begin{syntax} +% \cs{__file_name_sanitize:nN} \Arg{name} \meta{str var} % \end{syntax} % Exhaustively-expands the \meta{name} with the exception of any % category \meta{active} (catcode~$13$) tokens, which are not expanded. % The list of \meta{active} tokens is taken from \cs{l_char_active_seq}. -% The \meta{sanitized name} is then inserted (in braces) after the -% \meta{tokens}, which should further process the file name. If any -% spaces are found in the name after expansion, an error is raised. +% The \meta{str var} is then set to the \meta{sanitized name}. +% \end{function} +% +% \begin{function}[added = 2017-06-19, updated = 2017-06-25] +% {\__file_name_quote:nN} +% \begin{syntax} +% \cs{__file_name_quote:nN} \Arg{name} \meta{str var} +% \end{syntax} +% Expands the \meta{name} (without special-casing active tokens), then +% sets the \meta{str var} to the \meta{name} quoted using |"| at each +% end if required by the presence of spaces in the \meta{name}. Any existing +% |"| tokens is removed and if their number is odd an error is raised. % \end{function} % % \subsection{Internal input--output functions} @@ -625,7 +692,7 @@ % higher-level % functions which have already fully expanded the \meta{file name} and which % need to perform multiple open or close operations. See for example the -% implementation of \cs{file_add_path:nN}, +% implementation of \cs{file_get_full_name:nN}, % \end{function} % % \begin{function}[added = 2014-08-23]{\__iow_with:Nnn} @@ -659,31 +726,64 @@ % % \subsection{File operations} % -% \begin{variable}{\g_file_current_name_tl} +% \begin{variable} +% { +% \g_file_curr_dir_str , +% \g_file_curr_ext_str , +% \g_file_curr_name_str +% } % The name of the current file should be available at all times. % For the format the file name needs to be picked up at the start of the -% file. In \LaTeXe{} package mode the current file name is collected from +% run. In \LaTeXe{} package mode the current file name is collected from % \tn{@currname}. % \begin{macrocode} -\tl_new:N \g_file_current_name_tl +\str_new:N \g_file_curr_dir_str +\str_new:N \g_file_curr_ext_str +\str_new:N \g_file_curr_name_str %<*initex> \tex_everyjob:D \exp_after:wN { \tex_the:D \tex_everyjob:D - \tl_gset:Nx \g_file_current_name_tl { \tex_jobname:D } + \str_gset:Nx \g_file_curr_name_str { \tex_jobname:D } } %</initex> %<*package> \cs_if_exist:NT \@currname - { \tl_gset_eq:NN \g_file_current_name_tl \@currname } + { \str_gset_eq:NN \g_file_curr_name_str \@currname } %</package> % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_stack_seq} -% The input list of files is stored as a sequence stack. +% The input list of files is stored as a sequence stack. In package +% mode we can recover the information from the details held by +% \LaTeXe{} (we must be in the preamble and loaded using \tn{usepackage} +% or \tn{RequirePackage}). As \LaTeXe{} doesn't store directory and +% name separately, we stick to the same convention here. % \begin{macrocode} \seq_new:N \g_@@_stack_seq +%<*package> +\group_begin: + \cs_set_protected:Npn \@@_tmp:w #1#2#3 + { + \tl_if_blank:nTF {#1} + { + \cs_set:Npn \@@_tmp:w ##1 " ##2 " ##3 \q_stop { { } {##2} { } } + \seq_gput_right:Nx \g_@@_stack_seq + { + \exp_after:wN \@@_tmp:w \tex_jobname:D + " \tex_jobname:D " \q_stop + } + } + { + \seq_gput_right:Nn \g_@@_stack_seq { { } {#1} {#2} } + \@@_tmp:w + } + } + \cs_if_exist:NT \@currnamestack + { \exp_after:wN \@@_tmp:w \@currnamestack } +\group_end: +%</package> % \end{macrocode} % \end{variable} % @@ -699,53 +799,55 @@ \tex_everyjob:D \exp_after:wN { \tex_the:D \tex_everyjob:D - \seq_gput_right:NV \g_@@_record_seq \g_file_current_name_tl + \seq_gput_right:NV \g_@@_record_seq \g_file_curr_name_str } %</initex> % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_internal_tl} -% Used as a short-term scratch variable. It may be possible to reuse -% \cs{l_@@_internal_name_tl} there. +% \begin{variable}{\l_@@_tmp_tl} +% Used as a short-term scratch variable. % \begin{macrocode} -\tl_new:N \l_@@_internal_tl +\tl_new:N \l_@@_tmp_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_internal_name_tl} -% Used to return the fully-qualified name of a file. +% \begin{variable}{\l__file_base_name_str, \l__file_full_name_str} +% For storing the basename and full path whilst passing data internally. % \begin{macrocode} -\tl_new:N \l_@@_internal_name_tl +\str_new:N \l__file_base_name_str +\str_new:N \l__file_full_name_str % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_search_path_seq} -% The current search path. +% \begin{variable}{\l_@@_dir_str, \l_@@_ext_str, \l_@@_name_str} +% Used in parsing a path into parts: in contrast to the above, these are +% never used outside of the current module. % \begin{macrocode} -\seq_new:N \l_@@_search_path_seq +\str_new:N \l_@@_dir_str +\str_new:N \l_@@_ext_str +\str_new:N \l_@@_name_str % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_saved_search_path_seq} -% The current search path has to be saved for package use. +% \begin{variable}{\l_file_search_path_seq} +% The current search path. % \begin{macrocode} -%<*package> -\seq_new:N \l_@@_saved_search_path_seq -%</package> +\seq_new:N \l_file_search_path_seq % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_internal_seq} +% \begin{variable}{\l_@@_tmp_seq} % Scratch space for comma list conversion in package mode. % \begin{macrocode} %<*package> -\seq_new:N \l_@@_internal_seq +\seq_new:N \l_@@_tmp_seq %</package> % \end{macrocode} % \end{variable} % -% \begin{macro}[int]{\@@_name_sanitize:nn} +% \begin{macro}[int]{\__file_name_sanitize:nN} +% \begin{macro}[int]{\__file_name_quote: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. The logic to the quoting normalisation is the @@ -753,100 +855,90 @@ % 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 +\cs_new_protected:Npn \__file_name_sanitize:nN #1#2 { \group_begin: \seq_map_inline:Nn \l_char_active_seq { - \tl_set:Nx \l_@@_internal_tl { \iow_char:N ##1 } - \char_set_active_eq:NN ##1 \l_@@_internal_tl - } - \tl_set:Nx \l_@@_internal_name_tl {#1} - \tl_set:Nx \l_@@_internal_name_tl - { \tl_to_str:N \l_@@_internal_name_tl } - \int_compare:nNnTF - { - \int_mod:nn - { - 0 \tl_map_function:NN \l_@@_internal_name_tl - \@@_name_sanitize_aux:n - } - { 2 } - } - = 0 - { - \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 } + \tl_set:Nx \l_@@_tmp_tl { \iow_char:N ##1 } + \char_set_active_eq:NN ##1 \l_@@_tmp_tl } + \tl_set:Nx \l_@@_tmp_tl {#1} + \tl_set:Nx \l_@@_tmp_tl + { \tl_to_str:N \l_@@_tmp_tl } + \exp_args:NNNV \group_end: + \str_set:Nn #2 \l_@@_tmp_tl } -\cs_new:Npn \@@_name_sanitize_aux:n #1 +\cs_new_protected:Npn \__file_name_quote:nN #1#2 + { + \str_set:Nx #2 {#1} + \int_if_even:nF + { 0 \tl_map_function:NN #2 \@@_name_quote_aux:n } + { + \__msg_kernel_error:nnx + { kernel } { unbalanced-quote-in-filename } {#2} + } + \tl_remove_all:Nn #2 { " } + \tl_if_in:NnT #2 { ~ } + { \str_set:Nx #2 { " \exp_not:V #2 " } } + } +\cs_new:Npn \@@_name_quote_aux:n #1 { \token_if_eq_charcode:NNT #1 " { + 1 } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % -% \begin{macro}{\file_add_path:nN} -% \begin{macro}[aux]{\@@_add_path:nN, \@@_add_path_search:nN} -% The way to test if a file exists is to try to open it: if it does not -% exist then \TeX{} will report end-of-file. For files which are in the -% current directory, this is straight-forward. For other locations, a -% search has to be made looking at each potential path in turn. The first -% location is of course treated as the correct one. If nothing is found, -% |#2| is returned empty. +% \begin{macro}{\file_get_full_name:nN, \file_get_full_name:VN} +% \begin{macro}[aux]{\@@_get_full_name_search:nN} +% The way to test if a file exists is to try to open it: if it does +% not exist then \TeX{} reports end-of-file. A search is made +% looking at each potential path in turn (starting from the current +% directory). The first location is of course treated as the correct +% one: this is done by jumping to \cs{__prg_break_point:}. If nothing +% is found, |#2| is returned empty. A special case when there is no +% extension is that once the first location is found we test the +% existence of the file with |.tex| extension in that directory, and +% if it exists we include the |.tex| extension in the result. % \begin{macrocode} -\cs_new_protected:Npn \file_add_path:nN #1 - { \@@_name_sanitize:nn {#1} { \@@_add_path:nN } } -\cs_new_protected:Npn \@@_add_path:nN #1#2 +\cs_new_protected:Npn \file_get_full_name:nN #1#2 { - \__ior_open:Nn \g_@@_internal_ior {#1} - \ior_if_eof:NTF \g_@@_internal_ior - { \@@_add_path_search:nN {#1} #2 } - { \tl_set:Nn #2 {#1} } - \ior_close:N \g_@@_internal_ior - } -\cs_new_protected:Npn \@@_add_path_search:nN #1#2 - { - \tl_set:Nn #2 { \q_no_value } + \__file_name_sanitize:nN {#1} \l__file_base_name_str + \@@_get_full_name_search:nN { } \use:n + \seq_map_inline:Nn \l_file_search_path_seq + { \@@_get_full_name_search:nN { ##1 / } \seq_map_break:n } %<*package> \cs_if_exist:NT \input@path { - \seq_set_eq:NN \l_@@_saved_search_path_seq - \l_@@_search_path_seq - \seq_set_split:NnV \l_@@_internal_seq { , } \input@path - \seq_concat:NNN \l_@@_search_path_seq - \l_@@_search_path_seq \l_@@_internal_seq + \tl_map_inline:Nn \input@path + { \@@_get_full_name_search:nN { ##1 } \tl_map_break:n } } %</package> - \seq_map_inline:Nn \l_@@_search_path_seq + \str_clear:N \l__file_full_name_str + \__prg_break_point: + \str_if_empty:NF \l__file_full_name_str { - \__ior_open:Nn \g_@@_internal_ior { ##1 #1 } - \ior_if_eof:NF \g_@@_internal_ior + \exp_args:NV \file_parse_full_name:nNNN \l__file_full_name_str + \l_@@_dir_str \l_@@_name_str \l_@@_ext_str + \str_if_empty:NT \l_@@_ext_str { - \tl_set:Nx #2 { ##1 #1 } - \seq_map_break: + \__ior_open:No \g_@@_internal_ior + { \l__file_full_name_str .tex } + \ior_if_eof:NF \g_@@_internal_ior + { \str_put_right:Nn \l__file_full_name_str { .tex } } } } -%<*package> - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l_@@_search_path_seq - \l_@@_saved_search_path_seq - } -%</package> + \str_set_eq:NN #2 \l__file_full_name_str + \ior_close:N \g_@@_internal_ior + } +\cs_generate_variant:Nn \file_get_full_name:nN { V } +\cs_new_protected:Npn \@@_get_full_name_search:nN #1#2 + { + \__file_name_quote:nN + { \tl_to_str:n {#1} \l__file_base_name_str } + \l__file_full_name_str + \__ior_open:No \g_@@_internal_ior \l__file_full_name_str + \ior_if_eof:NF \g_@@_internal_ior { #2 { \__prg_break: } } } % \end{macrocode} % \end{macro} @@ -854,24 +946,37 @@ % % \begin{macro}[TF]{\file_if_exist:n} % The test for the existence of a file is a wrapper around the function to -% add a path to a file. If the file was found, the path will contain +% add a path to a file. If the file was found, the path contains % something, whereas if the file was not located then the return value -% will be \cs{q_no_value}. +% is empty. % \begin{macrocode} \prg_new_protected_conditional:Npnn \file_if_exist:n #1 { T , F , TF } { - \file_add_path:nN {#1} \l_@@_internal_name_tl - \quark_if_no_value:NTF \l_@@_internal_name_tl + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str { \prg_return_false: } { \prg_return_true: } } % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{\__file_missing:n} +% An error message for a missing file, also used in \cs{ior_open:Nn}. +% \begin{macrocode} +\cs_new_protected:Npn \__file_missing:n #1 + { + \__file_name_sanitize:nN {#1} \l__file_base_name_str + \__msg_kernel_error:nnx { kernel } { file-not-found } + { \l__file_base_name_str } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\file_input:n} -% \begin{macro}[int]{\@@_if_exist:nT} % \begin{macro}[aux]{\@@_input:n, \@@_input:V} -% \begin{macro}[aux]{\@@_input_aux:n, \@@_input_aux:o} +% \begin{macro}[aux]{\@@_input_push:n} +% \begin{macro}[aux]{\@@_input_pop:} +% \begin{macro}[aux]{\@@_input_pop:nnn} % Loading a file is done in a safe way, checking first that the file % exists and loading only if it does. Push the file name on the % \cs{g_@@_stack_seq}, and add it to the file list, either @@ -879,31 +984,13 @@ % \begin{macrocode} \cs_new_protected:Npn \file_input:n #1 { - \@@_if_exist:nT {#1} - { \@@_input:V \l_@@_internal_name_tl } - } -% \end{macrocode} -% This code is spun out as a separate function to encapsulate the -% error message into a easy-to-reuse form. -% \begin{macrocode} -\cs_new_protected:Npn \@@_if_exist:nT #1#2 - { - \file_if_exist:nTF {#1} - {#2} - { - \@@_name_sanitize:nn {#1} - { \__msg_kernel_error:nnx { kernel } { file-not-found } } - } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#1} } + { \@@_input:V \l__file_full_name_str } } \cs_new_protected:Npn \@@_input:n #1 { - \tl_if_in:nnTF {#1} { . } - { \@@_input_aux:n {#1} } - { \@@_input_aux:o { \tl_to_str:n { #1 . tex } } } - } -\cs_generate_variant:Nn \@@_input:n { V } -\cs_new_protected:Npn \@@_input_aux:n #1 - { %<*initex> \seq_gput_right:Nn \g_@@_record_seq {#1} %</initex> @@ -912,68 +999,140 @@ { \@addtofilelist {#1} } { \seq_gput_right:Nn \g_@@_record_seq {#1} } %</package> - \seq_gpush:No \g_@@_stack_seq \g_file_current_name_tl - \tl_gset:Nn \g_file_current_name_tl {#1} + \@@_input_push:n {#1} \tex_input:D #1 \c_space_tl - \seq_gpop:NN \g_@@_stack_seq \l_@@_internal_tl - \tl_gset_eq:NN \g_file_current_name_tl \l_@@_internal_tl + \@@_input_pop: + } +\cs_generate_variant:Nn \@@_input:n { V } +% \end{macrocode} +% Keeping a track of the file data is easy enough: we store the separated +% parts so we do not need to parse them twice. +% \begin{macrocode} +\cs_new_protected:Npn \@@_input_push:n #1 + { + \seq_gpush:Nx \g_@@_stack_seq + { + { \g_file_curr_dir_str } + { \g_file_curr_name_str } + { \g_file_curr_ext_str } + } + \file_parse_full_name:nNNN {#1} + \l_@@_dir_str \l_@@_name_str \l_@@_ext_str + \str_gset_eq:NN \g_file_curr_dir_str \l_@@_dir_str + \str_gset_eq:NN \g_file_curr_name_str \l_@@_name_str + \str_gset_eq:NN \g_file_curr_ext_str \l_@@_ext_str + } +\cs_new_protected:Npn \@@_input_pop: + { + \seq_gpop:NN \g_@@_stack_seq \l_@@_tmp_tl + \exp_after:wN \@@_input_pop:nnn \l_@@_tmp_tl + } +\cs_new_protected:Npn \@@_input_pop:nnn #1#2#3 + { + \str_gset:Nn \g_file_curr_dir_str {#1} + \str_gset:Nn \g_file_curr_name_str {#2} + \str_gset:Nn \g_file_curr_ext_str {#3} } -\cs_generate_variant:Nn \@@_input_aux:n { o } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % -% \begin{macro}{\file_path_include:n} -% \begin{macro}{\file_path_remove:n} -% \begin{macro}[aux]{\@@_path_include:n} -% Wrapper functions to manage the search path. +% \begin{macro}{\file_parse_full_name:nNNN} +% \begin{macro}[aux] +% {\@@_parse_full_name_auxi:w, \@@_parse_full_name_split:nNNNTF} +% Parsing starts by stripping off any surrounding quotes. Then find +% the directory |#4| by splitting at the last~|/|. (The auxiliary +% returns \texttt{true}/\texttt{false} depending on whether it found +% the delimiter.) We correct for the case of a file in the root |/|, +% as in that case we wish to keep the trailing (and only) slash. Then +% split the base name |#5| at the last dot. If there was indeed a +% dot, |#5| contains the name and |#6| the extension without the dot, +% which we add back for convenience. In the special case of no +% extension given, the auxiliary stored the name into |#6|, we just +% have to move it to |#5|. % \begin{macrocode} -\cs_new_protected:Npn \file_path_include:n #1 - { \@@_name_sanitize:nn {#1} { \@@_path_include:n } } -\cs_new_protected:Npn \@@_path_include:n #1 +\cs_new_protected:Npn \file_parse_full_name:nNNN #1#2#3#4 { - \seq_if_in:NnF \l_@@_search_path_seq {#1} - { \seq_put_right:Nn \l_@@_search_path_seq {#1} } + \exp_after:wN \@@_parse_full_name_auxi:w + \tl_to_str:n { #1 " #1 " } \q_stop #2#3#4 } -\cs_new_protected:Npn \file_path_remove:n #1 +\cs_new_protected:Npn \@@_parse_full_name_auxi:w #1 " #2 " #3 \q_stop #4#5#6 { - \@@_name_sanitize:nn {#1} - { \seq_remove_all:Nn \l_@@_search_path_seq } + \@@_parse_full_name_split:nNNNTF {#2} / #4 #5 + { \str_if_empty:NT #4 { \str_set:Nn #4 { / } } } + { } + \exp_args:No \@@_parse_full_name_split:nNNNTF {#5} . #5 #6 + { \str_put_left:Nn #6 { . } } + { + \str_set_eq:NN #5 #6 + \str_clear:N #6 + } + } +\cs_new_protected:Npn \@@_parse_full_name_split:nNNNTF #1#2#3#4 + { + \cs_set_protected:Npn \@@_tmp:w ##1 ##2 #2 ##3 \q_stop + { + \tl_if_empty:nTF {##3} + { + \str_set:Nn #4 {##2} + \tl_if_empty:nTF {##1} + { + \str_clear:N #3 + \use_ii:nn + } + { + \str_set:Nx #3 { \str_tail:n {##1} } + \use_i:nn + } + } + { \@@_tmp:w { ##1 #2 ##2 } ##3 \q_stop } + } + \@@_tmp:w { } #1 #2 \q_stop } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{macro}{\file_list:} +% \begin{macro}{\file_show_list:, \file_log_list:} +% \begin{macro}[aux, EXP]{\@@_list_aux:n} % A function to list all files used to the log, without duplicates. % In package mode, if \cs{@filelist} is still defined, we need to take -% this list of file names into account -% (we capture it \cs{AtBeginDocument} into -% \cs{g_@@_record_seq}), turning each file name into a string. +% this list of file names into account (we capture it +% \cs{AtBeginDocument} into \cs{g_@@_record_seq}), turning it to a +% string (this does not affect the commas of this comma list). The +% message system is a bit finnicky (it can only display results that +% start with |>~| and end with a dot) so that constrains the possible +% markup. The advantage is that we get terminal and log outputs for +% free. % \begin{macrocode} -\cs_new_protected:Npn \file_list: +\cs_new_protected:Npn \file_show_list: { - \seq_set_eq:NN \l_@@_internal_seq \g_@@_record_seq + \seq_clear:N \l_@@_tmp_seq %<*package> \clist_if_exist:NT \@filelist { - \clist_map_inline:Nn \@filelist - { - \seq_put_right:No \l_@@_internal_seq - { \tl_to_str:n {##1} } - } + \exp_args:NNx \seq_set_from_clist:Nn \l_@@_tmp_seq + { \tl_to_str:N \@filelist } } %</package> - \seq_remove_duplicates:N \l_@@_internal_seq - \iow_log:n { *~File~List~* } - \seq_map_inline:Nn \l_@@_internal_seq { \iow_log:n {##1} } - \iow_log:n { ************* } + \seq_concat:NNN \l_@@_tmp_seq \l_@@_tmp_seq \g_@@_record_seq + \seq_remove_duplicates:N \l_@@_tmp_seq + \__msg_show_wrap:n + { + >~File~List~< \\ + \seq_map_function:NN \l_@@_tmp_seq \@@_list_aux:n + ............ + } } +\cs_new:Npn \@@_list_aux:n #1 { #1 \\ } +\cs_new_protected:Npn \file_log_list: + { \__msg_log_next: \file_show_list: } % \end{macrocode} % \end{macro} +% \end{macro} % % When used as a package, there is a need to hold onto the standard file % list as well as the new one here. File names recorded in @@ -983,8 +1142,9 @@ %<*package> \AtBeginDocument { - \clist_map_inline:Nn \@filelist - { \seq_gput_right:No \g_@@_record_seq { \tl_to_str:n {#1} } } + \exp_args:NNx \seq_set_from_clist:Nn \l_@@_tmp_seq + { \tl_to_str:N \@filelist } + \seq_gconcat:NNN \g_@@_record_seq \g_@@_record_seq \l_@@_tmp_seq } %</package> % \end{macrocode} @@ -1070,50 +1230,35 @@ % \end{macro} % % \begin{macro}{\ior_open:Nn, \ior_open:cn} -% \begin{macro}[aux]{\@@_open_aux:Nn} -% Opening an input stream requires a bit of pre-processing. The file name -% is sanitized to deal with active characters, before an auxiliary adds a -% path and checks that the file really exists. If those two tests pass, then -% pass the information on to the lower-level function which deals with -% streams. +% Use the conditional version, with an error if the file is not found. % \begin{macrocode} \cs_new_protected:Npn \ior_open:Nn #1#2 - { \__file_name_sanitize:nn {#2} { \@@_open_aux:Nn #1 } } + { \ior_open:NnF #1 {#2} { \__file_missing:n {#2} } } \cs_generate_variant:Nn \ior_open:Nn { c } -\cs_new_protected:Npn \@@_open_aux:Nn #1#2 - { - \file_add_path:nN {#2} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl - { \__msg_kernel_error:nnx { kernel } { file-not-found } {#2} } - { \@@_open:No #1 \l__file_internal_name_tl } - } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}[TF]{\ior_open:Nn, \ior_open:cn} -% \begin{macro}[aux]{\@@_open_aux:NnTF} -% Much the same idea for opening a read with a conditional, except the -% auxiliary function does not issue an error if the file is not found. +% An auxiliary searches for the file in the \TeX{}, \LaTeXe{} and +% \LaTeX3 paths. Then pass the file found to the lower-level function +% which deals with streams. The |full_name| is empty when the file is +% not found. % \begin{macrocode} \prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF } - { \__file_name_sanitize:nn {#2} { \@@_open_aux:NnTF #1 } } -\cs_generate_variant:Nn \ior_open:NnT { c } -\cs_generate_variant:Nn \ior_open:NnF { c } -\cs_generate_variant:Nn \ior_open:NnTF { c } -\cs_new_protected:Npn \@@_open_aux:NnTF #1#2 { - \file_add_path:nN {#2} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl + \file_get_full_name:nN {#2} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str { \prg_return_false: } { - \@@_open:No #1 \l__file_internal_name_tl + \@@_open:No #1 \l__file_full_name_str \prg_return_true: } } +\cs_generate_variant:Nn \ior_open:NnT { c } +\cs_generate_variant:Nn \ior_open:NnF { c } +\cs_generate_variant:Nn \ior_open:NnTF { c } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}[int]{\@@_new:N} % In package mode, streams are reserved using \tn{newread} before they @@ -1190,8 +1335,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\ior_list_streams:} -% \begin{macro}[aux]{\@@_list_streams:Nn} +% \begin{macro}{\ior_show_list:, \ior_log_list:} +% \begin{macro}[aux]{\@@_list:Nn} % Show the property lists, but with some \enquote{pretty printing}. % See the \pkg{l3msg} module. The first argument of the message is % |ior| (as opposed to |iow|) and the second is empty if no read @@ -1200,9 +1345,11 @@ % translating |ior|/|iow| to English. The list of streams is % formatted using \cs{__msg_show_item_unbraced:nn}. % \begin{macrocode} -\cs_new_protected:Npn \ior_list_streams: - { \@@_list_streams:Nn \g_@@_streams_prop { ior } } -\cs_new_protected:Npn \@@_list_streams:Nn #1#2 +\cs_new_protected:Npn \ior_show_list: + { \@@_list:Nn \g_@@_streams_prop { ior } } +\cs_new_protected:Npn \ior_log_list: + { \__msg_log_next: \ior_show_list: } +\cs_new_protected:Npn \@@_list:Nn #1#2 { \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-streams } {#2} { \prop_if_empty:NF #1 { ? } } { } { } @@ -1437,19 +1584,16 @@ % \end{macro} % % \begin{macro}{\iow_open:Nn, \iow_open:cn} -% \begin{macro}[int]{\@@_open:Nn} -% \begin{macro}[aux]{\@@_open_stream:Nn} +% \begin{macro}[aux]{\@@_open_stream:Nn, \@@_open_stream:NV} % The same idea as for reading, but without the path and without the need % to allow for a conditional version. % \begin{macrocode} \cs_new_protected:Npn \iow_open:Nn #1#2 - { \__file_name_sanitize:nn {#2} { \@@_open:Nn #1 } } -\cs_generate_variant:Nn \iow_open:Nn { c } -\cs_new_protected:Npn \@@_open:Nn #1#2 { + \__file_name_sanitize:nN {#2} \l__file_base_name_str \iow_close:N #1 \seq_gpop:NNTF \g_@@_streams_seq \l_@@_stream_tl - { \@@_open_stream:Nn #1 {#2} } + { \@@_open_stream:NV #1 \l__file_base_name_str } %<*initex> { \__msg_kernel_fatal:nn { kernel } { output-streams-exhausted } } %</initex> @@ -1457,21 +1601,21 @@ { \@@_new:N #1 \tl_set:Nx \l_@@_stream_tl { \int_eval:n {#1} } - \@@_open_stream:Nn #1 {#2} + \@@_open_stream:NV #1 \l__file_base_name_str } %</package> } -\cs_generate_variant:Nn \@@_open:Nn { No } +\cs_generate_variant:Nn \iow_open:Nn { c } \cs_new_protected:Npn \@@_open_stream:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \l_@@_stream_tl \scan_stop: \prop_gput:NVn \g_@@_streams_prop #1 {#2} \tex_immediate:D \tex_openout:D #1 #2 \scan_stop: } +\cs_generate_variant:Nn \@@_open_stream:Nn { NV } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}{\iow_close:N, \iow_close:c} % Closing a stream is not quite the reverse of opening one. First, @@ -1494,13 +1638,15 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\iow_list_streams:} -% \begin{macro}{\@@_list_streams:Nn} +% \begin{macro}{\iow_show_list:, \iow_log_list:} +% \begin{macro}{\@@_list:Nn} % Done as for input, but with a copy of the auxiliary so the name is correct. % \begin{macrocode} -\cs_new_protected:Npn \iow_list_streams: - { \@@_list_streams:Nn \g_@@_streams_prop { iow } } -\cs_new_eq:NN \@@_list_streams:Nn \__ior_list_streams:Nn +\cs_new_protected:Npn \iow_show_list: + { \@@_list:Nn \g_@@_streams_prop { iow } } +\cs_new_protected:Npn \iow_log_list: + { \__msg_log_next: \iow_show_list: } +\cs_new_eq:NN \@@_list:Nn \__ior_list:Nn % \end{macrocode} % \end{macro} % \end{macro} @@ -1745,7 +1891,7 @@ % valid and otherwise to \cs{@@_indent_error:n}. The first places the % instruction for increasing the indentation before its argument, and % the instruction for unindenting afterwards. The second produces an -% error expandably. Note that there will be no forced line-break, so +% error expandably. Note that there are no forced line-break, so % the indentation only changes when the next line is started. % \begin{macrocode} \cs_new_protected:Npn \iow_indent:n #1 @@ -1800,7 +1946,7 @@ % done, reset \cs{iow_indent:n} to its error definition: it only works % in the first argument of \cs{iow_wrap:nnnN}. % \begin{macrocode} -%<*initex> +%<*initex> \tl_set:Nx \l_@@_wrap_tl {#1} %</initex> %<*package> @@ -1817,7 +1963,7 @@ \int_set:Nn \l_@@_line_target_int { \l_iow_line_count_int - \str_count:N \l_@@_newline_tl + 1 } % \end{macrocode} -% There is then a loop over the input, which will store the wrapped +% There is then a loop over the input, which stores the wrapped % result in \cs{l_@@_wrap_tl}. After the loop, the resulting text is % passed on to the function which has been given as a post-processor. % The \cs{tl_to_str:N} step converts the \enquote{other} spaces back @@ -1829,7 +1975,7 @@ #4 { \tl_to_str:N \l_@@_wrap_tl } } % \end{macrocode} -% As using the generic loader will mean that \cs{protected@edef} is +% As using the generic loader means that \cs{protected@edef} is % not available, it's not placed directly in the wrap function but is set % up as an auxiliary. In the generic loader this can then be redefined. % \begin{macrocode} @@ -1842,9 +1988,9 @@ % % \begin{macro}[aux]{\@@_wrap_do:, \@@_wrap_start:w} % Escape spaces. Set up a few variables, in particular the initial -% value of \cs{l_@@_wrap_tl}: the space will stop the +% value of \cs{l_@@_wrap_tl}: the space stops the % \texttt{f}-expansion of the main wrapping function and -% \cs{use_none:n} will remove a newline marker inserted by later code. +% \cs{use_none:n} removes a newline marker inserted by later code. % The main loop consists of repeatedly calling the \texttt{chunk} % auxiliary to wrap chunks delimited by (newline or indentation) % markers. @@ -2026,7 +2172,7 @@ % \texttt{break_first} auxiliary calls the \texttt{break_none} % auxiliary. In that case, if the current line is empty, the complete % word (including |##4|, characters beyond what we had grabbed) is -% added to the line, making it over-long. Otherwise, the word will be +% added to the line, making it over-long. Otherwise, the word is % used for the following line (and the last space of the line so far % is removed because it was inserted due to the presence of a marker). % \begin{macrocode} @@ -2217,6 +2363,65 @@ % % \subsection{Deprecated functions} % +% \begin{variable}[deprecated = 2018-12-31]{\g_file_current_name_tl} +% For removal after 2018-12-31. +% \begin{macrocode} +\tl_new:N \g_file_current_name_tl +\tl_gset:Nn \g_file_current_name_tl { \g_file_curr_name_str } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[deprecated = 2018-12-31]{\file_path_include:n} +% \begin{macro}[deprecated = 2018-12-31]{\file_path_remove:n} +% \begin{macro}[deprecated = 2018-12-31, aux]{\__file_path_include:n} +% Wrapper functions to manage the search path. +% \begin{macrocode} +\cs_new_protected:Npn \file_path_include:n #1 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_path_include:n } + { + \token_to_str:N \seq_put_right:Nn \c_space_tl + \token_to_str:N \l_file_search_path_seq + } + \__file_name_sanitize:nN {#1} \l__file_full_name_str + \seq_if_in:NVF \l_file_search_path_seq \l__file_full_name_str + { \seq_put_right:NV \l_file_search_path_seq \l__file_full_name_str } + } +\cs_new_protected:Npn \file_path_remove:n #1 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_path_remove:n } + { + \token_to_str:N \seq_remove_all:Nn \c_space_tl + \token_to_str:N \l_file_search_path_seq + } + \__file_name_sanitize:nN {#1} \l__file_full_name_str + \seq_remove_all:NV \l_file_search_path_seq \l__file_full_name_str + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[deprecated = 2018-12-31]{\file_add_path:nN} +% For removal after 2018-12-31. +% \begin{macrocode} +\cs_new_protected:Npn \file_add_path:nN #1#2 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_add_path:nN } + { \token_to_str:N \file_get_full_name:nN } + \file_get_full_name:nN {#1} #2 + \str_if_empty:NT #2 + { \tl_set:Nn #2 { \q_no_value } } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[added = 2012-06-24, updated = 2012-07-31, deprecated=2017-12-31]{\ior_get_str:NN} % For removal after 2017-12-31. % \begin{macrocode} @@ -2232,6 +2437,64 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[deprecated = 2018-12-31]{\file_list:} +% Renamed to \cs{file_log_list:}. For removal after 2018-12-31. +% \begin{macrocode} +\cs_new_protected:Npn \file_list: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_list: } + { \token_to_str:N \file_log_list: } + \cs_gset_eq:NN \file_list: \file_log_list: + \file_log_list: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[added = 2014-08-22, updated = 2015-08-01, deprecated = 2018-12-31] +% {\ior_list_streams:, \ior_log_streams:, \iow_list_streams:, \iow_log_streams:} +% These got a more consistent naming. +% \begin{macrocode} +\cs_new_protected:Npn \ior_list_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \ior_list_streams: } + { \token_to_str:N \ior_show_list: } + \cs_gset_eq:NN \ior_list_streams: \ior_show_list: + \ior_show_list: + } +\cs_new_protected:Npn \ior_log_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \ior_log_streams: } + { \token_to_str:N \ior_log_list: } + \cs_gset_eq:NN \ior_log_streams: \ior_log_list: + \ior_log_list: + } +\cs_new_protected:Npn \iow_list_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \iow_list_streams: } + { \token_to_str:N \iow_show_list: } + \cs_gset_eq:NN \iow_list_streams: \iow_show_list: + \iow_show_list: + } +\cs_new_protected:Npn \iow_log_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \iow_log_streams: } + { \token_to_str:N \iow_log_list: } + \cs_gset_eq:NN \iow_log_streams: \iow_log_list: + \iow_log_list: + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index d49b33d33da..1a09fdf2ec4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -63,7 +63,7 @@ % % \subsection{Input encoding} % -% The letters |a|--|z| and |A|--|Z| will be correct directly from Ini\TeX{} +% The letters |a|--|z| and |A|--|Z| have the correct catcode directly from Ini\TeX{} % while for Unicode engines (almost) all characters to be treated as letters % are defined by the automatic data parsing. Thus the changes here are to % deal with the additional cases. @@ -92,7 +92,7 @@ % % For non-Unicode engine we now need to convert from UTF-$8$ to $8$-bit % for pattern reading and document use. The set up here is copied from -% the file |conv-utf8-ec.tex| maintained by \acro{tug} for hyphenation +% the file |conv-utf8-ec.tex| maintained by \textsc{tug} for hyphenation % pattern use. As some of the relevant primitives have been moved and to % allow for self-contained code that is copied here with minor adjustments. % (The primitives have to be available at point of use not just at point of diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index 8c12450f32a..2923b1cbe62 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -84,7 +84,7 @@ % Creates a new flag with a name given by \meta{flag name}, or raises % an error if the name is already taken. The \meta{flag name} may not % contain spaces. The declaration is global, but flags are always -% local variables. The \meta{flag} will initially have zero height. +% local variables. The \meta{flag} initially has zero height. % \end{function} % % \begin{function}{\flag_clear:n} @@ -193,8 +193,12 @@ % Undefine control sequences, starting from the |0| flag, upwards, % until reaching an undefined control sequence. We don't use % \cs{cs_undefine:c} because that would act globally. +% When the option \texttt{check-declarations} is used, check for the +% function defined by \cs{flag_new:n}. % \begin{macrocode} -\cs_new_protected:Npn \flag_clear:n { \@@_clear:wn 0 ; } +\__debug_patch:nnNw + { \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } } { } +\cs_new_protected:Npn \flag_clear:n #1 { \@@_clear:wn 0 ; {#1} } \cs_new_protected:Npn \@@_clear:wn #1 ; #2 { \if_cs_exist:w flag~#2~#1 \cs_end: @@ -235,6 +239,27 @@ % % \subsection{Expandable flag commands} % +% \begin{macro}[EXP,aux]{\@@_chk_exist:n} +% Analogue of \cs{__chk_if_exist_var:N} for flags, and with an +% expandable error. We need to add checks by hand because flags are +% not implemented in terms of other variables. Not all functions need +% to be patched since some are defined in terms of others. +% \begin{macrocode} +%<*package> +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_new:Npn \@@_chk_exist:n #1 + { + \flag_if_exist:nF {#1} + { + \__msg_kernel_expandable_error:nnn + { kernel } { bad-variable } { flag~#1~ } + } + } +\fi: +%</package> +% \end{macrocode} +% \end{macro} +% % \begin{macro}[EXP, pTF]{\flag_if_exist:n} % A flag exist if the corresponding trap \cs[no-index]{flag \meta{flag % name}:n} is defined. @@ -250,6 +275,7 @@ % \begin{macro}[EXP, pTF]{\flag_if_raised:n} % Test if the flag has a non-zero height, by checking the |0| control sequence. % \begin{macrocode} +\__debug_patch:nnNw { \@@_chk_exist:n {#1} } { } \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } { \if_cs_exist:w flag~#1~0 \cs_end: @@ -266,7 +292,8 @@ % Extract the value of the flag by going through all of the % control sequences starting from |0|. % \begin{macrocode} -\cs_new:Npn \flag_height:n { \@@_height_loop:wn 0; } +\__debug_patch:nnNw { \@@_chk_exist:n {#1} } { } +\cs_new:Npn \flag_height:n #1 { \@@_height_loop:wn 0; {#1} } \cs_new:Npn \@@_height_loop:wn #1 ; #2 { \if_cs_exist:w flag~#2~#1 \cs_end: @@ -292,48 +319,6 @@ % \end{macrocode} % \end{macro} % -% \subsection{Option check-declarations} -% -% \begin{macro}[EXP,aux]{\@@_chk_exist:n} -% In package mode, there is an option to check all variables used are -% defined. Since flags are not implemented in terms of other -% variables, we need to add checks by hand. Not all functions need to -% be patched because some are defined in terms of others. -% \begin{macrocode} -%<*package> -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \flag_clear:n #1 - { - \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } - \@@_clear:wn 0 ; {#1} - } - \cs_set:Npn \@@_chk_exist:n #1 - { - \flag_if_exist:nF {#1} - { - \__msg_kernel_expandable_error:nnn - { kernel } { bad-variable } { flag~#1~ } - } - } - \cs_set:Npn \flag_height:n #1 - { - \@@_chk_exist:n {#1} - \@@_height_loop:wn 0; {#1} - } - \prg_set_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } - { - \@@_chk_exist:n {#1} - \if_cs_exist:w flag~#1~0 \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\fi: -%</package> -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index af396801a00..de23e977006 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index 58c67b9cf57..eadf3479acc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -72,8 +72,8 @@ % \end{quote} % Let us explain each piece separately. % -% Internal floating point numbers will be used in expressions, -% and in this context will be subject to \texttt{f}-expansion. They must +% Internal floating point numbers are used in expressions, +% and in this context are subject to \texttt{f}-expansion. They must % leave a recognizable mark after \texttt{f}-expansion, to prevent the % floating point number from being re-parsed. Thus, \cs{s_@@} % is simply another name for \tn{relax}. @@ -483,7 +483,7 @@ % \subsection{Packing digits} % % When a positive integer |#1| is known to be less than $10^8$, the -% following trick will split it into two blocks of $4$ digits, padding +% following trick splits it into two blocks of $4$ digits, padding % with zeros on the left. % \begin{verbatim} % \cs_new:Npn \pack:NNNNNw #1 #2#3#4#5 #6; { {#2#3#4#5} {#6} } @@ -520,14 +520,14 @@ % which triggers the third computation. The third computation's value % is $5\,0000\,0000 + 12345 \times 8899$, which has $9$ digits. Adding % $5\cdot 10^{8}$ to the product allowed us to know how many digits to -% expect as long as the numbers to multiply are not too big; it will -% also work to some extent with negative results. The \texttt{pack} +% expect as long as the numbers to multiply are not too big; it +% also works to some extent with negative results. The \texttt{pack} % function puts the last $4$ of those $9$ digits into a brace group, % moves the semi-colon delimiter, and inserts a |+|, which combines the % carry with the previous computation. The shifts nicely combine into % $5\,0000\,0000 / 10^{4} + 4\,9995\,0000 = 5\,0000\,0000$. As long as % the operands are in some range, the result of this second computation -% will have $9$ digits. The corresponding \texttt{pack} function, +% has $9$ digits. The corresponding \texttt{pack} function, % expanded after the result is computed, braces the last $4$ digits, and % leaves |+| \meta{5 digits} for the initial computation. The % \enquote{leading shift} cancels the combination of the other shifts, @@ -610,7 +610,7 @@ % \end{syntax} % Grabs two sets of $4$ digits and places them before the semi-colon % delimiter. Putting several copies of this function before a -% semicolon will pack more digits since each will take the digits +% semicolon packs more digits since each takes the digits % packed by the others in its first argument. % \begin{macrocode} \cs_new:Npn \@@_pack_twice_four:wNNNNNNNN #1; #2#3#4#5 #6#7#8#9 @@ -624,8 +624,8 @@ % \end{syntax} % Grabs one set of $8$ digits and places them before the semi-colon % delimiter as a single group. Putting several copies of this -% function before a semicolon will pack more digits since each will -% take the digits packed by the others in its first argument. +% function before a semicolon packs more digits since each +% takes the digits packed by the others in its first argument. % \begin{macrocode} \cs_new:Npn \@@_pack_eight:wNNNNNNNN #1; #2#3#4#5 #6#7#8#9 { #1 {#2#3#4#5#6#7#8#9} ; } @@ -851,14 +851,14 @@ % \meta{junk} % \meta{floating point} % \end{syntax} -% In this example, the case $0$ will return the floating point +% In this example, the case $0$ returns the floating point % \meta{fp~var}, expanding once after that floating point. Case $1$ -% will do \meta{some computation} using the \meta{floating point} +% does \meta{some computation} using the \meta{floating point} % (presumably compute the operation requested by the user in that -% non-trivial case). Case $2$ will return the \meta{floating point} +% non-trivial case). Case $2$ returns the \meta{floating point} % without modifying it, removing the \meta{junk} and expanding once -% after. Case $3$ will close the conditional, remove the \meta{junk} -% and the \meta{floating point}, and expand \meta{something} next. In +% after. Case $3$ closes the conditional, removes the \meta{junk} +% and the \meta{floating point}, and expands \meta{something} next. In % other cases, the \enquote{\meta{junk}} is expanded, performing some % other operation on the \meta{floating point}. We provide similar % functions with two trailing \meta{floating points}. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index 8a8e233edc5..ae6a2ad07b0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -614,7 +614,7 @@ % $10$, namely the first digit of $x$ is $1$, and all others vanish % when subtracting $y$. Then the \meta{rounding} |#3| and the % \meta{final sign} |#4| control whether we get $1$ or $0.9999 9999 -% 9999 9999$. In the usual round-to-nearest mode, we will get $1$ +% 9999 9999$. In the usual round-to-nearest mode, we get $1$ % whenever the \meta{rounding} digit is less than or equal to $5$ % (remember that the \meta{rounding} digit is only equal to $5$ if % there was no further non-zero digit). @@ -922,7 +922,7 @@ % \end{macro} % % \begin{macro}[aux, rEXP]{\@@_mul_significand_small_f:NNwwwN} -% In this branch, \meta{digit 1} is zero. Our result will thus be +% In this branch, \meta{digit 1} is zero. Our result is thus % \meta{digits 2--17}, plus some rounding which depends on the digits % $17$, $18$, and whether all subsequent digits are zero or not. % The $8$ digits |1#3| are followed, after expansion of the @@ -1038,7 +1038,7 @@ % + 10^{-16} Q_{D} + \text{rounding}$. Since the $Q_{i}$ are integers, % $B$, $C$, $D$, and~$E$ are all exact multiples of $10^{-16}$, in other % words, computing with $16$ digits after the decimal separator yields -% exact results. The problem will be overflow: in general $B$, $C$, +% exact results. The problem is the risk of overflow: in general $B$, $C$, % $D$, and $E$ may be greater than $1$. % % Unfortunately, things are not as easy as they seem. In particular, we @@ -1143,7 +1143,7 @@ % All of those bounds are less than $2.147\cdot 10^{5}$, and we are thus % within \TeX{}'s bounds in all cases! % -% We will later need to have a bound on the $Q_{i}$. Their definitions +% We later need to have a bound on the $Q_{i}$. Their definitions % imply that $Q_{A} < 10^{9} A/y - 1/2 < 10^{5} A$ and similarly for the % other $Q_{i}$. Thus, all of them are less than $177770$. % @@ -1151,7 +1151,7 @@ % \begin{equation*} % A/Z = \sum_{i=1}^{4} \left(10^{-4i} Q_{i}\right) + 10^{-16} E/Z % \end{equation*} -% exactly. Furthermore, we know that the result will be in $[0.1,10)$, +% exactly. Furthermore, we know that the result is in $[0.1,10)$, % hence will be rounded to a multiple of $10^{-16}$ or of $10^{-15}$, so % we only need to know the integer part of $E/Z$, and a % \enquote{rounding} digit encoding the rest. Equivalently, we need to @@ -1194,7 +1194,7 @@ % Compute $10^{6} + Q_{A}$ (a $7$~digit number thanks to the shift), % unbrace \meta{A_1} and \meta{A_2}, and prepare the % \meta{continuation} arguments for $4$ consecutive calls to -% \cs{@@_div_significand_calc:wwnnnnnnn}. Each of these calls will need +% \cs{@@_div_significand_calc:wwnnnnnnn}. Each of these calls needs % \meta{y} (|#1|), and it turns out that we need post-expansion there, % hence the \cs{__int_value:w}. Here, |#4| is six brace groups, which % give the six first |n|-type arguments of the \texttt{calc} function. @@ -1328,7 +1328,7 @@ % \meta{continuations} \meta{sign} % \end{quote} % Compute $Q_{B}$ by evaluating $\meta{B_1}\meta{B_2}0 / y - 1$. The -% result will be output to the left, in an \cs{__int_eval:w} which we +% result is output to the left, in an \cs{__int_eval:w} which we % start now. Once that is evaluated (and the other $Q_{i}$ also, % since later expansions are triggered by this one), a packing % auxiliary takes care of placing the digits of $Q_{B}$ in an @@ -1353,7 +1353,7 @@ % \Arg{Z_1} \Arg{Z_2} \Arg{Z_3} \Arg{Z_4} \meta{sign} % \end{quote} % We compute $P \simeq 2E/Z$ by rounding $2 E_{1} E_{2}/Z_{1}Z_{2}$. -% Note the first $0$, which multiplies $Q_{D}$ by $10$: we will later +% Note the first $0$, which multiplies $Q_{D}$ by $10$: we later % add (roughly) $5\cdot P$, which amounts to adding $P/2 \simeq E/Z$ % to $Q_{D}$, the appropriate correction from a hypothetical $Q_{E}$. % \begin{macrocode} @@ -1692,7 +1692,7 @@ % < 3.2 \cdot 10^{-8} \,, % \] % and $\sqrt{a} - y = (a - y^2)/(\sqrt{a} + y) \leq 16 \cdot 10^{-8}$. -% Next, \cs{@@_sqrt_auxii_o:NnnnnnnnN} will be called several times to +% Next, \cs{@@_sqrt_auxii_o:NnnnnnnnN} is called several times to % get closer and closer underestimates of~$\sqrt{a}$. By % construction, the underestimates~$y$ are always increasing, $a - y^2 % < 3.2 \cdot 10^{-8}$ for all. Also, $y<1$. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index ae0c958d999..bde140cea7e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -69,7 +69,7 @@ % If |#1| ends with a $0$, the \texttt{loop} auxiliary takes that zero % as an end-delimiter for its first argument, and the second argument % is the same \texttt{loop} auxiliary. Once the last trailing zero is -% reached, the second argument will be the \texttt{dot} auxiliary, +% reached, the second argument is the \texttt{dot} auxiliary, % which removes a trailing dot if any. We then clean-up with the % \texttt{end} auxiliary, keeping only the number. % \begin{macrocode} @@ -355,7 +355,7 @@ % \begin{macro}[aux, EXP]{\@@_to_int_dispatch:w} % To convert to an integer, first round to $0$ places (to the nearest % integer), then express the result as a decimal number: the -% definition of \cs{@@_to_decimal_dispatch:w} is such that there will be no +% definition of \cs{@@_to_decimal_dispatch:w} is such that there are no % trailing dot nor zero. % \begin{macrocode} \cs_new:Npn \@@_to_int_dispatch:w #1; diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 521bdae30e6..b0731d99868 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -82,7 +82,7 @@ % % \emph{The rest of this section is actually not in sync with the code. % Or is the code not in sync with the section? In the current code, -% $c\in [1,10]$ will be such that $0.7\leq ac < 1.4$.} +% $c\in [1,10]$ is such that $0.7\leq ac < 1.4$.} % % We are given a positive normal number, of the form $a\cdot 10^{b}$ % with $a\in[0.1,1)$. To compute its logarithm, we find a small integer @@ -250,7 +250,7 @@ {#1#2#3#4#5} {#6} } % \end{macrocode} -% The Taylor series will be expressed in terms of +% The Taylor series to be used is expressed in terms of % $t = (x-1)/(x+1) = 1 - 2/(x+1)$. We now compute the % quotient with extended precision, reusing some code % from \cs{@@_/_o:ww}. Note that $1+x$ is known exactly. @@ -520,8 +520,7 @@ % % For now, $\ln(x)$ is given as $\cdot 10^0$. Unless both the exponent % is $1$ and $c=1$, we shift to working in units of $\cdot 10^4$, -% since the final result will be at least $\ln(10/7) \simeq -% 0.35$. +% since the final result is at least $\ln(10/7) \simeq 0.35$. % \begin{macrocode} \cs_new:Npn \@@_ln_c:NwNw #1 #2; #3 { @@ -542,7 +541,7 @@ % \Arg{exponent} % \end{quote} % Compute \meta{exponent} times $\ln(10)$. Apart from the cases where -% \meta{exponent} is $0$ or $1$, the result will necessarily be at +% \meta{exponent} is $0$ or $1$, the result is necessarily at % least $\ln(10) \simeq 2.3$ in magnitude. We can thus drop the least % significant $4$ digits. In the case of a very large (positive or % negative) exponent, we can (and we need to) drop $4$ additional @@ -1157,7 +1156,7 @@ % undefined. This is invalid, unless $|a|^b$ turns out to be $+0$ or % \texttt{nan}, in which case we return that as $a^b$. In particular, % since the underflow detection occurs before \cs{@@_pow_neg:www} is -% called, |(-0.1)**(12345.67)| will give $+0$ rather than complaining +% called, |(-0.1)**(12345.67)| gives $+0$ rather than complaining % that the sign is not defined. % \begin{macrocode} \cs_new:Npn \@@_pow_neg:www \s_@@ \@@_chk:w #1#2; #3; #4; diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 286d320973c..1144d72e0ac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -180,8 +180,8 @@ % $10^{-24}$, and leaves \meta{continuation} \Arg{c_1} \ldots{} % \Arg{c_6} |;| in the input stream, where each of the \meta{c_i} are % blocks of $4$~digits, except \meta{c_1}, which is any \TeX{} -% integer. Note that indices for \meta{b} start at~$0$: a second -% operand of |{0001}{0000}{0000}| will leave the first operand +% integer. Note that indices for \meta{b} start at~$0$: for instance +% a second operand of |{0001}{0000}{0000}| leaves the first operand % unchanged (rather than dividing it by $10^{4}$, as % \cs{@@_fixed_mul:wwn} would). % \begin{macrocode} @@ -235,7 +235,7 @@ % The \texttt{ii} auxiliary receives $Q_{i}$, $n$, and $a_{i}$ as % arguments. It adds $Q_{i}$ to a surrounding integer expression, and % starts a new one with the initial value $9999$, which ensures that -% the result of this expression will have $5$ digits. The auxiliary +% the result of this expression has $5$ digits. The auxiliary % also computes $a_{i}-n\cdot Q_{i}$, placing the result in front of % the $4$ digits of $a_{i+1}$. The resulting $a'_{i+1} = 10^{4} % (a_{i} - n \cdot Q_{i}) + a_{i+1}$ serves as the first argument for @@ -450,7 +450,7 @@ % common parts of the three functions. % % For definiteness, consider the task of computing $a\times b + c$. -% We will perform carries in +% We perform carries in % \begin{align*} % a \times b + c = % & (a_{1} \cdot b_{1} + c_{1} c_{2})\cdot 10^{-8} \\ @@ -479,7 +479,7 @@ % first level, calls the \texttt{i} auxiliary with arguments described % later, and adds a trailing ${} + c_{5}c_{6}$ |;| % \Arg{continuation}~|;|. The ${} + c_{5}c_{6}$ piece, which is -% omitted for \cs{@@_fixed_one_minus_mul:wwn}, will be taken in the +% omitted for \cs{@@_fixed_one_minus_mul:wwn}, is taken in the % integer expression for the $10^{-24}$ level. % \begin{macrocode} \cs_new:Npn \@@_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8; @@ -564,7 +564,7 @@ % & b_{1} + a_{4} \cdot b_{2} + a_{3} \cdot b_{3} + a_{2} \cdot b_{4} + a_{1} \\ % & b_{2} + a_{4} \cdot b_{3} + a_{3} \cdot b_{4} + a_{2} . % \end{align*} -% Obviously, those expressions make no mathematical sense: we will +% Obviously, those expressions make no mathematical sense: we % complete them with $a_{5} \cdot {}$ and ${} \cdot b_{5}$, and with % $a_{6} \cdot b_{1} + a_{5} \cdot {}$ and ${} \cdot b_{5} + a_{1} % \cdot b_{6}$, and of course with the trailing ${} + c_{5} c_{6}$. @@ -626,8 +626,7 @@ % {\@@_ep_to_fixed_auxi:www, \@@_ep_to_fixed_auxii:nnnnnnnwn} % Converts an extended-precision number with an exponent at most~$4$ % and a first block less than $10^{8}$ to a fixed point number whose -% first block will have $12$~digits, hopefully starting with many -% zeros. +% first block has $12$~digits, hopefully starting with many zeros. % \begin{macrocode} \cs_new:Npn \@@_ep_to_fixed:wwn #1,#2 { @@ -779,7 +778,7 @@ % $\meta{d_1}\cdots\meta{d_6}$, the condition translates to % $\meta{n_1},\meta{d_1}\in[1000,9999]$. % -% We will first find an integer estimate $a \simeq 10^{8} / \meta{d}$ by +% We first find an integer estimate $a \simeq 10^{8} / \meta{d}$ by % computing % \begin{align*} % \alpha &= \eTeXfrac{10^{9}}{\meta{d_1}+1} \\ @@ -795,7 +794,7 @@ % \meta{d}$, while when $\meta{d_2}=9999$ one gets $a = % 10^{3}\alpha-1250 \simeq 10^{12} / (\meta{d_1} + 1) \simeq 10^{8} / % \meta{d}$. The shift by $1250$ helps to ensure that $a$ is an -% underestimate of the correct value. We will prove that +% underestimate of the correct value. We shall prove that % \[ % 1 - 1.755\cdot 10^{-5} < \frac{\meta{d}a}{10^{8}} < 1 . % \] @@ -812,8 +811,8 @@ % % Let us prove the upper bound first (multiplied by $10^{15}$). Note % that $10^{7} \meta{d} < 10^{3} \meta{d_1} + 10^{-1} (\meta{d_2} + 1)$, -% and that \eTeX{}'s division $\eTeXfrac{\meta{d_2}}{10}$ will at most -% underestimate $10^{-1}(\meta{d_2} + 1)$ by $0.5$, as can be checked +% and that \eTeX{}'s division $\eTeXfrac{\meta{d_2}}{10}$ underestimates +% $10^{-1}(\meta{d_2} + 1)$ by $0.5$ at most, as can be checked % for each possible last digit of \meta{d_2}. Then, % \begin{align} % 10^{7} \meta{d}a @@ -877,7 +876,7 @@ % reached for one of the extreme values $[y/10]=0$ or $[y/10]=100$, and % we easily check the bound for those values. % -% We have proven that the algorithm will give us a precise enough +% We have proven that the algorithm gives us a precise enough % answer. Incidentally, the upper bound that we derived tells us that % $a < 10^{8}/\meta{d} \leq 10^{9}$, hence we can compute $a$ safely as % a \TeX{} integer, and even add $10^{9}$ to it to ease grabbing of all @@ -916,7 +915,7 @@ % } % The \texttt{esti} function evaluates $\alpha=10^{9} / (\meta{d_1} + % 1)$, which is used twice in the expression for $a$, and combines the -% exponents |#1| and~|#4| (with a shift by~$1$ because we will compute +% exponents |#1| and~|#4| (with a shift by~$1$ because we later compute % $\meta{n}/(10\meta{d})$. Then the \texttt{estii} function evaluates % $10^{9} + a$, and puts the exponent~|#2| after the % continuation~|#7|: from there on we can forget exponents and focus @@ -1008,8 +1007,8 @@ % method: essentially $r \mapsto (r + 10^{8} / (x_{1} r)) / 2$, starting % from a guess that optimizes the number of steps before convergence. % In fact, just as there is a slight shift when computing divisions to -% ensure that some inequalities hold, we will replace $10^{8}$ by a -% slightly larger number which will ensure that $r^2 x \geq 10^{4}$. +% ensure that some inequalities hold, we replace $10^{8}$ by a +% slightly larger number which ensures that $r^2 x \geq 10^{4}$. % This also causes $r \in [101, 1003]$. Another correction to the above % is that the input is actually normalized to $[0.1,1)$, and we use % either $10^{8}$ or $10^{9}$ in the Newton method, depending on the diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index ff54b840a59..af6f55373a7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -315,8 +315,7 @@ % \cs{int_step_function:nnnN}. There are two subtleties: we use the % internal parser \cs{@@_parse:n} to avoid converting back and forth % from the internal representation; and (due to rounding) even a -% non-zero step does not guarantee that the loop counter will -% increase. +% non-zero step does not guarantee that the loop counter increases. % \begin{macrocode} \cs_new:Npn \fp_step_function:nnnN #1#2#3 { @@ -425,8 +424,9 @@ % numbers sequentially, keeping track of the largest (smallest) number % found so far. If numbers are equal (for instance~$\pm0$), the first % is kept. We append $-\infty$ ($\infty$), for the case of an empty -% array, currently impossible. Since no number is smaller (larger) -% than that, it will never alter the maximum (minimum). The weird +% array. Since no number is smaller (larger) than that, this +% additional item only affects the maximum (minimum) in the case of +% |max()| and |min()| with no argument. The weird % fp-like trailing marker breaks the loop correctly: see the precise % definition of \cs{@@_minmax_loop:Nww}. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index b0abdd5abac..f83cd642d62 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -78,7 +78,7 @@ % \begin{texnote} % Registers (integers, toks, etc.) are automatically unpacked, % without requiring a function such as \cs{int_use:N}. Invalid -% tokens remaining after \texttt{f}-expansion will lead to +% tokens remaining after \texttt{f}-expansion lead to % unrecoverable low-level \TeX{} errors. % \end{texnote} % \end{macro} @@ -155,7 +155,7 @@ % \cs{int_eval:n} does), and with this approach, expanding the next % unread token forces us to jump with \cs{exp_after:wN} over every value % computed earlier in the expression. With this approach, the run-time -% will grow at least quadratically in the length of the expression, if +% grows at least quadratically in the length of the expression, if % not as its cube (inserting the \cs{exp_after:wN} is tricky and slow). % % A second option is to place those values at the end of the expression. @@ -217,7 +217,7 @@ % to do the calculation, and in the process to expand the following % once. This is also true in our real application: all the functions of % the form \cs[no-index]{@@_\ldots_o:ww} expand what follows once. This comes at the -% cost of leaving tokens in the input stack, and we will need to be +% cost of leaving tokens in the input stack, and we need to be % careful not to waste this memory. All of our discussion above is nice % but simplistic, as operations should not simply be performed in the % order they appear. @@ -232,8 +232,8 @@ % reaching an operator which has lower precedence than the one which % called |\operand:w|. This means that |\operand:w| must know what the % previous binary operator is, or rather, its precedence: we thus rename -% it |\operand:Nw|. Let us describe as an example how the calculation -% |41-2^3*4+5| will be done. Here, we abuse notations: the first +% it |\operand:Nw|. Let us describe as an example how we plan to do +% the calculation |41-2^3*4+5|. Here, we abuse notations: the first % argument of |\operand:Nw| should be an integer constant (\cs{c_@@_prec_plus_int}, % \ldots{}) equal to the precedence of the given operator, % not directly the operator itself. @@ -266,7 +266,7 @@ % \end{itemize} % The procedure above stops short of performing all computations, but % adding a surrounding call to |\operand:Nw| with a very low precedence -% ensures that all computations will be performed before |\operand:Nw| +% ensures that all computations are performed before |\operand:Nw| % is done. Adding a trailing marker with the same very low precedence % prevents the surrounding |\operand:Nw| from going beyond the marker. % @@ -386,7 +386,7 @@ % the \meta{precedence}, continuing the loop. % % We have introduced the most important functions here, and the next few -% paragraphs will describe various subtleties. +% paragraphs we describe various subtleties. % % \subsubsection{Prefix operators, parentheses, and functions} % @@ -530,8 +530,8 @@ % At all steps, we try to accept all category codes: when |#1|~is kept % to be used later, it is almost always converted to category code other % through \cs{token_to_str:N}. More precisely, catcodes $\{3, 6, 7, 8, -% 11, 12\}$ should work without trouble, but $\{1, 2, 4, 10, 13\}$ will -% not work, and of course $\{0, 5, 9\}$ cannot become tokens. +% 11, 12\}$ should work without trouble, but not $\{1, 2, 4, 10, 13\}$, +% and of course $\{0, 5, 9\}$ cannot become tokens. % % Floating point expressions should behave as much as possible like % \eTeX{}-based integer expressions and dimension expressions. In @@ -541,22 +541,22 @@ % restricted expandable functions can then be used in floating point % expressions just as they can be in other kinds of expressions. % Problematically, spaces stop \texttt{f}-expansion: for instance, the -% macro~|\X| below will not be expanded if we simply perform +% macro~|\X| below would not be expanded if we simply performed % \texttt{f}-expansion. % \begin{verbatim} % \DeclareDocumentCommand {\test} {m} { \fp_eval:n {#1} } % \ExplSyntaxOff % \test { 1 + \X } % \end{verbatim} -% Of course, spaces will not appear in a code setting, but may very +% Of course, spaces typically do not appear in a code setting, but may very % easily come in document-level input, from which some expressions may % come. To avoid this problem, at every step, we do essentially what % \cs{use:f} would do: take an argument, put it back in the input % stream, then \texttt{f}-expand it. This is not a complete solution, -% since a macro's expansion could contain leading spaces which will stop +% since a macro's expansion could contain leading spaces which would stop % the \texttt{f}-expansion before further macro calls are performed. % However, in practice it should be enough: in particular, floating -% point numbers will correctly be expanded to the underlying \cs{s_@@} +% point numbers are correctly expanded to the underlying \cs{s_@@} % \ldots{} structure. The \texttt{f}-expansion is performed by % \cs{@@_parse_expand:w}. % @@ -722,7 +722,7 @@ % and |#2|~the first token of the operand. We distinguish four cases: % |#2|~is equal to \cs{scan_stop:} in meaning, |#2|~is a different % control sequence, |#2|~is a digit, and |#2|~is something else (this -% last case will be split further). Despite the earlier +% last case is split further later). Despite the earlier % \texttt{f}-expansion, |#2|~may still be expandable if it was % protected by \cs{exp_not:N}, as may happen with the \LaTeXe{} command % \tn{protect}. Using a well placed \cs{reverse_if:N}, this case is @@ -925,7 +925,7 @@ % % \begin{macro}[aux, EXP]{\@@_parse_one_digit:NN} % A digit marks the beginning of an explicit floating point number. -% Once the number is found, we will catch the case of overflow and +% Once the number is found, we catch the case of overflow and % underflow with \cs{@@_sanitize:wN}, then % \cs{@@_parse_infix_after_operand:NwN} expands \cs{@@_parse_infix:NN} % after the number we find, to wrap the following infix operator as @@ -1069,7 +1069,7 @@ % % \subsubsection{Numbers: trimming leading zeros} % -% Numbers will be parsed as follows: first we trim leading zeros, then +% Numbers are parsed as follows: first we trim leading zeros, then % if the next character is a digit, start reading a significand $\geq 1$ % with the set of functions |\__fp_parse_large|\ldots{}; if it is a % period, the significand is~$<1$; and otherwise it is zero. In the @@ -1150,8 +1150,8 @@ % % \begin{macro}[aux, EXP]{\@@_parse_zero:} % After reading a significand of~$0$, find any exponent, then put a -% sign of~|1| for \cs{@@_sanitize:wN}, which will remove everything -% and leave an exact zero. +% sign of~|1| for \cs{@@_sanitize:wN}, which removes everything +% and leaves an exact zero. % \begin{macrocode} \cs_new:Npn \@@_parse_zero: { @@ -1172,8 +1172,8 @@ % expanding) can only go up to $9$ digits. Hence we grab digits in % two steps of $8$ digits. Since |#1| is a digit, read seven more % digits using \cs{@@_parse_digits_vii:N}. The \texttt{small_leading} -% auxiliary will leave those digits in the \cs{__int_value:w}, and -% grab some more, or stop if there are no more digits. Then the +% auxiliary leaves those digits in the \cs{__int_value:w}, and +% grabs some more, or stops if there are no more digits. Then the % \texttt{pack_leading} auxiliary puts the various parts in the % appropriate order for the processing further up. % \begin{macrocode} @@ -1471,7 +1471,7 @@ % {\@@_parse_small_round:NN, \@@_parse_round_after:wN} % Here, |#1|~is the digit that we are currently rounding (we only care % whether it is even or odd). If |#2|~is not a digit, then fetch an -% exponent and expand to |;|\meta{exponent} only. Otherwise, we will +% exponent and expand to |;|\meta{exponent} only. Otherwise, we % expand to |+0| or |+1|, then |;|\meta{exponent}. To % decide which, call \cs{@@_round_s:NNNw} to know whether to round up, % giving it as arguments a sign~$0$ (all explicit numbers are @@ -1842,7 +1842,7 @@ % \begin{macro}[aux, EXP] % {\@@_parse_prefix_(:Nw, \@@_parse_lparen_after:NwN} % The left parenthesis is treated as a unary prefix operator because -% it appears in exactly the same settings. Commas will be allowed if +% it appears in exactly the same settings. Commas are allowed if % the previous precedence is $16$ (function with multiple arguments). % In this case, find an % operand using the precedence~$1$; otherwise the precedence~$0$. @@ -2028,7 +2028,7 @@ % \begin{macro}[int, EXP]{\@@_parse:n} % \begin{macro}[aux, EXP]{\@@_parse_after:ww} % Start an \cs{exp:w} expansion so that \cs{@@_parse:n} expands -% in two steps. The \cs{@@_parse_operand:Nw} function will perform +% in two steps. The \cs{@@_parse_operand:Nw} function performs % computations until reaching an operation with precedence % \cs{c_@@_prec_end_int} or less, namely, the end of the expression. The % marker \cs{s_@@_mark} indicates that the next token is an already @@ -2654,7 +2654,7 @@ % 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 +% results in a floating point result, which is then correctly 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}. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index ebe0d53cb5c..ec0829787e3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -106,7 +106,7 @@ % setting~$n$ to (any multiple of) $2^{29}$ gives only even values. % Thus it is only safe to call \cs{pdftex_uniformdeviate:D} with % argument $2^{28}$. This integer is also used in the implementation -% of \cs{int_rand:nn}. We will also use variants of this number +% of \cs{int_rand:nn}. We also use variants of this number % rounded down to multiples of $10^4$ and $10^8$. % \begin{macrocode} \cs_new:Npn \@@_rand_uniform: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 8b88920c57e..ccc13714253 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -89,7 +89,15 @@ % \@@_parse_round_deprecation_error:Nw % } % \begin{macro}[aux, deprecated = 2017-12-31]{round+, round0, round-} -% This looks for |+|, |-|, |0| after |round|. That syntax is deprecated. +% This looks for |+|, |-|, |0| after |round|. That syntax was +% deprecated in 2013 but the system to tell users about deprecated +% syntax was not really available then, so we did not have anything +% set up. When \pkg{l3doc} complains, remove the syntax by +% removing everything until the last \cs{fi:} in +% \cs{@@_parse_word_round:N} (and getting rid of the unused +% definitions of \cs{@@_parse_round:Nw} and +% \cs{@@_parse_round_deprecation_error:Nw} here and in +% \pkg{l3deprecation}, perhaps also of the |fp-deprecated| error). % \begin{macrocode} \cs_new:Npn \@@_parse_word_round:N #1#2 { @@ -194,7 +202,7 @@ % correctly. The result depends on the rounding mode. % % It is very important that \meta{final sign} be the final sign of the -% result. Otherwise, the result will be incorrect in the case of +% result. Otherwise, the result would be incorrect in the case of % rounding towards~$-\infty$ or towards~$+\infty$. Also recall that % \meta{final sign} is~$0$ for positive, and~$2$ for negative. % @@ -401,7 +409,7 @@ % The |trunc|, |ceil| and |floor| functions expect one or two % arguments (the second is $0$ by default), and the |round| function % also accepts a third argument (\texttt{nan} by default), which -% will change |#1| from \cs{@@_round_to_nearest:NNN} to one of its +% changes |#1| from \cs{@@_round_to_nearest:NNN} to one of its % analogues. % \begin{macrocode} \cs_new:Npn \@@_round_o:Nw #1#2 @ diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index 9a3a94ffc53..df5477dc2cd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index d5c48436db4..4ff2e34c2bd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -158,7 +158,7 @@ % an invalid operation exception with the appropriate function name. % Otherwise, call the \texttt{trig} function to perform argument % reduction and if necessary convert the reduced argument to radians. -% Then, \cs{@@_sin_series_o:NNwwww} will be called to compute the +% Then, \cs{@@_sin_series_o:NNwwww} is called to compute the % Taylor series: this function receives a sign~|#3|, an initial octant % of~$0$, and the function \cs{@@_ep_to_float_o:wwN} which converts the % result of the series to a floating point directly rather than taking @@ -187,7 +187,7 @@ % invalid operation exception. The cosine of \nan{} is itself. % Otherwise, the \texttt{trig} function reduces the argument to at % most half a right-angle and converts if necessary to radians. We -% will then call the same series as for sine, but using a positive +% then call the same series as for sine, but using a positive % sign~|0| regardless of the sign of~$x$, and with an initial octant % of~$2$, because $\cos(x) = + \sin(\pi/2 + \lvert x\rvert)$. % \begin{macrocode} @@ -382,7 +382,7 @@ % converts it to a fixed point number. Some trailing digits may be % lost in the conversion, so we keep the original floating point % number around: when computing sine or tangent (or their inverses), -% the last step will be to multiply by the floating point number (as +% the last step is to multiply by the floating point number (as % an extended-precision number) rather than the fixed point number. % The period serves to end the integer expression for the octant. % \begin{macrocode} @@ -516,7 +516,7 @@ % \begin{variable}[aux, EXP]{\@@_trig_inverse_two_pi:} % This macro expands to |,,!| or~|,!| followed by $10112$~decimals of % $10^{-16}/(2\pi)$. The number of decimals we really need is the -% maximum exponent plus the number of digits we will need later,~$52$, +% maximum exponent plus the number of digits we later need,~$52$, % plus~$12$ ($4-1$~groups of $4$~digits). We store the decimals as a % control sequence name, and convert it to a token list when required: % strings take up less memory than their token list representation. @@ -864,7 +864,7 @@ % \item the conversion function~|#1|; % \item the final sign, which depends on the octant~|#3| and the % sign~|#2|; -% \item the octant~|#3|, which will control the series we use; +% \item the octant~|#3|, which controls the series we use; % \item the square |#4 * #4| of the argument as a fixed point number, % computed with \cs{@@_fixed_mul:wwn}; % \item the number itself as an extended-precision number. @@ -1046,7 +1046,7 @@ % / x)$ is the angular coordinate of the point $(x, y)$. % % As for direct trigonometric functions, the first step in computing -% $\operatorname{atan}(y, x)$ is argument reduction. The sign of~$y$ will give that +% $\operatorname{atan}(y, x)$ is argument reduction. The sign of~$y$ gives that % of the result. We distinguish eight regions where the point $(x, % \lvert y\rvert)$ can lie, of angular size roughly $\pi/8$, % characterized by their \enquote{octant}, between $0$ and~$7$ included. In @@ -1080,7 +1080,7 @@ % $\operatorname{atan}\frac{\lvert y\rvert}{x} % = \pi-\operatorname{atan}\frac{\lvert y\rvert}{-x}$. % \end{itemize} -% In the following, we will denote by~$z$ the ratio among +% In the following, we denote by~$z$ the ratio among % $\lvert\frac{y}{x}\rvert$, $\lvert\frac{x}{y}\rvert$, % $\lvert\frac{x+y}{x-y}\rvert$, $\lvert\frac{x-y}{x+y}\rvert$ which % appears in the right-hand side above. @@ -1171,8 +1171,8 @@ % \cs{@@_atan_combine_o:NwwwwwN}, with arguments the final sign~|#2|; % the octant~|#3|; $\operatorname{atan} z/z=1$ as a fixed point number; $z=0$~as a % fixed point number; and $z=0$~as an extended-precision number. -% Given the values we provide, $\operatorname{atan} z$ will be computed to be~$0$, -% and the result will be $[|#3|/2]\cdot\pi/4$ if the sign~|#5| of~$x$ +% Given the values we provide, $\operatorname{atan} z$ is computed to be~$0$, +% and the result is $[|#3|/2]\cdot\pi/4$ if the sign~|#5| of~$x$ % is positive, and $[(7-|#3|)/2]\cdot\pi/4$ for negative~$x$, where % the divisions are rounded up. % \begin{macrocode} @@ -1215,7 +1215,7 @@ % both as a fixed point number and as an extended-precision floating % point number with a mantissa in $[0.01,1)$. For now, we place |#1| % as a first argument, and start an integer expression for the octant. -% The sign of $x$ does not affect what~$z$ will be, so we simply leave +% The sign of $x$ does not affect~$z$, so we simply leave % a contribution to the octant: $\meta{octant} \to 7 - \meta{octant}$ % for negative~$x$. Then we order $\lvert y\rvert$ and $\lvert % x\rvert$ in a non-decreasing order: if $\lvert y\rvert > \lvert diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 6eb6e2b68e1..2293af64152 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -148,8 +148,8 @@ % \cs{fp_new:N} \meta{fp~var} % \end{syntax} % Creates a new \meta{fp~var} or raises an error if the name is -% already taken. The declaration is global. The \meta{fp~var} will -% initially be~$+0$. +% already taken. The declaration is global. The \meta{fp~var} is +% initially~$+0$. % \end{function} % % \begin{function}[updated = 2012-05-08, tested = m3fp001] @@ -158,7 +158,7 @@ % \cs{fp_const:Nn} \meta{fp~var} \Arg{floating point expression} % \end{syntax} % Creates a new constant \meta{fp~var} or raises an error if the name -% is already taken. The \meta{fp~var} will be set globally equal to +% is already taken. The \meta{fp~var} is set globally equal to % the result of evaluating the \meta{floating point expression}. % \end{function} % @@ -319,7 +319,7 @@ % special values $\pm 0$, $\pm\infty$ and~\nan{} are rendered as % |0|, |-0|, \texttt{inf}, \texttt{-inf}, and~\texttt{nan} % respectively. Normal category codes apply and thus \texttt{inf} or -% \texttt{nan}, if produced, will be made up of letters. +% \texttt{nan}, if produced, are made up of letters. % \end{function} % % \begin{function}[EXP, updated = 2012-07-08] @@ -428,8 +428,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, % and then evaluates the relationship between the two \meta{floating % point expressions} as described for \cs{fp_compare:nNnTF}. If the -% test is \texttt{false} then the \meta{code} will be inserted into -% the input stream again and a loop will occur until the +% test is \texttt{false} then the \meta{code} is inserted into +% the input stream again and a loop occurs until the % \meta{relation} is \texttt{true}. % \end{function} % @@ -441,8 +441,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, % and then evaluates the relationship between the two \meta{floating % point expressions} as described for \cs{fp_compare:nNnTF}. If the -% test is \texttt{true} then the \meta{code} will be inserted into the -% input stream again and a loop will occur until the \meta{relation} +% test is \texttt{true} then the \meta{code} is inserted into the +% input stream again and a loop occurs until the \meta{relation} % is \texttt{false}. % \end{function} % @@ -455,7 +455,7 @@ % expressions} as described for \cs{fp_compare:nNnTF}, and then % places the \meta{code} in the input stream if the \meta{relation} is % \texttt{false}. After the \meta{code} has been processed by \TeX{} -% the test will be repeated, and a loop will occur until the test is +% the test is repeated, and a loop occurs until the test is % \texttt{true}. % \end{function} % @@ -468,7 +468,7 @@ % expressions} as described for \cs{fp_compare:nNnTF}, and then % places the \meta{code} in the input stream if the \meta{relation} is % \texttt{true}. After the \meta{code} has been processed by \TeX{} -% the test will be repeated, and a loop will occur until the test is +% the test is repeated, and a loop occurs until the test is % \texttt{false}. % \end{function} % @@ -480,8 +480,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, % and then evaluates the relationship between the two \meta{floating % point expressions} as described for \cs{fp_compare:nTF}. If the -% test is \texttt{false} then the \meta{code} will be inserted into -% the input stream again and a loop will occur until the +% test is \texttt{false} then the \meta{code} is inserted into +% the input stream again and a loop occurs until the % \meta{relation} is \texttt{true}. % \end{function} % @@ -493,8 +493,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, % and then evaluates the relationship between the two \meta{floating % point expressions} as described for \cs{fp_compare:nTF}. If the -% test is \texttt{true} then the \meta{code} will be inserted into the -% input stream again and a loop will occur until the \meta{relation} +% test is \texttt{true} then the \meta{code} is inserted into the +% input stream again and a loop occurs until the \meta{relation} % is \texttt{false}. % \end{function} % @@ -507,7 +507,7 @@ % expressions} as described for \cs{fp_compare:nTF}, and then places % the \meta{code} in the input stream if the \meta{relation} is % \texttt{false}. After the \meta{code} has been processed by \TeX{} -% the test will be repeated, and a loop will occur until the test is +% the test is repeated, and a loop occurs until the test is % \texttt{true}. % \end{function} % @@ -520,7 +520,7 @@ % expressions} as described for \cs{fp_compare:nTF}, and then places % the \meta{code} in the input stream if the \meta{relation} is % \texttt{true}. After the \meta{code} has been processed by \TeX{} -% the test will be repeated, and a loop will occur until the test is +% the test is repeated, and a loop occurs until the test is % \texttt{false}. % \end{function} % @@ -789,7 +789,7 @@ % \item \texttt{inf} represents $+\infty$, and can be preceded by any % \meta{sign}, yielding $\pm\infty$ as appropriate. % \item \texttt{nan} represents a (quiet) non-number. It can be -% preceded by any sign, but that will be ignored. +% preceded by any sign, but that sign is ignored. % \item Any unrecognizable string triggers an error, and produces a % \nan{}. % \end{itemize} @@ -1005,13 +1005,13 @@ % multiple closest to $0$ is chosen (\enquote{ties to zero}), % if $t$ is positive/negative the multiple closest to $\infty$/$-\infty$ is chosen % (\enquote{ties towards positive/negative infinity}). -% \item |floor|, or the deprecated |round-|, yields the largest +% \item |floor| yields the largest % multiple of~$10^{-n}$ smaller or equal to~$x$ (\enquote{round % towards negative infinity}); -% \item |ceil|, or the deprecated |round+|, yields the smallest +% \item |ceil| yields the smallest % multiple of~$10^{-n}$ greater or equal to~$x$ (\enquote{round % towards positive infinity}); -% \item |trunc|, or the deprecated |round0|, yields a multiple +% \item |trunc| yields a multiple % of~$10^{-n}$ with the same sign as~$x$ and with the largest % absolute value less that that of~$x$ (\enquote{round towards % zero}). diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index d5b6eb60ace..fba1893a993 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -158,8 +158,8 @@ % \cs{int_new:N} \meta{integer} % \end{syntax} % Creates a new \meta{integer} or raises an error if the name is -% already taken. The declaration is global. The \meta{integer} will -% initially be equal to $0$. +% already taken. The declaration is global. The \meta{integer} is +% initially equal to $0$. % \end{function} % % \begin{function}[updated = 2011-10-22]{\int_const:Nn, \int_const:cn} @@ -167,7 +167,7 @@ % \cs{int_const:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} % Creates a new constant \meta{integer} or raises an error if the name -% is already taken. The value of the \meta{integer} will be set +% is already taken. The value of the \meta{integer} is set % globally to the \meta{integer expression}. % \end{function} % @@ -262,7 +262,7 @@ % \cs{int_use:N} \meta{integer} % \end{syntax} % Recovers the content of an \meta{integer} and places it directly -% in the input stream. An error will be raised if the variable does +% in the input stream. An error is raised if the variable does % not exist or if it is invalid. Can be omitted in places where an % \meta{integer} is required (such as in the first and third arguments % of \cs{int_compare:nNnTF}). @@ -350,7 +350,8 @@ % This function evaluates the \meta{test integer expression} and % compares this in turn to each of the % \meta{integer expression cases}. If the two are equal then the -% associated \meta{code} is left in the input stream. If any of the +% associated \meta{code} is left in the input stream +% and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the % input stream (after the code for the appropriate case), while if none % match then the \meta{false code} is inserted. The function @@ -366,7 +367,7 @@ % } % { No idea! } % \end{verbatim} -% will leave \enquote{\texttt{Medium}} in the input stream. +% leaves \enquote{\texttt{Medium}} in the input stream. % \end{function} % % \begin{function}[EXP,pTF]{\int_if_even:n, \int_if_odd:n} @@ -389,8 +390,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the relationship between the two % \meta{integer expressions} as described for \cs{int_compare:nNnTF}. -% If the test is \texttt{false} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{false} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{true}. % \end{function} % @@ -401,8 +402,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the relationship between the two % \meta{integer expressions} as described for \cs{int_compare:nNnTF}. -% If the test is \texttt{true} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{true} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{false}. % \end{function} % @@ -414,7 +415,7 @@ % as described for \cs{int_compare:nNnTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{false}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{true}. % \end{function} % @@ -426,7 +427,7 @@ % as described for \cs{int_compare:nNnTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{true}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{false}. % \end{function} % @@ -437,8 +438,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the \meta{integer relation} % as described for \cs{int_compare:nTF}. -% If the test is \texttt{false} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{false} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{true}. % \end{function} % @@ -449,8 +450,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the \meta{integer relation} % as described for \cs{int_compare:nTF}. -% If the test is \texttt{true} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{true} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{false}. % \end{function} % @@ -462,7 +463,7 @@ % as described for \cs{int_compare:nTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{false}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{true}. % \end{function} % @@ -474,7 +475,7 @@ % as described for \cs{int_compare:nTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{true}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{false}. % \end{function} % @@ -586,8 +587,8 @@ % ~~\meta{value to symbol mapping} % \end{syntax} % This is the low-level function for conversion of an -% \meta{integer expression} into a symbolic form (which will often -% be letters). The \meta{total symbols} available should be given +% \meta{integer expression} into a symbolic form (often +% letters). The \meta{total symbols} available should be given % as an integer expression. Values are actually converted to symbols % according to the \meta{value to symbol mapping}. This should be given % as \meta{total symbols} pairs of entries, a number and the @@ -735,7 +736,7 @@ % numeral} is first converted to a string, with no expansion. The % \meta{roman numeral} may be in upper or lower case; if the numeral % contains characters besides |mdclxvi| or |MDCLXVI| then the -% resulting value will be $-1$. This is the inverse function of +% resulting value is $-1$. This is the inverse function of % \cs{int_to_roman:n} and \cs{int_to_Roman:n}. % \end{function} % @@ -1317,7 +1318,7 @@ % \UnitTested % \begin{macro}{\int_gset:Nn, \int_gset:cn} % \UnitTested -% As integers are register-based \TeX{} will issue an error +% As integers are register-based \TeX{} issues an error % if they are not defined. Thus there is no need for the checking % code seen with token list variables. % \begin{macrocode} @@ -1418,11 +1419,11 @@ % is at least one relation symbol. We first let \TeX{} evaluate this % left hand side of the (in)equality using \cs{@@_eval:w}. Since the % relation symbols |<|, |>|, |=| and |!| are not allowed in integer -% expressions, they will terminate it. If the argument contains no +% expressions, they would terminate the expression. If the argument contains no % relation symbol, \cs{__prg_compare_error:} is expanded, % inserting~|=| and itself after an error. In all cases, % \cs{@@_compare:w} receives as its argument an integer, a relation -% symbol, and some more tokens. We then setup the loop, which will be +% symbol, and some more tokens. We then setup the loop, which is % ended by the two odd-looking items |e| and |{=nd_}|, with a trailing % \cs{q_stop} used to grab the entire argument when necessary. % \begin{macrocode} @@ -1750,7 +1751,7 @@ % We put a \cs{__prg_break_point:Nn} so that \texttt{map_break} % functions from other modules correctly decrement \cs{g__prg_map_int} % before looking for their own break point. The first argument is -% \cs{scan_stop:}, so no breaking function will recognize this break +% \cs{scan_stop:}, so that no breaking function recognizes this break % point as its own. % \begin{macrocode} \cs_new_protected:Npn \int_step_inline:nnnn @@ -2093,7 +2094,7 @@ % code $12$ (other). Usually, what is actually wanted is letters. % The approach here is to convert the output of the primitive into % letters using appropriate control sequence names. That keeps -% everything expandable. The loop will be terminated by the conversion +% everything expandable. The loop is terminated by the conversion % of the |Q|. % \begin{macrocode} \cs_new:Npn \int_to_roman:n #1 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index e64ee21f1bb..c8da27656d9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 2b1deb80434..6f4847fd0d2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -86,7 +86,7 @@ % } % \end{verbatim} % -% At a document level, \cs{keys_set:nn} will be used within a +% At a document level, \cs{keys_set:nn} is used within a % document function, for example % \begin{verbatim} % \DeclareDocumentCommand \MyModuleSetup { m } @@ -102,7 +102,7 @@ % % Key names may contain any tokens, as they are handled internally % using \cs{tl_to_str:n}; spaces are \emph{ignored} in key names. -% As will be discussed in +% As discussed in % section~\ref{sec:l3keys:subdivision}, it is suggested that the character % |/| is reserved for sub-division of keys into logical % groups. Functions and variables are \emph{not} expanded when creating @@ -114,7 +114,7 @@ % \l_mymodule_tmp_tl .code:n = code % } % \end{verbatim} -% will create a key called |\l_mymodule_tmp_tl|, and not one called +% creates a key called |\l_mymodule_tmp_tl|, and not one called % \texttt{key}. % % \section{Creating keys} @@ -154,9 +154,9 @@ % % Key properties are applied in the reading order and so the ordering % is significant. Key properties which define \enquote{actions}, such -% as |.code:n|, |.tl_set:N|, \emph{etc.}, will override one another. +% as |.code:n|, |.tl_set:N|, \emph{etc.}, override one another. % Some other properties are mutually exclusive, notably |.value_required:n| -% and |.value_forbidden:n|, and so will replace one another. However, +% and |.value_forbidden:n|, and so they replace one another. However, % properties covering non-exclusive behaviours may be given in any order. Thus % for example the following definitions are equivalent. % \begin{verbatim} @@ -172,7 +172,7 @@ % } % \end{verbatim} % Note that with the exception of the special |.undefine:| property, all -% key properties will define the key within the current \TeX{} scope. +% key properties define the key within the current \TeX{} scope. % % \begin{function}[updated = 2013-07-08] % {.bool_set:N, .bool_set:c, .bool_gset:N, .bool_gset:c} @@ -230,7 +230,7 @@ % Defines \meta{key} to set \meta{comma list variable} to \meta{value}. % Spaces around commas and empty items will be stripped. % If the variable does not exist, it -% will be created globally at the point that the key is set up. +% is created globally at the point that the key is set up. % \end{function} % % \begin{function}[updated = 2013-07-10]{.code:n} @@ -240,7 +240,7 @@ % Stores the \meta{code} for execution when \meta{key} is used. % The \meta{code} can include one parameter (|#1|), which will be the % \meta{value} given for the \meta{key}. The \texttt{x}-type variant -% will expand \meta{code} at the point where the \meta{key} is +% expands \meta{code} at the point where the \meta{key} is % created. % \end{function} % @@ -268,7 +268,7 @@ % The default does not affect keys where values are required or % forbidden. Thus a required value cannot be supplied by a default % value, and giving a default value for a key which cannot take a value -% will not trigger an error. +% does not trigger an error. % \end{function} % % \begin{function}{.dim_set:N, .dim_set:c, .dim_gset:N, .dim_gset:c} @@ -277,7 +277,7 @@ % \end{syntax} % Defines \meta{key} to set \meta{dimension} to \meta{value} (which % must a dimension expression). If the variable does not exist, it -% will be created globally at the point that the key is set up. +% is created globally at the point that the key is set up. % \end{function} % % \begin{function}{.fp_set:N, .fp_set:c, .fp_gset:N, .fp_gset:c} @@ -286,7 +286,7 @@ % \end{syntax} % Defines \meta{key} to set \meta{floating point} to \meta{value} % (which must a floating point expression). If the variable does not exist, -% it will be created globally at the point that the key is set up. +% it is created globally at the point that the key is set up. % \end{function} % % \begin{function}[added = 2013-07-14] @@ -304,7 +304,7 @@ % \meta{key} .inherit:n = \Arg{parents} % \end{syntax} % Specifies that the \meta{key} path should inherit the keys listed -% as \meta{parents}. For example, with setting +% as \meta{parents}. For example, after setting % \begin{verbatim} % \keys_define:n { foo } { test .code:n = \tl_show:n {#1} } % \keys_define:n { } { bar .inherit:n = foo } @@ -336,7 +336,7 @@ % \end{syntax} % Defines \meta{key} to set \meta{integer} to \meta{value} (which % must be an integer expression). If the variable does not exist, it -% will be created globally at the point that the key is set up. +% is created globally at the point that the key is set up. % \end{function} % % \begin{function}[updated = 2013-07-10]{.meta:n} @@ -389,7 +389,7 @@ % \end{syntax} % Defines \meta{key} to set \meta{skip} to \meta{value} (which % must be a skip expression). If the variable does not exist, it -% will be created globally at the point that the key is set up. +% is created globally at the point that the key is set up. % \end{function} % % \begin{function}{.tl_set:N, .tl_set:c, .tl_gset:N, .tl_gset:c} @@ -397,7 +397,7 @@ % \meta{key} .tl_set:N = \meta{token list variable} % \end{syntax} % Defines \meta{key} to set \meta{token list variable} to \meta{value}. -% If the variable does not exist, it will be created globally +% If the variable does not exist, it is created globally % at the point that the key is set up. % \end{function} % @@ -408,7 +408,7 @@ % Defines \meta{key} to set \meta{token list variable} to \meta{value}, % which will be subjected to an \texttt{x}-type expansion % (\emph{i.e.}~using \cs{tl_set:Nx}). If the variable does not exist, -% it will be created globally at the point that the key is set up. +% it is created globally at the point that the key is set up. % \end{function} % % \begin{function}[added = 2015-07-14]{.undefine:} @@ -424,7 +424,7 @@ % \end{syntax} % Specifies that \meta{key} cannot receive a \meta{value} when used. % If a \meta{value} is given then an error will be issued. Setting -% the property \texttt{false} will cancel the restriction. +% the property \texttt{false} cancels the restriction. % \end{function} % % \begin{function}[added = 2015-07-14]{.value_required:n} @@ -433,7 +433,7 @@ % \end{syntax} % Specifies that \meta{key} must receive a \meta{value} when used. % If a \meta{value} is not given then an error will be issued. Setting -% the property \texttt{false} will cancel the restriction. +% the property \texttt{false} cancels the restriction. % \end{function} % % \section{Sub-dividing keys} @@ -456,7 +456,7 @@ % used to represent keys internally. Both of the above code fragments % set the same key, which has full name \texttt{module/subgroup/key}. % -% As will be illustrated in the next section, this subdivision is +% As illustrated in the next section, this subdivision is % particularly relevant to making multiple choices. % % \section{Choice and multiple choice keys} @@ -606,7 +606,7 @@ % \end{syntax} % Parses the \meta{keyval list}, and sets those keys which are defined % for \meta{module}. The behaviour on finding an unknown key can be set -% by defining a special \texttt{unknown} key: this will be illustrated +% by defining a special \texttt{unknown} key: this is illustrated % later. % \end{function} % @@ -634,18 +634,18 @@ % has path \texttt{mymodule/subset/key-a}. This information is stored in % \cs{l_keys_path_tl}, and will have been processed by \cs{tl_to_str:n}. % -% The \emph{name} of the key is the part of the path after the last -% \texttt{/}, and thus is not unique. In the preceding examples, both keys -% have name \texttt{key-a} despite having different paths. This information -% is stored in \cs{l_keys_key_tl}, and will have been processed by -% \cs{tl_to_str:n}. +% The \emph{name} of the key is the part of the path after the last +% \texttt{/}, and thus is not unique. In the preceding examples, both keys +% have name \texttt{key-a} despite having different paths. This information +% is stored in \cs{l_keys_key_tl}, and will have been processed by +% \cs{tl_to_str:n}. % \end{variable} % % \section{Handling of unknown keys} % \label{sec:l3keys:unknown} % -% If a key has not previously been defined (is unknown), \cs{keys_set:nn} will -% look for a special \texttt{unknown} key for the same module, and if this is +% If a key has not previously been defined (is unknown), \cs{keys_set:nn} +% looks for a special \texttt{unknown} key for the same module, and if this is % not defined raises an error indicating that the key name was unknown. This % mechanism can be used for example to issue custom error texts. % \begin{verbatim} @@ -671,7 +671,7 @@ % \cs{keys_set_known:nnN} function parses the \meta{keyval list}, and sets % those keys which are defined for \meta{module}. Any keys which are unknown % are not processed further by the parser. -% The key--value pairs for each \emph{unknown} key name will be +% The key--value pairs for each \emph{unknown} key name are % stored in the \meta{tl} in a comma-separated form (\emph{i.e.}~an edited % version of the \meta{keyval list}). The \cs{keys_set_known:nn} version % skips this stage. @@ -695,7 +695,7 @@ % key-four .fp_set:N = \l_my_a_fp , % } % \end{verbatim} -% the use of \cs{keys_set:nn} will attempt to set all four keys. However, in +% the use of \cs{keys_set:nn} attempts to set all four keys. However, in % some contexts it may only be sensible to set some keys, or to control the % order of setting. To do this, keys may be assigned to \emph{groups}: % arbitrary sets which are independent of the key tree. Thus modifying the @@ -712,7 +712,7 @@ % key-four .fp_set:N = \l_my_a_fp , % } % \end{verbatim} -% will assign \texttt{key-one} and \texttt{key-two} to group \texttt{first}, +% assigns \texttt{key-one} and \texttt{key-two} to group \texttt{first}, % \texttt{key-three} to group \texttt{second}, while \texttt{key-four} is % not assigned to a group. % @@ -730,11 +730,11 @@ % \begin{syntax} % \cs{keys_set_filter:nnnN} \Arg{module} \Arg{groups} \Arg{keyval list} \meta{tl} % \end{syntax} -% Actives key filtering in an \enquote{opt-out} sense: keys assigned to any -% of the \meta{groups} specified will be ignored. The \meta{groups} are +% Activates key filtering in an \enquote{opt-out} sense: keys assigned to any +% of the \meta{groups} specified are ignored. The \meta{groups} are % given as a comma-separated list. Unknown keys are not assigned to any -% group and will thus always be set. The key--value pairs for each -% key which is filtered out will be stored in the \meta{tl} in a +% group and are thus always set. The key--value pairs for each +% key which is filtered out are stored in the \meta{tl} in a % comma-separated form (\emph{i.e.}~an edited version of the \meta{keyval % list}). The \cs{keys_set_filter:nnn} version skips this stage. % @@ -750,10 +750,10 @@ % \begin{syntax} % \cs{keys_set_groups:nnn} \Arg{module} \Arg{groups} \Arg{keyval list} % \end{syntax} -% Actives key filtering in an \enquote{opt-in} sense: only keys assigned to -% one or more of the \meta{groups} specified will be set. The \meta{groups} are +% Activates key filtering in an \enquote{opt-in} sense: only keys assigned to +% one or more of the \meta{groups} specified are set. The \meta{groups} are % given as a comma-separated list. Unknown keys are not assigned to any -% group and will thus never be set. +% group and are thus never set. % \end{function} % % \section{Utility functions for keys} @@ -829,7 +829,7 @@ % to category \enquote{other} (12) so that the parser does not \enquote{miss} % any due to category code changes. Spaces are removed from the ends % of the keys and values. Keys and values which are given in braces -% will have exactly one set removed (after space trimming), thus +% have exactly one set removed (after space trimming), thus % \begin{verbatim} % key = {value here}, % \end{verbatim} @@ -848,15 +848,15 @@ % given). \meta{function_1} should take one argument, while % \meta{function_2} should absorb two arguments. After % \cs{keyval_parse:NNn} has parsed the \meta{key--value list}, -% \meta{function_1} will be used to process keys given with no value -% and \meta{function_2} will be used to process keys given with a +% \meta{function_1} is used to process keys given with no value +% and \meta{function_2} is used to process keys given with a % value. The order of the \meta{keys} in the \meta{key--value list} -% will be preserved. Thus +% is preserved. Thus % \begin{verbatim} % \keyval_parse:NNn \function:n \function:nn % { key1 = value1 , key2 = value2, key3 = , key4 } % \end{verbatim} -% will be converted into an input stream +% is converted into an input stream % \begin{verbatim} % \function:nn { key1 } { value1 } % \function:nn { key2 } { value2 } @@ -1363,7 +1363,7 @@ % the function. If not, then a check to make sure there is no need for % a value with the property. If there should be one then complain, % otherwise execute it. There is no need to check for a |:| as if it -% is missing the earlier tests will have failed. +% was missing the earlier tests would have failed. % \begin{macrocode} \cs_new_protected:Npn \@@_define_code:n #1 { @@ -1511,15 +1511,17 @@ % % \begin{macro}[int] % {\@@_cmd_set:nn, \@@_cmd_set:nx, \@@_cmd_set:Vn, \@@_cmd_set:Vo} -% Setting the code for a key first checks that the basic data structures -% exist, then saves the code. +% Setting the code for a key first logs if appropriate that we are +% defining a new key, then saves the code. % \begin{macrocode} -\cs_new_protected:Npn \@@_cmd_set:nn #1#2 +\__debug_patch:nnNw { \cs_if_exist:cF { \c_@@_code_root_tl #1 } - { \__chk_log:x { Defining~key~#1~\msg_line_context: } } - \cs_set_protected:cpn { \c_@@_code_root_tl #1 } ##1 {#2} + { \__debug_log:x { Defining~key~#1~\msg_line_context: } } } + { } +\cs_new_protected:Npn \@@_cmd_set:nn #1#2 + { \cs_set_protected:cpn { \c_@@_code_root_tl #1 } ##1 {#2} } \cs_generate_variant:Nn \@@_cmd_set:nn { nx , Vn , Vo } % \end{macrocode} % \end{macro} @@ -1549,7 +1551,8 @@ % Assigning a key to one or more groups uses comma lists. As the list of % groups only exists if there is anything to do, the setting is done using % a scratch list. For the usual grouping reasons we use the low-level -% approach to undefining a list. +% approach to undefining a list. We also use the low-level approach for +% the other case to avoid tripping up the |check-declarations| code. % \begin{macrocode} \cs_new_protected:Npn \@@_groups_set:n #1 { @@ -1560,7 +1563,7 @@ \tex_undefined:D } { - \clist_set_eq:cN { \c_@@_groups_root_tl \l_keys_path_tl } + \cs_set_eq:cN { \c_@@_groups_root_tl \l_keys_path_tl } \l_@@_groups_clist } } @@ -1757,7 +1760,7 @@ % \begin{macro} % {.choices:nn, .choices:Vn, .choices:on, .choices:xn} % For auto-generation of a series of mutually-exclusive choices. -% Here, |#1| will consist of two separate +% Here, |#1| consists of two separate % arguments, hence the slightly odd-looking implementation. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .choices:nn } #1 @@ -2368,7 +2371,7 @@ % \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 +% if that fails call the unknown key. That always exists, 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} @@ -2456,7 +2459,7 @@ % (same message, but with a |t| or |f| argument, then build the % control sequences which contain the code and other information % about the key, call an intermediate auxiliary which constructs the -% code that will be displayed to the terminal, and finally conclude +% code to be displayed to the terminal, and finally conclude % with \cs{__msg_show_wrap:n}. % \begin{macrocode} \cs_new_protected:Npn \keys_show:nn #1#2 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index b83cc86cde1..80ec22a2e2a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -52,9 +52,9 @@ % 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{sys_if_engine_luatex:T} to avoid this. Details of coding -% the \LuaTeX{} engine are detailed in the \LuaTeX{} manual. +% available. When used with \pdfTeX{} or \XeTeX{} these raise an +% error: use \cs{sys_if_engine_luatex:T} to avoid this. Details on using +% \Lua{} with the \LuaTeX{} engine are given in the \LuaTeX{} manual. % % \subsection{\TeX{} code interfaces} % @@ -62,12 +62,12 @@ % \begin{syntax} % \cs{lua_now:n} \Arg{token list} % \end{syntax} -% The \meta{token list} is first tokenized by \TeX{}, which will include +% The \meta{token list} is first tokenized by \TeX{}, which includes % 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, +% The \Lua{} interpreter executes the \meta{\Lua{} input} immediately, % and in an expandable manner. % % In the case of the \cs{lua_now_x:n} version the input is fully expanded @@ -75,7 +75,7 @@ % fully expandable. % \begin{texnote} % \cs{lua_now_x:n} is a macro wrapper around \tn{directlua}: when -% \LuaTeX{} is in use two expansions will be required to yield the +% \LuaTeX{} is in use two expansions are required to yield the % result of the \Lua{} code. % \end{texnote} % \end{function} @@ -84,7 +84,7 @@ % \begin{syntax} % \cs{lua_shipout:n} \Arg{token list} % \end{syntax} -% The \meta{token list} is first tokenized by \TeX{}, which will include +% The \meta{token list} is first tokenized by \TeX{}, which includes % 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 @@ -118,7 +118,7 @@ % fully expandable. % \begin{texnote} % \cs{lua_escape_x:n} is a macro wrapper around \tn{luaescapestring}: -% when \LuaTeX{} is in use two expansions will be required to yield the +% when \LuaTeX{} is in use two expansions are required to yield the % result of the \Lua{} code. % \end{texnote} % \end{function} @@ -128,14 +128,6 @@ % As well as interfaces for \TeX{}, there are a small number of Lua functions % provided here. Currently these are intended for internal use only. % -% \begin{function}{l3kernel.strcmp} -% \begin{syntax} -% \cs{l3kernel.strcmp}|(|\meta{str one}, \meta{str two}|)| -% \end{syntax} -% Compares the two strings and returns |0| to \TeX{} -% if the two are identical. -% \end{function} -% % \begin{function}{l3kernel.charcat} % \begin{syntax} % \cs{l3kernel.charcat}|(|\meta{charcode}, \meta{catcode}|)| @@ -144,6 +136,41 @@ % the result to \TeX{}. % \end{function} % +% \begin{function}{l3kernel.filemdfivesum} +% \begin{syntax} +% \cs{l3kernel.filemdfivesum}|(|\meta{file}|)| +% \end{syntax} +% Returns the of the MD5 sum of the file contents read as bytes. If the +% \meta{file} is not found, nothing is returned with \emph{no error raised}. +% \end{function} +% +% \begin{function}{l3kernel.filemoddate} +% \begin{syntax} +% \cs{l3kernel.filemoddate}|(|\meta{file}|)| +% \end{syntax} +% Returns the of the date/time of last modification of the \meta{file} in the +% format |D:|\meta{year}\meta{month}\meta{day}\meta{hour}\meta{minute}^^A +% \meta{second}\meta{offset}, where the latter may be |Z| (UTC) or +% \meta{plus-minus}\meta{hours}|'|\meta{minutes}|'|. If the \meta{file} is +% not found, nothing is returned with \emph{no error raised}. +% \end{function} +% +% \begin{function}{l3kernel.filesize} +% \begin{syntax} +% \cs{l3kernel.filesize}|(|\meta{file}|)| +% \end{syntax} +% Returns the size of the \meta{file} in bytes. If the \meta{file} is not +% found, nothing is returned with \emph{no error raised}. +% \end{function} +% +% \begin{function}{l3kernel.strcmp} +% \begin{syntax} +% \cs{l3kernel.strcmp}|(|\meta{str one}, \meta{str two}|)| +% \end{syntax} +% Compares the two strings and returns |0| to \TeX{} +% if the two are identical. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -221,6 +248,9 @@ %<*lua> % \end{macrocode} % +% Most of the emulation of \pdfTeX{} here is based heavily on Heiko Oberdiek's +% \pkg{pdftexcmds} package. +% % \begin{macro}[int]{l3kernel} % Create a table for the kernel's own use. % \begin{macrocode} @@ -228,29 +258,47 @@ l3kernel = l3kernel or { } % \end{macrocode} % \end{macro} % -% Various local copies of standard functions: naming convention is to retain -% the full text but replace all |.| by |_|. +% Local copies of global tables. % \begin{macrocode} -local tex_setcatcode = tex.setcatcode -local tex_sprint = tex.sprint -local tex_write = tex.write -local unicode_utf8_char = unicode.utf8.char +local io = io +local kpse = kpse +local lfs = lfs +local math = math +local md5 = md5 +local os = os +local string = string +local tex = tex +local unicode = unicode % \end{macrocode} % -% \begin{macro}[int]{l3kernel.strcmp} -% String comparison which gives the same results as \pdfTeX{}'s -% \tn{pdfstrcmp}, although the ordering should likely not be relied upon! +% Local copies of standard functions. % \begin{macrocode} -local function strcmp (A, B) - if A == B then - tex_write("0") - elseif A < B then - tex_write("-1") - else - tex_write("1") - end +local abs = math.abs +local byte = string.byte +local floor = math.floor +local format = string.format +local gsub = string.gsub +local kpse_find = kpse.find_file +local lfs_attr = lfs.attributes +local md5_sum = md5.sum +local open = io.open +local os_date = os.date +local setcatcode = tex.setcatcode +local str_format = string.format +local sprint = tex.sprint +local write = tex.write +local utf8_char = unicode.utf8.char +% \end{macrocode} +% +% \begin{macro}[aux]{escapehex} +% An internal auxiliary to convert a string to the matching hex escape. +% This works on a byte basis: extension to handled UTF-8 input is +% covered in \pkg{pdftexcmds} but is not currently required here. +% \begin{macrocode} +local function escapehex(str) + write((gsub(str, ".", + function (ch) return format("%02X", byte(ch)) end))) end -l3kernel.strcmp = strcmp % \end{macrocode} % \end{macro} % @@ -261,14 +309,120 @@ l3kernel.strcmp = strcmp % to match an eventual allocator. % \begin{macrocode} local charcat_table = l3kernel.charcat_table or 1 -local function charcat (charcode, catcode) - tex_setcatcode(charcat_table, charcode, catcode) - tex_sprint(charcat_table, unicode_utf8_char(charcode)) +local function charcat(charcode, catcode) + setcatcode(charcat_table, charcode, catcode) + sprint(charcat_table, utf8_char(charcode)) end l3kernel.charcat = charcat % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{l3kernel.filemdfivesum} +% Read an entire file and hash it: the hash function itself is a built-in. +% As Lua is byte-based there is no work needed here in terms of UTF-8 +% (see \pkg{pdftexcmds} and how it handles strings that have passed through +% \LuaTeX{}). +% \begin{macrocode} +local function filemdfivesum(name) + local file = kpse_find(name, "tex", true) + if file then + local f = open(file, "r") + if f then + local data = f:read("*a") + escapehex(md5_sum(data)) + f:close() + end + end +end +l3kernel.filemdfivesum = filemdfivesum +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{l3kernel.filemoddate} +% See procedure \texttt{makepdftime} in \texttt{utils.c} of +% \pdfTeX{}. +% \begin{macrocode} +local function filemoddate(name) + local file = kpse_find(name, "tex", true) + if file then + local date = lfs_attr(file, "modification") + if date then + local d = os_date("*t", date) + if d.sec >= 60 then + d.sec = 59 + end + local u = os_date("!*t", date) + local off = 60 * (d.hour - u.hour) + d.min - u.min + if d.year ~= u.year then + if d.year > u.year then + off = off + 1440 + else + off = off - 1440 + end + elseif d.yday ~= u.yday then + if d.yday > u.yday then + off = off + 1440 + else + off = off - 1440 + end + end + local timezone + if off == 0 then + timezone = "Z" + else + local hours = floor(off / 60) + local mins = abs(off - hours * 60) + timezone = str_format("%+03d", hours) + .. "'" .. str_format("%02d", mins) .. "'" + end + write("D:" + .. str_format("%04d", d.year) + .. str_format("%02d", d.month) + .. str_format("%02d", d.day) + .. str_format("%02d", d.hour) + .. str_format("%02d", d.min) + .. str_format("%02d", d.sec) + .. timezone) + end + end +end +l3kernel.filemoddate = filemoddate +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{l3kernel.filesize} +% A simple disk lookup. +% \begin{macrocode} +local function filesize(name) + local file = kpse_find(name, "tex", true) + if file then + local size = lfs_attr(file, "size") + if size then + write(size) + end + end +end +l3kernel.filesize = filesize +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{l3kernel.strcmp} +% String comparison which gives the same results as \pdfTeX{}'s +% \tn{pdfstrcmp}, although the ordering should likely not be relied upon! +% \begin{macrocode} +local function strcmp(A, B) + if A == B then + write("0") + elseif A < B then + write("-1") + else + write("1") + end +end +l3kernel.strcmp = strcmp +% \end{macrocode} +% \end{macro} +% % \subsection{Generic \Lua{} and font support} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 8e6a6525406..d71000c896d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -72,9 +72,9 @@ % \section{Creating new messages} % % All messages have to be created before they can be used. -% The text of messages will automatically by wrapped to the length +% The text of messages is automatically wrapped to the length % available in the console. As a result, formatting is only needed -% where it will help to show meaning. In particular, |\\| may be +% where it helps to show meaning. In particular, |\\| may be % used to force a new line and \verb*|\ | forces an explicit space. % Additionally, |\{|, |\#|, |\}|, |\%| and |\~| can be used to produce % the corresponding character. @@ -87,20 +87,19 @@ % \begin{verbatim} % \msg_new:nnnn { mymodule } { submodule / message } ... % \end{verbatim} -% will allow only those messages from the \texttt{submodule} to be filtered -% out. +% will allow to filter out specifically messages from the \texttt{submodule}. % % \begin{function}[updated = 2011-08-16]{\msg_new:nnnn, \msg_new:nnn} % \begin{syntax} % \cs{msg_new:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Creates a \meta{message} for a given \meta{module}. -% The message will be defined to first give \meta{text} and then +% The message is defined to first give \meta{text} and then % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: % these will be supplied at the time the message is -% used. An error will be raised if the \meta{message} already exists. +% used. An error is raised if the \meta{message} already exists. % \end{function} % % \begin{function}{\msg_set:nnnn, \msg_set:nnn, \msg_gset:nnnn, \msg_gset:nnn} @@ -108,7 +107,7 @@ % \cs{msg_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Sets up the text for a \meta{message} for a given \meta{module}. -% The message will be defined to first give \meta{text} and then +% The message is defined to first give \meta{text} and then % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: @@ -232,9 +231,9 @@ % Messages behave differently depending on the message class. In all cases, % the message may be issued supplying~$0$ to~$4$ arguments. If the number of % arguments supplied here does not match the number in the definition of the -% message, extra arguments will be ignored, or empty arguments added (of -% course the sense of the message may be impaired). The four arguments will -% be converted to strings before being added to the message text: the +% message, extra arguments are ignored, or empty arguments added (of +% course the sense of the message may be impaired). The four arguments are +% converted to strings before being added to the message text: the % \texttt{x}-type variants should be used to expand material. % % \begin{function}[updated = 2012-08-11] @@ -254,7 +253,7 @@ % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. After issuing a -% fatal error the \TeX{} run will halt. +% fatal error the \TeX{} run halts. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -274,7 +273,7 @@ % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. After issuing a -% critical error, \TeX{} will stop reading the current input file. +% critical error, \TeX{} stops reading the current input file. % This may halt the \TeX{} run (if the current file is the main file) % or may abort reading a sub-file. % \begin{texnote} @@ -300,9 +299,9 @@ % \cs{msg_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to -% \meta{arg four} to the text-creating functions. The error will -% interrupt processing and issue the text at the terminal. After user -% input, the run will continue. +% \meta{arg four} to the text-creating functions. The error +% interrupts processing and issues the text at the terminal. After user +% input, the run continues. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -322,8 +321,8 @@ % \end{syntax} % Issues \meta{module} warning \meta{message}, passing \meta{arg one} % to \meta{arg four} to the text-creating functions. The warning text -% will be added to the log file and the terminal, but the \TeX{} run -% will not be interrupted. +% is added to the log file and the terminal, but the \TeX{} run +% is not interrupted. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -343,7 +342,7 @@ % \end{syntax} % Issues \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. -% The information text will be added to the log file. +% The information text is added to the log file. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -363,7 +362,7 @@ % \end{syntax} % Issues \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. -% The information text will be added to the log file: the output +% The information text is added to the log file: the output % is briefer than \cs{msg_info:nnnnnn}. % \end{function} % @@ -397,7 +396,7 @@ % \begin{verbatim} % \msg_error:nn { module } { my-message } % \end{verbatim} -% when it is used. With no filtering, this will raise an error. However, we +% when it is used. With no filtering, this raises an error. However, we % could alter the behaviour with % \begin{verbatim} % \msg_redirect_class:nn { error } { warning } @@ -417,7 +416,7 @@ % % Multiple redirections are possible. Redirections can be cancelled by % providing an empty argument for the target class. Redirection to a -% missing class will raise errors immediately. Infinite loops are +% missing class raises an error immediately. Infinite loops are % prevented by eliminating the redirection starting from the target of % the redirection that caused the loop to appear. Namely, if % redirections are requested as $A \to B$, $B \to C$ and $C \to A$ in @@ -479,16 +478,16 @@ % ! <text> % !............................................... % \end{verbatim} -% where the \meta{text} will be wrapped to fit within the current +% where the \meta{text} is wrapped to fit within the current % line length. The user may then request more information, at which -% stage the \meta{extra text} will be shown in the terminal in the +% stage the \meta{extra text} is shown in the terminal in the % format % \begin{verbatim} % |''''''''''''''''''''''''''''''''''''''''''''''' % | <extra text> % |............................................... % \end{verbatim} -% where the \meta{extra text} will be wrapped within the current +% where the \meta{extra text} is wrapped within the current % line length. Wrapping of both \meta{text} and \meta{more text} takes place % using \cs{iow_wrap:nnnN}; the documentation for the latter should be % consulted for full details. @@ -504,7 +503,7 @@ % . <text> % ................................................. % \end{verbatim} -% where the \meta{text} will be wrapped to fit within the current +% where the \meta{text} is wrapped to fit within the current % line length. Wrapping takes place using \cs{iow_wrap:nnnN}; the % documentation for the latter should be consulted for full details. % \end{function} @@ -520,7 +519,7 @@ % * <text> % ************************************************* % \end{verbatim} -% where the \meta{text} will be wrapped to fit within the current +% where the \meta{text} is wrapped to fit within the current % line length. Wrapping takes place using \cs{iow_wrap:nnnN}; the % documentation for the latter should be consulted for full details. % \end{function} @@ -537,12 +536,12 @@ % \cs{__msg_kernel_new:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Creates a kernel \meta{message} for a given \meta{module}. -% The message will be defined to first give \meta{text} and then +% The message is defined to first give \meta{text} and then % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: % these will be supplied and expanded at the time the message is used. -% An error will be raised if the \meta{message} already exists. +% An error is raised if the \meta{message} already exists. % \end{function} % % \begin{function}{\__msg_kernel_set:nnnn, \__msg_kernel_set:nnn} @@ -550,7 +549,7 @@ % \cs{__msg_kernel_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Sets up the text for a kernel \meta{message} for a given \meta{module}. -% The message will be defined to first give \meta{text} and then +% The message is defined to first give \meta{text} and then % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: @@ -574,7 +573,7 @@ % \end{syntax} % Issues kernel \meta{module} error \meta{message}, passing \meta{arg one} % to \meta{arg four} to the text-creating functions. After issuing a -% fatal error the \TeX{} run will halt. Cannot be redirected. +% fatal error the \TeX{} run halts. Cannot be redirected. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -594,9 +593,9 @@ % \end{syntax} % Issues kernel \meta{module} error \meta{message}, passing \meta{arg one} % to -% \meta{arg four} to the text-creating functions. The error will -% stop processing and issue the text at the terminal. After user input, -% the run will continue. Cannot be redirected. +% \meta{arg four} to the text-creating functions. The error +% stops processing and issues the text at the terminal. After user input, +% the run continues. Cannot be redirected. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -617,8 +616,7 @@ % Issues kernel \meta{module} warning \meta{message}, passing % \meta{arg one} to % \meta{arg four} to the text-creating functions. The warning text -% will be added to the log file, but the \TeX{} run will not be -% interrupted. +% is added to the log file, but the \TeX{} run is not interrupted. % \end{function} % % \begin{function}[updated = 2012-08-11] @@ -638,7 +636,7 @@ % \end{syntax} % Issues kernel \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. -% The information text will be added to the log file. +% The information text is added to the log file. % \end{function} % % \section{Expandable errors} @@ -664,7 +662,7 @@ % \end{syntax} % Issues an error, passing \meta{arg one} to \meta{arg four} % to the text-creating functions. The resulting string must -% be shorter than a line, otherwise it will be cropped. +% be much shorter than a line, otherwise it is cropped. % \end{function} % % \begin{function}[EXP, added = 2011-08-11, updated = 2011-08-13] @@ -738,8 +736,8 @@ % Shows or logs the \meta{expression} (turned into a string), an % equal sign, and the result of applying the \meta{function} to the % \Arg{expression}. For instance, if the \meta{function} is -% \cs{int_eval:n} and the \meta{expression} is |1+2| then this will -% log |> 1+2=3.| The case where the \meta{function} is +% \cs{int_eval:n} and the \meta{expression} is |1+2| then this +% logs |> 1+2=3.| The case where the \meta{function} is % \cs{tl_to_str:n} is special: then the string representation of the % \meta{expression} is only logged once. % \end{function} @@ -833,11 +831,10 @@ % % \begin{macro}[aux]{\__chk_if_free_msg:nn} % This auxiliary is similar to \cs{__chk_if_free_cs:N}, and is used when -% defining messages with \cs{msg_new:nnnn}. It could be inlined in -% \cs{msg_new:nnnn}, but the experimental \pkg{l3trace} module needs -% to disable this check when reloading a package with the extra -% tracing information. +% defining messages with \cs{msg_new:nnnn}. % \begin{macrocode} +\__debug_patch:nnNw { } + { \__debug_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \cs_new_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} @@ -846,19 +843,6 @@ {#1} {#2} } } -%<*package> -\if_bool:N \l@expl@log@functions@bool - \cs_gset_protected:Npn \__chk_if_free_msg:nn #1#2 - { - \msg_if_exist:nnT {#1} {#2} - { - \@@_kernel_error:nnxx { kernel } { message-already-defined } - {#1} {#2} - } - \__chk_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } - } -\fi: -%</package> % \end{macrocode} % \end{macro} % @@ -922,7 +906,7 @@ \tl_const:Nn \c_@@_continue_text_tl { Type~<return>~to~continue } \tl_const:Nn \c_@@_critical_text_tl - { Reading~the~current~file~'\g_file_current_name_tl'~will~stop. } + { Reading~the~current~file~'\g_file_curr_name_str'~will~stop. } \tl_const:Nn \c_@@_fatal_text_tl { This~is~a~fatal~error:~LaTeX~will~abort. } \tl_const:Nn \c_@@_help_text_tl @@ -1027,9 +1011,9 @@ % trailing closing braces are turned into spaces to hide them as well. % The group in which we alter the definition of the active |!| is % closed before producing the message: this ensures that tokens -% inserted by typing |I| in the command-line will be inserted after +% inserted by typing |I| in the command-line are inserted after % the message is entirely cleaned up. - +% % The \cs{__iow_with:Nnn} auxiliary, defined in \pkg{l3file}, expects % an \meta{integer variable}, an integer \meta{value}, and some % \meta{code}. It runs the \meta{code} after ensuring that the @@ -1489,7 +1473,7 @@ % applies then no further redirection is attempted. Otherwise, split % the message name into \texttt{module/submodule/message} (with an % arbitrary number of slashes), and store |{/module/submodule}|, -% |{/module}| and |{}| into \cs{l_@@_hierarchy_seq}. We will then +% |{/module}| and |{}| into \cs{l_@@_hierarchy_seq}. We then % map through this sequence, applying the most specific redirection. % \begin{macrocode} \cs_new_protected:Npn \@@_use_redirect_name:n #1 @@ -1556,7 +1540,7 @@ % \end{macro} % % \begin{macro}{\msg_redirect_name:nnn} -% Named message will always use the given class even if that class is +% Named message always use the given class even if that class is % redirected further. An empty target class cancels any existing % redirection for that message. % \begin{macrocode} @@ -1928,21 +1912,6 @@ 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 } - { The~variable~#1~has~not~been~declared~\msg_line_context:. } - { - Checking~is~active,~and~you~have~tried~do~so~something~like: \\ - \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ - without~first~having: \\ - \ \ \tl_new:N ~ #1 \\ - \\ - LaTeX~will~create~the~variable~and~continue. - } - } -%</package> \@@_kernel_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { @@ -1975,6 +1944,52 @@ } % \end{macrocode} % +% Some errors are only needed in package mode if debugging is enabled by +% one of the options \texttt{enable-debug}, \texttt{check-declarations}, +% \texttt{log-functions}, or on the contrary if debugging is turned off. +% In format mode the error is somewhat different. +% \begin{macrocode} +%<*package> +\bool_if:NTF \l@expl@enable@debug@bool + { + \@@_kernel_new:nnn { kernel } { debug-unpatchable } + { Only~some~definitions~can~be~patched;~'#3'~cannot. } + \@@_kernel_new:nnnn { check } { non-declared-variable } + { The~variable~#1~has~not~been~declared~\msg_line_context:. } + { + Checking~is~active,~and~you~have~tried~do~so~something~like: \\ + \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ + without~first~having: \\ + \ \ \tl_new:N ~ #1 \\ + \\ + LaTeX~will~create~the~variable~and~continue. + } + } + { + \@@_kernel_new:nnnn { kernel } { enable-debug } + { To~use~'#1'~load~expl3~with~the~'enable-debug'~option. } + { + The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ + some~internal~functions~in~expl3~have~been~appropriately~ + defined.~This~only~happens~if~one~of~the~options~ + 'enable-debug',~'check-declarations'~or~'log-functions'~was~ + given~when~loading~expl3. + } + } +%</package> +%<*initex> +\@@_kernel_new:nnnn { kernel } { enable-debug } + { '#1'~cannot~be~used~in~format~mode. } + { + The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ + some~internal~functions~in~expl3~have~been~appropriately~ + defined.~This~only~happens~in~package~mode~(and~only~if~one~of~ + the~options~'enable-debug',~'check-declarations'~or~'log-functions'~ + was~given~when~loading~expl3. + } +%</initex> +% \end{macrocode} +% % Some errors only appear in expandable settings, % hence don't need a \enquote{more-text} argument. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 805700f73c8..3ade94184a8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -628,6 +628,8 @@ \__kernel_primitive:NN \pdfdraftmode \pdftex_draftmode:D \__kernel_primitive:NN \pdfeachlinedepth \pdftex_eachlinedepth:D \__kernel_primitive:NN \pdfeachlineheight \pdftex_eachlineheight:D + \__kernel_primitive:NN \pdffilemoddate \pdftex_filemoddate:D + \__kernel_primitive:NN \pdffilesize \pdftex_filesize:D \__kernel_primitive:NN \pdffirstlineheight \pdftex_firstlineheight:D \__kernel_primitive:NN \pdffontexpand \pdftex_fontexpand:D \__kernel_primitive:NN \pdffontsize \pdftex_fontsize:D @@ -638,6 +640,7 @@ \__kernel_primitive:NN \pdflastypos \pdftex_lastypos:D \__kernel_primitive:NN \pdfmapfile \pdftex_mapfile:D \__kernel_primitive:NN \pdfmapline \pdftex_mapline:D + \__kernel_primitive:NN \pdfmdfivesum \pdftex_mdfivesum:D \__kernel_primitive:NN \pdfnoligatures \pdftex_noligatures:D \__kernel_primitive:NN \pdfnormaldeviate \pdftex_normaldeviate:D \__kernel_primitive:NN \pdfpageheight \pdftex_pageheight:D @@ -762,6 +765,7 @@ % Primitives from \pdfTeX{} that \XeTeX{} renames: also helps with % \LuaTeX{}. % \begin{macrocode} + \__kernel_primitive:NN \mdfivesum \pdftex_mdfivesum:D \__kernel_primitive:NN \ifprimitive \pdftex_ifprimitive:D \__kernel_primitive:NN \primitive \pdftex_primitive:D \__kernel_primitive:NN \shellescape \pdftex_shellescape:D @@ -1112,7 +1116,7 @@ \tex_endgroup:D % \end{macrocode} % -% \LaTeXe{} will have moved a few primitives, so these are sorted out. +% \LaTeXe{} moves a few primitives, so these are sorted out. % A convenient test for \LaTeXe{} is the \cs{@@end} saved primitive. % \begin{macrocode} %<*package> @@ -1126,7 +1130,7 @@ \tex_let:D \tex_underline:D \@@underline % \end{macrocode} % Some tidying up is needed for \tn[index=tracingfonts]{(pdf)tracingfonts}. Newer \LuaTeX{} has -% this simply as \tn{tracingfonts}, but that will have been overwritten by +% this simply as \tn{tracingfonts}, but that is overwritten by % the \LaTeXe{} kernel. So any spurious definition has to be removed, then % the real version saved either from the \pdfTeX{} name or from \LuaTeX{}. % In the latter case, we leave \tn{@@tracingfonts} available: this might diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index a8750f614c2..2340345b14a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -42,7 +42,7 @@ % } % % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index b74c712d0a4..b54376773d6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -85,7 +85,7 @@ % \end{syntax} % These functions create a family of conditionals using the same % \Arg{code} to perform the test created. Those conditionals are -% expandable if \meta{code} is. The \texttt{new} versions will check +% expandable if \meta{code} is. The \texttt{new} versions check % for existing definitions and perform assignments globally % (\emph{cf.}~\cs{cs_new:Npn}) whereas the \texttt{set} versions do no % check and perform assignments locally (\emph{cf.}~\cs{cs_set:Npn}). @@ -105,9 +105,9 @@ % \end{syntax} % These functions create a family of protected conditionals using the % same \Arg{code} to perform the test created. The \meta{code} does -% not need to be expandable. The \texttt{new} version will check for +% not need to be expandable. The \texttt{new} version check for % existing definitions and perform assignments globally -% (\emph{cf.}~\cs{cs_new:Npn}) whereas the \texttt{set} version will +% (\emph{cf.}~\cs{cs_new:Npn}) whereas the \texttt{set} version do % not (\emph{cf.}~\cs{cs_set:Npn}). The conditionals created are % depended on the comma-separated list of \meta{conditions}, which % should be one or more of \texttt{T}, \texttt{F} and \texttt{TF} (not @@ -174,8 +174,8 @@ % \cs{prg_new_eq_conditional:NNn} \cs[no-index]{\meta{name_1}:\meta{arg spec_1}} \cs[no-index]{\meta{name_2}:\meta{arg spec_2}} \Arg{conditions} % \end{syntax} % These functions copy a family of conditionals. The \texttt{new} version -% will check for existing definitions (\emph{cf.}~\cs{cs_new_eq:NN}) whereas -% the \texttt{set} version will not (\emph{cf.}~\cs{cs_set_eq:NN}). The +% checks for existing definitions (\emph{cf.}~\cs{cs_new_eq:NN}) whereas +% the \texttt{set} version does not (\emph{cf.}~\cs{cs_set_eq:NN}). The % conditionals copied are depended on the comma-separated list of % \meta{conditions}, which should be one or more of \texttt{p}, \texttt{T}, % \texttt{F} and \texttt{TF}. @@ -217,8 +217,8 @@ % both the boolean type and predicate functions. % % All conditional |\bool_| functions except assignments are expandable -% and expect the input to also be fully expandable (which will generally -% mean being constructed from predicate functions, possibly nested). +% and expect the input to also be fully expandable (which generally +% means being constructed from predicate functions and booleans, possibly nested). % % \begin{texnote} % The \texttt{bool} data type is not implemented using the @@ -234,7 +234,7 @@ % \end{syntax} % Creates a new \meta{boolean} or raises an error if the % name is already taken. The declaration is global. The -% \meta{boolean} will initially be \texttt{false}. +% \meta{boolean} is initially \texttt{false}. % \end{function} % % \begin{function} @@ -429,7 +429,7 @@ % \texttt{true} and \texttt{false} if any of them is \texttt{false}. % Contrarily to the infix operator |&&|, only the \meta{boolean % expressions} which are needed to determine the result of -% \cs{bool_lazy_all:nTF} will be evaluated. See also \cs{bool_lazy_and:nnTF} +% \cs{bool_lazy_all:nTF} are evaluated. See also \cs{bool_lazy_and:nnTF} % when there are only two \meta{boolean expressions}. % \end{function} % @@ -440,8 +440,8 @@ % \end{syntax} % Implements the \enquote{And} operation between two boolean % expressions, hence is \texttt{true} if both are \texttt{true}. -% Contrarily to the infix operator |&&|, the \meta{boolexpr_2} will -% only be evaluated if it is needed to determine the result of +% Contrarily to the infix operator |&&|, the \meta{boolexpr_2} is only +% evaluated if it is needed to determine the result of % \cs{bool_lazy_and:nnTF}. See also \cs{bool_lazy_all:nTF} when there are more % than two \meta{boolean expressions}. % \end{function} @@ -456,7 +456,7 @@ % \texttt{true} and \texttt{false} if all of them are \texttt{false}. % Contrarily to the infix operator \verb"||", only the \meta{boolean % expressions} which are needed to determine the result of -% \cs{bool_lazy_any:nTF} will be evaluated. See also \cs{bool_lazy_or:nnTF} +% \cs{bool_lazy_any:nTF} are evaluated. See also \cs{bool_lazy_or:nnTF} % when there are only two \meta{boolean expressions}. % \end{function} % @@ -468,7 +468,7 @@ % Implements the \enquote{Or} operation between two boolean % expressions, hence is \texttt{true} if either one is \texttt{true}. % Contrarily to the infix operator \verb"||", the \meta{boolexpr_2} -% will only be evaluated if it is needed to determine the result of +% is only evaluated if it is needed to determine the result of % \cs{bool_lazy_or:nnTF}. See also \cs{bool_lazy_any:nTF} when there are more % than two \meta{boolean expressions}. % \end{function} @@ -500,8 +500,8 @@ % \end{syntax} % Places the \meta{code} in the input stream for \TeX{} to process, % and then checks the logical value of the \meta{boolean}. If it is -% \texttt{false} then the \meta{code} will be inserted into the input -% stream again and the process will loop until the \meta{boolean} is +% \texttt{false} then the \meta{code} is inserted into the input +% stream again and the process loops until the \meta{boolean} is % \texttt{true}. % \end{function} % @@ -511,8 +511,8 @@ % \end{syntax} % Places the \meta{code} in the input stream for \TeX{} to process, % and then checks the logical value of the \meta{boolean}. If it is -% \texttt{true} then the \meta{code} will be inserted into the input -% stream again and the process will loop until the \meta{boolean} is +% \texttt{true} then the \meta{code} is inserted into the input +% stream again and the process loops until the \meta{boolean} is % \texttt{false}. % \end{function} % @@ -523,7 +523,7 @@ % This function firsts checks the logical value of the \meta{boolean}. % If it is \texttt{false} the \meta{code} is placed in the input stream % and expanded. After the completion of the \meta{code} the truth -% of the \meta{boolean} is re-evaluated. The process will then loop +% of the \meta{boolean} is re-evaluated. The process then loops % until the \meta{boolean} is \texttt{true}. % \end{function} % @@ -534,7 +534,7 @@ % This function firsts checks the logical value of the \meta{boolean}. % If it is \texttt{true} the \meta{code} is placed in the input stream % and expanded. After the completion of the \meta{code} the truth -% of the \meta{boolean} is re-evaluated. The process will then loop +% of the \meta{boolean} is re-evaluated. The process then loops % until the \meta{boolean} is \texttt{false}. % \end{function} % @@ -545,8 +545,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, % and then checks the logical value of the \meta{boolean expression} % as described for \cs{bool_if:nTF}. If it is \texttt{false} then the -% \meta{code} will be inserted into the input stream again and the -% process will loop until the \meta{boolean expression} evaluates to +% \meta{code} is inserted into the input stream again and the +% process loops until the \meta{boolean expression} evaluates to % \texttt{true}. % \end{function} % @@ -557,8 +557,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, % and then checks the logical value of the \meta{boolean expression} % as described for \cs{bool_if:nTF}. If it is \texttt{true} then the -% \meta{code} will be inserted into the input stream again and the -% process will loop until the \meta{boolean expression} evaluates to +% \meta{code} is inserted into the input stream again and the +% process loops until the \meta{boolean expression} evaluates to % \texttt{false}. % \end{function} % @@ -570,8 +570,8 @@ % \meta{boolean expression} (as described for \cs{bool_if:nTF}). % If it is \texttt{false} the \meta{code} is placed in the input stream % and expanded. After the completion of the \meta{code} the truth -% of the \meta{boolean expression} is re-evaluated. The process will -% then loop until the \meta{boolean expression} is \texttt{true}. +% of the \meta{boolean expression} is re-evaluated. The process +% then loops until the \meta{boolean expression} is \texttt{true}. % \end{function} % % \begin{function}[rEXP, updated = 2012-07-08]{\bool_while_do:nn} @@ -582,8 +582,8 @@ % \meta{boolean expression} (as described for \cs{bool_if:nTF}). % If it is \texttt{true} the \meta{code} is placed in the input stream % and expanded. After the completion of the \meta{code} the truth -% of the \meta{boolean expression} is re-evaluated. The process will -% then loop until the \meta{boolean expression} is \texttt{false}. +% of the \meta{boolean expression} is re-evaluated. The process +% then loops until the \meta{boolean expression} is \texttt{false}. % \end{function} % % \section{Producing multiple copies} @@ -667,7 +667,7 @@ % \tn{halign}. This is necessary to allow grabbing of tokens % for testing purposes, as \TeX{} uses group level to determine the % effect of alignment tokens. Without the special grouping, the use of -% a function such as \cs{peek_after:Nw} will result in a forbidden +% a function such as \cs{peek_after:Nw} would result in a forbidden % comparison of the internal \tn{endtemplate} token, yielding a % fatal error. Each \cs{group_align_safe_begin:} must be matched by a % \cs{group_align_safe_end:}, although this does not have to occur @@ -711,7 +711,7 @@ % % \begin{function}[EXP]{\__prg_break_point:} % This copy of \cs{prg_do_nothing:} is used to mark the end of a fast -% short-term recursions: the function \cs{__prg_break:n} uses this to +% short-term recursion: the function \cs{__prg_break:n} uses this to % break out of the loop. % \end{function} % @@ -804,13 +804,20 @@ % } % \UnitTested % Setting is already pretty easy. +% When \texttt{check-declarations} is active, the definitions are patched to +% make sure the boolean exists. This is needed because booleans are +% not based on token lists nor on \TeX{} registers. % \begin{macrocode} +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_set_true:N { c } @@ -828,16 +835,14 @@ % \bool_gset_eq:Nc, \bool_gset_eq:cc % } % \UnitTested -% The usual copy code. +% The usual copy code. While it would be cleaner semantically to copy +% the \cs{cs_set_eq:NN} family of functions, we copy \cs{tl_set_eq:NN} +% because that has the correct checking code. % \begin{macrocode} -\cs_new_eq:NN \bool_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \bool_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \bool_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \bool_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \bool_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \bool_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \bool_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \bool_gset_eq:cc \cs_gset_eq:cc +\cs_new_eq:NN \bool_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \bool_gset_eq:NN \tl_gset_eq:NN +\cs_generate_variant:Nn \bool_set_eq:NN { Nc, cN, cc } +\cs_generate_variant:Nn \bool_gset_eq:NN { Nc, cN, cc } % \end{macrocode} % \end{macro} % @@ -845,9 +850,12 @@ % \begin{macro}{\bool_gset:Nn, \bool_gset:cn} % This function evaluates a boolean expression and assigns the first % argument the meaning \cs{c_true_bool} or \cs{c_false_bool}. +% Again, we include some checking code. % \begin{macrocode} +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set:Nn #1#2 { \tex_chardef:D #1 = \bool_if_p:n {#2} } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } \cs_generate_variant:Nn \bool_set:Nn { c } @@ -856,55 +864,6 @@ % \end{macro} % \end{macro} % -% Booleans are not based on token lists but do need checking: this -% code complements similar material in \pkg{l3tl}. -% \begin{macrocode} -%<*package> -\if_bool:N \l@expl@check@declarations@bool - \cs_set_protected:Npn \bool_set_true:N #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 \c_true_bool - } - \cs_set_protected:Npn \bool_set_false:N #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 \c_false_bool - } - \cs_set_protected:Npn \bool_gset_true:N #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 \c_true_bool - } - \cs_set_protected:Npn \bool_gset_false:N #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 \c_false_bool - } - \cs_set_protected:Npn \bool_set_eq:NN #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 - } - \cs_set_protected:Npn \bool_gset_eq:NN #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 - } - \cs_set_protected:Npn \bool_set:Nn #1#2 - { - \__chk_if_exist_var:N #1 - \tex_chardef:D #1 = \bool_if_p:n {#2} - } - \cs_set_protected:Npn \bool_gset:Nn #1#2 - { - \__chk_if_exist_var:N #1 - \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} - } -\fi: -%</package> -% \end{macrocode} -% % \begin{macro}[pTF]{\bool_if:N, \bool_if:c} % \UnitTested % Straight forward here. We could optimize here if we wanted to as @@ -1052,7 +1011,7 @@ % } % First issue a \cs{group_align_safe_begin:} as we are using |&&| % as syntax shorthand for the And operation and we need to hide it for -% \TeX{}. This will be closed at the end of the expression parsing +% \TeX{}. This is closed at the end of the expression parsing % (see |S| below). % % Minimal (\enquote{short-circuit}) evaluation of boolean expressions @@ -1061,14 +1020,14 @@ % parenthesis when \meta{false}|&&| is seen. To avoid having separate % functions for the two cases, we transform the boolean expression by % doubling each parenthesis and adding parenthesis around each -% \verb"||". This ensures that |&&| will bind tighter than \verb"||". +% \verb"||". This ensures that |&&| binds tighter than \verb"||". % % The replacement is done in three passes, for left and right % parentheses and for \verb"||". At each pass, the part of the % expression that has been transformed is stored before \cs{q_nil}, % the rest lies until the first \cs{q_mark}, followed by an empty % brace group. A trailing marker ensures that the auxiliaries' -% delimited arguments will not run-away. As long as the delimiter +% delimited arguments do not run-away. As long as the delimiter % matches inside the expression, material is moved before \cs{q_nil} % and we continue. Afterwards, the trailing marker is taken as a % delimiter, |#4| is the next auxiliary, immediately followed by a new @@ -1098,7 +1057,7 @@ % % \begin{macro}[EXP, aux]{\@@_if_parse:NNNww} % After removing extra tokens from the transformation phase, start -% evaluating. At the end, we will need to finish the special +% evaluating. At the end, we need to finish the special % \texttt{align_safe} group before finally % returning a \cs{c_true_bool} or \cs{c_false_bool} as there might % otherwise be something left in front in the input stream. For this @@ -1540,7 +1499,7 @@ % requires two steps of expansion. % % This function has one flaw though: Since it constantly passes down -% ten copies of its previous argument it will severely affect the main +% ten copies of its previous argument it severely affects the main % memory once you start demanding hundreds of thousands of copies. Now % I don't think this is a real limitation for any ordinary use, and if % necessary, it is possible to write \cs{prg_replicate:nn} |{1000}| @@ -1665,9 +1624,9 @@ % whenever \tn{halign} or \tn{valign} work, [\ldots]} One problem relates % to commands that internally issues a \tn{cr} but also peek ahead for % the next character for use in, say, an optional argument. If the -% next token happens to be a |&| with category code~4 we will get some +% next token happens to be a |&| with category code~4 we get some % sort of weird error message because the underlying -% \tn{futurelet} will store the token at the end of the alignment +% \tn{futurelet} stores the token at the end of the alignment % template. This could be a |&|$_4$ giving a message like % |! Misplaced \cr.| or even worse: it could be the \tn{endtemplate} % token causing even more trouble! To solve this we have to open a diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 5545dbec4b0..2d3ecc3bbd2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -56,7 +56,7 @@ % % Each entry in a property list must have a unique \meta{key}: if an entry is % added to a property list which already contains the \meta{key} then the new -% entry will overwrite the existing one. The \meta{keys} are compared on a +% entry overwrites the existing one. The \meta{keys} are compared on a % string basis, using the same method as \cs{str_if_eq:nn}. % % Property lists are intended for storing key-based information for use within @@ -70,8 +70,8 @@ % \cs{prop_new:N} \meta{property list} % \end{syntax} % Creates a new \meta{property list} or raises an error if the name is -% already taken. The declaration is global. The \meta{property list} will -% initially contain no entries. +% already taken. The declaration is global. The \meta{property list} +% initially contains no entries. % \end{function} % % \begin{function} @@ -162,8 +162,8 @@ % Recovers the \meta{value} stored with \meta{key} from the % \meta{property list}, and places this in the \meta{token list % variable}. If the \meta{key} is not found in the -% \meta{property list} then the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. The \meta{token list +% \meta{property list} then the \meta{token list variable} is set +% to the special marker \cs{q_no_value}. The \meta{token list % variable} is set within the current \TeX{} group. See also % \cs{prop_get:NnNTF}. % \end{function} @@ -176,8 +176,8 @@ % Recovers the \meta{value} stored with \meta{key} from the % \meta{property list}, and places this in the \meta{token list % variable}. If the \meta{key} is not found in the -% \meta{property list} then the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. The \meta{key} and +% \meta{property list} then the \meta{token list variable} is set +% to the special marker \cs{q_no_value}. The \meta{key} and % \meta{value} are then deleted from the property list. Both % assignments are local. See also \cs{prop_pop:NnNTF}. % \end{function} @@ -190,8 +190,8 @@ % Recovers the \meta{value} stored with \meta{key} from the % \meta{property list}, and places this in the \meta{token list % variable}. If the \meta{key} is not found in the -% \meta{property list} then the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. The \meta{key} and +% \meta{property list} then the \meta{token list variable} is set +% to the special marker \cs{q_no_value}. The \meta{key} and % \meta{value} are then deleted from the property list. % The \meta{property list} is modified globally, while the assignment of % the \meta{token list variable} is local. See also \cs{prop_gpop:NnNTF}. @@ -209,7 +209,7 @@ % \cs{prop_get:NnN}. % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{value} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -335,7 +335,7 @@ % \cs{prop_map_function:NN} \meta{property list} \meta{function} % \end{syntax} % Applies \meta{function} to every \meta{entry} stored in the -% \meta{property list}. The \meta{function} will receive two argument for +% \meta{property list}. The \meta{function} receives two argument for % each iteration: the \meta{key} and associated \meta{value}. % The order in which \meta{entries} are returned is not defined and % should not be relied upon. @@ -348,7 +348,7 @@ % \end{syntax} % Applies \meta{inline function} to every \meta{entry} stored % within the \meta{property list}. The \meta{inline function} should -% consist of code which will receive the \meta{key} as |#1| and the +% consist of code which receives the \meta{key} as |#1| and the % \meta{value} as |#2|. % The order in which \meta{entries} are returned is not defined and % should not be relied upon. @@ -359,8 +359,8 @@ % \cs{prop_map_break:} % \end{syntax} % Used to terminate a \cs[no-index]{prop_map_\ldots} function before all -% entries in the \meta{property list} have been processed. This will -% normally take place within a conditional statement, for example +% entries in the \meta{property list} have been processed. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \prop_map_inline:Nn \l_my_prop % { @@ -371,7 +371,7 @@ % } % } % \end{verbatim} -% Use outside of a \cs[no-index]{prop_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{prop_map_\ldots} scenario leads to low % level \TeX{} errors. % \end{function} % @@ -381,8 +381,8 @@ % \end{syntax} % Used to terminate a \cs[no-index]{prop_map_\ldots} function before all % entries in the \meta{property list} have been processed, inserting -% the \meta{tokens} after the mapping has ended. This will -% normally take place within a conditional statement, for example +% the \meta{tokens} after the mapping has ended. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \prop_map_inline:Nn \l_my_prop % { @@ -393,7 +393,7 @@ % } % } % \end{verbatim} -% Use outside of a \cs[no-index]{prop_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{prop_map_\ldots} scenario leads to low % level \TeX{} errors. % \end{function} % @@ -448,7 +448,7 @@ % \end{syntax} % The internal token used to begin each key--value pair in the % property list. If expanded outside of a mapping or manipulation -% function, an error will be raised. The definition should always be +% function, an error is raised. The definition should always be % set globally. % \end{variable} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 86be080ee8a..6b5f79741c3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -102,8 +102,8 @@ % \cs{quark_new:N} \meta{quark} % \end{syntax} % Creates a new \meta{quark} which expands only to \meta{quark}. -% The \meta{quark} will be defined globally, and an error message -% will be raised if the name was already taken. +% The \meta{quark} is defined globally, and an error message +% is raised if the name was already taken. % \end{function} % % \begin{variable}{\q_stop} @@ -262,7 +262,7 @@ % % % Here's the definition of |\my_map_dbl:nn|. -% First of all, define the function that will do the processing based on the +% First of all, define the function that does the processing based on the % inline function argument |#2|. % Then initiate the recursion using an internal function. % The token list |#1| is terminated using \cs{q_recursion_tail}, with @@ -294,7 +294,7 @@ % } %\end{verbatim} % Note that contrarily to \LaTeX3 built-in mapping functions, this -% mapping function cannot be nested, since the second map will overwrite +% mapping function cannot be nested, since the second map would overwrite % the definition of |\__my_map_dbl_fn:nn|. % % @@ -317,7 +317,7 @@ % \section{Scan marks} % % Scan marks are control sequences set equal to \cs{scan_stop:}, -% hence will never expand in an expansion context and will be (largely) +% hence never expand in an expansion context and are (largely) % invisible if they are encountered in a typesetting context. % % Like quarks, they can be used as delimiters in weird functions @@ -336,8 +336,8 @@ % \cs{__scan_new:N} \meta{scan mark} % \end{syntax} % Creates a new \meta{scan mark} which is set equal to \cs{scan_stop:}. -% The \meta{scan mark} will be defined globally, and an error message -% will be raised if the name was already taken by another scan mark. +% The \meta{scan mark} is defined globally, and an error message +% is raised if the name was already taken by another scan mark. % \end{function} % % \begin{variable}{\s__stop} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index fd57d6736cb..625907bf5a0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -70,15 +70,16 @@ % \enquote{\texttt{This cat.}}, where the first % occurrence of \enquote{\texttt{at}} was replaced % by \enquote{\texttt{is}}. A more complicated example is -% a pattern to add a comma at the end of each word: +% a pattern to emphasize each word and add a comma after it: % \begin{verbatim} -% \regex_replace_all:nnN { \w+ } { \0 , } \l_my_tl +% \regex_replace_all:nnN { \w+ } { \c{emph}\cB\{ \0 \cE\} , } \l_my_tl % \end{verbatim} -% The |\w| sequence represents any \enquote{word} character, -% and |+| indicates that the |\w| sequence should be repeated -% as many times as possible (at least once), hence matching a word in the -% input token list. In the replacement text, |\0| denotes the full match -% (here, a word). +% The |\w| sequence represents any \enquote{word} character, and |+| +% indicates that the |\w| sequence should be repeated as many times as +% possible (at least once), hence matching a word in the input token +% list. In the replacement text, |\0| denotes the full match (here, a +% word). The command |\emph| is inserted using |\c{emph}|, and its +% argument |\0| is put between braces |\cB\{| and |\cE\}|. % % If a regular expression is to be used several times, % it can be compiled once, and stored in a regex @@ -97,6 +98,55 @@ % % \subsection{Syntax of regular expressions} % +% We start with a few examples, and encourage the reader to apply +% \cs{regex_show:n} to these regular expressions. +% \begin{itemize} +% \item |Cat| matches the word \enquote{Cat} capitalized in this way, +% but also matches the beginning of the word \enquote{Cattle}: use +% |\bCat\b| to match a complete word only. +% \item |[abc]| matches one letter among \enquote{a}, \enquote{b}, +% \enquote{c}; the pattern \verb"(a|b|c)" matches the same three +% possible letters (but see the discussion of submatches below). +% \item |[A-Za-z]*| matches any number (due to the quantifier +% \verb"*") of Latin letters (not accented). +% \item |\c{[A-Za-z]*}| matches a control sequence made of Latin +% letters. +% \item |\_[^\_]*\_| matches an underscore, any number of characters +% other than underscore, and another underscore; it is equivalent to +% |\_.*?\_| where |.| matches arbitrary characters and the +% lazy quantifier |*?| means to match as few characters as +% possible, thus avoiding matching underscores. +% \item |[+-]?\d+| matches an explicit integer with at most one +% sign. +% \item \verb*"[+-\ ]*\d+\ *" matches an explicit integer with any +% number of $+$ and $-$ signs, with spaces allowed except within the +% mantissa, and sourrounded by spaces. +% \item \verb*"[+-\ ]*(\d+|\d*\.\d+)\ *" matches an explict integer or +% decimal number; using \verb*"[.,]" instead of \verb*"\." would allow +% the comma as a decimal marker. +% \item +% \verb*"[+-\ ]*(\d+|\d*\.\d+)\ *((?i)pt|in|[cem]m|ex|[bs]p|[dn]d|[pcn]c)\ *" +% matches an explicit dimension with any unit that \TeX{} knows, where +% \verb*"(?i)" means to treat lowercase and uppercase letters +% identically. +% \item \verb*"[+-\ ]*((?i)nan|inf|(\d+|\d*\.\d+)(\ *e[+-\ ]*\d+)?)\ *" +% matches an explicit floating point number or the special values +% \verb*"nan" and \verb*"inf" (with signs). +% \item \verb*"[+-\ ]*(\d+|\cC.)\ *" matches an explicit integer or +% control sequence (without checking whether it is an integer +% variable). +% \item |\G.*?\K| at the beginning of a regular expression matches and +% discards (due to |\K|) everything between the end of the previous +% match (|\G|) and what is matched by the rest of the regular +% expression; this is useful in \cs{regex_replace_all:nnN} when the +% goal is to extract matches or submatches in a finer way than with +% \cs{regex_extract_all:nnN}. +% \end{itemize} +% While it is impossible for a regular expression to match only integer +% expressions, \verb*"[+-\(]*\d+\)*([+-*/][+-\(]*\d+\)*)*" matches among +% other things all valid integer expressions (made only with explicit +% integers). One should follow it with further testing. +% % Most characters match exactly themselves, % with an arbitrary category code. Some characters are % special and must be escaped with a backslash (\emph{e.g.}, |\*| @@ -114,7 +164,7 @@ % \item spaces should always be escaped (even in character % classes); % \item any other character may be escaped or not, without any -% effect: both versions will match exactly that character. +% effect: both versions match exactly that character. % \end{itemize} % Note that these rules play nicely with the fact that many % non-alphanumeric characters are difficult to input into \TeX{} @@ -161,7 +211,7 @@ % \item[\\V] Any token not matched by |\v|. % \item[\\W] Any token not matched by |\w|. % \end{l3regex-syntax} -% Of those, |.|, |\D|, |\H|, |\N|, |\S|, |\V|, and |\W| will match arbitrary +% Of those, |.|, |\D|, |\H|, |\N|, |\S|, |\V|, and |\W| match arbitrary % control sequences. % % Character classes match exactly one token in the subject. @@ -208,7 +258,7 @@ % or two |\W| tokens (including the boundary). % \item[\char`^ \textrm{or} \\A] % Start of the subject token list. -% \item[\char`$\textrm{,} \\Z \textrm{or} \\z] +% \item[\char`$\textrm{,} \\Z \textrm{or} \\z] ^^A $ % End of the subject token list. % \item[\\G] Start of the current match. This is only different from |^| % in the case of multiple matches: for instance @@ -225,7 +275,7 @@ % \item[(?:\ldots{})] Non-capturing group. % \item[(?\char`|\ldots{})] Non-capturing group which resets % the group number for capturing groups in each alternative. -% The following group will be numbered with the first unused +% The following group is numbered with the first unused % group number. % \end{l3regex-syntax} % @@ -335,12 +385,12 @@ % % Most of the features described in regular expressions do not make % sense within the replacement text. Backslash introduces various -% special constructions: +% special constructions, described further below: % \begin{itemize} % \item |\0| is the whole match; -% \item |\1|, |\2|, \ldots{}, |\9| or |\g{|\meta{number}|}| are the -% submatches (empty if there are fewer than \meta{number} capturing -% groups); +% \item |\1| is the submatch that was matched by the first (capturing) +% group |(...)|; similarly for |\2|, \ldots{}, |\9| and +% |\g{|\meta{number}|}|; % \item \verb*|\ | inserts a space (spaces are ignored when not % escaped); % \item |\a|, |\e|, |\f|, |\n|, |\r|, |\t|, |\xhh|, |\x{hhh}| @@ -363,8 +413,15 @@ % \end{verbatim} % results in \cs{l_my_tl} holding |H(ell--el)(o,--o) w(or--o)(ld--l)!| % -% Submatches always keep the same category codes as in the original -% token list. +% The submatches are numbered according to the order in which the +% opening parenthesis of capturing groups appear in the regular +% expression to match. The $n$-th submatch is empty if there are fewer +% than $n$ capturing groups or for capturing groups that appear in +% alternatives that were not used for the match. In case a capturing +% group matches several times during a match (due to quantifiers) only +% the last match is used in the replacement text. Submatches always keep +% the same category codes as in the original token list. +% % The characters inserted by the replacement have category code $12$ % (other) by default, with the exception of space characters. Spaces % inserted through \verb*|\ | have category code $10$, while spaces @@ -375,8 +432,9 @@ % \item[\\cX(\ldots{})] Produces the characters \enquote{\ldots{}} with % category~|X|, which must be one of |CBEMTPUDSLOA| as in regular % expressions. Parentheses are optional for a single character (which -% can be an escape sequence). This can be nested, for instance -% |\cL(Hello\cS\ world)!| +% can be an escape sequence). When nested, the innermost category +% code applies, for instance |\cL(Hello\cS\ world)!| gives this text +% with standard category codes. % \item[\\c\Arg{text}] Produces the control sequence with csname % \meta{text}. The \meta{text} may contain references to the % submatches |\0|, |\1|, and so on, as in the example for |\u| below. @@ -384,12 +442,11 @@ % % The escape sequence |\u|\Arg{tl~var~name} allows to insert the % contents of the token list with name \meta{tl~var~name} directly into -% the replacement, giving an easier control of category codes. -% Within |\c{|\ldots{}|}| and |\u{|\ldots{}|}| constructions, the |\u| -% and |\c|~escape sequences perform \cs{tl_to_str:v}, namely extract the -% value of the control sequence and turn it into a string. -% -% Matches can be used within the arguments of |\c| and |\u|. For +% the replacement, giving an easier control of category codes. When +% nested in |\c{|\ldots{}|}| and |\u{|\ldots{}|}| constructions, the +% |\u| and |\c|~escape sequences perform \cs{tl_to_str:v}, namely +% extract the value of the control sequence and turn it into a string. +% Matches can also be used within the arguments of |\c| and |\u|. For % instance, % \begin{verbatim} % \tl_set:Nn \l_my_one_tl { first } @@ -415,7 +472,7 @@ % \end{syntax} % Creates a new \meta{regex~var} or raises an error if the % name is already taken. The declaration is global. The -% \meta{regex~var} will initially be such that it never matches. +% \meta{regex~var} is initially such that it never matches. % \end{function} % % \begin{function}[added = 2017-05-26] @@ -432,7 +489,7 @@ % \end{verbatim} % The assignment is local for \cs{regex_set:Nn} and global for % \cs{regex_gset:Nn}. Use \cs{regex_const:Nn} for compiled expressions -% which will never change. +% which never change. % \end{function} % % \begin{function}[added = 2017-05-26]{\regex_show:n, \regex_show:N} @@ -502,26 +559,29 @@ % \cs{regex_extract_once:nnN} \Arg{regex} \Arg{token list} \meta{seq~var} % \cs{regex_extract_once:nnNTF} \Arg{regex} \Arg{token list} \meta{seq~var} \Arg{true code} \Arg{false code} % \end{syntax} -% Finds the first match of the \meta{regular expression} -% in the \meta{token list}. If it exists, the match is stored -% as the zeroeth item of the \meta{seq~var}, and further -% items are the contents of capturing groups, in the order -% of their opening parenthesis. The \meta{seq~var} -% is assigned locally. If there is no match, -% the \meta{seq~var} is cleared. -% The testing versions insert the \meta{true code} into the input -% stream if a match was found, and the \meta{false code} otherwise. +% Finds the first match of the \meta{regular expression} in the +% \meta{token list}. If it exists, the match is stored as the first +% item of the \meta{seq~var}, and further items are the contents of +% capturing groups, in the order of their opening parenthesis. The +% \meta{seq~var} is assigned locally. If there is no match, the +% \meta{seq~var} is cleared. The testing versions insert the +% \meta{true code} into the input stream if a match was found, and the +% \meta{false code} otherwise. +% % For instance, assume that you type % \begin{verbatim} % \regex_extract_once:nnNTF { \A(La)?TeX(!*)\Z } { LaTeX!!! } \l_foo_seq % { true } { false } % \end{verbatim} % Then the regular expression (anchored at the start with |\A| and -% at the end with |\Z|) will match the whole token list. The first +% at the end with |\Z|) must match the whole token list. The first % capturing group, |(La)?|, matches |La|, and the second capturing -% group, |(!*)|, matches |!!!|. Thus, |\l_foo_seq| will contain +% group, |(!*)|, matches |!!!|. Thus, |\l_foo_seq| contains as a result % the items |{LaTeX!!!}|, |{La}|, and |{!!!}|, and the \texttt{true} % branch is left in the input stream. +% Note that the $n$-th item of |\l_foo_seq|, as obtained using +% \cs{seq_item:Nn}, correspond to the submatch numbered $(n-1)$ in +% functions such as \cs{regex_replace_once:nnN}. % \end{function} % % \begin{function}[TF, added = 2017-05-26] @@ -543,7 +603,7 @@ % \regex_extract_all:nnNTF { \w+ } { Hello,~world! } \l_foo_seq % { true } { false } % \end{verbatim} -% Then the regular expression will match twice, and the resulting +% Then the regular expression matches twice, the resulting % sequence contains the two items |{Hello}| and |{world}|, % and the \texttt{true} branch is left in the input stream. % \end{function} @@ -607,15 +667,13 @@ % % The following need to be done now. % \begin{itemize} -% \item Change user function names! -% \item Clean up the use of messages. % \item Rewrite the documentation in a more ordered way, perhaps add a % \textsc{bnf}? % \end{itemize} % % Additional error-checking to come. % \begin{itemize} -% \item Currently, |a{\x34}| is recognized as |a{4}|. +% \item Clean up the use of messages. % \item Cleaner error reporting in the replacement phase. % \item Add tracing information. % \item Detect attempts to use back-references and other @@ -623,7 +681,6 @@ % \item Test for the maximum register \cs{c_max_register_int}. % \item Find out whether the fact that |\W| and friends match the % end-marker leads to bugs. Possibly update \cs{__regex_item_reverse:n}. -% \item Enforce that |\cC| can only be followed by a match-all dot. % \item The empty cs should be matched by |\c{}|, not by % |\c{csname.?endcsname\s?}|. % \end{itemize} @@ -679,13 +736,24 @@ % \item Unicode properties: |\p{..}| and |\P{..}|; % |\X| which should match any \enquote{extended} Unicode sequence. % This requires to manipulate a lot of data, probably using tree-boxes. +% \item Provide a syntax such as |\ur{l_my_regex}| to use an +% already-compiled regex in a more complicated regex. This makes +% regexes more easily composable. +% \item Allowing |\u{l_my_tl}| in more places, for instance as the +% number of repetitions in a quantifier. % \end{itemize} % % The following features of \textsc{pcre} or Perl may or may not be % implemented. % \begin{itemize} -% \item |\ddd|, matching the character with octal code \texttt{ddd}; -% \item Callout with |(?C...)|; +% \item Callout with |(?C...)| or other syntax: some internal code +% changes make that possible, and it can be useful for instance in +% the replacement code to stop a regex replacement when some marker +% has been found; this raises the question of a potential +% |\regex_break:| and then of playing well with \cs{tl_map_break:} +% called from within the code in a regex. It also raises the +% question of nested calls to the regex machinery, which is a +% problem since \tn{fontdimen} are global. % \item Conditional subpatterns (other than with a look-ahead or % look-behind condition): this is non-regular, isn't it? % \item Named subpatterns: \TeX{} programmers have lived so far @@ -695,21 +763,25 @@ % The following features of \textsc{pcre} or Perl will definitely not be % implemented. % \begin{itemize} -% \item |\cx|, similar to \TeX{}'s own |\^^x|; -% \item Comments: \TeX{} already has its own system for comments. -% \item |\Q...\E| escaping: this would require to read the argument -% verbatim, which is not in the scope of this module. +% \item Back-references: non-regular feature, this requires +% backtracking, which is prohibitively slow. +% \item Recursion: this is a non-regular feature. % \item Atomic grouping, possessive quantifiers: those tools, mostly % meant to fix catastrophic backtracking, are unnecessary in a % non-backtracking algorithm, and difficult to implement. % \item Subroutine calls: this syntactic sugar is difficult to include % in a non-backtracking algorithm, in particular because the % corresponding group should be treated as atomic. -% \item Recursion: this is a non-regular feature. -% \item Back-references: non-regular feature, this requires -% backtracking, which is prohibitively slow. % \item Backtracking control verbs: intrinsically tied to % backtracking. +% \item |\ddd|, matching the character with octal code \texttt{ddd}: +% we already have |\x{...}| and the syntax is confusingly close to +% what we could have used for backreferences (|\1|, |\2|, \ldots{}), +% making it harder to produce useful error message. +% \item |\cx|, similar to \TeX{}'s own |\^^x|. +% \item Comments: \TeX{} already has its own system for comments. +% \item |\Q...\E| escaping: this would require to read the argument +% verbatim, which is not in the scope of this module. % \item |\C| single byte in UTF-8 mode: Xe\TeX{} and Lua\TeX{} serve % us characters directly, and splitting those into bytes is tricky, % encoding dependent, and most likely not useful anyways. @@ -898,16 +970,16 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, rEXP]{\@@_current_cs_to_str:} +% \begin{macro}[int, rEXP]{\@@_curr_cs_to_str:} % Expands to the string representation of the token (known to be a -% control sequence) at the current position \cs{l_@@_current_pos_int}. +% control sequence) at the current position \cs{l_@@_curr_pos_int}. % It should only be used in \texttt{x}-expansion to avoid losing a % leading space. % \begin{macrocode} -\cs_new:Npn \@@_current_cs_to_str: +\cs_new:Npn \@@_curr_cs_to_str: { \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N - \tex_the:D \tex_toks:D \l_@@_current_pos_int + \tex_the:D \tex_toks:D \l_@@_curr_pos_int } % \end{macrocode} % \end{macro} @@ -1028,7 +1100,7 @@ % \begin{macro}[int]{\@@_item_reverse:n} % This function makes showing regular expressions easier, and lets us % define |\D| in terms of |\d| for instance. There is a subtlety: the -% end of the query is marked by $-2$, and will thus match |\D| and +% end of the query is marked by $-2$, and thus matches |\D| and % other negated properties; this case is caught by another part of % the code. % \begin{macrocode} @@ -1046,14 +1118,14 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_item_caseful_equal:n #1 { - \if_int_compare:w #1 = \l_@@_current_char_int + \if_int_compare:w #1 = \l_@@_curr_char_int \exp_after:wN \@@_break_true:w \fi: } \cs_new_protected:Npn \@@_item_caseful_range:nn #1 #2 { - \reverse_if:N \if_int_compare:w #1 > \l_@@_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l_@@_current_char_int + \reverse_if:N \if_int_compare:w #1 > \l_@@_curr_char_int + \reverse_if:N \if_int_compare:w #2 < \l_@@_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w \fi: \fi: @@ -1070,7 +1142,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_item_caseless_equal:n #1 { - \if_int_compare:w #1 = \l_@@_current_char_int + \if_int_compare:w #1 = \l_@@_curr_char_int \exp_after:wN \@@_break_true:w \fi: \if_int_compare:w \l_@@_case_changed_char_int = \c_max_int @@ -1082,8 +1154,8 @@ } \cs_new_protected:Npn \@@_item_caseless_range:nn #1 #2 { - \reverse_if:N \if_int_compare:w #1 > \l_@@_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l_@@_current_char_int + \reverse_if:N \if_int_compare:w #1 > \l_@@_curr_char_int + \reverse_if:N \if_int_compare:w #2 < \l_@@_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w \fi: \fi: @@ -1108,15 +1180,15 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_compute_case_changed_char: { - \int_set_eq:NN \l_@@_case_changed_char_int \l_@@_current_char_int - \if_int_compare:w \l_@@_current_char_int > `Z \exp_stop_f: - \if_int_compare:w \l_@@_current_char_int > `z \exp_stop_f: \else: - \if_int_compare:w \l_@@_current_char_int < `a \exp_stop_f: \else: + \int_set_eq:NN \l_@@_case_changed_char_int \l_@@_curr_char_int + \if_int_compare:w \l_@@_curr_char_int > `Z \exp_stop_f: + \if_int_compare:w \l_@@_curr_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l_@@_curr_char_int < `a \exp_stop_f: \else: \int_sub:Nn \l_@@_case_changed_char_int { \c_@@_ascii_lower_int } \fi: \fi: \else: - \if_int_compare:w \l_@@_current_char_int < `A \exp_stop_f: \else: + \if_int_compare:w \l_@@_curr_char_int < `A \exp_stop_f: \else: \int_add:Nn \l_@@_case_changed_char_int { \c_@@_ascii_lower_int } \fi: \fi: @@ -1146,7 +1218,7 @@ \cs_new_protected:Npn \@@_item_catcode: { " - \if_case:w \l_@@_current_catcode_int + \if_case:w \l_@@_curr_catcode_int 1 \or: 4 \or: 10 \or: 40 \or: 100 \or: \or: 1000 \or: 4000 \or: 10000 \or: \or: 100000 \or: 400000 @@ -1173,18 +1245,18 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_item_exact:nn #1#2 { - \if_int_compare:w #1 = \l_@@_current_catcode_int - \if_int_compare:w #2 = \l_@@_current_char_int + \if_int_compare:w #1 = \l_@@_curr_catcode_int + \if_int_compare:w #2 = \l_@@_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w \fi: \fi: } \cs_new_protected:Npn \@@_item_exact_cs:n #1 { - \int_compare:nNnTF \l_@@_current_catcode_int = 0 + \int_compare:nNnTF \l_@@_curr_catcode_int = 0 { \tl_set:Nx \l_@@_internal_a_tl - { \scan_stop: \@@_current_cs_to_str: \scan_stop: } + { \scan_stop: \@@_curr_cs_to_str: \scan_stop: } \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l_@@_internal_a_tl { \@@_break_true:w } { } } @@ -1205,10 +1277,10 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_item_cs:n #1 { - \int_compare:nNnT \l_@@_current_catcode_int = 0 + \int_compare:nNnT \l_@@_curr_catcode_int = 0 { \group_begin: - \tl_set:Nx \l_@@_cs_name_tl { \@@_current_cs_to_str: } + \tl_set:Nx \l_@@_cs_name_tl { \@@_curr_cs_to_str: } \@@_single_match: \@@_disable_submatches: \@@_build_for_cs:n {#1} @@ -1442,7 +1514,7 @@ \cs_new:cpn { @@_escape_/break:w } { \if_false: { \fi: } - \__msg_kernel_error:nn { regex } { trailing-backslash } + \__msg_kernel_error:nn { kernel } { trailing-backslash } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } \cs_new:cpn { @@_escape_~:w } { } @@ -1481,7 +1553,7 @@ { \if_false: { \fi: } \__tl_build_one:o \l_@@_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-overflow } {#1} + \__msg_kernel_error:nnx { kernel } { x-overflow } {#1} \tl_set:Nx \l_@@_internal_b_tl { \if_false: } \fi: } @@ -1570,7 +1642,7 @@ { \if_false: { \fi: } \__tl_build_one:o \l_@@_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-missing-rbrace } {#1} + \__msg_kernel_error:nnx { kernel } { x-missing-rbrace } {#1} \tl_set:Nx \l_@@_internal_b_tl { \if_false: } \fi: \@@_escape_loop:N #1 } @@ -1987,7 +2059,7 @@ \if_int_compare:w \l_@@_mode_int = \c_@@_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: - \__msg_kernel_error:nn { regex } { c-bad-mode } + \__msg_kernel_error:nn { kernel } { c-bad-mode } \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n \fi: \fi: @@ -2036,13 +2108,13 @@ { \@@_if_in_class:TF { - \__msg_kernel_error:nn { regex } { missing-rbrack } + \__msg_kernel_error:nn { kernel } { missing-rbrack } \use:c { @@_compile_]: } \prg_do_nothing: \prg_do_nothing: } { } \if_int_compare:w \l_@@_group_level_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { missing-rparen } + \__msg_kernel_error:nnx { kernel } { missing-rparen } { \int_use:N \l_@@_group_level_int } \prg_replicate:nn { \l_@@_group_level_int } @@ -2093,10 +2165,10 @@ \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \int_compare:nNnT \l_@@_mode_int = \c_@@_catcode_mode_int - { \__msg_kernel_error:nn { regex } { c-trailing } } + { \__msg_kernel_error:nn { kernel } { c-trailing } } \int_compare:nNnT \l_@@_mode_int < \c_@@_outer_mode_int { - \__msg_kernel_error:nn { regex } { c-missing-rbrace } + \__msg_kernel_error:nn { kernel } { c-missing-rbrace } \@@_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: @@ -2203,7 +2275,7 @@ \cs_new_protected:Npn \@@_compile_quantifier_abort:xNN #1#2#3 { \@@_compile_quantifier_none: - \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3} + \__msg_kernel_warning:nnxx { kernel } { invalid-quantifier } {#1} {#3} \@@_compile_abort_tokens:x {#1} #2 #3 } @@ -2316,7 +2388,7 @@ { #1 #2 } { \@@_compile_special:N \c_right_brace_str } { \if_int_compare:w \l_@@_internal_a_int > \l_@@_internal_b_int - \__msg_kernel_error:nnxx { regex } { backwards-quantifier } + \__msg_kernel_error:nnxx { kernel } { backwards-quantifier } { \int_use:N \l_@@_internal_a_int } { \int_use:N \l_@@_internal_b_int } \int_zero:N \l_@@_internal_b_int @@ -2350,7 +2422,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_compile_raw_error:N #1 { - \__msg_kernel_error:nnx { regex } { bad-escape } {#1} + \__msg_kernel_error:nnx { kernel } { bad-escape } {#1} \@@_compile_raw:N #1 } % \end{macrocode} @@ -2409,7 +2481,7 @@ \@@_if_end_range:NNTF #2 #3 { \if_int_compare:w `#1 > `#3 \exp_stop_f: - \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3} + \__msg_kernel_error:nnxx { kernel } { range-backwards } {#1} {#3} \else: \__tl_build_one:x { @@ -2423,7 +2495,7 @@ \fi: } { - \__msg_kernel_warning:nnxx { regex } { range-missing-end } + \__msg_kernel_warning:nnxx { kernel } { range-missing-end } {#1} { \c_backslash_str #3 } \__tl_build_one:x { @@ -2451,7 +2523,7 @@ } \cs_new_protected:cpn { @@_prop_.: } { - \if_int_compare:w \l_@@_current_char_int > - 2 \exp_stop_f: + \if_int_compare:w \l_@@_curr_char_int > - 2 \exp_stop_f: \exp_after:wN \@@_break_true:w \fi: } @@ -2613,7 +2685,7 @@ % \end{macro} % % \begin{macro}[aux]{\@@_compile_class_normal:w} -% In the \enquote{normal} case, we will insert \cs{@@_class:NnnnN} +% In the \enquote{normal} case, we insert \cs{@@_class:NnnnN} % \meta{boolean} in the compiled code. The \meta{boolean} is true for % positive classes, and false for negative classes, characterized by a % leading |^|. The auxiliary \cs{@@_compile_class:TFNN} also @@ -2701,8 +2773,8 @@ \str_case:nn { #2 } { : { \@@_compile_class_posix:NNNNw } - = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } } - . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } } + = { \__msg_kernel_warning:nnx { kernel } { posix-unsupported } { = } } + . { \__msg_kernel_warning:nnx { kernel } { posix-unsupported } { . } } } } \@@_compile_raw:N [ #1 #2 @@ -2741,7 +2813,7 @@ } } { - \__msg_kernel_warning:nnx { regex } { posix-unknown } + \__msg_kernel_warning:nnx { kernel } { posix-unknown } { \l_@@_internal_a_tl } \@@_compile_abort_tokens:x { @@ -2751,7 +2823,7 @@ } } { - \__msg_kernel_error:nnxx { regex } { posix-missing-close } + \__msg_kernel_error:nnxx { kernel } { posix-missing-close } { [: \l_@@_internal_a_tl } { #2 #4 } \@@_compile_abort_tokens:x { [: \l_@@_internal_a_tl } #1 #2 #3 #4 @@ -2793,7 +2865,7 @@ \__tl_build_one:o \l_@@_internal_regex \exp_after:wN \@@_compile_quantifier:w \else: - \__msg_kernel_warning:nn { regex } { extra-rparen } + \__msg_kernel_warning:nn { kernel } { extra-rparen } \exp_after:wN \@@_compile_raw:N \exp_after:wN ) \fi: } @@ -2817,7 +2889,7 @@ \cs_if_exist_use:cF { @@_compile_special_group_\token_to_str:N #4 :w } { - \__msg_kernel_warning:nnx { regex } { special-group-unknown } + \__msg_kernel_warning:nnx { kernel } { special-group-unknown } { (? #4 } \@@_compile_group_begin:N \@@_group:nnnN \@@_compile_raw:N ? #3 #4 @@ -2860,8 +2932,7 @@ % \begin{macro}[aux]{\@@_compile_special_group_::w} % \begin{macro}[aux]+\@@_compile_special_group_|:w+ % Non-capturing, and resetting groups are easy to take care of during -% compilation; for those groups, the harder parts will come when -% building. +% compilation; for those groups, the harder parts come when building. % \begin{macrocode} \cs_new_protected:cpn { @@_compile_special_group_::w } { \@@_compile_group_begin:N \@@_group_no_capture:nnnN } @@ -2885,7 +2956,7 @@ \cs_set:Npn \@@_item_range:nn { \@@_item_caseless_range:nn } } { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 } + \__msg_kernel_warning:nnx { kernel } { unknown-option } { (?i #2 } \@@_compile_raw:N ( \@@_compile_raw:N ? \@@_compile_raw:N i @@ -2901,7 +2972,7 @@ \cs_set:Npn \@@_item_range:nn { \@@_item_caseful_range:nn } } { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 } + \__msg_kernel_warning:nnx { kernel } { unknown-option } { (?-#2#4 } \@@_compile_raw:N ( \@@_compile_raw:N ? \@@_compile_raw:N - @@ -2934,17 +3005,38 @@ \else: \c_@@_catcode_in_class_mode_int \fi: + \token_if_eq_charcode:NNT C #2 { \@@_compile_c_C:NN } } } { \cs_if_exist_use:cF { @@_compile_c_#2:w } } { - \__msg_kernel_error:nnx { regex } { c-missing-category } {#2} + \__msg_kernel_error:nnx { kernel } { c-missing-category } {#2} #1 #2 } } % \end{macrocode} % \end{macro} % +% \begin{macro}[aux]{\@@_compile_c_C:NN} +% If |\cC| is not followed by |.| or |(...)| then complain because +% that construction cannot match anything, except in cases like +% |\cC[\c{...}]|, where it has no effect. +% \begin{macrocode} +\cs_new_protected:Npn \@@_compile_c_C:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \@@_compile_special:N + { + \token_if_eq_charcode:NNTF #2 . + { \use_none:n } + { \token_if_eq_charcode:NNF #2 ( } % ) + } + { \use:n } + { \__msg_kernel_error:nnn { kernel } { c-C-invalid } {#2} } + #1 #2 + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[aux] % { % \@@_compile_c_[:w, @@ -2992,7 +3084,7 @@ { \@@_compile_c_lbrack_end: } } { - \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2} + \__msg_kernel_error:nnx { kernel } { c-missing-rbrack } {#2} \@@_compile_c_lbrack_end: #1 #2 } @@ -3121,8 +3213,8 @@ % catcode test. Otherwise, it must be followed by a left brace. We % then collect the characters for the argument of |\u| within an % \texttt{x}-expanding assignment. In principle we could just wait to -% encounter a right brace, but this is unsafe: if the right brace is -% missing, then we will reach the end-markers of the regex, and +% encounter a right brace, but this is unsafe: if the right brace was +% missing, then we would reach the end-markers of the regex, and % continue, leading to obscure fatal errors. Instead, we only allow % raw and special characters, and stop when encountering a special % right brace, any escaped character, or the end-marker. @@ -3138,7 +3230,7 @@ \@@_compile_u_loop:NN } { - \__msg_kernel_error:nn { regex } { u-missing-lbrace } + \__msg_kernel_error:nn { kernel } { u-missing-lbrace } \@@_compile_raw:N u #1 #2 } } @@ -3156,7 +3248,7 @@ } { \if_false: { \fi: } - \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2} + \__msg_kernel_error:nnx { kernel } { u-missing-rbrace } {#2} \@@_compile_u_end: #1 #2 } @@ -3508,8 +3600,8 @@ % \end{variable} % % \begin{variable}{\l_@@_capturing_group_int} -% \cs{l_@@_capturing_group_int} is the \textsc{id} number that will -% be assigned to a capturing group if one was opened now. This starts +% \cs{l_@@_capturing_group_int} is the next \textsc{id} number to +% be assigned to a capturing group. This starts % at $0$ for the group enclosing the full regular expression, and % groups are counted in the order of their left parenthesis, except % when encountering \texttt{resetting} groups. @@ -3548,8 +3640,8 @@ % We strive to preserve the following properties while building. % \begin{itemize} % \item The current capturing group is -% $\text{\texttt{capturing_group}}-1$, and if a group is opened now, -% it will be labelled \texttt{capturing_group}. +% $\text{\texttt{capturing_group}}-1$, and if a group opened now +% it would be labelled \texttt{capturing_group}. % \item The last allocated state is $\text{\texttt{max_state}}-1$, so % \texttt{max_state} is a free state. % \item The \texttt{left_state} points to a state to the left of the @@ -3564,7 +3656,7 @@ % The \texttt{n}-type function first compiles its argument. Reset some % variables. Allocate two states, and put a wildcard in state $0$ % (transitions to state $1$ and $0$ state). Then build the regex -% within a (capturing) group, which will be numbered $0$ (current +% within a (capturing) group numbered $0$ (current % value of \texttt{capturing_group}). Finally, if the match reaches the % last state, it is successful. % \begin{macrocode} @@ -3610,7 +3702,7 @@ \@@_pop_lr_states: \@@_toks_put_right:Nn \l_@@_right_state_int { - \if_int_compare:w \l_@@_current_pos_int = \l_@@_max_pos_int + \if_int_compare:w \l_@@_curr_pos_int = \l_@@_max_pos_int \exp_after:wN \@@_action_success: \fi: } @@ -3821,7 +3913,7 @@ % building the group, so that the thread which skips the group does % not also set the start-point of the submatch. After adding one more % state, the \texttt{left_state} is the left end of the group, from -% which all branches will stem, and the \texttt{right_state} is the +% which all branches stem, and the \texttt{right_state} is the % right end of the group, and all branches end their course in that % state. We store those two integers to be queried for each branch, we % build the \textsc{nfa} states for the contents |#2| of the group, @@ -3974,7 +4066,7 @@ % \begin{macro}[aux]{\@@_group_repeat_aux:n} % Here we repeat \tn{toks} ranging from \texttt{left_state} to % \texttt{max_state}, $|#1|>0$ times. First add a transition so that -% the copies will \enquote{chain} properly. Compute the shift +% the copies \enquote{chain} properly. Compute the shift % \texttt{c} between the original copy and the last copy we % want. Shift the \texttt{right_state} and \texttt{max_state} to their % final values. We then want to perform \texttt{c} copy operations. At @@ -4145,14 +4237,14 @@ } \cs_new_protected:Npn \@@_anchor:N #1 { - \if_int_compare:w #1 = \l_@@_current_pos_int + \if_int_compare:w #1 = \l_@@_curr_pos_int \exp_after:wN \@@_break_true:w \fi: } \cs_new_protected:Npn \@@_b_test: { \group_begin: - \int_set_eq:NN \l_@@_current_char_int \l_@@_last_char_int + \int_set_eq:NN \l_@@_curr_char_int \l_@@_last_char_int \@@_prop_w: \@@_break_point:TF { \group_end: \@@_item_reverse:n \@@_prop_w: } @@ -4189,15 +4281,15 @@ % transitions, the instruction at the new state of the \textsc{nfa} is % performed immediately. When a transition consumes a character, the % new state is appended to a list of \enquote{active states}, stored in -% \cs{g_@@_thread_state_intarray}: this thread will be active again when the next +% \cs{g_@@_thread_state_intarray}: this thread is made active again when the next % token is read from the query. At every step (for each token in the % query), we unpack that list of active states and the corresponding % submatch props, and empty those. % % If two paths through the \textsc{nfa} \enquote{collide} in the sense % that they reach the same state after reading a given token, then they -% only differ in how they previously matched, and the future execution -% will be identical for both. (Note that this would be wrong in the +% only differ in how they previously matched, and any future execution +% would be identical for both. (Note that this would be wrong in the % presence of back-references.) Hence, we only need to keep one of the % two threads: the thread with the highest priority. Our \textsc{nfa} is % built in such a way that higher priority actions always come before @@ -4217,7 +4309,7 @@ % We solve this by distinguishing \enquote{normal} free transitions % \cs{@@_action_free:n} from transitions % \cs{@@_action_free_group:n} which go back to the start of the -% group. The former will keep threads unless they have been visited by a +% group. The former keeps threads unless they have been visited by a % \enquote{completed} thread, while the latter kind of transition also % prevents going back to a state visited by the current thread. % @@ -4227,7 +4319,7 @@ % { % \l_@@_min_pos_int, % \l_@@_max_pos_int, -% \l_@@_current_pos_int, +% \l_@@_curr_pos_int, % \l_@@_start_pos_int, % \l_@@_success_pos_int, % } @@ -4244,7 +4336,7 @@ % \begin{macrocode} \int_new:N \l_@@_min_pos_int \int_new:N \l_@@_max_pos_int -\int_new:N \l_@@_current_pos_int +\int_new:N \l_@@_curr_pos_int \int_new:N \l_@@_start_pos_int \int_new:N \l_@@_success_pos_int % \end{macrocode} @@ -4252,8 +4344,8 @@ % % \begin{variable} % { -% \l_@@_current_char_int, -% \l_@@_current_catcode_int, +% \l_@@_curr_char_int, +% \l_@@_curr_catcode_int, % \l_@@_last_char_int, % \l_@@_case_changed_char_int % } @@ -4265,25 +4357,25 @@ % \texttt{current_char} variable is also used in various other phases % to hold a character code. % \begin{macrocode} -\int_new:N \l_@@_current_char_int -\int_new:N \l_@@_current_catcode_int +\int_new:N \l_@@_curr_char_int +\int_new:N \l_@@_curr_catcode_int \int_new:N \l_@@_last_char_int \int_new:N \l_@@_case_changed_char_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_current_state_int} +% \begin{variable}{\l_@@_curr_state_int} % For every character in the token list, each of the active states is -% considered in turn. The variable \cs{l_@@_current_state_int} +% considered in turn. The variable \cs{l_@@_curr_state_int} % holds the state of the \textsc{nfa} which is currently considered: % transitions are then given as shifts relative to the current state. % \begin{macrocode} -\int_new:N \l_@@_current_state_int +\int_new:N \l_@@_curr_state_int % \end{macrocode} % \end{variable} % % \begin{variable} -% {\l_@@_current_submatches_prop, \l_@@_success_submatches_prop} +% {\l_@@_curr_submatches_prop, \l_@@_success_submatches_prop} % The submatches for the thread which is currently active are stored % in the \texttt{current_submatches} property list variable. This % property list is stored by \cs{@@_action_cost:n} into the @@ -4291,9 +4383,9 @@ % retrieved when matching at the next position. When a thread % succeeds, this property list is copied to % \cs{l_@@_success_submatches_prop}: only the last successful thread -% will remain there. +% remains there. % \begin{macrocode} -\prop_new:N \l_@@_current_submatches_prop +\prop_new:N \l_@@_curr_submatches_prop \prop_new:N \l_@@_success_submatches_prop % \end{macrocode} % \end{variable} @@ -4334,7 +4426,7 @@ % \begin{variable}{\g_@@_state_active_intarray, \g_@@_thread_state_intarray} % \cs{g_@@_state_active_intarray} stores the last \meta{step} in which % each \meta{state} was active. \cs{g_@@_thread_state_intarray} stores -% threads that will be considered in the next step, more precisely the +% threads to be considered in the next step, more precisely the % states in which these threads are. % \begin{macrocode} \__intarray_new:Nn \g_@@_state_active_intarray { 65536 } @@ -4415,12 +4507,12 @@ %<trace> \trace_push:nnx { regex } { 1 } { @@_match } %<trace> \trace:nnx { regex } { 1 } { analyzing~query~token~list } \int_zero:N \l_@@_balance_int - \int_set:Nn \l_@@_current_pos_int { 2 * \l_@@_max_state_int } + \int_set:Nn \l_@@_curr_pos_int { 2 * \l_@@_max_state_int } \@@_query_set:nnn { } { -1 } { -2 } - \int_set_eq:NN \l_@@_min_pos_int \l_@@_current_pos_int + \int_set_eq:NN \l_@@_min_pos_int \l_@@_curr_pos_int \__tl_analysis_map_inline:nn {#1} { \@@_query_set:nnn {##1} {"##2} {##3} } - \int_set_eq:NN \l_@@_max_pos_int \l_@@_current_pos_int + \int_set_eq:NN \l_@@_max_pos_int \l_@@_curr_pos_int \@@_query_set:nnn { } { -1 } { -2 } %<trace> \trace:nnx { regex } { 1 } { initializing } \bool_gset_false:N \g_@@_success_bool @@ -4449,8 +4541,8 @@ % successful, and has no submatches yet; clear the array of active % threads, and put the starting state $0$ in it. We are then almost % ready to read our first token in the query, but we actually start -% one position earlier than the start, and \texttt{get} that token, so -% that the \texttt{last_char} will be set properly for word +% one position earlier than the start, and \texttt{get} that token, to +% set \texttt{last_char} properly for word % boundaries. Then call \cs{@@_match_loop:}, which runs through the % query until the end or until a successful match breaks early. % \begin{macrocode} @@ -4458,16 +4550,16 @@ { \if_meaning:w \c_true_bool \l_@@_empty_success_bool \cs_set:Npn \@@_if_two_empty_matches:F - { \int_compare:nNnF \l_@@_start_pos_int = \l_@@_current_pos_int } + { \int_compare:nNnF \l_@@_start_pos_int = \l_@@_curr_pos_int } \else: \cs_set_eq:NN \@@_if_two_empty_matches:F \use:n \fi: \int_set_eq:NN \l_@@_start_pos_int \l_@@_success_pos_int \bool_set_false:N \l_@@_match_success_bool - \prop_clear:N \l_@@_current_submatches_prop + \prop_clear:N \l_@@_curr_submatches_prop \int_set_eq:NN \l_@@_max_active_int \l_@@_min_active_int \@@_store_state:n { \l_@@_min_state_int } - \int_set:Nn \l_@@_current_pos_int + \int_set:Nn \l_@@_curr_pos_int { \l_@@_start_pos_int - 1 } \@@_query_get: \@@_match_loop: @@ -4518,8 +4610,8 @@ \cs_new_protected:Npn \@@_match_loop: { \int_add:Nn \l_@@_step_int { 2 } - \int_incr:N \l_@@_current_pos_int - \int_set_eq:NN \l_@@_last_char_int \l_@@_current_char_int + \int_incr:N \l_@@_curr_pos_int + \int_set_eq:NN \l_@@_last_char_int \l_@@_curr_char_int \int_set_eq:NN \l_@@_case_changed_char_int \c_max_int \@@_query_get: \use:x @@ -4534,7 +4626,7 @@ \__prg_break_point: \bool_set_false:N \l_@@_fresh_thread_bool %^^A was arg of break_point:n \if_int_compare:w \l_@@_max_active_int > \l_@@_min_active_int - \if_int_compare:w \l_@@_current_pos_int < \l_@@_max_pos_int + \if_int_compare:w \l_@@_curr_pos_int < \l_@@_max_pos_int \exp_after:wN \exp_after:wN \exp_after:wN \@@_match_loop: \fi: \fi: @@ -4559,13 +4651,13 @@ \cs_new_protected:Npn \@@_query_set:nnn #1#2#3 { \__intarray_gset_fast:Nnn \g_@@_charcode_intarray - { \l_@@_current_pos_int } {#3} + { \l_@@_curr_pos_int } {#3} \__intarray_gset_fast:Nnn \g_@@_catcode_intarray - { \l_@@_current_pos_int } {#2} + { \l_@@_curr_pos_int } {#2} \__intarray_gset_fast:Nnn \g_@@_balance_intarray - { \l_@@_current_pos_int } { \l_@@_balance_int } - \@@_toks_set:Nn \l_@@_current_pos_int {#1} - \int_incr:N \l_@@_current_pos_int + { \l_@@_curr_pos_int } { \l_@@_balance_int } + \@@_toks_set:Nn \l_@@_curr_pos_int {#1} + \int_incr:N \l_@@_curr_pos_int \if_case:w #2 \exp_stop_f: \or: \int_incr:N \l_@@_balance_int \or: \int_decr:N \l_@@_balance_int @@ -4580,12 +4672,12 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_query_get: { - \l_@@_current_char_int + \l_@@_curr_char_int = \__intarray_item_fast:Nn \g_@@_charcode_intarray - { \l_@@_current_pos_int } \scan_stop: - \l_@@_current_catcode_int + { \l_@@_curr_pos_int } \scan_stop: + \l_@@_curr_catcode_int = \__intarray_item_fast:Nn \g_@@_catcode_intarray - { \l_@@_current_pos_int } \scan_stop: + { \l_@@_curr_pos_int } \scan_stop: } % \end{macrocode} % \end{macro} @@ -4603,13 +4695,13 @@ \cs_new_protected:Npn \@@_use_state: { %<*trace> - \trace:nnx { regex } { 2 } { state~\int_use:N \l_@@_current_state_int } + \trace:nnx { regex } { 2 } { state~\int_use:N \l_@@_curr_state_int } %</trace> \__intarray_gset_fast:Nnn \g_@@_state_active_intarray - { \l_@@_current_state_int } { \l_@@_step_int } - \@@_toks_use:w \l_@@_current_state_int + { \l_@@_curr_state_int } { \l_@@_step_int } + \@@_toks_use:w \l_@@_curr_state_int \__intarray_gset_fast:Nnn \g_@@_state_active_intarray - { \l_@@_current_state_int } { \l_@@_step_int + 1 } + { \l_@@_curr_state_int } { \l_@@_step_int + 1 } } % \end{macrocode} % \end{macro} @@ -4622,12 +4714,12 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_use_state_and_submatches:nn #1 #2 { - \int_set:Nn \l_@@_current_state_int {#1} + \int_set:Nn \l_@@_curr_state_int {#1} \if_int_compare:w \__intarray_item_fast:Nn \g_@@_state_active_intarray - { \l_@@_current_state_int } + { \l_@@_curr_state_int } < \l_@@_step_int - \tl_set:Nn \l_@@_current_submatches_prop {#2} + \tl_set:Nn \l_@@_curr_submatches_prop {#2} \exp_after:wN \@@_use_state: \fi: \scan_stop: @@ -4661,12 +4753,12 @@ % state has not already been used at this position. If not, store % submatches in the new state, and insert the instructions for that % state in the input stream. Then restore the old value of -% \cs{l_@@_current_state_int} and of the current submatches. The +% \cs{l_@@_curr_state_int} and of the current submatches. The % two types of free transitions differ by how they test that the state % has not been encountered yet: the \texttt{group} version is % stricter, and will not use a state if it was used earlier in the % current thread, hence forcefully breaking the loop, while the -% \enquote{normal} version will revisit a state when within the thread +% \enquote{normal} version will revisit a state even within the thread % itself. % \begin{macrocode} \cs_new_protected:Npn \@@_action_free:n @@ -4677,20 +4769,20 @@ { \use:x { - \int_add:Nn \l_@@_current_state_int {#2} + \int_add:Nn \l_@@_curr_state_int {#2} \exp_not:n { \if_int_compare:w \__intarray_item_fast:Nn \g_@@_state_active_intarray - { \l_@@_current_state_int } + { \l_@@_curr_state_int } #1 \exp_after:wN \@@_use_state: \fi: } - \int_set:Nn \l_@@_current_state_int - { \int_use:N \l_@@_current_state_int } - \tl_set:Nn \exp_not:N \l_@@_current_submatches_prop - { \exp_not:o \l_@@_current_submatches_prop } + \int_set:Nn \l_@@_curr_state_int + { \int_use:N \l_@@_curr_state_int } + \tl_set:Nn \exp_not:N \l_@@_curr_submatches_prop + { \exp_not:o \l_@@_curr_submatches_prop } } } % \end{macrocode} @@ -4706,7 +4798,7 @@ \cs_new_protected:Npn \@@_action_cost:n #1 { \exp_args:No \@@_store_state:n - { \__int_value:w \__int_eval:w \l_@@_current_state_int + #1 } + { \__int_value:w \__int_eval:w \l_@@_curr_state_int + #1 } } % \end{macrocode} % \end{macro} @@ -4727,7 +4819,7 @@ \cs_new_protected:Npn \@@_store_submatches: { \@@_toks_set:No \l_@@_max_active_int - { \l_@@_current_submatches_prop } + { \l_@@_curr_submatches_prop } } % \end{macrocode} % \end{macro} @@ -4753,8 +4845,8 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_action_submatch:n #1 { - \prop_put:Nno \l_@@_current_submatches_prop {#1} - { \int_use:N \l_@@_current_pos_int } + \prop_put:Nno \l_@@_curr_submatches_prop {#1} + { \int_use:N \l_@@_curr_pos_int } } % \end{macrocode} % \end{macro} @@ -4776,9 +4868,9 @@ \bool_set_true:N \l_@@_match_success_bool \bool_set_eq:NN \l_@@_empty_success_bool \l_@@_fresh_thread_bool - \int_set_eq:NN \l_@@_success_pos_int \l_@@_current_pos_int + \int_set_eq:NN \l_@@_success_pos_int \l_@@_curr_pos_int \prop_set_eq:NN \l_@@_success_submatches_prop - \l_@@_current_submatches_prop + \l_@@_curr_submatches_prop \__prg_break: } } @@ -4844,7 +4936,7 @@ % replacement text. Hence concatenating the result of this function % with all possible arguments (one call for each match), as well as % the range from the end of the last match to the end of the string, -% will produce the fully replaced token list. The initialization does +% produces the fully replaced token list. The initialization does % not matter, but (as an example) we set it as for an empty replacement. % \begin{macrocode} \cs_new:Npn \@@_replacement_do_one_match:n #1 @@ -4879,7 +4971,7 @@ % exclusive. The function \cs{@@_query_range:nn} \Arg{min} % \Arg{max} unpacks registers from the position \meta{min} to the % position $\meta{max}-1$ included. Once this is expanded, a second -% \texttt{x}-expansion will result in the actual tokens from the +% \texttt{x}-expansion results in the actual tokens from the % query. That second expansion is only done by user functions at the % very end of their operation, after checking (and correcting) the % brace balance first. @@ -4956,7 +5048,7 @@ % The replacement text is built incrementally by abusing \tn{toks} % within a group (see \pkg{l3tl-build}). We keep track in % \cs{l_@@_balance_int} of the balance of explicit begin- and -% end-group tokens and \cs{l_@@_balance_tl} will consist of some +% end-group tokens and we store in \cs{l_@@_balance_tl} some % code to compute the brace balance from submatches (see its % description). Detect unescaped right braces, and escaped characters, % with trailing \cs{prg_do_nothing:} because some of the later @@ -4984,14 +5076,14 @@ {#1} \prg_do_nothing: \prg_do_nothing: \if_int_compare:w \l_@@_replacement_csnames_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } + \__msg_kernel_error:nnx { kernel } { replacement-missing-rbrace } { \int_use:N \l_@@_replacement_csnames_int } \__tl_build_one:x { \prg_replicate:nn \l_@@_replacement_csnames_int \cs_end: } \fi: \seq_if_empty:NF \l_@@_replacement_category_seq { - \__msg_kernel_error:nnx { regex } { replacement-missing-rparen } + \__msg_kernel_error:nnx { kernel } { replacement-missing-rparen } { \seq_count:N \l_@@_replacement_category_seq } \seq_clear:N \l_@@_replacement_category_seq } @@ -5076,7 +5168,7 @@ % submatch number is larger than the number of capturing groups. % Unless the submatch appears inside a |\c{...}| or |\u{...}| % construction, it must be taken into account in the brace balance. -% Here, |##1| will receive a pointer to the $0$-th submatch for a +% Later on, |##1| will be replaced by a pointer to the $0$-th submatch for a % given match. We cannot use \cs{int_eval:n} because it is % expandable, and would be expanded too early (short of adding % \cs{exp_not:N}, making the code messy again). @@ -5163,7 +5255,7 @@ % \end{macro} % % \begin{macro}[aux]{\@@_replacement_cu_aux:Nw} -% Start a control sequence with \cs{cs:w}, which will be protected +% Start a control sequence with \cs{cs:w}, protected % from expansion by |#1| (either \cs{@@_replacement_exp_not:N} or % \cs{exp_not:V}), or turned to a string by \cs{tl_to_str:V} if inside % another csname construction |\c| or |\u|. We use \cs{tl_to_str:V} @@ -5226,12 +5318,12 @@ \cs_new_protected:Npn \@@_replacement_cat:NNN #1#2#3 { \token_if_eq_meaning:NNTF \prg_do_nothing: #3 - { \__msg_kernel_error:nn { regex } { replacement-catcode-end } } + { \__msg_kernel_error:nn { kernel } { replacement-catcode-end } } { \int_compare:nNnTF { \l_@@_replacement_csnames_int } > 0 { \__msg_kernel_error:nnnn - { regex } { replacement-catcode-in-cs } {#1} {#3} + { kernel } { replacement-catcode-in-cs } {#1} {#3} #2 #3 } { @@ -5241,14 +5333,26 @@ \l_@@_replacement_category_tl \tl_set:Nn \l_@@_replacement_category_tl {#1} } - { \use:c { @@_replacement_c_#1:w } #2 #3 } + { + \token_if_eq_meaning:NNT #2 \@@_replacement_escaped:N + { + \@@_char_if_alphanumeric:NTF #3 + { + \__msg_kernel_error:nnnn + { kernel } { replacement-catcode-escaped } + {#1} {#3} + } + { } + } + \use:c { @@_replacement_c_#1:w } #2 #3 + } } } } % \end{macrocode} % \end{macro} % -% We will need to change the category code of the null character many +% We now need to change the category code of the null character many % times, hence work in a group. The catcode-specific macros below are % defined in alphabetical order; if you are trying to understand the % code, start from the end of the alphabet as those categories are @@ -5396,7 +5500,7 @@ \cs_new_protected:Npn \@@_replacement_c_S:w #1#2 { \if_int_compare:w `#2 = 0 \exp_stop_f: - \__msg_kernel_error:nn { regex } { replacement-null-space } + \__msg_kernel_error:nn { kernel } { replacement-null-space } \fi: \tex_lccode:D `\ = `#2 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {~} } @@ -5439,7 +5543,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_replacement_error:NNN #1#2#3 { - \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3} + \__msg_kernel_error:nnx { kernel } { replacement-#1 } {#3} #2 #3 } % \end{macrocode} @@ -5733,7 +5837,7 @@ } #1 \@@_match:n {#2} -%<assert>\assert_int:n { \l_@@_current_pos_int = \l_@@_max_pos_int } +%<assert>\assert_int:n { \l_@@_curr_pos_int = \l_@@_max_pos_int } \__intarray_gset_fast:Nnn \g_@@_submatch_prev_intarray { \l_@@_submatch_int } { 0 } \__intarray_gset_fast:Nnn \g_@@_submatch_end_intarray @@ -5781,7 +5885,7 @@ { \flag_height:n { @@_begin } + \flag_height:n { @@_end } } = 0 { - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + \__msg_kernel_error:nnxxx { kernel } { result-unbalanced } { splitting~or~extracting~submatches } { \flag_height:n { @@_end } } { \flag_height:n { @@_begin } } @@ -5972,7 +6076,7 @@ { \if_int_compare:w \l_@@_balance_int = 0 \exp_stop_f: \else: - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + \__msg_kernel_error:nnxxx { kernel } { result-unbalanced } { replacing } { \int_max:nn { - \l_@@_balance_int } { 0 } } { \int_max:nn { \l_@@_balance_int } { 0 } } @@ -6003,20 +6107,20 @@ % % Messages for the preparsing phase. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { trailing-backslash } +\__msg_kernel_new:nnnn { kernel } { trailing-backslash } { Trailing~escape~character~'\iow_char:N\\'. } { A~regular~expression~or~its~replacement~text~ends~with~ the~escape~character~'\iow_char:N\\'.~It~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { x-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { x-missing-rbrace } { Missing~closing~brace~in~'\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ '\iow_char:N\\x\{...#1'.~ The~closing~brace~is~missing. } -\__msg_kernel_new:nnnn { regex } { x-overflow } +\__msg_kernel_new:nnnn { kernel } { x-overflow } { Character~code~'#1'~too~large~in~'\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ @@ -6028,7 +6132,7 @@ % % Invalid quantifier. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { invalid-quantifier } +\__msg_kernel_new:nnnn { kernel } { invalid-quantifier } { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. } { The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~ @@ -6040,13 +6144,13 @@ % Messages for missing or extra closing brackets and parentheses, with % some fancy singular/plural handling for the case of parentheses. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { missing-rbrack } +\__msg_kernel_new:nnnn { kernel } { missing-rbrack } { Missing~right~bracket~inserted~in~regular~expression. } { LaTeX~was~given~a~regular~expression~where~a~character~class~ was~started~with~'[',~but~the~matching~']'~is~missing. } -\__msg_kernel_new:nnnn { regex } { missing-rparen } +\__msg_kernel_new:nnnn { kernel } { missing-rparen } { Missing~right~ \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~ @@ -6056,7 +6160,7 @@ LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~ more~left~parentheses~than~right~parentheses. } -\__msg_kernel_new:nnnn { regex } { extra-rparen } +\__msg_kernel_new:nnnn { kernel } { extra-rparen } { Extra~right~parenthesis~ignored~in~regular~expression. } { LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~ @@ -6066,7 +6170,7 @@ % % Some escaped alphanumerics are not allowed everywhere. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { bad-escape } +\__msg_kernel_new:nnnn { kernel } { bad-escape } { Invalid~escape~'\iow_char:N\\#1'~ \@@_if_in_cs:TF { within~a~control~sequence. } @@ -6094,14 +6198,14 @@ % % Range errors. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { range-missing-end } +\__msg_kernel_new:nnnn { kernel } { range-missing-end } { Invalid~end-point~for~range~'#1-#2'~in~character~class. } { The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~ end-point~for~a~range:~alphanumeric~characters~should~not~be~ escaped,~and~non-alphanumeric~characters~should~be~escaped. } -\__msg_kernel_new:nnnn { regex } { range-backwards } +\__msg_kernel_new:nnnn { kernel } { range-backwards } { Range~'[#1-#2]'~out~of~order~in~character~class. } { In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~ @@ -6113,27 +6217,34 @@ % % Errors related to |\c| and |\u|. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { c-bad-mode } +\__msg_kernel_new:nnnn { kernel } { c-bad-mode } { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. } { The~'\iow_char:N\\c'~escape~cannot~be~used~within~ a~control~sequence~test~'\iow_char:N\\c{...}'.~ To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'. } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { c-C-invalid } + { '\iow_char:N\\cC'~should~be~followed~by~'.'~or~'(',~not~'#1'. } + { + The~'\iow_char:N\\cC'~construction~restricts~the~next~item~to~be~a~ + control~sequence~or~the~next~group~to~be~made~of~control~sequences.~ + It~only~makes~sense~to~follow~it~by~'.'~or~by~a~group. + } +\__msg_kernel_new:nnnn { kernel } { c-missing-rbrace } { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. } { LaTeX~was~given~a~regular~expression~where~a~ '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~ with~a~closing~brace~'\iow_char:N\}'. } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrack } +\__msg_kernel_new:nnnn { kernel } { c-missing-rbrack } { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. } { A~construction~'\iow_char:N\\c[...'~appears~in~a~ regular~expression,~but~the~closing~']'~is~not~present. } -\__msg_kernel_new:nnnn { regex } { c-missing-category } +\__msg_kernel_new:nnnn { kernel } { c-missing-category } { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. } { In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~ @@ -6141,19 +6252,19 @@ capital~letter~representing~a~character~category,~namely~ one~of~'ABCDELMOPSTU'. } -\__msg_kernel_new:nnnn { regex } { c-trailing } +\__msg_kernel_new:nnnn { kernel } { c-trailing } { Trailing~category~code~escape~'\iow_char:N\\c'... } { A~regular~expression~ends~with~'\iow_char:N\\c'~followed~ by~a~letter.~It~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { u-missing-lbrace } +\__msg_kernel_new:nnnn { kernel } { u-missing-lbrace } { Missing~left~brace~following~'\iow_char:N\\u'~escape. } { The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~ a~brace~group~with~the~name~of~the~variable~to~use. } -\__msg_kernel_new:nnnn { regex } { u-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { u-missing-rbrace } { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. } { LaTeX~ @@ -6166,14 +6277,14 @@ % % Errors when encountering the \textsc{posix} syntax |[:...:]|. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { posix-unsupported } +\__msg_kernel_new:nnnn { kernel } { posix-unsupported } { POSIX~collating~element~'[#1 ~ #1]'~not~supported. } { The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~ in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~ Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class? } -\__msg_kernel_new:nnnn { regex } { posix-unknown } +\__msg_kernel_new:nnnn { kernel } { posix-unknown } { POSIX~class~'[:#1:]'~unknown. } { '[:#1:]'~is~not~among~the~known~POSIX~classes~ @@ -6182,7 +6293,7 @@ '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~ '[:word:]',~and~'[:xdigit:]'. } -\__msg_kernel_new:nnnn { regex } { posix-missing-close } +\__msg_kernel_new:nnnn { kernel } { posix-missing-close } { Missing~closing~':]'~for~POSIX~class. } { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. } % \end{macrocode} @@ -6191,7 +6302,7 @@ % with an unbalanced token list, which we must re-balance by adding % begin-group or end-group character tokens. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { result-unbalanced } +\__msg_kernel_new:nnnn { kernel } { result-unbalanced } { Missing~brace~inserted~when~#1. } { LaTeX~was~asked~to~do~some~regular~expression~operation,~ @@ -6203,13 +6314,13 @@ % % Error message for unknown options. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { unknown-option } +\__msg_kernel_new:nnnn { kernel } { unknown-option } { Unknown~option~'#1'~for~regular~expressions. } { The~only~available~option~is~'case-insensitive',~toggled~by~ '(?i)'~and~'(?-i)'. } -\__msg_kernel_new:nnnn { regex } { special-group-unknown } +\__msg_kernel_new:nnnn { kernel } { special-group-unknown } { Unknown~special~group~'#1~...'~in~a~regular~expression. } { The~only~valid~constructions~starting~with~'(?'~are~ @@ -6219,21 +6330,21 @@ % % Errors in the replacement text. % \begin{macrocode} -\__msg_kernel_new:nnnn { regex } { replacement-c } +\__msg_kernel_new:nnnn { kernel } { replacement-c } { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. } { In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~ or~a~brace~group,~not~by~'#1'. } -\__msg_kernel_new:nnnn { regex } { replacement-u } +\__msg_kernel_new:nnnn { kernel } { replacement-u } { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. } { In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~ must~be~~followed~by~a~brace~group~holding~the~name~of~the~ variable~to~use. } -\__msg_kernel_new:nnnn { regex } { replacement-g } +\__msg_kernel_new:nnnn { kernel } { replacement-g } { Missing~brace~for~the~'\iow_char:N\\g'~construction~ in~a~replacement~text. @@ -6243,7 +6354,7 @@ submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~ or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing. } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-end } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-end } { Missing~character~for~the~'\iow_char:N\\c<category><character>'~ construction~in~a~replacement~text. @@ -6254,7 +6365,17 @@ the~character~category.~Then,~a~character~must~follow.~LaTeX~ reached~the~end~of~the~replacement~when~looking~for~that. } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-in-cs } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-escaped } + { + Escaped~letter~or~digit~after~category~code~in~replacement~text. + } + { + In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ + can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~ + the~character~category.~Then,~a~character~must~follow,~not~ + '\iow_char:N\\#2'. + } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-in-cs } { Category~code~'\iow_char:N\\c#1#3'~ignored~inside~ '\iow_char:N\\c\{...\}'~in~a~replacement~text. @@ -6264,7 +6385,7 @@ '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~ sequence~name. } -\__msg_kernel_new:nnnn { regex } { replacement-null-space } +\__msg_kernel_new:nnnn { kernel } { replacement-null-space } { TeX~cannot~build~a~space~token~with~character~code~0. } { You~asked~for~a~character~token~with~category~space,~ @@ -6273,13 +6394,13 @@ This~specific~case~is~impossible~and~will~be~replaced~ by~a~normal~space. } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { replacement-missing-rbrace } { Missing~right~brace~inserted~in~replacement~text. } { There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } . } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rparen } +\__msg_kernel_new:nnnn { kernel } { replacement-missing-rparen } { Missing~right~parenthesis~inserted~in~replacement~text. } { There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 3af96d7ad28..9d724ec4715 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -62,8 +62,8 @@ % \cs{seq_new:N} \meta{sequence} % \end{syntax} % Creates a new \meta{sequence} or raises an error if the name is -% already taken. The declaration is global. The \meta{sequence} will -% initially contain no items. +% already taken. The declaration is global. The \meta{sequence} +% initially contains no items. % \end{function} % % \begin{function}{\seq_clear:N, \seq_clear:c, \seq_gclear:N, \seq_gclear:c} @@ -141,7 +141,7 @@ % \end{syntax} % Concatenates the content of \meta{sequence_2} and \meta{sequence_3} % together and saves the result in \meta{sequence_1}. The items in -% \meta{sequence_2} will be placed at the left side of the new sequence. +% \meta{sequence_2} are placed at the left side of the new sequence. % \end{function} % % \begin{function}[EXP, pTF, added=2012-03-03] @@ -204,8 +204,8 @@ % Stores the left-most item from a \meta{sequence} in the % \meta{token list variable} without removing it from the % \meta{sequence}. The \meta{token list variable} is assigned locally. -% If \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% If \meta{sequence} is empty the \meta{token list variable} +% is set to the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-19]{\seq_get_right:NN, \seq_get_right:cN} @@ -215,8 +215,8 @@ % Stores the right-most item from a \meta{sequence} in the % \meta{token list variable} without removing it from the % \meta{sequence}. The \meta{token list variable} is assigned locally. -% If \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% If \meta{sequence} is empty the \meta{token list variable} +% is set to the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-14]{\seq_pop_left:NN, \seq_pop_left:cN} @@ -227,8 +227,8 @@ % \meta{token list variable}, \emph{i.e.}~removes the item from the % sequence and stores it in the \meta{token list variable}. % Both of the variables are assigned locally. If \meta{sequence} is -% empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% empty the \meta{token list variable} is set to +% the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-14]{\seq_gpop_left:NN, \seq_gpop_left:cN} @@ -240,8 +240,8 @@ % sequence and stores it in the \meta{token list variable}. % The \meta{sequence} is modified globally, while the assignment of % the \meta{token list variable} is local. -% If \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% If \meta{sequence} is empty the \meta{token list variable} is set to +% the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-19]{\seq_pop_right:NN, \seq_pop_right:cN} @@ -252,8 +252,8 @@ % \meta{token list variable}, \emph{i.e.}~removes the item from the % sequence and stores it in the \meta{token list variable}. % Both of the variables are assigned locally. If \meta{sequence} is -% empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% empty the \meta{token list variable} is set to +% the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-19]{\seq_gpop_right:NN, \seq_gpop_right:cN} @@ -265,8 +265,8 @@ % sequence and stores it in the \meta{token list variable}. % The \meta{sequence} is modified globally, while the assignment of % the \meta{token list variable} is local. -% If \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% If \meta{sequence} is empty the \meta{token list variable} is set to +% the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[added = 2014-07-17, EXP]{\seq_item:Nn, \seq_item:cn} @@ -274,17 +274,17 @@ % \cs{seq_item:Nn} \meta{sequence} \Arg{integer expression} % \end{syntax} % Indexing items in the \meta{sequence} from~$1$ at the top (left), this -% function will evaluate the \meta{integer expression} and leave the +% function evaluates the \meta{integer expression} and leaves the % appropriate item from the sequence in the input stream. If the % \meta{integer expression} is negative, indexing occurs from the -% bottom (right) of the sequence. When the \meta{integer expression} +% bottom (right) of the sequence. If the \meta{integer expression} % is larger than the number of items in the \meta{sequence} (as -% calculated by \cs{seq_count:N}) then the function will expand to +% calculated by \cs{seq_count:N}) then the function expands to % nothing. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -515,8 +515,8 @@ % \cs{seq_map_break:} % \end{syntax} % Used to terminate a \cs[no-index]{seq_map_\ldots} function before all -% entries in the \meta{sequence} have been processed. This will -% normally take place within a conditional statement, for example +% entries in the \meta{sequence} have been processed. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \seq_map_inline:Nn \l_my_seq % { @@ -527,12 +527,12 @@ % } % } % \end{verbatim} -% Use outside of a \cs[no-index]{seq_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{seq_map_\ldots} scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before further items are taken -% from the input stream. This will depend on the design of the mapping +% from the input stream. This depends on the design of the mapping % function. % \end{texnote} % \end{function} @@ -543,8 +543,8 @@ % \end{syntax} % Used to terminate a \cs[no-index]{seq_map_\ldots} function before all % entries in the \meta{sequence} have been processed, inserting -% the \meta{tokens} after the mapping has ended. This will -% normally take place within a conditional statement, for example +% the \meta{tokens} after the mapping has ended. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \seq_map_inline:Nn \l_my_seq % { @@ -555,13 +555,13 @@ % } % } % \end{verbatim} -% Use outside of a \cs[no-index]{seq_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{seq_map_\ldots} scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are % inserted into the input stream. -% This will depend on the design of the mapping function. +% This depends on the design of the mapping function. % \end{texnote} % \end{function} % @@ -571,7 +571,7 @@ % \end{syntax} % Leaves the number of items in the \meta{sequence} in the input % stream as an \meta{integer denotation}. The total number of items -% in a \meta{sequence} will include those which are empty and duplicates, +% in a \meta{sequence} includes those which are empty and duplicates, % \emph{i.e.}~every item in a \meta{sequence} is unique. % \end{function} % @@ -589,7 +589,7 @@ % sequence has exactly two items, then they are placed in the input stream % separated by the \meta{separator between two}. If the sequence has % a single item, it is placed in the input stream, and an empty sequence -% produces no output. An error will be raised if the variable does +% produces no output. An error is raised if the variable does % not exist or if it is invalid. % % For example, @@ -597,13 +597,13 @@ % \seq_set_split:Nnn \l_tmpa_seq { | } { a | b | c | {de} | f } % \seq_use:Nnnn \l_tmpa_seq { ~and~ } { ,~ } { ,~and~ } % \end{verbatim} -% will insert \enquote{\texttt{a, b, c, de, and f}} in the input +% inserts \enquote{\texttt{a, b, c, de, and f}} in the input % stream. The first separator argument is not used in this case % because the sequence has more than $2$ items. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{items} -% will not expand further when appearing in an \texttt{x}-type +% do not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -615,7 +615,7 @@ % Places the contents of the \meta{seq~var} in the input stream, with % the \meta{separator} between the items. If the sequence has % a single item, it is placed in the input stream with no \meta{separator}, -% and an empty sequence produces no output. An error will be raised if +% and an empty sequence produces no output. An error is raised if % the variable does not exist or if it is invalid. % % For example, @@ -623,12 +623,12 @@ % \seq_set_split:Nnn \l_tmpa_seq { | } { a | b | c | {de} | f } % \seq_use:Nn \l_tmpa_seq { ~and~ } % \end{verbatim} -% will insert \enquote{\texttt{a and b and c and de and f}} in the input +% inserts \enquote{\texttt{a and b and c and de and f}} in the input % stream. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{items} -% will not expand further when appearing in an \texttt{x}-type +% do not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -649,8 +649,8 @@ % Reads the top item from a \meta{sequence} into the % \meta{token list variable} without removing it from the % \meta{sequence}. The \meta{token list variable} is assigned locally. -% If \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% If \meta{sequence} is empty the \meta{token list variable} is set to +% the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-14]{\seq_pop:NN, \seq_pop:cN} @@ -659,8 +659,8 @@ % \end{syntax} % Pops the top item from a \meta{sequence} into the % \meta{token list variable}. Both of the variables are assigned -% locally. If \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% locally. If \meta{sequence} is empty the \meta{token list variable} +% is set to the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[updated = 2012-05-14]{\seq_gpop:NN, \seq_gpop:cN} @@ -670,8 +670,8 @@ % Pops the top item from a \meta{sequence} into the % \meta{token list variable}. The \meta{sequence} is modified globally, % while the \meta{token list variable} is assigned locally. If -% \meta{sequence} is empty the \meta{token list variable} will -% contain the special marker \cs{q_no_value}. +% \meta{sequence} is empty the \meta{token list variable} is set to +% the special marker \cs{q_no_value}. % \end{function} % % \begin{function}[TF, added = 2012-05-14, updated = 2012-05-19]{\seq_get:NN, \seq_get:cN} @@ -869,7 +869,7 @@ % \cs{__seq_item:n} \Arg{item} % \end{syntax} % The internal token used to begin each sequence entry. If expanded -% outside of a mapping or manipulation function, an error will be +% outside of a mapping or manipulation function, an error is % raised. The definition should always be set globally. % \end{function} % @@ -1304,11 +1304,10 @@ % \texttt{x}-type expansion uses \cs{str_if_eq:nnT} to find potential % matches. If one is found, the expansion is halted and the necessary % set up takes place to use the \cs{tl_if_eq:NNT} test. The \texttt{x}-type -% is started again, including all of the items copied already. This will -% happen repeatedly until the entire sequence has been scanned. The code +% is started again, including all of the items copied already. This +% happens repeatedly until the entire sequence has been scanned. The code % is set up to avoid needing and intermediate scratch list: the lead-off -% \texttt{x}-type expansion (|#1 #2 {#2}|) will ensure that nothing is -% lost. +% \texttt{x}-type expansion (|#1 #2 {#2}|) ensures that nothing is lost. % \begin{macrocode} \cs_new_protected:Npn \seq_remove_all:Nn { \@@_remove_all_aux:NNn \tl_set:Nx } @@ -1436,7 +1435,7 @@ % argument with the test sequence. If the two items are equal, the % mapping is terminated and \cs{group_end:} \cs{prg_return_true:} % is inserted after skipping over the rest of the recursion. On the -% other hand, if there is no match then the loop will break returning +% other hand, if there is no match then the loop breaks, returning % \cs{prg_return_false:}. % Everything is inside a group so that \cs{@@_item:n} is preserved % in nested situations. @@ -1591,7 +1590,7 @@ % supplied by the |{ \if_false: } \fi:| \ldots % |\if_false: { \fi: }| construct. Using an \texttt{x}-type % expansion and a \enquote{non-expanding} definition for \cs{@@_item:n}, -% the left-most $n - 1$ entries in a sequence of $n$ items will be stored +% the left-most $n - 1$ entries in a sequence of $n$ items are stored % back in the sequence. That needs a loop of unknown length, hence using the % strange \cs{if_false:} way of including braces. When the last item % of the sequence is reached, the closing brace for the assignment is @@ -1687,7 +1686,7 @@ % \begin{macro}[aux]{\@@_item:wNn, \@@_item:nN, \@@_item:nnn} % The idea here is to find the offset of the item from the left, then use % a loop to grab the correct item. If the resulting offset is too large, -% then the stop code |{ ? \__prg_break: } { }| will be used by the auxiliary, +% then the stop code |{ ? \__prg_break: } { }| is used by the auxiliary, % terminating the loop and returning nothing at all. % \begin{macrocode} \cs_new:Npn \seq_item:Nn #1 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index e43dd6320b6..8f2e175ecaa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -66,7 +66,7 @@ % \end{syntax} % Creates a new \meta{dimension} or raises an error if the name is % already taken. The declaration is global. The \meta{dimension} -% will initially be equal to $0$\,pt. +% is initially equal to $0$\,pt. % \end{function} % % \begin{function}[added = 2012-03-05]{\dim_const:Nn, \dim_const:cn} @@ -74,7 +74,7 @@ % \cs{dim_const:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} % Creates a new constant \meta{dimension} or raises an error if the -% name is already taken. The value of the \meta{dimension} will be set +% name is already taken. The value of the \meta{dimension} is set % globally to the \meta{dimension expression}. % \end{function} % @@ -185,7 +185,7 @@ % \tl_set:Nx \l_my_tl { \dim_ratio:nn { 5 pt } { 10 pt } } % \tl_show:N \l_my_tl % \end{verbatim} -% will display |327680/655360| on the terminal. +% displays |327680/655360| on the terminal. % \end{function} % % \section{Dimension expression conditionals} @@ -267,7 +267,8 @@ % This function evaluates the \meta{test dimension expression} and % compares this in turn to each of the % \meta{dimension expression cases}. If the two are equal then the -% associated \meta{code} is left in the input stream. If any of the +% associated \meta{code} is left in the input stream +% and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the % input stream (after the code for the appropriate case), while if none % match then the \meta{false code} is inserted. The function @@ -284,7 +285,7 @@ % } % { No idea! } % \end{verbatim} -% will leave \enquote{\texttt{Medium}} in the input stream. +% leaves \enquote{\texttt{Medium}} in the input stream. % \end{function} % % \section{Dimension expression loops} @@ -296,8 +297,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the relationship between the two % \meta{dimension expressions} as described for \cs{dim_compare:nNnTF}. -% If the test is \texttt{false} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{false} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{true}. % \end{function} % @@ -308,8 +309,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the relationship between the two % \meta{dimension expressions} as described for \cs{dim_compare:nNnTF}. -% If the test is \texttt{true} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{true} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{false}. % \end{function} % @@ -321,7 +322,7 @@ % as described for \cs{dim_compare:nNnTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{false}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{true}. % \end{function} % @@ -333,7 +334,7 @@ % as described for \cs{dim_compare:nNnTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{true}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{false}. % \end{function} % @@ -344,8 +345,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the \meta{dimension relation} % as described for \cs{dim_compare:nTF}. -% If the test is \texttt{false} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{false} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{true}. % \end{function} % @@ -356,8 +357,8 @@ % Places the \meta{code} in the input stream for \TeX{} to process, and % then evaluates the \meta{dimension relation} % as described for \cs{dim_compare:nTF}. -% If the test is \texttt{true} then the \meta{code} will be inserted -% into the input stream again and a loop will occur until the +% If the test is \texttt{true} then the \meta{code} is inserted +% into the input stream again and a loop occurs until the % \meta{relation} is \texttt{false}. % \end{function} % @@ -369,7 +370,7 @@ % as described for \cs{dim_compare:nTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{false}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{true}. % \end{function} % @@ -381,7 +382,7 @@ % as described for \cs{dim_compare:nTF}, and then places the % \meta{code} in the input stream if the \meta{relation} is % \texttt{true}. After the \meta{code} has been processed by \TeX{} the -% test will be repeated, and a loop will occur until the test is +% test is repeated, and a loop occurs until the test is % \texttt{false}. % \end{function} % @@ -396,8 +397,8 @@ % to their content (without requiring \cs{dim_use:N}/\cs{tl_use:N}) % and applying the standard mathematical rules. The result of the % calculation is left in the input stream as a -% \meta{dimension denotation} after two expansions. This will be -% expressed in points (\texttt{pt}), and will require suitable +% \meta{dimension denotation} after two expansions. This is +% expressed in points (\texttt{pt}), and requires suitable % termination if used in a \TeX{}-style assignment as it is \emph{not} % an \meta{internal dimension}. % \end{function} @@ -407,7 +408,7 @@ % \cs{dim_use:N} \meta{dimension} % \end{syntax} % Recovers the content of a \meta{dimension} and places it directly -% in the input stream. An error will be raised if the variable does +% in the input stream. An error is raised if the variable does % not exist or if it is invalid. Can be omitted in places where a % \meta{dimension} is required (such as in the argument of % \cs{dim_eval:n}). @@ -459,7 +460,7 @@ % \end{syntax} % Evaluates the \meta{dimension expression}, and leaves the result, % expressed in scaled points (\texttt{sp}) in the input stream, with \emph{no -% units}. The result will necessarily be an integer. +% units}. The result is necessarily an integer. % \end{function} % % \begin{function}[added = 2014-07-15, EXP] @@ -497,7 +498,7 @@ % the \meta{dimexpr} in \texttt{pt}. Since dimension expressions are % evaluated much faster than their floating point equivalent, % \cs{dim_to_fp:n} can be used to speed up parts of a computation -% where a low precision is acceptable. +% where a low precision and a smaller range are acceptable. % \end{function} % % \section{Viewing \texttt{dim} variables} @@ -568,7 +569,7 @@ % \end{syntax} % Creates a new \meta{skip} or raises an error if the name is % already taken. The declaration is global. The \meta{skip} -% will initially be equal to $0$\,pt. +% is initially equal to $0$\,pt. % \end{function} % % \begin{function}[added = 2012-03-05]{\skip_const:Nn, \skip_const:cn} @@ -576,7 +577,7 @@ % \cs{skip_const:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} % Creates a new constant \meta{skip} or raises an error if the -% name is already taken. The value of the \meta{skip} will be set +% name is already taken. The value of the \meta{skip} is set % globally to the \meta{skip expression}. % \end{function} % @@ -685,8 +686,8 @@ % to their content (without requiring \cs{skip_use:N}/\cs{tl_use:N}) % and applying the standard mathematical rules. The result of the % calculation is left in the input stream as a \meta{glue denotation} -% after two expansions. This will be expressed in points (\texttt{pt}), -% and will require suitable termination if used in a \TeX{}-style +% after two expansions. This is expressed in points (\texttt{pt}), +% and requires suitable termination if used in a \TeX{}-style % assignment as it is \emph{not} an \meta{internal glue}. % \end{function} % @@ -695,7 +696,7 @@ % \cs{skip_use:N} \meta{skip} % \end{syntax} % Recovers the content of a \meta{skip} and places it directly -% in the input stream. An error will be raised if the variable does +% in the input stream. An error is raised if the variable does % not exist or if it is invalid. Can be omitted in places where a % \meta{dimension} is required (such as in the argument of % \cs{skip_eval:n}). @@ -798,7 +799,7 @@ % \end{syntax} % Creates a new \meta{muskip} or raises an error if the name is % already taken. The declaration is global. The \meta{muskip} -% will initially be equal to $0$\,mu. +% is initially equal to $0$\,mu. % \end{function} % % \begin{function}[added = 2012-03-05]{\muskip_const:Nn, \muskip_const:cn} @@ -806,7 +807,7 @@ % \cs{muskip_const:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} % Creates a new constant \meta{muskip} or raises an error if the -% name is already taken. The value of the \meta{muskip} will be set +% name is already taken. The value of the \meta{muskip} is set % globally to the \meta{muskip expression}. % \end{function} % @@ -897,8 +898,8 @@ % to their content (without requiring \cs{muskip_use:N}/\cs{tl_use:N}) % and applying the standard mathematical rules. The result of the % calculation is left in the input stream as a \meta{muglue denotation} -% after two expansions. This will be expressed in \texttt{mu}, -% and will require suitable termination if used in a \TeX{}-style +% after two expansions. This is expressed in \texttt{mu}, +% and requires suitable termination if used in a \TeX{}-style % assignment as it is \emph{not} an \meta{internal muglue}. % \end{function} % @@ -907,7 +908,7 @@ % \cs{muskip_use:N} \meta{muskip} % \end{syntax} % Recovers the content of a \meta{skip} and places it directly -% in the input stream. An error will be raised if the variable does +% in the input stream. An error is raised if the variable does % not exist or if it is invalid. Can be omitted in places where a % \meta{dimension} is required (such as in the argument of % \cs{muskip_eval:n}). @@ -1208,7 +1209,7 @@ % % \begin{macro}{\dim_ratio:nn} % \begin{macro}[aux]{\@@_ratio:n} -% With dimension expressions, something like |10 pt * ( 5 pt / 10 pt )| will +% With dimension expressions, something like |10 pt * ( 5 pt / 10 pt )| does % not work. Instead, the ratio part needs to be converted to an integer % expression. Using \cs{__int_value:w} forces everything into |sp|, avoiding % any decimal parts. @@ -1216,7 +1217,7 @@ \cs_new:Npn \dim_ratio:nn #1#2 { \@@_ratio:n {#1} / \@@_ratio:n {#2} } \cs_new:Npn \@@_ratio:n #1 - { \__int_value:w \@@_eval:w #1 \@@_eval_end: } + { \__int_value:w \@@_eval:w (#1) \@@_eval_end: } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 009d228859e..98e256c3b29 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -63,7 +63,7 @@ % { \sort_return_same: } % } % \end{verbatim} -% will result in \cs{l_foo_clist} holding the values +% results in \cs{l_foo_clist} holding the values % |{ -2 , 01 , +1 , 3 , 5 }| sorted in non-decreasing order. % % The code defining the comparison should call @@ -73,10 +73,10 @@ % the order of this pair of items should not be changed. % % For instance, a \meta{comparison code} consisting only -% of \cs{sort_return_same:} with no test will yield a trivial +% of \cs{sort_return_same:} with no test yields a trivial % sort: the final order is identical to the original order. % Conversely, using a \meta{comparison code} consisting only -% of \cs{sort_return_swapped:} will reverse the list (in a fairly +% of \cs{sort_return_swapped:} reverses the list (in a fairly % inefficient way). % % \begin{texnote} @@ -116,7 +116,7 @@ % \cs{l_@@_min_int} to $\cs{l_@@_top_int}-1$. While reading the % sequence in memory, we check that \cs{l_@@_top_int} remains at most % \cs{l_@@_max_int}, precomputed by \cs{@@_compute_range:}. That -% bound is such that the merge sort will only use \tn{toks} registers +% bound is such that the merge sort only uses \tn{toks} registers % less than \cs{l_@@_true_max_int}, namely those that have not been % allocated for use in other code: the user's comparison code could % alter these. @@ -489,7 +489,7 @@ % pair of blocks). If shifting by one block to the right we reach % the end of the list, then this pass has ended: the end of the % list is sorted already. Otherwise, store the result of that shift in $A$, -% which will index the first block starting from the top end. +% which indexes the first block starting from the top end. % Then locate the end-point (maximum) of the second block: shift % \texttt{end} upwards by one more block, but keeping it % $\leq\texttt{top}$. Copy this upper block of \tn{toks} @@ -585,14 +585,14 @@ \cs_new_protected:Npn \@@_return_mark:N #1 { } \cs_new_protected:Npn \@@_return_none_error: { - \__msg_kernel_error:nnxx { sort } { return-none } + \__msg_kernel_error:nnxx { kernel } { return-none } { \tex_the:D \tex_toks:D \l_@@_A_int } { \tex_the:D \tex_toks:D \l_@@_C_int } \@@_return_same: } \cs_new_protected:Npn \@@_return_two_error:w #1 \@@_return_none_error: - { \__msg_kernel_error:nn { sort } { return-two } } + { \__msg_kernel_error:nn { kernel } { return-two } } % \end{macrocode} % \end{macro} % \end{macro} @@ -710,7 +710,7 @@ % % In the simple version of the code, \cs{@@:nnNnn} is called % \(O(n\ln n)\) times on average (the number of comparisons required by -% the quicksort algorithm). Hence most of our focus will be on +% the quicksort algorithm). Hence most of our focus is on % optimizing that function. % % The first speed up is to avoid testing for the end of the list at @@ -830,7 +830,7 @@ % when~|#4| contains \cs{__prg_break_point:}, then the % \texttt{prepare_end} auxiliary finds the prepared token list % as~|#4|. The scene is then set up for \cs{@@_quick_split:NnNn}, -% which will sort the prepared list and perform the post action placed +% which sorts the prepared list and perform the post action placed % after \cs{q_mark}, namely removing the trailing \cs{s__stop} and % \cs{q_stop} and leaving \cs{exp_stop_f:} to stop % \texttt{f}-expansion. @@ -1013,12 +1013,12 @@ { \cs_set_eq:NN \toksdef \@@_disabled_toksdef:n } \cs_new_protected:Npn \@@_disabled_toksdef:n #1 { - \__msg_kernel_error:nnx { sort } { toksdef } + \__msg_kernel_error:nnx { kernel } { toksdef } { \token_to_str:N #1 } \@@_error: \tex_toksdef:D #1 } -\__msg_kernel_new:nnnn { sort } { toksdef } +\__msg_kernel_new:nnnn { kernel } { toksdef } { Allocation~of~\iow_char:N\\toks~registers~impossible~while~sorting. } { The~comparison~code~used~for~sorting~a~list~has~attempted~to~ @@ -1037,13 +1037,13 @@ \cs_new_protected:Npn \@@_too_long_error:NNw #1#2 \fi: { \fi: - \__msg_kernel_error:nnxxx { sort } { too-large } + \__msg_kernel_error:nnxxx { kernel } { too-large } { \token_to_str:N #2 } { \int_eval:n { \l_@@_true_max_int - \l_@@_min_int } } { \int_eval:n { \l_@@_top_int - \l_@@_min_int } } #1 \@@_error: } -\__msg_kernel_new:nnnn { sort } { too-large } +\__msg_kernel_new:nnnn { kernel } { too-large } { The~list~#1~is~too~long~to~be~sorted~by~TeX. } { TeX~has~#2~toks~registers~still~available:~ @@ -1054,7 +1054,7 @@ % \end{macro} % % \begin{macrocode} -\__msg_kernel_new:nnnn { sort } { return-none } +\__msg_kernel_new:nnnn { kernel } { return-none } { The~comparison~code~did~not~return. } { When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~ @@ -1063,7 +1063,7 @@ \iow_char:N\\sort_return_swapped: .~ Exactly~one~of~these~should~be~called. } -\__msg_kernel_new:nnnn { sort } { return-two } +\__msg_kernel_new:nnnn { kernel } { return-two } { The~comparison~code~returned~multiple~times. } { When~sorting~a~list,~the~code~to~compare~items~called~ diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 3739bc8a766..1642d85a1ee 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -57,7 +57,7 @@ % which have category code $12$ (\enquote{other}) with the exception of % space characters which have category code $10$ (\enquote{space}). Thus % at a technical level, a \TeX{} string is a token list with the appropriate -% category codes. In this documentation, these will simply be referred to as +% category codes. In this documentation, these are simply referred to as % strings. % % String variables are simply specialised token lists, but by convention @@ -66,15 +66,22 @@ % spaces, which have category code $10$ (blank space). All the % functions in this module which accept a token list argument first % convert it to a string using \cs{tl_to_str:n} for internal processing, -% and will not treat a token list or the corresponding string +% and do not treat a token list or the corresponding string % representation differently. % +% As a string is a subset of the more general token list, it is sometimes unclear +% when one should be used over the other. +% Use a string variable for data that isn’t primarily intended for typesetting +% and for which a level of protection from unwanted expansion is suitable. +% This data type simplifies comparison of variables since there are no concerns +% about expansion of their contents. +% % Note that as string variables are a special case of token list variables % the coverage of \cs[no-index]{str_\ldots{}:N} functions is somewhat smaller than % \cs[no-index]{tl_\ldots{}:N}. % % The functions \cs{cs_to_str:N}, \cs{tl_to_str:n}, \cs{tl_to_str:N} and -% \cs{token_to_str:N} (and variants) will generate strings from the appropriate +% \cs{token_to_str:N} (and variants) generate strings from the appropriate % input: these are documented in \pkg{l3basics}, \pkg{l3tl} and \pkg{l3token}, % respectively. % @@ -97,8 +104,8 @@ % \cs{str_new:N} \meta{str~var} % \end{syntax} % Creates a new \meta{str~var} or raises an error if the name is -% already taken. The declaration is global. The \meta{str~var} will -% initially be empty. +% already taken. The declaration is global. The \meta{str~var} is +% initially empty. % \end{function} % % \begin{function}[added = 2015-09-18] @@ -107,7 +114,7 @@ % \cs{str_const:Nn} \meta{str~var} \Arg{token list} % \end{syntax} % Creates a new constant \meta{str~var} or raises an error if the name -% is already taken. The value of the \meta{str~var} will be set +% is already taken. The value of the \meta{str~var} is set % globally to the \meta{token list}, converted to a string. % \end{function} % @@ -200,7 +207,7 @@ % \begin{function}[EXP,pTF, added = 2015-09-18] % {\str_if_empty:N, \str_if_empty:c} % \begin{syntax} -% \cs{sr_if_empty_p:N} \meta{str~var} +% \cs{str_if_empty_p:N} \meta{str~var} % \cs{str_if_empty:NTF} \meta{str~var} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the \meta{string variable} is entirely empty @@ -264,8 +271,8 @@ % \end{syntax} % This function compares the \meta{test string} in turn with each % of the \meta{string cases}. If the two are equal (as described for -% \cs{str_if_eq:nnTF} then the -% associated \meta{code} is left in the input stream. If any of the +% \cs{str_if_eq:nnTF} then the associated \meta{code} is left in the +% input stream and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the % input stream (after the code for the appropriate case), while if none % match then the \meta{false code} is inserted. The function @@ -288,7 +295,8 @@ % This function compares the full expansion of the \meta{test string} % in turn with the full expansion of the \meta{string cases}. If the two % full expansions are equal (as described for \cs{str_if_eq:nnTF} then the -% associated \meta{code} is left in the input stream. If any of the +% associated \meta{code} is left in the input stream +% and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the % input stream (after the code for the appropriate case), while if none % match then the \meta{false code} is inserted. The function @@ -306,7 +314,7 @@ % \cs{str_use:N} \meta{str~var} % \end{syntax} % Recovers the content of a \meta{str~var} and places it -% directly in the input stream. An error will be raised if the variable +% directly in the input stream. An error is raised if the variable % does not exist or if it is invalid. Note that it is possible to use % a \meta{str} directly without an accessor function. % \end{function} @@ -361,7 +369,7 @@ % character, and leaves the remaining characters (if any) in the input % stream, with category codes $12$ and $10$ (for spaces). The % functions differ in the case where the first character is a space: -% \cs{str_tail:N} and \cs{str_tail:n} will trim only that space, while +% \cs{str_tail:N} and \cs{str_tail:n} only trim that space, while % \cs{str_tail_ignore_spaces:n} removes the first non-space character % and any space before it. If the \meta{token list} is empty (or % blank in the case of the \texttt{_ignore_spaces} variant), then @@ -405,7 +413,7 @@ % \iow_term:x { \str_range:nnn { abcdef } { -2 } { -1 } } % \iow_term:x { \str_range:nnn { abcdef } { 0 } { -1 } } % \end{verbatim} -% will print \texttt{bcde}, \texttt{cdef}, \texttt{ef}, and an empty +% prints \texttt{bcde}, \texttt{cdef}, \texttt{ef}, and an empty % line to the terminal. The \meta{start index} must always be smaller than % or equal to the \meta{end index}: if this is not the case then no output % is generated. Thus @@ -470,7 +478,7 @@ % As with all \pkg{expl3} functions, the input supported by % \cs{str_fold_case:n} is \emph{engine-native} characters which are or % interoperate with \textsc{utf-8}. As such, when used with \pdfTeX{} -% \emph{only} the Latin alphabet characters A--Z will be case-folded +% \emph{only} the Latin alphabet characters A--Z are case-folded % (\emph{i.e.}~the \textsc{ascii} range which coincides with % \textsc{utf-8}). Full \textsc{utf-8} support is available with both % \XeTeX{} and \LuaTeX{}, subject only to the fact that \XeTeX{} in @@ -514,7 +522,7 @@ % As with all \pkg{expl3} functions, the input supported by % \cs{str_fold_case:n} is \emph{engine-native} characters which are or % interoperate with \textsc{utf-8}. As such, when used with \pdfTeX{} -% \emph{only} the Latin alphabet characters A--Z will be case-folded +% \emph{only} the Latin alphabet characters A--Z are case-folded % (\emph{i.e.}~the \textsc{ascii} range which coincides with % \textsc{utf-8}). Full \textsc{utf-8} support is available with both % \XeTeX{} and \LuaTeX{}, subject only to the fact that \XeTeX{} in @@ -765,7 +773,7 @@ % 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 +% otherwise would fail as \cs{luatex_luaescapestring:D} does not double % such tokens. % \begin{macrocode} \cs_new:Npn \@@_if_eq_x:nn #1#2 { \pdftex_strcmp:D {#1} {#2} } @@ -1203,7 +1211,7 @@ % trick again, so that the $8$ first arguments of % \cs{@@_collect_end:nnnnnnnnw} are some \cs{or:}, followed by an % \cs{fi:}, followed by |#1| characters from the input stream. Simply -% leaving this in the input stream will close the conditional properly +% leaving this in the input stream closes the conditional properly % and the \cs{or:} disappear. % \begin{macrocode} \cs_new:Npn \@@_collect_delimit_by_q_stop:w #1; @@ -1613,7 +1621,7 @@ % Set up to read each file. As they use C-style comments, there is a need to % deal with |#|. At the same time, spaces are important so they need to be % picked up as they are important. Beyond that, the current category code -% scheme works fine. With no I/O loop available, hard-code one that will work +% scheme works fine. With no I/O loop available, hard-code one that works % quickly. % \begin{macrocode} \cs_set_protected:Npn \@@_map_inline:n #1 @@ -1664,8 +1672,8 @@ } % \end{macrocode} % Storing each exception is always done in the same way: create a constant -% token list which expands to exactly the mapping. These will have the -% category codes \enquote{now} (so should be letters) but will be detokenized +% token list which expands to exactly the mapping. These have the +% category codes \enquote{now} (so should be letters) but are later detokenized % for string use. % \begin{macrocode} \cs_set_protected:Npn \@@_store:nnnnn #1#2#3#4#5 @@ -1680,7 +1688,7 @@ } % \end{macrocode} % Parse the main Unicode data file for title case exceptions (the one-to-one -% lower and upper case mappings it contains will all be covered by the \TeX{} +% lower and upper case mappings it contains are all be covered by the \TeX{} % data). % \begin{macrocode} \cs_set_protected:Npn \@@_parse_auxi:w @@ -1694,7 +1702,7 @@ \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = 0 \exp_stop_f: \else: \tl_const:cx - { c_@@_title_ \utex_char:D "#1 _tl } + { c_@@_mixed_ \utex_char:D "#1 _tl } { \utex_char:D "#7 } \fi: } @@ -1734,7 +1742,7 @@ \use:n { \@@_parse_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = 0 \exp_stop_f: \else: - \use:n { \@@_parse_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop + \use:n { \@@_parse_auxii:w #1 ~ mixed ~ #3 ~ } ~ \q_stop \fi: } \cs_set_protected:Npn \@@_parse_auxii:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index c21509d6f1d..559a20d56df 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -98,7 +98,7 @@ % \end{function} % % \begin{variable}[added = 2015-09-19]{\c_sys_engine_str} -% The current engine given as a lower case string: will be one of +% The current engine given as a lower case string: one of % |luatex|, |pdftex|, |ptex|, |uptex| or |xetex|. % \end{variable} % @@ -113,14 +113,14 @@ % \cs{sys_if_output_dvi:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Conditionals which give the current output mode the \TeX{} run is -% operating in. This will always be one of two outcomes, DVI mode or +% operating in. This is always one of two outcomes, DVI mode or % PDF mode. The two sets of conditionals are thus complementary and % are both provided to allow the programmer to emphasise the most % appropriate case. % \end{function} % % \begin{variable}[added = 2015-09-19]{\c_sys_output_str} -% The current output mode given as a lower case string: will be one of +% The current output mode given as a lower case string: one of % |dvi| or |pdf|. % \end{variable} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index d427b756056..d5ca22491ab 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -344,14 +344,14 @@ % \end{itemize} % The only tokens which are not valid \texttt{N}-type arguments are true % begin-group characters, true end-group characters, and true spaces. -% We will detect those characters by scanning ahead with \tn{futurelet}, +% We detect those characters by scanning ahead with \tn{futurelet}, % then distinguishing true characters from control sequences set equal % to them using the \tn{string} representation. % % The second pass is a simple exercise in expandable loops. % % \begin{macro}[int]{\@@:n} -% Everything is done within a group, and all definitions will be +% Everything is done within a group, and all definitions are % local. We use \cs{group_align_safe_begin/end:} to avoid problems in % case \cs{@@:n} is used within an alignment and its argument % contains alignment tab tokens. @@ -442,7 +442,7 @@ % \end{itemize} % Our first tool is \tn{futurelet}. This cannot distinguish % case $8$ from $1$ or $2$, nor case $9$ from $3$ or $4$, -% nor case $10$ from case $5$. Those cases will be distinguished +% nor case $10$ from case $5$. Those cases are later distinguished % by applying the \tn{string} primitive to the following token, % after possibly changing the escape character to ensure that % a control sequence's string representation cannot be mistaken @@ -631,7 +631,7 @@ % \item 1 begin-group character. % \end{itemize} % We need to distinguish further the case of a space character -% (code $32$) from other character codes, because those will +% (code $32$) from other character codes, because those % behave differently in the second pass. Namely, after testing % the \tn{lccode} of $0$ (which holds the present character code) % we change the cases above to @@ -722,8 +722,8 @@ % \begin{macro}[int]{\@@_b:n} % \begin{macro}[int, EXP]{\@@_b_loop:w} % Start the loop with the index $0$. No need for an end-marker: -% the loop will stop by itself when the last index is read. -% We will repeatedly oscillate between reading long stretches +% the loop stops by itself when the last index is read. +% We repeatedly oscillate between reading long stretches % of normal tokens, and reading special tokens. % \begin{macrocode} \cs_new_protected:Npn \@@_b:n #1 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx index 268c8616a55..06882053001 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index e0124c53a60..82d13e8cb54 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -92,7 +92,7 @@ % \end{syntax} % Creates a new \meta{tl~var} or raises an error if the % name is already taken. The declaration is global. The -% \meta{tl~var} will initially be empty. +% \meta{tl~var} is initially empty. % \end{function} % % \begin{function}{\tl_const:Nn, \tl_const:Nx, \tl_const:cn, \tl_const:cx} @@ -101,8 +101,7 @@ % \end{syntax} % Creates a new constant \meta{tl~var} or raises an error % if the name is already taken. The value of the -% \meta{tl~var} will be set globally to the -% \meta{token list}. +% \meta{tl~var} is set globally to the \meta{token list}. % \end{function} % % \begin{function}{\tl_clear:N, \tl_clear:c, \tl_gclear:N, \tl_gclear:c} @@ -144,7 +143,7 @@ % \end{syntax} % Concatenates the content of \meta{tl~var_2} and \meta{tl~var_3} % together and saves the result in \meta{tl~var_1}. The \meta{tl~var_2} -% will be placed at the left side of the new token list. +% is placed at the left side of the new token list. % \end{function} % % \begin{function}[EXP, pTF, added=2012-03-03]{\tl_if_exist:N, \tl_if_exist:c} @@ -273,7 +272,7 @@ % \cs{tl_set:Nn} \cs{l_tmpa_tl} |{abbccd}| % \cs{tl_remove_all:Nn} \cs{l_tmpa_tl} |{bc}| % \end{quote} -% will result in \cs{l_tmpa_tl} containing \texttt{abcd}. +% results in \cs{l_tmpa_tl} containing \texttt{abcd}. % \end{function} % % \section{Reassigning token list category codes} @@ -299,7 +298,7 @@ % Sets \meta{tl~var} to contain \meta{tokens}, applying the category % code r\'{e}gime specified in the \meta{setup} before carrying out % the assignment. (Category codes applied to tokens not explicitly covered -% by the \meta{setup} will be those in force at the point of use of +% by the \meta{setup} are those in force at the point of use of % \cs{tl_set_rescan:Nnn}.) % This allows the \meta{tl~var} to contain material % with category codes other than those that apply when \meta{tokens} @@ -329,7 +328,7 @@ % Rescans \meta{tokens} applying the category code r\'{e}gime % specified in the \meta{setup}, and leaves the resulting tokens in % the input stream. (Category codes applied to tokens not explicitly covered -% by the \meta{setup} will be those in force at the point of use of +% by the \meta{setup} are those in force at the point of use of % \cs{tl_rescan:nn}.) % The \meta{setup} is run within a group and may % contain any valid input, although only changes in category codes @@ -475,7 +474,7 @@ % with each of the \meta{token list variable cases}. If the two % are equal (as described for \cs{tl_if_eq:NNTF}) % then the associated \meta{code} is left in the input -% stream. If any of the +% stream and other cases are discarded. If any of the % cases are matched, the \meta{true code} is also inserted into the % input stream (after the code for the appropriate case), while if none % match then the \meta{false code} is inserted. The function @@ -491,7 +490,7 @@ % \cs{tl_map_function:NN} \meta{tl~var} \meta{function} % \end{syntax} % Applies \meta{function} to every \meta{item} in the \meta{tl~var}. -% The \meta{function} will receive one argument for each iteration. +% The \meta{function} receives one argument for each iteration. % This may be a number of tokens if the \meta{item} was stored within % braces. Hence the \meta{function} should anticipate receiving % \texttt{n}-type arguments. See also \cs{tl_map_function:nN}. @@ -502,7 +501,7 @@ % \cs{tl_map_function:nN} \meta{token list} \meta{function} % \end{syntax} % Applies \meta{function} to every \meta{item} in the \meta{token list}, -% The \meta{function} will receive one argument for each iteration. +% The \meta{function} receives one argument for each iteration. % This may be a number of tokens if the \meta{item} was stored within % braces. Hence the \meta{function} should anticipate receiving % \texttt{n}-type arguments. See also \cs{tl_map_function:NN}. @@ -515,7 +514,7 @@ % \end{syntax} % Applies the \meta{inline function} to every \meta{item} stored within the % \meta{tl~var}. The \meta{inline function} should consist of code which -% will receive the \meta{item} as |#1|. One in line mapping can be nested +% receives the \meta{item} as |#1|. One in line mapping can be nested % inside another. See also \cs{tl_map_function:NN}. % \end{function} % @@ -525,7 +524,7 @@ % \end{syntax} % Applies the \meta{inline function} to every \meta{item} stored within the % \meta{token list}. The \meta{inline function} should consist of code which -% will receive the \meta{item} as |#1|. One in line mapping can be nested +% receives the \meta{item} as |#1|. One in line mapping can be nested % inside another. See also \cs{tl_map_function:nN}. % \end{function} % @@ -536,7 +535,7 @@ % \end{syntax} % Applies the \meta{function} to every \meta{item} stored % within the \meta{tl~var}. The \meta{function} should consist of code -% which will receive the \meta{item} stored in the \meta{variable}. +% which receives the \meta{item} stored in the \meta{variable}. % One variable mapping can be nested inside another. See also % \cs{tl_map_inline:Nn}. % \end{function} @@ -547,7 +546,7 @@ % \end{syntax} % Applies the \meta{function} to every \meta{item} stored % within the \meta{token list}. The \meta{function} should consist of code -% which will receive the \meta{item} stored in the \meta{variable}. +% which receives the \meta{item} stored in the \meta{variable}. % One variable mapping can be nested inside another. See also % \cs{tl_map_inline:nn}. % \end{function} @@ -558,7 +557,7 @@ % \end{syntax} % Used to terminate a \cs[no-index]{tl_map_\ldots} function before all % entries in the \meta{token list variable} have been processed. This -% will normally take place within a conditional statement, for example +% normally takes place within a conditional statement, for example % \begin{verbatim} % \tl_map_inline:Nn \l_my_tl % { @@ -567,13 +566,13 @@ % } % \end{verbatim} % See also \cs{tl_map_break:n}. -% Use outside of a \cs[no-index]{tl_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{tl_map_\ldots} scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are % inserted into the input stream. -% This will depend on the design of the mapping function. +% This depends on the design of the mapping function. % \end{texnote} % \end{function} % @@ -583,8 +582,8 @@ % \end{syntax} % Used to terminate a \cs[no-index]{tl_map_\ldots} function before all % entries in the \meta{token list variable} have been processed, inserting -% the \meta{tokens} after the mapping has ended. This will -% normally take place within a conditional statement, for example +% the \meta{tokens} after the mapping has ended. This +% normally takes place within a conditional statement, for example % \begin{verbatim} % \tl_map_inline:Nn \l_my_tl % { @@ -593,13 +592,13 @@ % % Do something useful % } % \end{verbatim} -% Use outside of a \cs[no-index]{tl_map_\ldots} scenario will lead to low +% Use outside of a \cs[no-index]{tl_map_\ldots} scenario leads to low % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the % internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are % inserted into the input stream. -% This will depend on the design of the mapping function. +% This depends on the design of the mapping function. % \end{texnote} % \end{function} % @@ -657,7 +656,7 @@ % \cs{tl_use:N} \meta{tl~var} % \end{syntax} % Recovers the content of a \meta{tl~var} and places it -% directly in the input stream. An error will be raised if the variable +% directly in the input stream. An error is raised if the variable % does not exist or if it is invalid. Note that it is possible to use % a \meta{tl~var} directly without an accessor function. % \end{function} @@ -671,8 +670,8 @@ % \end{syntax} % Counts the number of \meta{items} in \meta{tokens} and leaves this % information in the input stream. Unbraced tokens count as one -% element as do each token group (|{|\ldots|}|). This process will -% ignore any unprotected spaces within \meta{tokens}. See also +% element as do each token group (|{|\ldots|}|). This process +% ignores any unprotected spaces within \meta{tokens}. See also % \cs{tl_count:N}. This function requires three expansions, % giving an \meta{integer denotation}. % \end{function} @@ -684,7 +683,7 @@ % Counts the number of token groups in the \meta{tl~var} % and leaves this information in the input stream. Unbraced tokens % count as one element as do each token group (|{|\ldots|}|). This -% process will ignore any unprotected spaces within the \meta{tl~var}. +% process ignores any unprotected spaces within the \meta{tl~var}. % See also \cs{tl_count:n}. This function requires three expansions, % giving an \meta{integer denotation}. % \end{function} @@ -697,7 +696,7 @@ % Reverses the order of the \meta{items} in the \meta{token list}, % so that \meta{item_1}\meta{item_2}\meta{item_3} \ldots \meta{item_n} % becomes \meta{item_n}\ldots \meta{item_3}\meta{item_2}\meta{item_1}. -% This process will preserve unprotected space within the +% This process preserves unprotected space within the % \meta{token list}. Tokens are not reversed within braced token % groups, which keep their outer set of braces. % In situations where performance is important, @@ -705,7 +704,7 @@ % See also \cs{tl_reverse:N}. % \begin{texnote} % The result is returned within \tn{unexpanded}, which means that the token -% list will not expand further when appearing in an \texttt{x}-type +% list does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -718,7 +717,7 @@ % Reverses the order of the \meta{items} stored in \meta{tl~var}, so % that \meta{item_1}\meta{item_2}\meta{item_3} \ldots \meta{item_n} % becomes \meta{item_n}\ldots \meta{item_3}\meta{item_2}\meta{item_1}. -% This process will preserve unprotected spaces within the +% This process preserves unprotected spaces within the % \meta{token list variable}. Braced token groups are copied without % reversing the order of tokens, but keep the outer set of braces. % See also \cs{tl_reverse:n}, and, for improved performance, @@ -732,7 +731,7 @@ % Reverses the order of the \meta{items} stored in \meta{tl~var}, % so that \Arg{item_1}\Arg{item_2}\Arg{item_3} \ldots \Arg{item_n} % becomes \Arg{item_n} \ldots{} \Arg{item_3}\Arg{item_2}\Arg{item_1}. -% This process will remove any unprotected space within the +% This process removes any unprotected space within the % \meta{token list}. Braced token groups are copied without % reversing the order of tokens, and keep the outer set of braces. % Items which are initially not braced are copied with braces in @@ -740,7 +739,7 @@ % consider the slower function \cs{tl_reverse:n}. % \begin{texnote} % The result is returned within \tn{unexpanded}, which means that the token -% list will not expand further when appearing in an \texttt{x}-type +% list does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -756,7 +755,7 @@ % stream. % \begin{texnote} % The result is returned within \tn{unexpanded}, which means that the token -% list will not expand further when appearing in an \texttt{x}-type +% list does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -799,7 +798,7 @@ % described in Section~\ref{sec:l3sort:mech}. % \begin{texnote} % The result is returned within \cs{exp_not:n}, which means that the -% token list will not expand further when appearing in an +% token list does not expand further when appearing in an % \texttt{x}-type argument expansion. % \end{texnote} % \end{function} @@ -826,18 +825,18 @@ % \begin{verbatim} % \tl_head:n { ~ abc } % \end{verbatim} -% will both leave |a| in the input stream. If the \enquote{head} is a -% brace group, rather than a single token, the braces will be removed, and +% both leave |a| in the input stream. If the \enquote{head} is a +% brace group, rather than a single token, the braces are removed, and % so % \begin{verbatim} % \tl_head:n { ~ { ~ ab } c } % \end{verbatim} % yields \verb*| ab|. -% A blank \meta{token list} (see \cs{tl_if_blank:nTF}) will result in +% A blank \meta{token list} (see \cs{tl_if_blank:nTF}) results in % \cs{tl_head:n} leaving nothing in the input stream. % \begin{texnote} % The result is returned within \cs{exp_not:n}, which means that the token -% list will not expand further when appearing in an \texttt{x}-type +% list does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -852,7 +851,7 @@ % (explicit tokens with character code~$32$ and category code~$10$) % are discarded. % A blank \meta{token list} (which consists only of space characters) -% will result in a low-level \TeX{} error, which may be avoided by the +% results in a low-level \TeX{} error, which may be avoided by the % inclusion of an empty group in the input (as shown), without the need % for an explicit test. Alternatively, \cs{tl_if_blank:nF} may be used to % avoid using the function with a \enquote{blank} argument. @@ -877,12 +876,12 @@ % \begin{verbatim} % \tl_tail:n { ~ a ~ {bc} d } % \end{verbatim} -% will both leave \verb*| {bc}d| in the input stream. A blank -% \meta{token list} (see \cs{tl_if_blank:nTF}) will result +% both leave \verb*| {bc}d| in the input stream. A blank +% \meta{token list} (see \cs{tl_if_blank:nTF}) results % in \cs{tl_tail:n} leaving nothing in the input stream. % \begin{texnote} % The result is returned within \cs{exp_not:n}, which means that the -% token list will not expand further when appearing in an \texttt{x}-type +% token list does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -895,7 +894,7 @@ % \end{syntax} % Tests if the first \meta{token} in the \meta{token list} has the % same category code as the \meta{test token}. In the case where the -% \meta{token list} is empty, the test will always be \texttt{false}. +% \meta{token list} is empty, the test is always \texttt{false}. % \end{function} % % \begin{function}[updated = 2012-07-09, EXP, pTF] @@ -907,7 +906,7 @@ % \end{syntax} % Tests if the first \meta{token} in the \meta{token list} has the % same character code as the \meta{test token}. In the case where the -% \meta{token list} is empty, the test will always be \texttt{false}. +% \meta{token list} is empty, the test is always \texttt{false}. % \end{function} % % \begin{function}[updated = 2012-07-09, EXP, pTF]{\tl_if_head_eq_meaning:nN} @@ -918,7 +917,7 @@ % \end{syntax} % Tests if the first \meta{token} in the \meta{token list} has the % same meaning as the \meta{test token}. In the case where -% \meta{token list} is empty, the test will always be \texttt{false}. +% \meta{token list} is empty, the test is always \texttt{false}. % \end{function} % % \begin{function}[added = 2012-07-08, EXP, pTF]{\tl_if_head_is_group:n} @@ -976,7 +975,7 @@ % \cs{tl_item:nn} \Arg{token list} \Arg{integer expression} % \end{syntax} % Indexing items in the \meta{token list} from~$1$ on the left, this -% function will evaluate the \meta{integer expression} and leave the +% function evaluates the \meta{integer expression} and leaves the % appropriate item from the \meta{token list} in the input stream. % If the \meta{integer expression} is negative, indexing occurs from % the right of the token list, starting at $-1$ for the right-most item. @@ -984,7 +983,7 @@ % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} -% will not expand further when appearing in an \texttt{x}-type +% does not expand further when appearing in an \texttt{x}-type % argument expansion. % \end{texnote} % \end{function} @@ -1126,7 +1125,7 @@ % \begin{macro}{\tl_clear:N, \tl_clear:c} % \begin{macro}{\tl_gclear:N, \tl_gclear:c} % Clearing a token list variable means setting it to an empty value. -% Error checking will be sorted out by the parent function. +% Error checking is sorted out by the parent function. % \begin{macrocode} \cs_new_protected:Npn \tl_clear:N #1 { \tl_set_eq:NN #1 \c_empty_tl } @@ -1141,7 +1140,7 @@ % \begin{macro}{\tl_clear_new:N, \tl_clear_new:c} % \begin{macro}{\tl_gclear_new:N, \tl_gclear_new:c} % Clearing a token list variable means setting it to an empty value. -% Error checking will be sorted out by the parent function. +% Error checking is sorted out by the parent function. % \begin{macrocode} \cs_new_protected:Npn \tl_clear_new:N #1 { \tl_if_exist:NTF #1 { \tl_clear:N #1 } { \tl_new:N #1 } } @@ -1155,26 +1154,54 @@ % % \begin{macro}{\tl_set_eq:NN, \tl_set_eq:Nc, \tl_set_eq:cN, \tl_set_eq:cc} % \begin{macro}{\tl_gset_eq:NN, \tl_gset_eq:Nc, \tl_gset_eq:cN, \tl_gset_eq:cc} -% For setting token list variables equal to each other. +% For setting token list variables equal to each other. When checking +% is turned on, make sure both variables exist. % \begin{macrocode} -\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \tl_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \tl_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \tl_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_new_protected:Npn \tl_set_eq:NN #1#2 + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \cs_set_eq:NN #1 #2 + } + \cs_new_protected:Npn \tl_gset_eq:NN #1#2 + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \cs_gset_eq:NN #1 #2 + } +\else: + \cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN + \cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN +\fi: +\cs_generate_variant:Nn \tl_set_eq:NN { cN, Nc, cc } +\cs_generate_variant:Nn \tl_gset_eq:NN { cN, Nc, cc } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tl_concat:NNN, \tl_concat:ccc} % \begin{macro}{\tl_gconcat:NNN, \tl_gconcat:ccc} -% Concatenating token lists is easy. +% Concatenating token lists is easy. When checking is turned on, all +% three arguments must be checked: a token list |#2| or |#3| equal to +% \cs{scan_stop:} would lead to problems later on. % \begin{macrocode} +\__debug_patch:nnNw + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \__chk_if_exist_var:N #3 + } + { } \cs_new_protected:Npn \tl_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\__debug_patch:nnNw + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \__chk_if_exist_var:N #3 + } + { } \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } \cs_generate_variant:Nn \tl_concat:NNN { ccc } @@ -1224,18 +1251,26 @@ % By using \cs{exp_not:n} token list variables can contain |#| tokens, % which makes the token list registers provided by \TeX{} % more or less redundant. The \cs{tl_set:No} version is done -% \enquote{by hand} as it is used quite a lot. +% \enquote{by hand} as it is used quite a lot. Each definition is +% prefixed by a call to \cs{__debug_patch:nnNw} which adds an +% existence check to the definition. % \begin{macrocode} +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:Nx #1#2 { \cs_set_nopar:Npx #1 {#2} } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:Nx #1#2 { \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } @@ -1260,20 +1295,28 @@ % } % Adding to the left is done directly to gain a little performance. % \begin{macrocode} +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nx #1#2 { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nx #1#2 { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } @@ -1302,20 +1345,28 @@ % } % The same on the right. % \begin{macrocode} +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } @@ -1330,85 +1381,6 @@ % \end{macro} % \end{macro} % -% When used as a package, there is an option to be picky and to -% check definitions exist. This part of the process is done now, so that -% variable types based on |tl| (for example |clist|, |seq| and |prop|) will -% inherit the appropriate definitions. -% No \cs[no-index]{tl_map_\ldots} yet as the mechanisms are not fully in place. Thus -% instead do a more low level set up for a mapping, as in \pkg{l3basics}. -% \begin{macrocode} -%<*package> -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \__cs_tmp:w #1 - { - \if_meaning:w \q_recursion_tail #1 - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: - \use:x - { - \cs_set_protected:Npn #1 \exp_not:n { ##1 ##2 } - { - \__chk_if_exist_var:N \exp_not:n {##1} - \exp_not:o { #1 {##1} {##2} } - } - } - \__cs_tmp:w - } - \__cs_tmp:w - \tl_set:Nn \tl_set:No \tl_set:Nx - \tl_gset:Nn \tl_gset:No \tl_gset:Nx - \tl_put_left:Nn \tl_put_left:NV - \tl_put_left:No \tl_put_left:Nx - \tl_gput_left:Nn \tl_gput_left:NV - \tl_gput_left:No \tl_gput_left:Nx - \tl_put_right:Nn \tl_put_right:NV - \tl_put_right:No \tl_put_right:Nx - \tl_gput_right:Nn \tl_gput_right:NV - \tl_gput_right:No \tl_gput_right:Nx - \q_recursion_tail \q_recursion_stop -%</package> -% \end{macrocode} -% The two \texttt{set_eq} functions are done by hand as the internals there -% are a bit different. -% \begin{macrocode} -%<*package> - \cs_set_protected:Npn \tl_set_eq:NN #1#2 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \cs_set_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_gset_eq:NN #1#2 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \cs_gset_eq:NN #1 #2 - } -%</package> -% \end{macrocode} -% There is also a need to check all three arguments of the -% \texttt{concat} functions: a token list |#2| or |#3| equal to -% \cs{scan_stop:} would lead to problems later on. -% \begin{macrocode} -%<*package> - \cs_set_protected:Npn \tl_concat:NNN #1#2#3 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 - \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } - } - \cs_set_protected:Npn \tl_gconcat:NNN #1#2#3 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 - \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } - } -\tex_fi:D -%</package> -% \end{macrocode} -% % \subsection{Reassigning token list category codes} % % \begin{variable}{\c_@@_rescan_marker_tl} @@ -1452,7 +1424,7 @@ % The standard solution is to use an \texttt{x}-expanding assignment % and set \tn{everyeof} to \cs{exp_not:N} to suppress the error at % the end of the file. Since the rescanned tokens should not be -% expanded, they will be taken as a delimited argument of an +% expanded, they are taken as a delimited argument of an % auxiliary which wraps them in \cs{exp_not:n} (in fact % \cs{exp_not:o}, as there is a \cs{prg_do_nothing:} to avoid losing % braces). The delimiter cannot appear within the rescanned token @@ -1536,8 +1508,8 @@ % ignored at the beginning of lines, and spaces and tabs (character % code $32$ and $9$) are ignored at the end of lines. % -% For a single line, no \tn{endlinechar} should be added, so it will -% be set to $-1$, and spaces should not be removed. +% For a single line, no \tn{endlinechar} should be added, so it is +% set to $-1$, and spaces should not be removed. % % Trailing spaces and tabs are a difficult matter, as \TeX{} removes % these at a very low level. The only way to preserve them is to @@ -1681,7 +1653,7 @@ % \@@_replace_wrap:w, % } % To implement the actual replacement auxiliary -% \cs{@@_replace_auxii:nNNNnn} we will need a \meta{delimiter} with +% \cs{@@_replace_auxii:nNNNnn} we need a \meta{delimiter} with % the following properties: % \begin{itemize} % \item all occurrences of the \meta{pattern}~|#6| in @@ -1715,7 +1687,7 @@ % at most $O(n^{3/2})$. Bear in mind that these upper bounds are % reached only in very contrived scenarios: we include the case % \enquote{\meta{A}} in the list of delimiters to try, so that the -% \meta{delimiter} will simply be \cs{q_mark} in the most common +% \meta{delimiter} is simply \cs{q_mark} in the most common % situation where neither the \meta{token list} nor the \meta{pattern} % contains \cs{q_mark}. % @@ -1920,7 +1892,7 @@ % \end{macro} % % \begin{macro}[pTF]{\tl_if_empty:n, \tl_if_empty:V} -% Convert the argument to a string: this will be empty if and only if +% Convert the argument to a string: this is 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. @@ -2082,10 +2054,10 @@ % 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 +% second token in front of it. If |#1| is empty, this token is % 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 +% |#1| has a single item, the token is~|^| and the catcode test +% yields \texttt{true}. Otherwise, it is 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} @@ -2115,7 +2087,7 @@ % using a known number of expansion steps (two), and without % needing to use an explicit \enquote{end of recursion} marker. % That is achieved by using the test input as the final case, -% as this will always be true. The trick is then to tidy up +% as this is always true. The trick is then to tidy up % the output such that the appropriate case code plus either % the \texttt{true} or \texttt{false} branch code is inserted. % \begin{macrocode} @@ -2153,14 +2125,14 @@ \cs_generate_variant:Nn \tl_case:NnTF { c } % \end{macrocode} % To tidy up the recursion, there are two outcomes. If there was a hit to -% one of the cases searched for, then |#1| will be the code to insert, -% |#2| will be the \emph{next} case to check on and |#3| will be all of -% the rest of the cases code. That means that |#4| will be the \texttt{true} -% branch code, and |#5| will be tidy up the spare \cs{q_mark} and the +% one of the cases searched for, then |#1| is the code to insert, +% |#2| is the \emph{next} case to check on and |#3| is all of +% the rest of the cases code. That means that |#4| is the \texttt{true} +% branch code, and |#5| tidies up the spare \cs{q_mark} and the % \texttt{false} branch. On the other hand, if none of the cases matched % then we arrive here using the \enquote{termination} case of comparing -% the search with itself. That means that |#1| will be empty, |#2| will be -% the first \cs{q_mark} and so |#4| will be the \texttt{false} code (the +% the search with itself. That means that |#1| is empty, |#2| is +% the first \cs{q_mark} and so |#4| is the \texttt{false} code (the % \texttt{true} code is mopped up by |#3|). % \begin{macrocode} \cs_new:Npn \__prg_case_end:nw #1#2#3 \q_mark #4#5 \q_stop @@ -2180,7 +2152,7 @@ % \begin{macro}[aux]{\@@_map_function:Nn} % Expandable loop macro for token lists. These have the advantage of not % needing to test if the argument is empty, because if it is, the stop -% marker will be read immediately and the loop terminated. +% marker is read immediately and the loop terminated. % \begin{macrocode} \cs_new:Npn \tl_map_function:nN #1#2 { @@ -2284,7 +2256,7 @@ % \end{macro} % % \begin{macro}{\tl_use:N, \tl_use:c} -% Token lists which are simply not defined will give a clear \TeX{} +% Token lists which are simply not defined give a clear \TeX{} % error here. No such luck for ones equal to \cs{scan_stop:} so % instead a test is made and if there is an issue an error is forced. % \begin{macrocode} @@ -2365,10 +2337,10 @@ % Trimming spaces from around the input is deferred to an internal % function whose first argument is the token list to trim, augmented % by an initial \cs{q_mark}, and whose second argument is a -% \meta{continuation}, which will receive as a braced argument +% \meta{continuation}, which receives as a braced argument % \cs{use_none:n} \cs{q_mark} \meta{trimmed token list}. In the case % at hand, we take \cs{exp_not:o} as our continuation, so that space -% trimming will behave correctly within an \texttt{x}-type expansion. +% trimming behaves correctly within an \texttt{x}-type expansion. % \begin{macrocode} \cs_new:Npn \tl_trim_spaces:n #1 { \@@_trim_spaces:nn { \q_mark #1 } \exp_not:o } @@ -2606,7 +2578,7 @@ % \begin{macro}[aux]{\@@_head_auxi:nw, \@@_head_auxii:n} % \begin{macro}{\tl_head:w} % \begin{macro}{\tl_tail:N, \tl_tail:n, \tl_tail:V, \tl_tail:v, \tl_tail:f} -% Finding the head of a token list expandably will always strip braces, which +% Finding the head of a token list expandably always strips braces, which % is fine as this is consistent with for example mapping to a list. The % empty brace groups in \cs{tl_head:n} ensure that a blank argument gives an % empty result. The result is returned within the \tn{unexpanded} primitive. @@ -2643,14 +2615,14 @@ \cs_new:Npn \tl_head:w #1#2 \q_stop {#1} \cs_new:Npn \tl_head:N { \exp_args:No \tl_head:n } % \end{macrocode} -% To corrected leave the tail of a token list, it's important \emph{not} to +% To correctly leave the tail of a token list, it's important \emph{not} to % absorb any of the tail part as an argument. For example, the simple % definition % \begin{verbatim} % \cs_new:Npn \tl_tail:n #1 { \tl_tail:w #1 \q_stop } % \cs_new:Npn \tl_tail:w #1#2 \q_stop % \end{verbatim} -% will give the wrong result for |\tl_tail:n { a { bc } }| (the braces will +% would give the wrong result for |\tl_tail:n { a { bc } }| (the braces would % be stripped). Thus the only safe way to proceed is to first check that % there is an item to grab (\emph{i.e.}~that the argument is not blank) and % assuming there is to dispose of the first item. As with \cs{tl_head:n}, @@ -2695,8 +2667,8 @@ % token lists to the \texttt{true} branch of this test). In those % cases, the first token is a character, and since we only care about % its character code, we can use \cs{str_head:n} to access it (this -% works even if it is a space character). An empty argument will -% result in \cs{tl_head:w} leaving two tokens: |?| which is taken in +% works even if it is a space character). An empty argument +% results in \cs{tl_head:w} leaving two tokens: |?| which is taken in % the \cs{if_charcode:w} test, and \cs{use_none:nn}, which ensures % that \cs{prg_return_false:} is returned regardless of whether the % charcode test was \texttt{true} or \texttt{false}. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 3d9f02a2b1c..ecbc69d46b4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -57,11 +57,11 @@ % comes to document commands) is looking ahead in the token stream to % see if a certain character is present and maybe even remove it or % disregard other tokens while scanning. This module provides -% functions for both and as such will have two primary function +% functions for both and as such has two primary function % categories: |\token_| for anything that deals with tokens and % |\peek_| for looking ahead in the token stream. % -% Most functions we will describe here can be used on control sequences, +% Most functions we describe here can be used on control sequences, % as those are tokens as well. % % It is important to distinguish two aspects of a token: its @@ -78,7 +78,7 @@ % character code. They have the same meaning hence behave identically % in many situations. However, \TeX{} distinguishes them when searching % for a delimited argument. Namely, the example function -% |\show_until_if:w| defined below will take everything until \cs{if:w} +% |\show_until_if:w| defined below takes everything until \cs{if:w} % as an argument, despite the presence of other copies of \cs{if:w} % under different names. % \begin{verbatim} @@ -139,7 +139,7 @@ % \item $11$ (letter) % \item $12$ (other) % \end{itemize} -% and other values will raise an error. +% and other values raise an error. % % The \meta{charcode} may be any one valid for the engine in use. Note % however that for \XeTeX{} releases prior to 0.99992 only the 8-bit @@ -243,7 +243,7 @@ % \cs{char_set_lccode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} % Sets up the behaviour of the \meta{character} when -% found inside \cs{tl_to_lowercase:n}, such that \meta{character_1} +% found inside \cs{tl_lower_case:n}, such that \meta{character_1} % will be converted into \meta{character_2}. The two \meta{characters} % may be specified using an \meta{integer expression} for the character code % concerned. This may include the \TeX{} |`|\meta{character} @@ -280,7 +280,7 @@ % \cs{char_set_uccode:nn} \Arg{intexpr_1} \Arg{intexpr_2} % \end{syntax} % Sets up the behaviour of the \meta{character} when -% found inside \cs{tl_to_uppercase:n}, such that \meta{character_1} +% found inside \cs{tl_upper_case:n}, such that \meta{character_1} % will be converted into \meta{character_2}. The two \meta{characters} % may be specified using an \meta{integer expression} for the character code % concerned. This may include the \TeX{} |`|\meta{character} @@ -396,7 +396,7 @@ % \cs{token_new:Nn} \meta{token_1} \Arg{token_2} % \end{syntax} % Defines \meta{token_1} to globally be a snapshot of \meta{token_2}. -% This will be an implicit representation of \meta{token_2}. +% This is an implicit representation of \meta{token_2}. % \end{function} % % \begin{variable} @@ -439,9 +439,9 @@ % \end{syntax} % Inserts the current meaning of the \meta{token} into the input % stream as a series of characters of category code $12$ (other). -% This will be the primitive \TeX{} description of the \meta{token}, +% This is the primitive \TeX{} description of the \meta{token}, % thus for example both functions defined by \cs{cs_set_nopar:Npn} -% and token list variables defined using \cs{tl_new:N} will be described +% and token list variables defined using \cs{tl_new:N} are described % as |macro|s. % \begin{texnote} % This is the \TeX{} primitive \tn{meaning}. @@ -453,8 +453,8 @@ % \cs{token_to_str:N} \meta{token} % \end{syntax} % Converts the given \meta{token} into a series of characters with -% category code $12$ (other). The current escape character will be -% the first character in the sequence, although this will also have +% category code $12$ (other). If the \meta{token} is a control +% sequence, this will start with the current escape character with % category code $12$ (the escape character is part of the % \meta{token}). This function requires only a single expansion. % \begin{texnote} @@ -630,8 +630,8 @@ % \cs{token_if_protected_macro_p:N} \meta{token} \\ % \cs{token_if_protected_macro:NTF} \meta{token} \Arg{true code} \Arg{false code} % \end{syntax} -% Tests if the \meta{token} is a protected macro: a macro which -% is both protected and long will return logical \texttt{false}. +% Tests if the \meta{token} is a protected macro: for a macro which +% is both protected and long this returns \texttt{false}. % \end{function} % % \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_protected_long_macro:N} @@ -650,7 +650,7 @@ % Tests if the \meta{token} is defined to be a chardef. % \begin{texnote} % Booleans, boxes and small integer constants are implemented as -% chardefs. +% \tn{chardef}s. % \end{texnote} % \end{function} % @@ -678,7 +678,7 @@ % Tests if the \meta{token} is defined to be a integer register. % \begin{texnote} % Constant integers may be implemented as integer registers, -% chardefs, or mathchardefs depending on their value. +% \tn{chardef}s, or \tn{mathchardef}s depending on their value. % \end{texnote} % \end{function} % @@ -730,7 +730,7 @@ % \end{syntax} % Locally sets the test variable \cs{l_peek_token} equal to \meta{token} % (as an implicit token, \emph{not} as a token list), and then -% expands the \meta{function}. The \meta{token} will remain in +% expands the \meta{function}. The \meta{token} remains in % the input stream as the next item after the \meta{function}. % The \meta{token} here may be \verb*| |, |{| or |}| (assuming % normal \TeX{} category codes), \emph{i.e.}~it is not necessarily the @@ -743,7 +743,7 @@ % \end{syntax} % Globally sets the test variable \cs{g_peek_token} equal to \meta{token} % (as an implicit token, \emph{not} as a token list), and then -% expands the \meta{function}. The \meta{token} will remain in +% expands the \meta{function}. The \meta{token} remains in % the input stream as the next item after the \meta{function}. % The \meta{token} here may be \verb*| |, |{| or |}| (assuming % normal \TeX{} category codes), \emph{i.e.}~it is not necessarily the @@ -767,7 +767,7 @@ % Tests if the next \meta{token} in the input stream has the same % category code as the \meta{test token} (as defined by the test % \cs{token_if_eq_catcode:NNTF}). Spaces are respected by the test -% and the \meta{token} will be left in the input stream after +% and the \meta{token} is left in the input stream after % the \meta{true code} or \meta{false code} (as appropriate to the % result of the test). % \end{function} @@ -780,7 +780,7 @@ % same category code as the \meta{test token} (as defined by the test % \cs{token_if_eq_catcode:NNTF}). Explicit and implicit space tokens % (with character code 32 and category code 10) are ignored and -% removed by the test and the \meta{token} will be left in the input +% removed by the test and the \meta{token} is left in the input % stream after the \meta{true code} or \meta{false code} (as % appropriate to the result of the test). % \end{function} @@ -792,8 +792,8 @@ % Tests if the next \meta{token} in the input stream has the same % category code as the \meta{test token} (as defined by the test % \cs{token_if_eq_catcode:NNTF}). Spaces are respected by the test -% and the \meta{token} will be removed from the input stream if the -% test is true. The function will then place either the +% and the \meta{token} is removed from the input stream if the +% test is true. The function then places either the % \meta{true code} or \meta{false code} in the input stream (as % appropriate to the result of the test). % \end{function} @@ -807,8 +807,8 @@ % same category code as the \meta{test token} (as defined by the test % \cs{token_if_eq_catcode:NNTF}). Explicit and implicit space tokens % (with character code 32 and category code 10) are ignored and -% removed by the test and the \meta{token} will be removed from the -% input stream if the test is true. The function will then place +% removed by the test and the \meta{token} is removed from the +% input stream if the test is true. The function then places % either the \meta{true code} or \meta{false code} in the input stream % (as appropriate to the result of the test). % \end{function} @@ -820,7 +820,7 @@ % Tests if the next \meta{token} in the input stream has the same % character code as the \meta{test token} (as defined by the test % \cs{token_if_eq_charcode:NNTF}). Spaces are respected by the test -% and the \meta{token} will be left in the input stream after +% and the \meta{token} is left in the input stream after % the \meta{true code} or \meta{false code} (as appropriate to the % result of the test). % \end{function} @@ -833,7 +833,7 @@ % same character code as the \meta{test token} (as defined by the test % \cs{token_if_eq_charcode:NNTF}). Explicit and implicit space tokens % (with character code 32 and category code 10) are ignored and removed by -% the test and the \meta{token} will be left in the input stream after +% the test and the \meta{token} is left in the input stream after % the \meta{true code} or \meta{false code} (as appropriate to the % result of the test). % \end{function} @@ -845,8 +845,8 @@ % Tests if the next \meta{token} in the input stream has the same % character code as the \meta{test token} (as defined by the test % \cs{token_if_eq_charcode:NNTF}). Spaces are respected by the test -% and the \meta{token} will be removed from the input stream if the -% test is true. The function will then place either the +% and the \meta{token} is removed from the input stream if the +% test is true. The function then places either the % \meta{true code} or \meta{false code} in the input stream (as % appropriate to the result of the test). % \end{function} @@ -861,8 +861,8 @@ % same character code as the \meta{test token} (as defined by the test % \cs{token_if_eq_charcode:NNTF}). Explicit and implicit space tokens % (with character code 32 and category code 10) are ignored and -% removed by the test and the \meta{token} will be removed from the -% input stream if the test is true. The function will then place +% removed by the test and the \meta{token} is removed from the +% input stream if the test is true. The function then places % either the \meta{true code} or \meta{false code} in the input stream % (as appropriate to the result of the test). % \end{function} @@ -874,7 +874,7 @@ % Tests if the next \meta{token} in the input stream has the same % meaning as the \meta{test token} (as defined by the test % \cs{token_if_eq_meaning:NNTF}). Spaces are respected by the test -% and the \meta{token} will be left in the input stream after +% and the \meta{token} is left in the input stream after % the \meta{true code} or \meta{false code} (as appropriate to the % result of the test). % \end{function} @@ -887,7 +887,7 @@ % same meaning as the \meta{test token} (as defined by the test % \cs{token_if_eq_meaning:NNTF}). Explicit and implicit space tokens % (with character code 32 and category code 10) are ignored and -% removed by the test and the \meta{token} will be left in the input +% removed by the test and the \meta{token} is left in the input % stream after the \meta{true code} or \meta{false code} (as % appropriate to the result of the test). % \end{function} @@ -899,8 +899,8 @@ % Tests if the next \meta{token} in the input stream has the same % meaning as the \meta{test token} (as defined by the test % \cs{token_if_eq_meaning:NNTF}). Spaces are respected by the test -% and the \meta{token} will be removed from the input stream if the -% test is true. The function will then place either the +% and the \meta{token} is removed from the input stream if the +% test is true. The function then places either the % \meta{true code} or \meta{false code} in the input stream (as % appropriate to the result of the test). % \end{function} @@ -915,8 +915,8 @@ % same meaning as the \meta{test token} (as defined by the test % \cs{token_if_eq_meaning:NNTF}). Explicit and implicit space tokens % (with character code 32 and category code 10) are ignored and -% removed by the test and the \meta{token} will be removed from the -% input stream if the test is true. The function will then place +% removed by the test and the \meta{token} is removed from the +% input stream if the test is true. The function then places % either the \meta{true code} or \meta{false code} in the input stream % (as appropriate to the result of the test). % \end{function} @@ -932,18 +932,18 @@ % \begin{syntax} % \cs{token_get_arg_spec:N} \meta{token} % \end{syntax} -% If the \meta{token} is a macro, this function will leave +% If the \meta{token} is a macro, this function leaves % the primitive \TeX{} argument specification in input stream as % a string of tokens of category code $12$ (with spaces having category % code $10$). Thus for example for a token \cs{next} defined by % \begin{verbatim} % \cs_set:Npn \next #1#2 { x #1 y #2 } % \end{verbatim} -% will leave |#1#2| in the input stream. If the \meta{token} is -% not a macro then \cs{scan_stop:} will be left in the input stream. +% leaves |#1#2| in the input stream. If the \meta{token} is +% not a macro then \cs{scan_stop:} is left in the input stream. % \begin{texnote} % If the arg~spec. contains the string |->|, then the |spec| function -% will produce incorrect results. +% produces incorrect results. % \end{texnote} % \end{function} % @@ -951,18 +951,18 @@ % \begin{syntax} % \cs{token_get_replacement_spec:N} \meta{token} % \end{syntax} -% If the \meta{token} is a macro, this function will leave +% If the \meta{token} is a macro, this function leaves % the replacement text in input stream as % a string of tokens of category code $12$ (with spaces having category % code $10$). Thus for example for a token \cs{next} defined by % \begin{verbatim} % \cs_set:Npn \next #1#2 { x #1~y #2 } % \end{verbatim} -% will leave \verb|x#1 y#2| in the input stream. If the \meta{token} is -% not a macro then \cs{scan_stop:} will be left in the input stream. +% leaves \verb|x#1 y#2| in the input stream. If the \meta{token} is +% not a macro then \cs{scan_stop:} is left in the input stream. % \begin{texnote} % If the arg~spec. contains the string |->|, then the |spec| function -% will produce incorrect results. +% produces incorrect results. % \end{texnote} % \end{function} % @@ -970,15 +970,15 @@ % \begin{syntax} % \cs{token_get_prefix_spec:N} \meta{token} % \end{syntax} -% If the \meta{token} is a macro, this function will leave +% If the \meta{token} is a macro, this function leaves % the \TeX{} prefixes applicable in input stream as % a string of tokens of category code $12$ (with spaces having category % code $10$). Thus for example for a token \cs{next} defined by % \begin{verbatim} % \cs_set:Npn \next #1#2 { x #1~y #2 } % \end{verbatim} -% will leave |\long| in the input stream. If the \meta{token} is -% not a macro then \cs{scan_stop:} will be left in the input stream +% leaves |\long| in the input stream. If the \meta{token} is +% not a macro then \cs{scan_stop:} is left in the input stream % \end{function} % % \section{Description of all possible tokens} @@ -1011,7 +1011,7 @@ % There are also a few internal tokens. The following list may be % incomplete in some engines. % \begin{itemize} -% \item Expanding \tn{the}\th{font} results in a token that looks +% \item Expanding \tn{the}\tn{font} results in a token that looks % identical to the command that was used to select the current font % (such as \tn{tenrm}) but it differs from it in shape. % \item A \enquote{frozen} |\relax|, which differs from the primitive in @@ -1030,7 +1030,7 @@ % \end{itemize} % % The meaning of a (non-active) character token is fixed by its category -% code (and character code) and cannot be changed. We will call these +% code (and character code) and cannot be changed. We call these % tokens \emph{explicit} character tokens. Category codes that a % character token can have are listed below by giving a sample output of % the \TeX{} primitive \tn{meaning}, together with their \LaTeX3 names @@ -1055,7 +1055,7 @@ % % The meaning of a control sequence or active character can be identical % to that of any character token listed above (with any character code), -% and we will call such tokens \emph{implicit} character tokens. The +% and we call such tokens \emph{implicit} character tokens. The % meaning is otherwise in the following list: % \begin{itemize} % \item a macro, used in \LaTeX3 for most functions and some variables @@ -1499,9 +1499,9 @@ \char_set_catcode_math_toggle:n { 0 } \tl_put_right:Nn \l_@@_tmp_tl { \or: ^^@ } % \end{macrocode} -% As \TeX{} will be very unhappy if if finds an alignment character inside +% As \TeX{} is very unhappy if if finds an alignment character inside % a primitive \tn{halign} even when skipping false branches, some precautions -% are required. \TeX{} will be happy if the token is hidden inside +% are required. \TeX{} is happy if the token is hidden inside % \tn{unexpanded} (which needs to be the primitive). The expansion chain here % is required so that the conditional gets cleaned up correctly (other code % assumes there is exactly one token to skip during the clean-up). @@ -1715,7 +1715,7 @@ % avoid an error message: within a group we prevent % \cs{c_parameter_token} from behaving like a macro parameter character. % The definitions of \cs{prg_new_conditional:Npnn} are global, so they -% will remain after the group. +% remain after the group. % \begin{macrocode} \group_begin: \cs_set_eq:NN \c_parameter_token \scan_stop: @@ -1838,7 +1838,7 @@ % % \begin{macro}[pTF]{\token_if_macro:N} % \begin{macro}[aux]{\@@_if_macro_p:w} -% When a token is a macro, \cs{token_to_meaning:N} will always output +% When a token is a macro, \cs{token_to_meaning:N} always outputs % something like |\long macro:#1->#1| so we could naively check to % see if the meaning contains |->|. However, this can fail the five % \tn[no-index]{...mark} primitives, whose meaning has the form @@ -1901,8 +1901,8 @@ % \end{macro} % % \begin{macro}[pTF]{\token_if_expandable:N} -% Check if token is expandable. We use the fact that \TeX{} will -% temporarily convert \cs{exp_not:N} \meta{token} into \cs{scan_stop:} +% Check if token is expandable. We use the fact that \TeX{} +% temporarily converts \cs{exp_not:N} \meta{token} into \cs{scan_stop:} % if \meta{token} is expandable. An \texttt{undefined} token is not % considered as expandable. No problem nesting the conditionals, % since the third |#1| is only skipped if it is non-expandable (hence @@ -1938,7 +1938,7 @@ % argument begins with a particular string. Each auxiliary takes an % argument delimited by a string, a second one delimited by % \cs{q_stop}, and returns the first one and its delimiter. -% This result will eventually be compared to another string. +% This result is eventually compared to another string. % \begin{macrocode} \group_begin: \cs_set_protected:Npn \@@_tmp:w #1 @@ -2088,7 +2088,7 @@ % % We start by removing the two first (non-space) characters from % the meaning. This removes the escape character (which may be -% inexistent depending on \tn{endlinechar}), and takes care +% nonexistent depending on \tn{endlinechar}), and takes care % of three of the exceptions: \tn{space}, \tn{italiccorr} % and \tn{hyphen}, whose meaning is at most two characters. % This leaves a string terminated by some |:|, and \cs{q_stop}. @@ -2336,7 +2336,7 @@ % The catcode and charcode tests are very similar, and in order to use % the same auxiliaries we do something a little bit odd, firing % \cs{if_catcode:w} and \cs{if_charcode:w} before finding the operands -% for those tests, which will only be given in the |auxii:N| and +% for those tests, which are only given in the |auxii:N| and % |auxiii:| auxiliaries. For our purposes, three kinds of tokens may % follow the peeking function: % \begin{itemize} diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index fcc6c4e6dfd..7d93a5cad0e 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/29] -%<package>\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +%<package>\@ifpackagelater{expl3}{2017/07/15} %<package> {} %<package> {% %<package> \PackageError{l3keys2e}{Support package l3kernel too old} @@ -60,7 +60,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -131,7 +131,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3keys2e}{2017/05/29}{} +\ProvidesExplPackage{l3keys2e}{2017/07/15}{} {LaTeX2e option processing using LaTeX3 keys} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx index dd3477874f9..f5af0b21774 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx @@ -23,16 +23,16 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/29] -%<package>\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +%<package>\@ifpackagelater{expl3}{2017/07/15} %<package> {} %<package> {% -%<package> \PackageError{xfpu}{Support package l3kernel too old} +%<package> \PackageError{xfp}{Support package l3kernel too old} %<package> {% %<package> Please install an up to date version of l3kernel\MessageBreak %<package> using your TeX package manager or from CTAN.\MessageBreak %<package> \MessageBreak -%<package> Loading xfpu will abort!% +%<package> Loading xfp will abort!% %<package> }% %<package> \endinput %<package> } @@ -62,7 +62,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -120,7 +120,7 @@ % \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians). % \item Dimensions, automatically expressed in points, \emph{e.g.}, % \texttt{pc} is~$12$. -% \item Automatic conversion (no need for \cs{number} of +% \item Automatic conversion (no need for \cs{number}) of % integer, dimension, and skip variables to floating points, % expressing dimensions in points and ignoring the stretch and % shrink components of skips. @@ -136,14 +136,14 @@ % % \begin{implementation} % -% \section{\pkg{xfpu} implementation} +% \section{\pkg{xfp} implementation} % % \begin{macrocode} %<*package> % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfp}{2017/05/29}{} +\ProvidesExplPackage{xfp}{2017/07/15}{} {L3 Floating point unit} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index cfdfc5d5e9f..289e1932800 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/29] -%<package>\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +%<package>\@ifpackagelater{expl3}{2017/07/15} %<package> {} %<package> {% %<package> \PackageError{xfrac}{Support package l3kernel too old} @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -533,7 +533,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfrac}{2017/05/29}{} +\ProvidesExplPackage{xfrac}{2017/07/15}{} {L3 Experimental split-level fractions} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index 98e99bfbd88..9f43230d35c 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/29] -%<package>\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +%<package>\@ifpackagelater{expl3}{2017/07/15} %<package> {} %<package> {% %<package> \PackageError{xparse}{Support package l3kernel too old} @@ -67,7 +67,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -776,7 +776,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xparse}{2017/05/29}{} +\ProvidesExplPackage{xparse}{2017/07/15}{} {L3 Experimental document command parser} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 3ceba577192..6e02cb5befd 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/29] -%<package>\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +%<package>\@ifpackagelater{expl3}{2017/07/15} %<package> {} %<package> {% %<package> \PackageError{xtemplate}{Support package l3kernel too old} @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2017/05/29} +% \date{Released 2017/07/15} % % \maketitle % @@ -682,7 +682,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xtemplate}{2017/05/29}{} +\ProvidesExplPackage{xtemplate}{2017/07/15}{} {L3 Experimental prototype document functions} % \end{macrocode} % diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty index 934457dae78..e6eea5f4b15 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty @@ -20,7 +20,7 @@ %% %% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \RequirePackage{expl3} -\ProvidesExplPackage{l3str-convert}{2017/05/29}{} +\ProvidesExplPackage{l3str-convert}{2017/07/15}{} {L3 Experimental string encoding conversions} \cs_if_exist:NF \use_ii_i:nn { \cs_new:Npn \use_ii_i:nn #1#2 { #2 #1 } } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index b638c905b0a..fa88bb5ca45 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -20,7 +20,7 @@ %% %% File: l3str-format.dtx Copyright (C) 2012-2013,2015-2017 The LaTeX3 Project \RequirePackage{expl3} -\ProvidesExplPackage{l3str-format}{2017/05/29}{} +\ProvidesExplPackage{l3str-format}{2017/07/15}{} {L3 Experimental string formatting} \RequirePackage{l3str} \cs_generate_variant:Nn \use:nn { nf } diff --git a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty index 4158ff85dbd..bc90583cfa7 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty @@ -20,7 +20,7 @@ %% %% File: xcoffins.dtx Copyright(C) 2010-2012,2014,2016,2017 The LaTeX3 Project \RequirePackage{xparse} -\ProvidesExplPackage{xcoffins}{2017/05/29}{} +\ProvidesExplPackage{xcoffins}{2017/07/15}{} {L3 Experimental design level coffins} \keys_define:nn { coffin } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index 9f687c7e4f5..d436dff2ad9 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -20,8 +20,8 @@ %% %% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach %% (C) 2010-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/29] -\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +\@ifpackagelater{expl3}{2017/07/15} {} {% \PackageError{l3galley}{Support package l3kernel too old} @@ -33,7 +33,7 @@ }% \endinput } -\ProvidesExplPackage{l3galley}{2017/05/29}{} +\ProvidesExplPackage{l3galley}{2017/07/15}{} {L3 Experimental galley code} \int_new:N \l__galley_tmp_int \seq_new:N \g__galley_tmpa_seq diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty index 53ce196568a..033fd58bc4f 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty @@ -21,7 +21,7 @@ %% File: xgalley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach %% (C) 2010-2012,2014,2016-2017 The LaTeX3 Project \RequirePackage{xparse} -\ProvidesExplPackage{xgalley}{2017/05/29}{} +\ProvidesExplPackage{xgalley}{2017/07/15}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} \clist_new:N \l__galley_tmpa_clist diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index ed3ba7dd47d..6bf8dcf4de8 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -62,7 +62,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/29}% +\def\ExplFileDate{2017/07/15}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -187,7 +187,7 @@ local t = { } for _,i in pairs(tex.extraprimitives("luatex")) do if string.match(i,"^U") then - if not string.match(i,"^Uchar$") then + if not string.match(i,"^Uchar$") then %$ table.insert(t,i) end end @@ -826,6 +826,8 @@ \__kernel_primitive:NN \pdfdraftmode \pdftex_draftmode:D \__kernel_primitive:NN \pdfeachlinedepth \pdftex_eachlinedepth:D \__kernel_primitive:NN \pdfeachlineheight \pdftex_eachlineheight:D + \__kernel_primitive:NN \pdffilemoddate \pdftex_filemoddate:D + \__kernel_primitive:NN \pdffilesize \pdftex_filesize:D \__kernel_primitive:NN \pdffirstlineheight \pdftex_firstlineheight:D \__kernel_primitive:NN \pdffontexpand \pdftex_fontexpand:D \__kernel_primitive:NN \pdffontsize \pdftex_fontsize:D @@ -836,6 +838,7 @@ \__kernel_primitive:NN \pdflastypos \pdftex_lastypos:D \__kernel_primitive:NN \pdfmapfile \pdftex_mapfile:D \__kernel_primitive:NN \pdfmapline \pdftex_mapline:D + \__kernel_primitive:NN \pdfmdfivesum \pdftex_mdfivesum:D \__kernel_primitive:NN \pdfnoligatures \pdftex_noligatures:D \__kernel_primitive:NN \pdfnormaldeviate \pdftex_normaldeviate:D \__kernel_primitive:NN \pdfpageheight \pdftex_pageheight:D @@ -925,6 +928,7 @@ \__kernel_primitive:NN \XeTeXvariationname \xetex_variationname:D \__kernel_primitive:NN \XeTeXrevision \xetex_XeTeXrevision:D \__kernel_primitive:NN \XeTeXversion \xetex_XeTeXversion:D + \__kernel_primitive:NN \mdfivesum \pdftex_mdfivesum:D \__kernel_primitive:NN \ifprimitive \pdftex_ifprimitive:D \__kernel_primitive:NN \primitive \pdftex_primitive:D \__kernel_primitive:NN \shellescape \pdftex_shellescape:D @@ -1755,29 +1759,6 @@ { \cs_if_exist:cTF {#1} { \use:c {#1} #2 } { } } \cs_set:Npn \cs_if_exist_use:c #1 { \cs_if_exist:cTF {#1} { \use:c {#1} } { } } -\cs_set_protected:Npn \iow_log:x - { \tex_immediate:D \tex_write:D -1 } -\cs_set_protected:Npn \iow_term:x - { \tex_immediate:D \tex_write:D 16 } -\tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \__chk_log:x { \iow_log:x } - \cs_set_protected:Npn \__chk_suspend_log: - { - \cs_set_protected:Npx \__chk_resume_log: - { - \cs_set_protected:Npn \__chk_resume_log: - { \exp_not:o { \__chk_resume_log: } } - \cs_set_protected:Npn \__chk_log:x - { \exp_not:o { \__chk_log:x } } - } - \cs_set_protected:Npn \__chk_log:x { \use_none:n } - } - \cs_set_protected:Npn \__chk_resume_log: { } -\else: - \cs_set_protected:Npn \__chk_log:x { \use_none:n } - \cs_set_protected:Npn \__chk_suspend_log: { } - \cs_set_protected:Npn \__chk_resume_log: { } -\fi: \cs_set_protected:Npn \__msg_kernel_error:nnxx #1#2#3#4 { \tex_newlinechar:D = `\^^J \tex_relax:D @@ -1797,6 +1778,85 @@ { \__msg_kernel_error:nnxx {#1} {#2} { } { } } \cs_set:Npn \msg_line_context: { on~line~ \tex_the:D \tex_inputlineno:D } +\cs_set_protected:Npn \iow_log:x + { \tex_immediate:D \tex_write:D -1 } +\cs_set_protected:Npn \iow_term:x + { \tex_immediate:D \tex_write:D 16 } +\cs_set_protected:Npn \debug_log_functions_on: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_log_functions_on: } + } +\cs_set_protected:Npn \debug_log_functions_off: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_log_functions_off: } + } +\cs_set_protected:Npn \__debug_suspend_log: { } +\cs_set_protected:Npn \__debug_resume_log: { } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \debug_log_functions_on: + { + \cs_set_protected:Npn \__debug_log:x { \iow_log:x } + \cs_set_protected:Npn \__debug_suspend_log: + { + \cs_set_protected:Npx \__debug_resume_log: + { + \cs_set_protected:Npn \__debug_resume_log: + { \exp_not:o { \__debug_resume_log: } } + \cs_set_protected:Npn \__debug_log:x + { \exp_not:o { \__debug_log:x } } + } + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \cs_set_protected:Npn \debug_log_functions_off: + { + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + \cs_set_protected:Npn \__debug_suspend_log: { } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \tex_ifodd:D \l@expl@log@functions@bool + \debug_log_functions_on: + \else: + \debug_log_functions_off: + \fi: +\fi: +\cs_set_protected:Npn \__debug_patch:nnNw #1#2 { } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \__debug_patch:nnNw #1#2#3 + { + \tex_ifcase:D + \if_meaning:w #3 \cs_new_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_new:Npn 1~ \fi: + \if_meaning:w #3 \cs_set_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_set:Npn 1~ \fi: + \if_meaning:w #3 \cs_gset_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_gset:Npn 1~ \fi: + \if_meaning:w #3 \prg_new_protected_conditional:Npnn 2~ \fi: + \if_meaning:w #3 \prg_new_conditional:Npnn 2~ \fi: + \__msg_kernel_error:nnx { kernel } { debug-unpatchable } + { \token_to_str:N #3 } + \or: + \exp_after:wN \__debug_patch_param:NNnnNnp + \exp_after:wN \__debug_patch_new:nnNNnn + \else: + \exp_after:wN \__debug_patch_param:NNnnNnp + \exp_after:wN \__debug_patch_new_conditional:nnNNnnn + \fi: + \use_none:nn {#1} {#2} #3 + } + \cs_set_protected:Npn \__debug_patch_param:NNnnNnp #1#2#3#4#5#6#7# + { #1 {#3} {#4} #5 #6 {#7} } + \cs_set_protected:Npn \__debug_patch_new:nnNNnn #1#2#3#4#5#6 + { #3 #4 #5 { #1 #6 #2 } } + \cs_set_protected:Npn \__debug_patch_new_conditional:nnNNnnn + #1#2#3#4#5#6#7 + { #3 #4 #5 {#6} { #1 #7 #2 } } +\fi: +\__debug_patch:nnNw { } + { \__debug_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \cs_set_protected:Npn \__chk_if_free_cs:N #1 { \cs_if_free:NF #1 @@ -1804,29 +1864,38 @@ \__msg_kernel_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } -} -\tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \__chk_if_free_cs:N #1 - { - \cs_if_free:NF #1 - { - \__msg_kernel_error:nnxx { kernel } { command-already-defined } - { \token_to_str:N #1 } { \token_to_meaning:N #1 } - } - \__chk_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } - } -\fi: + } \cs_set_protected:Npn \__chk_if_free_cs:c { \exp_args:Nc \__chk_if_free_cs:N } -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \__chk_if_exist_var:N #1 +\cs_set_protected:Npn \debug_check_declarations_on: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_check_declarations_on: } + } +\cs_set_protected:Npn \debug_check_declarations_off: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_check_declarations_off: } + } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \debug_check_declarations_on: { - \cs_if_exist:NF #1 + \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { - \__msg_kernel_error:nnx { check } { non-declared-variable } - { \token_to_str:N #1 } + \cs_if_exist:NF ##1 + { + \__msg_kernel_error:nnx { check } { non-declared-variable } + { \token_to_str:N ##1 } + } } } + \cs_set_protected:Npn \debug_check_declarations_off: + { \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { } } + \tex_ifodd:D \l@expl@check@declarations@bool + \debug_check_declarations_on: + \else: + \debug_check_declarations_off: + \fi: \fi: \cs_set_protected:Npn \__chk_if_exist_cs:N #1 { @@ -2474,7 +2543,7 @@ \q_mark \__msg_kernel_error:nnxx { kernel } { variant-too-long } {#5} { \token_to_str:N #3 } - \use_none:nnnn + \use_none:nnn \q_stop #3 #3 @@ -2489,7 +2558,7 @@ \q_mark \__msg_kernel_error:nnxxxx { kernel } { invalid-variant } {#7} { \token_to_str:N #5 } {#1} {#2} - \use_none:nnnn + \use_none:nnn \q_stop #5 #5 @@ -2507,24 +2576,29 @@ \fi: \fi: } +\__debug_patch:nnNw + { + \cs_if_free:NF #4 + { + \__debug_log:x + { + Variant~\token_to_str:N #4~% + already~defined;~ not~ changing~ it~ \msg_line_context: + } + } + } + { } \cs_new_protected:Npn \__cs_generate_variant:wwNN #1 \q_mark #2 \q_stop #3#4 { #2 - \cs_if_free:NTF #4 + \cs_if_free:NT #4 { \group_begin: \__cs_generate_internal_variant:n {#1} \__cs_tmp:w #4 { \exp_not:c { exp_args:N #1 } \exp_not:N #3 } \group_end: } - { - \__chk_log:x - { - Variant~\token_to_str:N #4~% - already~defined;~ not~ changing~ it~ \msg_line_context: - } - } } \cs_new_protected:Npx \__cs_generate_internal_variant:n #1 { @@ -2588,16 +2662,41 @@ { \tl_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } \cs_generate_variant:Nn \tl_clear_new:N { c } \cs_generate_variant:Nn \tl_gclear_new:N { c } -\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \tl_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \tl_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \tl_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_new_protected:Npn \tl_set_eq:NN #1#2 + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \cs_set_eq:NN #1 #2 + } + \cs_new_protected:Npn \tl_gset_eq:NN #1#2 + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \cs_gset_eq:NN #1 #2 + } +\else: + \cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN + \cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN +\fi: +\cs_generate_variant:Nn \tl_set_eq:NN { cN, Nc, cc } +\cs_generate_variant:Nn \tl_gset_eq:NN { cN, Nc, cc } +\__debug_patch:nnNw + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \__chk_if_exist_var:N #3 + } + { } \cs_new_protected:Npn \tl_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\__debug_patch:nnNw + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \__chk_if_exist_var:N #3 + } + { } \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } \cs_generate_variant:Nn \tl_concat:NNN { ccc } @@ -2606,16 +2705,22 @@ \prg_new_eq_conditional:NNn \tl_if_exist:c \cs_if_exist:c { TF , T , F , p } \tl_const:Nn \c_empty_tl { } \tl_const:Nn \c_space_tl { ~ } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:Nx #1#2 { \cs_set_nopar:Npx #1 {#2} } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:Nx #1#2 { \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } @@ -2624,20 +2729,28 @@ \cs_generate_variant:Nn \tl_gset:Nn { NV , Nv , Nf } \cs_generate_variant:Nn \tl_gset:Nx { c } \cs_generate_variant:Nn \tl_gset:Nn { c, co , cV , cv , cf } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nx #1#2 { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nx #1#2 { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } @@ -2648,20 +2761,28 @@ \cs_generate_variant:Nn \tl_gput_left:NV { c } \cs_generate_variant:Nn \tl_gput_left:No { c } \cs_generate_variant:Nn \tl_gput_left:Nx { c } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } @@ -2672,61 +2793,6 @@ \cs_generate_variant:Nn \tl_gput_right:NV { c } \cs_generate_variant:Nn \tl_gput_right:No { c } \cs_generate_variant:Nn \tl_gput_right:Nx { c } -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \__cs_tmp:w #1 - { - \if_meaning:w \q_recursion_tail #1 - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: - \use:x - { - \cs_set_protected:Npn #1 \exp_not:n { ##1 ##2 } - { - \__chk_if_exist_var:N \exp_not:n {##1} - \exp_not:o { #1 {##1} {##2} } - } - } - \__cs_tmp:w - } - \__cs_tmp:w - \tl_set:Nn \tl_set:No \tl_set:Nx - \tl_gset:Nn \tl_gset:No \tl_gset:Nx - \tl_put_left:Nn \tl_put_left:NV - \tl_put_left:No \tl_put_left:Nx - \tl_gput_left:Nn \tl_gput_left:NV - \tl_gput_left:No \tl_gput_left:Nx - \tl_put_right:Nn \tl_put_right:NV - \tl_put_right:No \tl_put_right:Nx - \tl_gput_right:Nn \tl_gput_right:NV - \tl_gput_right:No \tl_gput_right:Nx - \q_recursion_tail \q_recursion_stop - \cs_set_protected:Npn \tl_set_eq:NN #1#2 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \cs_set_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_gset_eq:NN #1#2 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \cs_gset_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_concat:NNN #1#2#3 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 - \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } - } - \cs_set_protected:Npn \tl_gconcat:NNN #1#2#3 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 - \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } - } -\tex_fi:D \tl_const:Nx \c__tl_rescan_marker_tl { : \token_to_str:N : } \cs_new_protected:Npn \tl_set_rescan:Nnn { \__tl_set_rescan:NNnn \tl_set:Nn } @@ -4051,7 +4117,7 @@ \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = 0 \exp_stop_f: \else: \tl_const:cx - { c__unicode_title_ \utex_char:D "#1 _tl } + { c__unicode_mixed_ \utex_char:D "#1 _tl } { \utex_char:D "#7 } \fi: } @@ -4081,7 +4147,7 @@ \use:n { \__unicode_parse_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = 0 \exp_stop_f: \else: - \use:n { \__unicode_parse_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop + \use:n { \__unicode_parse_auxii:w #1 ~ mixed ~ #3 ~ } ~ \q_stop \fi: } \cs_set_protected:Npn \__unicode_parse_auxii:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop @@ -5494,7 +5560,9 @@ \cs_new:cpn { flag~#1 } ##1 ; { \exp_after:wN \use_none:n \cs:w flag~#1~##1 \cs_end: } } -\cs_new_protected:Npn \flag_clear:n { \__flag_clear:wn 0 ; } +\__debug_patch:nnNw + { \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } } { } +\cs_new_protected:Npn \flag_clear:n #1 { \__flag_clear:wn 0 ; {#1} } \cs_new_protected:Npn \__flag_clear:wn #1 ; #2 { \if_cs_exist:w flag~#2~#1 \cs_end: @@ -5515,11 +5583,22 @@ } \cs_new_protected:Npn \flag_log:n { \__msg_log_next: \flag_show:n } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_new:Npn \__flag_chk_exist:n #1 + { + \flag_if_exist:nF {#1} + { + \__msg_kernel_expandable_error:nnn + { kernel } { bad-variable } { flag~#1~ } + } + } +\fi: \prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } { \cs_if_exist:cTF { flag~#1 } { \prg_return_true: } { \prg_return_false: } } +\__debug_patch:nnNw { \__flag_chk_exist:n {#1} } { } \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } { \if_cs_exist:w flag~#1~0 \cs_end: @@ -5528,7 +5607,8 @@ \prg_return_false: \fi: } -\cs_new:Npn \flag_height:n { \__flag_height_loop:wn 0; } +\__debug_patch:nnNw { \__flag_chk_exist:n {#1} } { } +\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:wn 0; {#1} } \cs_new:Npn \__flag_height_loop:wn #1 ; #2 { \if_cs_exist:w flag~#2~#1 \cs_end: @@ -5544,35 +5624,6 @@ \cs:w flag~#1 \exp_after:wN \cs_end: \__int_value:w \flag_height:n {#1} ; } -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \flag_clear:n #1 - { - \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } - \__flag_clear:wn 0 ; {#1} - } - \cs_set:Npn \__flag_chk_exist:n #1 - { - \flag_if_exist:nF {#1} - { - \__msg_kernel_expandable_error:nnn - { kernel } { bad-variable } { flag~#1~ } - } - } - \cs_set:Npn \flag_height:n #1 - { - \__flag_chk_exist:n {#1} - \__flag_height_loop:wn 0; {#1} - } - \prg_set_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } - { - \__flag_chk_exist:n {#1} - \if_cs_exist:w flag~#1~0 \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\fi: %% File: l3quark.dtx Copyright (C) 1990-2017 The LaTeX3 Project \cs_new_protected:Npn \quark_new:N #1 { \tl_const:Nn #1 {#1} } \quark_new:N \q_nil @@ -5685,74 +5736,34 @@ \cs_new_eq:NN \if_predicate:w \tex_ifodd:D \cs_new_protected:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_new:N { c } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_set_true:N { c } \cs_generate_variant:Nn \bool_set_false:N { c } \cs_generate_variant:Nn \bool_gset_true:N { c } \cs_generate_variant:Nn \bool_gset_false:N { c } -\cs_new_eq:NN \bool_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \bool_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \bool_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \bool_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \bool_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \bool_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \bool_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \bool_gset_eq:cc \cs_gset_eq:cc +\cs_new_eq:NN \bool_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \bool_gset_eq:NN \tl_gset_eq:NN +\cs_generate_variant:Nn \bool_set_eq:NN { Nc, cN, cc } +\cs_generate_variant:Nn \bool_gset_eq:NN { Nc, cN, cc } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set:Nn #1#2 { \tex_chardef:D #1 = \bool_if_p:n {#2} } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } \cs_generate_variant:Nn \bool_set:Nn { c } \cs_generate_variant:Nn \bool_gset:Nn { c } -\if_bool:N \l@expl@check@declarations@bool - \cs_set_protected:Npn \bool_set_true:N #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 \c_true_bool - } - \cs_set_protected:Npn \bool_set_false:N #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 \c_false_bool - } - \cs_set_protected:Npn \bool_gset_true:N #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 \c_true_bool - } - \cs_set_protected:Npn \bool_gset_false:N #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 \c_false_bool - } - \cs_set_protected:Npn \bool_set_eq:NN #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 - } - \cs_set_protected:Npn \bool_gset_eq:NN #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 - } - \cs_set_protected:Npn \bool_set:Nn #1#2 - { - \__chk_if_exist_var:N #1 - \tex_chardef:D #1 = \bool_if_p:n {#2} - } - \cs_set_protected:Npn \bool_gset:Nn #1#2 - { - \__chk_if_exist_var:N #1 - \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} - } -\fi: \prg_new_conditional:Npnn \bool_if:N #1 { p , T , F , TF } { \if_meaning:w \c_true_bool #1 @@ -7569,6 +7580,8 @@ \cs_if_exist:cTF { \c__msg_text_prefix_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } +\__debug_patch:nnNw { } + { \__debug_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \cs_new_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} @@ -7577,17 +7590,6 @@ {#1} {#2} } } -\if_bool:N \l@expl@log@functions@bool - \cs_gset_protected:Npn \__chk_if_free_msg:nn #1#2 - { - \msg_if_exist:nnT {#1} {#2} - { - \__msg_kernel_error:nnxx { kernel } { message-already-defined } - {#1} {#2} - } - \__chk_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } - } -\fi: \cs_new_protected:Npn \msg_new:nnnn #1#2 { \__chk_if_free_msg:nn {#1} {#2} @@ -7621,7 +7623,7 @@ \tl_const:Nn \c__msg_continue_text_tl { Type~<return>~to~continue } \tl_const:Nn \c__msg_critical_text_tl - { Reading~the~current~file~'\g_file_current_name_tl'~will~stop. } + { Reading~the~current~file~'\g_file_curr_name_str'~will~stop. } \tl_const:Nn \c__msg_fatal_text_tl { This~is~a~fatal~error:~LaTeX~will~abort. } \tl_const:Nn \c__msg_help_text_tl @@ -7678,7 +7680,6 @@ |............................................... } } - \group_begin: \char_set_lccode:nn {`\{} {`\ } \char_set_lccode:nn {`\}} {`\ } @@ -8183,19 +8184,6 @@ LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. } -\bool_if:NT \l@expl@check@declarations@bool - { - \__msg_kernel_new:nnnn { check } { non-declared-variable } - { The~variable~#1~has~not~been~declared~\msg_line_context:. } - { - Checking~is~active,~and~you~have~tried~do~so~something~like: \\ - \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ - without~first~having: \\ - \ \ \tl_new:N ~ #1 \\ - \\ - LaTeX~will~create~the~variable~and~continue. - } - } \__msg_kernel_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { @@ -8226,6 +8214,32 @@ with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~ from~type~'#3'~to~type~'#4'. } +\bool_if:NTF \l@expl@enable@debug@bool + { + \__msg_kernel_new:nnn { kernel } { debug-unpatchable } + { Only~some~definitions~can~be~patched;~'#3'~cannot. } + \__msg_kernel_new:nnnn { check } { non-declared-variable } + { The~variable~#1~has~not~been~declared~\msg_line_context:. } + { + Checking~is~active,~and~you~have~tried~do~so~something~like: \\ + \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ + without~first~having: \\ + \ \ \tl_new:N ~ #1 \\ + \\ + LaTeX~will~create~the~variable~and~continue. + } + } + { + \__msg_kernel_new:nnnn { kernel } { enable-debug } + { To~use~'#1'~load~expl3~with~the~'enable-debug'~option. } + { + The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ + some~internal~functions~in~expl3~have~been~appropriately~ + defined.~This~only~happens~if~one~of~the~options~ + 'enable-debug',~'check-declarations'~or~'log-functions'~was~ + given~when~loading~expl3. + } + } \__msg_kernel_new:nnn { kernel } { bad-variable } { Erroneous~variable~#1 used! } \__msg_kernel_new:nnn { kernel } { misused-sequence } @@ -8403,166 +8417,225 @@ \ \ => \ \ \tl_to_str:n {#2} } %% File: l3file.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\tl_new:N \g_file_current_name_tl +\str_new:N \g_file_curr_dir_str +\str_new:N \g_file_curr_ext_str +\str_new:N \g_file_curr_name_str \cs_if_exist:NT \@currname - { \tl_gset_eq:NN \g_file_current_name_tl \@currname } + { \str_gset_eq:NN \g_file_curr_name_str \@currname } \seq_new:N \g__file_stack_seq -\seq_new:N \g__file_record_seq -\tl_new:N \l__file_internal_tl -\tl_new:N \l__file_internal_name_tl -\seq_new:N \l__file_search_path_seq -\seq_new:N \l__file_saved_search_path_seq -\seq_new:N \l__file_internal_seq -\cs_new_protected:Npn \__file_name_sanitize:nn #1#2 - { - \group_begin: - \seq_map_inline:Nn \l_char_active_seq - { - \tl_set:Nx \l__file_internal_tl { \iow_char:N ##1 } - \char_set_active_eq:NN ##1 \l__file_internal_tl - } - \tl_set:Nx \l__file_internal_name_tl {#1} - \tl_set:Nx \l__file_internal_name_tl - { \tl_to_str:N \l__file_internal_name_tl } - \int_compare:nNnTF - { - \int_mod:nn - { - 0 \tl_map_function:NN \l__file_internal_name_tl - \__file_name_sanitize_aux:n - } - { 2 } - } - = 0 +\group_begin: + \cs_set_protected:Npn \__file_tmp:w #1#2#3 + { + \tl_if_blank:nTF {#1} { - \tl_remove_all:Nn \l__file_internal_name_tl { " } - \tl_if_in:NnT \l__file_internal_name_tl { ~ } + \cs_set:Npn \__file_tmp:w ##1 " ##2 " ##3 \q_stop { { } {##2} { } } + \seq_gput_right:Nx \g__file_stack_seq { - \tl_set:Nx \l__file_internal_name_tl - { " \exp_not:V \l__file_internal_name_tl " } + \exp_after:wN \__file_tmp:w \tex_jobname:D + " \tex_jobname:D " \q_stop } } { - \__msg_kernel_error:nnx - { kernel } { unbalanced-quote-in-filename } - { \l__file_internal_name_tl } + \seq_gput_right:Nn \g__file_stack_seq { { } {#1} {#2} } + \__file_tmp:w } - \use:x + } + \cs_if_exist:NT \@currnamestack + { \exp_after:wN \__file_tmp:w \@currnamestack } +\group_end: +\seq_new:N \g__file_record_seq +\tl_new:N \l__file_tmp_tl +\str_new:N \l__file_base_name_str +\str_new:N \l__file_full_name_str +\str_new:N \l__file_dir_str +\str_new:N \l__file_ext_str +\str_new:N \l__file_name_str +\seq_new:N \l_file_search_path_seq +\seq_new:N \l__file_tmp_seq +\cs_new_protected:Npn \__file_name_sanitize:nN #1#2 + { + \group_begin: + \seq_map_inline:Nn \l_char_active_seq { - \group_end: - \exp_not:n {#2} { \l__file_internal_name_tl } + \tl_set:Nx \l__file_tmp_tl { \iow_char:N ##1 } + \char_set_active_eq:NN ##1 \l__file_tmp_tl } + \tl_set:Nx \l__file_tmp_tl {#1} + \tl_set:Nx \l__file_tmp_tl + { \tl_to_str:N \l__file_tmp_tl } + \exp_args:NNNV \group_end: + \str_set:Nn #2 \l__file_tmp_tl } -\cs_new:Npn \__file_name_sanitize_aux:n #1 - { \token_if_eq_charcode:NNT #1 " { + 1 } } -\cs_new_protected:Npn \file_add_path:nN #1 - { \__file_name_sanitize:nn {#1} { \__file_add_path:nN } } -\cs_new_protected:Npn \__file_add_path:nN #1#2 - { - \__ior_open:Nn \g__file_internal_ior {#1} - \ior_if_eof:NTF \g__file_internal_ior - { \__file_add_path_search:nN {#1} #2 } - { \tl_set:Nn #2 {#1} } - \ior_close:N \g__file_internal_ior +\cs_new_protected:Npn \__file_name_quote:nN #1#2 + { + \str_set:Nx #2 {#1} + \int_if_even:nF + { 0 \tl_map_function:NN #2 \__file_name_quote_aux:n } + { + \__msg_kernel_error:nnx + { kernel } { unbalanced-quote-in-filename } {#2} + } + \tl_remove_all:Nn #2 { " } + \tl_if_in:NnT #2 { ~ } + { \str_set:Nx #2 { " \exp_not:V #2 " } } } -\cs_new_protected:Npn \__file_add_path_search:nN #1#2 +\cs_new:Npn \__file_name_quote_aux:n #1 + { \token_if_eq_charcode:NNT #1 " { + 1 } } +\cs_new_protected:Npn \file_get_full_name:nN #1#2 { - \tl_set:Nn #2 { \q_no_value } + \__file_name_sanitize:nN {#1} \l__file_base_name_str + \__file_get_full_name_search:nN { } \use:n + \seq_map_inline:Nn \l_file_search_path_seq + { \__file_get_full_name_search:nN { ##1 / } \seq_map_break:n } \cs_if_exist:NT \input@path { - \seq_set_eq:NN \l__file_saved_search_path_seq - \l__file_search_path_seq - \seq_set_split:NnV \l__file_internal_seq { , } \input@path - \seq_concat:NNN \l__file_search_path_seq - \l__file_search_path_seq \l__file_internal_seq + \tl_map_inline:Nn \input@path + { \__file_get_full_name_search:nN { ##1 } \tl_map_break:n } } - \seq_map_inline:Nn \l__file_search_path_seq + \str_clear:N \l__file_full_name_str + \__prg_break_point: + \str_if_empty:NF \l__file_full_name_str { - \__ior_open:Nn \g__file_internal_ior { ##1 #1 } - \ior_if_eof:NF \g__file_internal_ior + \exp_args:NV \file_parse_full_name:nNNN \l__file_full_name_str + \l__file_dir_str \l__file_name_str \l__file_ext_str + \str_if_empty:NT \l__file_ext_str { - \tl_set:Nx #2 { ##1 #1 } - \seq_map_break: + \__ior_open:No \g__file_internal_ior + { \l__file_full_name_str .tex } + \ior_if_eof:NF \g__file_internal_ior + { \str_put_right:Nn \l__file_full_name_str { .tex } } } } - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l__file_search_path_seq - \l__file_saved_search_path_seq - } + \str_set_eq:NN #2 \l__file_full_name_str + \ior_close:N \g__file_internal_ior + } +\cs_generate_variant:Nn \file_get_full_name:nN { V } +\cs_new_protected:Npn \__file_get_full_name_search:nN #1#2 + { + \__file_name_quote:nN + { \tl_to_str:n {#1} \l__file_base_name_str } + \l__file_full_name_str + \__ior_open:No \g__file_internal_ior \l__file_full_name_str + \ior_if_eof:NF \g__file_internal_ior { #2 { \__prg_break: } } } \prg_new_protected_conditional:Npnn \file_if_exist:n #1 { T , F , TF } { - \file_add_path:nN {#1} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str { \prg_return_false: } { \prg_return_true: } } -\cs_new_protected:Npn \file_input:n #1 +\cs_new_protected:Npn \__file_missing:n #1 { - \__file_if_exist:nT {#1} - { \__file_input:V \l__file_internal_name_tl } + \__file_name_sanitize:nN {#1} \l__file_base_name_str + \__msg_kernel_error:nnx { kernel } { file-not-found } + { \l__file_base_name_str } } -\cs_new_protected:Npn \__file_if_exist:nT #1#2 +\cs_new_protected:Npn \file_input:n #1 { - \file_if_exist:nTF {#1} - {#2} - { - \__file_name_sanitize:nn {#1} - { \__msg_kernel_error:nnx { kernel } { file-not-found } } - } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#1} } + { \__file_input:V \l__file_full_name_str } } \cs_new_protected:Npn \__file_input:n #1 { - \tl_if_in:nnTF {#1} { . } - { \__file_input_aux:n {#1} } - { \__file_input_aux:o { \tl_to_str:n { #1 . tex } } } - } -\cs_generate_variant:Nn \__file_input:n { V } -\cs_new_protected:Npn \__file_input_aux:n #1 - { \clist_if_exist:NTF \@filelist { \@addtofilelist {#1} } { \seq_gput_right:Nn \g__file_record_seq {#1} } - \seq_gpush:No \g__file_stack_seq \g_file_current_name_tl - \tl_gset:Nn \g_file_current_name_tl {#1} + \__file_input_push:n {#1} \tex_input:D #1 \c_space_tl - \seq_gpop:NN \g__file_stack_seq \l__file_internal_tl - \tl_gset_eq:NN \g_file_current_name_tl \l__file_internal_tl + \__file_input_pop: } -\cs_generate_variant:Nn \__file_input_aux:n { o } -\cs_new_protected:Npn \file_path_include:n #1 - { \__file_name_sanitize:nn {#1} { \__file_path_include:n } } -\cs_new_protected:Npn \__file_path_include:n #1 +\cs_generate_variant:Nn \__file_input:n { V } +\cs_new_protected:Npn \__file_input_push:n #1 { - \seq_if_in:NnF \l__file_search_path_seq {#1} - { \seq_put_right:Nn \l__file_search_path_seq {#1} } + \seq_gpush:Nx \g__file_stack_seq + { + { \g_file_curr_dir_str } + { \g_file_curr_name_str } + { \g_file_curr_ext_str } + } + \file_parse_full_name:nNNN {#1} + \l__file_dir_str \l__file_name_str \l__file_ext_str + \str_gset_eq:NN \g_file_curr_dir_str \l__file_dir_str + \str_gset_eq:NN \g_file_curr_name_str \l__file_name_str + \str_gset_eq:NN \g_file_curr_ext_str \l__file_ext_str } -\cs_new_protected:Npn \file_path_remove:n #1 +\cs_new_protected:Npn \__file_input_pop: { - \__file_name_sanitize:nn {#1} - { \seq_remove_all:Nn \l__file_search_path_seq } + \seq_gpop:NN \g__file_stack_seq \l__file_tmp_tl + \exp_after:wN \__file_input_pop:nnn \l__file_tmp_tl } -\cs_new_protected:Npn \file_list: +\cs_new_protected:Npn \__file_input_pop:nnn #1#2#3 { - \seq_set_eq:NN \l__file_internal_seq \g__file_record_seq - \clist_if_exist:NT \@filelist + \str_gset:Nn \g_file_curr_dir_str {#1} + \str_gset:Nn \g_file_curr_name_str {#2} + \str_gset:Nn \g_file_curr_ext_str {#3} + } +\cs_new_protected:Npn \file_parse_full_name:nNNN #1#2#3#4 + { + \exp_after:wN \__file_parse_full_name_auxi:w + \tl_to_str:n { #1 " #1 " } \q_stop #2#3#4 + } +\cs_new_protected:Npn \__file_parse_full_name_auxi:w #1 " #2 " #3 \q_stop #4#5#6 + { + \__file_parse_full_name_split:nNNNTF {#2} / #4 #5 + { \str_if_empty:NT #4 { \str_set:Nn #4 { / } } } + { } + \exp_args:No \__file_parse_full_name_split:nNNNTF {#5} . #5 #6 + { \str_put_left:Nn #6 { . } } + { + \str_set_eq:NN #5 #6 + \str_clear:N #6 + } + } +\cs_new_protected:Npn \__file_parse_full_name_split:nNNNTF #1#2#3#4 + { + \cs_set_protected:Npn \__file_tmp:w ##1 ##2 #2 ##3 \q_stop { - \clist_map_inline:Nn \@filelist + \tl_if_empty:nTF {##3} { - \seq_put_right:No \l__file_internal_seq - { \tl_to_str:n {##1} } + \str_set:Nn #4 {##2} + \tl_if_empty:nTF {##1} + { + \str_clear:N #3 + \use_ii:nn + } + { + \str_set:Nx #3 { \str_tail:n {##1} } + \use_i:nn + } } + { \__file_tmp:w { ##1 #2 ##2 } ##3 \q_stop } + } + \__file_tmp:w { } #1 #2 \q_stop + } +\cs_new_protected:Npn \file_show_list: + { + \seq_clear:N \l__file_tmp_seq + \clist_if_exist:NT \@filelist + { + \exp_args:NNx \seq_set_from_clist:Nn \l__file_tmp_seq + { \tl_to_str:N \@filelist } + } + \seq_concat:NNN \l__file_tmp_seq \l__file_tmp_seq \g__file_record_seq + \seq_remove_duplicates:N \l__file_tmp_seq + \__msg_show_wrap:n + { + >~File~List~< \\ + \seq_map_function:NN \l__file_tmp_seq \__file_list_aux:n + ............ } - \seq_remove_duplicates:N \l__file_internal_seq - \iow_log:n { *~File~List~* } - \seq_map_inline:Nn \l__file_internal_seq { \iow_log:n {##1} } - \iow_log:n { ************* } } +\cs_new:Npn \__file_list_aux:n #1 { #1 \\ } +\cs_new_protected:Npn \file_log_list: + { \__msg_log_next: \file_show_list: } \AtBeginDocument { - \clist_map_inline:Nn \@filelist - { \seq_gput_right:No \g__file_record_seq { \tl_to_str:n {#1} } } + \exp_args:NNx \seq_set_from_clist:Nn \l__file_tmp_seq + { \tl_to_str:N \@filelist } + \seq_gconcat:NNN \g__file_record_seq \g__file_record_seq \l__file_tmp_seq } \int_const:Nn \c_term_ior { 16 } \seq_new:N \g__ior_streams_seq @@ -8585,30 +8658,21 @@ \cs_new_protected:Npn \ior_new:N #1 { \cs_new_eq:NN #1 \c_term_ior } \cs_generate_variant:Nn \ior_new:N { c } \cs_new_protected:Npn \ior_open:Nn #1#2 - { \__file_name_sanitize:nn {#2} { \__ior_open_aux:Nn #1 } } + { \ior_open:NnF #1 {#2} { \__file_missing:n {#2} } } \cs_generate_variant:Nn \ior_open:Nn { c } -\cs_new_protected:Npn \__ior_open_aux:Nn #1#2 - { - \file_add_path:nN {#2} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl - { \__msg_kernel_error:nnx { kernel } { file-not-found } {#2} } - { \__ior_open:No #1 \l__file_internal_name_tl } - } \prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF } - { \__file_name_sanitize:nn {#2} { \__ior_open_aux:NnTF #1 } } -\cs_generate_variant:Nn \ior_open:NnT { c } -\cs_generate_variant:Nn \ior_open:NnF { c } -\cs_generate_variant:Nn \ior_open:NnTF { c } -\cs_new_protected:Npn \__ior_open_aux:NnTF #1#2 { - \file_add_path:nN {#2} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl + \file_get_full_name:nN {#2} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str { \prg_return_false: } { - \__ior_open:No #1 \l__file_internal_name_tl + \__ior_open:No #1 \l__file_full_name_str \prg_return_true: } } +\cs_generate_variant:Nn \ior_open:NnT { c } +\cs_generate_variant:Nn \ior_open:NnF { c } +\cs_generate_variant:Nn \ior_open:NnTF { c } \exp_args:NNf \cs_new_protected:Npn \__ior_new:N { \exp_args:NNc \exp_after:wN \exp_stop_f: { newread } } \cs_new_protected:Npn \__ior_open:Nn #1#2 @@ -8641,9 +8705,11 @@ } } \cs_generate_variant:Nn \ior_close:N { c } -\cs_new_protected:Npn \ior_list_streams: - { \__ior_list_streams:Nn \g__ior_streams_prop { ior } } -\cs_new_protected:Npn \__ior_list_streams:Nn #1#2 +\cs_new_protected:Npn \ior_show_list: + { \__ior_list:Nn \g__ior_streams_prop { ior } } +\cs_new_protected:Npn \ior_log_list: + { \__msg_log_next: \ior_show_list: } +\cs_new_protected:Npn \__ior_list:Nn #1#2 { \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-streams } {#2} { \prop_if_empty:NF #1 { ? } } { } { } @@ -8743,26 +8809,25 @@ \exp_args:NNf \cs_new_protected:Npn \__iow_new:N { \exp_args:NNc \exp_after:wN \exp_stop_f: { newwrite } } \cs_new_protected:Npn \iow_open:Nn #1#2 - { \__file_name_sanitize:nn {#2} { \__iow_open:Nn #1 } } -\cs_generate_variant:Nn \iow_open:Nn { c } -\cs_new_protected:Npn \__iow_open:Nn #1#2 { + \__file_name_sanitize:nN {#2} \l__file_base_name_str \iow_close:N #1 \seq_gpop:NNTF \g__iow_streams_seq \l__iow_stream_tl - { \__iow_open_stream:Nn #1 {#2} } + { \__iow_open_stream:NV #1 \l__file_base_name_str } { \__iow_new:N #1 \tl_set:Nx \l__iow_stream_tl { \int_eval:n {#1} } - \__iow_open_stream:Nn #1 {#2} + \__iow_open_stream:NV #1 \l__file_base_name_str } } -\cs_generate_variant:Nn \__iow_open:Nn { No } +\cs_generate_variant:Nn \iow_open:Nn { c } \cs_new_protected:Npn \__iow_open_stream:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \l__iow_stream_tl \scan_stop: \prop_gput:NVn \g__iow_streams_prop #1 {#2} \tex_immediate:D \tex_openout:D #1 #2 \scan_stop: } +\cs_generate_variant:Nn \__iow_open_stream:Nn { NV } \cs_new_protected:Npn \iow_close:N #1 { \int_compare:nT { - \c_log_iow < #1 < \c_term_iow } @@ -8775,9 +8840,11 @@ } } \cs_generate_variant:Nn \iow_close:N { c } -\cs_new_protected:Npn \iow_list_streams: - { \__iow_list_streams:Nn \g__iow_streams_prop { iow } } -\cs_new_eq:NN \__iow_list_streams:Nn \__ior_list_streams:Nn +\cs_new_protected:Npn \iow_show_list: + { \__iow_list:Nn \g__iow_streams_prop { iow } } +\cs_new_protected:Npn \iow_log_list: + { \__msg_log_next: \iow_show_list: } +\cs_new_eq:NN \__iow_list:Nn \__ior_list:Nn \cs_new_protected:Npn \iow_shipout_x:Nn #1#2 { \tex_write:D #1 {#2} } \cs_generate_variant:Nn \iow_shipout_x:Nn { c, Nx, cx } @@ -9118,6 +9185,43 @@ which~will~be~wrapped~using~#1.~ It~was~called~with~argument~'#3'. } +\tl_new:N \g_file_current_name_tl +\tl_gset:Nn \g_file_current_name_tl { \g_file_curr_name_str } +\cs_new_protected:Npn \file_path_include:n #1 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_path_include:n } + { + \token_to_str:N \seq_put_right:Nn \c_space_tl + \token_to_str:N \l_file_search_path_seq + } + \__file_name_sanitize:nN {#1} \l__file_full_name_str + \seq_if_in:NVF \l_file_search_path_seq \l__file_full_name_str + { \seq_put_right:NV \l_file_search_path_seq \l__file_full_name_str } + } +\cs_new_protected:Npn \file_path_remove:n #1 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_path_remove:n } + { + \token_to_str:N \seq_remove_all:Nn \c_space_tl + \token_to_str:N \l_file_search_path_seq + } + \__file_name_sanitize:nN {#1} \l__file_full_name_str + \seq_remove_all:NV \l_file_search_path_seq \l__file_full_name_str + } +\cs_new_protected:Npn \file_add_path:nN #1#2 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_add_path:nN } + { \token_to_str:N \file_get_full_name:nN } + \file_get_full_name:nN {#1} #2 + \str_if_empty:NT #2 + { \tl_set:Nn #2 { \q_no_value } } + } \cs_new_protected:Npn \ior_get_str:NN { \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } @@ -9127,6 +9231,51 @@ \cs_gset_eq:NN \ior_get_str:NN \ior_str_get:NN \ior_str_get:NN } +\cs_new_protected:Npn \file_list: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_list: } + { \token_to_str:N \file_log_list: } + \cs_gset_eq:NN \file_list: \file_log_list: + \file_log_list: + } +\cs_new_protected:Npn \ior_list_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \ior_list_streams: } + { \token_to_str:N \ior_show_list: } + \cs_gset_eq:NN \ior_list_streams: \ior_show_list: + \ior_show_list: + } +\cs_new_protected:Npn \ior_log_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \ior_log_streams: } + { \token_to_str:N \ior_log_list: } + \cs_gset_eq:NN \ior_log_streams: \ior_log_list: + \ior_log_list: + } +\cs_new_protected:Npn \iow_list_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \iow_list_streams: } + { \token_to_str:N \iow_show_list: } + \cs_gset_eq:NN \iow_list_streams: \iow_show_list: + \iow_show_list: + } +\cs_new_protected:Npn \iow_log_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \iow_log_streams: } + { \token_to_str:N \iow_log_list: } + \cs_gset_eq:NN \iow_log_streams: \iow_log_list: + \iow_log_list: + } %% File: l3skip.dtx Copyright (C) 2004-2011 Frank Mittelbach, The LaTeX3 Project %% (C) 2012-2017 The LaTeX3 Project \cs_new_eq:NN \if_dim:w \tex_ifdim:D @@ -9213,7 +9362,7 @@ \cs_new:Npn \dim_ratio:nn #1#2 { \__dim_ratio:n {#1} / \__dim_ratio:n {#2} } \cs_new:Npn \__dim_ratio:n #1 - { \__int_value:w \__dim_eval:w #1 \__dim_eval_end: } + { \__int_value:w \__dim_eval:w (#1) \__dim_eval_end: } \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } { \if_dim:w \__dim_eval:w #1 #2 \__dim_eval:w #3 \__dim_eval_end: @@ -9873,12 +10022,14 @@ } } } -\cs_new_protected:Npn \__keys_cmd_set:nn #1#2 +\__debug_patch:nnNw { \cs_if_exist:cF { \c__keys_code_root_tl #1 } - { \__chk_log:x { Defining~key~#1~\msg_line_context: } } - \cs_set_protected:cpn { \c__keys_code_root_tl #1 } ##1 {#2} + { \__debug_log:x { Defining~key~#1~\msg_line_context: } } } + { } +\cs_new_protected:Npn \__keys_cmd_set:nn #1#2 + { \cs_set_protected:cpn { \c__keys_code_root_tl #1 } ##1 {#2} } \cs_generate_variant:Nn \__keys_cmd_set:nn { nx , Vn , Vo } \cs_new_protected:Npn \__keys_default_set:n #1 { @@ -9903,7 +10054,7 @@ \tex_undefined:D } { - \clist_set_eq:cN { \c__keys_groups_root_tl \l_keys_path_tl } + \cs_set_eq:cN { \c__keys_groups_root_tl \l_keys_path_tl } \l__keys_groups_clist } } @@ -16159,14 +16310,14 @@ \cs_new_protected:Npn \__sort_return_mark:N #1 { } \cs_new_protected:Npn \__sort_return_none_error: { - \__msg_kernel_error:nnxx { sort } { return-none } + \__msg_kernel_error:nnxx { kernel } { return-none } { \tex_the:D \tex_toks:D \l__sort_A_int } { \tex_the:D \tex_toks:D \l__sort_C_int } \__sort_return_same: } \cs_new_protected:Npn \__sort_return_two_error:w #1 \__sort_return_none_error: - { \__msg_kernel_error:nn { sort } { return-two } } + { \__msg_kernel_error:nn { kernel } { return-two } } \cs_new_protected:Npn \__sort_return_same: { \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int @@ -16288,12 +16439,12 @@ { \cs_set_eq:NN \toksdef \__sort_disabled_toksdef:n } \cs_new_protected:Npn \__sort_disabled_toksdef:n #1 { - \__msg_kernel_error:nnx { sort } { toksdef } + \__msg_kernel_error:nnx { kernel } { toksdef } { \token_to_str:N #1 } \__sort_error: \tex_toksdef:D #1 } -\__msg_kernel_new:nnnn { sort } { toksdef } +\__msg_kernel_new:nnnn { kernel } { toksdef } { Allocation~of~\iow_char:N\\toks~registers~impossible~while~sorting. } { The~comparison~code~used~for~sorting~a~list~has~attempted~to~ @@ -16303,20 +16454,20 @@ \cs_new_protected:Npn \__sort_too_long_error:NNw #1#2 \fi: { \fi: - \__msg_kernel_error:nnxxx { sort } { too-large } + \__msg_kernel_error:nnxxx { kernel } { too-large } { \token_to_str:N #2 } { \int_eval:n { \l__sort_true_max_int - \l__sort_min_int } } { \int_eval:n { \l__sort_top_int - \l__sort_min_int } } #1 \__sort_error: } -\__msg_kernel_new:nnnn { sort } { too-large } +\__msg_kernel_new:nnnn { kernel } { too-large } { The~list~#1~is~too~long~to~be~sorted~by~TeX. } { TeX~has~#2~toks~registers~still~available:~ this~only~allows~to~sort~with~up~to~#3~ items.~All~extra~items~will~be~deleted. } -\__msg_kernel_new:nnnn { sort } { return-none } +\__msg_kernel_new:nnnn { kernel } { return-none } { The~comparison~code~did~not~return. } { When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~ @@ -16325,7 +16476,7 @@ \iow_char:N\\sort_return_swapped: .~ Exactly~one~of~these~should~be~called. } -\__msg_kernel_new:nnnn { sort } { return-two } +\__msg_kernel_new:nnnn { kernel } { return-two } { The~comparison~code~returned~multiple~times. } { When~sorting~a~list,~the~code~to~compare~items~called~ @@ -16870,10 +17021,10 @@ } \cs_new_protected:Npn \__regex_toks_put_right:Nn #1#2 { \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } } -\cs_new:Npn \__regex_current_cs_to_str: +\cs_new:Npn \__regex_curr_cs_to_str: { \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N - \tex_the:D \tex_toks:D \l__regex_current_pos_int + \tex_the:D \tex_toks:D \l__regex_curr_pos_int } \cs_new:Npn \__regex_tmp:w { } \tl_new:N \l__regex_internal_a_tl @@ -16908,21 +17059,21 @@ } \cs_new_protected:Npn \__regex_item_caseful_equal:n #1 { - \if_int_compare:w #1 = \l__regex_current_char_int + \if_int_compare:w #1 = \l__regex_curr_char_int \exp_after:wN \__regex_break_true:w \fi: } \cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2 { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int + \reverse_if:N \if_int_compare:w #1 > \l__regex_curr_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w \fi: \fi: } \cs_new_protected:Npn \__regex_item_caseless_equal:n #1 { - \if_int_compare:w #1 = \l__regex_current_char_int + \if_int_compare:w #1 = \l__regex_curr_char_int \exp_after:wN \__regex_break_true:w \fi: \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int @@ -16934,8 +17085,8 @@ } \cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2 { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int + \reverse_if:N \if_int_compare:w #1 > \l__regex_curr_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w \fi: \fi: @@ -16950,15 +17101,15 @@ } \cs_new_protected:Npn \__regex_compute_case_changed_char: { - \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: - \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: - \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: + \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_curr_char_int + \if_int_compare:w \l__regex_curr_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_curr_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_curr_char_int < `a \exp_stop_f: \else: \int_sub:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } \fi: \fi: \else: - \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \if_int_compare:w \l__regex_curr_char_int < `A \exp_stop_f: \else: \int_add:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } \fi: \fi: @@ -16968,7 +17119,7 @@ \cs_new_protected:Npn \__regex_item_catcode: { " - \if_case:w \l__regex_current_catcode_int + \if_case:w \l__regex_curr_catcode_int 1 \or: 4 \or: 10 \or: 40 \or: 100 \or: \or: 1000 \or: 4000 \or: 10000 \or: \or: 100000 \or: 400000 @@ -16987,18 +17138,18 @@ { \__regex_item_catcode:nT {#1} { \__regex_item_reverse:n {#2} } } \cs_new_protected:Npn \__regex_item_exact:nn #1#2 { - \if_int_compare:w #1 = \l__regex_current_catcode_int - \if_int_compare:w #2 = \l__regex_current_char_int + \if_int_compare:w #1 = \l__regex_curr_catcode_int + \if_int_compare:w #2 = \l__regex_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w \fi: \fi: } \cs_new_protected:Npn \__regex_item_exact_cs:n #1 { - \int_compare:nNnTF \l__regex_current_catcode_int = 0 + \int_compare:nNnTF \l__regex_curr_catcode_int = 0 { \tl_set:Nx \l__regex_internal_a_tl - { \scan_stop: \__regex_current_cs_to_str: \scan_stop: } + { \scan_stop: \__regex_curr_cs_to_str: \scan_stop: } \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl { \__regex_break_true:w } { } } @@ -17006,10 +17157,10 @@ } \cs_new_protected:Npn \__regex_item_cs:n #1 { - \int_compare:nNnT \l__regex_current_catcode_int = 0 + \int_compare:nNnT \l__regex_curr_catcode_int = 0 { \group_begin: - \tl_set:Nx \l__regex_cs_name_tl { \__regex_current_cs_to_str: } + \tl_set:Nx \l__regex_cs_name_tl { \__regex_curr_cs_to_str: } \__regex_single_match: \__regex_disable_submatches: \__regex_build_for_cs:n {#1} @@ -17134,7 +17285,7 @@ \cs_new:cpn { __regex_escape_/break:w } { \if_false: { \fi: } - \__msg_kernel_error:nn { regex } { trailing-backslash } + \__msg_kernel_error:nn { kernel } { trailing-backslash } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } \cs_new:cpn { __regex_escape_~:w } { } @@ -17161,7 +17312,7 @@ { \if_false: { \fi: } \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-overflow } {#1} + \__msg_kernel_error:nnx { kernel } { x-overflow } {#1} \tl_set:Nx \l__regex_internal_b_tl { \if_false: } \fi: } @@ -17225,7 +17376,7 @@ { \if_false: { \fi: } \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-missing-rbrace } {#1} + \__msg_kernel_error:nnx { kernel } { x-missing-rbrace } {#1} \tl_set:Nx \l__regex_internal_b_tl { \if_false: } \fi: \__regex_escape_loop:N #1 } @@ -17390,7 +17541,7 @@ \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: - \__msg_kernel_error:nn { regex } { c-bad-mode } + \__msg_kernel_error:nn { kernel } { c-bad-mode } \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n \fi: \fi: @@ -17419,13 +17570,13 @@ { \__regex_if_in_class:TF { - \__msg_kernel_error:nn { regex } { missing-rbrack } + \__msg_kernel_error:nn { kernel } { missing-rbrack } \use:c { __regex_compile_]: } \prg_do_nothing: \prg_do_nothing: } { } \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { missing-rparen } + \__msg_kernel_error:nnx { kernel } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn { \l__regex_group_level_int } @@ -17461,10 +17612,10 @@ \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int - { \__msg_kernel_error:nn { regex } { c-trailing } } + { \__msg_kernel_error:nn { kernel } { c-trailing } } \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int { - \__msg_kernel_error:nn { regex } { c-missing-rbrace } + \__msg_kernel_error:nn { kernel } { c-missing-rbrace } \__regex_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: @@ -17524,7 +17675,7 @@ \cs_new_protected:Npn \__regex_compile_quantifier_abort:xNN #1#2#3 { \__regex_compile_quantifier_none: - \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3} + \__msg_kernel_warning:nnxx { kernel } { invalid-quantifier } {#1} {#3} \__regex_compile_abort_tokens:x {#1} #2 #3 } @@ -17591,7 +17742,7 @@ { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } { \if_int_compare:w \l__regex_internal_a_int > \l__regex_internal_b_int - \__msg_kernel_error:nnxx { regex } { backwards-quantifier } + \__msg_kernel_error:nnxx { kernel } { backwards-quantifier } { \int_use:N \l__regex_internal_a_int } { \int_use:N \l__regex_internal_b_int } \int_zero:N \l__regex_internal_b_int @@ -17614,7 +17765,7 @@ } \cs_new_protected:Npn \__regex_compile_raw_error:N #1 { - \__msg_kernel_error:nnx { regex } { bad-escape } {#1} + \__msg_kernel_error:nnx { kernel } { bad-escape } {#1} \__regex_compile_raw:N #1 } \cs_new_protected:Npn \__regex_compile_raw:N #1#2#3 @@ -17656,7 +17807,7 @@ \__regex_if_end_range:NNTF #2 #3 { \if_int_compare:w `#1 > `#3 \exp_stop_f: - \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3} + \__msg_kernel_error:nnxx { kernel } { range-backwards } {#1} {#3} \else: \__tl_build_one:x { @@ -17670,7 +17821,7 @@ \fi: } { - \__msg_kernel_warning:nnxx { regex } { range-missing-end } + \__msg_kernel_warning:nnxx { kernel } { range-missing-end } {#1} { \c_backslash_str #3 } \__tl_build_one:x { @@ -17688,7 +17839,7 @@ } \cs_new_protected:cpn { __regex_prop_.: } { - \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: + \if_int_compare:w \l__regex_curr_char_int > - 2 \exp_stop_f: \exp_after:wN \__regex_break_true:w \fi: } @@ -17822,8 +17973,8 @@ \str_case:nn { #2 } { : { \__regex_compile_class_posix:NNNNw } - = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } } - . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } } + = { \__msg_kernel_warning:nnx { kernel } { posix-unsupported } { = } } + . { \__msg_kernel_warning:nnx { kernel } { posix-unsupported } { . } } } } \__regex_compile_raw:N [ #1 #2 @@ -17862,7 +18013,7 @@ } } { - \__msg_kernel_warning:nnx { regex } { posix-unknown } + \__msg_kernel_warning:nnx { kernel } { posix-unknown } { \l__regex_internal_a_tl } \__regex_compile_abort_tokens:x { @@ -17872,7 +18023,7 @@ } } { - \__msg_kernel_error:nnxx { regex } { posix-missing-close } + \__msg_kernel_error:nnxx { kernel } { posix-missing-close } { [: \l__regex_internal_a_tl } { #2 #4 } \__regex_compile_abort_tokens:x { [: \l__regex_internal_a_tl } #1 #2 #3 #4 @@ -17896,7 +18047,7 @@ \__tl_build_one:o \l__regex_internal_regex \exp_after:wN \__regex_compile_quantifier:w \else: - \__msg_kernel_warning:nn { regex } { extra-rparen } + \__msg_kernel_warning:nn { kernel } { extra-rparen } \exp_after:wN \__regex_compile_raw:N \exp_after:wN ) \fi: } @@ -17912,7 +18063,7 @@ \cs_if_exist_use:cF { __regex_compile_special_group_\token_to_str:N #4 :w } { - \__msg_kernel_warning:nnx { regex } { special-group-unknown } + \__msg_kernel_warning:nnx { kernel } { special-group-unknown } { (? #4 } \__regex_compile_group_begin:N \__regex_group:nnnN \__regex_compile_raw:N ? #3 #4 @@ -17948,7 +18099,7 @@ \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseless_range:nn } } { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 } + \__msg_kernel_warning:nnx { kernel } { unknown-option } { (?i #2 } \__regex_compile_raw:N ( \__regex_compile_raw:N ? \__regex_compile_raw:N i @@ -17964,7 +18115,7 @@ \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } } { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 } + \__msg_kernel_warning:nnx { kernel } { unknown-option } { (?-#2#4 } \__regex_compile_raw:N ( \__regex_compile_raw:N ? \__regex_compile_raw:N - @@ -17986,14 +18137,27 @@ \else: \c__regex_catcode_in_class_mode_int \fi: + \token_if_eq_charcode:NNT C #2 { \__regex_compile_c_C:NN } } } { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } { - \__msg_kernel_error:nnx { regex } { c-missing-category } {#2} + \__msg_kernel_error:nnx { kernel } { c-missing-category } {#2} #1 #2 } } +\cs_new_protected:Npn \__regex_compile_c_C:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N + { + \token_if_eq_charcode:NNTF #2 . + { \use_none:n } + { \token_if_eq_charcode:NNF #2 ( } % ) + } + { \use:n } + { \__msg_kernel_error:nnn { kernel } { c-C-invalid } {#2} } + #1 #2 + } \cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 { \l__regex_mode_int @@ -18030,7 +18194,7 @@ { \__regex_compile_c_lbrack_end: } } { - \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2} + \__msg_kernel_error:nnx { kernel } { c-missing-rbrack } {#2} \__regex_compile_c_lbrack_end: #1 #2 } @@ -18132,7 +18296,7 @@ \__regex_compile_u_loop:NN } { - \__msg_kernel_error:nn { regex } { u-missing-lbrace } + \__msg_kernel_error:nn { kernel } { u-missing-lbrace } \__regex_compile_raw:N u #1 #2 } } @@ -18150,7 +18314,7 @@ } { \if_false: { \fi: } - \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2} + \__msg_kernel_error:nnx { kernel } { u-missing-rbrace } {#2} \__regex_compile_u_end: #1 #2 } @@ -18395,7 +18559,7 @@ \__regex_pop_lr_states: \__regex_toks_put_right:Nn \l__regex_right_state_int { - \if_int_compare:w \l__regex_current_pos_int = \l__regex_max_pos_int + \if_int_compare:w \l__regex_curr_pos_int = \l__regex_max_pos_int \exp_after:wN \__regex_action_success: \fi: } @@ -18676,14 +18840,14 @@ } \cs_new_protected:Npn \__regex_anchor:N #1 { - \if_int_compare:w #1 = \l__regex_current_pos_int + \if_int_compare:w #1 = \l__regex_curr_pos_int \exp_after:wN \__regex_break_true:w \fi: } \cs_new_protected:Npn \__regex_b_test: { \group_begin: - \int_set_eq:NN \l__regex_current_char_int \l__regex_last_char_int + \int_set_eq:NN \l__regex_curr_char_int \l__regex_last_char_int \__regex_prop_w: \__regex_break_point:TF { \group_end: \__regex_item_reverse:n \__regex_prop_w: } @@ -18703,15 +18867,15 @@ } \int_new:N \l__regex_min_pos_int \int_new:N \l__regex_max_pos_int -\int_new:N \l__regex_current_pos_int +\int_new:N \l__regex_curr_pos_int \int_new:N \l__regex_start_pos_int \int_new:N \l__regex_success_pos_int -\int_new:N \l__regex_current_char_int -\int_new:N \l__regex_current_catcode_int +\int_new:N \l__regex_curr_char_int +\int_new:N \l__regex_curr_catcode_int \int_new:N \l__regex_last_char_int \int_new:N \l__regex_case_changed_char_int -\int_new:N \l__regex_current_state_int -\prop_new:N \l__regex_current_submatches_prop +\int_new:N \l__regex_curr_state_int +\prop_new:N \l__regex_curr_submatches_prop \prop_new:N \l__regex_success_submatches_prop \int_new:N \l__regex_step_int \int_new:N \l__regex_min_active_int @@ -18728,12 +18892,12 @@ \cs_new_protected:Npn \__regex_match:n #1 { \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } + \int_set:Nn \l__regex_curr_pos_int { 2 * \l__regex_max_state_int } \__regex_query_set:nnn { } { -1 } { -2 } - \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int + \int_set_eq:NN \l__regex_min_pos_int \l__regex_curr_pos_int \__tl_analysis_map_inline:nn {#1} { \__regex_query_set:nnn {##1} {"##2} {##3} } - \int_set_eq:NN \l__regex_max_pos_int \l__regex_current_pos_int + \int_set_eq:NN \l__regex_max_pos_int \l__regex_curr_pos_int \__regex_query_set:nnn { } { -1 } { -2 } \bool_gset_false:N \g__regex_success_bool \int_step_inline:nnnn @@ -18752,16 +18916,16 @@ { \if_meaning:w \c_true_bool \l__regex_empty_success_bool \cs_set:Npn \__regex_if_two_empty_matches:F - { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_current_pos_int } + { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_curr_pos_int } \else: \cs_set_eq:NN \__regex_if_two_empty_matches:F \use:n \fi: \int_set_eq:NN \l__regex_start_pos_int \l__regex_success_pos_int \bool_set_false:N \l__regex_match_success_bool - \prop_clear:N \l__regex_current_submatches_prop + \prop_clear:N \l__regex_curr_submatches_prop \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int \__regex_store_state:n { \l__regex_min_state_int } - \int_set:Nn \l__regex_current_pos_int + \int_set:Nn \l__regex_curr_pos_int { \l__regex_start_pos_int - 1 } \__regex_query_get: \__regex_match_loop: @@ -18786,8 +18950,8 @@ \cs_new_protected:Npn \__regex_match_loop: { \int_add:Nn \l__regex_step_int { 2 } - \int_incr:N \l__regex_current_pos_int - \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int + \int_incr:N \l__regex_curr_pos_int + \int_set_eq:NN \l__regex_last_char_int \l__regex_curr_char_int \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int \__regex_query_get: \use:x @@ -18802,7 +18966,7 @@ \__prg_break_point: \bool_set_false:N \l__regex_fresh_thread_bool %^^A was arg of break_point:n \if_int_compare:w \l__regex_max_active_int > \l__regex_min_active_int - \if_int_compare:w \l__regex_current_pos_int < \l__regex_max_pos_int + \if_int_compare:w \l__regex_curr_pos_int < \l__regex_max_pos_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_match_loop: \fi: \fi: @@ -18816,13 +18980,13 @@ \cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 { \__intarray_gset_fast:Nnn \g__regex_charcode_intarray - { \l__regex_current_pos_int } {#3} + { \l__regex_curr_pos_int } {#3} \__intarray_gset_fast:Nnn \g__regex_catcode_intarray - { \l__regex_current_pos_int } {#2} + { \l__regex_curr_pos_int } {#2} \__intarray_gset_fast:Nnn \g__regex_balance_intarray - { \l__regex_current_pos_int } { \l__regex_balance_int } - \__regex_toks_set:Nn \l__regex_current_pos_int {#1} - \int_incr:N \l__regex_current_pos_int + { \l__regex_curr_pos_int } { \l__regex_balance_int } + \__regex_toks_set:Nn \l__regex_curr_pos_int {#1} + \int_incr:N \l__regex_curr_pos_int \if_case:w #2 \exp_stop_f: \or: \int_incr:N \l__regex_balance_int \or: \int_decr:N \l__regex_balance_int @@ -18830,29 +18994,29 @@ } \cs_new_protected:Npn \__regex_query_get: { - \l__regex_current_char_int + \l__regex_curr_char_int = \__intarray_item_fast:Nn \g__regex_charcode_intarray - { \l__regex_current_pos_int } \scan_stop: - \l__regex_current_catcode_int + { \l__regex_curr_pos_int } \scan_stop: + \l__regex_curr_catcode_int = \__intarray_item_fast:Nn \g__regex_catcode_intarray - { \l__regex_current_pos_int } \scan_stop: + { \l__regex_curr_pos_int } \scan_stop: } \cs_new_protected:Npn \__regex_use_state: { \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int } - \__regex_toks_use:w \l__regex_current_state_int + { \l__regex_curr_state_int } { \l__regex_step_int } + \__regex_toks_use:w \l__regex_curr_state_int \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int + 1 } + { \l__regex_curr_state_int } { \l__regex_step_int + 1 } } \cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 { - \int_set:Nn \l__regex_current_state_int {#1} + \int_set:Nn \l__regex_curr_state_int {#1} \if_int_compare:w \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } + { \l__regex_curr_state_int } < \l__regex_step_int - \tl_set:Nn \l__regex_current_submatches_prop {#2} + \tl_set:Nn \l__regex_curr_submatches_prop {#2} \exp_after:wN \__regex_use_state: \fi: \scan_stop: @@ -18872,26 +19036,26 @@ { \use:x { - \int_add:Nn \l__regex_current_state_int {#2} + \int_add:Nn \l__regex_curr_state_int {#2} \exp_not:n { \if_int_compare:w \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } + { \l__regex_curr_state_int } #1 \exp_after:wN \__regex_use_state: \fi: } - \int_set:Nn \l__regex_current_state_int - { \int_use:N \l__regex_current_state_int } - \tl_set:Nn \exp_not:N \l__regex_current_submatches_prop - { \exp_not:o \l__regex_current_submatches_prop } + \int_set:Nn \l__regex_curr_state_int + { \int_use:N \l__regex_curr_state_int } + \tl_set:Nn \exp_not:N \l__regex_curr_submatches_prop + { \exp_not:o \l__regex_curr_submatches_prop } } } \cs_new_protected:Npn \__regex_action_cost:n #1 { \exp_args:No \__regex_store_state:n - { \__int_value:w \__int_eval:w \l__regex_current_state_int + #1 } + { \__int_value:w \__int_eval:w \l__regex_curr_state_int + #1 } } \cs_new_protected:Npn \__regex_store_state:n #1 { @@ -18903,7 +19067,7 @@ \cs_new_protected:Npn \__regex_store_submatches: { \__regex_toks_set:No \l__regex_max_active_int - { \l__regex_current_submatches_prop } + { \l__regex_curr_submatches_prop } } \cs_new_protected:Npn \__regex_disable_submatches: { @@ -18912,8 +19076,8 @@ } \cs_new_protected:Npn \__regex_action_submatch:n #1 { - \prop_put:Nno \l__regex_current_submatches_prop {#1} - { \int_use:N \l__regex_current_pos_int } + \prop_put:Nno \l__regex_curr_submatches_prop {#1} + { \int_use:N \l__regex_curr_pos_int } } \cs_new_protected:Npn \__regex_action_success: { @@ -18922,9 +19086,9 @@ \bool_set_true:N \l__regex_match_success_bool \bool_set_eq:NN \l__regex_empty_success_bool \l__regex_fresh_thread_bool - \int_set_eq:NN \l__regex_success_pos_int \l__regex_current_pos_int + \int_set_eq:NN \l__regex_success_pos_int \l__regex_curr_pos_int \prop_set_eq:NN \l__regex_success_submatches_prop - \l__regex_current_submatches_prop + \l__regex_curr_submatches_prop \__prg_break: } } @@ -19003,14 +19167,14 @@ {#1} \prg_do_nothing: \prg_do_nothing: \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } + \__msg_kernel_error:nnx { kernel } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \__tl_build_one:x { \prg_replicate:nn \l__regex_replacement_csnames_int \cs_end: } \fi: \seq_if_empty:NF \l__regex_replacement_category_seq { - \__msg_kernel_error:nnx { regex } { replacement-missing-rparen } + \__msg_kernel_error:nnx { kernel } { replacement-missing-rparen } { \seq_count:N \l__regex_replacement_category_seq } \seq_clear:N \l__regex_replacement_category_seq } @@ -19145,12 +19309,12 @@ \cs_new_protected:Npn \__regex_replacement_cat:NNN #1#2#3 { \token_if_eq_meaning:NNTF \prg_do_nothing: #3 - { \__msg_kernel_error:nn { regex } { replacement-catcode-end } } + { \__msg_kernel_error:nn { kernel } { replacement-catcode-end } } { \int_compare:nNnTF { \l__regex_replacement_csnames_int } > 0 { \__msg_kernel_error:nnnn - { regex } { replacement-catcode-in-cs } {#1} {#3} + { kernel } { replacement-catcode-in-cs } {#1} {#3} #2 #3 } { @@ -19160,7 +19324,19 @@ \l__regex_replacement_category_tl \tl_set:Nn \l__regex_replacement_category_tl {#1} } - { \use:c { __regex_replacement_c_#1:w } #2 #3 } + { + \token_if_eq_meaning:NNT #2 \__regex_replacement_escaped:N + { + \__regex_char_if_alphanumeric:NTF #3 + { + \__msg_kernel_error:nnnn + { kernel } { replacement-catcode-escaped } + {#1} {#3} + } + { } + } + \use:c { __regex_replacement_c_#1:w } #2 #3 + } } } } @@ -19214,7 +19390,7 @@ \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2 { \if_int_compare:w `#2 = 0 \exp_stop_f: - \__msg_kernel_error:nn { regex } { replacement-null-space } + \__msg_kernel_error:nn { kernel } { replacement-null-space } \fi: \tex_lccode:D `\ = `#2 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {~} } @@ -19228,7 +19404,7 @@ \group_end: \cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3 { - \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3} + \__msg_kernel_error:nnx { kernel } { replacement-#1 } {#3} #2 #3 } \cs_new_protected:Npn \regex_new:N #1 @@ -19399,7 +19575,7 @@ { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } = 0 { - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + \__msg_kernel_error:nnxxx { kernel } { result-unbalanced } { splitting~or~extracting~submatches } { \flag_height:n { __regex_end } } { \flag_height:n { __regex_begin } } @@ -19522,7 +19698,7 @@ { \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: \else: - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + \__msg_kernel_error:nnxxx { kernel } { result-unbalanced } { replacing } { \int_max:nn { - \l__regex_balance_int } { 0 } } { \int_max:nn { \l__regex_balance_int } { 0 } } @@ -19544,20 +19720,20 @@ } } } -\__msg_kernel_new:nnnn { regex } { trailing-backslash } +\__msg_kernel_new:nnnn { kernel } { trailing-backslash } { Trailing~escape~character~'\iow_char:N\\'. } { A~regular~expression~or~its~replacement~text~ends~with~ the~escape~character~'\iow_char:N\\'.~It~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { x-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { x-missing-rbrace } { Missing~closing~brace~in~'\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ '\iow_char:N\\x\{...#1'.~ The~closing~brace~is~missing. } -\__msg_kernel_new:nnnn { regex } { x-overflow } +\__msg_kernel_new:nnnn { kernel } { x-overflow } { Character~code~'#1'~too~large~in~'\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ @@ -19565,20 +19741,20 @@ The~character~code~#1~is~larger~than~ the~maximum~value~\int_use:N \c_max_char_int. } -\__msg_kernel_new:nnnn { regex } { invalid-quantifier } +\__msg_kernel_new:nnnn { kernel } { invalid-quantifier } { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. } { The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~ The~only~valid~quantifiers~are~'*',~'?',~'+',~'{<int>}',~ '{<min>,}'~and~'{<min>,<max>}',~optionally~followed~by~'?'. } -\__msg_kernel_new:nnnn { regex } { missing-rbrack } +\__msg_kernel_new:nnnn { kernel } { missing-rbrack } { Missing~right~bracket~inserted~in~regular~expression. } { LaTeX~was~given~a~regular~expression~where~a~character~class~ was~started~with~'[',~but~the~matching~']'~is~missing. } -\__msg_kernel_new:nnnn { regex } { missing-rparen } +\__msg_kernel_new:nnnn { kernel } { missing-rparen } { Missing~right~ \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~ @@ -19588,13 +19764,13 @@ LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~ more~left~parentheses~than~right~parentheses. } -\__msg_kernel_new:nnnn { regex } { extra-rparen } +\__msg_kernel_new:nnnn { kernel } { extra-rparen } { Extra~right~parenthesis~ignored~in~regular~expression. } { LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~ was~open.~The~parenthesis~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { bad-escape } +\__msg_kernel_new:nnnn { kernel } { bad-escape } { Invalid~escape~'\iow_char:N\\#1'~ \__regex_if_in_cs:TF { within~a~control~sequence. } @@ -19618,14 +19794,14 @@ because~it~does~not~match~exactly~one~character. } } -\__msg_kernel_new:nnnn { regex } { range-missing-end } +\__msg_kernel_new:nnnn { kernel } { range-missing-end } { Invalid~end-point~for~range~'#1-#2'~in~character~class. } { The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~ end-point~for~a~range:~alphanumeric~characters~should~not~be~ escaped,~and~non-alphanumeric~characters~should~be~escaped. } -\__msg_kernel_new:nnnn { regex } { range-backwards } +\__msg_kernel_new:nnnn { kernel } { range-backwards } { Range~'[#1-#2]'~out~of~order~in~character~class. } { In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~ @@ -19633,27 +19809,34 @@ Here,~'#1'~has~character~code~\int_eval:n {`#1},~while~ '#2'~has~character~code~\int_eval:n {`#2}. } -\__msg_kernel_new:nnnn { regex } { c-bad-mode } +\__msg_kernel_new:nnnn { kernel } { c-bad-mode } { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. } { The~'\iow_char:N\\c'~escape~cannot~be~used~within~ a~control~sequence~test~'\iow_char:N\\c{...}'.~ To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'. } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { c-C-invalid } + { '\iow_char:N\\cC'~should~be~followed~by~'.'~or~'(',~not~'#1'. } + { + The~'\iow_char:N\\cC'~construction~restricts~the~next~item~to~be~a~ + control~sequence~or~the~next~group~to~be~made~of~control~sequences.~ + It~only~makes~sense~to~follow~it~by~'.'~or~by~a~group. + } +\__msg_kernel_new:nnnn { kernel } { c-missing-rbrace } { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. } { LaTeX~was~given~a~regular~expression~where~a~ '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~ with~a~closing~brace~'\iow_char:N\}'. } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrack } +\__msg_kernel_new:nnnn { kernel } { c-missing-rbrack } { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. } { A~construction~'\iow_char:N\\c[...'~appears~in~a~ regular~expression,~but~the~closing~']'~is~not~present. } -\__msg_kernel_new:nnnn { regex } { c-missing-category } +\__msg_kernel_new:nnnn { kernel } { c-missing-category } { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. } { In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~ @@ -19661,19 +19844,19 @@ capital~letter~representing~a~character~category,~namely~ one~of~'ABCDELMOPSTU'. } -\__msg_kernel_new:nnnn { regex } { c-trailing } +\__msg_kernel_new:nnnn { kernel } { c-trailing } { Trailing~category~code~escape~'\iow_char:N\\c'... } { A~regular~expression~ends~with~'\iow_char:N\\c'~followed~ by~a~letter.~It~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { u-missing-lbrace } +\__msg_kernel_new:nnnn { kernel } { u-missing-lbrace } { Missing~left~brace~following~'\iow_char:N\\u'~escape. } { The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~ a~brace~group~with~the~name~of~the~variable~to~use. } -\__msg_kernel_new:nnnn { regex } { u-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { u-missing-rbrace } { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. } { LaTeX~ @@ -19682,14 +19865,14 @@ { encountered~an~escaped~alphanumeric~character '\iow_char:N\\#2'~ } when~parsing~the~argument~of~an~'\iow_char:N\\u\iow_char:N\{...\}'~escape. } -\__msg_kernel_new:nnnn { regex } { posix-unsupported } +\__msg_kernel_new:nnnn { kernel } { posix-unsupported } { POSIX~collating~element~'[#1 ~ #1]'~not~supported. } { The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~ in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~ Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class? } -\__msg_kernel_new:nnnn { regex } { posix-unknown } +\__msg_kernel_new:nnnn { kernel } { posix-unknown } { POSIX~class~'[:#1:]'~unknown. } { '[:#1:]'~is~not~among~the~known~POSIX~classes~ @@ -19698,10 +19881,10 @@ '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~ '[:word:]',~and~'[:xdigit:]'. } -\__msg_kernel_new:nnnn { regex } { posix-missing-close } +\__msg_kernel_new:nnnn { kernel } { posix-missing-close } { Missing~closing~':]'~for~POSIX~class. } { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. } -\__msg_kernel_new:nnnn { regex } { result-unbalanced } +\__msg_kernel_new:nnnn { kernel } { result-unbalanced } { Missing~brace~inserted~when~#1. } { LaTeX~was~asked~to~do~some~regular~expression~operation,~ @@ -19709,33 +19892,33 @@ of~begin-group~and~end-group~tokens.~Braces~were~inserted:~ #2~left,~#3~right. } -\__msg_kernel_new:nnnn { regex } { unknown-option } +\__msg_kernel_new:nnnn { kernel } { unknown-option } { Unknown~option~'#1'~for~regular~expressions. } { The~only~available~option~is~'case-insensitive',~toggled~by~ '(?i)'~and~'(?-i)'. } -\__msg_kernel_new:nnnn { regex } { special-group-unknown } +\__msg_kernel_new:nnnn { kernel } { special-group-unknown } { Unknown~special~group~'#1~...'~in~a~regular~expression. } { The~only~valid~constructions~starting~with~'(?'~are~ '(?:~...~)',~'(?|~...~)',~'(?i)',~and~'(?-i)'. } -\__msg_kernel_new:nnnn { regex } { replacement-c } +\__msg_kernel_new:nnnn { kernel } { replacement-c } { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. } { In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~ or~a~brace~group,~not~by~'#1'. } -\__msg_kernel_new:nnnn { regex } { replacement-u } +\__msg_kernel_new:nnnn { kernel } { replacement-u } { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. } { In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~ must~be~~followed~by~a~brace~group~holding~the~name~of~the~ variable~to~use. } -\__msg_kernel_new:nnnn { regex } { replacement-g } +\__msg_kernel_new:nnnn { kernel } { replacement-g } { Missing~brace~for~the~'\iow_char:N\\g'~construction~ in~a~replacement~text. @@ -19745,7 +19928,7 @@ submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~ or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing. } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-end } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-end } { Missing~character~for~the~'\iow_char:N\\c<category><character>'~ construction~in~a~replacement~text. @@ -19756,7 +19939,17 @@ the~character~category.~Then,~a~character~must~follow.~LaTeX~ reached~the~end~of~the~replacement~when~looking~for~that. } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-in-cs } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-escaped } + { + Escaped~letter~or~digit~after~category~code~in~replacement~text. + } + { + In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ + can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~ + the~character~category.~Then,~a~character~must~follow,~not~ + '\iow_char:N\\#2'. + } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-in-cs } { Category~code~'\iow_char:N\\c#1#3'~ignored~inside~ '\iow_char:N\\c\{...\}'~in~a~replacement~text. @@ -19766,7 +19959,7 @@ '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~ sequence~name. } -\__msg_kernel_new:nnnn { regex } { replacement-null-space } +\__msg_kernel_new:nnnn { kernel } { replacement-null-space } { TeX~cannot~build~a~space~token~with~character~code~0. } { You~asked~for~a~character~token~with~category~space,~ @@ -19775,13 +19968,13 @@ This~specific~case~is~impossible~and~will~be~replaced~ by~a~normal~space. } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { replacement-missing-rbrace } { Missing~right~brace~inserted~in~replacement~text. } { There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } . } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rparen } +\__msg_kernel_new:nnnn { kernel } { replacement-missing-rparen } { Missing~right~parenthesis~inserted~in~replacement~text. } { There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ @@ -19965,6 +20158,16 @@ \c_group_end_token } \cs_new_eq:NN \hbox_gset_end: \hbox_set_end: +\cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2 + { + \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: + \c_group_begin_token + \group_begin: + } +\cs_new_protected:Npn \hbox_gset_to_wd:Nnw + { \tex_global:D \hbox_set_to_wd:Nnw } +\cs_generate_variant:Nn \hbox_set_to_wd:Nnw { c } +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnw { c } \cs_new_protected:Npn \hbox_to_wd:nn #1#2 { \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: @@ -20037,6 +20240,16 @@ \c_group_end_token } \cs_new_eq:NN \vbox_gset_end: \vbox_set_end: +\cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2 + { + \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: + \c_group_begin_token + \group_begin: + } +\cs_new_protected:Npn \vbox_gset_to_ht:Nnw + { \tex_global:D \vbox_set_to_ht:Nnw } +\cs_generate_variant:Nn \vbox_set_to_ht:Nnw { c } +\cs_generate_variant:Nn \vbox_gset_to_ht:Nnw { c } \cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D \cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D \cs_generate_variant:Nn \vbox_unpack:N { c } @@ -20411,14 +20624,14 @@ \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 - \__chk_suspend_log: + \__debug_suspend_log: \prop_clear_new:c { l__coffin_corners_ \__int_value:w #1 _prop } \prop_clear_new:c { l__coffin_poles_ \__int_value:w #1 _prop } \prop_gset_eq:cN { l__coffin_corners_ \__int_value:w #1 _prop } \c__coffin_corners_prop \prop_gset_eq:cN { l__coffin_poles_ \__int_value:w #1 _prop } \c__coffin_poles_prop - \__chk_resume_log: + \__debug_resume_log: } \cs_generate_variant:Nn \coffin_new:N { c } \cs_new_protected:Npn \hcoffin_set:Nn #1#2 @@ -20898,7 +21111,7 @@ } \cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { - \hbox_unpack:N \c_empty_box + \mode_leave_vertical: \__coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } #1 {#2} {#3} {#4} {#5} \l__coffin_aligned_coffin \box_use:N \l__coffin_aligned_coffin @@ -21151,7 +21364,12 @@ \group_end: } \cs_new_protected:Npn \color_ensure_current: - { \__driver_color_ensure_current: } + { + \__driver_color_ensure_current: + \group_insert_after:N \__driver_color_reset: + } +\tl_new:N \l__color_current_tl +\tl_set:Nn \l__color_current_tl { gray~0 } %% File: l3sys.dtx Copyright (C) 2015-2017 The LaTeX3 Project \str_const:Nx \c_sys_jobname_str { \tex_jobname:D } \int_const:Nn \c_sys_minute_int @@ -21290,10 +21508,34 @@ \__deprecation_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } \__deprecation_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } \__deprecation_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } + \__deprecation_error:Nnn \g_file_current_name_tl { \g_file_curr_name_str } { 2018-12-31 } + \__deprecation_error:Nnn \file_add_path:nN { \file_get_full_name:nN } { 2018-12-31 } + \__deprecation_error:Nnn \file_path_include:n + { \seq_put_right:Nn \l_file_search_path_seq } { 2018-12-31 } + \__deprecation_error:Nnn \file_path_remove:n + { \seq_remove_all:Nn \l_file_search_path_seq } { 2018-12-31 } + \__deprecation_error:Nnn \file_list: { \file_log_list: } { 2018-12-31 } + \__deprecation_error:Nnn \ior_list_streams: { \ior_show_list: } { 2018-12-31 } + \__deprecation_error:Nnn \ior_log_streams: { \ior_log_list: } { 2018-12-31 } + \__deprecation_error:Nnn \iow_list_streams: { \iow_show_list: } { 2018-12-31 } + \__deprecation_error:Nnn \iow_log_streams: { \iow_log_list: } { 2018-12-31 } \cs_set_eq:NN \__fp_parse_round:Nw \__fp_parse_round_deprecation_error:Nw \cs_set_eq:NN \deprecation_error: \scan_stop: } %% File: l3candidates.dtx Copyright (C) 2012-2017 The LaTeX3 Project +\cs_new_protected:Npx \mode_leave_vertical: + { + \cs_if_exist:NTF \pdftex_quitvmode:D + { \pdftex_quitvmode:D } + { + \exp_not:n + { + \if_mode_vertical: + \exp_after:wN \tex_indent:D + \fi: + } + } + } \cs_new_protected:Npn \box_clip:N #1 { \hbox_set:Nn #1 { \__driver_box_use_clip:N #1 } } \cs_generate_variant:Nn \box_clip:N { c } @@ -21632,36 +21874,96 @@ {#5} {#6} } } +\cs_new_protected:Npn \file_get_mdfive_hash:nN #1#2 + { \__file_get_details:nnN {#1} { mdfivesum } {#2} } +\cs_new_protected:Npn \file_get_size:nN #1#2 + { \__file_get_details:nnN {#1} { size } {#2} } +\cs_new_protected:Npn \file_get_timestamp:nN #1#2 + { \__file_get_details:nnN {#1} { moddate } {#2} } +\cs_new_protected:Npn \__file_get_details:nnN #1#2#3 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_set:Nx #3 + { + \use:c { pdftex_file #2 :D } \exp_after:wN + { \l__file_full_name_str } + } + } +\cs_if_exist:NTF \luatex_directlua:D + { + \cs_set_protected:Npn \__file_get_details:nnN #1#2#3 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_set:Nx #3 + { + \lua_now_x:n + { + l3kernel.file#2 + ( " \lua_escape_x:n { \l__file_full_name_str } " ) + } + } + } + } + { + \cs_set_protected:Npn \file_get_mdfive_hash:nN #1#2 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \tl_set:Nx #2 + { + \pdftex_mdfivesum:D file \exp_after:wN + { \l__file_full_name_str } + } + } + \cs_if_exist:NT \xetex_XeTeXversion:D + { + \cs_set_protected:Npn \__file_get_details:nnN #1#2#3 + { + \tl_clear:N #3 + \__msg_kernel_error:nnx + { kernel } { xetex-primitive-not-available } + { \exp_not:c { pdffile #2 } } + } + } + } +\__msg_kernel_new:nnnn { kernel } { xetex-primitive-not-available } + { Primitive~\token_to_str:N #1 not~available } + { + XeTeX~does~not~currently~provide~functionality~equivalent~to~the~ + \token_to_str:N #1 primitive. + } \cs_new_protected:Npn \file_if_exist_input:n #1 { - \file_if_exist:nT {#1} - { \__file_input:V \l__file_internal_name_tl } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str + { \__file_input:V \l__file_full_name_str } } \cs_new_protected:Npn \file_if_exist_input:nT #1#2 { - \file_if_exist:nT {#1} + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str { #2 - \__file_input:V \l__file_internal_name_tl + \__file_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nF #1 +\cs_new_protected:Npn \file_if_exist_input:nF #1#2 { - \file_if_exist:nTF {#1} - { \__file_input:V \l__file_internal_name_tl } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + {#2} + { \__file_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nTF #1#2 +\cs_new_protected:Npn \file_if_exist_input:nTF #1#2#3 { - \file_if_exist:nTF {#1} + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + {#3} { #2 - \__file_input:V \l__file_internal_name_tl + \__file_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \ior_log_streams: - { \__msg_log_next: \ior_list_streams: } -\cs_new_protected:Npn \iow_log_streams: - { \__msg_log_next: \iow_list_streams: } +\cs_new_protected:Npn \file_input_stop: { \tex_endinput:D } \cs_if_exist:NTF \pdftex_uniformdeviate:D { \cs_new:Npn \int_rand:nn #1#2 @@ -21998,7 +22300,9 @@ \cs_generate_variant:Nn \tl_gset_from_file:Nnn { c } \cs_new_protected:Npn \__tl_set_from_file:NNnn #1#2#3#4 { - \__file_if_exist:nT {#4} + \file_get_full_name:nN {#4} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#4} } { \group_begin: \exp_args:No \etex_everyeof:D @@ -22006,7 +22310,7 @@ #3 \scan_stop: \exp_after:wN \__tl_from_file_do:w \exp_after:wN \prg_do_nothing: - \tex_input:D \l__file_internal_name_tl \scan_stop: + \tex_input:D \l__file_full_name_str \scan_stop: \exp_args:NNNo \group_end: #1 #2 \l__tl_internal_a_tl } @@ -22023,13 +22327,15 @@ \cs_generate_variant:Nn \tl_gset_from_file_x:Nnn { c } \cs_new_protected:Npn \__tl_set_from_file_x:NNnn #1#2#3#4 { - \__file_if_exist:nT {#4} + \file_get_full_name:nN {#4} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#4} } { \group_begin: \etex_everyeof:D { \exp_not:N } #3 \scan_stop: \tl_set:Nx \l__tl_internal_a_tl - { \tex_input:D \l__file_internal_name_tl \c_space_token } + { \tex_input:D \l__file_full_name_str \c_space_token } \exp_args:NNNo \group_end: #1 #2 \l__tl_internal_a_tl } @@ -22037,10 +22343,10 @@ \cs_generate_variant:Nn \tl_if_head_eq_catcode:nNTF { o } \cs_new:Npn \tl_lower_case:n { \__tl_change_case:nnn { lower } { } } \cs_new:Npn \tl_upper_case:n { \__tl_change_case:nnn { upper } { } } -\cs_new:Npn \tl_mixed_case:n { \__tl_mixed_case:nn { } } +\cs_new:Npn \tl_mixed_case:n { \__tl_change_case:nnn { mixed } { } } \cs_new:Npn \tl_lower_case:nn { \__tl_change_case:nnn { lower } } \cs_new:Npn \tl_upper_case:nn { \__tl_change_case:nnn { upper } } -\cs_new:Npn \tl_mixed_case:nn { \__tl_mixed_case:nn } +\cs_new:Npn \tl_mixed_case:nn { \__tl_change_case:nnn { mixed } } \cs_new:Npn \__tl_change_case:nnn #1#2#3 { \etex_unexpanded:D \exp_after:wN @@ -22078,6 +22384,10 @@ } \cs_new:Npn \__tl_change_case_group:nwnn #1#2 \q_recursion_stop #3#4 { + \use:c { __tl_change_case_group_ #3 : nnnn } {#1} {#2} {#3} {#4} + } +\cs_new:Npn \__tl_change_case_group_lower:nnnn #1#2#3#4 + { \__tl_change_case_output:own { \exp_after:wN @@ -22088,6 +22398,20 @@ } \__tl_change_case_loop:wnn #2 \q_recursion_stop {#3} {#4} } +\cs_new_eq:NN \__tl_change_case_group_upper:nnnn + \__tl_change_case_group_lower:nnnn +\cs_new:Npn \__tl_change_case_group_mixed:nnnn #1#2#3#4 + { + \__tl_change_case_output:own + { + \exp_after:wN + { + \exp:w + \__tl_change_case_aux:nnn {#3} {#4} {#1} + } + } + \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } {#4} + } \exp_last_unbraced:NNo \cs_new:Npn \__tl_change_case_space:wnn \c_space_tl { \__tl_change_case_output:nwn { ~ } @@ -22156,11 +22480,11 @@ \cs_new:Npn \__tl_change_case_N_type:Nnnn #1#2#3#4 { \token_if_cs:NTF #1 - { \__tl_change_case_cs_letterlike:Nnn #1 {#3} { } } - { \__tl_change_case_char:Nnn #1 {#3} {#4} } + { \__tl_change_case_cs_letterlike:Nn #1 {#3} } + { \use:c { __tl_change_case_char_ #3 :Nnn } #1 {#3} {#4} } \__tl_change_case_loop:wnn #2 \q_recursion_stop {#3} {#4} } -\cs_new:Npn \__tl_change_case_char:Nnn #1#2#3 +\cs_new:Npn \__tl_change_case_char_lower:Nnn #1#2#3 { \cs_if_exist_use:cF { __tl_change_case_ #2 _ #3 :Nnw } { \use_ii:nn } @@ -22170,6 +22494,19 @@ { \__tl_change_case_char:nN {#2} #1 } } } +\cs_new_eq:NN \__tl_change_case_char_upper:Nnn + \__tl_change_case_char_lower:Nnn +\cs_new:Npn \__tl_change_case_char_mixed:Nnn #1#2#3 + { + \__tl_change_case_mixed_switch:w + \cs_if_exist_use:cF { __tl_change_case_mixed_ #3 :Nnw } + { + \cs_if_exist_use:cF { __tl_change_case_upper_ #3 :Nnw } + { \use_ii:nn } + } + #1 + { \__tl_change_case_mixed_skip:N #1 } + } \cs_if_exist:NTF \utex_char:D { \cs_new:Npn \__tl_change_case_char:nN #1#2 @@ -22192,13 +22529,32 @@ } } \cs_new:Npn \__tl_change_case_char_auxi:nN #1#2 + { \use:c { __tl_change_case_char_ #1 :N } #2 } +\cs_new:Npn \__tl_change_case_char_lower:N #1 + { + \__tl_change_case_output:fwn + { + \cs_if_exist_use:cF { c__unicode_lower_ \token_to_str:N #1 _tl } + { \__tl_change_case_char_auxii:nN { lower } #1 } + } + } +\cs_new:Npn \__tl_change_case_char_upper:N #1 { \__tl_change_case_output:fwn { - \cs_if_exist_use:cF { c__unicode_ #1 _ \token_to_str:N #2 _tl } - { \__tl_change_case_char_auxii:nN {#1} #2 } + \cs_if_exist_use:cF { c__unicode_upper_ \token_to_str:N #1 _tl } + { \__tl_change_case_char_auxii:nN { upper } #1 } } } +\cs_new:Npn \__tl_change_case_char_mixed:N #1 + { + \cs_if_exist:cTF { c__unicode_mixed_ \token_to_str:N #1 _tl } + { + \__tl_change_case_output:fwn + { \tl_use:c { c__unicode_mixed_ \token_to_str:N #1 _tl } } + } + { \__tl_change_case_char_upper:N #1 } + } \cs_if_exist:NTF \utex_char:D { \cs_new:Npn \__tl_change_case_char_auxii:nN #1#2 @@ -22213,7 +22569,7 @@ } \cs_new_protected:Npn \__tl_lookup_lower:N #1 { \tex_lccode:D `#1 } \cs_new_protected:Npn \__tl_lookup_upper:N #1 { \tex_uccode:D `#1 } - \cs_new_eq:NN \__tl_lookup_title:N \__tl_lookup_upper:N + \cs_new_eq:NN \__tl_lookup_mixed:N \__tl_lookup_upper:N } { \cs_new:Npn \__tl_change_case_char_auxii:nN #1#2 { \exp_stop_f: #2 } @@ -22234,7 +22590,16 @@ #3 } } -\cs_new:Npn \__tl_change_case_cs_letterlike:Nnn #1#2#3 +\cs_new:Npn \__tl_change_case_cs_letterlike:Nn #1#2 + { + \str_if_eq:nnTF {#2} { mixed } + { + \__tl_change_case_cs_letterlike:NnN #1 { upper } + \__tl_change_case_mixed_switch:w + } + { \__tl_change_case_cs_letterlike:NnN #1 {#2} \prg_do_nothing: } + } +\cs_new:Npn \__tl_change_case_cs_letterlike:NnN #1#2#3 { \cs_if_exist:cTF { c__tl_change_case_ #2 _ \token_to_str:N #1 _tl } { @@ -22322,6 +22687,36 @@ } \cs_new:Npn \__tl_change_case_cs_expand:NN #1#2 { \exp_after:wN #2 #1 } +\cs_new:Npn \__tl_change_case_mixed_skip:N #1 + { + \exp_after:wN \__tl_change_case_mixed_skip:NN + \exp_after:wN #1 \l_tl_mixed_case_ignore_tl + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \__tl_change_case_mixed_skip:NN #1#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} + { \__tl_change_case_char:nN { mixed } #1 } + \int_compare:nNnT { `#1 } = { `#2 } + { + \use_i_delimit_by_q_recursion_stop:nw + { + \__tl_change_case_output:nwn {#1} + \__tl_change_case_mixed_skip_tidy:Nwn + } + } + \__tl_change_case_mixed_skip:NN #1 + } +\cs_new:Npn \__tl_change_case_mixed_skip_tidy:Nwn #1#2 \q_recursion_stop #3 + { + \__tl_change_case_loop:wnn #2 \q_recursion_stop { mixed } + } +\cs_new:Npn \__tl_change_case_mixed_switch:w + #1 \__tl_change_case_loop:wnn #2 \q_recursion_stop #3 + { + #1 + \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } + } \cs_new:Npn \__tl_change_case_lower_sigma:Nnw #1#2#3#4 \q_recursion_stop { \int_compare:nNnTF { `#1 } = { "03A3 } @@ -22795,7 +23190,7 @@ \group_end: } \__tl_tmp:w { 00DF } { SS } { upper } - \__tl_tmp:w { 00DF } { Ss } { title } + \__tl_tmp:w { 00DF } { Ss } { mixed } \__tl_tmp:w { 0131 } { I } { upper } } \group_end: @@ -22827,129 +23222,6 @@ \tl_new:N \l_tl_case_change_accents_tl \tl_set:Nn \l_tl_case_change_accents_tl { \" \' \. \^ \` \~ \c \H \k \r \t \u \v } -\cs_new:Npn \__tl_mixed_case:nn #1#2 - { - \etex_unexpanded:D \exp_after:wN - { - \exp:w - \__tl_mixed_case_aux:nn {#1} {#2} - } - } -\cs_new:Npn \__tl_mixed_case_aux:nn #1#2 - { - \group_align_safe_begin: - \__tl_mixed_case_loop:wn - #2 \q_recursion_tail \q_recursion_stop {#1} - \__tl_change_case_result:n { } - } -\cs_new:Npn \__tl_mixed_case_loop:wn #1 \q_recursion_stop - { - \tl_if_head_is_N_type:nTF {#1} - { \__tl_mixed_case_N_type:Nwn } - { - \tl_if_head_is_group:nTF {#1} - { \__tl_mixed_case_group:nwn } - { \__tl_mixed_case_space:wn } - } - #1 \q_recursion_stop - } -\cs_new:Npn \__tl_mixed_case_group:nwn #1#2 \q_recursion_stop #3 - { - \__tl_change_case_output:own - { - \exp_after:wN - { - \exp:w - \__tl_mixed_case_aux:nn {#3} {#1} - } - } - \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } {#3} - } -\exp_last_unbraced:NNo \cs_new:Npn \__tl_mixed_case_space:wn \c_space_tl - { - \__tl_change_case_output:nwn { ~ } - \__tl_mixed_case_loop:wn - } -\cs_new:Npn \__tl_mixed_case_N_type:Nwn #1#2 \q_recursion_stop - { - \quark_if_recursion_tail_stop_do:Nn #1 - { \__tl_change_case_end:wn } - \exp_after:wN \__tl_mixed_case_N_type:NNNnn - \exp_after:wN #1 \l_tl_case_change_math_tl - \q_recursion_tail ? \q_recursion_stop {#2} - } -\cs_new:Npn \__tl_mixed_case_N_type:NNNnn #1#2#3 - { - \quark_if_recursion_tail_stop_do:Nn #2 - { \__tl_mixed_case_N_type:Nnn #1 } - \token_if_eq_meaning:NNTF #1 #2 - { - \use_i_delimit_by_q_recursion_stop:nw - { - \__tl_change_case_math:NNNnnn - #1 #3 \__tl_mixed_case_loop:wn - } - } - { \__tl_mixed_case_N_type:NNNnn #1 } - } -\cs_new:Npn \__tl_mixed_case_N_type:Nnn #1#2#3 - { - \token_if_cs:NTF #1 - { - \__tl_change_case_cs_letterlike:Nnn #1 { upper } - { \__tl_mixed_case_letterlike:Nw } - \__tl_mixed_case_loop:wn #2 \q_recursion_stop {#3} - } - { - \__tl_mixed_case_char:Nn #1 {#3} - \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } {#3} - } - } -\cs_new:Npn \__tl_mixed_case_letterlike:Nw #1#2 \q_recursion_stop - { \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } } -\cs_new:Npn \__tl_mixed_case_char:Nn #1#2 - { - \cs_if_exist_use:cF { __tl_change_case_mixed_ #2 :Nnw } - { - \cs_if_exist_use:cF { __tl_change_case_upper_ #2 :Nnw } - { \use_ii:nn } - } - #1 - { \__tl_mixed_case_skip:N #1 } - } -\cs_new:Npn \__tl_mixed_case_skip:N #1 - { - \exp_after:wN \__tl_mixed_case_skip:NN - \exp_after:wN #1 \l_tl_mixed_case_ignore_tl - \q_recursion_tail \q_recursion_stop - } -\cs_new:Npn \__tl_mixed_case_skip:NN #1#2 - { - \quark_if_recursion_tail_stop_do:nn {#2} - { \__tl_mixed_case_char:N #1 } - \int_compare:nNnT { `#1 } = { `#2 } - { - \use_i_delimit_by_q_recursion_stop:nw - { - \__tl_change_case_output:nwn {#1} - \__tl_mixed_case_skip_tidy:Nwn - } - } - \__tl_mixed_case_skip:NN #1 - } -\cs_new:Npn \__tl_mixed_case_skip_tidy:Nwn #1#2 \q_recursion_stop #3 - { - \__tl_mixed_case_loop:wn #2 \q_recursion_stop - } -\cs_new:Npn \__tl_mixed_case_char:N #1 - { - \cs_if_exist:cTF { c__unicode_title_ #1 _tl } - { - \__tl_change_case_output:fwn - { \tl_use:c { c__unicode_title_ #1 _tl } } - } - { \__tl_change_case_char:nN { upper } #1 } - } \cs_new:Npn \__tl_change_case_mixed_nl:Nnw #1 { \bool_lazy_or:nnTF diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex index 2dfdc116f31..7dcf18f679b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/29}% +\def\ExplFileDate{2017/07/15}% \let\ExplLoaderFileDate\ExplFileDate \begingroup \def\tempa{LaTeX2e}% @@ -59,6 +59,7 @@ \catcode64=11 % \chardef \l@expl@check@declarations@bool = 0 % \chardef \l@expl@log@functions@bool = 0 % +\chardef \l@expl@enable@debug@bool = 0 % \let\expl@AtBeginDocument\AtBeginDocument \def\AtBeginDocument#1{}% \expandafter\def\expandafter\l@expl@tidy@tl\expandafter diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua index 1da6f623d37..ca496b495c9 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua @@ -20,23 +20,114 @@ -- -- File: l3luatex.dtx Copyright (C) 2010-2017 The LaTeX3 Project l3kernel = l3kernel or { } -local tex_setcatcode = tex.setcatcode -local tex_sprint = tex.sprint -local tex_write = tex.write -local unicode_utf8_char = unicode.utf8.char -local function strcmp (A, B) +local io = io +local kpse = kpse +local lfs = lfs +local math = math +local md5 = md5 +local os = os +local string = string +local tex = tex +local unicode = unicode +local abs = math.abs +local byte = string.byte +local floor = math.floor +local format = string.format +local gsub = string.gsub +local kpse_find = kpse.find_file +local lfs_attr = lfs.attributes +local md5_sum = md5.sum +local open = io.open +local os_date = os.date +local setcatcode = tex.setcatcode +local str_format = string.format +local sprint = tex.sprint +local write = tex.write +local utf8_char = unicode.utf8.char +local function escapehex(str) + write((gsub(str, ".", + function (ch) return format("%02X", byte(ch)) end))) +end +local charcat_table = l3kernel.charcat_table or 1 +local function charcat(charcode, catcode) + setcatcode(charcat_table, charcode, catcode) + sprint(charcat_table, utf8_char(charcode)) +end +l3kernel.charcat = charcat +local function filemdfivesum(name) + local file = kpse_find(name, "tex", true) + if file then + local f = open(file, "r") + if f then + local data = f:read("*a") + escapehex(md5_sum(data)) + f:close() + end + end +end +l3kernel.filemdfivesum = filemdfivesum +local function filemoddate(name) + local file = kpse_find(name, "tex", true) + if file then + local date = lfs_attr(file, "modification") + if date then + local d = os_date("*t", date) + if d.sec >= 60 then + d.sec = 59 + end + local u = os_date("!*t", date) + local off = 60 * (d.hour - u.hour) + d.min - u.min + if d.year ~= u.year then + if d.year > u.year then + off = off + 1440 + else + off = off - 1440 + end + elseif d.yday ~= u.yday then + if d.yday > u.yday then + off = off + 1440 + else + off = off - 1440 + end + end + local timezone + if off == 0 then + timezone = "Z" + else + local hours = floor(off / 60) + local mins = abs(off - hours * 60) + timezone = str_format("%+03d", hours) + .. "'" .. str_format("%02d", mins) .. "'" + end + write("D:" + .. str_format("%04d", d.year) + .. str_format("%02d", d.month) + .. str_format("%02d", d.day) + .. str_format("%02d", d.hour) + .. str_format("%02d", d.min) + .. str_format("%02d", d.sec) + .. timezone) + end + end +end +l3kernel.filemoddate = filemoddate +local function filesize(name) + local file = kpse_find(name, "tex", true) + if file then + local size = lfs_attr(file, "size") + if size then + write(size) + end + end +end +l3kernel.filesize = filesize +local function strcmp(A, B) if A == B then - tex_write("0") + write("0") elseif A < B then - tex_write("-1") + write("-1") else - tex_write("1") + write("1") end end l3kernel.strcmp = strcmp -local charcat_table = l3kernel.charcat_table or 1 -local function charcat (charcode, catcode) - tex_setcatcode(charcat_table, charcode, catcode) - tex_sprint(charcat_table, unicode_utf8_char(charcode)) -end -l3kernel.charcat = charcat diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 10791bf2dc1..2ca397563e7 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/29}% +\def\ExplFileDate{2017/07/15}% \let\ExplLoaderFileDate\ExplFileDate \ProvidesPackage{expl3} [% @@ -36,7 +36,9 @@ } \expl@create@bool@option{check-declarations}\l@expl@check@declarations@bool \expl@create@bool@option{log-functions}\l@expl@log@functions@bool +\expl@create@bool@option{enable-debug}\l@expl@enable@debug@bool \let\expl@create@bool@option\@undefined +\chardef\l@expl@enable@debug@bool=0 % \newcommand*\l@expl@options@clist{} \DeclareOption* {% @@ -50,6 +52,12 @@ \fi } \ProcessOptions\relax +\ifodd\l@expl@check@declarations@bool + \chardef\l@expl@enable@debug@bool=1 % +\fi +\ifodd\l@expl@log@functions@bool + \chardef\l@expl@enable@debug@bool=1 % +\fi \protected\def\ProvidesExplPackage#1#2#3#4% {% \ProvidesPackage{#1}[#2 \ifx\relax#3\relax\else v#3\space\fi #4]% @@ -275,6 +283,11 @@ } \tl_put_left:Nn \@pushfilename { + \exp_args:Nx \__file_input_push:n + { + \tl_to_str:N \@currname + \tl_to_str:N \@currext + } \tl_put_left:Nx \l__expl_status_stack_tl { \bool_if:NTF \l__kernel_expl_bool @@ -283,8 +296,15 @@ } \ExplSyntaxOff } +\tl_put_right:Nn \@pushfilename { \@pushfilenameaux } +\cs_set_protected:Npn \@pushfilenameaux #1#2#3 + { + \str_gset:Nn \g_file_curr_name_str {#3} + #1 #2 {#3} + } \tl_put_right:Nn \@popfilename { + \__file_input_pop: \tl_if_empty:NTF \l__expl_status_stack_tl { \ExplSyntaxOff } { \exp_after:wN \__expl_status_pop:w \l__expl_status_stack_tl \q_stop } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index 557e1346c97..40e5be8e70b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -20,7 +20,7 @@ %% %% File: l3doc.dtx Copyright (C) 1990-2017 The LaTeX3 project \RequirePackage{expl3,xparse,calc} -\ProvidesExplClass{l3doc}{2017/05/29}{} +\ProvidesExplClass{l3doc}{2017/07/15}{} {L3 Experimental documentation class} \clist_new:N \g_docinput_clist \seq_new:N \g_doc_functions_seq @@ -1354,7 +1354,7 @@ \__codedoc_test_missing_aux:Nxn \g__codedoc_missing_tests_prop { \seq_use:Nn \l__codedoc_names_seq { , } } - { { \g_file_current_name_tl \iow_char:N \ (#1) } } + { { \g_file_curr_name_str \iow_char:N \ (#1) } } } \cs_new_protected:Npn \__codedoc_test_missing_aux:Nnn #1#2#3 { diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def index 7d8c5b96f9e..60886d1f6c7 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def @@ -22,6 +22,22 @@ \ProvidesExplFile {l3dvidpfmx.def}{2017/03/18}{} {L3 Experimental driver: dvipdfmx} +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \__driver_color_pickup: + { \tl_set_eq:NN \l__color_current_tl \current@color } + } + { \cs_new_protected:Npn \__driver_color_pickup: { } } + } +\cs_new_protected:Npn \__driver_color_ensure_current: + { + \__driver_color_pickup: + \tex_special:D { color~push~\l__color_current_tl } + } +\cs_new_protected:Npn \__driver_color_reset: + { \tex_special:D { color~pop } } \cs_new_protected:Npn \__driver_literal:n #1 { \tex_special:D { pdf:literal~ #1 } } \cs_new_protected:Npn \__driver_scope_begin: @@ -68,31 +84,18 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_color_current_tl -\tl_set:Nn \l__driver_color_current_tl { [ 0 ] } -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_color_current_tl { \current@color } } - { } - } -\cs_new_protected:Npn \__driver_color_ensure_current: - { - \tex_special:D { pdf:bcolor~\l__driver_color_current_tl } - \group_insert_after:N \__driver_color_reset: - } -\cs_new_protected:Npn \__driver_color_reset: - { \tex_special:D { pdf:ecolor } } \cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n \cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 { \int_zero:N \l__image_page_int + \tl_clear:N \l__image_pagebox_tl \__image_extract_bb:n {#1} } \cs_new_eq:NN \__driver_image_getbb_png:n \__driver_image_getbb_jpg:n \cs_new_protected:Npn \__driver_image_getbb_pdf:n #1 { - \bool_set_false:N \l__image_interpolate_tl + \tl_clear:N \l__image_decode_tl + \bool_set_false:N \l__image_interpolate_bool \__image_extract_bb:n {#1} } \int_new:N \g__driver_image_int @@ -102,15 +105,19 @@ } \cs_new_protected:Npn \__driver_image_include_jpg:n #1 { \__driver_image_include_auxi:nn {#1} { image } } -\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_png:n +\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_jpg:n \cs_new_protected:Npn \__driver_image_include_pdf:n #1 { \__driver_image_include_auxi:nn {#1} { epdf } } \cs_new_protected:Npn \__driver_image_include_auxi:nn #1#2 { \__driver_image_include_auxii:xnn { - \int_compare:nNnT \l__image_page_int > 0 + \tl_if_empty:NF \l__image_pagebox_tl + { : \l__image_pagebox_tl } + \int_compare:nNnT \l__image_page_int > 1 { :P \int_use:N \l__image_page_int } + \tl_if_empty:NF \l__image_decode_tl + { :D \l__image_decode_tl } \bool_if:NT \l__image_interpolate_bool { :I } } @@ -134,11 +141,29 @@ { pdf:#3~ @image \int_use:c { c__image_ #1#2 _int } - \int_compare:nNnT \l__image_page_int > 0 + \int_compare:nNnT \l__image_page_int > 1 { page ~ \int_use:N \l__image_page_int \c_space_tl } + \tl_if_empty:NF \l__image_pagebox_tl + { + pagebox ~ \l__image_pagebox_tl \c_space_tl + bbox ~ + \dim_to_decimal_in_bp:n \l__image_llx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_lly_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_urx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_ury_dim \c_space_tl + } (#1) - \bool_if:NT \l__image_interpolate_bool - { <</Interpolate~true>> } + \bool_lazy_or:nnT + { \l__image_interpolate_bool } + { ! \tl_if_empty_p:N \l__imge_decode_tl } + { + << + \tl_if_empty:NF \l__imge_decode_tl + { /Decode~[ \l__imge_decode_tl ] } + \bool_if:NT \l__image_interpolate_bool + { /Interpolate~true> } + >> + } } } \cs_new_eq:NN \__driver_draw_literal:n \__driver_literal:n diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def index 07063fdcd2c..727fbcbd454 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def @@ -22,6 +22,22 @@ \ProvidesExplFile {l3dvips.def}{2017/03/18}{} {L3 Experimental driver: dvips} +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \__driver_color_pickup: + { \tl_set_eq:NN \l__color_current_tl \current@color } + } + { \cs_new_protected:Npn \__driver_color_pickup: { } } + } +\cs_new_protected:Npn \__driver_color_ensure_current: + { + \__driver_color_pickup: + \tex_special:D { color~push~\l__color_current_tl } + } +\cs_new_protected:Npn \__driver_color_reset: + { \tex_special:D { color~pop } } \cs_new_protected:Npn \__driver_literal:n #1 { \tex_special:D @@ -88,21 +104,6 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_color_current_tl -\tl_set:Nn \l__driver_color_current_tl { gray~0 } -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_color_current_tl { \current@color } } - { } - } -\cs_new_protected:Npn \__driver_color_ensure_current: - { - \tex_special:D { color~push~\l__driver_color_current_tl } - \group_insert_after:N \__driver_color_reset: - } -\cs_new_protected:Npn \__driver_color_reset: - { \tex_special:D { color~pop } } \cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n \cs_new_protected:Npn \__driver_image_include_eps:n #1 { @@ -144,7 +145,7 @@ { \dim_to_decimal_in_bp:n {#4} ~ \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ - moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~clospath + moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~closepath } } \cs_new_protected:Npn \__driver_draw_curveto:nnnnnn #1#2#3#4#5#6 diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def index 4bae05e91df..f9bf990c499 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def @@ -22,6 +22,22 @@ \ProvidesExplFile {l3dvisvgm.def}{2017/03/18}{} {L3 Experimental driver: dvisvgm} +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \__driver_color_pickup: + { \tl_set_eq:NN \l__color_current_tl \current@color } + } + { \cs_new_protected:Npn \__driver_color_pickup: { } } + } +\cs_new_protected:Npn \__driver_color_ensure_current: + { + \__driver_color_pickup: + \tex_special:D { color~push~\l__color_current_tl } + } +\cs_new_protected:Npn \__driver_color_reset: + { \tex_special:D { color~pop } } \cs_new_protected:Npn \__driver_literal:n #1 { \tex_special:D { dvisvgm:raw~ #1 { ?nl } } } \cs_new_protected:Npn \__driver_scope_begin: @@ -113,21 +129,20 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_color_current_tl -\tl_set:Nn \l__driver_color_current_tl { gray~0 } -\AtBeginDocument +\cs_new_eq:NN \__driver_image_getbb_png:n \__image_extract_bb:n +\cs_new_eq:NN \__driver_image_getbb_jpg:n \__image_extract_bb:n +\cs_new_protected:Npn \__driver_image_include_png:n #1 { - \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_color_current_tl { \current@color } } - { } + \tex_special:D + { + dvisvgm:img~ + \dim_to_decimal:n { \l__image_ury_dim } ~ + \dim_to_decimal:n { \l__image_ury_dim } ~ + \__driver_image_include_bitmap_quote:w #1 " " \q_stop + } } -\cs_new_protected:Npn \__driver_color_ensure_current: - { - \tex_special:D { color~push~\l__driver_color_current_tl } - \group_insert_after:N \__driver_color_reset: - } -\cs_new_protected:Npn \__driver_color_reset: - { \tex_special:D { color~pop } } +\cs_new_eq:NN \__driver_image_include_jpg:n \__driver_image_include_png:n +\cs_new:Npn \__driver_image_include_bitmap_quote:w #1 " #2 " #3 \q_stop { #1#2 } \cs_new_eq:NN \__driver_draw_literal:n \__driver_literal:n \cs_generate_variant:Nn \__driver_draw_literal:n { x } \cs_new_protected:Npn \__driver_draw_begin: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def index a8db92d73d0..5e1fe69f6fe 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def @@ -22,6 +22,66 @@ \ProvidesExplFile {l3pdfmode.def}{2017/03/18}{} {L3 Experimental driver: PDF mode} +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \__driver_color_pickup: + { + \tl_set:Nx \l__color_current_tl + { + \exp_after:wN \__driver_color_pickup_aux:w + \current@color ~ 0 ~ 0 ~ 0 \q_stop + } + } + \cs_new:Npn \__driver_color_pickup_aux:w #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \q_stop + { + \str_if_eq:nnTF {#2} { g } + { gray ~ #1 } + { + \str_if_eq:nnTF {#4} { rg } + { rgb ~ #1 ~ #2 ~ #3 } + { + \str_if_eq:nnTF {#5} { k } + { cmyk ~ #1 ~ #2 ~ #3 ~ #4 } + { gray ~ #1 } + } + } + } + } + { \cs_new_protected:Npn \__driver_color_pickup: { } } + } +\int_new:N \l__driver_color_stack_int +\cs_new_protected:Npx \__driver_color_ensure_current: + { + \exp_not:N \__driver_color_pickup: + \cs_if_exist:NTF \luatex_pdfextension:D + { \luatex_pdfextension:D colorstack } + { \pdftex_pdfcolorstack:D } + \exp_not:N \l__driver_color_stack_int push + { + \exp_not:N \exp_after:wN + \exp_not:N \__driver_color_convert:w + \exp_not:N \l__color_current_tl + \c_space_tl 0 ~ 0 ~ 0 + \exp_not:N \q_stop + } + } +\cs_new:Npn \__driver_color_convert:w #1 ~ + { \use:c { __driver_color_convert_ #1 :w } } +\cs_new:Npn \__driver_color_convert_gray:w #1 ~ #2 \q_stop + { #1 ~ g ~ #1 ~ G } +\cs_new:Npn \__driver_color_convert_cmyk:w #1 ~ #2 ~ #3 ~ #4 \q_stop + { #1 ~ #2 ~ #3 ~ rg ~ #1 ~ #2 ~ #3 ~ RG } +\cs_new:Npn \__driver_color_convert_rgb:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop + { #1 ~ #2 ~ #3 ~ #4 ~ k ~ #1 ~ #2 ~ #3 ~ #4 ~ K } +\cs_new_protected:Npx \__driver_color_reset: + { + \cs_if_exist:NTF \luatex_pdfextension:D + { \luatex_pdfextension:D colorstack } + { \pdftex_pdfcolorstack:D } + \exp_not:N \l__driver_color_stack_int pop \scan_stop: + } \cs_new_protected:Npx \__driver_literal:n #1 { \cs_if_exist:NTF \luatex_pdfextension:D @@ -101,82 +161,77 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_color_current_tl -\tl_set:Nn \l__driver_color_current_tl { 0~g~0~G } -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_color_current_tl { \current@color } } - { } - } -\int_new:N \l__driver_color_stack_int -\cs_new_protected:Npx \__driver_color_ensure_current: - { - \cs_if_exist:NTF \luatex_pdfextension:D - { \luatex_pdfextension:D colorstack } - { \pdftex_pdfcolorstack:D } - \exp_not:N \l__driver_color_stack_int push - { \exp_not:N \l__driver_color_current_tl } - \group_insert_after:N \exp_not:N \__driver_color_reset: - } -\cs_new_protected:Npx \__driver_color_reset: - { - \cs_if_exist:NTF \luatex_pdfextension:D - { \luatex_pdfextension:D colorstack } - { \pdftex_pdfcolorstack:D } - \exp_not:N \l__driver_color_stack_int pop \scan_stop: - } \tl_new:N \l__driver_image_attr_tl \cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 { \int_zero:N \l__image_page_int + \tl_clear:N \l__image_pagebox_tl \tl_set:Nx \l__driver_image_attr_tl { + \tl_if_empty:NF \l__image_decode_tl + { :D \l__image_decode_tl } \bool_if:NT \l__image_interpolate_bool { :I } } + \tl_clear:N \l__driver_image_attr_tl \__driver_image_getbb_auxi:n {#1} } \cs_new_eq:NN \__driver_image_getbb_png:n \__driver_image_getbb_jpg:n \cs_new_protected:Npn \__driver_image_getbb_pdf:n #1 { + \tl_clear:N \l__image_decode_tl \bool_set_false:N \l__image_interpolate_bool \tl_set:Nx \l__driver_image_attr_tl { - \int_compare:nNnT \l__image_page_int > 0 + : \l__image_pagebox_tl + \int_compare:nNnT \l__image_page_int > 1 { :P \int_use:N \l__image_page_int } } \__driver_image_getbb_auxi:n {#1} } \cs_new_protected:Npn \__driver_image_getbb_auxi:n #1 { - \dim_if_exist:cTF { c__image_ #1 \l__driver_image_attr_tl _ht_dim } + \dim_zero:N \l__image_llx_dim + \dim_zero:N \l__image_lly_dim + \dim_if_exist:cTF { c__image_ #1 \l__driver_image_attr_tl _urx_dim } { - \dim_set_eq:Nc \l__image_ht_dim - { c__image_ #1 \l__driver_image_attr_tl _ht_dim } - \dim_set_eq:Nc \l__image_wd_dim - { c__image_ #1 \l__driver_image_attr_tl _wd_dim } + \dim_set_eq:Nc \l__image_urx_dim + { c__image_ #1 \l__driver_image_attr_tl _urx_dim } + \dim_set_eq:Nc \l__image_ury_dim + { c__image_ #1 \l__driver_image_attr_tl _ury_dim } } { \__driver_image_getbb_auxii:n {#1} } } \cs_new_protected:Npn \__driver_image_getbb_auxii:n #1 { \tex_immediate:D \pdftex_pdfximage:D - \bool_if:NT \l__image_interpolate_bool - { attr ~ { /Interpolate~true } } + \bool_lazy_or:nnT + { \l__image_interpolate_bool } + { ! \tl_if_empty_p:N \l__image_decode_tl } + { + attr ~ + { + \tl_if_empty:NF \l__image_decode_tl + { /Decode~[ \l__image_decode_tl ] } + \bool_if:NT \l__image_interpolate_bool + { /Interpolate~true } + } + } \int_compare:nNnT \l__image_page_int > 0 { page ~ \int_use:N \l__image_page_int } + \tl_if_empty:NF \l__image_pagebox_tl + { \l__image_pagebox_tl } {#1} \hbox_set:Nn \l__image_tmp_box { \pdftex_pdfrefximage:D \pdftex_pdflastximage:D } - \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } - \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } + \dim_set:Nn \l__image_urx_dim { \box_wd:N \l__image_tmp_box } + \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box } \int_const:cn { c__image_ #1 \l__driver_image_attr_tl _int } { \tex_the:D \pdftex_pdflastximage:D } - \dim_const:cn { c__image_ #1 \l__driver_image_attr_tl _ht_dim } - { \l__image_ht_dim } - \dim_const:cn { c__image_ #1 \l__driver_image_attr_tl _wd_dim } - { \l__image_wd_dim } + \dim_const:cn { c__image_ #1 \l__driver_image_attr_tl _urx_dim } + { \l__image_urx_dim } + \dim_const:cn { c__image_ #1 \l__driver_image_attr_tl _ury_dim } + { \l__image_ury_dim } } \cs_new_protected:Npn \__driver_image_include_jpg:n #1 { diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def b/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def index 4046489e12e..f66bc633b4c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def @@ -22,6 +22,22 @@ \ProvidesExplFile {l3xdvidpfmx.def}{2017/03/18}{} {L3 Experimental driver: xdvipdfmx} +\AtBeginDocument + { + \@ifpackageloaded { color } + { + \cs_new_protected:Npn \__driver_color_pickup: + { \tl_set_eq:NN \l__color_current_tl \current@color } + } + { \cs_new_protected:Npn \__driver_color_pickup: { } } + } +\cs_new_protected:Npn \__driver_color_ensure_current: + { + \__driver_color_pickup: + \tex_special:D { color~push~\l__color_current_tl } + } +\cs_new_protected:Npn \__driver_color_reset: + { \tex_special:D { color~pop } } \cs_new_protected:Npn \__driver_literal:n #1 { \tex_special:D { pdf:literal~ #1 } } \cs_new_protected:Npn \__driver_scope_begin: @@ -68,21 +84,6 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_color_current_tl -\tl_set:Nn \l__driver_color_current_tl { [ 0 ] } -\AtBeginDocument - { - \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_color_current_tl { \current@color } } - { } - } -\cs_new_protected:Npn \__driver_color_ensure_current: - { - \tex_special:D { pdf:bcolor~\l__driver_color_current_tl } - \group_insert_after:N \__driver_color_reset: - } -\cs_new_protected:Npn \__driver_color_reset: - { \tex_special:D { pdf:ecolor } } \cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n \int_new:N \g__driver_image_int \cs_new_protected:Npn \__driver_image_include_eps:n #1 @@ -91,15 +92,17 @@ } \cs_new_protected:Npn \__driver_image_include_jpg:n #1 { \__driver_image_include_auxi:nn {#1} { image } } -\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_png:n -\cs_new_protected:Npn \__driver_image_include_pdf:n #1 - { \__driver_image_include_auxi:nn {#1} { epdf } } +\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_jpg:n \cs_new_protected:Npn \__driver_image_include_auxi:nn #1#2 { \__driver_image_include_auxii:xnn { - \int_compare:nNnT \l__image_page_int > 0 + \tl_if_empty:NF \l__image_pagebox_tl + { : \l__image_pagebox_tl } + \int_compare:nNnT \l__image_page_int > 1 { :P \int_use:N \l__image_page_int } + \tl_if_empty:NF \l__image_decode_tl + { :D \l__image_decode_tl } \bool_if:NT \l__image_interpolate_bool { :I } } @@ -123,69 +126,97 @@ { pdf:#3~ @image \int_use:c { c__image_ #1#2 _int } - \int_compare:nNnT \l__image_page_int > 0 + \int_compare:nNnT \l__image_page_int > 1 { page ~ \int_use:N \l__image_page_int \c_space_tl } + \tl_if_empty:NF \l__image_pagebox_tl + { + pagebox ~ \l__image_pagebox_tl \c_space_tl + bbox ~ + \dim_to_decimal_in_bp:n \l__image_llx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_lly_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_urx_dim \c_space_tl + \dim_to_decimal_in_bp:n \l__image_ury_dim \c_space_tl + } (#1) - \bool_if:NT \l__image_interpolate_bool - { <</Interpolate~true>> } - } - } -\AtBeginDocument - { - \@ifpackageloaded { color } - { - \cs_set_protected:Npn \__driver_tmp:w #1 [ #2 ] #3 \q_stop + \bool_lazy_or:nnT + { \l__image_interpolate_bool } + { ! \tl_if_empty_p:N \l__imge_decode_tl } { - \tl_if_empty:nT {#2} - { - \cs_set_protected:Npn \__driver_color_ensure_current: - { - \tex_special:D { color~push~\l__driver_color_current_tl } - \group_insert_after:N \__driver_color_reset: - } - \cs_set_protected:Npn \__driver_color_reset: - { \tex_special:D { color~pop } } - } + << + \tl_if_empty:NF \l__imge_decode_tl + { /Decode~[ \l__imge_decode_tl ] } + \bool_if:NT \l__image_interpolate_bool + { /Interpolate~true> } + >> } - \exp_after:wN \__driver_tmp:w \current@color [ ] \q_stop } - { } } \cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 { \int_zero:N \l__image_page_int + \tl_clear:N \l__image_pagebox_tl \__driver_image_getbb_auxi:nN {#1} \xetex_picfile:D } \cs_new_eq:NN \__driver_image_getbb_png:n \__driver_image_getbb_jpg:n \cs_new_protected:Npn \__driver_image_getbb_pdf:n #1 - { \__driver_image_getbb_auxi:nN {#1} \xetex_pdffile:D } + { + \tl_clear:N \l__image_decode_tl + \bool_set_false:N \l__image_interpolate_bool + \__driver_image_getbb_auxi:nN {#1} \xetex_pdffile:D + } \cs_new_protected:Npn \__driver_image_getbb_auxi:nN #1#2 { - \int_compare:nNnTF \l__image_page_int > 0 + \int_compare:nNnTF \l__image_page_int > 1 { \__driver_image_getbb_auxii:VnN \l__image_page_int {#1} #2 } { \__driver_image_getbb_auxiii:nNnn {#1} #2 } } \cs_new_protected:Npn \__driver_image_getbb_auxii:nnN #1#2#3 - { \__driver_image_getbb_auxiii:nNnn {#2} #3 { :P #1 } { page #1 } } + { \__driver_image_getbb_aux:nNnn {#2} #3 { :P #1 } { page #1 } } \cs_generate_variant:Nn \__driver_image_getbb_auxii:nnN { V } \cs_new_protected:Npn \__driver_image_getbb_auxiii:nNnn #1#2#3#4 { - \dim_if_exist:cTF { c__image_ #1#3 _ht_dim } + \tl_if_empty:NTF \l__image_pagebox_tl + { \__driver_image_getbb_auxiv:VnNnn \l__image_pagebox_tl } + { \__driver_image_getbb_auxv:nNnn } + {#1} #2 {#3} {#4} + } +\cs_new_protected:Npn \__driver_image_getbb_auxiv:nnNnn #1#2#3#4#5 + { + \use:x { - \dim_set_eq:Nc \l__image_ht_dim { c__image_ #1#3 _ht_dim } - \dim_set_eq:Nc \l__image_wd_dim { c__image_ #1#3 _wd_dim } + \__driver_image_getbb_auxv:nNnn {#2} #3 { : #1 #4 } + { #5 ~ \__driver_image_getbb_pagebox:w #1 } + } + } +\cs_generate_variant:Nn \__driver_image_getbb_auxiv:nnNnn { V } +\cs_new_protected:Npn \__driver_image_getbb_auxv:nNnn #1#2#3#4 + { + \dim_zero:N \l__image_llx_dim + \dim_zero:N \l__image_lly_dim + \dim_if_exist:cTF { c__image_ #1#3 _urx_dim } + { + \dim_set_eq:Nc \l__image_urx_dim { c__image_ #1#3 _urx_dim } + \dim_set_eq:Nc \l__image_ury_dim { c__image_ #1#3 _ury_dim } } { \__driver_image_getbb_auxvi:nNnn {#1} #2 {#3} {#4} } } \cs_new_protected:Npn \__driver_image_getbb_auxvi:nNnn #1#2#3#4 { \hbox_set:Nn \l__image_tmp_box { #2 #1 ~ #4 } - \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } - \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } - \dim_const:cn { c__image_ #1#3 _ht_dim } - { \l__image_ht_dim } - \dim_const:cn { c__image_ #1#3 _wd_dim } - { \l__image_wd_dim } + \dim_set:Nn \l__image_utx_dim { \box_wd:N \l__image_tmp_box } + \dim_set:Nn \l__image_ury_dim { \box_ht:N \l__image_tmp_box } + \dim_const:cn { c__image_ #1#3 _urx_dim } + { \l__image_urx_dim } + \dim_const:cn { c__image_ #1#3 _ury_dim } + { \l__image_ury_dim } + } +\cs_new:Npn \__driver_image_getbb_pagebox:w #1 box {#1} +\cs_new_protected:Npn \__driver_image_include_pdf:n #1 + { + \xetex_pdffile:D "#1" ~ + \int_compare:nNnT \l__image_page_int > 0 + { page~ \int_use:N \l__image_page_int } + \__driver_image_getbb_auxiv:VnNnn \l__image_pagebox_tl } \cs_new_eq:NN \__driver_draw_literal:n \__driver_literal:n \cs_generate_variant:Nn \__driver_draw_literal:n { x } diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty index 29ecea0a4ec..be5cd42c8e2 100644 --- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: l3keys2e.dtx (C) Copyright 2009,2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/29] -\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +\@ifpackagelater{expl3}{2017/07/15} {} {% \PackageError{l3keys2e}{Support package l3kernel too old} @@ -32,7 +32,7 @@ }% \endinput } -\ProvidesExplPackage{l3keys2e}{2017/05/29}{} +\ProvidesExplPackage{l3keys2e}{2017/07/15}{} {LaTeX2e option processing using LaTeX3 keys} \cs_generate_variant:Nn \clist_put_right:Nn { Nv } \cs_generate_variant:Nn \keys_if_exist:nnT { nx } diff --git a/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty index 1dcf5f17d85..99294202e51 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty @@ -19,21 +19,21 @@ %% and all files in that bundle must be distributed together. %% %% File: xfp.dtx (C) Copyright 2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/29] -\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +\@ifpackagelater{expl3}{2017/07/15} {} {% - \PackageError{xfpu}{Support package l3kernel too old} + \PackageError{xfp}{Support package l3kernel too old} {% Please install an up to date version of l3kernel\MessageBreak using your TeX package manager or from CTAN.\MessageBreak \MessageBreak - Loading xfpu will abort!% + Loading xfp will abort!% }% \endinput } \RequirePackage{xparse} -\ProvidesExplPackage{xfp}{2017/05/29}{} +\ProvidesExplPackage{xfp}{2017/07/15}{} {L3 Floating point unit} \NewExpandableDocumentCommand \fpeval { m } { \fp_eval:n {#1} } %% diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty index 96892e13abe..4fae096efc7 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -20,8 +20,8 @@ %% %% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm %% (C) 2011,2012,2014-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/29] -\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +\@ifpackagelater{expl3}{2017/07/15} {} {% \PackageError{xfrac}{Support package l3kernel too old} @@ -34,7 +34,7 @@ \endinput } \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} -\ProvidesExplPackage{xfrac}{2017/05/29}{} +\ProvidesExplPackage{xfrac}{2017/07/15}{} {L3 Experimental split-level fractions} \keys_define:nn { xfrac } { diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index 0616a2d2023..b7ecc485e91 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2008 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2009-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/29] -\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +\@ifpackagelater{expl3}{2017/07/15} {} {% \PackageError{xparse}{Support package l3kernel too old} @@ -36,7 +36,7 @@ }% \endinput } -\ProvidesExplPackage{xparse}{2017/05/29}{} +\ProvidesExplPackage{xparse}{2017/07/15}{} {L3 Experimental document command parser} \tl_const:Nx \c__xparse_no_value_tl { \char_generate:nn { `\- } { 11 } NoValue- } diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index ee436a00226..f20705ea335 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2010 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/29] -\@ifpackagelater{expl3}{2017/05/29} +\RequirePackage{expl3}[2017/07/15] +\@ifpackagelater{expl3}{2017/07/15} {} {% \PackageError{xtemplate}{Support package l3kernel too old} @@ -36,7 +36,7 @@ }% \endinput } -\ProvidesExplPackage{xtemplate}{2017/05/29}{} +\ProvidesExplPackage{xtemplate}{2017/07/15}{} {L3 Experimental prototype document functions} \tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } \tl_const:Nn \c__xtemplate_defaults_root_tl { template~defaults~>~ } |