summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-07-31 18:29:08 +0000
committerKarl Berry <karl@freefriends.org>2011-07-31 18:29:08 +0000
commit332d583e34cb464fadc271aac86368fc71af2c40 (patch)
tree24afad6e2f2915364873082b6bfad0bad04ba5bf /Master/texmf-dist/source
parented6913bb5d71e9779f8714d469d5903b9d328020 (diff)
rm expl3, now l3kernel
git-svn-id: svn://tug.org/texlive/trunk@23285 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/expl3/expl3.dtx1013
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3alloc.dtx265
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3basics.dtx3189
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3box.dtx1036
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3calc.dtx1165
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3candidates.dtx531
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3chk.dtx387
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3clist.dtx1135
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3doc.dtx2104
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3expan.dtx1264
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3file.dtx418
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3final.dtx267
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3font.dtx264
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3fp.dtx5893
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3int.dtx2453
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3io.dtx927
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3keys.dtx1656
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3keyval.dtx831
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3luatex.dtx463
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3msg.dtx1402
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3names.dtx1523
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3num.dtx505
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3precom.dtx435
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3prg.dtx1965
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3prop.dtx865
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3quark.dtx441
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3seq.dtx1391
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3skip.dtx1347
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3tl.dtx2142
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3token.dtx1884
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3toks.dtx807
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3vers.dtx96
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3xref.dtx377
33 files changed, 0 insertions, 40441 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/expl3.dtx b/Master/texmf-dist/source/latex/expl3/expl3.dtx
deleted file mode 100644
index 0ff399f6404..00000000000
--- a/Master/texmf-dist/source/latex/expl3/expl3.dtx
+++ /dev/null
@@ -1,1013 +0,0 @@
-% \iffalse
-%% File: expl3.dtx Copyright (C) 1990-2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: expl3.dtx 2222 2011-04-09 12:47:12Z will $
- {L3 Experimental code bundle wrapper}%
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{expl3.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \providecommand\acro[1]{\textsc{\MakeLowercase{#1}}}
-% \newenvironment{arg-description}{%
-% \begin{itemize}\def\makelabel##1{\hss\llap{\bfseries##1}}}{\end{itemize}}
-%
-% \title{The \textsf{expl3} package and \LaTeX3 programming^^A
-% \thanks{This file has version number \fileversion, last
-% revised \filedate.}}
-% \author{\Team}
-% \date{\filedate}
-%
-% \maketitle
-%
-% \begin{documentation}
-%
-% \begin{abstract}
-%
-% This document gives an introduction to a new set of programming
-% conventions that have been designed to meet the requirements of
-% implementing large scale \TeX\ macro programming projects such as
-% \LaTeX. These programming conventions are the base layer of \LaTeX3.
-%
-% The main features of the system described are:
-% \begin{itemize}
-% \item classification of the macros (or, in \LaTeX\ terminology,
-% commands) into \LaTeX\ functions and \LaTeX\ parameters, and also
-% into modules containing related commands;
-% \item a systematic naming scheme based on these classifications;
-% \item a simple mechanism for controlling the expansion of a function's
-% arguments.
-% \end{itemize}
-% This system is being used as the basis for \TeX\ programming within
-% the \LaTeX3 project. Note that the language is not intended for either
-% document mark-up or style specification. Instead, it is intended that
-% such features will be built on top of the conventions described here.
-%
-% This document is an introduction to the ideas behind the \pkg{expl3}
-% programming interface. For the complete documentation of the programming
-% layer provided by the \LaTeX3 Project, see the accompanying \texttt{source3}
-% document.
-%
-% \end{abstract}
-%
-% \section{Introduction}
-%
-% The first step to develop a \LaTeX\ kernel beyond \LaTeXe\ is to
-% address how the underlying system is programmed. Rather than the
-% current mix of \LaTeX\ and \TeX\ macros, the \LaTeX3 system provides
-% its own consistent interface to all of the functions needed to
-% control \TeX. A key part of this work is to ensure that everything
-% is documented, so that \LaTeX\ programmers and users can work
-% efficiently without needing to be familiar with the internal nature
-% of the kernel or with plain \TeX.
-%
-% 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
-% the syntax of the new language.
-%
-% The next section shows where this language fits into a complete
-% \TeX-based document processing system. We then describe the major
-% features of the syntactic structure of command names, including the
-% argument specification syntax used in function names.
-%
-% The practical ideas behind this argument syntax will be explained,
-% together with the expansion control mechanism and the interface
-% used to define variant forms of functions.
-%
-% As we shall demonstrate, the use of a structured naming scheme and of
-% variant forms for functions greatly improves the readability of the
-% code and hence also its reliability. Moreover, experience has shown
-% that the longer command names which result from the new syntax do not
-% make the process of \emph{writing} code significantly harder.
-%
-% \section{Languages and interfaces}
-%
-% It is possible to identify several distinct languages related to the
-% various interfaces that are needed in a \TeX-based document processing
-% system. This section looks at those we consider most important for
-% the \LaTeX3 system.
-%
-% \begin{description}
-% \item[Document mark-up] This comprises those commands (often called
-% tags) that are to embedded in the document (the |.tex| file).
-%
-% It is generally accepted that such mark-up should be essentially
-% \emph{declarative}. It may be traditional \TeX-based mark-up such
-% as \LaTeXe, as described in~\cite{A-W:LLa94} and~\cite{A-W:GMS94},
-% or a mark-up language defined via \acro{HTML} or \acro{XML}.
-%
-% One problem with more traditional \TeX\ coding conventions (as
-% described in~\cite{A-W:K-TB}) is that the names and syntax of \TeX's
-% primitive formatting commands are ingeniously designed to be
-% `natural' when used directly by the author as document mark-up or in
-% macros. Ironically, the ubiquity (and widely recognised
-% superiority) of logical mark-up has meant that such explicit
-% formatting commands are almost never needed in documents or in
-% author-defined macros. Thus they are used almost exclusively by
-% \TeX\ programmers to define higher-level commands, and their
-% idiosyncratic syntax is not at all popular with this community.
-% Moreover, many of them have names that could be very useful as
-% document mark-up tags were they not pre-empted as primitives
-% (e.g.~\cs{box} or \cs{special}).
-%
-% \item[Designer interface] This relates a (human) typographic
-% designer's specification for a document to a program that `formats
-% the document'. It should ideally use a declarative language that
-% facilitates expression of the relationship and spacing rules
-% specified for the layout of the various document elements.
-%
-% This language is not embedded in document text and it will be very
-% different in form to the document mark-up language. For \LaTeX,
-% this level was almost completely missing from \LaTeX2.09; \LaTeXe\
-% made some improvements in this area but it is still the case that
-% implementing a design specification in \LaTeX\ requires far more
-% `low-level' coding than is acceptable.
-%
-% \item[Programmer interface]
-% This language is the implementation language within which the
-% basic typesetting functionality is implemented, building upon the
-% primitives of \TeX\ (or a successor program). It may also be used
-% to implement the previous two languages `within' \TeX, as in the
-% current \LaTeX\ system.
-%
-% \end{description}
-%
-% The last layer is covered by the conventions described in this
-% doucment, which describes a system aimed at providing a suitable
-% basis for coding \LaTeX3. Its main distinguishing features are
-% summarised here:
-%\begin{itemize}
-% \item A consistent naming scheme for all commands, including \TeX\
-% primitives.
-% \item The classification of commands as \LaTeX\ functions or \LaTeX\
-% parameters, and also their division into modules according to their
-% functionality.
-% \item A simple mechanism for controlling argument expansion.
-% \item Provision of a set of core \LaTeX\ functions that is sufficient
-% for handling programming constructs such as queues, sets, stacks,
-% property lists.
-% \item A \TeX\ programming environment in which, for example, all
-% white space is ignored.
-% \end{itemize}
-%
-% \section{The naming scheme}
-%
-% \LaTeX3 does not use \texttt{@} as a `letter' for defining
-% internal macros. Instead, the symbols \texttt{_} and \texttt{:}
-% are used in internal macro names to provide structure. In
-% contrast to the plain \TeX\ format and the \LaTeXe\ kernel, these
-% extra letters are used only between parts of a macro name (no
-% strange vowel replacement).
-%
-% While \TeX\ is actually a macro processor, by
-% convention for the \pkg{expl3} programming language we distinguish between
-% \emph{functions} and \emph{variables}. Functions can have arguments and they
-% are either expanded or executed. Variables can be assigned values and they
-% are used in arguments to functions; they are not used directly but are
-% manipulated by functions (including getting and setting functions).
-% Functions and variables with a related functionality (for example accessing
-% counters, or manipulating token lists, etc.)\ are collected together into a
-% \emph{module}.
-%
-%\subsection{Examples}
-%
-% Before giving the details of the naming scheme, here are a few typical
-% examples to indicate the flavour of the scheme; first some variable
-% names.
-%\begin{quote}
-% \cs{l_tmpa_box} is a local variable (hence the~|l_| prefix)
-% corresponding to a box register.\\
-% \cs{g_tmpa_int} is a global variable (hence the~|g_| prefix)
-% corresponding to an integer register (i.e.~a \TeX\ count
-% register).\\
-% \cs{c_empty_toks} is the constant~(|c_|) token register variable
-% that is always empty.
-%\end{quote}
-%
-% Now here is an example of a typical function name.
-%
-% \cs{seq_push:Nn} is the function which puts the token list specified
-% by its second argument onto the stack specified by its first argument.
-% The different natures of the two arguments are indicated by the~|:Nn|
-% suffix. The first argument must be a single token which `names'
-% the stack parameter: such single-token arguments are denoted~|N|.
-% The second argument is a normal \TeX\ `undelimited argument', which
-% may either be a single token or a balanced, brace-delimited token
-% list (which we shall here call a \textit{braced token list}): the~|n|
-% denotes such a `normal' argument form. The name of the function
-% indicates it belongs to the |seq| module.
-%
-% \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:
-%\begin{quote}
-% |\|\m{module}|_|\m{description}|:|\m{arg-spec}
-%\end{quote}
-% while a variable will have (up to) four distinct parts to its name:
-%\begin{quote}
-% |\|\m{scope}|_|\m{module}|_|\m{description}|_|\m{type}
-%\end{quote}
-%
-% The syntax of all names contains
-% \begin{quote}
-% \m{module} and \m{description}
-% \end{quote}
-% these both give information about the command.
-%
-% A \emph{module} is a collection of closely related functions and
-% variables. Typical module names include~|int| for integer parameters
-% and related functions,~|seq| for sequences and~|box| for boxes.
-%
-% Packages providing new programming functionality will add new modules
-% 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}.
-%
-% The \emph{description} gives more detailed information about the
-% function or parameter, and provides a unique name for it. It should
-% consist of letters and, possibly,~|_|~characters. In general, the
-% description should use |_| to divide up `words' or other easy to
-% follow parts of the name. For example, the \LaTeX3 kernel provides
-% \cs{if_cs_exist:N} which, as might be expected, tests if a command
-% name exists.
-%
-% As a semi-formalized concept the letter |g| is sometimes used to
-% prefix certain parts of the \m{description}
-% to mark the function as `globally acting', e.g., \cs{int_set:Nn} is
-% a local operation while \cs{int_gset:Nn} is a global operation. This
-% of course goes hand in hand with when to use \cs{l_} and \cs{g_}
-% variable prefixes.
-%
-%\subsubsection{Variables: scope and type}
-%
-% The \m{scope} part of the name describes how the variable can be
-% accessed. Variables are classified as local, global or constant.
-% This \emph{scope} type appears as a code at the beginning of the name;
-% the codes used are:
-%\begin{arg-description}
-% \item[c] constants (global variables whose value should not be
-% changed);
-% \item[g] variables whose value should only be set globally;
-% \item[l] variables whose value should only be set locally.
-%\end{arg-description}
-%
-% Separate functions are provided to assign data to local and global
-% variables; for example, "\tl_set:Nn" and "\tl_gset:Nn" respectively
-% set the value of a local or global `token list' variable.
-% Note that it is a poor \TeX\ practise to intermix local and global
-% assignments to a variable; otherwise you risk exhausting the save stack.
-% \unskip\footnote{See the \TeX book, p.\,301, for further information.}
-%
-% The \m{type} will be 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
-% primitive \TeX\ data-types, such as the various registers, but to
-% these will be added data-types built within the \LaTeX\ programming
-% system.
-%
-% The data types in \LaTeX3 are:
-%\begin{description}
-% \item[int] integer-valued count register;
-% \item[tl] `token list variables': placeholders for token lists;
-% \item[toks] token register;
-% \item[box] box register;
-% \item[skip] `rubber' lengths;
-% \item[dim] `rigid' lengths;
-% \item[seq] `sequence': a data-type used to implement lists (with
-% access at both ends) and stacks;
-% \item[prop] property list;
-% \item[clist] comma separated list;
-% \item[stream] an input or output stream (for reading from or writing
-% to, respectively);
-% \item[bool] either true or false (the \LaTeX3 implementation does
-% not use \cs{iftrue} or \cs{iffalse}).
-%\end{description}
-% When the \m{type} and \m{module} are identical (as often happens in
-% the more basic modules) the \m{module} part is often omitted for
-% aesthetic reasons.
-%
-% The name `token list' may cause confusion, and so some background is
-% useful. \TeX\ works with tokens and lists of tokens, rather than
-% characters. It provides two ways to store these token lists: within
-% macros and as token registers (toks). \LaTeX3 retains the name `toks'
-% for the later, and adopts the name `token list variables' (tl vars)
-% for macros used to store tokens.
-%
-%\subsubsection{Variables: guidance}
-%
-% Although \TeX\ provides token registers for certain programming
-% tasks, \LaTeX3 is written so that token list variables can be used
-% for all stored lists of tokens. The \cs{toks_\ldots} functions are
-% therefore for internal use within \LaTeX3 and for supporting
-% \LaTeXe, and should not be needed in new \LaTeX3-based code.
-%
-% Both comma lists and sequences both have similar characteristics.
-% They both use special delimiters to mark out one entry from the
-% next, and are both accessible at both ends. In general, it is
-% easier to create comma lists `by hand' as they can be typed
-% in directly. User input often takes the form of a comma separated
-% list and so there are many cases where this is the obvious
-% data type to use. On the other hand, sequences use special internal
-% tokens to separate entries. This means that they can be used to
-% contain material that comma lists cannot (such as items that may
-% themselves contain commas!). In general, comma lists should be
-% preferred for creating fixed lists inside programs and for
-% handling user input where commas will not occur. On the other
-% hand, sequences should be used to store arbitrary lists of
-% data.
-%
-% \pkg{expl3} implements stacks using the sequence data structure.
-% Thus creating stacks involves first creating a sequence, and
-% then using the sequence functions which work in a stack manner
-% (\cs{seq_push:Nn}, \emph{etc}.).
-%
-% Due to the nature of the underlying \TeX\ implementation, it is
-% possible to assign values to token list variables and comma lists
-% without first declaring them. However, this is \emph{not supported
-% behaviour}. The \LaTeX3 coding convention is that all variables must
-% be declared before use.
-%
-% The expl3 package can be loaded with the "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.
-%
-%\subsubsection{Functions: argument specifications}
-%
-% Function names end with an \m{arg-spec} after a colon. This
-% gives an indication of the types of argument that a function takes,
-% and provides a convenient method of naming similar functions that
-% differ only in their argument forms (see the next section for
-% examples).
-%
-% The \m{arg-spec} consists of a (possibly empty) list of letters,
-% each denoting one argument of the function. The letter, including
-% its case, conveys information about the type of argument required.
-%
-% All functions have a base form with arguments using one of the
-% following argument specifiers:
-%\begin{arg-description}
-% \item[n] Unexpanded token or braced token list.\\
-% This is a standard \TeX\ undelimited macro argument.
-% \item[N] Single token (unlike~|n|, the argument must \emph{not} be
-% surrounded by braces).\\
-% A typical example of a command taking an~|N|
-% argument is~|\cs_set|, in which the command being defined must be
-% unbraced.
-% \item[p] Primitive \TeX\ parameter specification.\\
-% This can be something simple like~|#1#2#3|, but may use arbitrary
-% delimited argument syntax such as: |#1,#2\q_stop#3|. This is used
-% when defining functions.
-% \item[T,F]
-% These are special cases of~|n| arguments, used for the
-% true and false code in conditional commands.
-%\end{arg-description}
-% There are two other specifiers with more general meanings:
-%\begin{arg-description}
-% \item[D] This means: \textbf{Do not use}. This special case is used
-% for \TeX\ primitives and other commands that are provided for use
-% only while bootstrapping the \LaTeX\ kernel. Programmers outside
-% the kernel team should not use these functions!
-% \item[w] This means that the argument syntax is `weird' in that it
-% does not follow any standard rule. It is used for functions with
-% arguments that take non standard forms: examples are \TeX-level
-% delimited arguments and the boolean tests needed after certain
-% primitive |\if|\ldots\ commands.
-%\end{arg-description}
-%
-% In case of "n" arguments that consist of a single token the
-% surrounding braces can be omitted in nearly all
-% situations---functions that force the use of braces even for single
-% token arguments are explicitly mentioned. However, programmers are
-% encouraged to always use braces around \texttt{n} arguments, as this
-% makes the relationship between function and argument clearer.
-%
-% Further argument specifiers are available as part of the expansion
-% control system. These are discussed in the next section.
-%
-%\section{Expansion control}
-%
-% Let's take a look at some typical operations one might want to
-% perform. Suppose we maintain a stack of open files and we use the
-% stack |\g_ior_file_name_seq| to keep track of them (|io| is the
-% file reading and writing module: it uses the module prefixe
-% \texttt{ior} for reading functions and variables). The basic
-% operation here is to push a name onto this stack which could be
-% done by the operation
-% \begin{quote}
-% "\seq_gpush:Nn \g_ior_file_name_seq {#1}"
-% \end{quote}
-% where |#1| is the filename. In other words, this operation would
-% push the file name as is onto the stack.
-%
-% However, we might face a situation where the filename is stored in
-% a variable of some sort, say |\l_ior_curr_file_tl|. In this case we
-% want to retrieve the value of the variable. If we simply use
-% \begin{quote}
-% "\seq_gpush:Nn \g_io_file_name_seq \l_io_curr_file_tl "
-% \end{quote}
-% we will not get the value of the variable pushed onto the stack,
-% only the variable name itself. Instead a suitable number of
-% "\exp_after:wN" would be necessary (together with extra braces) to
-% change the order of expansion,\footnote{\cs{exp_after:wN} is
-% the \LaTeX3 name for the \TeX\ \cs{expandafter} primitive.} i.e.
-% \begin{quote}
-% "\exp_after:wN" \\
-% " \seq_gpush:Nn" \\
-% "\exp_after:wN" \\
-% " \g_io_file_name_seq" \\
-% "\exp_after:wN" \\
-% " { \l_io_curr_file_tl }"
-% \end{quote}
-%
-% The above example is probably the simplest case but already shows
-% how the code changes to something difficult to understand.
-% Furthermore there is an assumption in this: that the storage bin
-% reveals its contents after exactly one expansion. Relying on this
-% means that you cannot do proper checking plus you have to know
-% exactly how a storage bin acts in order to get the correct number
-% of expansions. Therefore \LaTeX3 provides the programmer with a
-% general scheme that keeps the code compact and easy to understand.
-%
-% To denote that some argument to a function needs special treatment one
-% just uses different letters in the arg-spec part of the function to
-% mark the desired behaviour. In the above example one would write
-% \begin{quote}
-% "\seq_gpush:NV \g_io_file_name_seq \l_io_curr_file_tl "
-% \end{quote}
-% to achieve the desired effect. Here the "V" (the second argument)
-% is for `retrieve the value of the variable' before passing it to
-% the base function.
-%
-% The following letters can be used to denote special treatment of
-% arguments before passing it to the base function:
-%\begin{description}
-% \item[c] Character string used as a command name.\\ The argument (a
-% token or braced token list) must, when fully expanded, produce a
-% sequence of characters which is then used to construct a command
-% name (via~|\csname| \ldots |\endcsname|). This command name is the
-% single token that is passed to the function as the argument. Hence
-% \begin{quote}
-% "\seq_gpush:cV { g_file_name_seq } \l_tmpa_tl"
-% \end{quote}
-% is equivalent to
-% \begin{quote}
-% "\seq_gpush:NV \g_file_name_seq \l_tmpa_tl".
-% \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
-% converted to their content. So the preceding examples are also
-% equivalent to
-% \begin{quote}
-% "\tl_new:N \g_file_seq_name_tl" \\
-% "\tl_gset:Nn \g_file_seq_name_tl { g_file_name_seq }" \\
-% "\seq_gpush:cV { \g_file_seq_name_tl } \l_tmpa_tl".
-% \end{quote}
-% (Token list variables are expandable and do not require an
-% accessor function. Other variable types require the appropriate
-% \cs{<var>_use:N} functions to be used in this context.)
-% \item[V] Value of a variable.\\
-% This means that the contents of the register in question is used as the
-% argument, be it an integer, a length-type register, a token list variable
-% or similar. The value is passed to the function as a braced token list.
-% \item[v] Value of a register, constructed from a character string
-% used as a command name.\\
-% This is a combination of |c| and |V| which first constructs a
-% control sequence from the argument and then passes the value of the
-% resulting register to the function.
-% \item[x] Fully-expanded token or braced token list.\\
-% This means that the argument is expanded as in the replacement
-% text of an~|\edef|, and the expansion is passed to the function as
-% a braced token list. This means that expansion takes place until
-% only unexpandable tokens are left.
-% \item[o] One-level-expanded token or braced token list.\\
-% This means that the argument is expanded one level, as by
-% \cs{expandafter}, and the expansion is passed to the function as a
-% braced token list. Note that if the original argument is a braced
-% token list then only the first token in that list is expanded.
-% In general, using \texttt{V} should be preferred to using
-% \texttt{o} for simple variable retrival.
-% \item[f] 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
-% expand the next argument.
-%\end{description}
-%
-% \subsection{Simpler means better}
-%
-% Anyone who programs in \TeX\ is frustratingly familiar with the
-% problem of arranging that arguments to functions are suitably expanded
-% before the function is called. To illustrate how expansion control
-% can bring instant relief to this problem we shall consider two
-% examples copied from \texttt{latex.ltx}.
-%
-% \begin{verbatim}
-% \global\expandafter\let
-% \csname\cf@encoding \string#1\expandafter\endcsname
-% \csname ?\string#1\endcsname
-% \end{verbatim}
-% This first piece of code is in essence simply a global |\let| whose
-% two arguments firstly have to be constructed before |\let| is
-% executed. The |#1| is a control sequence name such as
-% |\textcurrency|. The token to be defined is obtained by
-% concatenating the characters of the current font encoding stored in
-% |\cf@encoding|, which has to be fully expanded, and the name of the
-% symbol. The second token is the same except it uses the default
-% encoding |?|. The result is a mess of interwoven |\expandafter|
-% and |\csname| beloved of all \TeX\ programmers, and the code is
-% essentially unreadable.
-%
-% Using the conventions and functionality outlined here, the task would
-% be achieved with code such as this:
-% \begin{verbatim}
-% \cs_gset_eq:cc
-% { \cf@encoding \token_to_str:N #1 } { ? \token_to_str:N #1 }
-% \end{verbatim}
-% The command |\cs_gset_eq:cc| is a global~|\let| that generates
-% command names out of both of its arguments before making the
-% definition. This produces code that is far more readable and more
-% likely to be correct first time. (\cs{token_to_str:N} is the \LaTeX3
-% name for \cs{string}.)
-%
-% Here is the second example.
-% \begin{verbatim}
-% \expandafter
-% \in@
-% \csname sym#3%
-% \expandafter
-% \endcsname
-% \expandafter
-% {%
-% \group@list}%
-% \end{verbatim}
-% This piece of code is part of the definition of another function. It
-% first produces two things: a token list, by expanding |\group@list| once;
-% and a token whose name comes from~`|sym#3|'. Then the function~|\in@|
-% is called and this tests if its first argument occurs in the token list
-% of its second argument.
-%
-% Again we can improve enormously on the code. First we shall rename
-% the function~|\in@| according to our conventions. A function such as
-% this but taking two normal `\texttt{n}' arguments might reasonably be
-% named |\seq_test_in:Nn|; thus the variant function we need will be
-% defined with the appropriate argument types and its name will be
-% |\seq_test_in:cV|. Now this code fragment will be simply:
-% \begin{verbatim}
-% \seq_test_in:cV { sym #3 } \l_group_seq
-% \end{verbatim}
-% Note that, in addition to the lack of |\expandafter|, the space after
-% the~|}| will be 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
-% with a range of argument forms, and similarly it is expected that
-% extension packages providing new functions will make them available in
-% the all the commonly needed forms.
-%
-% However, there will be occasions where it is necessary to construct a
-% new such variant form; therefore the expansion module provides a
-% straightforward mechanism for the creation of functions with any
-% required argument type, starting from a function that takes `normal'
-% \TeX\ undelimited arguments.
-%
-% To illustrate this let us suppose you have a `base function'
-% |\demo_cmd:Nnn| that takes three normal arguments, and that you need
-% to construct the variant |\demo_cmd:cnx|, for which the first argument
-% is used to construct the \emph{name} of a command, whilst the third
-% argument must be fully expanded before being passed to
-% |\demo_cmd:Nnn|.
-% To produce the variant form from the base form, simply use this:
-% \begin{verbatim}
-% \cs_generate_variant:Nn \demo_cmd:Nnn { cnx }
-% \end{verbatim}
-% This defines the variant form so that you can then write, for example:
-% \begin{verbatim}
-% \demo_cmd:cnx { abc } { pq } { \rst \xyz }
-% \end{verbatim}
-% rather than \ldots\ well, something like this!
-% \begin{verbatim}
-% \def \tempa {{pq}}%
-% \edef \tempb {\rst \xyz}%
-% \expandafter
-% \demo@cmd:nnn
-% \csname abc%
-% \expandafter
-% \expandafter
-% \expandafter
-% \endcsname
-% \expandafter
-% \tempa
-% \expandafter
-% {%
-% \tempb
-% }%
-% \end{verbatim}
-%
-% Another example: you may wish to declare a function
-% |\demo_cmd_b:xcxcx|, a variant of an existing function
-% |\demo_cmd_b:nnnnn|, that fully
-% expands arguments 1,~3 and~5, and produces commands to pass as
-% arguments 2 and~4 using~|\csname|.
-% The definition you need is simply
-% \begin{verbatim}
-% \cs_generate_variant:Nn \demo_cmd_b:nnnnn { xcxcx }
-% \end{verbatim}
-%
-% 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.
-%
-%\section{The distribution}
-%
-% At present, the \pkg{expl3} modules are designed to be loaded on top
-% of \LaTeXe. In time, a \LaTeX3 format will be produced based on this
-% code. This allows the code to be used in \LaTeXe\ packages \emph{now}
-% while a stand-alone \LaTeX3 is developed.
-%
-%\begin{bfseries}
-% While \pkg{expl3} is still experimental, the bundle is now regarded
-% as broadly stable. The syntax conventions and functions provided
-% are now ready for wider use. There may still be changes to some
-% functions, but these will be minor when compared to the scope of
-% \pkg{expl3}.
-%\end{bfseries}
-%
-% New modules will be added to the distributed version of \pkg{expl3}
-% as they reach maturity. At present, the \pkg{expl3} bundle consists
-% of a number of modules, most of which are loaded by including the
-% line:
-%\begin{verbatim}
-% \RequirePackage{expl3}
-%\end{verbatim}
-% in a \LaTeXe\ package, class or other file. The \pkg{expl3} modules
-% regarded as stable, and therefore suitable for basing real code on,
-% are as follows:
-%
-%\begin{description}
-% \providecommand\explpkg[2]{\item[#1]#2}
-% \explpkg{l3basics}{
-% This contains the basic definition modules used
-% by the other packages.
-% }
-% \explpkg{l3box}{
-% Primitives for dealing with boxes.
-% }
-% \explpkg{l3calc}{
-% A re-implementation of the \LaTeXe\ package \pkg{calc} package in
-% \pkg{expl3} that provides extended methods for numeric and dimensional
-% calculations and assignments.
-% }
-% \explpkg{l3clist}{
-% Methods for manipulating comma-separated token lists.
-% }
-% \explpkg{l3expan}{
-% This is the argument expansion module discussed earlier in this
-% document.
-% }
-% \explpkg{l3int}{
-% This implements the integer data-type \texttt{int}.
-% }
-% \explpkg{l3intexpr}{
-% For carring out integer expression calculations and comparisons,
-% whether the input is stored in \texttt{int}, \texttt{tl} or
-% other variable types, or is given literally.
-% }
-% \explpkg{l3io}{
-% A module providing low level input and output functions.
-% }
-% \explpkg{l3keyval}{
-% Low-level implementation for processing lists of the form
-% \texttt{\{ key1=val1 , key2=val2 \}}.
-% }
-% \explpkg{l3keys}{
-% Higher-level implementation of key--value methods: intended to work
-% as a \LaTeX3 version of \pkg{xkeyval}/\pkg{kvoptions}, although
-% with input syntax more like that of \pkg{pgfkeys}.
-% }
-% \explpkg{l3msg}{
-% Communicating with the user: includes low-level hooks to allow
-% messages to be filtered (higher-level interface for filtering
-% to be written!).
-% }
-% \explpkg{l3names}{
-% This sets up the basic naming scheme and renames all
-% the \TeX\ primitives.
-% }
-% \explpkg{l3prg}{
-% Program control structures such as boolean data type |bool|, generic
-% do-while loops, case-switches, sorting routines and stepwise loops.
-% }
-% \explpkg{l3prop}{
-% This implements the data-type for `property lists' that are used, in
-% particular, for storing key/value pairs.
-% }
-% \explpkg{l3quark}{
-% A `quark' is a command that is defined to expand to
-% itself! Therefore they must never be expanded as this will generate
-% infinite recursion; they do however have many uses, e.g.~as
-% special markers and delimiters within code.
-% }
-% \explpkg{l3seq}{
-% This implements data-types such as queues and stacks.
-% }
-% \explpkg{l3skip}{
-% Implements the `rubber length' datatype \texttt{skip} and the
-% `rigid length' datatype |dim|.
-% }
-% \explpkg{l3tl}{
-% This implements a basic data-type, called a \textit{token-list
-% variable} (|tl var.|), used for storing named token lists: these are
-% essentially \TeX{} macros with no arguments.
-% }
-% \explpkg{l3token}{
-% Analysing token lists and token streams, including peeking ahead to
-% see what's coming next and inspecting tokens to detect which kind
-% they are.
-% }
-% \explpkg{l3toks}{
-% A data-type corresponding to \TeX's primitive token registers.
-% }
-%\end{description}
-%
-%\section{Moving from \LaTeXe\ to \LaTeX3}
-%
-% To help programmers to use \LaTeX3 code in existing \LaTeXe\ package,
-% some short notes on making the change are probably desirable.
-% Suggestions for inclusion here are welcome! Some of the following
-% is concerned with code, and some with coding style.
-%
-%\begin{itemize}
-% \item \pkg{expl3} is mainly focussed on programming. This means that
-% some areas still require the use of \LaTeXe\ internal macros.
-% For example, you may well need \cs{@ifpackageloaded}, as there
-% is currently no native \LaTeX3 package loading module.
-% \item User level macros should be generated using the mechansim
-% availble in the \pkg{xparse} package, which is available from CTAN
-% or the \LaTeX3 SVN repository.
-% \item At an internal level, most functions should be generated
-% \cs{long} (using \cs{cs_new:Npn}) rather than `short' (using
-% \cs{cs_new_nopar:Npn}). The exceptions are:
-% \begin{itemize}
-% \item Functions which take no arguments;
-% \item Functions which are used with pre-set arguments which
-% therefore cannot be \cs{long}: this is mainly the case with
-% auxiliary functions.
-% \end{itemize}
-% \item Where possible, declare all variables and functions (using
-% \cs{cs_new:Npn}, \cs{tl_new:N}, etc.) before use.
-% \item Prefer `higher-level' functions over `lower-level', where
-% possible. So for example use \cs{cs_if_exist:N(TF)} over
-% \cs{if_cs_exist:N}.
-% \item Use space to make code readable. In general, we recommend
-% a layout such as:
-% \begin{verbatim}
-% \cs_new:Npn \foo_bar:Nn #1#2 {
-% \cs_if_exist:NTF #1 {
-% \foo_bar_aux_i:n {#2}
-% }{
-% \foo_bar_aux_ii:nn {#2} { literal }
-% }
-% }
-% \end{verbatim}
-% where spaces are used around |{| and |}| except for isolated
-% |#1|, |#2|, etc.
-% \item Put different code items on separate lines: readablity is
-% much more useful than compactness.
-% \item Use long, descriptive names for functions and variables,
-% and for auxilliary functions use the parent function name plus
-% |aux|, |aux_i|, |aux_ii| and so on.
-% \item If in doubt, ask the team via the LaTeX-L list: someone will
-% soon get back to you!
-%\end{itemize}
-%
-% \begin{thebibliography}{1}
-%
-% \bibitem{A-W:K-TB}
-% Donald E Knuth
-% \newblock {\em The {\TeX}book}.
-% \newblock Addison-Wesley, Reading, Massachusetts, 1984.
-%
-% \bibitem{A-W:GMS94}
-% Goossens, Mittelbach and Samarin.
-% \newblock {\em The {\LaTeX} Companion}.
-% \newblock Addison-Wesley, Reading, Massachusetts, 1994.
-%
-% \bibitem{A-W:LLa94}
-% Leslie Lamport.
-% \newblock {\em {\LaTeX:} A Document Preparation System}.
-% \newblock Addison-Wesley, Reading, Massachusetts, second edition, 1994.
-%
-% \bibitem{tub:MR97-1}
-% Frank Mittelbach and Chris Rowley.
-% \newblock `The {\LaTeX3} Project'.
-% \newblock {\em {TUG}boat},
-% Vol.\,18, No.\,3, pp.\,195--198, 1997.
-%
-% \end{thebibliography}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \subsection{\pkg{expl3} implementation}
-%
-% Well, it's not complicated |:)|
-%
-%<*package>
-% \begin{macrocode}
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-% \end{macrocode}
-%
-% Load \pkg{etex} as otherwise we are likely to get into trouble
-% with registers. Some inserts are reserved also as these have to
-% be from the standard pool.
-% \begin{macrocode}
-\RequirePackage{etex}
-\reserveinserts{32}
-% \end{macrocode}
-%
-%\begin{macro}{\@l@expl@check@declarations@bool}
-%\begin{macro}{\@l@expl@log@functions@bool}
-% A couple of package options to be provided.
-% These have to be done by hand as there is no expl3 yet.
-% \begin{macrocode}
-\newcommand*\@l@expl@check@declarations@bool{0}
-\newcommand*\@l@expl@log@functions@bool{0}
-\DeclareOption{check-declarations}{
- \def\@l@expl@check@declarations@bool{1}
-}
-\DeclareOption{log-functions}{
- \def\@l@expl@log@functions@bool{1}
-}
-\ProcessOptions\relax
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-% We already loaded \pkg{l3names} at the beginning of the \texttt{dtx} file.
-%
-% The \pkg{l3chk} package is omitted since it is only used for conditional
-% processing with full error-checking turned on. Most users will generally
-% not need to do this, and we haven't set it up yet, anyway.
-%
-% Fundamentals:
-% \begin{macrocode}
-\RequirePackage{
- l3basics,
- l3expan,
- l3tl,
- l3int,
- l3quark,
- l3seq,
- l3toks,
- l3prg,
- l3clist,
- l3token,
- l3prop,
- l3msg,
- l3io,
- l3skip
-}
-% \end{macrocode}
-% All the rest:
-% \begin{macrocode}
-\RequirePackage{
- l3box,
- l3keyval,
- l3keys,
- l3precom,
-% l3calc,
- l3xref,
- l3file,
- l3fp,
- l3luatex,
-% l3font
-}
-\RequirePackage{calc}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\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: \\
- \c_space_tl \c_space_tl \tl_set:Nn #1 ~
- \iow_char:N \{ ~ ... ~ \iow_char:N \} \\
- without~first~having: \\
- \c_space_tl \c_space_tl \tl_new:N #1 \\
- \\
- LaTeX~will~create~the~variable~and~continue.
- }
-}
-% \end{macrocode}
-%
-%\begin{macro}{\_tl_check_exists:N}
-% When used as a package, there is an option to be picky and to
-% check definitions exist.
-% These redefinitions are delayed until here so that all the necessary
-% definitions are in place.
-% \begin{macrocode}
-\tex_ifodd:D \@l@expl@check@declarations@bool \scan_stop:
- \cs_set_protected:Npn \_tl_check_exists:N #1
- {
- \cs_if_exist:NF #1
- {
- \msg_kernel_error:nnx { check } { non-declared-variable }
- { \token_to_str:N #1 }
- }
- }
- \cs_set_protected:Npn \tl_set:Nn #1#2
- {
- \_tl_check_exists:N #1
- \cs_set_nopar:Npx #1 { \exp_not:n {#2} }
- }
- \cs_set_protected:Npn \tl_set:Nx #1#2
- {
- \_tl_check_exists:N #1
- \cs_set_nopar:Npx #1 {#2}
- }
- \cs_set_protected:Npn \tl_gset:Nn #1#2
- {
- \_tl_check_exists:N #1
- \cs_gset_nopar:Npx #1 { \exp_not:n {#2} }
- }
- \cs_set_protected:Npn \tl_gset:Nx #1#2
- {
- \_tl_check_exists:N #1
- \cs_gset_nopar:Npx #1 {#2}
- }
- \cs_set_protected:Npn \tl_set_eq:NN #1#2
- {
- \_tl_check_exists:N #1
- \_tl_check_exists:N #2
- \cs_set_eq:NN #1 #2
- }
- \cs_set_protected:Npn \tl_gset_eq:NN #1#2
- {
- \_tl_check_exists:N #1
- \_tl_check_exists:N #2
- \cs_gset_eq:NN #1 #2
- }
-\tex_fi:D
-%</package>
-% \end{macrocode}
-%\end{macro}
-%
-% \end{implementation}
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3alloc.dtx b/Master/texmf-dist/source/latex/expl3/l3alloc.dtx
deleted file mode 100644
index c095e913a82..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3alloc.dtx
+++ /dev/null
@@ -1,265 +0,0 @@
-% \iffalse
-%% File: l3alloc.dtx Copyright (C) 1990-2006,2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver>
-\RequirePackage{l3names}
-%</driver>
-%\fi
-\GetIdInfo$Id: l3alloc.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental register allocation}%
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3alloc} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Allocating registers and the like}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \section{Allocating registers and the like}
-%
-% Note that this module is only used for generating an pkg{expl3}-based
-% format. Under \LaTeXe, the |etex.sty| package is used for allocation
-% management.
-%
-% This module provides the basic mechanism for allocating \TeX's
-% registers. While designing this we have to take into account the
-% following characteristics:
-% \begin{itemize}
-% \item |\box255| is reserved for use in the output routine, so it
-% should not be allocated otherwise.
-% \item \TeX\ can load up 256 hyphenation patterns (registers
-% |\tex_language:D| 0-255),
-% \item \TeX\ can load no more than 16 math families,
-% \item \TeX\ supports no more than 16 io-streams for reading
-% (|\tex_read:D|) and 16 io-streams for writing (|\tex_write:D|),
-% \item \TeX\ supports no more than 256 inserts, Omega supports more.
-% \item The other registers (|\tex_count:D|, |\tex_dimen:D|,
-% |\tex_skip:D|, |\tex_muskip:D|, |\tex_box:D|, and |\tex_toks:D|
-% range from 0 to 32768, but registers numbered above 255 are
-% accessed somewhat less efficiently.
-% \item Registers could be allocated both globally and locally; the
-% use of registers could also be globaly or locally. Here we
-% provide support for globally allocated registers for both
-% gloabl and local use and for locally allocated registers for
-% local use only.
-% \end{itemize}
-% We also need to allow for some bookkeeping: we need to know which
-% register was allocated last and which registers can not be
-% allocated by the standard mechanisms.
-%
-% \section{Functions}
-%
-%
-% \begin{function}{\alloc_new:nnnN}
-% \begin{syntax}
-% "\alloc_new:nnnN" \Arg{type} \Arg{min} \Arg{max} <alloc_cmd>
-% \end{syntax}
-% Shorthand for allocating new registers. Defines \cs{<type>_new:N} and
-% \cs{<type>_new_local:N} allocators of the specified <type>, indexed up from
-% <min> for global registers and down from <max> for local registers, with
-% registers assigned using the function <alloc_cmd>.
-%
-% Internally uses "\alloc_setup_type:nnn" and "\alloc_reg:NnNN"
-% defined below in case you want finer-grained control.
-% \end{function}
-%
-%
-% \begin{function}{\alloc_setup_type:nnn}
-% \begin{syntax}
-% "\alloc_setup_type:nnn" \Arg{type} \Arg{g_start_num} \Arg{l_start_num}
-% \end{syntax}
-% Sets up the storage needed for the administration of registers of
-% type <type>.\\
-% <type> should be a token list in braces, it can be one of
-% "int", "dimen", "skip", "muskip", "box", "toks", "ior", "iow",
-% "pattern", or "ins".\\
-% <g_start_num> is the number of the first non-allocated global
-% register, it will be incremented by 1 when the allocation is done.
-% <l_start_num> is the number of the first non-allocated local
-% register, it will be decremented by 1 when the allocation is done.
-% \end{function}
-%
-% \begin{function}{\alloc_reg:NnNN}
-% \begin{syntax}
-% "\alloc_reg:NnNN" "g"$\big/$"l" <type> <alloc_cmd> <cs>
-% \end{syntax}
-% Performs the allocation of a register of type <type> to control
-% sequence <cs>, using the command <alloc_cmd>. The "g" or "l"
-% indicates whether the allocation should be global or local.
-% This macro is the basic building block for the definition of the
-% "\"<type>"_new:N" commands
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3alloc} implementation}
-%
-% \subsection{Internal functions}
-%
-% \begin{function}{ \alloc_next:Nn }
-% \begin{syntax}
-% "\alloc_next:Nn" "l"/"g" \Arg{type}
-% \end{syntax}
-% These functions find the next free register for the specified type.
-% \end{function}
-%
-% \subsection{Module code}
-%
-% \begin{macrocode}
-%<*initex>
-% \end{macrocode}
-%
-% \begin{macro}{\alloc_setup_type:nnn}
-% For each type of register we need to `counters' that hold the
-% last allocated global or local register. We also need a sequence
-% to store the `exceptions'.
-% \begin{macrocode}
-\cs_new_nopar:Npn \alloc_setup_type:nnn #1#2#3 {
- \seq_new:c {g_#1_allocation_seq}
- \tl_new:cn {g_#1_allocation_tl } {#2}
- \tl_new:cn {l_#1_allocation_tl } {#3}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\alloc_next:Nn}
-% This routine finds the next free register. For globally allocated
-% registers we first increment the counter that keeps track of them;
-% for local registers, decrement.
-% \begin{macrocode}
-\cs_new_nopar:Npn \alloc_next:Nn #1#2 {
- \tl_set:cx {#1_#2_allocation_tl}
- {
- \int_eval:n
- {
- \tl_use:c {#1_#2_allocation_tl}
- \if:w #1 g + \else: - \fi: 1
- }
- }
-% \end{macrocode}
-% Then we need to check whether we have run out of registers.
-% \begin{macrocode}
- \tex_ifnum:D \etex_numexpr:D
- \tl_use:c{g_#2_allocation_tl} \tex_relax:D = \etex_numexpr:D \tl_use:c{l_#2_allocation_tl} \tex_relax:D
- \iow_term:x {
- We~ ran~ out~ of~
- \if:w #1 g \scan_stop: global~ \else: local~ \fi:
- 'l#2!'~ registers!
- }
- \tex_else:D
-% \end{macrocode}
-% We also need to check whether the value of the counter already
-% occurs in the list of already allocated registers.
-% \begin{macrocode}
- \seq_if_in:cxTF {g_#2_allocation_seq} {\tl_use:c{#1_#2_allocation_tl}}
- {
- \iow_log:x{ \tl_use:c{#1_#2_allocation_tl}~already~allocated. }
- \alloc_next:Nn #1 {#2}
- }
-% \end{macrocode}
-% By now the |.._allocation_tl| counter will contain the number of
-% the register we will assign a control sequence for.
-% \begin{macrocode}
- { \iow_log:x{\tl_use:c{#1_#2_allocation_tl}~free.} }
- \tex_fi:D
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\alloc_reg:NnNN}
-% This internal macro performs the actual allocation. Its first
-% argument is either `|g|' for a globally allocated register or `|l|'
-% for a locally allocated register. The second argument is the
-% type of register to allocate, the third argument is the command
-% to use and the fourth argument is the control sequence that is to
-% be defined to point to the register.
-% \begin{macrocode}
-\cs_new_nopar:Npn \alloc_reg:NnNN #1#2#3#4 {
- \chk_if_free_cs:N #4
- \if:w #1 g
- \exp_after:wN \pref_global:D
- \fi:
- #3 #4 \tl_use:c{#1_ #2 _allocation_tl}
- %%\cs_record_meaning:N#1
- \iow_log:x{
- \token_to_str:N#4~=~#2~register~\tl_use:c{#1_#2_allocation_tl}
- }
- \alloc_next:Nn #1 {#2}
- }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\alloc_new:nnnN}
-% Shorthand for defining new register types and their allocators:
-% \begin{macrocode}
-\cs_new:Npn \alloc_new:nnnN #1#2#3#4 {
- \alloc_setup_type:nnn {#1} {#2} {#3}
- \cs_new_nopar:cpn {#1_new:N} ##1 {
- \alloc_reg:NnNN g {#1} #4 ##1
- }
- \cs_new_nopar:cpn {#1_new_local:N} ##1 {
- \alloc_reg:NnNN l {#1} #4 ##1
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3basics.dtx b/Master/texmf-dist/source/latex/expl3/l3basics.dtx
deleted file mode 100644
index 527146b66d7..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3basics.dtx
+++ /dev/null
@@ -1,3189 +0,0 @@
-% \iffalse
-%% File: l3basics.dtx Copyright (C) 1990-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3basics.dtx 2246 2011-04-23 08:01:25Z joseph $
- {L3 Experimental basic definitions}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3basics.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3basics} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Basic Definitions}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% As the name suggest this package holds some basic definitions which
-% are needed by most or all other packages in this set.
-%
-% Here we describe those functions that are used all over the place. With
-% that we mean functions dealing with the construction and testing of
-% control sequences. Furthermore the basic parts of conditional
-% processing are covered; conditional processing dealing with specific
-% data types is described in the modules specific for the respective
-% data types.
-%
-% \section{Predicates and conditionals}
-% \label{sec:predicates}
-%
-% \LaTeX3 has three concepts for conditional flow processing:
-% \begin{description}
-%
-% \item[Branching conditionals]
-% Functions that carry out a test and then execute, depending on its
-% result, either the code supplied in the \m{true arg} or the \m{false
-% arg}.
-% These arguments are denoted with "T" and "F" repectively. An
-% example would be
-% \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
-% (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
-% the second argument (true case) or in the third argument (false
-% case).
-%
-% These type of functions are known as `conditionals'; whenever a "TF"
-% function is defined it will usually be 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
-% provide all three versions.
-%
-% Important to note is that these branching conditionals with \m{true
-% code} and/or \m{false code} are always defined in a way that the
-% code of the chosen alternative can operate on following tokens in
-% the input stream.
-%
-% These conditional functions may or may not be fully expandable, but if they
-% are expandable they will be accompanied by a `predicate' for the same test
-% as described below.
-%
-% \item[Predicates]
-% `Predicates' are functions that return a special type of boolean
-% value which can be tested by the function "\if_predicate:w"
-% or in the boolean expression parser. All functions of this type
-% are expandable and have names that end with "_p" in the
-% description part. For example,
-% \begin{quote}
-% "\cs_if_free_p:N"
-% \end{quote}
-% would be a predicate function for the same type of test as the
-% conditional described above. It would return `true' if its argument (a
-% single token denoted by "N") is still free for definition. It would be used
-% in constructions like
-% \begin{quote}
-% "\if_predicate:w \cs_if_free_p:N \l_tmpz_tl" \m{true code} "\else:"
-% \m{false code} "\fi:"
-% \end{quote}
-% or in expressions utilizing the boolean logic parser:
-% \begin{quote}
-% "\bool_if:nTF {" \\
-% " \cs_if_free_p:N \l_tmpz_tl || \cs_if_free_p:N \g_tmpz_tl " \\
-% "}"
-% \Arg{true code} \Arg{false code}
-% \end{quote}
-%
-% Like their branching cousins, predicate functions ensure that all
-% underlying primitive "\else:" or "\fi:" have been removed before
-% returning the boolean true or false values.\footnote{If defined
-% using the interface provided.}
-%
-% For each predicate defined, a `predicate conditional' will also exist that
-% behaves like a conditional described above.
-%
-% \item[Primitive conditionals]
-% There is a third variety of conditional, which is the original concept used in
-% plain \TeX{} and \LaTeX. Their use is discouraged in \pkg{expl3} (although
-% still used in low-level definitions) because they are more fragile and
-% in many cases require more expansion control (hence more code) than the two
-% types of conditionals described above.
-% \end{description}
-%
-%
-% \subsection{Primitive conditionals}
-%
-% 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
-% higher level functions are often available. See for instance
-% |\int_compare_p:nNn| which is a wrapper for |\if_num: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
-% prefix primitive conditionals with |\if_|.
-%
-% \begin{function}{ \if_true: / (EXP) |
-% \if_false: / (EXP) |
-% \or: / (EXP) |
-% \else: / (EXP) |
-% \fi: / (EXP) |
-% \reverse_if:N / (EXP) }
-% \begin{syntax}
-% "\if_true:" <true code> "\else:" <false code> "\fi:" \\
-% "\if_false:" <true code> "\else:" <false code> "\fi:" \\
-% "\reverse_if:N" <primitive conditional>
-% \end{syntax}
-% "\if_true:" always executes <true code>, while "\if_false:" always
-% executes <false code>. "\reverse_if:N" reverses any two-way primitive
-% conditional. "\else:" and "\fi:" delimit the branches of the
-% conditional. "\or:" is used in case switches, see \pkg{l3intexpr}
-% for more.
-% \begin{texnote}
-% These are equivalent to their corresponding \TeX\ primitive
-% conditionals; |\reverse_if:N| is \eTeX's |\unless|.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \if_meaning:w / (EXP) }
-% \begin{syntax}
-% "\if_meaning:w" <arg1> <arg2> <true code> "\else:" <false code> "\fi:"
-% \end{syntax}
-% "\if_meaning:w" executes <true code> when <arg1> and <arg2> are the same,
-% otherwise it executes <false code>.
-% <arg1> and <arg2> could be functions, variables, tokens; in all cases the
-% \emph{unexpanded} definitions are compared.
-% \begin{texnote}
-% This is \TeX's |\ifx|.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \if:w / (EXP) |
-% \if_charcode:w / (EXP) |
-% \if_catcode:w / (EXP) }
-% \begin{syntax}
-% "\if:w" <token1> <token2> <true code> "\else:" <false code> "\fi:" \\
-% "\if_catcode:w" <token1> <token2> <true code> "\else:" <false
-% code> "\fi:"
-% \end{syntax}
-% These conditionals will 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
-% "\if:w" tests if the character codes are
-% identical. "\if_charcode:w" is an alternative name for "\if:w".
-% \end{function}
-%
-%
-% \begin{function}{\if_predicate:w / (EXP)}
-% \begin{syntax}
-% "\if_predicate:w" <predicate> <true code> "\else:" <false code> "\fi:"
-% \end{syntax}
-% This function takes a predicate function and
-% branches according to the result. (In practice this function would also
-% accept a single boolean variable in place of the <predicate> but to make the
-% coding clearer this should be done through "\if_bool:N".)
-% \end{function}
-%
-%
-%
-% \begin{function}{\if_bool:N / (EXP)}
-% \begin{syntax}
-% "\if_bool:N" <boolean> <true code> "\else:" <false code> "\fi:"
-% \end{syntax}
-% This function takes a boolean variable and
-% branches according to the result.
-% \end{function}
-%
-%
-% \begin{function}{ \if_cs_exist:N / (EXP) |
-% \if_cs_exist:w / (EXP) }
-% \begin{syntax}
-% "\if_cs_exist:N" <cs> <true code> "\else:" <false code> "\fi:" \\
-% "\if_cs_exist:w" <tokens> "\cs_end:" <true code> "\else:" <false
-% code> "\fi:"
-% \end{syntax}
-% Check if <cs> appears in the hash table or if the control sequence
-% that can be formed from <tokens> appears in the hash table. The
-% latter function does not turn the control sequence in question into
-% "\scan_stop:"! This can be useful when dealing with control
-% sequences which cannot be entered as a single token.
-% \end{function}
-%
-% \begin{function}{
-% \if_mode_horizontal: / (EXP) |
-% \if_mode_vertical: / (EXP) |
-% \if_mode_math: / (EXP) |
-% \if_mode_inner: / (EXP) }
-% \begin{syntax}
-% "\if_mode_horizontal:" <true code> "\else:" <false code> "\fi:"
-% \end{syntax}
-% Execute <true code> if currently in horizontal mode, otherwise
-% execute <false code>. Similar for the other functions.
-% \end{function}
-%
-% \subsection{Non-primitive conditionals}
-%
-% \begin{function}{ \cs_if_eq_name_p:NN }
-% \begin{syntax}
-% "\cs_if_eq_name_p:NN" <cs1> <cs2>
-% \end{syntax}
-% Returns `true' if <cs1> and <cs2> are textually the same, i.e.\ have
-% the same name, otherwise it returns `false'.
-% \end{function}
-%
-% \begin{function}{ \cs_if_eq_p:NN / (EXP) |
-% \cs_if_eq_p:cN / (EXP) |
-% \cs_if_eq_p:Nc / (EXP) |
-% \cs_if_eq_p:cc / (EXP) |
-% \cs_if_eq:NN / (TF)(EXP) |
-% \cs_if_eq:cN / (TF)(EXP) |
-% \cs_if_eq:Nc / (TF)(EXP) |
-% \cs_if_eq:cc / (TF)(EXP) }
-% \begin{syntax}
-% "\cs_if_eq_p:NNTF" <cs1> <cs2>
-% "\cs_if_eq:NNTF" <cs1> <cs2> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% These functions check if <cs1> and <cs2> have same meaning.
-% \end{function}
-%
-%
-% \begin{function}{ \cs_if_free_p:N / (EXP) |
-% \cs_if_free_p:c / (EXP) |
-% \cs_if_free:N / (TF)(EXP) |
-% \cs_if_free:c / (TF)(EXP) }
-% \begin{syntax}
-% "\cs_if_free_p:N" <cs>
-% "\cs_if_free:NTF" <cs> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Returns `true' if <cs> is either undefined or equal to
-% "\tex_relax:D" (the function that is assigned to newly created
-% control sequences by \TeX{} when "\cs:w" "..." "\cs_end:" is
-% used). In addition to this, `true' is only returned if <cs> does not
-% have a signature equal to "D", i.e., `do not use' functions are not
-% free to be redefined.
-% \end{function}
-%
-% \begin{function}{ \cs_if_exist_p:N / (EXP) |
-% \cs_if_exist_p:c / (EXP) |
-% \cs_if_exist:N / (TF)(EXP) |
-% \cs_if_exist:c / (TF)(EXP) }
-% \begin{syntax}
-% "\cs_if_exist_p:N" <cs>
-% "\cs_if_exist:NTF" <cs> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% These functions check if <cs> exists, i.e., if <cs> is present in
-% the hash table and is not the primitive "\tex_relax:D".
-% \end{function}
-%
-% \begin{function}{ \cs_if_do_not_use_p:N / (EXP) }
-% \begin{syntax}
-% "\cs_if_do_not_use_p:N" <cs>
-% \end{syntax}
-% These functions check if <cs> has the arg spec "D" for `\emph{do not use}'.
-% There are no "TF"-type conditionals for this function as it is only used
-% internally and not expected to be widely used. (For now, anyway.)
-% \end{function}
-%
-% \begin{function}{
-% \chk_if_free_cs:N|
-% \chk_if_free_cs:c
-% }
-% \begin{syntax}
-% "\chk_if_free_cs:N" <cs>
-% \end{syntax}
-% This function checks that <cs> is \m{free} according to the criteria
-% for "\cs_if_free_p:N" above. If not, an error is generated.
-% \end{function}
-%
-% \begin{function}{ \chk_if_exist_cs:N |
-% \chk_if_exist_cs:c }
-% \begin{syntax}
-% "\chk_if_exist_cs:N" <cs>
-% \end{syntax}
-% This function checks that <cs> is defined. If it is not an error
-% is generated.
-% \end{function}
-%
-%\begin{function}{
-% \str_if_eq_p:nn / (EXP) |
-% \str_if_eq_p:Vn / (EXP) |
-% \str_if_eq_p:on / (EXP) |
-% \str_if_eq_p:no / (EXP) |
-% \str_if_eq_p:nV / (EXP) |
-% \str_if_eq_p:VV / (EXP) |
-% \str_if_eq_p:xx / (EXP) |
-% \str_if_eq:nn / (EXP) (TF) |
-% \str_if_eq:Vn / (EXP) (TF) |
-% \str_if_eq:on / (EXP) (TF) |
-% \str_if_eq:no / (EXP) (TF) |
-% \str_if_eq:nV / (EXP) (TF) |
-% \str_if_eq:VV / (EXP) (TF) |
-% \str_if_eq:xx / (EXP) (TF) |
-%}
-% \begin{syntax}
-% \cs{str_if_eq_p:nn} \Arg{tl1} \Arg{tl2}
-% \cs{str_if_eq:nnTF} \Arg{tl1} \Arg{tl2} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Compares the two \meta{token lists} on a character by character
-% basis, and is \texttt{true} if the two lists contain the same
-% characters in the same order. Thus for example
-% \begin{verbatim}
-% \str_if_eq_p:xx { abc } { \tl_to_str:n { abc } }
-% \end{verbatim}
-% is logically \texttt{true}. The branching versions then leave either
-% \meta{true code} or \meta{false code} in the input stream, as
-% appropriate to the truth of the test and the variant of the function
-% chosen. The logical truth of the test is left in the input stream by
-% the predicate version. All versions of these functions are fully
-% expandable (including those involving an \texttt{x}-type
-% expansion).
-%\end{function}
-%
-% \begin{variable}{ \c_true_bool | \c_false_bool }
-% \begin{syntax}
-% \end{syntax}
-% Constants that represent `true' or `false', respectively. Used to
-% implement predicates.
-% \end{variable}
-%
-% \section{Control sequences}
-%
-% \begin{function}{ \cs:w / (EXP) | \cs_end: / (EXP) }
-% \begin{syntax}
-% "\cs:w" <tokens> "\cs_end:"
-% \end{syntax}
-% This is the \TeX{} internal way of generating a control sequence from
-% some token list. <tokens> get expanded and must ultimately result in a
-% sequence of characters.
-% \begin{texnote}
-% These functions are the primitives \tn{csname} and \tn{endcsname}.
-% "\cs:w" is considered weird because it expands tokens until it reaches
-% "\cs_end:".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \cs_show:N |
-% \cs_show:c }
-% \begin{syntax}
-% "\cs_show:N" <cs>
-% "\cs_show:c" \Arg{arg}
-% \end{syntax}
-% This function shows in the console output the \emph{meaning} of the control
-% sequence <cs> or that created by <arg>.
-% \begin{texnote}
-% This is \TeX's |\show| and associated csname version of it.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \cs_meaning:N / (EXP) |
-% \cs_meaning:c / (EXP) }
-% \begin{syntax}
-% "\cs_meaning:N" <cs>
-% "\cs_meaning:c" \Arg{arg}
-% \end{syntax}
-% This function expands to the \emph{meaning} of the control sequence <cs> or
-% that created by <arg>.
-% \begin{texnote}
-% This is \TeX's |\meaning| and associated csname version of it.
-% \end{texnote}
-% \end{function}
-%
-% \section{Selecting and discarding tokens from the input stream}
-%
-% The conditional processing cannot be implemented without
-% being able to gobble and select which tokens to use from the input
-% stream.
-%
-%
-% \begin{function}{ \use:n / (EXP) |
-% \use:nn / (EXP) |
-% \use:nnn / (EXP) |
-% \use:nnnn / (EXP) }
-% \begin{syntax}
-% "\use:n" \Arg{arg}
-% \end{syntax}
-% Functions that returns all of their arguments to the input stream after
-% removing the surrounding braces around each argument.
-% \begin{texnote}
-% "\use:n" is \LaTeXe's "\@firstofone"/"\@iden".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \use:c / (EXP) }
-% \begin{syntax}
-% "\use:c" \Arg{cs}
-% \end{syntax}
-% Function that returns to the input stream the control sequence created from
-% its argument. Requires two expansions before a control sequence is returned.
-% \begin{texnote}
-% "\use:c" is \LaTeXe's "\@nameuse".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \use:x }
-% \begin{syntax}
-% "\use:x" \Arg{expandable tokens}
-% \end{syntax}
-% Function that fully expands its argument before passing it to the input
-% stream. Contents of the argument must be fully expandable.
-% \begin{texnote}
-% Lua\TeX\ provides "\expanded" which performs this operation in an expandable
-% manner, but we cannot assume this behaviour on all platforms yet.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \use_none:n / (EXP) |
-% \use_none:nn / (EXP) |
-% \use_none:nnn / (EXP) |
-% \use_none:nnnn / (EXP) |
-% \use_none:nnnnn / (EXP) |
-% \use_none:nnnnnn / (EXP) |
-% \use_none:nnnnnnn / (EXP) |
-% \use_none:nnnnnnnn / (EXP) |
-% \use_none:nnnnnnnnn / (EXP) }
-% \begin{syntax}
-% "\use_none:n" \Arg{arg1}\\
-% "\use_none:nn" \Arg{arg1} \Arg{arg2}
-% \end{syntax}
-% These functions gobble the tokens or brace groups from the input
-% stream.
-% \begin{texnote}
-% "\use_none:n", "\use_none:nn", "\use_none:nnnn" are \LaTeXe's
-% "\@gobble", "\@gobbletwo", and "\@gobblefour".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \use_i:nn / (EXP) |
-% \use_ii:nn / (EXP) }
-% \begin{syntax}
-% "\use_i:nn" \Arg{code1} \Arg{code2}
-% \end{syntax}
-% Functions that execute the first or second argument respectively,
-% after removing the surrounding braces. Primarily used to implement
-% conditionals.
-% \begin{texnote}
-% These are \LaTeXe's "\@firstoftwo" and "\@secondoftwo", respectively.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \use_i:nnn / (EXP) |
-% \use_ii:nnn / (EXP) |
-% \use_iii:nnn / (EXP) }
-% \begin{syntax}
-% "\use_i:nnn" \Arg{arg1} \Arg{arg2} \Arg{arg3}
-% \end{syntax}
-% Functions that pick up one of three arguments and execute them after
-% removing the surrounding braces.
-% \begin{texnote}
-% \LaTeXe\ has only "\@thirdofthree".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \use_i:nnnn / (EXP) |
-% \use_ii:nnnn / (EXP) |
-% \use_iii:nnnn / (EXP) |
-% \use_iv:nnnn / (EXP) }
-% \begin{syntax}
-% "\use_i:nnnn" \Arg{arg1} \Arg{arg2} \Arg{arg3} \Arg{arg4}
-% \end{syntax}
-% Functions that pick up one of four arguments and execute them after
-% removing the surrounding braces.
-% \end{function}
-%
-% \subsection{Extending the interface}
-%
-% \begin{function}{ \use_i_ii:nnn / (EXP) }
-% \begin{syntax}
-% "\use_i_ii:nnn" \Arg{arg1} \Arg{arg2} \Arg{arg3}
-% \end{syntax}
-% This function used in the expansion module reads three arguments and
-% returns (without braces) the first and second argument while
-% discarding the third argument.
-%
-% If you wish to select multiple arguments while discarding others,
-% use a syntax like this. Its definition is
-% \begin{verbatim}
-% \cs_set:Npn \use_i_ii:nnn #1#2#3 {#1#2}
-% \end{verbatim}
-% \end{function}
-%
-% \subsection{Selecting tokens from delimited arguments}
-%
-% A different kind of function for selecting tokens from the token
-% stream are those that use delimited arguments.
-%
-% \begin{function}{ \use_none_delimit_by_q_nil:w / (EXP) |
-% \use_none_delimit_by_q_stop:w / (EXP) |
-% \use_none_delimit_by_q_recursion_stop:w / (EXP) }
-% \begin{syntax}
-% "\use_none_delimit_by_q_nil:w" <balanced text> "\q_nil"
-% \end{syntax}
-% Gobbles <balanced text>. Useful in gobbling the remainder in a list
-% structure or terminating recursion.
-% \end{function}
-%
-% \begin{function}{ \use_i_delimit_by_q_nil:nw / (EXP) |
-% \use_i_delimit_by_q_stop:nw / (EXP) |
-% \use_i_delimit_by_q_recursion_stop:nw / (EXP) }
-% \begin{syntax}
-% "\use_i_delimit_by_q_nil:nw" \Arg{arg} <balanced text> "\q_nil"
-% \end{syntax}
-% Gobbles <balanced text> and executes <arg> afterwards. This can also
-% be used to get the first item in a token list.
-% \end{function}
-%
-%
-% \begin{function}{ \use_i_after_fi:nw / (EXP) |
-% \use_i_after_else:nw / (EXP) |
-% \use_i_after_or:nw / (EXP) |
-% \use_i_after_orelse:nw / (EXP) }
-% \begin{syntax}
-% "\use_i_after_fi:nw" \Arg{arg} "\fi:"
-% "\use_i_after_else:nw" \Arg{arg} "\else:" <balanced text> "\fi:"
-% "\use_i_after_or:nw" \Arg{arg} "\or:" <balanced text> "\fi:"
-% "\use_i_after_orelse:nw" \Arg{arg} "\or:/\else:" <balanced text> "\fi:"
-% \end{syntax}
-% Executes <arg> after executing closing out
-% "\fi:". "\use_i_after_orelse:nw" can be used anywhere where
-% "\use_i_after_else:nw" or "\use_i_after_or:nw" are used.
-% \end{function}
-%
-%
-% \section{That which belongs in other modules but needs to be defined earlier}
-%
-% \begin{function}{ \exp_after:wN / (EXP) }
-% \begin{syntax}
-% "\exp_after:wN" <token1> <token2>
-% \end{syntax}
-% Expands <token2> once and then continues processing from <token1>.
-% \begin{texnote}
-% This is \TeX's \tn{expandafter}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \exp_not:N / (EXP) | \exp_not:n / (EXP) }
-% \begin{syntax}
-% "\exp_not:N" <token>
-% "\exp_not:n" \Arg{tokens}
-% \end{syntax}
-% In an expanding context, this function prevents <token> or <tokens> from
-% expanding.
-% \begin{texnote}
-% These are \TeX's \tn{noexpand} and \eTeX's \tn{unexpanded}, respectively.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \prg_do_nothing: / (EXP) }
-% This is as close as we get to a null operation or no-op.
-% \begin{texnote}
-% Definition as in \LaTeX's \tn{\@empty} but not used for the same thing.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \iow_log:x |
-% \iow_term:x |
-% \iow_shipout_x:Nn }
-% \begin{syntax}
-% "\iow_log:x" \Arg{message}
-% "\iow_shipout_x:Nn" <write_stream> \Arg{message}
-% \end{syntax}
-% Writes <message> to either to log or the terminal.
-% \end{function}
-%
-% \begin{function}{ \msg_kernel_bug:x }
-% \begin{syntax}
-% "\msg_kernel_bug:x" \Arg{message}
-% \end{syntax}
-% Internal function for calling errors in our code.
-% \end{function}
-%
-% \begin{function}{ \cs_record_meaning:N }
-% Placeholder for a function to be defined by \file{l3chk}.
-% \end{function}
-%
-% \begin{variable}{ \c_minus_one | \c_zero | \c_sixteen }
-% Numeric constants.
-% \end{variable}
-%
-%
-%
-% \section{Defining functions}
-%
-%
-% There are two types of function definitions in \LaTeX3: versions
-% that check if the function name is still unused, and versions that
-% simply make the definition. The latter are used for internal scratch
-% functions that get new meanings all over the place.
-%
-% For each type there is an additional choice to be made: Does the
-% function to be defined contain delimited arguments? The answer in
-% 99\% of the cases is no. For this type the programmer will know the
-% number of arguments and in most cases use the argument signature to
-% signal this, e.g., "\foo_bar:nnn" presumably takes three
-% arguments. We therefore also provide functions that automatically
-% detect how many arguments are required and construct the parameter
-% text on the fly.
-%
-% A definition of a new function can be done locally and globally. Currently
-% nearly all function definitions are done locally on top level, in
-% other words they are global but don't show it. Therefore I think it may
-% be better to remove the local variants in the future and declare all
-% checked function definitions global.
-%
-% \begin{texnote}
-% While \TeX{} makes all definition functions directly available to the
-% user \LaTeX3 hides them very carefully to avoid the problems with
-% definitions that are overwritten accidentally. Many functions that are in
-% \TeX{} a combination of prefixes and definition functions are provided
-% as individual functions.
-% \end{texnote}
-%
-% A slew of functions are defined in the following sections for defining
-% new functions. Here's a quick summary to get an idea of what's available:
-% {\centering
-% "\cs_"("g")("new"/"set")("_protected")("_nopar")":"("N"/"c")("p")("n"/"x")
-% \par}
-% That stands for, respectively, the following variations:
-% \begin{description}
-% \item[\texttt g] Global or local;
-% \item[\texttt{new}/\texttt{set}]
-% Define a new function or re-define an existing one;
-% \item[\texttt{protected}]
-% Prevent expansion of the function in "x" arguments;
-% \item[\texttt{nopar}] Restrict the argument(s) from containing "\par";
-% \item[\texttt N/\texttt c] Either a control sequence or a `csname';
-% \item[\texttt p]
-% Either the a primitive \TeX\ argument or the number of arguments
-% is detected from the argument signature, i.e., |\foo:nnn| is
-% assumed to have three arguments |#1#2#3|;
-% \item[\texttt n/\texttt x] Either an unexpanded or an expanded definition.
-% \end{description}
-% That adds up to 128 variations (!). However, the system is very
-% logical and only a handful will usually be required often.
-%
-%
-%
-% \subsection{Defining new functions using primitive parameter text}
-%
-%
-% \begin{function}{\cs_new:Npn |
-% \cs_new:Npx |
-% \cs_new:cpn |
-% \cs_new:cpx
-% }
-% \begin{syntax}
-% "\cs_new:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Defines a function that may contain "\par" tokens in the argument(s)
-% when called. This is not allowed for normal functions.
-% \end{function}
-%
-% \begin{function}{\cs_new_nopar:Npn |
-% \cs_new_nopar:Npx |
-% \cs_new_nopar:cpn |
-% \cs_new_nopar:cpx
-% }
-% \begin{syntax}
-% "\cs_new_nopar:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Defines a new function, making sure that <cs> is unused so far.
-% <parms> may consist of arbitrary parameter specification in \TeX{}
-% syntax. It is under the responsibility of the programmer to name the
-% new function according to the rules laid out in the previous section.
-% <code> is either passed literally or may be subject to expansion
-% (under the "x" variants).
-% \end{function}
-%
-% \begin{function}{\cs_new_protected:Npn |
-% \cs_new_protected:Npx |
-% \cs_new_protected:cpn |
-% \cs_new_protected:cpx
-% }
-% \begin{syntax}
-% "\cs_new_protected:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Defines a function that is both robust and may contain "\par" tokens
-% in the argument(s) when called.
-% \end{function}
-%
-% \begin{function}{\cs_new_protected_nopar:Npn |
-% \cs_new_protected_nopar:Npx |
-% \cs_new_protected_nopar:cpn |
-% \cs_new_protected_nopar:cpx
-% }
-% \begin{syntax}
-% "\cs_new_protected_nopar:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Defines a function that does not expand when inside an |x| type
-% expansion.
-% \end{function}
-%
-%
-%
-%
-%
-%
-%
-% \subsection{Defining new functions using the signature}
-%
-%
-% \begin{function}{\cs_new:Nn |
-% \cs_new:Nx |
-% \cs_new:cn |
-% \cs_new:cx
-% }
-% \begin{syntax}
-% "\cs_new:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Defines a new function, making sure that <cs> is unused so far. The
-% parameter text is automatically detected from the length of the
-% function signature. If <cs> is missing a colon in its name, an error
-% is raised. It is under the responsibility of the programmer to name
-% the new function according to the rules laid out in the previous
-% section. <code> is either passed literally or may be subject to
-% expansion (under the "x" variants).
-% \begin{texnote}
-% Internally, these use \TeX's "\long". These forms are
-% recommended for low-level definitions as experience has shown that "\par"
-% tokens often turn up in programming situations that wouldn't have been
-% expected.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\cs_new_nopar:Nn |
-% \cs_new_nopar:Nx |
-% \cs_new_nopar:cn |
-% \cs_new_nopar:cx
-% }
-% \begin{syntax}
-% "\cs_new_nopar:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Version of the above in which "\par" is not allowed to appear within the
-% argument(s) of the defined functions.
-% \end{function}
-%
-% \begin{function}{\cs_new_protected:Nn |
-% \cs_new_protected:Nx |
-% \cs_new_protected:cn |
-% \cs_new_protected:cx
-% }
-% \begin{syntax}
-% "\cs_new_protected:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Defines a function that is both robust and may contain "\par" tokens
-% in the argument(s) when called.
-% \end{function}
-%
-% \begin{function}{\cs_new_protected_nopar:Nn |
-% \cs_new_protected_nopar:Nx |
-% \cs_new_protected_nopar:cn |
-% \cs_new_protected_nopar:cx
-% }
-% \begin{syntax}
-% "\cs_new_protected_nopar:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Defines a function that does not expand when inside an |x| type
-% expansion. "\par" is not allowed in the argument(s) of the defined function.
-% \end{function}
-%
-%
-%
-% \subsection{Defining functions using primitive parameter text}
-%
-%
-% Besides the function definitions that check whether or not their
-% argument is an unused function we need function definitions that
-% overwrite currently used definitions. The following functions are
-% provided for this purpose.
-%
-% \begin{function}{\cs_set:Npn |
-% \cs_set:Npx |
-% \cs_set:cpn |
-% \cs_set:cpx |
-% }
-% \begin{syntax}
-% "\cs_set:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Like "\cs_set_nopar:Npn" but allows "\par" tokens in the arguments of the
-% function being defined.
-% \begin{texnote}
-% These are equivalent to \TeX's "\long\def" and so on. These forms are
-% recommended for low-level definitions as experience has shown that "\par"
-% tokens often turn up in programming situations that wouldn't have been
-% expected.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\cs_gset:Npn |
-% \cs_gset:Npx |
-% \cs_gset:cpn |
-% \cs_gset:cpx |
-% }
-% \begin{syntax}
-% "\cs_gset:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Global variant of "\cs_set:Npn".
-% \end{function}
-%
-% \begin{function}{\cs_set_nopar:Npn |
-% \cs_set_nopar:Npx |
-% \cs_set_nopar:cpn |
-% \cs_set_nopar:cpx |
-% }
-% \begin{syntax}
-% "\cs_set_nopar:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Like "\cs_new_nopar:Npn" etc.\ but does not check the <cs> name.
-% \begin{texnote}
-% "\cs_set_nopar:Npn" is the \LaTeX3 name for \TeX{}'s \tn{def} and
-% "\cs_set_nopar:Npx" corresponds to the primitive \tn{edef}. The
-% "\cs_set_nopar:cpn" function was known in \LaTeX2 as \tn{@namedef}.
-% "\cs_set_nopar:cpx" has no equivalent.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\cs_gset_nopar:Npn |
-% \cs_gset_nopar:Npx |
-% \cs_gset_nopar:cpn |
-% \cs_gset_nopar:cpx |
-% }
-% \begin{syntax}
-% "\cs_gset_nopar:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Like "\cs_set_nopar:Npn" but defines the <cs> globally.
-% \begin{texnote}
-% "\cs_gset_nopar:Npn" and "\cs_gset_nopar:Npx"
-% are \TeX's \tn{gdef} and \tn{xdef}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{\cs_set_protected:Npn |
-% \cs_set_protected:Npx |
-% \cs_set_protected:cpn |
-% \cs_set_protected:cpx |
-% }
-% \begin{syntax}
-% "\cs_set_protected:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Naturally robust macro that won't expand in an |x| type argument.
-% These varieties allow |\par| tokens in the arguments of the
-% function being defined.
-% \end{function}
-%
-% \begin{function}{\cs_gset_protected:Npn |
-% \cs_gset_protected:Npx |
-% \cs_gset_protected:cpn |
-% \cs_gset_protected:cpx |
-% }
-% \begin{syntax}
-% "\cs_gset_protected:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Global versions of the above functions.
-% \end{function}
-%
-% \begin{function}{\cs_set_protected_nopar:Npn |
-% \cs_set_protected_nopar:Npx |
-% \cs_set_protected_nopar:cpn |
-% \cs_set_protected_nopar:cpx |
-% }
-% \begin{syntax}
-% "\cs_set_protected_nopar:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Naturally robust macro that won't expand in an |x| type argument.
-% If you want for some reason to expand it inside an |x| type expansion,
-% prefix it with |\exp_after:wN \prg_do_nothing:|.
-% \end{function}
-%
-% \begin{function}{\cs_gset_protected_nopar:Npn |
-% \cs_gset_protected_nopar:Npx |
-% \cs_gset_protected_nopar:cpn |
-% \cs_gset_protected_nopar:cpx |
-% }
-% \begin{syntax}
-% "\cs_gset_protected_nopar:Npn" <cs> <parms> \Arg{code}
-% \end{syntax}
-% Global versions of the above functions.
-% \end{function}
-%
-%
-% \subsection{Defining functions using the signature (no checks)}
-%
-% As above but now detecting the parameter text from inspecting the
-% signature.
-%
-% \begin{function}{\cs_set:Nn |
-% \cs_set:Nx |
-% \cs_set:cn |
-% \cs_set:cx |
-% }
-% \begin{syntax}
-% "\cs_set:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Like "\cs_set_nopar:Nn" but allows "\par" tokens in the arguments of the
-% function being defined.
-% \end{function}
-%
-% \begin{function}{\cs_gset:Nn |
-% \cs_gset:Nx |
-% \cs_gset:cn |
-% \cs_gset:cx |
-% }
-% \begin{syntax}
-% "\cs_gset:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Global variant of "\cs_set:Nn".
-% \end{function}
-%
-% \begin{function}{\cs_set_nopar:Nn |
-% \cs_set_nopar:Nx |
-% \cs_set_nopar:cn |
-% \cs_set_nopar:cx |
-% }
-% \begin{syntax}
-% "\cs_set_nopar:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Like "\cs_new_nopar:Nn" etc.\ but does not check the <cs> name.
-% \end{function}
-%
-% \begin{function}{\cs_gset_nopar:Nn |
-% \cs_gset_nopar:Nx |
-% \cs_gset_nopar:cn |
-% \cs_gset_nopar:cx |
-% }
-% \begin{syntax}
-% "\cs_gset_nopar:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Like "\cs_set_nopar:Nn" but defines the <cs> globally.
-% \end{function}
-%
-% \begin{function}{\cs_set_protected:Nn |
-% \cs_set_protected:cn |
-% \cs_set_protected:Nx |
-% \cs_set_protected:cx |
-% }
-% \begin{syntax}
-% "\cs_set_protected:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Naturally robust macro that won't expand in an |x| type argument.
-% These varieties also allow |\par| tokens in the arguments of the
-% function being defined.
-% \end{function}
-%
-% \begin{function}{\cs_gset_protected:Nn |
-% \cs_gset_protected:cn |
-% \cs_gset_protected:Nx |
-% \cs_gset_protected:cx |
-% }
-% \begin{syntax}
-% "\cs_gset_protected:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Global versions of the above functions.
-% \end{function}
-%
-% \begin{function}{\cs_set_protected_nopar:Nn |
-% \cs_set_protected_nopar:cn |
-% \cs_set_protected_nopar:Nx |
-% \cs_set_protected_nopar:cx |
-% }
-% \begin{syntax}
-% "\cs_set_protected_nopar:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Naturally robust macro that won't expand in an |x| type argument.
-% This also comes as a |long| version. If you for some reason want to
-% expand it inside an |x| type expansion, prefix it with
-% |\exp_after:wN \prg_do_nothing:|.
-% \end{function}
-%
-% \begin{function}{\cs_gset_protected_nopar:Nn |
-% \cs_gset_protected_nopar:cn |
-% \cs_gset_protected_nopar:Nx |
-% \cs_gset_protected_nopar:cx |
-% }
-% \begin{syntax}
-% "\cs_gset_protected_nopar:Nn" <cs> \Arg{code}
-% \end{syntax}
-% Global versions of the above functions.
-% \end{function}
-%
-%
-%
-% \subsection{Undefining functions}
-%
-% \begin{function}{
-% \cs_undefine:N |
-% \cs_undefine:c |
-% \cs_gundefine:N |
-% \cs_gundefine:c
-% }
-% \begin{syntax}
-% "\cs_gundefine:N" <cs>
-% \end{syntax}
-% Undefines the control sequence locally or globally.
-% In a global context, this is useful for reclaiming a small amount of
-% memory but shouldn't often be needed for this purpose.
-% In a local context, this can be useful if you need to clear a definition
-% before applying a short-term modification to something.
-% \end{function}
-%
-%
-% \subsection{Copying function definitions}
-%
-% \begin{function}{ \cs_new_eq:NN |
-% \cs_new_eq:cN |
-% \cs_new_eq:Nc |
-% \cs_new_eq:cc }
-% \begin{syntax}
-% "\cs_new_eq:NN" <cs1> <cs2>
-% \end{syntax}
-% Gives the function <cs1> locally or globally the current meaning of <cs2>.
-% If <cs1> already exists then an error is called.
-% \end{function}
-%
-%
-% \begin{function}{\cs_set_eq:NN |
-% \cs_set_eq:cN |
-% \cs_set_eq:Nc |
-% \cs_set_eq:cc |
-% \cs_gset_eq:NN |
-% \cs_gset_eq:cN |
-% \cs_gset_eq:Nc |
-% \cs_gset_eq:cc }
-% \begin{syntax}
-% "\cs_set_eq:cN" <cs1> <cs2>
-% \end{syntax}
-% Gives the function <cs1> the current meaning of <cs2>. Again, we may
-% always do this globally.
-% \end{function}
-%
-% \begin{function}{\cs_set_eq:NwN}
-% \begin{syntax}
-% "\cs_set_eq:NwN" <cs1> <cs2>
-% "\cs_set_eq:NwN" <cs1> "=" <cs2>
-% \end{syntax}
-% These functions assign the meaning of <cs2> locally or globally to the
-% function <cs1>. Because the \TeX{} primitive operation is being used
-% which may have an equal sign and (a certain number of) spaces between
-% <cs1> and <cs2> the name contains a "w". (Not happy about this
-% convention!).
-% \begin{texnote}
-% "\cs_set_eq:NwN" is the \LaTeX3 name for \TeX{}'s \tn{let}.
-% \end{texnote}
-% \end{function}
-%
-% \subsection{Internal functions}
-%
-%
-% \begin{function}{ \pref_global:D |
-% \pref_long:D |
-% \pref_protected:D }
-% \begin{syntax}
-% "\pref_global:D" "\cs_set_nopar:Npn"
-% \end{syntax}
-% Prefix functions that can be used in front of some definition
-% functions (namely \ldots). The result of prefixing a function
-% definition with "\pref_global:D" makes the definition global,
-% "\pref_long:D" change the argument scanning mechanism so that it
-% allows "\par" tokens in the argument of the prefixed function,
-% and "\pref_protected:D" makes the definition robust in "\write"s etc.
-%
-% None of these internal functions should be used by a programmer since
-% the necessary combinations are all available as separate function,
-% e.g., "\cs_set:Npn" is internally implemented as "\pref_long:D"
-% "\cs_set_nopar:Npn".
-% \begin{texnote}
-% These prefixes are the primitives \tn{global}, \tn{long}, and
-% \tn{protected}. The \tn{outer} prefix isn't used at all within \LaTeX3
-% because \ldots (it causes more hassle than it's worth? It's nevery proved
-% useful in any meaningful way?)
-% \end{texnote}
-% \end{function}
-%
-% \section{The innards of a function}
-%
-% \begin{function}{\cs_to_str:N / (EXP)}
-% \begin{syntax}
-% "\cs_to_str:N" <cs>
-% \end{syntax}
-% This function returns the name of <cs> as a sequence of letters with
-% the escape character removed.
-% \end{function}
-%
-% \begin{function}{\token_to_str:N / (EXP) | \token_to_str:c / (EXP)}
-% \begin{syntax}
-% "\token_to_str:N" <arg>
-% \end{syntax}
-% This function return the name of <arg> as a sequence of letters
-% including the escape character.
-% \begin{texnote}
-% This is \TeX's \tn{string}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\token_to_meaning:N / (EXP)}
-% \begin{syntax}
-% "\token_to_meaning:N" <arg>
-% \end{syntax}
-% This function returns the type and definition of <arg> as a sequence
-% of letters.
-% \begin{texnote}
-% This is \TeX's \tn{meaning}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{\cs_get_function_name:N / (EXP) |
-% \cs_get_function_signature:N / (EXP)}
-% \begin{syntax}
-% "\cs_get_function_name:N" "\"<fn>":"<args>
-% \end{syntax}
-% The "name" variant strips off the leading escape character and the
-% trailing argument specification (including the colon) to return
-% <fn>. The "signature" variants does the same but returns the
-% signature <args> instead.
-% \end{function}
-%
-%
-% \begin{function}{\cs_split_function:NN / (EXP)}
-% \begin{syntax}
-% "\cs_split_function:NN" "\"<fn>":"<args> <post process>
-% \end{syntax}
-% Strips off the leading escape character, splits off the signature
-% without the colon, informs whether or not a colon was present and
-% then prefixes these results with <post process>, i.e., <post
-% process>\Arg{name}\Arg{signature}\meta{true}/\meta{false}. For
-% example, "\cs_get_function_name:N" is nothing more than
-% "\cs_split_function:NN" "\"<fn>":"<args> "\use_i:nnn".
-% \end{function}
-%
-%
-% \begin{function}{\cs_get_arg_count_from_signature:N / (EXP)}
-% \begin{syntax}
-% "\cs_get_arg_count_from_signature:N" "\"<fn>":"<args>
-% \end{syntax}
-% Returns the number of chars in <args>, signifying the number of arguments
-% that the function uses.
-% \end{function}
-%
-%
-% Other functions regarding arbitrary tokens can be found in the
-% \textsf{l3token} module.
-%
-% \section{Grouping and scanning}
-%
-% \begin{function}{\scan_stop:}
-% \begin{syntax}
-% "\scan_stop:"
-% \end{syntax}
-% This function stops \TeX's scanning ahead when ending a number.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{relax} renamed.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{\group_begin:|
-% \group_end:}
-% \begin{syntax}
-% "\group_begin:" <...> "\group_end:"
-% \end{syntax}
-% Encloses <...> inside a group.
-% \begin{texnote}
-% These are the \TeX{} primitives \tn{begingroup} and \tn{endgroup}
-% renamed.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\group_execute_after:N}
-% \begin{syntax}
-% "\group_execute_after:N" <token>
-% \end{syntax}
-% Adds <token> to the list of tokens to be inserted after the
-% current group ends (through an explicit or implicit "\group_end:").
-% \begin{texnote}
-% This is \TeX's \tn{aftergroup}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \section{Checking the engine}
-%
-% \begin{function}{\xetex_if_engine: / (TF)(EXP)}
-% \begin{syntax}
-% "\xetex_if_engine:TF" \Arg{true code} \Arg{false code}
-% \end{syntax}
-% This function detects if we're running a Xe\TeX-based format.
-% \end{function}
-%
-% \begin{function}{\luatex_if_engine: / (TF)(EXP)}
-% \begin{syntax}
-% "\luatex_if_engine:TF" \Arg{true code} \Arg{false code}
-% \end{syntax}
-% This function detects if we're running a Lua\TeX-based format.
-% \end{function}
-%
-% \begin{variable}{\c_xetex_is_engine_bool|\c_luatex_is_engine_bool}
-% Boolean variables used for the above functions.
-% \end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3basics} implementation}
-%
-% We need \textsf{l3names} to get things going but we actually need it very
-% early on, so it is loaded at the very top of the file \file{l3basics.dtx}.
-% Also, most of the code below won't run until \textsf{l3expan} has been
-% loaded.
-%
-% \subsection{Renaming some \TeX{} primitives (again)}
-%
-% \begin{macro}{\cs_set_eq:NwN}
-% 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
-% 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 ``tex\ldots D'' name in the cases where no good alternative exists.}
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-\tex_let:D \cs_set_eq:NwN \tex_let:D
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\if_true:}
-% \begin{macro}{\if_false:}
-% \begin{macro}{\or:}
-% \begin{macro}{\else:}
-% \begin{macro}{\fi:}
-% \begin{macro}{\reverse_if:N}
-% \begin{macro}{\if:w}
-% \begin{macro}{\if_bool:N}
-% \begin{macro}{\if_predicate:w}
-% \begin{macro}{\if_charcode:w}
-% \begin{macro}{\if_catcode:w}
-% Then some conditionals.
-% \begin{macrocode}
-\cs_set_eq:NwN \if_true: \tex_iftrue:D
-\cs_set_eq:NwN \if_false: \tex_iffalse:D
-\cs_set_eq:NwN \or: \tex_or:D
-\cs_set_eq:NwN \else: \tex_else:D
-\cs_set_eq:NwN \fi: \tex_fi:D
-\cs_set_eq:NwN \reverse_if:N \etex_unless:D
-\cs_set_eq:NwN \if:w \tex_if:D
-\cs_set_eq:NwN \if_bool:N \tex_ifodd:D
-\cs_set_eq:NwN \if_predicate:w \tex_ifodd:D
-\cs_set_eq:NwN \if_charcode:w \tex_if:D
-\cs_set_eq:NwN \if_catcode:w \tex_ifcat:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\if_meaning:w}
-% \begin{macrocode}
-\cs_set_eq:NwN \if_meaning:w \tex_ifx:D
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\if_mode_math:}
-% \begin{macro}{\if_mode_horizontal:}
-% \begin{macro}{\if_mode_vertical:}
-% \begin{macro}{\if_mode_inner:}
-% \TeX{} lets us detect some if its modes.
-% \begin{macrocode}
-\cs_set_eq:NwN \if_mode_math: \tex_ifmmode:D
-\cs_set_eq:NwN \if_mode_horizontal: \tex_ifhmode:D
-\cs_set_eq:NwN \if_mode_vertical: \tex_ifvmode:D
-\cs_set_eq:NwN \if_mode_inner: \tex_ifinner:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{\if_cs_exist:N}
-% \begin{macro}{\if_cs_exist:w}
-% \begin{macrocode}
-\cs_set_eq:NwN \if_cs_exist:N \etex_ifdefined:D
-\cs_set_eq:NwN \if_cs_exist:w \etex_ifcsname:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\exp_after:wN}
-% \begin{macro}{\exp_not:N}
-% \begin{macro}{\exp_not:n}
-% The three |\exp_| functions are used in the \textsf{l3expan} module
-% where they are described.
-% \begin{macrocode}
-\cs_set_eq:NwN \exp_after:wN \tex_expandafter:D
-\cs_set_eq:NwN \exp_not:N \tex_noexpand:D
-\cs_set_eq:NwN \exp_not:n \etex_unexpanded:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\iow_shipout_x:Nn}
-% \begin{macro}{\token_to_meaning:N}
-% \begin{macro}{\token_to_str:N}
-% \begin{macro}{\token_to_str:c}
-% \begin{macro}{\cs:w}
-% \begin{macro}{\cs_end:}
-% \begin{macro}{\cs_meaning:N}
-% \begin{macro}{\cs_meaning:c}
-% \begin{macro}{\cs_show:N}
-% \begin{macro}{\cs_show:c}
-% \begin{macrocode}
-\cs_set_eq:NwN \iow_shipout_x:Nn \tex_write:D
-\cs_set_eq:NwN \token_to_meaning:N \tex_meaning:D
-\cs_set_eq:NwN \token_to_str:N \tex_string:D
-\cs_set_eq:NwN \cs:w \tex_csname:D
-\cs_set_eq:NwN \cs_end: \tex_endcsname:D
-\cs_set_eq:NwN \cs_meaning:N \tex_meaning:D
-\tex_def:D \cs_meaning:c {\exp_args:Nc\cs_meaning:N}
-\cs_set_eq:NwN \cs_show:N \tex_show:D
-\tex_def:D \cs_show:c {\exp_args:Nc\cs_show:N}
-\tex_def:D \token_to_str:c {\exp_args:Nc\token_to_str:N}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\scan_stop:}
-% \begin{macro}{\group_begin:}
-% \begin{macro}{\group_end:}
-% The next three are basic functions for which there also exist
-% versions that are safe inside alignments. These safe versions are
-% defined in the \textsf{l3prg} module.
-% \begin{macrocode}
-\cs_set_eq:NwN \scan_stop: \tex_relax:D
-\cs_set_eq:NwN \group_begin: \tex_begingroup:D
-\cs_set_eq:NwN \group_end: \tex_endgroup:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{\group_execute_after:N}
-% \begin{macrocode}
-\cs_set_eq:NwN \group_execute_after:N \tex_aftergroup:D
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\pref_global:D}
-% \begin{macro}{\pref_long:D}
-% \begin{macro}{\pref_protected:D}
-% \begin{macrocode}
-\cs_set_eq:NwN \pref_global:D \tex_global:D
-\cs_set_eq:NwN \pref_long:D \tex_long:D
-\cs_set_eq:NwN \pref_protected:D \etex_protected:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \subsection {Defining functions}
-%
-%
-% We start by providing functions for the typical definition
-% functions. First the local ones.
-%
-% \begin{macro}{\cs_set_nopar:Npn}
-% \begin{macro}{\cs_set_nopar:Npx}
-% \begin{macro}{\cs_set:Npn}
-% \begin{macro}{\cs_set:Npx}
-% \begin{macro}{\cs_set_protected_nopar:Npn}
-% \begin{macro}{\cs_set_protected_nopar:Npx}
-% \begin{macro}{\cs_set_protected:Npn}
-% \begin{macro}{\cs_set_protected:Npx}
-% All assignment functions in \LaTeX3 should be naturally robust;
-% after all, the \TeX\ primitives for assignments are and it can be
-% a cause of problems if others aren't.
-% \begin{macrocode}
-\cs_set_eq:NwN \cs_set_nopar:Npn \tex_def:D
-\cs_set_eq:NwN \cs_set_nopar:Npx \tex_edef:D
-\pref_protected:D \cs_set_nopar:Npn \cs_set:Npn {
- \pref_long:D \cs_set_nopar:Npn
-}
-\pref_protected:D \cs_set_nopar:Npn \cs_set:Npx {
- \pref_long:D \cs_set_nopar:Npx
-}
-\pref_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npn {
- \pref_protected:D \cs_set_nopar:Npn
-}
-\pref_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npx {
- \pref_protected:D \cs_set_nopar:Npx
-}
-\cs_set_protected_nopar:Npn \cs_set_protected:Npn {
- \pref_protected:D \pref_long:D \cs_set_nopar:Npn
-}
-\cs_set_protected_nopar:Npn \cs_set_protected:Npx {
- \pref_protected:D \pref_long:D \cs_set_nopar:Npx
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_gset_nopar:Npn}
-% \begin{macro}{\cs_gset_nopar:Npx}
-% \begin{macro}{\cs_gset:Npn}
-% \begin{macro}{\cs_gset:Npx}
-% \begin{macro}{\cs_gset_protected_nopar:Npn}
-% \begin{macro}{\cs_gset_protected_nopar:Npx}
-% \begin{macro}{\cs_gset_protected:Npn}
-% \begin{macro}{\cs_gset_protected:Npx}
-% Global versions of the above functions.
-% \begin{macrocode}
-\cs_set_eq:NwN \cs_gset_nopar:Npn \tex_gdef:D
-\cs_set_eq:NwN \cs_gset_nopar:Npx \tex_xdef:D
-\cs_set_protected_nopar:Npn \cs_gset:Npn {
- \pref_long:D \cs_gset_nopar:Npn
-}
-\cs_set_protected_nopar:Npn \cs_gset:Npx {
- \pref_long:D \cs_gset_nopar:Npx
-}
-\cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npn {
- \pref_protected:D \cs_gset_nopar:Npn
-}
-\cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npx {
- \pref_protected:D \cs_gset_nopar:Npx
-}
-\cs_set_protected_nopar:Npn \cs_gset_protected:Npn {
- \pref_protected:D \pref_long:D \cs_gset_nopar:Npn
-}
-\cs_set_protected_nopar:Npn \cs_gset_protected:Npx {
- \pref_protected:D \pref_long:D \cs_gset_nopar:Npx
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \subsection{Selecting tokens}
-%
-% \begin{macro}{\use:c}
-% This macro grabs its argument and returns a csname from it.
-% \begin{macrocode}
-\cs_set:Npn \use:c #1 { \cs:w#1\cs_end: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\use:x}
-% Fully expands its argument and passes it to the input stream.
-% Uses "\cs_tmp:" as a scratch register but does not affect it.
-% \begin{macrocode}
-\cs_set_protected:Npn \use:x #1 {
- \group_begin:
- \cs_set:Npx \cs_tmp: {#1}
- \exp_after:wN
- \group_end:
- \cs_tmp:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\use:n}
-% \begin{macro}{\use:nn}
-% \begin{macro}{\use:nnn}
-% \begin{macro}{\use:nnnn}
-% These macro grabs its arguments and returns it back to the input
-% (with outer braces removed). "\use:n" is defined earlier for bootstrapping.
-% \begin{macrocode}
-\cs_set:Npn \use:n #1 {#1}
-\cs_set:Npn \use:nn #1#2 {#1#2}
-\cs_set:Npn \use:nnn #1#2#3 {#1#2#3}
-\cs_set:Npn \use:nnnn #1#2#3#4 {#1#2#3#4}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\use_i:nn}
-% \begin{macro}{\use_ii:nn}
-% These macros are needed to provide functions with true and false
-% cases, as introduced by Michael some time ago. By using
-% |\exp_after:wN| |\use_i:nn | |\else:| constructions it
-% is possible to write code where the true or false case is able to
-% access the following tokens from the input stream, which is not
-% possible if the |\c_true_bool| syntax is used.
-% \begin{macrocode}
-\cs_set:Npn \use_i:nn #1#2 {#1}
-\cs_set:Npn \use_ii:nn #1#2 {#2}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\use_i:nnn}
-% \begin{macro}{\use_ii:nnn}
-% \begin{macro}{\use_iii:nnn}
-% \begin{macro}{\use_i:nnnn}
-% \begin{macro}{\use_ii:nnnn}
-% \begin{macro}{\use_iii:nnnn}
-% \begin{macro}{\use_iv:nnnn}
-% \begin{macro}{\use_i_ii:nnn}
-% We also need something for picking up arguments from a longer
-% list.
-% \begin{macrocode}
-\cs_set:Npn \use_i:nnn #1#2#3{#1}
-\cs_set:Npn \use_ii:nnn #1#2#3{#2}
-\cs_set:Npn \use_iii:nnn #1#2#3{#3}
-\cs_set:Npn \use_i:nnnn #1#2#3#4{#1}
-\cs_set:Npn \use_ii:nnnn #1#2#3#4{#2}
-\cs_set:Npn \use_iii:nnnn #1#2#3#4{#3}
-\cs_set:Npn \use_iv:nnnn #1#2#3#4{#4}
-\cs_set:Npn \use_i_ii:nnn #1#2#3{#1#2}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\use_none_delimit_by_q_nil:w}
-% \begin{macro}{\use_none_delimit_by_q_stop:w}
-% \begin{macro}{\use_none_delimit_by_q_recursion_stop:w}
-% Functions that gobble everything until they see either |\q_nil| or
-% |\q_stop| resp.
-% \begin{macrocode}
-\cs_set:Npn \use_none_delimit_by_q_nil:w #1\q_nil{}
-\cs_set:Npn \use_none_delimit_by_q_stop:w #1\q_stop{}
-\cs_set:Npn \use_none_delimit_by_q_recursion_stop:w #1 \q_recursion_stop {}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\use_i_delimit_by_q_nil:nw}
-% \begin{macro}{\use_i_delimit_by_q_stop:nw}
-% \begin{macro}{\use_i_delimit_by_q_recursion_stop:nw}
-% Same as above but execute first argument after gobbling. Very
-% useful when you need to skip the rest of a mapping sequence but
-% want an easy way to control what should be expanded next.
-% \begin{macrocode}
-\cs_set:Npn \use_i_delimit_by_q_nil:nw #1#2\q_nil{#1}
-\cs_set:Npn \use_i_delimit_by_q_stop:nw #1#2\q_stop{#1}
-\cs_set:Npn \use_i_delimit_by_q_recursion_stop:nw #1#2 \q_recursion_stop {#1}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\use_i_after_fi:nw}
-% \begin{macro}{\use_i_after_else:nw}
-% \begin{macro}{\use_i_after_or:nw}
-% \begin{macro}{\use_i_after_orelse:nw}
-% Returns the first argument after ending the conditional.
-% \begin{macrocode}
-\cs_set:Npn \use_i_after_fi:nw #1\fi:{\fi: #1}
-\cs_set:Npn \use_i_after_else:nw #1\else:#2\fi:{\fi: #1}
-\cs_set:Npn \use_i_after_or:nw #1\or: #2\fi: {\fi:#1}
-\cs_set:Npn \use_i_after_orelse:nw #1 #2#3\fi: {\fi:#1}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Gobbling tokens from input}
-%
-% \begin{macro}{\use_none:n}
-% \begin{macro}{\use_none:nn}
-% \begin{macro}{\use_none:nnn}
-% \begin{macro}{\use_none:nnnn}
-% \begin{macro}{\use_none:nnnnn}
-% \begin{macro}{\use_none:nnnnnn}
-% \begin{macro}{\use_none:nnnnnnn}
-% \begin{macro}{\use_none:nnnnnnnn}
-% \begin{macro}{\use_none:nnnnnnnnn}
-% To gobble tokens from the input we use a standard naming
-% convention: the number of tokens gobbled is given by the number of
-% |n|'s following the |:| in the name. Although defining
-% |\use_none:nnn| and above as separate calls of |\use_none:n| and
-% |\use_none:nn| is slightly faster, this is very non-intuitive to
-% the programmer who will assume that expanding such a function once
-% will take care of gobbling all the tokens in one go.
-% \begin{macrocode}
-\cs_set:Npn \use_none:n #1{}
-\cs_set:Npn \use_none:nn #1#2{}
-\cs_set:Npn \use_none:nnn #1#2#3{}
-\cs_set:Npn \use_none:nnnn #1#2#3#4{}
-\cs_set:Npn \use_none:nnnnn #1#2#3#4#5{}
-\cs_set:Npn \use_none:nnnnnn #1#2#3#4#5#6{}
-\cs_set:Npn \use_none:nnnnnnn #1#2#3#4#5#6#7{}
-\cs_set:Npn \use_none:nnnnnnnn #1#2#3#4#5#6#7#8{}
-\cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9{}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Expansion control from l3expan}
-%
-%\ExplSyntaxOn
-% \cs_set_eq:NN \g_saved_doc_macros_seq \g_doc_macros_seq
-%\ExplSyntaxOff
-% \begin{macro}{\exp_args:Nc}
-% Moved here for now as it is going to be used right away.
-% \begin{macrocode}
-\cs_set:Npn \exp_args:Nc #1#2{\exp_after:wN#1\cs:w#2\cs_end:}
-% \end{macrocode}
-% \end{macro}
-%\ExplSyntaxOn
-% \cs_set_eq:NN \g_doc_macros_seq \g_saved_doc_macros_seq
-%\ExplSyntaxOff
-%
-% \subsection{Conditional processing and definitions}
-%
-% Underneath any predicate function (|_p|) or other conditional forms
-% (|TF|, etc.) is a built-in logic saying that it after all of the
-% testing and processing must return the \meta{state} this leaves
-% \TeX\ in. Therefore, a simple user interface could be something like
-% \begin{verbatim}
-% \if_meaning:w #1#2 \prg_return_true: \else:
-% \if_meaning:w #1#3 \prg_return_true: \else:
-% \prg_return_false:
-% \fi: \fi:
-% \end{verbatim}
-% Usually, a \TeX\ programmer would have to insert a number of
-% |\exp_after:wN|s to ensure the state value is returned at exactly
-% the point where the last conditional is finished. However, that
-% obscures the code and forces the \TeX\ programmer to prove that
-% he/she knows the $2^{n}-1$ table. We therefore provide the simpler
-% interface.
-%
-%\ExplSyntaxOn
-% \cs_set_eq:NN \g_saved_doc_macros_seq \g_doc_macros_seq
-%\ExplSyntaxOff
-%
-% \begin{macro}{\prg_return_true:}
-% \begin{macro}{\prg_return_false:}
-% The idea here is that \cs{tex_romanumeral:D} will expand fully any
-% \cs{tex_else:D} and the \cs{tex_fi:D} that are waiting to be discarded,
-% before reaching the \cs{c_zero} which will leave the expansion null.
-% 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
-% to see this.
-% \begin{macrocode}
-\cs_set_nopar:Npn \prg_return_true:
- { \exp_after:wN \use_i:nn \tex_romannumeral:D }
-\cs_set_nopar:Npn \prg_return_false:
- { \exp_after:wN \use_ii:nn \tex_romannumeral:D }
-% \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.
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prg_set_conditional:Npnn,\prg_new_conditional:Npnn,
-% \prg_set_protected_conditional:Npnn,\prg_new_protected_conditional:Npnn}
-% The user functions for the types using parameter text from the
-% programmer. Call aux function to grab parameters, split the base
-% function into name and signature and then use, e.g., |\cs_set:Npn|
-% to define it with.
-% \begin{macrocode}
-\cs_set_protected:Npn \prg_set_conditional:Npnn #1{
- \prg_get_parm_aux:nw{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_set:Npn {parm}
- }
-}
-\cs_set_protected:Npn \prg_new_conditional:Npnn #1{
- \prg_get_parm_aux:nw{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_new:Npn {parm}
- }
-}
-\cs_set_protected:Npn \prg_set_protected_conditional:Npnn #1{
- \prg_get_parm_aux:nw{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_set_protected:Npn {parm}
- }
-}
-\cs_set_protected:Npn \prg_new_protected_conditional:Npnn #1{
- \prg_get_parm_aux:nw{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_new_protected:Npn {parm}
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\prg_set_conditional:Nnn,\prg_new_conditional:Nnn,
-% \prg_set_protected_conditional:Nnn,\prg_new_protected_conditional:Nnn}
-% The user functions for the types automatically inserting the
-% correct parameter text based on the signature. Call aux function
-% after calculating number of arguments, split the base function
-% into name and signature and then use, e.g., |\cs_set:Npn| to
-% define it with.
-% \begin{macrocode}
-\cs_set_protected:Npn \prg_set_conditional:Nnn #1{
- \exp_args:Nnf \prg_get_count_aux:nn{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_set:Npn {count}
- }{\cs_get_arg_count_from_signature:N #1}
-}
-\cs_set_protected:Npn \prg_new_conditional:Nnn #1{
- \exp_args:Nnf \prg_get_count_aux:nn{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_new:Npn {count}
- }{\cs_get_arg_count_from_signature:N #1}
-}
-
-\cs_set_protected:Npn \prg_set_protected_conditional:Nnn #1{
- \exp_args:Nnf \prg_get_count_aux:nn{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_set_protected:Npn {count}
- }{\cs_get_arg_count_from_signature:N #1}
-}
-
-\cs_set_protected:Npn \prg_new_protected_conditional:Nnn #1{
- \exp_args:Nnf \prg_get_count_aux:nn{
- \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn
- \cs_new_protected:Npn {count}
- }{\cs_get_arg_count_from_signature:N #1}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\prg_set_eq_conditional:NNn,\prg_new_eq_conditional:NNn}
-% The obvious setting-equal functions.
-% \begin{macrocode}
-\cs_set_protected:Npn \prg_set_eq_conditional:NNn #1#2#3 {
- \prg_set_eq_conditional_aux:NNNn \cs_set_eq:cc #1#2 {#3}
-}
-\cs_set_protected:Npn \prg_new_eq_conditional:NNn #1#2#3 {
- \prg_set_eq_conditional_aux:NNNn \cs_new_eq:cc #1#2 {#3}
-}
-% \end{macrocode}
-% \end{macro}
-%
-%\ExplSyntaxOn
-% \cs_set_eq:NN \g_doc_macros_seq \g_saved_doc_macros_seq
-%\ExplSyntaxOff
-%
-% \begin{macro}[aux]{\prg_get_parm_aux:nw,\prg_get_count_aux:nn}
-% For the "Npnn" type we must grab the parameter text before
-% continuing. We make this a very generic function that takes one
-% argument before reading everything up to a left brace. Something
-% similar for the "Nnn" type.
-% \begin{macrocode}
-\cs_set:Npn \prg_get_count_aux:nn #1#2 {#1{#2}}
-\cs_set:Npn \prg_get_parm_aux:nw #1#2#{#1{#2}}
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}[aux]{\prg_generate_conditional_parm_aux:nnNNnnnn,
-% \prg_generate_conditional_parm_aux:nw}
-%
-% The workhorse here is going through a list of desired forms, i.e.,
-% p, TF, T and F. The first three arguments come from splitting up
-% the base form of the conditional, which gives the name, signature
-% and a boolean to signal whether or not there was a colon in the
-% name. For the time being, we do not use this piece of information
-% but could well throw an error. The fourth argument is how to
-% define this function, the fifth is the text "parm" or "count" for
-% which version to use to define the functions, the sixth is the
-% parameters to use (possibly empty) or number of arguments, the
-% seventh is the list of forms to define, the eight is the
-% replacement text which we will augment when defining the forms.
-% \begin{macrocode}
-\cs_set:Npn \prg_generate_conditional_aux:nnNNnnnn #1#2#3#4#5#6#7#8{
- \prg_generate_conditional_aux:nnw{#5}{
- #4{#1}{#2}{#6}{#8}
- }#7,?, \q_recursion_stop
-}
-% \end{macrocode}
-% Looping through the list of desired forms. First is the text "parm"
-% or "count", second is five arguments packed together and third is
-% the form. Use text and form to call the correct type.
-% \begin{macrocode}
-\cs_set:Npn \prg_generate_conditional_aux:nnw #1#2#3,{
- \if:w ?#3
- \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
- \fi:
- \use:c{prg_generate_#3_form_#1:Nnnnn} #2
- \prg_generate_conditional_aux:nnw{#1}{#2}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[aux]
-% {
-% \prg_generate_p_form_parm:Nnnnn,
-% \prg_generate_TF_form_parm:Nnnnn,
-% \prg_generate_T_form_parm:Nnnnn,
-% \prg_generate_F_form_parm:Nnnnn
-% }
-% How to generate the various forms. The |parm| types here takes the
-% following arguments: 1: how to define (an N-type), 2: name, 3:
-% signature, 4: parameter text (or empty), 5: replacement. Remember that
-% the logic-returning functions expect two arguments to be present after
-% \cs{c_zero}: notice the construction of the different variants
-% relies on this, and that the |TF| variant will be slightly faster
-% than the |T| version.
-% \begin{macrocode}
-\cs_set_protected:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5
- {
- \exp_args:Nc #1 { #2 _p: #3 } #4
- {
- #5 \c_zero
- \c_true_bool \c_false_bool
- }
- }
-\cs_set_protected:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5
- {
- \exp_args:Nc #1 { #2 : #3 T } #4
- {
- #5 \c_zero
- \use:n \use_none:n
- }
- }
-\cs_set_protected:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5
- {
- \exp_args:Nc #1 { #2 : #3 F } #4
- {
- #5 \c_zero
- { }
- }
- }
-\cs_set_protected:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5
- {
- \exp_args:Nc #1 { #2 : #3 TF } #4
- { #5 \c_zero }
- }
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}[aux]
-% {
-% \prg_generate_p_form_count:Nnnnn,
-% \prg_generate_TF_form_count:Nnnnn,
-% \prg_generate_T_form_count:Nnnnn,
-% \prg_generate_F_form_count:Nnnnn
-% }
-% The |count| form is similar, but of course requires a number rather
-% than a primitive argument specification.
-% \begin{macrocode}
-\cs_set_protected:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5
- {
- \cs_generate_from_arg_count:cNnn { #2 _p: #3 } #1 {#4}
- {
- #5 \c_zero
- \c_true_bool \c_false_bool
- }
- }
-\cs_set_protected:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5
- {
- \cs_generate_from_arg_count:cNnn { #2 : #3 T } #1 {#4}
- {
- #5 \c_zero
- \use:n \use_none:n
- }
- }
-\cs_set_protected:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5
- {
- \cs_generate_from_arg_count:cNnn { #2 : #3 F } #1 {#4}
- {
- #5 \c_zero
- { }
- }
- }
-\cs_set_protected:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5
- {
- \cs_generate_from_arg_count:cNnn { #2 : #3 TF } #1 {#4}
- { #5 \c_zero }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[aux]{\prg_set_eq_conditional_aux:NNNn,
-% \prg_set_eq_conditional_aux:NNNw}
-% \begin{macrocode}
-\cs_set:Npn \prg_set_eq_conditional_aux:NNNn #1#2#3#4 {
- \prg_set_eq_conditional_aux:NNNw #1#2#3#4,?,\q_recursion_stop
-}
-% \end{macrocode}
-% Manual clist loop over argument "#4".
-% \begin{macrocode}
-\cs_set:Npn \prg_set_eq_conditional_aux:NNNw #1#2#3#4, {
- \if:w ? #4 \scan_stop:
- \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
- \fi:
- #1 {
- \exp_args:NNc \cs_split_function:NN #2 {prg_conditional_form_#4:nnn}
- }{
- \exp_args:NNc \cs_split_function:NN #3 {prg_conditional_form_#4:nnn}
- }
- \prg_set_eq_conditional_aux:NNNw #1{#2}{#3}
-}
-% \end{macrocode}
-% \begin{macrocode}
-\cs_set:Npn \prg_conditional_form_p:nnn #1#2#3 {#1_p:#2}
-\cs_set:Npn \prg_conditional_form_TF:nnn #1#2#3 {#1:#2TF}
-\cs_set:Npn \prg_conditional_form_T:nnn #1#2#3 {#1:#2T}
-\cs_set:Npn \prg_conditional_form_F:nnn #1#2#3 {#1:#2F}
-% \end{macrocode}
-% \end{macro}
-%
-% All that is left is to define the canonical boolean true and false.
-% I think Michael originated the idea of expandable boolean tests. At
-% first these were supposed to expand into either \texttt{TT} or
-% \texttt{TF} to be tested using |\if:w| but this was later changed to
-% \texttt{00} and \texttt{01}, so they could be used in logical
-% operations. Later again they were changed to being numerical
-% constants with values of $1$ for true and $0$ for false. We need
-% this from the get-go.
-%
-% \begin{macro}{\c_true_bool}
-% \begin{macro}{\c_false_bool}
-% Here are the canonical boolean values.
-% \begin{macrocode}
-\tex_chardef:D \c_true_bool = 1~
-\tex_chardef:D \c_false_bool = 0~
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Dissecting a control sequence}
-%
-% \begin{macro}{\cs_to_str:N}
-% \begin{macro}[aux]{\cs_to_str_aux:w}
-% This converts a control sequence into the character string of its
-% name, removing the leading escape character. This turns out to be
-% a non-trivial matter as there a different cases:
-% \begin{itemize}
-% \item The usual case of a printable escape character;
-% \item the case of a non-printable escape characters, e.g., when
-% the value of |\tex_escapechar:D| is negative;
-% \item when the escape character is a space.
-% \end{itemize}
-% One approach to solve this is to test how many tokens result from
-% |\token_to_str:N \a|. If there are two tokens, then the escape
-% character is printable, while if it is non-printable then only
-% one is present.
-%
-% However, there is an additional complication: the control
-% sequence itself may start with a space. Clearly that should \emph{not} be
-% lost in the process of converting to a string. So the approach adopted is
-% a little more intricate still. When the escape character is printable,
-% \verb*|\token_to_str:N \ | yields the escape character itself and a space.
-% The escape sequence will terminate the expansion started by
-% \cs{tex_romannumeral:D}, which is a negative number and so will not
-% gobble the escape character even if it's a number. The \cs{tex_if:D}
-% test will then be \texttt{false}, and the na\"ive approach of gobbling
-% the first character of the \cs{token_to_str:N} version of the control
-% sequence will work, even if the first character is a space.
-% The second case is that the escape character is itself a space. In this
-% case, the escape character space is consumed terminating the first
-% \cs{tex_romannumeral:D}, and \cs{cs_to_str_aux:w} is expanded. This
-% inserts a space, making the \cs{tex_if:D} test \texttt{true}. The
-% second \cs{tex_romannumeral:D} will then execute the \cs{token_to_str:N},
-% with the escape-character space being consumed by the
-% \cs{tex_romannumeral:D}, and thus leaving the control sequence name in the
-% input stream. The final case is where the escape character is not printable.
-% The flow here starts with the \verb*|\token_to_str:N \ | giving just a
-% space, which terminates the first \cs{tex_romannumeral:D} but leaves no
-% token for the \cs{tex_if:D} test. This means that the \cs{tex_romannumeral:D}
-% is executed before the test is finished. The result is that the
-% \cs{tex_fi:D}, expanded before the \cs{tex_if:D} is finished, becomes
-% \cs{tex_relax:D} \cs{tex_fi:D}, and the \cs{tex_relax:D} is then used in
-% the \cs{tex_if:D} test.
-% In this case, \cs{token_to_str:N} is therefore used with no gobbling at
-% all, which is exactly what is needed in this case.
-% \begin{macrocode}
-\cs_set:Npn \cs_to_str:N
- {
- \tex_if:D \tex_romannumeral:D - `0 \token_to_str:N \ %
- \cs_to_str_aux:w
- \tex_fi:D
- \exp_after:wN \use_none:n \token_to_str:N
- }
-\cs_set_nopar:Npn \cs_to_str_aux:w #1 \use_none:n
- { ~ \tex_romannumeral:D - `0 \tex_fi:D }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\cs_split_function:NN}
-% \begin{macro}[aux]{\cs_split_function_aux:w}
-% \begin{macro}[aux]{\cs_split_function_auxii:w}
-% This function takes a function name and splits it into name with
-% the escape char removed and argument specification. In addition to
-% this, a third argument, a boolean \m{true} or \m{false} is
-% returned with \m{true} for when there is a colon in the function
-% and \m{false} if there is not. Lastly, the second argument of
-% |\cs_split_function:NN| is supposed to be a function
-% taking three variables, one for name, one for signature, and one
-% for the boolean. For example,
-% "\cs_split_function:NN\foo_bar:cnx\use_i:nnn" as input
-% becomes "\use_i:nnn {foo_bar}{cnx}\c_true_bool".
-%
-% Can't use a literal ":" because it has the wrong catcode here, so
-% it's transformed from "@" with "\tex_lowercase:D".
-% \begin{macrocode}
-\group_begin:
- \tex_lccode:D `\@ = `\: \scan_stop:
- \tex_catcode:D `\@ = 12~
-\tex_lowercase:D {
- \group_end:
-% \end{macrocode}
-% First ensure that we actually get a properly evaluated str as we
-% don't know how many expansions |\cs_to_str:N| requires. Insert
-% extra colon to catch the error cases.
-% \begin{macrocode}
-\cs_set:Npn \cs_split_function:NN #1#2{
- \exp_after:wN \cs_split_function_aux:w
- \tex_romannumeral:D -`\q \cs_to_str:N #1 @a \q_stop #2
-}
-% \end{macrocode}
-% If no colon in the name, |#2| is |a| with catcode 11 and |#3| is
-% empty. If colon in the name, then either |#2| is a colon or the
-% first letter of the signature. The letters here have catcode 12.
-% If a colon was given we need to a) split off the colon and quark at
-% the end and b) ensure we return the name, signature and boolean true
-% We can't use |\quark_if_no_value:NTF| yet but this is very safe
-% anyway as all tokens have catcode~12.
-% \begin{macrocode}
-\cs_set:Npn \cs_split_function_aux:w #1@#2#3\q_stop#4{
- \if_meaning:w a#2
- \exp_after:wN \use_i:nn
- \else:
- \exp_after:wN\use_ii:nn
- \fi:
- {#4{#1}{}\c_false_bool}
- {\cs_split_function_auxii:w#2#3\q_stop #4{#1}}
-}
-\cs_set:Npn \cs_split_function_auxii:w #1@a\q_stop#2#3{
- #2{#3}{#1}\c_true_bool
-}
-% \end{macrocode}
-% End of lowercase
-% \begin{macrocode}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_get_function_name:N, \cs_get_function_signature:N }
-% Now returning the name is trivial: just discard the last two
-% arguments. Similar for signature.
-% \begin{macrocode}
-\cs_set:Npn \cs_get_function_name:N #1 {
- \cs_split_function:NN #1\use_i:nnn
-}
-\cs_set:Npn \cs_get_function_signature:N #1 {
- \cs_split_function:NN #1\use_ii:nnn
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Exist or free}
-%
-% A control sequence is said to \emph{exist} (to be used) if has an entry in
-% the hash table and its meaning is different from the primitive
-% "\tex_relax:D" token. A control sequence is said to be \emph{free}
-% (to be defined) if it does not already exist and also meets the
-% requirement that it does not contain a "D" signature. The reasoning
-% behind this is that most of the time, a check for a free control
-% sequence is when we wish to make a new control sequence and we do
-% not want to let the user define a new ``do not use'' control
-% sequence.
-%
-% \begin{macro}{\cs_if_exist_p:N,\cs_if_exist_p:c}
-% \begin{macro}[TF]{\cs_if_exist:N,\cs_if_exist:c}
-% Two versions for checking existence. For the "N" form we firstly
-% check for "\tex_relax:D" and then if it is in the hash
-% table. There is no problem when inputting something like "\else:"
-% or "\fi:" as \TeX\ will only ever skip input in case the token
-% tested against is "\tex_relax:D".
-% \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_exist:N #1 {p,TF,T,F}{
- \if_meaning:w #1\tex_relax:D
- \prg_return_false:
- \else:
- \if_cs_exist:N #1
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
- \fi:
-}
-% \end{macrocode}
-% For the "c" form we firstly check if it is in the hash table and
-% then for "\tex_relax:D" so that we do not add it to the hash table
-% unless it was already there. Here we have to be careful as the text
-% to be skipped if the first test is false may contain tokens that
-% disturb the scanner. Therefore, we ensure that the second test is
-% performed after the first one has concluded completely.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_exist:c #1 {p,TF,T,F}{
- \if_cs_exist:w #1 \cs_end:
- \exp_after:wN \use_i:nn
- \else:
- \exp_after:wN \use_ii:nn
- \fi:
- {
- \exp_after:wN \if_meaning:w \cs:w #1\cs_end: \tex_relax:D
- \prg_return_false:
- \else:
- \prg_return_true:
- \fi:
- }
- \prg_return_false:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_if_do_not_use_p:N}
-% \begin{macro}[aux]{\cs_if_do_not_use_aux:nnN}
-% \begin{macrocode}
-\cs_set:Npn \cs_if_do_not_use_p:N #1{
- \cs_split_function:NN #1 \cs_if_do_not_use_aux:nnN
-}
-\cs_set:Npn \cs_if_do_not_use_aux:nnN #1#2#3{
- \str_if_eq_p:nn { D } {#2}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_if_free_p:N,\cs_if_free_p:c}
-% \begin{macro}[TF]{\cs_if_free:N,\cs_if_free:c}
-% The simple implementation is one using the boolean expression
-% parser: If it is exists or is do not use, then return false.
-% \begin{verbatim}
-% \prg_set_conditional:Npnn \cs_if_free:N #1{p,TF,T,F}{
-% \bool_if:nTF {\cs_if_exist_p:N #1 || \cs_if_do_not_use_p:N #1}
-% {\prg_return_false:}{\prg_return_true:}
-% }
-% \end{verbatim}
-% However, this functionality may not be available this early on. We
-% do something similar: The numerical values of true and false is one
-% and zero respectively, which we can use. The problem again here is
-% that the token we are checking may in fact be something that can
-% disturb the scanner, so we have to be careful. We would like to do
-% minimal evaluation so we ensure this.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_free:N #1{p,TF,T,F}{
- \tex_ifnum:D \cs_if_exist_p:N #1 =\c_zero
- \exp_after:wN \use_i:nn
- \else:
- \exp_after:wN \use_ii:nn
- \fi:
- {
- \tex_ifnum:D \cs_if_do_not_use_p:N #1 =\c_zero
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
- }
- \prg_return_false:
-}
-\cs_set_nopar:Npn \cs_if_free_p:c{\exp_args:Nc\cs_if_free_p:N}
-\cs_set_nopar:Npn \cs_if_free:cTF{\exp_args:Nc\cs_if_free:NTF}
-\cs_set_nopar:Npn \cs_if_free:cT{\exp_args:Nc\cs_if_free:NT}
-\cs_set_nopar:Npn \cs_if_free:cF{\exp_args:Nc\cs_if_free:NF}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Defining and checking (new) functions}
-%
-% \begin{macro}{\c_minus_one, \c_zero, \c_sixteen}
-% \begin{macro}{\c_six, \c_seven, \c_twelve}
-% We need the constants |\c_minus_one| and |\c_sixteen| now for
-% writing information to the log and the terminal and |\c_zero|
-% which is used by some functions in the \textsf{l3alloc} module. The
-% rest are defined in the \textsf{l3int} module -- at least for the
-% ones that can be defined with |\tex_chardef:D| or
-% |\tex_mathchardef:D|. For other constants the \textsf{l3int} module is
-% required but it can't be used until the allocation has been set
-% up properly! The actual allocation mechanism is in
-% \textsf{l3alloc} and as \TeX{} wants to reserve count registers
-% 0--9, the first available one is~10 so we use that for
-% |\c_minus_one|.
-% \begin{macrocode}
-%<*!initex>
-\cs_set_eq:NwN \c_minus_one\m@ne
-%</!initex>
-%<*!package>
-\tex_countdef:D \c_minus_one = 10 ~
-\c_minus_one = -1 ~
-%</!package>
-\tex_chardef:D \c_sixteen = 16~
-\tex_chardef:D \c_zero = 0~
-\tex_chardef:D \c_six = 6~
-\tex_chardef:D \c_seven = 7~
-\tex_chardef:D \c_twelve = 12~
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\c_max_register_int}
-% This is here as this particular integer is needed both in package
-% mode and to bootstrap \pkg{l3alloc}
-% \begin{macrocode}
-\tex_mathchardef:D \c_max_register_int = 32767 \tex_relax:D
-% \end{macrocode}
-% \end{macro}
-%
-% We provide two kinds of functions that can be used to define
-% control sequences. On the one hand we have functions that check
-% if their argument doesn't already exist, they are called
-% |\..._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
-% only temporary, they will be redefined later on.
-%
-% \begin{macro}{\iow_log:x}
-% \begin{macro}{\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.
-%
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \iow_log:x {
- \tex_immediate:D \iow_shipout_x:Nn \c_minus_one
-}
-\cs_set_protected_nopar:Npn \iow_term:x {
- \tex_immediate:D \iow_shipout_x:Nn \c_sixteen
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\msg_kernel_bug:x}
-% This will show internal errors.
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \msg_kernel_bug:x #1 {
- \iow_term:x { This~is~a~LaTeX~bug:~check~coding! }
- \tex_errmessage:D {#1}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\cs_record_meaning:N}
-% This macro will be used later on for tracing purposes. But we
-% need some more modules to define it, so we just give some dummy
-% definition here.
-% \begin{macrocode}
-%<*trace>
-\cs_set:Npn \cs_record_meaning:N #1{}
-%</trace>
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\chk_if_free_cs:N}
-% \begin{macro}{\chk_if_free_cs:c}
-% This command is called by |\cs_new_nopar:Npn| and |\cs_new_eq:NN| etc.\
-% to make sure that the argument sequence is not already in use. If
-% it is, an error is signalled. It checks if \m{csname} is
-% undefined or |\scan_stop:|. Otherwise an error message is
-% 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}
-\cs_set_protected_nopar:Npn \chk_if_free_cs:N #1{
- \cs_if_free:NF #1
- {
- \msg_kernel_bug:x {Command~name~`\token_to_str:N #1'~already~defined!~
- Current~meaning: \\ \c_space_tl \c_space_tl \token_to_meaning:N #1
- }
- }
-%<*trace>
- \cs_record_meaning:N#1
-% \iow_term:x{Defining~\token_to_str:N #1~on~%}
- \iow_log:x{Defining~\token_to_str:N #1~on~
- line~\tex_the:D \tex_inputlineno:D}
-%</trace>
-}
-\cs_set_protected_nopar:Npn \chk_if_free_cs:c {
- \exp_args:Nc \chk_if_free_cs:N
-}
-%<*package>
-\tex_ifodd:D \@l@expl@log@functions@bool \else
- \cs_set_protected_nopar:Npn \chk_if_free_cs:N #1 {
- \cs_if_free:NF #1
- {
- \msg_kernel_bug:x
- {
- Command~name~`\token_to_str:N #1'~already~defined!~
- Current~meaning: \\ \c_space_tl \c_space_tl \token_to_meaning:N #1
- }
- }
- }
-\fi
-%</package>
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\chk_if_exist_cs:N }
-% \begin{macro}{\chk_if_exist_cs:c }
-% This function issues a warning message when the control sequence
-% in its argument does not exist.
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \chk_if_exist_cs:N #1 {
- \cs_if_exist:NF #1
- {
- \msg_kernel_bug:x {Command~ `\token_to_str:N #1'~
- not~ yet~ defined!}
- }
-}
-\cs_set_protected_nopar:Npn \chk_if_exist_cs:c {
- \exp_args:Nc \chk_if_exist_cs:N
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}{\str_if_eq_p:nn}
-%\begin{macro}[TF]{\str_if_eq:nn}
-%\begin{macro}{\str_if_eq_p:xx}
-%\begin{macro}[TF]{\str_if_eq:xx}
-% Modern engines provide a direct way of comparing two token lists,
-% but returning a number. This set of conditionals therefore make life
-% a bit clearer. The \texttt{nn} and \texttt{xx} versions are created
-% directly as this is most efficient.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF } {
- \tex_ifnum:D \pdf_strcmp:D
- { \etex_unexpanded:D {#1} } { \etex_unexpanded:D {#2} }
- = \c_zero
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\prg_set_conditional:Npnn \str_if_eq:xx #1#2 { p , T , F , TF } {
- \tex_ifnum:D \pdf_strcmp:D {#1} {#2} = \c_zero
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macro}{\cs_if_eq_name_p:NN}
-% An application of the above function, already streamlined for
-% speed, so I put it in here.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_eq_name:NN #1#2{p}{
- \str_if_eq_p:nn {#1} {#2}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{More new definitions}
-%
-% \begin{macro}{\cs_new_nopar:Npn}
-% \begin{macro}{\cs_new_nopar:Npx}
-% \begin{macro}{\cs_new:Npn}
-% \begin{macro}{\cs_new:Npx}
-% \begin{macro}{\cs_new_protected_nopar:Npn}
-% \begin{macro}{\cs_new_protected_nopar:Npx}
-% \begin{macro}{\cs_new_protected:Npn}
-% \begin{macro}{\cs_new_protected:Npx}
-% Global versions of the above functions.
-% \begin {macrocode}
-\cs_set:Npn \cs_tmp:w #1#2 {
- \cs_set_protected_nopar:Npn #1 ##1
- {
- \chk_if_free_cs:N ##1
- #2 ##1
- }
-}
-\cs_tmp:w \cs_new_nopar:Npn \cs_gset_nopar:Npn
-\cs_tmp:w \cs_new_nopar:Npx \cs_gset_nopar:Npx
-\cs_tmp:w \cs_new:Npn \cs_gset:Npn
-\cs_tmp:w \cs_new:Npx \cs_gset:Npx
-\cs_tmp:w \cs_new_protected_nopar:Npn \cs_gset_protected_nopar:Npn
-\cs_tmp:w \cs_new_protected_nopar:Npx \cs_gset_protected_nopar:Npx
-\cs_tmp:w \cs_new_protected:Npn \cs_gset_protected:Npn
-\cs_tmp:w \cs_new_protected:Npx \cs_gset_protected:Npx
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\cs_set_nopar:cpn}
-% \begin{macro}{\cs_set_nopar:cpx}
-% \begin{macro}{\cs_gset_nopar:cpn}
-% \begin{macro}{\cs_gset_nopar:cpx}
-% \begin{macro}{\cs_new_nopar:cpn}
-% \begin{macro}{\cs_new_nopar:cpx}
-% Like |\cs_set_nopar:Npn| and |\cs_new_nopar:Npn|, except that the
-% first argument consists of the sequence of characters that should
-% be used to form the name of the desired control sequence (the |c|
-% stands for csname argument, see the expansion module). Global
-% versions are also provided.
-%
-% |\cs_set_nopar:cpn|\m{string}\m{rep-text} will turn \m{string}
-% into a csname and then assign \m {rep-text} to it by using
-% |\cs_set_nopar:Npn|. This means that there might be a parameter
-% string between the two arguments.
-% \begin{macrocode}
-\cs_set:Npn \cs_tmp:w #1#2{
- \cs_new_protected_nopar:Npn #1 { \exp_args:Nc #2 }
-}
-\cs_tmp:w \cs_set_nopar:cpn \cs_set_nopar:Npn
-\cs_tmp:w \cs_set_nopar:cpx \cs_set_nopar:Npx
-\cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn
-\cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx
-\cs_tmp:w \cs_new_nopar:cpn \cs_new_nopar:Npn
-\cs_tmp:w \cs_new_nopar:cpx \cs_new_nopar:Npx
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\cs_set:cpn}
-% \begin{macro}{\cs_set:cpx}
-% \begin{macro}{\cs_gset:cpn}
-% \begin{macro}{\cs_gset:cpx}
-% \begin{macro}{\cs_new:cpn}
-% \begin{macro}{\cs_new:cpx}
-% Variants of the |\cs_set:Npn| versions which make a csname out
-% of the first arguments. We may also do this globally.
-% \begin{macrocode}
-\cs_tmp:w \cs_set:cpn \cs_set:Npn
-\cs_tmp:w \cs_set:cpx \cs_set:Npx
-\cs_tmp:w \cs_gset:cpn \cs_gset:Npn
-\cs_tmp:w \cs_gset:cpx \cs_gset:Npx
-\cs_tmp:w \cs_new:cpn \cs_new:Npn
-\cs_tmp:w \cs_new:cpx \cs_new:Npx
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_set_protected_nopar:cpn}
-% \begin{macro}{\cs_set_protected_nopar:cpx}
-% \begin{macro}{\cs_gset_protected_nopar:cpn}
-% \begin{macro}{\cs_gset_protected_nopar:cpx}
-% \begin{macro}{\cs_new_protected_nopar:cpn}
-% \begin{macro}{\cs_new_protected_nopar:cpx}
-% Variants of the |\cs_set_protected_nopar:Npn| versions which make a csname
-% out of the first arguments. We may also do this globally.
-% \begin{macrocode}
-\cs_tmp:w \cs_set_protected_nopar:cpn \cs_set_protected_nopar:Npn
-\cs_tmp:w \cs_set_protected_nopar:cpx \cs_set_protected_nopar:Npx
-\cs_tmp:w \cs_gset_protected_nopar:cpn \cs_gset_protected_nopar:Npn
-\cs_tmp:w \cs_gset_protected_nopar:cpx \cs_gset_protected_nopar:Npx
-\cs_tmp:w \cs_new_protected_nopar:cpn \cs_new_protected_nopar:Npn
-\cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_set_protected:cpn}
-% \begin{macro}{\cs_set_protected:cpx}
-% \begin{macro}{\cs_gset_protected:cpn}
-% \begin{macro}{\cs_gset_protected:cpx}
-% \begin{macro}{\cs_new_protected:cpn}
-% \begin{macro}{\cs_new_protected:cpx}
-% Variants of the |\cs_set_protected:Npn| versions which make a csname
-% out of the first arguments. We may also do this globally.
-% \begin{macrocode}
-\cs_tmp:w \cs_set_protected:cpn \cs_set_protected:Npn
-\cs_tmp:w \cs_set_protected:cpx \cs_set_protected:Npx
-\cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn
-\cs_tmp:w \cs_gset_protected:cpx \cs_gset_protected:Npx
-\cs_tmp:w \cs_new_protected:cpn \cs_new_protected:Npn
-\cs_tmp:w \cs_new_protected:cpx \cs_new_protected:Npx
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% BACKWARDS COMPATIBILITY:
-% \begin{macrocode}
-\cs_set_eq:NwN \cs_gnew_nopar:Npn \cs_new_nopar:Npn
-\cs_set_eq:NwN \cs_gnew:Npn \cs_new:Npn
-\cs_set_eq:NwN \cs_gnew_protected_nopar:Npn \cs_new_protected_nopar:Npn
-\cs_set_eq:NwN \cs_gnew_protected:Npn \cs_new_protected:Npn
-\cs_set_eq:NwN \cs_gnew_nopar:Npx \cs_new_nopar:Npx
-\cs_set_eq:NwN \cs_gnew:Npx \cs_new:Npx
-\cs_set_eq:NwN \cs_gnew_protected_nopar:Npx \cs_new_protected_nopar:Npx
-\cs_set_eq:NwN \cs_gnew_protected:Npx \cs_new_protected:Npx
-\cs_set_eq:NwN \cs_gnew_nopar:cpn \cs_new_nopar:cpn
-\cs_set_eq:NwN \cs_gnew:cpn \cs_new:cpn
-\cs_set_eq:NwN \cs_gnew_protected_nopar:cpn \cs_new_protected_nopar:cpn
-\cs_set_eq:NwN \cs_gnew_protected:cpn \cs_new_protected:cpn
-\cs_set_eq:NwN \cs_gnew_nopar:cpx \cs_new_nopar:cpx
-\cs_set_eq:NwN \cs_gnew:cpx \cs_new:cpx
-\cs_set_eq:NwN \cs_gnew_protected_nopar:cpx \cs_new_protected_nopar:cpx
-\cs_set_eq:NwN \cs_gnew_protected:cpx \cs_new_protected:cpx
-% \end{macrocode}
-%
-%
-% \begin{macro}[aux]{\use_0_parameter:}
-% \begin{macro}[aux]{\use_1_parameter:}
-% \begin{macro}[aux]{\use_2_parameter:}
-% \begin{macro}[aux]{\use_3_parameter:}
-% \begin{macro}[aux]{\use_4_parameter:}
-% \begin{macro}[aux]{\use_5_parameter:}
-% \begin{macro}[aux]{\use_6_parameter:}
-% \begin{macro}[aux]{\use_7_parameter:}
-% \begin{macro}[aux]{\use_8_parameter:}
-% \begin{macro}[aux]{\use_9_parameter:}
-% For using parameters, i.e., when you need to define a function to
-% process three parameters. See \textsf{xparse} for an application.
-% \begin{macrocode}
-\cs_set_nopar:cpn{use_0_parameter:}{}
-\cs_set_nopar:cpn{use_1_parameter:}{{##1}}
-\cs_set_nopar:cpn{use_2_parameter:}{{##1}{##2}}
-\cs_set_nopar:cpn{use_3_parameter:}{{##1}{##2}{##3}}
-\cs_set_nopar:cpn{use_4_parameter:}{{##1}{##2}{##3}{##4}}
-\cs_set_nopar:cpn{use_5_parameter:}{{##1}{##2}{##3}{##4}{##5}}
-\cs_set_nopar:cpn{use_6_parameter:}{{##1}{##2}{##3}{##4}{##5}{##6}}
-\cs_set_nopar:cpn{use_7_parameter:}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}
-\cs_set_nopar:cpn{use_8_parameter:}{
- {##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}}
-\cs_set_nopar:cpn{use_9_parameter:}{
- {##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Copying definitions}
-%
-% \begin{macro}{\cs_set_eq:NN}
-% \begin{macro}{\cs_set_eq:cN}
-% \begin{macro}{\cs_set_eq:Nc}
-% \begin{macro}{\cs_set_eq:cc}
-% These macros allow us to copy the definition of a control sequence
-% to another control sequence.
-%
-% The |=| sign allows us to define funny char tokens like |=|
-% itself or \verb*= = with this function. For the definition of
-% |\c_space_chartok{~}| to work we need the |~| after the |=|.
-%
-% |\cs_set_eq:NN| is long to avoid problems with a literal argument
-% of |\par|. While |\cs_new_eq:NN| will probably never be correct
-% with a first argument of |\par|, define it long in order to throw
-% an `already defined' error rather than `runaway argument'.
-%
-% The |c| variants are not protected in order for their arguments to
-% be constructed in the correct context.
-%
-% \begin{macrocode}
-\cs_set_protected:Npn \cs_set_eq:NN #1 { \cs_set_eq:NwN #1=~ }
-\cs_set_protected_nopar:Npn \cs_set_eq:cN { \exp_args:Nc \cs_set_eq:NN }
-\cs_set_protected_nopar:Npn \cs_set_eq:Nc { \exp_args:NNc \cs_set_eq:NN }
-\cs_set_protected_nopar:Npn \cs_set_eq:cc { \exp_args:Ncc \cs_set_eq:NN }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_new_eq:NN}
-% \begin{macro}{\cs_new_eq:cN}
-% \begin{macro}{\cs_new_eq:Nc}
-% \begin{macro}{\cs_new_eq:cc}
-% \begin{macrocode}
-\cs_new_protected:Npn \cs_new_eq:NN #1 {
- \chk_if_free_cs:N #1
- \pref_global:D \cs_set_eq:NN #1
-}
-\cs_new_protected_nopar:Npn \cs_new_eq:cN { \exp_args:Nc \cs_new_eq:NN }
-\cs_new_protected_nopar:Npn \cs_new_eq:Nc { \exp_args:NNc \cs_new_eq:NN }
-\cs_new_protected_nopar:Npn \cs_new_eq:cc { \exp_args:Ncc \cs_new_eq:NN }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_gset_eq:NN}
-% \begin{macro}{\cs_gset_eq:cN}
-% \begin{macro}{\cs_gset_eq:Nc}
-% \begin{macro}{\cs_gset_eq:cc}
-% \begin{macrocode}
-\cs_new_protected:Npn \cs_gset_eq:NN { \pref_global:D \cs_set_eq:NN }
-\cs_new_protected_nopar:Npn \cs_gset_eq:Nc { \exp_args:NNc \cs_gset_eq:NN }
-\cs_new_protected_nopar:Npn \cs_gset_eq:cN { \exp_args:Nc \cs_gset_eq:NN }
-\cs_new_protected_nopar:Npn \cs_gset_eq:cc { \exp_args:Ncc \cs_gset_eq:NN }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% BACKWARDS COMPATIBILITY
-% \begin{macrocode}
-\cs_set_eq:NN \cs_gnew_eq:NN \cs_new_eq:NN
-\cs_set_eq:NN \cs_gnew_eq:cN \cs_new_eq:cN
-\cs_set_eq:NN \cs_gnew_eq:Nc \cs_new_eq:Nc
-\cs_set_eq:NN \cs_gnew_eq:cc \cs_new_eq:cc
-% \end{macrocode}
-%
-% \subsection{Undefining functions}
-%
-% \begin{macro}{\cs_undefine:N , \cs_undefine:c }
-% \begin{macro}{\cs_gundefine:N , \cs_gundefine:c }
-% The following function is used to free the main memory from the
-% definition of some function that isn't in use any longer.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \cs_undefine:N #1 {
- \cs_set_eq:NN #1 \c_undefined:D
-}
-\cs_new_protected_nopar:Npn \cs_undefine:c #1 {
- \cs_set_eq:cN {#1} \c_undefined:D
-}
-\cs_new_protected_nopar:Npn \cs_gundefine:N #1 {
- \cs_gset_eq:NN #1 \c_undefined:D
-}
-\cs_new_protected_nopar:Npn \cs_gundefine:c #1 {
- \cs_gset_eq:cN {#1} \c_undefined:D
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Diagnostic wrapper functions}
-%
-% \begin{macro}{\kernel_register_show:N,\kernel_register_show:c}
-% \begin{macrocode}
-\cs_new_nopar:Npn \kernel_register_show:N #1 {
- \cs_if_exist:NTF #1
- {
- \tex_showthe:D #1
- }
- {
- \msg_kernel_bug:x {Register~ `\token_to_str:N #1'~ is~ not~ defined.}
- }
-}
-\cs_new_nopar:Npn \kernel_register_show:c { \exp_args:Nc \int_show:N }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsection{Engine specific definitions}
-%
-% \begin{macro}{\c_xetex_is_engine_bool,\c_luatex_is_engine_bool}
-% \begin{macro}[TF]{\xetex_if_engine:,\luatex_if_engine:}
-% In some cases it will be useful to know which engine we're running.
-% Don't provide a "_p" predicate because the "_bool" is used for the
-% same thing.
-% \begin{macrocode}
-\cs_if_exist:NTF \xetex_version:D
- { \cs_new_eq:NN \c_xetex_is_engine_bool \c_true_bool }
- { \cs_new_eq:NN \c_xetex_is_engine_bool \c_false_bool }
-\prg_new_conditional:Npnn \xetex_if_engine: {TF,T,F} {
- \if_bool:N \c_xetex_is_engine_bool
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_if_exist:NTF \luatex_directlua:D
- { \cs_new_eq:NN \c_luatex_is_engine_bool \c_true_bool }
- { \cs_new_eq:NN \c_luatex_is_engine_bool \c_false_bool }
-\prg_set_conditional:Npnn \xetex_if_engine: {TF,T,F}{
- \if_bool:N \c_xetex_is_engine_bool \prg_return_true:
- \else: \prg_return_false: \fi:
-}
-\prg_set_conditional:Npnn \luatex_if_engine: {TF,T,F}{
- \if_bool:N \c_luatex_is_engine_bool \prg_return_true:
- \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-% \subsection{Scratch functions}
-%
-% \begin{macro}{\prg_do_nothing:}
-% I don't think this function belongs here, but one place is as
-% good as any other. I want to use this function when I want to
-% express `no operation'. It is for example used in templates where
-% depending on the users settings we have to either select an function that
-% does something, or one that does nothing.
-% \begin{macrocode}
-\cs_new_nopar:Npn \prg_do_nothing: {}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsection{Defining functions from a given number of arguments}
-%
-% \begin{macro}{\cs_get_arg_count_from_signature:N}
-% \begin{macro}[aux]{\cs_get_arg_count_from_signature_aux:nnN}
-% \begin{macro}[aux]{\cs_get_arg_count_from_signature_auxii:w}
-% Counting the number of tokens in the signature, i.e., the number
-% of arguments the function should take. If there is no signature,
-% we return that there is $-1$ arguments to signal an error.
-% Otherwise we insert the string |9876543210| after the signature.
-% If the signature is empty, the number we want is $0$ so we remove
-% the first nine tokens and return the tenth. Similarly, if the
-% signature is |nnn| we want to remove the nine tokens |nnn987654|
-% and return $3$. Therefore, we simply remove the first nine tokens
-% and then return the tenth.
-% \begin{macrocode}
-\cs_set:Npn \cs_get_arg_count_from_signature:N #1{
- \cs_split_function:NN #1 \cs_get_arg_count_from_signature_aux:nnN
-}
-\cs_set:Npn \cs_get_arg_count_from_signature_aux:nnN #1#2#3{
- \if_predicate:w #3 % \bool_if:NTF here
- \exp_after:wN \use_i:nn
- \else:
- \exp_after:wN\use_ii:nn
- \fi:
- {
- \exp_after:wN \cs_get_arg_count_from_signature_auxii:w
- \use_none:nnnnnnnnn #2 9876543210\q_stop
- }
- {-1}
-}
-\cs_set:Npn \cs_get_arg_count_from_signature_auxii:w #1#2\q_stop{#1}
-% \end{macrocode}
-% A variant form we need right away.
-% \begin{macrocode}
-\cs_set_nopar:Npn \cs_get_arg_count_from_signature:c {
- \exp_args:Nc \cs_get_arg_count_from_signature:N
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}[aux]{\cs_generate_from_arg_count:NNnn}
-% \begin{macro}[aux]{\cs_generate_from_arg_count_error_msg:Nn}
-% We provide a constructor function for defining functions with a
-% given number of arguments. For this we need to choose the correct
-% parameter text and then use that when defining. Since \TeX\
-% supports from zero to nine arguments, we use a simple switch to
-% choose the correct parameter text, ensuring the result is returned
-% after finishing the conditional. If it is not between zero and
-% nine, we throw an error.
-%
-% 1: function to define, 2: with what to define it, 3: the number of
-% args it requires and 4: the replacement text
-% \begin{macrocode}
-\cs_set:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4{
- \tex_ifcase:D \etex_numexpr:D #3\tex_relax:D
- \use_i_after_orelse:nw{#2#1}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3##4}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3##4##5}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3##4##5##6}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3##4##5##6##7}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3##4##5##6##7##8}
- \or:
- \use_i_after_orelse:nw{#2#1 ##1##2##3##4##5##6##7##8##9}
- \else:
- \use_i_after_fi:nw{
- \cs_generate_from_arg_count_error_msg:Nn#1{#3}
- \use_none:n % to remove replacement text
- }
- \fi:
- {#4}
-}
-% \end{macrocode}
-% A variant form we need right away.
-% \begin{macrocode}
-\cs_set_nopar:Npn \cs_generate_from_arg_count:cNnn {
- \exp_args:Nc \cs_generate_from_arg_count:NNnn
-}
-% \end{macrocode}
-% The error message. Elsewhere we use the value of $-1$ to signal a
-% missing colon in a function, so provide a hint for help on this.
-% \begin{macrocode}
-\cs_set:Npn \cs_generate_from_arg_count_error_msg:Nn #1#2 {
- \msg_kernel_bug:x {
- You're~ trying~ to~ define~ the~ command~ `\token_to_str:N #1'~
- with~ \use:n{\tex_the:D\etex_numexpr:D #2\tex_relax:D} ~
- arguments~ but~ I~ only~ allow~ 0-9~arguments.~Perhaps~you~
- forgot~to~use~a~colon~in~the~function~name?~
- I~ can~ probably~ not~ help~ you~ here
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-% \subsection{Using the signature to define functions}
-%
-% We can now combine some of the tools we have to provide a simple
-% interface for defining functions. We define some simpler functions
-% with user interface |\cs_set:Nn \foo_bar:nn {#1,#2}|, i.e., the
-% number of arguments is read from the signature.
-%
-%
-% \begin{macro}{\cs_set:Nn}
-% \begin{macro}{\cs_set:Nx}
-% \begin{macro}{\cs_set_nopar:Nn}
-% \begin{macro}{\cs_set_nopar:Nx}
-% \begin{macro}{\cs_set_protected:Nn}
-% \begin{macro}{\cs_set_protected:Nx}
-% \begin{macro}{\cs_set_protected_nopar:Nn}
-% \begin{macro}{\cs_set_protected_nopar:Nx}
-% \begin{macro}{\cs_gset:Nn}
-% \begin{macro}{\cs_gset:Nx}
-% \begin{macro}{\cs_gset_nopar:Nn}
-% \begin{macro}{\cs_gset_nopar:Nx}
-% \begin{macro}{\cs_gset_protected:Nn}
-% \begin{macro}{\cs_gset_protected:Nx}
-% \begin{macro}{\cs_gset_protected_nopar:Nn}
-% \begin{macro}{\cs_gset_protected_nopar:Nx}
-% We want to define |\cs_set:Nn| as
-% \begin{verbatim}
-% \cs_set_protected:Npn \cs_set:Nn #1#2{
-% \cs_generate_from_arg_count:NNnn #1\cs_set:Npn
-% {\cs_get_arg_count_from_signature:N #1}{#2}
-% }
-% \end{verbatim}
-% In short, to define |\cs_set:Nn| we need just use |\cs_set:Npn|,
-% everything else is the same for each variant. Therefore, we can
-% make it simpler by temporarily defining a function to do this for
-% us.
-% \begin{macrocode}
-\cs_set:Npn \cs_tmp:w #1#2#3{
- \cs_set_protected:cpx {cs_#1:#2}##1##2{
- \exp_not:N \cs_generate_from_arg_count:NNnn ##1
- \exp_after:wN \exp_not:N \cs:w cs_#1:#3 \cs_end:
- {\exp_not:N\cs_get_arg_count_from_signature:N ##1}{##2}
- }
-}
-% \end{macrocode}
-% Then we define the 32 variants beginning with |N|.
-% \begin{macrocode}
-\cs_tmp:w {set}{Nn}{Npn}
-\cs_tmp:w {set}{Nx}{Npx}
-\cs_tmp:w {set_nopar}{Nn}{Npn}
-\cs_tmp:w {set_nopar}{Nx}{Npx}
-\cs_tmp:w {set_protected}{Nn}{Npn}
-\cs_tmp:w {set_protected}{Nx}{Npx}
-\cs_tmp:w {set_protected_nopar}{Nn}{Npn}
-\cs_tmp:w {set_protected_nopar}{Nx}{Npx}
-\cs_tmp:w {gset}{Nn}{Npn}
-\cs_tmp:w {gset}{Nx}{Npx}
-\cs_tmp:w {gset_nopar}{Nn}{Npn}
-\cs_tmp:w {gset_nopar}{Nx}{Npx}
-\cs_tmp:w {gset_protected}{Nn}{Npn}
-\cs_tmp:w {gset_protected}{Nx}{Npx}
-\cs_tmp:w {gset_protected_nopar}{Nn}{Npn}
-\cs_tmp:w {gset_protected_nopar}{Nx}{Npx}
-% \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}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_new:Nn}
-% \begin{macro}{\cs_new:Nx}
-% \begin{macro}{\cs_new_nopar:Nn}
-% \begin{macro}{\cs_new_nopar:Nx}
-% \begin{macro}{\cs_new_protected:Nn}
-% \begin{macro}{\cs_new_protected:Nx}
-% \begin{macro}{\cs_new_protected_nopar:Nn}
-% \begin{macro}{\cs_new_protected_nopar:Nx}
-% \begin{macrocode}
-\cs_tmp:w {new}{Nn}{Npn}
-\cs_tmp:w {new}{Nx}{Npx}
-\cs_tmp:w {new_nopar}{Nn}{Npn}
-\cs_tmp:w {new_nopar}{Nx}{Npx}
-\cs_tmp:w {new_protected}{Nn}{Npn}
-\cs_tmp:w {new_protected}{Nx}{Npx}
-\cs_tmp:w {new_protected_nopar}{Nn}{Npn}
-\cs_tmp:w {new_protected_nopar}{Nx}{Npx}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% Then something similar for the |c| variants.
-% \begin{verbatim}
-% \cs_set_protected:Npn \cs_set:cn #1#2{
-% \cs_generate_from_arg_count:cNnn {#1}\cs_set:Npn
-% {\cs_get_arg_count_from_signature:c {#1}}{#2}
-% }
-% \end{verbatim}
-% \begin{macrocode}
-\cs_set:Npn \cs_tmp:w #1#2#3{
- \cs_set_protected:cpx {cs_#1:#2}##1##2{
- \exp_not:N\cs_generate_from_arg_count:cNnn {##1}
- \exp_after:wN \exp_not:N \cs:w cs_#1:#3 \cs_end:
- {\exp_not:N\cs_get_arg_count_from_signature:c {##1}}{##2}
- }
-}
-% \end{macrocode}
-% \begin{macro}{\cs_set:cn}
-% \begin{macro}{\cs_set:cx}
-% \begin{macro}{\cs_set_nopar:cn}
-% \begin{macro}{\cs_set_nopar:cx}
-% \begin{macro}{\cs_set_protected:cn}
-% \begin{macro}{\cs_set_protected:cx}
-% \begin{macro}{\cs_set_protected_nopar:cn}
-% \begin{macro}{\cs_set_protected_nopar:cx}
-% \begin{macro}{\cs_gset:cn}
-% \begin{macro}{\cs_gset:cx}
-% \begin{macro}{\cs_gset_nopar:cn}
-% \begin{macro}{\cs_gset_nopar:cx}
-% \begin{macro}{\cs_gset_protected:cn}
-% \begin{macro}{\cs_gset_protected:cx}
-% \begin{macro}{\cs_gset_protected_nopar:cn}
-% \begin{macro}{\cs_gset_protected_nopar:cx}
-% The 32 |c| variants.
-% \begin{macrocode}
-\cs_tmp:w {set}{cn}{Npn}
-\cs_tmp:w {set}{cx}{Npx}
-\cs_tmp:w {set_nopar}{cn}{Npn}
-\cs_tmp:w {set_nopar}{cx}{Npx}
-\cs_tmp:w {set_protected}{cn}{Npn}
-\cs_tmp:w {set_protected}{cx}{Npx}
-\cs_tmp:w {set_protected_nopar}{cn}{Npn}
-\cs_tmp:w {set_protected_nopar}{cx}{Npx}
-\cs_tmp:w {gset}{cn}{Npn}
-\cs_tmp:w {gset}{cx}{Npx}
-\cs_tmp:w {gset_nopar}{cn}{Npn}
-\cs_tmp:w {gset_nopar}{cx}{Npx}
-\cs_tmp:w {gset_protected}{cn}{Npn}
-\cs_tmp:w {gset_protected}{cx}{Npx}
-\cs_tmp:w {gset_protected_nopar}{cn}{Npn}
-\cs_tmp:w {gset_protected_nopar}{cx}{Npx}
-% \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}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_new:cn}
-% \begin{macro}{\cs_new:cx}
-% \begin{macro}{\cs_new_nopar:cn}
-% \begin{macro}{\cs_new_nopar:cx}
-% \begin{macro}{\cs_new_protected:cn}
-% \begin{macro}{\cs_new_protected:cx}
-% \begin{macro}{\cs_new_protected_nopar:cn}
-% \begin{macro}{\cs_new_protected_nopar:cx}
-% \begin{macrocode}
-\cs_tmp:w {new}{cn}{Npn}
-\cs_tmp:w {new}{cx}{Npx}
-\cs_tmp:w {new_nopar}{cn}{Npn}
-\cs_tmp:w {new_nopar}{cx}{Npx}
-\cs_tmp:w {new_protected}{cn}{Npn}
-\cs_tmp:w {new_protected}{cx}{Npx}
-\cs_tmp:w {new_protected_nopar}{cn}{Npn}
-\cs_tmp:w {new_protected_nopar}{cx}{Npx}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-%
-%
-% \begin{macro}{\cs_if_eq_p:NN,\cs_if_eq_p:cN,\cs_if_eq_p:Nc,\cs_if_eq_p:cc}
-% \begin{macro}[TF]{\cs_if_eq:NN,\cs_if_eq:cN,\cs_if_eq:Nc,\cs_if_eq:cc}
-% Check if two control sequences are identical.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_eq:NN #1#2{p,TF,T,F}{
- \if_meaning:w #1#2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_new_nopar:Npn \cs_if_eq_p:cN {\exp_args:Nc \cs_if_eq_p:NN}
-\cs_new_nopar:Npn \cs_if_eq:cNTF {\exp_args:Nc \cs_if_eq:NNTF}
-\cs_new_nopar:Npn \cs_if_eq:cNT {\exp_args:Nc \cs_if_eq:NNT}
-\cs_new_nopar:Npn \cs_if_eq:cNF {\exp_args:Nc \cs_if_eq:NNF}
-\cs_new_nopar:Npn \cs_if_eq_p:Nc {\exp_args:NNc \cs_if_eq_p:NN}
-\cs_new_nopar:Npn \cs_if_eq:NcTF {\exp_args:NNc \cs_if_eq:NNTF}
-\cs_new_nopar:Npn \cs_if_eq:NcT {\exp_args:NNc \cs_if_eq:NNT}
-\cs_new_nopar:Npn \cs_if_eq:NcF {\exp_args:NNc \cs_if_eq:NNF}
-\cs_new_nopar:Npn \cs_if_eq_p:cc {\exp_args:Ncc \cs_if_eq_p:NN}
-\cs_new_nopar:Npn \cs_if_eq:ccTF {\exp_args:Ncc \cs_if_eq:NNTF}
-\cs_new_nopar:Npn \cs_if_eq:ccT {\exp_args:Ncc \cs_if_eq:NNT}
-\cs_new_nopar:Npn \cs_if_eq:ccF {\exp_args:Ncc \cs_if_eq:NNF}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-%
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3box.dtx b/Master/texmf-dist/source/latex/expl3/l3box.dtx
deleted file mode 100644
index 4ee8af4cf5f..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3box.dtx
+++ /dev/null
@@ -1,1036 +0,0 @@
-% \iffalse
-%% File: l3box.dtx Copyright (C) 2005-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3box.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental Box module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3box.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3box} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Boxes}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% There are three kinds of box operations: horizontal mode denoted
-% with prefix |\hbox_|, vertical mode with prefix |\vbox_|, and the
-% generic operations working in both modes with prefix |\box_|.
-%
-%
-% \section{Generic functions}
-%
-% \begin{function}{ \box_new:N |
-% \box_new:c }
-% \begin{syntax}
-% "\box_new:N" <box>
-% \end{syntax}
-% Defines <box> to be a new variable of type "box".
-% \begin{texnote}
-% "\box_new:N" is the equivalent of plain \TeX{}'s \tn{newbox}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \if_hbox:N |
-% \if_vbox:N |
-% \if_box_empty:N |
-% }
-% \begin{syntax}
-% "\if_hbox:N" <box> <true code>"\else:" <false code>"\fi:"
-% "\if_box_empty:N" <box> <true code>"\else:" <false code>"\fi:"
-% \end{syntax}
-% "\if_hbox:N" and "\if_vbox:N" check if <box> is an horizontal or
-% vertical box resp. "\if_box_empty:N" tests if <box> is empty (void)
-% and executes "code" according to the test outcome.
-% \begin{texnote}
-% These are the \TeX{} primitives \tn{ifhbox}, \tn{ifvbox} and
-% \tn{ifvoid}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\box_if_horizontal_p:N |
-% \box_if_horizontal_p:c |
-% \box_if_horizontal:N / (TF) |
-% \box_if_horizontal:c / (TF) }
-% \begin{syntax}
-% "\box_if_horizontal:NTF" <box> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if <box> is an horizontal box and executes <code> accordingly.
-% \end{function}
-%
-% \begin{function}{\box_if_vertical_p:N |
-% \box_if_vertical_p:c |
-% \box_if_vertical:N / (TF) |
-% \box_if_vertical:c / (TF) }
-% \begin{syntax}
-% "\box_if_vertical:NTF" <box> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if <box> is a vertical box and executes <code> accordingly.
-% \end{function}
-%
-% \begin{function}{%
-% \box_if_empty_p:N |
-% \box_if_empty_p:c |
-% \box_if_empty:N / (TF) |
-% \box_if_empty:c / (TF) |
-% }
-% \begin{syntax}
-% "\box_if_empty:NTF" <box> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if <box> is empty (void) and executes "code" according to the
-% test outcome.
-% \begin{texnote}
-% "\box_if_empty:NTF" is the \LaTeX3 function name for \tn{ifvoid}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{%
-% \box_set_eq:NN |
-% \box_set_eq:cN |
-% \box_set_eq:Nc |
-% \box_set_eq:cc |
-% \box_set_eq_clear:NN |
-% \box_set_eq_clear:cN |
-% \box_set_eq_clear:Nc |
-% \box_set_eq_clear:cc |
-% }
-% \begin{syntax}
-% "\box_set_eq:NN" <box1> <box2>
-% \end{syntax}
-% Sets <box1> equal to <box2>. The "_clear" versions eradicate the contents
-% of <box2> afterwards.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \box_gset_eq:NN |
-% \box_gset_eq:cN |
-% \box_gset_eq:Nc |
-% \box_gset_eq:cc |
-% \box_gset_eq_clear:NN |
-% \box_gset_eq_clear:cN |
-% \box_gset_eq_clear:Nc |
-% \box_gset_eq_clear:cc |
-% }
-% \begin{syntax}
-% "\box_gset_eq:NN" <box1> <box2>
-% \end{syntax}
-% Globally sets <box1> equal to <box2>. The "_clear" versions eradicate the contents
-% of <box2> afterwards.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \box_set_to_last:N |
-% \box_set_to_last:c |
-% \box_gset_to_last:N |
-% \box_gset_to_last:c |
-% }
-% \begin{syntax}
-% "\box_set_to_last:N" <box>
-% \end{syntax}
-% Sets <box> equal to the previous box |\l_last_box| and removes
-% |\l_last_box| from the current list (unless in outer vertical
-% or math mode).
-% \end{function}
-%
-% \begin{function}{%
-% \box_move_right:nn |
-% \box_move_left:nn |
-% \box_move_up:nn |
-% \box_move_down:nn |
-% }
-% \begin{syntax}
-% "\box_move_left:nn" \Arg{dimen} \Arg{box function}
-% \end{syntax}
-% Moves <box function> <dimen> in the direction specified. <box
-% function> is either an operation on a box such as "\box_use:N" or a
-% ``raw'' box specification like "\vbox:n{xyz}".
-% \end{function}
-%
-% \begin{function}{%
-% \box_clear:N |
-% \box_clear:c |
-% \box_gclear:N |
-% \box_gclear:c |
-% }
-% \begin{syntax}
-% "\box_clear:N" <box>
-% \end{syntax}
-% Clears <box> by setting it to the constant "\c_void_box".
-% "\box_gclear:N" does it globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \box_use:N |
-% \box_use:c |
-% \box_use_clear:N |
-% \box_use_clear:c |
-% }
-% \begin{syntax}
-% "\box_use:N" <box> \\
-% "\box_use_clear:N" <box>
-% \end{syntax}
-% "\box_use:N" puts a copy of <box> on the current list while
-% "\box_use_clear:N" puts the box on the current list and then
-% eradicates the contents of it.
-% \begin{texnote}
-% "\box_use:N" and "\box_use_clear:N" are the \TeX{} primitives
-% \tn{copy} and \tn{box} with new (descriptive) names.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{%
-% \box_ht:N |
-% \box_ht:c |
-% \box_dp:N |
-% \box_dp:c |
-% \box_wd:N |
-% \box_wd:c |
-% }
-% \begin{syntax}
-% "\box_ht:N" <box>
-% \end{syntax}
-% Returns the height, depth, and width of <box> for use in dimension
-% settings.
-% \begin{texnote}
-% These are the \TeX{} primitives \tn{ht}, \tn{dp} and \tn{wd}.
-% \end{texnote}
-% \end{function}
-%
-%\begin{function}{
-% \box_set_dp:Nn |
-% \box_set_dp:cn |
-%}
-% \begin{syntax}
-% \cs{box_set_dp:Nn} \meta{box} \Arg{dimension expression}
-% \end{syntax}
-% Set the depth(below the baseline) of the \meta{box} to the value of
-% the \Arg{dimension expression}. This is a local assignment.
-%\end{function}
-%
-%\begin{function}{
-% \box_set_ht:Nn |
-% \box_set_ht:cn |
-%}
-% \begin{syntax}
-% \cs{box_set_ht:Nn} \meta{box} \Arg{dimension expression}
-% \end{syntax}
-% Set the height(above the baseline) of the \meta{box} to the value of
-% the \Arg{dimension expression}. This is a local assignment.
-%\end{function}
-%
-%\begin{function}{
-% \box_set_wd:Nn |
-% \box_set_wd:cn |
-%}
-% \begin{syntax}
-% \cs{box_set_wd:Nn} \meta{box} \Arg{dimension expression}
-% \end{syntax}
-% Set the width of the \meta{box} to the value of the
-% \Arg{dimension expression}. This is a local assignment.
-%\end{function}
-%
-% \begin{function}{%
-% \box_show:N |
-% \box_show:c |
-% }
-% \begin{syntax}
-% "\box_show:N" <box>
-% \end{syntax}
-% Writes the contents of <box> to the log file.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{showbox}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{variable}{%
-% \c_empty_box |
-% \l_tmpa_box |
-% \l_tmpb_box |
-% }
-% \begin{syntax}
-% \end{syntax}
-% "\c_empty_box" is the constantly empty box. The others are scratch
-% boxes.
-% \end{variable}
-%
-%
-% \begin{variable}{%
-% \l_last_box |
-% }
-% \begin{syntax}
-% \end{syntax}
-% "\l_last_box" is more or less a read-only box register managed by the
-% engine. It denotes the last box on the current list if there is one,
-% otherwise it is void. You can set other
-% boxes to this box, with the result that the last box on the current list is
-% removed at the same time (so it is with variable with side-effects).
-% \end{variable}
-%
-%
-% \section{Horizontal mode}
-%
-% \begin{function}{%
-% \hbox:n |
-% }
-% \begin{syntax}
-% "\hbox:n" \Arg{contents}
-% \end{syntax}
-% Places a "hbox" of natural size.
-% \end{function}
-%
-% \begin{function}{%
-% \hbox_set:Nn |
-% \hbox_set:cn |
-% \hbox_gset:Nn |
-% \hbox_gset:cn |
-% }
-% \begin{syntax}
-% "\hbox_set:Nn" <box> \Arg{contents}
-% \end{syntax}
-% Sets <box> to be a horizontal mode box containing \m{contents}. It has
-% it's natural size. "\hbox_gset:Nn" does it globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \hbox_set_to_wd:Nnn |
-% \hbox_set_to_wd:cnn |
-% \hbox_gset_to_wd:Nnn |
-% \hbox_gset_to_wd:cnn |
-% }
-% \begin{syntax}
-% "\hbox_set_to_wd:Nnn" <box> \Arg{dimen} \Arg{contents}
-% \end{syntax}
-% Sets <box> to contain \m{contents} and have width <dimen>.
-% "\hbox_gset_to_wd:Nn" does it globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \hbox_to_wd:nn |
-% \hbox_to_zero:n |
-% }
-% \begin{syntax}
-% "\hbox_to_wd:nn" \Arg{dimen} <contents>
-% "\hbox_to_zero:n" <contents>
-% \end{syntax}
-% Places a <box> of width <dimen> containing <contents>. "\hbox_to_zero:n"
-% is a shorthand for a width of zero.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \hbox_overlap_left:n |
-% \hbox_overlap_right:n |
-% }
-% \begin{syntax}
-% "\hbox_overlap_left:n" <contents>
-% \end{syntax}
-% Places a <box> of width zero containing <contents> in a way the it overlaps
-% with surrounding material (sticking out to the left or right).
-% \end{function}
-%
-%
-% \begin{function}{%
-% \hbox_set_inline_begin:N |
-% \hbox_set_inline_begin:c |
-% \hbox_set_inline_end: |
-% \hbox_gset_inline_begin:N |
-% \hbox_gset_inline_begin:c |
-% \hbox_gset_inline_end: |
-% }
-% \begin{syntax}
-% "\hbox_set_inline_begin:N" <box> <contents>
-% "\hbox_set_inline_end:"
-% \end{syntax}
-% Sets <box> to contain <contents>. This type is useful for use in
-% environment definitions.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \hbox_unpack:N |
-% \hbox_unpack:c |
-% \hbox_unpack_clear:N |
-% \hbox_unpack_clear:c |
-% }
-% \begin{syntax}
-% "\hbox_unpack:N" <box>
-% \end{syntax}
-% "\hbox_unpack:N" unpacks the contents of the <box> register and
-% "\hbox_unpack_clear:N" also clears the <box> after unpacking it.
-% \begin{texnote}
-% These are the \TeX{} primitives \tn{unhcopy} and \tn{unhbox}.
-% \end{texnote}
-% \end{function}
-%
-%
-%
-%
-%
-% \section{Vertical mode}
-%
-% \begin{function}{%
-% \vbox:n |
-% }
-% \begin{syntax}
-% "\vbox:n" \Arg{contents}
-% \end{syntax}
-% Places a "vbox" of natural size with baseline equal to the baseline
-% of the last object in the box, i.e., if the last object is a line of text
-% the box has the same depth as that line; otherwise the depth will be zero.
-% \end{function}
-%
-% \begin{function}{%
-% \vbox_top:n |
-% }
-% \begin{syntax}
-% "\vbox_top:n" \Arg{contents}
-% \end{syntax}
-% Same as "\vbox:n" except that the reference point will be at the baseline
-% of the first object in the box not the last.
-% \end{function}
-%
-% \begin{function}{%
-% \vbox_set:Nn |
-% \vbox_set:cn |
-% \vbox_gset:Nn |
-% \vbox_gset:cn |
-% }
-% \begin{syntax}
-% "\vbox_set:Nn" <box> \Arg{contents}
-% \end{syntax}
-% Sets <box> to be a vertical mode box containing \m{contents}. It has
-% its natural size and the reference point will be at the baseline of the
-% last object in the box. "\vbox_gset:Nn" does it globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \vbox_set_top:Nn |
-% \vbox_set_top:cn |
-% \vbox_gset_top:Nn |
-% \vbox_gset_top:cn |
-% }
-% \begin{syntax}
-% "\vbox_set_top:Nn" <box> \Arg{contents}
-% \end{syntax}
-% Sets <box> to be a vertical mode box containing \m{contents}. It has
-% its natural size (usually a small height and a larger depth)
-% and the reference point will be at the baseline of the
-% first object in the box. "\vbox_gset_top:Nn" does it globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \vbox_set_to_ht:Nnn |
-% \vbox_set_to_ht:cnn |
-% \vbox_gset_to_ht:Nnn |
-% \vbox_gset_to_ht:cnn |
-% \vbox_gset_to_ht:ccn |
-% }
-% \begin{syntax}
-% "\vbox_set_to_ht:Nnn" <box> \Arg{dimen} \Arg{contents}
-% \end{syntax}
-% Sets <box> to contain \m{contents} and have total height <dimen>.
-% "\vbox_gset_to_ht:Nn" does it globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \vbox_set_inline_begin:N |
-% \vbox_set_inline_end: |
-% \vbox_gset_inline_begin:N |
-% \vbox_gset_inline_end: |
-% }
-% \begin{syntax}
-% "\vbox_set_inline_begin:N" <box> <contents>
-% "\vbox_set_inline_end:"
-% \end{syntax}
-% Sets <box> to contain \m{contents}. This type is useful for use in
-% environment definitions.
-% \end{function}
-%
-% \begin{function}{%
-% \vbox_set_split_to_ht:NNn |
-% }
-% \begin{syntax}
-% "\vbox_set_split_to_ht:NNn" <box1> <box2> \Arg{dimen}
-% \end{syntax}
-% Sets <box1> to contain the top <dimen> part of <box2>.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{vsplit}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \vbox_to_ht:nn |
-% \vbox_to_zero:n |
-% }
-% \begin{syntax}
-% "\vbox_to_ht:nn" \Arg{dimen} <contents> \\
-% "\vbox_to_zero:n" <contents>
-% \end{syntax}
-% Places a <box> of size <dimen> containing <contents>.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \vbox_unpack:N |
-% \vbox_unpack:c |
-% \vbox_unpack_clear:N |
-% \vbox_unpack_clear:c |
-% }
-% \begin{syntax}
-% "\vbox_unpack:N" <box>
-% \end{syntax}
-% "\vbox_unpack:N" unpacks the contents of the <box> register and
-% "\vbox_unpack_clear:N" also clears the <box> after unpacking it.
-% \begin{texnote}
-% These are the \TeX{} primitives \tn{unvcopy} and \tn{unvbox}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-%
-%
-% \section{\pkg{l3box} implementation}
-%
-%
-% Announce and ensure that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% The code in this module is very straight forward so I'm not going to
-% comment it very extensively.
-%
-%
-% \subsection{Generic boxes}
-%
-% \begin{macro}{\box_new:N,\box_new:c}
-% Defining a new \m{box} register.
-% \testfile{m3box001.lvt}
-% \begin{macrocode}
-%<*initex>
-\alloc_new:nnnN {box} \c_zero \c_max_register_int \tex_mathchardef:D
-% \end{macrocode}
-% Now, remember that |\box255| has a special role in \TeX, it
-% shouldn't be allocated\dots
-% \begin{macrocode}
-\seq_put_right:Nn \g_box_allocation_seq {255}
-%</initex>
-% \end{macrocode}
-% When we run on top of \LaTeX, we just use its allocation
-% mechanism.
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \box_new:N #1 {
- \chk_if_free_cs:N #1
- \newbox #1
-}
-%</package>
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \box_new:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\if_hbox:N,\if_vbox:N,\if_box_empty:N}
-% \testfile*
-% The primitives for testing if a \m{box} is empty/void or which
-% type of box it is.
-% \begin{macrocode}
-\cs_new_eq:NN \if_hbox:N \tex_ifhbox:D
-\cs_new_eq:NN \if_vbox:N \tex_ifvbox:D
-\cs_new_eq:NN \if_box_empty:N \tex_ifvoid:D
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\box_if_horizontal_p:N,\box_if_horizontal_p:c}
-% \testfile*
-% \begin{macro}{\box_if_vertical_p:N,\box_if_vertical_p:c}
-% \testfile*
-% \begin{macro}[TF]{\box_if_horizontal:N,\box_if_horizontal:c}
-% \testfile*
-% \begin{macro}[TF]{\box_if_vertical:N,\box_if_vertical:c}
-% \testfile*
-% \begin{macrocode}
-\prg_new_conditional:Nnn \box_if_horizontal:N {p,TF,T,F} {
- \tex_ifhbox:D #1 \prg_return_true: \else: \prg_return_false: \fi:
-}
-\prg_new_conditional:Nnn \box_if_vertical:N {p,TF,T,F} {
- \tex_ifvbox:D #1 \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \box_if_horizontal_p:N {c}
-\cs_generate_variant:Nn \box_if_horizontal:NTF {c}
-\cs_generate_variant:Nn \box_if_horizontal:NT {c}
-\cs_generate_variant:Nn \box_if_horizontal:NF {c}
-\cs_generate_variant:Nn \box_if_vertical_p:N {c}
-\cs_generate_variant:Nn \box_if_vertical:NTF {c}
-\cs_generate_variant:Nn \box_if_vertical:NT {c}
-\cs_generate_variant:Nn \box_if_vertical:NF {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\box_if_empty_p:N,\box_if_empty_p:c}
-% \testfile*
-% \begin{macro}[TF]{\box_if_empty:N,\box_if_empty:c}
-% \testfile*
-% Testing if a \m{box} is empty/void.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \box_if_empty:N {p,TF,T,F} {
- \tex_ifvoid:D #1 \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \box_if_empty_p:N {c}
-\cs_generate_variant:Nn \box_if_empty:NTF {c}
-\cs_generate_variant:Nn \box_if_empty:NT {c}
-\cs_generate_variant:Nn \box_if_empty:NF {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\box_set_eq:NN,\box_set_eq:cN,
-% \box_set_eq:Nc,\box_set_eq:cc}
-% \testfile*
-% Assigning the contents of a box to be another box.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \box_set_eq:NN #1#2 {\tex_setbox:D #1 \tex_copy:D #2}
-\cs_generate_variant:Nn \box_set_eq:NN {cN,Nc,cc}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\box_set_eq_clear:NN,\box_set_eq_clear:cN,
-% \box_set_eq_clear:Nc,\box_set_eq_clear:cc}
-% \testfile*
-% Assigning the contents of a box to be another box.
-% This clears the second box globally (that's how \TeX{} does it).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \box_set_eq_clear:NN #1#2 {\tex_setbox:D #1 \tex_box:D #2}
-\cs_generate_variant:Nn \box_set_eq_clear:NN {cN,Nc,cc}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\box_gset_eq:NN,\box_gset_eq:cN,
-% \box_gset_eq:Nc,\box_gset_eq:cc,
-% \box_gset_eq_clear:NN,\box_gset_eq_clear:cN,
-% \box_gset_eq_clear:Nc,\box_gset_eq_clear:cc}
-% \testfile*
-% Global version of the above.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \box_gset_eq:NN {\pref_global:D\box_set_eq:NN}
-\cs_generate_variant:Nn \box_gset_eq:NN {cN,Nc,cc}
-\cs_new_protected_nopar:Npn \box_gset_eq_clear:NN {\pref_global:D\box_set_eq_clear:NN}
-\cs_generate_variant:Nn \box_gset_eq_clear:NN {cN,Nc,cc}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{variable}{\l_last_box}
-% A different name for this read-only primitive.
-% \begin{macrocode}
-\cs_new_eq:NN \l_last_box \tex_lastbox:D
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}{\box_set_to_last:N, \box_gset_to_last:N,
-% \box_set_to_last:c, \box_gset_to_last:c}
-% \testfile*
-% Set a box to the previous box.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \box_set_to_last:N #1{\tex_setbox:D#1\l_last_box}
-\cs_generate_variant:Nn \box_set_to_last:N {c}
-\cs_new_protected_nopar:Npn \box_gset_to_last:N {\pref_global:D \box_set_to_last:N}
-\cs_generate_variant:Nn \box_gset_to_last:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\box_move_left:nn,\box_move_right:nn,
-% \box_move_up:nn,\box_move_down:nn}
-% \testfile*
-% Move box material in different directions.
-% \begin{macrocode}
-\cs_new:Npn \box_move_left:nn #1#2{\tex_moveleft:D\dim_eval:n{#1} #2}
-\cs_new:Npn \box_move_right:nn #1#2{\tex_moveright:D\dim_eval:n{#1} #2}
-\cs_new:Npn \box_move_up:nn #1#2{\tex_raise:D\dim_eval:n{#1} #2}
-\cs_new:Npn \box_move_down:nn #1#2{\tex_lower:D\dim_eval:n{#1} #2}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\box_clear:N,\box_clear:c,
-% \box_gclear:N,\box_gclear:c}
-% \testfile*
-% Clear a \m{box} register.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \box_clear:N #1{\box_set_eq_clear:NN #1 \c_empty_box }
-\cs_generate_variant:Nn \box_clear:N {c}
-\cs_new_protected_nopar:Npn \box_gclear:N {\pref_global:D\box_clear:N}
-\cs_generate_variant:Nn \box_gclear:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\box_ht:N,\box_ht:c,
-% \box_dp:N,\box_dp:c,
-% \box_wd:N,\box_wd:c}
-% \testfile*
-% Accessing the height, depth, and width of a \m{box} register.
-% \begin{macrocode}
-\cs_new_eq:NN \box_ht:N \tex_ht:D
-\cs_new_eq:NN \box_dp:N \tex_dp:D
-\cs_new_eq:NN \box_wd:N \tex_wd:D
-\cs_generate_variant:Nn \box_ht:N {c}
-\cs_generate_variant:Nn \box_dp:N {c}
-\cs_generate_variant:Nn \box_wd:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\box_set_ht:Nn,
-% \box_set_ht:cn,
-% \box_set_dp:Nn,
-% \box_set_dp:cn,
-% \box_set_wd:Nn,
-% \box_set_wd:cn}
-% Measuring is easy: all primitive work. These primitives are not
-% expandable, so the derived functions are not either.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \box_set_dp:Nn #1#2 {
- \box_dp:N #1 \etex_dimexpr:D #2 \scan_stop:
-}
-\cs_new_protected_nopar:Npn \box_set_ht:Nn #1#2 {
- \box_ht:N #1 \etex_dimexpr:D #2 \scan_stop:
-}
-\cs_new_protected_nopar:Npn \box_set_wd:Nn #1#2 {
- \box_wd:N #1 \etex_dimexpr:D #2 \scan_stop:
-}
-\cs_generate_variant:Nn \box_set_ht:Nn { c }
-\cs_generate_variant:Nn \box_set_dp:Nn { c }
-\cs_generate_variant:Nn \box_set_wd:Nn { c }
-% \end{macrocode}
-%\end{macro}
-%
-% \begin{macro}{\box_use_clear:N,\box_use_clear:c,
-% \box_use:N,\box_use:c}
-% \testfile{m3box001.lvt}
-% Using a \m{box}. These are just \TeX{} primitives with meaningful
-% names.
-% \begin{macrocode}
-\cs_new_eq:NN \box_use_clear:N \tex_box:D
-\cs_generate_variant:Nn \box_use_clear:N {c}
-\cs_new_eq:NN \box_use:N \tex_copy:D
-\cs_generate_variant:Nn \box_use:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\box_show:N,\box_show:c}
-% \testfile*
-% Show the contents of a box and write it into the log file.
-% \begin{macrocode}
-\cs_set_eq:NN \box_show:N \tex_showbox:D
-\cs_generate_variant:Nn \box_show:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{variable}{\c_empty_box,\l_tmpa_box,\l_tmpb_box}
-% We allocate some \m{box} registers here (and borrow a few from \LaTeX).
-% \begin{macrocode}
-%<package>\cs_set_eq:NN \c_empty_box \voidb@x
-%<package>\cs_new_eq:NN \l_tmpa_box \@tempboxa
-%<initex>\box_new:N \c_empty_box
-%<initex>\box_new:N \l_tmpa_box
-\box_new:N \l_tmpb_box
-% \end{macrocode}
-% \end{variable}
-%
-%
-% \subsection{Vertical boxes}
-%
-%
-% \begin{macro}{\vbox:n,
-% \vbox_top:n}
-% \testfile{m3box003.lvt}
-% Put a vertical box directly into the input stream.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \vbox:n {\tex_vbox:D \scan_stop:}
-\cs_new_protected_nopar:Npn \vbox_top:n {\tex_vtop:D \scan_stop:}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\vbox_set:Nn,\vbox_set:cn,
-% \vbox_gset:Nn,\vbox_gset:cn}
-% \testfile*
-% Storing material in a vertical box with a natural height.
-% \begin{macrocode}
-\cs_new_protected:Npn \vbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_vbox:D {#2}}
-\cs_generate_variant:Nn \vbox_set:Nn {cn}
-\cs_new_protected_nopar:Npn \vbox_gset:Nn {\pref_global:D \vbox_set:Nn}
-\cs_generate_variant:Nn \vbox_gset:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\vbox_set_top:Nn,\vbox_set_top:cn,
-% \vbox_gset_top:Nn,\vbox_gset_top:cn}
-% \testfile*
-% Storing material in a vertical box with a natural height and reference
-% point at the baseline of the first object in the box.
-% \begin{macrocode}
-\cs_new_protected:Npn \vbox_set_top:Nn #1#2 {\tex_setbox:D #1 \tex_vtop:D {#2}}
-\cs_generate_variant:Nn \vbox_set_top:Nn {cn}
-\cs_new_protected_nopar:Npn \vbox_gset_top:Nn {\pref_global:D \vbox_set_top:Nn}
-\cs_generate_variant:Nn \vbox_gset_top:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\vbox_set_to_ht:Nnn,\vbox_set_to_ht:cnn,
-% \vbox_gset_to_ht:Nnn,\vbox_gset_to_ht:cnn,\vbox_gset_to_ht:ccn}
-% \testfile*
-% Storing material in a vertical box with a specified height.
-% \begin{macrocode}
-\cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 {
- \tex_setbox:D #1 \tex_vbox:D to #2 {#3}
-}
-\cs_generate_variant:Nn \vbox_set_to_ht:Nnn {cnn}
-\cs_new_protected_nopar:Npn \vbox_gset_to_ht:Nnn { \pref_global:D \vbox_set_to_ht:Nnn }
-\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn {cnn,ccn}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\vbox_set_inline_begin:N,
-% \vbox_set_inline_end:,
-% \vbox_gset_inline_begin:N,
-% \vbox_gset_inline_end:}
-% \testfile*
-% Storing material in a vertical box. This type is useful in
-% environment definitions.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \vbox_set_inline_begin:N #1 {
- \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token }
-\cs_new_eq:NN \vbox_set_inline_end: \c_group_end_token
-\cs_new_protected_nopar:Npn \vbox_gset_inline_begin:N {
- \pref_global:D \vbox_set_inline_begin:N }
-\cs_new_eq:NN \vbox_gset_inline_end: \c_group_end_token
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\vbox_to_ht:nn,\vbox_to_zero:n}
-% \testfile*
-% Put a vertical box directly into the input stream.
-% \begin{macrocode}
-\cs_new_protected:Npn \vbox_to_ht:nn #1#2{\tex_vbox:D to \dim_eval:n{#1}{#2}}
-\cs_new_protected:Npn \vbox_to_zero:n #1 {\tex_vbox:D to \c_zero_dim {#1}}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\vbox_set_split_to_ht:NNn}
-% \testfile*
-% Splitting a vertical box in two.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3{
- \tex_setbox:D #1 \tex_vsplit:D #2 to #3
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\vbox_unpack:N,\vbox_unpack:c,
-% \vbox_unpack_clear:N,\vbox_unpack_clear:c}
-% \testfile*
-% Unpacking a box and if requested also clear it.
-% \begin{macrocode}
-\cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D
-\cs_generate_variant:Nn \vbox_unpack:N {c}
-\cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D
-\cs_generate_variant:Nn \vbox_unpack_clear:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-%
-%
-% \subsection{Horizontal boxes}
-%
-%
-% \begin{macro}{\hbox:n}
-% Put a horizontal box directly into the input stream.
-% \testfile{m3box002.lvt}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \hbox:n {\tex_hbox:D \scan_stop:}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\hbox_set:Nn,\hbox_set:cn,
-% \hbox_gset:Nn,\hbox_gset:cn}
-% \testfile*
-% Assigning the contents of a box to be another box.
-% This clears the second box globally (that's how \TeX{} does it).
-% \begin{macrocode}
-\cs_new_protected:Npn \hbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_hbox:D {#2}}
-\cs_generate_variant:Nn \hbox_set:Nn {cn}
-\cs_new_protected_nopar:Npn \hbox_gset:Nn {\pref_global:D \hbox_set:Nn}
-\cs_generate_variant:Nn \hbox_gset:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\hbox_set_to_wd:Nnn,\hbox_set_to_wd:cnn,
-% \hbox_gset_to_wd:Nnn,\hbox_gset_to_wd:cnn}
-% \testfile*
-% Storing material in a horizontal box with a specified width.
-% \begin{macrocode}
-\cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 {
- \tex_setbox:D #1 \tex_hbox:D to \dim_eval:n{#2} {#3}
-}
-\cs_generate_variant:Nn \hbox_set_to_wd:Nnn {cnn}
-\cs_new_protected_nopar:Npn \hbox_gset_to_wd:Nnn {\pref_global:D \hbox_set_to_wd:Nnn }
-\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn {cnn}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\hbox_set_inline_begin:N,\hbox_set_inline_begin:c,
-% \hbox_gset_inline_begin:N,\hbox_gset_inline_begin:c,
-% \hbox_set_inline_end:,
-% \hbox_gset_inline_end:}
-% \testfile*
-% Storing material in a horizontal box. This type is useful in
-% environment definitions.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \hbox_set_inline_begin:N #1 {
- \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token
-}
-\cs_generate_variant:Nn \hbox_set_inline_begin:N {c}
-\cs_new_eq:NN \hbox_set_inline_end: \c_group_end_token
-\cs_new_protected_nopar:Npn \hbox_gset_inline_begin:N {
- \pref_global:D \hbox_set_inline_begin:N
-}
-\cs_generate_variant:Nn \hbox_gset_inline_begin:N {c}
-\cs_new_eq:NN \hbox_gset_inline_end: \c_group_end_token
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\hbox_to_wd:nn,\hbox_to_zero:n}
-% \testfile*
-% Put a horizontal box directly into the input stream.
-% \begin{macrocode}
-\cs_new_protected:Npn \hbox_to_wd:nn #1#2 {\tex_hbox:D to #1 {#2}}
-\cs_new_protected:Npn \hbox_to_zero:n #1 {\tex_hbox:D to \c_zero_skip {#1}}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\hbox_overlap_left:n,\hbox_overlap_right:n}
-% Put a zero-sized box with the contents pushed against one side (which
-% makes it stick out on the other) directly into the input stream.
-% \begin{macrocode}
-\cs_new_protected:Npn \hbox_overlap_left:n #1 {\hbox_to_zero:n {\tex_hss:D #1}}
-\cs_new_protected:Npn \hbox_overlap_right:n #1 {\hbox_to_zero:n {#1 \tex_hss:D}}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\hbox_unpack:N,\hbox_unpack:c,
-% \hbox_unpack_clear:N,\hbox_unpack_clear:c}
-% \testfile*
-% Unpacking a box and if requested also clear it.
-% \begin{macrocode}
-\cs_new_eq:NN \hbox_unpack:N \tex_unhcopy:D
-\cs_generate_variant:Nn \hbox_unpack:N {c}
-\cs_new_eq:NN \hbox_unpack_clear:N \tex_unhbox:D
-\cs_generate_variant:Nn \hbox_unpack_clear:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%^^A xo-or.sty:1528: \setbox\z@\vsplit\c_twohundred_fifty_five to\l_tmpa_dim
-%^^A xo-or.dtx:222: \global\setbox\removed@guard@box\lastbox}
-%
-%^^A it probably should be \vbox_set:nn not \vbox_set:Nn as we can
-%^^A have a number as the first arg ... do do we argue that this is not
-%^^A supported on this level?
-%^^A MH comment:
-%^^A I don't think we should ever see people using numbers directly.
-%^^A If they do it's \vbox_set:Nn \c_zero {...} anyway, not two-digit
-%^^A numbers.
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3calc.dtx b/Master/texmf-dist/source/latex/expl3/l3calc.dtx
deleted file mode 100644
index 4d477acf7be..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3calc.dtx
+++ /dev/null
@@ -1,1165 +0,0 @@
-% \iffalse
-%% File: l3calc.dtx Copyright (C) 2006,2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3calc.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental calc module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3calc} package\thanks{This file has version
-% number \fileversion, last
-% revised \filedate.}\\
-% Infix notation arithmetic in \LaTeX3}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% This is pretty much a straight adaption of the \textsf{calc} package
-% and as such has same syntax for the \meta{calc expression}. However,
-% there are some noticeable differences.
-% \begin{itemize}
-% \item The calc expression is expanded fully, which means there are
-% no problems with unfinished conditionals. However, the contents of
-% |\widthof| etc.\ is not expanded at all. This includes uses in
-% traditional \LaTeX\ as in the \textsf{array} package, which tries
-% to do an |\edef| several times. The code used in \textsf{l3calc}
-% provides self-protection for these cases.
-% \item Muskip registers are supported although they can only be used
-% in |\ratio| if already evaluating a muskip expression. For the
-% other three register types, you can use points.
-% \item All results are rounded, not truncated. More precisely, the
-% primitive \TeX\ operations |\divide| and |\multiply| are not
-% used. The only instance where one will observe an effect is when
-% dividing integers.
-% \end{itemize}
-%
-% This version of \textsf{l3calc} is a now a complete replacement for
-% the original \textsf{calc} package providing the same functionality
-% and will prevent the original \textsf{calc} package from loading.
-%
-% \section{User functions}
-%
-%
-% \begin{function}{ \maxof |
-% \minof |
-% \widthof |
-% \heightof |
-% \depthof |
-% \totalheightof |
-% \ratio |
-% \real |
-% \setlength |
-% \gsetlength |
-% \addtolength |
-% \gaddtolength |
-% \setcounter |
-% \addtocounter |
-% \stepcounter }
-% See documentation for \LaTeXe\ package \pkg{calc}.
-% \end{function}
-%
-% \begin{function}{ \calc_maxof:nn |
-% \calc_minof:nn |
-% \calc_widthof:n |
-% \calc_heightof:n |
-% \calc_depthof:n |
-% \calc_totalheightof:n |
-% \calc_ratio:nn |
-% \calc_real:n |
-% \calc_setcounter:nn |
-% \calc_addtocounter:nn |
-% \calc_stepcounter:n }
-% Equivalent commands as the above in the \pkg{expl3} namespace.
-% \end{function}
-%
-% \begin{function}{
-% \calc_int_set:Nn |
-% \calc_int_gset:Nn |
-% \calc_int_add:Nn |
-% \calc_int_gadd:Nn |
-% \calc_int_sub:Nn |
-% \calc_int_gsub:Nn
-% }
-% \begin{syntax}
-% "\calc_int_set:Nn" <int> \Arg{calc expression}
-% \end{syntax}
-% Evaluates <calc expression> and either adds or subtracts it from
-% <int> or sets <int> to it. These operations can also be global.
-% \end{function}
-%
-%
-% \begin{function}{
-% \calc_dim_set:Nn |
-% \calc_dim_gset:Nn |
-% \calc_dim_add:Nn |
-% \calc_dim_gadd:Nn |
-% \calc_dim_sub:Nn |
-% \calc_dim_gsub:Nn |
-% }
-% \begin{syntax}
-% "\calc_dim_set:Nn" <dim> \Arg{calc expression}
-% \end{syntax}
-% Evaluates <calc expression> and either adds or subtracts it from
-% <dim> or sets <dim> to it. These operations can also be global.
-% \end{function}
-%
-%
-% \begin{function}{
-% \calc_skip_set:Nn |
-% \calc_skip_gset:Nn |
-% \calc_skip_add:Nn |
-% \calc_skip_gadd:Nn |
-% \calc_skip_sub:Nn |
-% \calc_skip_gsub:Nn |
-% }
-% \begin{syntax}
-% "\calc_skip_set:Nn" <skip> \Arg{calc expression}
-% \end{syntax}
-% Evaluates <calc expression> and either adds or subtracts it from
-% <skip> or sets <skip> to it. These operations can also be global.
-% \end{function}
-%
-%
-% \begin{function}{
-% \calc_muskip_set:Nn |
-% \calc_muskip_gset:Nn |
-% \calc_muskip_add:Nn |
-% \calc_muskip_gadd:Nn |
-% \calc_muskip_sub:Nn |
-% \calc_muskip_gsub:Nn |
-% }
-% \begin{syntax}
-% "\calc_muskip_set:Nn" <muskip> \Arg{calc expression}
-% \end{syntax}
-% Evaluates <calc expression> and either adds or subtracts it from
-% <muskip> or sets <muskip> to it. These operations can also be
-% global.
-% \end{function}
-%
-%
-% \begin{function}{
-% \calc_calculate_box_size:nnn |
-% }
-% \begin{syntax}
-% "\calc_calculate_box_size:nnn" \Arg{dim-set} \\
-% "{"<item 1> <item 2> ... <item n>"}" \Arg{contents}
-% \end{syntax}
-% Sets <contents> in a temporary box "\l_tmpa_box". Then <dim-set>
-% is put in front of a loop that inserts "+"\meta{item$\sb{i}$} in
-% front of "\l_tmpa_box" and this is evaluated. For instance, if we
-% wanted to determine the total height of the text "xyz" and store
-% it in "\l_tmpa_dim", we would call it as.
-% \begin{verbatim}
-% \calc_calculate_box_size:nnn
-% {\dim_set:Nn\l_tmpa_dim}{\box_ht:N\box_dp:N}{xyz}
-% \end{verbatim}
-% Similarly, if we wanted the difference between height and depth,
-% we could call it as
-% \begin{verbatim}
-% \calc_calculate_box_size:nnn
-% {\dim_set:Nn\l_tmpa_dim}{\box_ht:N{-\box_dp:N}}{xyz}
-% \end{verbatim}
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-%
-% \section{\pkg{l3calc} implementation}
-%
-% \subsection{Variables}
-%
-% \begin{function}{ \l_calc_expression_tl |
-% \g_calc_A_register |
-% \l_calc_B_register |
-% \l_calc_current_type_int |
-% \g_calc_A_int |
-% \l_calc_B_int |
-% \l_calc_C_int |
-% \g_calc_A_dim |
-% \l_calc_B_dim |
-% \l_calc_C_dim |
-% \g_calc_A_skip |
-% \l_calc_B_skip |
-% \l_calc_C_skip |
-% \g_calc_A_muskip |
-% \l_calc_B_muskip |
-% \l_calc_C_muskip }
-% Internal registers.
-% \end{function}
-%
-% \subsection{Internal functions}
-%
-% \begin{function}{ \calc_assign_generic:NNNNnn |
-% \calc_pre_scan:N |
-% \calc_open:w |
-% \calc_init_B: |
-% \calc_numeric: |
-% \calc_close: |
-% \calc_post_scan:N |
-% \calc_multiply:N |
-% \calc_divide:N |
-% \calc_generic_add_or_subtract:N |
-% \calc_add: |
-% \calc_subtract: |
-% \calc_add_A_to_B: |
-% \calc_subtract_A_from_B: |
-% \calc_generic_multiply_or_divide:N |
-% \calc_multiply_B_by_A: |
-% \calc_divide_B_by_A: |
-% \calc_multiply: |
-% \calc_divide: |
-% \calc_textsize:Nn |
-% \calc_ratio_multiply:nn |
-% \calc_ratio_divide:nn |
-% \calc_real_evaluate:nn |
-% \calc_real_multiply:n |
-% \calc_real_divide:n |
-% \calc_maxmin_operation:Nnn |
-% \calc_maxmin_generic:Nnn |
-% \calc_maxmin_div_or_mul:NNnn |
-% \calc_maxmin_multiply: |
-% \calc_maxmin_multiply: |
-% \calc_error:N |
-% \calc_chk_document_counter:nn }
-% Awaiting better documentation ":)"
-% \end{function}
-%
-% \subsection{Module code}
-%
-% Since this is basically a re-worked version of the \textsf{calc}
-% package, I haven't bothered with too many comments except for in the
-% places where this package differs. This may (and should) change at
-% some point.
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%
-% \begin{macro}{\l_calc_expression_tl}
-% \begin{macro}{\g_calc_A_register}
-% \begin{macro}{\l_calc_B_register}
-% \begin{macro}{\l_calc_current_type_int}
-% Here we define some registers and pointers we will need.
-% \begin{macrocode}
-\tl_new:N \l_calc_expression_tl
-\cs_new_nopar:Npn \g_calc_A_register{}
-\cs_new_nopar:Npn \l_calc_B_register{}
-\int_new:N \l_calc_current_type_int
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\g_calc_A_int}
-% \begin{macro}{\l_calc_B_int}
-% \begin{macro}{\l_calc_C_int}
-% \begin{macro}{\g_calc_A_dim}
-% \begin{macro}{\l_calc_B_dim}
-% \begin{macro}{\l_calc_C_dim}
-% \begin{macro}{\g_calc_A_skip}
-% \begin{macro}{\l_calc_B_skip}
-% \begin{macro}{\l_calc_C_skip}
-% \begin{macro}{\g_calc_A_muskip}
-% \begin{macro}{\l_calc_B_muskip}
-% \begin{macro}{\l_calc_C_muskip}
-% For each type of register we will need three registers to do our
-% manipulations.
-% \begin{macrocode}
-\int_new:N \g_calc_A_int
-\int_new:N \l_calc_B_int
-\int_new:N \l_calc_C_int
-\dim_new:N \g_calc_A_dim
-\dim_new:N \l_calc_B_dim
-\dim_new:N \l_calc_C_dim
-\skip_new:N \g_calc_A_skip
-\skip_new:N \l_calc_B_skip
-\skip_new:N \l_calc_C_skip
-\muskip_new:N \g_calc_A_muskip
-\muskip_new:N \l_calc_B_muskip
-\muskip_new:N \l_calc_C_muskip
-% \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}
-%
-%
-%
-% \begin{macro}{\calc_assign_generic:NNNNnn}
-% The generic function. |#1| is a number denoting which type we are
-% doing. (0=int, 1=dim, 2=skip, 3=muskip), |#2| = temp register A,
-% |#3| = temp register B, |#4| is a function acting on |#5| which is
-% the register to be set. |#6| is the calc expression. We do a
-% little extra work so that |\real| and |\ratio| can still be used
-% by the user.
-% \begin{macrocode}
-\cs_new:Npn \calc_assign_generic:NNNNnn#1#2#3#4#5#6{
- \cs_set_eq:NN\g_calc_A_register#2
- \cs_set_eq:NN\l_calc_B_register#3
- \int_set:Nn \l_calc_current_type_int {#1}
- \group_begin:
- \cs_set_eq:NN \real \calc_real:n
- \cs_set_eq:NN \ratio\calc_ratio:nn
- \tl_set:Nx\l_calc_expression_tl{#6}
- \exp_after:wN
- \group_end:
- \exp_after:wN\calc_open:w\exp_after:wN(\l_calc_expression_tl !
- \pref_global:D\g_calc_A_register\l_calc_B_register
- \group_end:
- #4{#5}\l_calc_B_register
-}
-% \end{macrocode}
-% A simpler version relying on |\real| and |\ratio| having our
-% definition is
-% \begin{verbatim}
-% \cs_new:Npn \calc_assign_generic:NNNNnn#1#2#3#4#5#6{
-% \cs_set_eq:NN\g_calc_A_register#2\cs_set_eq:NN\l_calc_B_register#3
-% \int_set:Nn \l_calc_current_type_int {#1}
-% \tl_set:Nx\l_calc_expression_tl{#6}
-% \exp_after:wN\calc_open:w\exp_after:wN(\l_calc_expression_tl !
-% \pref_global:D\g_calc_A_register\l_calc_B_register
-% \group_end:
-% #4{#5}\l_calc_B_register
-% }
-% \end{verbatim}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\calc_int_set:Nn}
-% \begin{macro}{\calc_int_gset:Nn}
-% \begin{macro}{\calc_int_add:Nn}
-% \begin{macro}{\calc_int_gadd:Nn}
-% \begin{macro}{\calc_int_sub:Nn}
-% \begin{macro}{\calc_int_gsub:Nn}
-% Here are the individual versions for the different register
-% types. First integer registers.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_int_set:Nn{
- \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_set:Nn
-}
-\cs_new_nopar:Npn\calc_int_gset:Nn{
- \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_gset:Nn
-}
-\cs_new_nopar:Npn\calc_int_add:Nn{
- \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_add:Nn
-}
-\cs_new_nopar:Npn\calc_int_gadd:Nn{
- \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_gadd:Nn
-}
-\cs_new_nopar:Npn\calc_int_sub:Nn{
- \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_sub:Nn
-}
-\cs_new_nopar:Npn\calc_int_gsub:Nn{
- \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_gsub:Nn
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_dim_set:Nn}
-% \begin{macro}{\calc_dim_gset:Nn}
-% \begin{macro}{\calc_dim_add:Nn}
-% \begin{macro}{\calc_dim_gadd:Nn}
-% \begin{macro}{\calc_dim_sub:Nn}
-% \begin{macro}{\calc_dim_gsub:Nn}
-% Dimens.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_dim_set:Nn{
- \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_set:Nn
-}
-\cs_new_nopar:Npn\calc_dim_gset:Nn{
- \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_gset:Nn
-}
-\cs_new_nopar:Npn\calc_dim_add:Nn{
- \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_add:Nn
-}
-\cs_new_nopar:Npn\calc_dim_gadd:Nn{
- \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_gadd:Nn
-}
-\cs_new_nopar:Npn\calc_dim_sub:Nn{
- \calc_assign_generic:NNNNnn\c_one\g_calc_A_int\l_calc_B_int\dim_sub:Nn
-}
-\cs_new_nopar:Npn\calc_dim_gsub:Nn{
- \calc_assign_generic:NNNNnn\c_one\g_calc_A_int\l_calc_B_int\dim_gsub:Nn
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_skip_set:Nn}
-% \begin{macro}{\calc_skip_gset:Nn}
-% \begin{macro}{\calc_skip_add:Nn}
-% \begin{macro}{\calc_skip_gadd:Nn}
-% \begin{macro}{\calc_skip_sub:Nn}
-% \begin{macro}{\calc_skip_gsub:Nn}
-% Skips.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_skip_set:Nn{
- \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_set:Nn
-}
-\cs_new_nopar:Npn\calc_skip_gset:Nn{
- \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_gset:Nn
-}
-\cs_new_nopar:Npn\calc_skip_add:Nn{
- \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_add:Nn
-}
-\cs_new_nopar:Npn\calc_skip_gadd:Nn{
- \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_gadd:Nn
-}
-\cs_new_nopar:Npn\calc_skip_sub:Nn{
- \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_sub:Nn
-}
-\cs_new_nopar:Npn\calc_skip_gsub:Nn{
- \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_gsub:Nn
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_muskip_set:Nn}
-% \begin{macro}{\calc_muskip_gset:Nn}
-% \begin{macro}{\calc_muskip_add:Nn}
-% \begin{macro}{\calc_muskip_gadd:Nn}
-% \begin{macro}{\calc_muskip_sub:Nn}
-% \begin{macro}{\calc_muskip_gsub:Nn}
-% Muskips.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_muskip_set:Nn{
- \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip
- \muskip_set:Nn
-}
-\cs_new_nopar:Npn\calc_muskip_gset:Nn{
- \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip
- \muskip_gset:Nn
-}
-\cs_new_nopar:Npn\calc_muskip_add:Nn{
- \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip
- \muskip_add:Nn
-}
-\cs_new_nopar:Npn\calc_muskip_gadd:Nn{
- \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip
- \muskip_gadd:Nn
-}
-\cs_new_nopar:Npn\calc_muskip_sub:Nn{
- \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip
- \muskip_add:Nn
-}
-\cs_new_nopar:Npn\calc_muskip_gsub:Nn{
- \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip
- \muskip_gadd:Nn
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\calc_pre_scan:N}
-% In case we found one of the special operations, this should just
-% be executed.
-% \begin{macrocode}
-\cs_new_nopar:Npn \calc_pre_scan:N #1{
- \if_meaning:w(#1
- \exp_after:wN\calc_open:w
- \else:
- \if_meaning:w \calc_textsize:Nn #1
- \else:
- \if_meaning:w \calc_maxmin_operation:Nnn #1
- \else:
-% \end{macrocode}
-% |\calc_numeric:| uses a primitive assignment so doesn't care about
-% these dangling |\fi:|s.
-% \begin{macrocode}
- \calc_numeric:
- \fi:
- \fi:
- \fi:
- #1}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\calc_open:w}
-% \begin{macrocode}
-\cs_new_nopar:Npn \calc_open:w({
- \group_begin:\group_execute_after:N\calc_init_B:
- \group_begin:\group_execute_after:N\calc_init_B:
- \calc_pre_scan:N
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\calc_init_B:}
-% \begin{macro}{\calc_numeric:}
-% \begin{macro}{\calc_close:}
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_init_B:{\l_calc_B_register\g_calc_A_register}
-\cs_new_nopar:Npn\calc_numeric:{
- \tex_afterassignment:D\calc_post_scan:N
- \pref_global:D\g_calc_A_register
-}
-\cs_new_nopar:Npn\calc_close:{
- \group_end:\pref_global:D\g_calc_A_register\l_calc_B_register
- \group_end:\pref_global:D\g_calc_A_register\l_calc_B_register
- \calc_post_scan:N}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_post_scan:N}
-% Look at what token we have and decide where to go.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_post_scan:N#1{
- \if_meaning:w#1!\cs_set_eq:NN\calc_next:w\group_end: \else:
- \if_meaning:w#1+\cs_set_eq:NN\calc_next:w\calc_add: \else:
- \if_meaning:w#1-\cs_set_eq:NN\calc_next:w\calc_subtract: \else:
- \if_meaning:w#1*\cs_set_eq:NN\calc_next:w\calc_multiply:N \else:
- \if_meaning:w#1/\cs_set_eq:NN\calc_next:w\calc_divide:N \else:
- \if_meaning:w#1)\cs_set_eq:NN\calc_next:w\calc_close: \else:
- \if_meaning:w#1\scan_stop:\cs_set_eq:NN\calc_next:w\calc_post_scan:N
- \else:
-% \end{macrocode}
-% If we get here, there is an error but let's also disable
-% |\calc_next:w| since it is otherwise undefined. No need to give
-% extra errors just for that.
-% \begin{macrocode}
- \cs_set_eq:NN \calc_next:w \prg_do_nothing:
- \calc_error:N#1
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- \calc_next:w}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\calc_multiply:N}
-% \begin{macro}{\calc_divide:N}
-% The switches for multiplication and division.
-% \begin{macrocode}
-\cs_new_nopar:Npn \calc_multiply:N #1{
- \if_meaning:w \calc_maxmin_operation:Nnn #1
- \cs_set_eq:NN \calc_next:w \calc_maxmin_multiply:
- \else:
- \if_meaning:w \calc_ratio_multiply:nn #1
- \cs_set_eq:NN \calc_next:w \calc_ratio_multiply:nn
- \else:
- \if_meaning:w \calc_real_evaluate:nn #1
- \cs_set_eq:NN \calc_next:w \calc_real_multiply:n
- \else:
- \cs_set_nopar:Npn \calc_next:w{\calc_multiply: #1}
- \fi:
- \fi:
- \fi:
- \calc_next:w
-}
-\cs_new_nopar:Npn \calc_divide:N #1{
- \if_meaning:w \calc_maxmin_operation:Nnn #1
- \cs_set_eq:NN \calc_next:w \calc_maxmin_divide:
- \else:
- \if_meaning:w \calc_ratio_multiply:nn #1
- \cs_set_eq:NN \calc_next:w \calc_ratio_divide:nn
- \else:
- \if_meaning:w \calc_real_evaluate:nn #1
- \cs_set_eq:NN \calc_next:w \calc_real_divide:n
- \else:
- \cs_set_nopar:Npn \calc_next:w{\calc_divide: #1}
- \fi:
- \fi:
- \fi:
- \calc_next:w
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_generic_add_or_subtract:N}
-% \begin{macro}{\calc_add:}
-% \begin{macro}{\calc_subtract:}
-% \begin{macro}{\calc_add_A_to_B:}
-% \begin{macro}{\calc_subtract_A_from_B:}
-% Here is how we add and subtract.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_generic_add_or_subtract:N#1{
- \group_end:
- \pref_global:D\g_calc_A_register\l_calc_B_register\group_end:
- \group_begin:\group_execute_after:N#1\group_begin:
- \group_execute_after:N\calc_init_B:
- \calc_pre_scan:N}
-\cs_new_nopar:Npn\calc_add:{\calc_generic_add_or_subtract:N\calc_add_A_to_B:}
-\cs_new_nopar:Npn\calc_subtract:{
- \calc_generic_add_or_subtract:N\calc_subtract_A_from_B:}
-% \end{macrocode}
-% Don't use |\tex_advance:D| since it allows overflows.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_add_A_to_B:{
- \l_calc_B_register
- \if_case:w\l_calc_current_type_int
- \etex_numexpr:D\or:
- \etex_dimexpr:D\or:
- \etex_glueexpr:D\or:
- \etex_muexpr:D\fi:
- \l_calc_B_register + \g_calc_A_register\scan_stop:
-}
-\cs_new_nopar:Npn\calc_subtract_A_from_B:{
- \l_calc_B_register
- \if_case:w\l_calc_current_type_int
- \etex_numexpr:D\or:
- \etex_dimexpr:D\or:
- \etex_glueexpr:D\or:
- \etex_muexpr:D\fi:
- \l_calc_B_register - \g_calc_A_register\scan_stop:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_generic_multiply_or_divide:N}
-% \begin{macro}{\calc_multiply_B_by_A:}
-% \begin{macro}{\calc_divide_B_by_A:}
-% \begin{macro}{\calc_multiply:}
-% \begin{macro}{\calc_divide:}
-% And here is how we multiply and divide. Note that we do not use the
-% primitive \TeX{} operations but the expandable operations provided
-% by \eTeX. This means that all results are rounded not truncated!
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_generic_multiply_or_divide:N#1{
- \group_end:
- \group_begin:
- \cs_set_eq:NN\g_calc_A_register\g_calc_A_int
- \cs_set_eq:NN\l_calc_B_register\l_calc_B_int
- \int_zero:N \l_calc_current_type_int
- \group_execute_after:N#1\calc_pre_scan:N
-}
-\cs_new_nopar:Npn\calc_multiply_B_by_A:{
- \l_calc_B_register
- \if_case:w\l_calc_current_type_int
- \etex_numexpr:D\or:
- \etex_dimexpr:D\or:
- \etex_glueexpr:D\or:
- \etex_muexpr:D\fi:
- \l_calc_B_register*\g_calc_A_int\scan_stop:
-}
-\cs_new_nopar:Npn\calc_divide_B_by_A:{
- \l_calc_B_register
- \if_case:w\l_calc_current_type_int
- \etex_numexpr:D\or:
- \etex_dimexpr:D\or:
- \etex_glueexpr:D\or:
- \etex_muexpr:D\fi:
- \l_calc_B_register/\g_calc_A_int\scan_stop:
-}
-\cs_new_nopar:Npn\calc_multiply:{
- \calc_generic_multiply_or_divide:N\calc_multiply_B_by_A:}
-\cs_new_nopar:Npn\calc_divide:{
- \calc_generic_multiply_or_divide:N\calc_divide_B_by_A:}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_calculate_box_size:nnn}
-% \begin{macro}[aux]{\calc_calculate_box_size_aux:n}
-% Put something in a box and measure it. |#1| is a list of
-% |\box_ht:N| etc., |#2| should be |\dim_set:Nn|\meta{dim register}
-% or |\dim_gset:Nn|\meta{dim register} and |#3| is the contents.
-% \begin{macrocode}
-\cs_new:Npn \calc_calculate_box_size:nnn #1#2#3{
- \hbox_set:Nn \l_tmpa_box {{#3}}
- #2{\c_zero_dim \tl_map_function:nN{#1}\calc_calculate_box_size_aux:n}
-}
-% \end{macrocode}
-% Helper for calculating the final dimension.
-% \begin{macrocode}
-\cs_set_nopar:Npn \calc_calculate_box_size_aux:n#1{ + #1\l_tmpa_box}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\calc_textsize:Nn}
-% Now we can define |\calc_textsize:Nn|.
-% \begin{macrocode}
-\cs_set_protected:Npn \calc_textsize:Nn#1#2{
- \group_begin:
- \cs_set_eq:NN\calc_widthof_aux:n\box_wd:N
- \cs_set_eq:NN\calc_heightof_aux:n\box_ht:N
- \cs_set_eq:NN\calc_depthof_aux:n\box_dp:N
- \cs_set_nopar:Npn\calc_totalheightof_aux:n{\box_ht:N\box_dp:N}
- \exp_args:No\calc_calculate_box_size:nnn{#1}
- {\dim_gset:Nn\g_calc_A_register}
-% \end{macrocode}
-% Restore the four user commands here since there might be a recursive
-% call.
-% \begin{macrocode}
- {
- \cs_set_eq:NN \calc_depthof_aux:n \calc_depthof_auxi:n
- \cs_set_eq:NN \calc_widthof_aux:n \calc_widthof_auxi:n
- \cs_set_eq:NN \calc_heightof_aux:n \calc_heightof_auxi:n
- \cs_set_eq:NN \calc_totalheightof_aux:n \calc_totalheightof_auxi:n
- #2
- }
- \group_end:
- \calc_post_scan:N
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\calc_ratio_multiply:nn}
-% \begin{macro}{\calc_ratio_divide:nn}
-% Evaluate a ratio. If we were already evaluation a \meta{muskip}
-% register, the ratio is probably also done with this type and we'll
-% have to convert them to regular points.
-% \begin{macrocode}
-\cs_set_protected:Npn\calc_ratio_multiply:nn#1#2{
- \group_end:\group_begin:
- \if_num:w\l_calc_current_type_int < \c_three
- \calc_dim_set:Nn\l_calc_B_int{#1}
- \calc_dim_set:Nn\l_calc_C_int{#2}
- \else:
- \calc_dim_muskip:Nn{\l_calc_B_int\etex_mutoglue:D}{#1}
- \calc_dim_muskip:Nn{\l_calc_C_int\etex_mutoglue:D}{#2}
- \fi:
-% \end{macrocode}
-% Then store the ratio as a fraction, which we just pass on.
-% \begin{macrocode}
- \cs_gset_nopar:Npx\calc_calculated_ratio:{
- \int_use:N\l_calc_B_int/\int_use:N\l_calc_C_int
- }
- \group_end:
-% \end{macrocode}
-% Here we set the new value of |\l_calc_B_register| and remember to
-% evaluate it as the correct type. Note that the intermediate
-% calculation is a scaled operation (meaning the intermediate value is
-% 64-bit) so we don't get into trouble when first multiplying by a
-% large number and then dividing.
-% \begin{macrocode}
- \l_calc_B_register
- \if_case:w\l_calc_current_type_int
- \etex_numexpr:D\or:
- \etex_dimexpr:D\or:
- \etex_glueexpr:D\or:
- \etex_muexpr:D\fi:
- \l_calc_B_register*\calc_calculated_ratio:\scan_stop:
- \group_begin:
- \calc_post_scan:N}
-% \end{macrocode}
-% Division is just flipping the arguments around.
-% \begin{macrocode}
-\cs_new:Npn \calc_ratio_divide:nn#1#2{\calc_ratio_multiply:nn{#2}{#1}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_real_evaluate:nn}
-% \begin{macro}{\calc_real_multiply:n}
-% \begin{macro}{\calc_real_divide:n}
-% Although we could define the |\real| function as a subcase of
-% |\ratio|, this is horribly inefficient since we just want to convert
-% the decimal to a fraction.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn\calc_real_evaluate:nn #1#2{
- \group_end:
- \l_calc_B_register
- \if_case:w\l_calc_current_type_int
- \etex_numexpr:D\or:
- \etex_dimexpr:D\or:
- \etex_glueexpr:D\or:
- \etex_muexpr:D\fi:
- \l_calc_B_register *
- \tex_number:D \dim_eval:n{#1pt}/
- \tex_number:D\dim_eval:n{#2pt}
- \scan_stop:
- \group_begin:
- \calc_post_scan:N}
-\cs_new_nopar:Npn \calc_real_multiply:n #1{\calc_real_evaluate:nn{#1}{1}}
-\cs_new_nopar:Npn \calc_real_divide:n {\calc_real_evaluate:nn{1}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_maxmin_operation:Nnn}
-% \begin{macro}{\calc_maxmin_generic:Nnn}
-% \begin{macro}{\calc_maxmin_div_or_mul:NNnn}
-% \begin{macro}{\calc_maxmin_multiply:}
-% \begin{macro}{\calc_maxmin_multiply:}
-% The max and min functions.
-% \begin{macrocode}
-\cs_set_protected:Npn\calc_maxmin_operation:Nnn#1#2#3{
- \group_begin:
- \calc_maxmin_generic:Nnn#1{#2}{#3}
- \group_end:
- \calc_post_scan:N
-}
-% \end{macrocode}
-% |#1| is either |>| or |<| and was expanded into this initially.
-% \begin{macrocode}
-\cs_new_protected:Npn \calc_maxmin_generic:Nnn#1#2#3{
- \group_begin:
- \if_case:w\l_calc_current_type_int
- \calc_int_set:Nn\l_calc_C_int{#2}%
- \calc_int_set:Nn\l_calc_B_int{#3}%
- \pref_global:D\g_calc_A_register
- \if_num:w\l_calc_C_int#1\l_calc_B_int
- \l_calc_C_int\else:\l_calc_B_int\fi:
- \or:
- \calc_dim_set:Nn\l_calc_C_dim{#2}%
- \calc_dim_set:Nn\l_calc_B_dim{#3}%
- \pref_global:D\g_calc_A_register
- \if_dim:w\l_calc_C_dim#1\l_calc_B_dim
- \l_calc_C_dim\else:\l_calc_B_dim\fi:
- \or:
- \calc_skip_set:Nn\l_calc_C_skip{#2}%
- \calc_skip_set:Nn\l_calc_B_skip{#3}%
- \pref_global:D\g_calc_A_register
- \if_dim:w\l_calc_C_skip#1\l_calc_B_skip
- \l_calc_C_skip\else:\l_calc_B_skip\fi:
- \else:
- \calc_muskip_set:Nn\l_calc_C_muskip{#2}%
- \calc_muskip_set:Nn\l_calc_B_muskip{#3}%
- \pref_global:D\g_calc_A_register
- \if_dim:w\l_calc_C_muskip#1\l_calc_B_muskip
- \l_calc_C_muskip\else:\l_calc_B_muskip\fi:
- \fi:
- \group_end:
-}
-\cs_new:Npn\calc_maxmin_div_or_mul:NNnn#1#2#3#4{
- \group_end:
- \group_begin:
- \int_zero:N\l_calc_current_type_int
- \group_execute_after:N#1
- \calc_maxmin_generic:Nnn#2{#3}{#4}
- \group_end:
- \group_begin:
- \calc_post_scan:N
-}
-\cs_new_nopar:Npn\calc_maxmin_multiply:{
- \calc_maxmin_div_or_mul:NNnn\calc_multiply_B_by_A:}
-\cs_new_nopar:Npn\calc_maxmin_divide: {
- \calc_maxmin_div_or_mul:NNnn\calc_divide_B_by_A:}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_error:N}
-% The error message.
-% \begin{macrocode}
-\cs_new_nopar:Npn\calc_error:N#1{
- \PackageError{calc}
- {`\token_to_str:N#1'~ invalid~ at~ this~ point}
- {I~ expected~ to~ see~ one~ of:~ +~ -~ *~ /~ )}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Higher level commands}
-%
-% The various operations allowed.
-%
-% \begin{macro}{\calc_maxof:nn}
-% \begin{macro}{\calc_minof:nn}
-% \begin{macro}{\maxof}
-% \begin{macro}{\minof}
-% Max and min operations
-% \begin{macrocode}
-\cs_new:Npn \calc_maxof:nn#1#2{
- \calc_maxmin_operation:Nnn > \exp_not:n{{#1}{#2}}
-}
-\cs_new:Npn \calc_minof:nn#1#2{
- \calc_maxmin_operation:Nnn < \exp_not:n{{#1}{#2}}
-}
-\cs_set_eq:NN \maxof \calc_maxof:nn
-\cs_set_eq:NN \minof \calc_minof:nn
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_widthof:n}
-% \begin{macro}[aux]{\calc_widthof_aux:n}
-% \begin{macro}[aux]{\calc_widthof_auxi:n}
-% \begin{macro}{\calc_heightof:n}
-% \begin{macro}[aux]{\calc_heightof_aux:n}
-% \begin{macro}[aux]{\calc_heightof_auxi:n}
-% \begin{macro}{\calc_depthof:n}
-% \begin{macro}[aux]{\calc_depthof_aux:n}
-% \begin{macro}[aux]{\calc_depthof_auxi:n}
-% \begin{macro}{\calc_totalheightof:n}
-% \begin{macro}[aux]{\calc_totalheightof_aux:n}
-% \begin{macro}[aux]{\calc_totalheightof_auxi:n}
-% Text dimension commands.
-% \begin{macrocode}
-\cs_new:Npn \calc_widthof:n#1{
- \calc_textsize:Nn \exp_not:N\calc_widthof_aux:n\exp_not:n{{#1}}
-}
-\cs_new:Npn \calc_heightof:n#1{
- \calc_textsize:Nn \exp_not:N\calc_heightof_aux:n\exp_not:n{{#1}}
-}
-\cs_new:Npn \calc_depthof:n#1{
- \calc_textsize:Nn \exp_not:N\calc_depthof_aux:n\exp_not:n{{#1}}
-}
-\cs_new:Npn \calc_totalheightof:n#1{
- \calc_textsize:Nn \exp_not:N\calc_totalheightof_aux:n \exp_not:n{{#1}}
-}
-\cs_new:Npn \calc_widthof_aux:n #1{
- \exp_not:N\calc_widthof_aux:n\exp_not:n{{#1}}
-}
-\cs_new_eq:NN \calc_widthof_auxi:n \calc_widthof_aux:n
-\cs_new:Npn \calc_depthof_aux:n #1{
- \exp_not:N\calc_depthof_aux:n\exp_not:n{{#1}}
-}
-\cs_new_eq:NN \calc_depthof_auxi:n \calc_depthof_aux:n
-\cs_new:Npn \calc_heightof_aux:n #1{
- \exp_not:N\calc_heightof_aux:n\exp_not:n{{#1}}
-}
-\cs_new_eq:NN \calc_heightof_auxi:n \calc_heightof_aux:n
-\cs_new:Npn \calc_totalheightof_aux:n #1{
- \exp_not:N\calc_totalheightof_aux:n\exp_not:n{{#1}}
-}
-\cs_new_eq:NN \calc_totalheightof_auxi:n \calc_totalheightof_aux:n
-% \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}
-%
-% \begin{macro}{\calc_ratio:nn}
-% \begin{macro}{\calc_real:n}
-% Ratio and real.
-% \begin{macrocode}
-\cs_new:Npn \calc_ratio:nn#1#2{
- \calc_ratio_multiply:nn\exp_not:n{{#1}{#2}}}
-\cs_new_nopar:Npn \calc_real:n {\calc_real_evaluate:nn}
-% \end{macrocode}
-% We can implement real and ratio without actually using these
-% names. We'll see.
-% \begin{macrocode}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\widthof}
-% \begin{macro}{\heightof}
-% \begin{macro}{\depthof}
-% \begin{macro}{\totalheightof}
-% \begin{macro}{\ratio}
-% \begin{macro}{\real}
-% User commands.
-% \begin{macrocode}
-\cs_set_eq:NN \depthof\calc_depthof:n
-\cs_set_eq:NN \widthof\calc_widthof:n
-\cs_set_eq:NN \heightof\calc_heightof:n
-\cs_set_eq:NN \totalheightof\calc_totalheightof:n
-%%\cs_set_eq:NN \ratio\calc_ratio:nn
-%%\cs_set_eq:NN \real\calc_real:n
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\setlength}
-% \begin{macro}{\gsetlength}
-% \begin{macro}{\addtolength}
-% \begin{macro}{\gaddtolength}
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \setlength{\calc_skip_set:Nn}
-\cs_set_protected_nopar:Npn \gsetlength{\calc_skip_gset:Nn}
-\cs_set_protected_nopar:Npn \addtolength{\calc_skip_add:Nn}
-\cs_set_protected_nopar:Npn \gaddtolength{\calc_skip_gadd:Nn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\calc_setcounter:nn}
-% \begin{macro}{\calc_addtocounter:nn}
-% \begin{macro}{\calc_stepcounter:n}
-% \begin{macro}{\setcounter}
-% \begin{macro}{\addtocounter}
-% \begin{macro}{\stepcounter}
-% \begin{macro}{\calc_chk_document_counter:nn}
-% Document commands for \LaTeXe\ counters. Also add support for
-% \textsf{amstext}. Note that when \textsf{l3breqn} is used,
-% |\mathchoice| will no longer need this switch as the argument is
-% only executed once.
-% \begin{macrocode}
-%</initex|package>
-%<*package>
-\newif\iffirstchoice@ \firstchoice@true
-%</package>
-%<*initex|package>
-\cs_set_protected_nopar:Npn \calc_setcounter:nn#1#2{
- \calc_chk_document_counter:nn{#1}{
- \exp_args:Nc\calc_int_gset:Nn {c@#1}{#2}
- }
-}
-\cs_set_protected_nopar:Npn \calc_addtocounter:nn#1#2{
-%</initex|package>
-%<*package>
- \iffirstchoice@
-%</package>
-%<*initex|package>
- \calc_chk_document_counter:nn{#1}{
- \exp_args:Nc\calc_int_gadd:Nn {c@#1}{#2}
- }
-%</initex|package>
-%<*package>
- \fi:
-%</package>
-%<*initex|package>
-}
-\cs_set_protected_nopar:Npn \calc_stepcounter:n#1{
-%</initex|package>
-%<*package>
- \iffirstchoice@
-%</package>
-%<*initex|package>
- \calc_chk_document_counter:nn{#1}{
- \int_gincr:c {c@#1}
- \group_begin:
- \cs_set_eq:NN \@elt\@stpelt \use:c{cl@#1}
- \group_end:
- }
-%</initex|package>
-%<*package>
- \fi:
-%</package>
-%<*initex|package>
-}
-\cs_new_nopar:Npn \calc_chk_document_counter:nn#1{
- \cs_if_free:cTF{c@#1}{\@nocounterr {#1}}
-}
-\cs_set_eq:NN \setcounter \calc_setcounter:nn
-\cs_set_eq:NN \addtocounter \calc_addtocounter:nn
-\cs_set_eq:NN \stepcounter \calc_stepcounter:n
-%</initex|package>
-%<*package>
-\AtBeginDocument{
- \cs_set_eq:NN \setcounter \calc_setcounter:nn
- \cs_set_eq:NN \addtocounter \calc_addtocounter:nn
- \cs_set_eq:NN \stepcounter \calc_stepcounter:n
-}
-% \end{macrocode}
-% Prevent the usual \textsf{calc} from loading.
-% \begin{macrocode}
-\cs_set_nopar:cpn{ver@calc.sty}{2005/08/06}
-%</package>
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx
deleted file mode 100644
index d7217f8eb97..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx
+++ /dev/null
@@ -1,531 +0,0 @@
-% \iffalse
-%% File: l3candidates.dtx Copyright (C) 2005-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{expl3}
-%</driver|package>
-%\fi
-\errorcontextlines=999
-\GetIdInfo$Id: l3candidates.dtx 2233 2011-04-14 06:32:45Z joseph $
- {L3 Experimental 'extras' module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3candidates.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3candidates} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \section{Intro}
-%
-% This \emph{experimental} package contains additions to the \pkg{expl3}
-% programming language before they're added to the `official' packages.
-% The functions defined within will fall into three categories:
-% \begin{itemize}
-% \item Will be added directly to a corresponding \pkg{expl3} module at some stage.
-% \item Will be re-worked and added to a module with slightly different name or behaviour.
-% \item Will eventually vanish.
-% \end{itemize}
-% Beware, then, that loading this package and using its contents may cause your
-% code to break down the track.
-%
-% \section{Functions for characters}
-%
-%
-% \begin{function}{\char_active_set:Npn|\char_active_gset:Npn}
-% \begin{syntax}
-% |\char_active_set:Npn|~<char>~<param>~<definition>
-% \end{syntax}
-% Makes <char> active and gives it the definition specified as if it were
-% a function.
-% \end{function}
-%
-% \begin{function}{\char_active_set_eq:NN|\char_active_gset_eq:NN}
-% \begin{syntax}
-% |\char_active_set:Npn|~<char>~<function>
-% \end{syntax}
-% Makes <char> active and makes it equal to <function>.
-% (Or another active char, etc.)
-% \end{function}
-%
-%
-%
-% \section{Functions for token lists}
-%
-% \begin{function}{\tl_trim_spaces:n|\tl_trim_spaces:N}
-% \begin{syntax}
-% |\tl_trim_spaces:n|~|{|<token list>|}|
-% |\tl_trim_spaces:n|~|{|\verb*| |<token list>\verb*| ||}|
-% |\tl_trim_spaces:N| <tl var.>
-% \end{syntax}
-% After a full expansion, |\tl_trim_space:n| returns <token list> stripped
-% of any preceeding and trailing spaces.
-% For example, to set a token list variable to a trim-spaced argument,
-% use something like this:
-% \begin{verbatim}
-% \tl_set:Nx \l_tmpa_tl { \tl_trim_spaces:n {#1} }
-% \end{verbatim}
-% |\tl_trim_spaces:N| removes preceeding and trailing spaces from the
-% contents of its token list variable argument.
-% \end{function}
-%
-%
-% \section{Functions for sequences}
-%
-%
-% \begin{function}{\seq_mapthread_function:NNN}
-% \begin{syntax}
-% "\seq_mapthread_function:NNN" <seq1> <seq2> <function>
-% \end{syntax}
-% Applies to <function> as arguments each pair of
-% corresponding elements within <seq1> and <seq2> (which must have the same
-% number of elements).
-%
-% For example, if "\l_mya_seq" contains "a", "b", "c" and
-% "\l_myb_seq" contains "x", "y", "z", then
-% \begin{verbatim}
-% \seq_mapthread_function:NNN \l_mya_seq \l_myb_seq \my_func:nn
-% \end{verbatim}
-% is the same as executing
-% \begin{verbatim}
-% \my_func:nn {a} {x}
-% \my_func:nn {b} {y}
-% \my_func:nn {c} {z}
-% \end{verbatim}
-% \end{function}
-%
-%
-% \begin{function}{\seq_get_length:NN}
-% \begin{syntax}
-% |\seq_get_length:NN| <seq> <int>
-% \end{syntax}
-% Sets <int> to the number of elements in <seq>.
-% \end{function}
-%
-%
-% \begin{function}{\seq_set_from_clist:NN|\seq_set_from_clist:Nn|
-% \seq_gset_from_clist:NN|\seq_gset_from_clist:Nn}
-% \begin{syntax}
-% "\seq_set_from_clist:Nn" <seq> \Arg{clist}
-% "\seq_set_from_clist:NN" <seq> <clist variable>
-% \end{syntax}
-% Transforms comma-list <clist> into sequence <seq>.
-% \end{function}
-%
-%
-% \section{Functions for comma-lists}
-%
-% \begin{function}{\clist_set_from_seq:NN|\clist_gset_from_seq:NN}
-% \begin{syntax}
-% "\clist_set_from_seq:NN" <clist> <seq>
-% \end{syntax}
-% Transforms sequence <seq> into comma-list variable <clist>.
-% \end{function}
-%
-%
-% \begin{function}{\clist_if_in_numrange:nn / (TF)}
-% \begin{syntax}
-% "\clist_if_in_numrange:nnTF" \Arg{intexpr} \Arg{numrange}
-% \Arg{true} \Arg{false}
-% \end{syntax}
-% When parsing user input to specify whether numerical elements
-% should be displayed/operated upon, it is common to use input such as
-% `|-4,7-11,17-|' to indicate ranged but sometimes discontiguous sets.
-% (In this particular example, we'd be specifying
-% $x\le4 \wedge 7\le x\le 11 \wedge x\ge 17$.)
-% This function can be used to test whether the input number
-% (actually <intexpr>) exists within the specified <numrange>.
-%
-% <numrange> need not be sorted and may contain overlapping ranges.
-% Numbers inside ranges may consist of integer expressions or anything
-% considered by \TeX\ to be a number
-% (such as `|`\A|', which is decimal number 65).
-%
-% This function could probably be made expandable with sufficient effort.
-% \end{function}
-%
-%
-%
-%\begin{function}{
-% \clist_length:N / (EXP) |
-% \clist_length:c / (EXP) |
-% \clist_length:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{clist_length:N} \Arg{comma-list}
-% \end{syntax}
-% Counts the number of \meta{elements} in the \Arg{comma-list} and
-% leaves this information in the input stream. The number of
-% \meta{elements} will be one more than the number of unbraced
-% \verb"," tokens of category code \( 12 \) (other) within the
-% \meta{comma-list}. This function requires two expansions,
-% giving an \meta{integer denotation}.
-%\end{function}
-%
-%\begin{function}{
-% \clist_item:Nn / (EXP) |
-% \clist_item:cn / (EXP) |
-% \clist_item:nn / (EXP) |
-%}
-% \begin{syntax}
-% \cs{clist_item:Nn} \Arg{comma-list} \Arg{offset}
-% \end{syntax}
-% Locates the \meta{element} in the \meta{comma-list} with the
-% \meta{offset} specified, and leaves the result in the input stream.
-% The \meta{offset} should be an integer expression, and is the number
-% of places from the start of the list at which the \meta{element} is
-% located. The there is no \meta{element} with the \meta{offset}
-% specified then the full expansion of the function will be empty.
-% Negative \meta{offset} values work from the end of the
-% \meta{comma-list}, such that and \meta{meta} of \( -1 \) will
-% leave the last item of the \meta{comma-list} in the input stream.
-%\end{function}
-%
-%
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{Implementation}
-%
-%
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%
-% \begin{macro}{\char_active_set:Npn,\char_active_set:Npx,\char_active_gset:Npn,\char_active_gset:Npx}
-% \begin{macro}{\char_active_set_eq:NN,\char_active_gset_eq:NN}
-% \begin{macrocode}
-\group_begin:
-\char_make_active:N \^^@
-\cs_set:Npn \char_tmp:NN #1#2
- {
- \cs_new:Npn #1 ##1
- {
- \char_make_active:n { `##1 }
- \group_begin:
- \tex_lccode:D `\^^@ `##1
- \tex_lowercase:D { \group_end: #2 ^^@ }
- }
- }
-\char_tmp:NN \char_active_set:Npn \cs_set:Npn
-\char_tmp:NN \char_active_set:Npx \cs_set:Npx
-\char_tmp:NN \char_active_gset:Npn \cs_gset:Npn
-\char_tmp:NN \char_active_gset:Npx \cs_gset:Npx
-\char_tmp:NN \char_active_set_eq:NN \cs_set_eq:NN
-\char_tmp:NN \char_active_gset_eq:NN \cs_gset_eq:NN
-\group_end:
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\tl_trim_spaces:n,\tl_trim_spaces:N}
-% \begin{macrocode}
-\cs_new:Npn \tl_trim_spaces:n #1 {
- \exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \tl_trim_spaces_exp:n {#1} }
-}
-\cs_new:Npn \tl_trim_spaces:N #1 {
- \tl_set:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\char_make_math_shift:N \Q
-\cs_new:Npn \tl_trim_spaces_exp:n #1 {
- \tex_romannumeral:D -`\q \tl_trim_spaces_aux_i:w \exp_not:N #1 Q~Q
-}
-\cs_new:Npn \tl_trim_spaces_aux_i:w #1~Q { \tl_trim_spaces_aux_ii:w #1 Q }
-\cs_new:Npn \tl_trim_spaces_aux_ii:w #1 Q #2 {#1}
-\char_make_letter:N \Q
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\seq_mapthread_function:NNN}
-% \begin{macrocode}
-\seq_new:N \l_tmpb_seq
-% \end{macrocode}
-%
-%
-% \begin{macrocode}
-\cs_new:Nn \seq_mapthread_function:NNN {
- \seq_get_length:NN \l_tmpa_int #1
- \seq_get_length:NN \l_tmpb_int #2
- \int_compare:nTF { \l_tmpa_int == \l_tmpb_int }{
- \seq_set_eq:NN \l_tmpa_seq #1
- \seq_set_eq:NN \l_tmpb_seq #2
- \prg_stepwise_inline:nnnn{1}{1}{\l_tmpa_int}{
- \seq_pop:NN \l_tmpa_seq \l_kernel_tmpa_tl
- \seq_pop:NN \l_tmpb_seq \l_kernel_tmpb_tl
- \exp_args:NVV #3 \l_kernel_tmpa_tl \l_kernel_tmpb_tl
- }
- }{\ERROR}
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\seq_set_from_clist:Nn,\seq_set_from_clist:NN}
-% \begin{macro}{\seq_gset_from_clist:Nn,\seq_gset_from_clist:NN}
-% \begin{macrocode}
-\cs_set:Npn \seq_set_from_clist:Nn #1#2 {
- \seq_clear:N #1
- \clist_map_inline:nn {#2} { \seq_put_right:Nn #1 {##1} }
-}
-\cs_set:Npn \seq_set_from_clist:NN #1#2 {
- \seq_clear:N #1
- \clist_map_inline:Nn #2 { \seq_put_right:Nn #1 {##1} }
-}
-\cs_set:Npn \seq_gset_from_clist:Nn #1#2 {
- \seq_gclear:N #1
- \clist_map_inline:nn {#2} { \seq_gput_right:Nn #1 {##1} }
-}
-\cs_set:Npn \seq_gset_from_clist:NN #1#2 {
- \seq_gclear:N #1
- \clist_map_inline:Nn #2 { \seq_gput_right:Nn #1 {##1} }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\clist_set_from_seq:NN,\clist_gset_from_seq:NN}
-% I assume this technique is more efficient than looping through each element
-% and using "\clist_put_right:Nn" (Will).
-% \begin{macrocode}
-\cs_new:Npn \clist_set_from_seq_aux:NNN #1#2#3 {
- \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: ##2 {
- \exp_not:n {##1}
- \quark_if_nil:NF ##2 { , ##2 }
- }
- #1 #2 { #3 \q_nil }
-}
-\cs_new:Npn \clist_set_from_seq:NN { \clist_set_from_seq_aux:NNN \tl_set:Nx }
-\cs_new:Npn \clist_gset_from_seq:NN { \clist_set_from_seq_aux:NNN \tl_gset:Nx }
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}[TF]{\clist_if_in_numrange:nn}
-% A `numrange' is like |-2,5-8,17-| (can be unsorted).
-% \begin{macrocode}
-\prg_new_conditional:Nnn \clist_if_in_numrange:nn {TF,T,F} {
- \bool_set_false:N \l_clist_numrange_bool
- \clist_map_inline:nn {#2} {
- \_clist_numrange_parse:nw {#1} ##1 - \q_nil - \q_stop
- }
- \bool_if:NTF \l_clist_numrange_bool \prg_return_true: \prg_return_false:
-}
-\cs_set:Npn \_clist_numrange_success: {
- \bool_set_true:N \l_clist_numrange_bool
- \clist_map_break:
-}
-\cs_set:Npn \_clist_numrange_parse:nw #1 #2 - #3 - #4 \q_stop {
- \tl_if_empty:nTF {#4}{
- \int_compare:nT {#1=#2} {\_clist_numrange_success:}
- }{
- \tl_if_empty:nTF {#3}{
- \int_compare:nT {#1>=#2} {\_clist_numrange_success:}
- }{
- \tl_if_empty:nTF {#2}{
- \int_compare:nT {#1<=#3} {\_clist_numrange_success:}
- }{
- \int_compare:nT {#1>=#2} {
- \int_compare:nT {#1<=#3}
- {\_clist_numrange_success:}
- }
- }
- }
- }
-}
-\bool_new:N \l_clist_numrange_bool
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\seq_length:N}
-% \begin{macrocode}
-\cs_new:Nn \seq_length:N {
- \tex_number:D \etex_numexpr:D
- 0
- \seq_map_function:NN #1 \tl_elt_count_aux:n
- \scan_stop:
-}
-\cs_generate_variant:Nn \seq_length:N { c }
-% \end{macrocode}
-% \end{macro}
-%
-%\begin{macro}{\clist_length:N,\clist_length:c,\clist_length:n}
-% Counting the elements in a comma-list is straight-forward, using the
-% same approach as for other lists of tokens.
-% \begin{macrocode}
-\cs_new_nopar:Npn \clist_length:N #1 {
- \tex_number:D \etex_numexpr:D
- 0
- \clist_map_function:NN #1 \tl_elt_count_aux:n
- \scan_stop:
-}
-\cs_generate_variant:Nn \clist_length:N { c }
-\cs_new_nopar:Npn \clist_length:n #1 {
- \tex_number:D \etex_numexpr:D
- 0
- \clist_map_function:nN {#1} \tl_elt_count_aux:n
- \scan_stop:
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\clist_item:Nn,\clist_item:cn,\clist_item:nn}
-%\begin{macro}[aux]{\clist_element_aux:nw}
-% Recovering an item from a list is indexed from \( 0 \), with negative
-% numbers meaning ``from the end of the list''. So the first test
-% discriminates the two cases. For negative numbers, there is therefore
-% a need to know the number of items in the list before doing the
-% second phase, a recursion which will give an empty result if the
-% number is too big.
-% \begin{macrocode}
-\cs_new_nopar:Npn \clist_item:Nn #1#2 {
- \exp_args:No \clist_item:nn {#1} {#2}
-}
-\cs_generate_variant:Nn \clist_item:Nn { c }
-\cs_new:Npn \clist_item:nn #1#2 {
- \int_compare:nNnTF {#2} < { 0 }
- {
- \exp_args:Nf \clist_item_aux:nw
- { \clist_length:n {#1} + #2 }
- #1 , \q_recursion_tail \q_recursion_stop
- }
- {
- \clist_item_aux:nw {#2} #1
- , \q_recursion_tail \q_recursion_stop
- }
-}
-\cs_new:Npn \clist_item_aux:nw #1#2 , #3 {
- \int_compare:nNnTF {#1} = { 0 }
- { \use_i_delimit_by_q_recursion_stop:nw {#2} }
- {
- \quark_if_recursion_tail_stop:n {#3}
- \clist_item_aux:nw { #1 - 1 } #3
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-% \begin{macro}{\seq_map_expandable:NN}
-% Expandable form of "\seq_map_function:NN".
-% \begin{macrocode}
-\cs_new:Npn \seq_map_expandable:NN #1#2 {
- \exp_last_unbraced:NNo \seq_map_exp_aux:Nw #2 #1
- \seq_elt:w \q_recursion_tail \seq_elt_end:
- \q_recursion_stop
-}
-\cs_new:Npn \seq_map_exp_aux:Nw #1 \seq_elt:w #2 \seq_elt_end: {
- \quark_if_recursion_tail_stop:n {#2}
- #1 {#2}
- \seq_map_exp_aux:Nw #1
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\seq_item:Nn,\seq_item:cn}
-% \begin{macrocode}
-\cs_new:Npn \seq_item:Nn #1#2 {
- \int_compare:nNnTF {#2} < { 0 }
- {
- \exp_args:Nfo
- \seq_item_aux:nn { \int_eval:n {\seq_length:N #1 + #2} } {#1}
- }
- {
- \exp_args:Nno \seq_item_aux:nn {#2} {#1}
- }
-}
-\cs_generate_variant:Nn \seq_item:Nn { c }
-\cs_new:Npn \seq_item_aux:nn #1#2 {
- \seq_item_aux:nw {#1} #2
- \seq_elt:w \q_recursion_tail \seq_elt_end:
- \q_recursion_stop
-}
-\cs_new:Npn \seq_item_aux:nw #1 \seq_elt:w #2 \seq_elt_end: {
- \int_compare:nNnTF {#1} = { 0 }
- { \use_i_delimit_by_q_recursion_stop:nw {#2} }
- {
- \quark_if_recursion_tail_stop:n {#2}
- \exp_args:Nf \seq_item_aux:nw { \int_eval:n { #1 - 1 } }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%%
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-%
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3chk.dtx b/Master/texmf-dist/source/latex/expl3/l3chk.dtx
deleted file mode 100644
index 9153433d4a5..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3chk.dtx
+++ /dev/null
@@ -1,387 +0,0 @@
-% \iffalse
-%% File: l3chk.dtx Copyright (C) 1990-2006,2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3chk.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental check module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3chk} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Checking things\ldots}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% To ensure that functions and variables are properly used certain
-% checking functions are implemented that may or may not be compiled
-% into the final format.
-%
-% \section{Tracing}
-%
-% \begin{function}{\tracingall |
-% \absolutelytracingall |
-% \donotcheck |
-% \tracingoff |
-% \traceon |
-% \traceoff }
-% Commands to control the level of verbosity in the tracing output.
-% \end{function}
-%
-% \section{Functions}
-%
-% \begin{function}{%
-% \chk_var_or_const:N |
-% }
-% \begin{syntax}
-% "\chk_var_or_const:N" <cs>
-% \end{syntax}
-% Checks that <cs> is a proper variable or constant which means that its
-% name starts out with "\L", "\l", "\G", "\g", "\R", "\C", "\c", or "\q".
-% \end{function}
-%
-% \begin{function}{%
-% \chk_local:N |
-% \chk_global:N |
-% }
-% \begin{syntax}
-% "\chk_local:N" <cs>
-% \end{syntax}
-% Checks that <cs> is a proper local or global variable. This means that
-% its name starts out with "\L", "\l", or "\G", "\g" respectively.
-% \end{function}
-%
-% \begin{function}{%
-% \chk_local_or_pref_global:N |
-% \pref_global_chk: |
-% }
-% To allow implementations where we precede some function with
-% "\pref_global:D" without loosing the possibility to check for the
-% correct variable type the following helper functions can be used:
-% "\chk_local_or_pref_global:N" <cs> is the variable check which is
-% usually let to "\chk_local:N", i.e.\ it will check that its argument
-% is a local variable. This behavior will be changed by
-% "\pref_global_chk:". This function first changes
-% "\chk_local_or_pref_global:N" to check for global variables then it
-% issues a "\pref_global:D". After use "\chk_local_or_pref_global:N"
-% will restore itself to "\chk_local:N". So, if we use
-% "\chk_local_or_pref_global:N" inside some function "\foo_bar:n" we can
-% implement a global version "\foo_gbar:n" by defining
-% \begin{quote}
-% "\cs_new_nopar:Npn \foo_gbar:n {\pref_global_chk: \foo_bar:n }"
-% \end{quote}
-% provided that "\foo_bar:n" is built in a way that prefixing it with
-% "\pref_global:D" turns its operation into a global one. See
-% implementation for details.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3chk} implementation}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% The |\chk| module contains those functions that are used primarily
-% during the development of \LaTeX3 for checking that things are not mixed up
-% too badly. All these functions are of type `{\tt e}' since they
-% issue error messages if certain conditions are violated.
-%
-% \subsection{Checking variable assignments}
-%
-% \begin{macro}{\chk_local:N}
-% \begin{macro}[aux]{\chk_local_aux:w}
-% This function checks that its argument is a proper local
-% variable, i.e.\ its name starts with |\l| or |\L|.
-% It is not allowed that the name starts with |\g| or |\G|,
-% which means that we do not allow to update global
-% variables locally. But see |\pref_global_chk:| below for
-% the encoding of functions that might accept global variables
-% in certain situations. Not checked is the case that the
-% argument isn't a variable at all, i.e.\ it doesn't have
-% a |_| as second letter. Maybe we should add this for safety
-% during the implementation since it will find certain errors
-% involving wrong expansion in earlier stage.
-% \begin{macrocode}
-\cs_new_nopar:Npn \chk_local:N #1{
- \exp_after:wN \chk_local_aux:w \token_to_str:N#1\q_stop}
-
-\cs_new_nopar:Npn \chk_local_aux:w #1#2#3\q_stop{
- \if_num:w\tex_uccode:D`#2=`G\scan_stop:
- \msg_kernel_bug:x {Local~mismatch:~local~function~called~with~
- global~variable:^^J\text_put_four_sp: #1#2#3~
- on~line~\tex_the:D\tex_inputlineno:D}
- \else:
- \if_num:w\tex_uccode:D`#2=`L\scan_stop:
- \else:
- \msg_kernel_bug:x {Variable~mismatch:~function~not~called~with~
- proper~variable:^^J\text_put_four_sp: #1#2#3~
- on~line~\tex_the:D\tex_inputlineno:D}\fi:
- \fi:}
-% \end{macrocode}
-% We set the |\l_iow_new_line_code| at this point, just in case we
-% run into errors.
-% \begin{macrocode}
-\tex_newlinechar:D=`\^^J
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\chk_global:N}
-% \begin{macro}[aux]{\chk_global_aux:w}
-% |\chk_global:N| is similar to |\chk_local:N| but looks only
-% for global variables.
-% \begin{macrocode}
-\cs_new_nopar:Npn \chk_global:N #1{\exp_after:wN
- \chk_global_aux:w \token_to_str:N#1\q_stop}
-\cs_new_nopar:Npn \chk_global_aux:w #1#2#3\q_stop{
- \if_num:w\tex_uccode:D`#2=`L\scan_stop:
- \msg_kernel_bug:x {Global~mismatch:~global~function~called~with~
- local~variable:~#1#2#3~
- on~line~\tex_the:D\tex_inputlineno:D}
- \else:
- \if_num:w\tex_uccode:D`#2=`G\scan_stop:
- \else:
- \msg_kernel_bug:x {Variable~mismatch:~function~not~called~with~
- proper~variable:~#1#2#3~
- on~line~\tex_the:D\tex_inputlineno:D}\fi:\fi:}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\pref_global_chk:}
-% \begin{macro}{\chk_local_or_pref_global:N}
-% To allow implementations where we precede some function with
-% |\pref_global:D| without loosing the possibility to check for the
-% correct type of a variable, the following helper functions can be
-% used: |\chk_local_or_pref_global:N| \m{variable} is the variable
-% check which is usually |\cs_set_eq:NN| to |\chk_local:N|, i.e.\ it will
-% check for local variables. This behavior will be changed by
-% |\pref_global_chk:|. This function first changes
-% |\chk_local_or_pref_global:N| to check for global variables, then
-% issues a |\pref_global:D|. After being used,
-% |\chk_local_or_pref_global:N| will restore itself to
-% |\chk_local:N|. So, if we use |\chk_local_or_pref_global:N|
-% inside some function |\foo_bar:n| we can implement a global
-% version |\foo_gbar:n| by defining
-% \begin{verbatim}
-% \cs_new_nopar:Npn \foo_gbar:n {\pref_global_chk: \foo_bar:n }
-%\end{verbatim}
-% provided of course, that |\foo_bar:n| is defined in a way that a
-% |\pref_global:D| does work. Such a scheme has to be used
-% carefully, but its advantage is that the checking version has the
-% same structure as a streamlined version, we only have to change
-% |\pref_global_chk:| into |\pref_global:D| and omit the
-% |\chk_local_or_pref_global:N| function in the body.
-% \begin{macrocode}
-\cs_new_nopar:Npn \pref_global_chk: {
- \cs_gset_nopar:Npn \chk_local_or_pref_global:N ##1{
- \chk_global:N ##1
- \cs_gset_eq:NN \chk_local_or_pref_global:N \chk_local:N}
- \pref_global:D}
-\cs_new_eq:NN \chk_local_or_pref_global:N \chk_local:N
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\chk_var_or_const:N}
-% \begin{macro}[aux]{\chk_var_or_const_aux:w}
-% |\chk_var_or_const:N| is used in situations where we want to check
-% that we have a variable (or a constant) but do not care whether
-% or not it is global (for example, in allocation routines).
-% \begin{macrocode}
-\cs_new_nopar:Npn \chk_var_or_const:N #1{\exp_after:wN
- \chk_var_or_const_aux:w \token_to_str:N#1\q_stop }
-\cs_new_nopar:Npn \chk_var_or_const_aux:w #1#2#3\q_stop {
- \if_num:w\tex_uccode:D`#2=`L\scan_stop:
- \else:
- \if_num:w\tex_uccode:D`#2=`G\scan_stop:
- \else:
- \if_num:w\tex_uccode:D`#2=`C\scan_stop:
- \else:
-% \end{macrocode}
-% We also allow the beast to be a quark, i.e.\ to start with |\q|.
-% \begin{macrocode}
- \if_charcode:w#2q\scan_stop:
- \else:
-% \end{macrocode}
-% We might also want to allow that it is a user definable
-% variable which means that its name consists of letters only. We
-% could check this by testing that there is no |_|, but this is not
-% implemented so far.
-% \begin{macrocode}
- \msg_kernel_bug:x {Variable~mismatch:~function~not~called~with~
- proper~variable:^^J\text_put_four_sp: #1#2#3~
- on~line~\tex_the:D\tex_inputlineno:D}\fi:\fi:\fi:
- \fi:}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Doing some tracing}
-%
-% \begin{macro}{\tracingall}
-% \begin{macro}{\absolutelytracingall}
-% \begin{macro}{\donotcheck}
-% During |\tracingall| we don't want to see all this code coming
-% from the checking functions since something more substantial is
-% probably wrong. Therefore this definition of it turns the
-% functions of as far as possible.
-% \begin{macrocode}
-\cs_new_nopar:Npn\donotcheck{
- \cs_set_eq:NN \chk_global:N \use_none:n
- \cs_set_eq:NN \chk_local:N \use_none:n
- \cs_set_eq:NN \chk_local_or_pref_global:N \use_none:n
- \cs_set_eq:NN \pref_global_chk: \pref_global:D
- \cs_set_eq:NN \chk_if_free_cs:N \use_none:n
- \cs_set_eq:NN \chk_exist_cs:N \use_none:n
- \cs_set_eq:NN \chk_var_or_const:N \use_none:n
- \cs_set_eq:NN \cs_record_name:N \use_none:n
- \cs_set_eq:NN \cs_record_name:c \use_none:n
- \cs_set_eq:NN \cs_record_meaning:N \use_none:n
- \cs_set_eq:NN \register_record_name:N \use_none:n
-}
-\cs_new_nopar:Npn\absolutelytracingall{
-% \end{macrocode}
-% \end{macro}
-%
-% We do the settings by hand to avoid uninteresting lines in the
-% log file as much as possible.
-% \begin{macrocode}
- \pref_global:D\g_trace_commands_status\c_two
- \pref_global:D\g_trace_statistics_status\c_two
- \pref_global:D\g_trace_pages_status\c_one
- \pref_global:D\g_trace_output_status\c_one
- \pref_global:D\g_trace_chars_status\c_one
- \pref_global:D\g_trace_macros_status\c_two
- \pref_global:D\g_trace_paragraphs_status\c_one
- \pref_global:D\g_trace_restores_status\c_one
- \pref_global:D\g_trace_box_breadth_int\c_ten_thousand
- \pref_global:D\g_trace_box_depth_int\c_ten_thousand
- \pref_global:D\g_trace_online_status\c_one
- \tex_errorstopmode:D}
-%
-% Use LaTeX2e definition for now.
-%\cs_new_nopar:Npn\tracingall{
-% \donotcheck
-% \absolutelytracingall
-%}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tracingoff}
-% This macro turns off all tracing.
-% \begin{macrocode}
-\cs_new_nopar:Npn\tracingoff{
-% \end{macrocode}
-% First we turn off |\g_trace_online_status| so that we get minimal
-% rubbish on the terminal. Of course, in the log file all
-% assignments are shown.
-% \begin{macrocode}
- \pref_global:D\g_trace_online_status\c_zero
- \pref_global:D\g_trace_commands_status\c_zero
- \pref_global:D\g_trace_statistics_status\c_zero
- \pref_global:D\g_trace_pages_status\c_zero
- \pref_global:D\g_trace_output_status\c_zero
- \pref_global:D\g_trace_chars_status\c_zero
- \pref_global:D\g_trace_macros_status\c_zero
- \pref_global:D\g_trace_paragraphs_status\c_zero
- \pref_global:D\g_trace_restores_status\c_zero
- \pref_global:D\g_trace_box_breadth_int\c_zero
- \pref_global:D\g_trace_box_depth_int\c_zero
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Tracing modules}
-%
-% \begin{macro}{\traceon}
-% \begin{macro}{\traceoff}
-% Turning the tracing of modules on or off. (primitive version).
-% \begin{macrocode}
-%<*trace>
-\cs_new_nopar:Npn\traceon#1{
- \clist_map_inline:nn {#1}{
- \cs_if_free:cF{g_trace_ ##1 _status}
- {\int_gincr:c{g_trace_ ##1 _status}}
- }
-}
-\cs_new_nopar:Npn\traceoff#1{
- \clist_map_inline:nn {#1}{
- \cs_if_free:cF{g_trace_ ##1 _status}
- {\int_gdecr:c{g_trace_ ##1 _status}}
- }
-}
-%</trace>
-%<-trace>\cs_new_eq:NN\traceon\use_none:n
-%<-trace>\cs_new_eq:NN\traceoff\use_none:n
-%</initex|package>
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3clist.dtx b/Master/texmf-dist/source/latex/expl3/l3clist.dtx
deleted file mode 100644
index 612bddb82cc..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3clist.dtx
+++ /dev/null
@@ -1,1135 +0,0 @@
-% \iffalse
-%% File: l3clist.dtx Copyright (C) 2005-2011 Frank Mittelbach, LaTeX3 project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3c of this
-%% 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3clist.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental comma separated lists}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-%
-%
-% \title{The \textsf{l3clist} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Comma separated lists}
-% \author{Frank Mittelbach}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% Comma lists contain ordered data where items can be added to the left
-% or right end of the sequence. This gives an ordered list which can
-% then be utilised with the \cs{clist_map_function:NN} function. Comma
-% Comma lists cannot contain empty items, thus
-% \begin{verbatim}
-% \clist_new:N \l_my_clist
-% \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.
-%
-% \section{Functions for creating/initialising comma-lists}
-%
-%\begin{function}{
-% \clist_new:N |
-% \clist_new:c |
-%}
-% \begin{syntax}
-% \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 entries.
-%\end{function}
-%
-%\begin{function}{
-% \clist_set_eq:NN |
-% \clist_set_eq:cN |
-% \clist_set_eq:Nc |
-% \clist_set_eq:cc |
-%}
-% \begin{syntax}
-% \cs{clist_set_eq:NN} \meta{comma list1} \meta{comma list2}
-% \end{syntax}
-% Sets the content of \meta{comma list1} equal to that of
-% \meta{comma list2}. This assignment is restricted to the current
-% \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \clist_gset_eq:NN |
-% \clist_gset_eq:cN |
-% \clist_gset_eq:Nc |
-% \clist_gset_eq:cc |
-%}
-% \begin{syntax}
-% \cs{clist_gset_eq:NN} \meta{comma list1} \meta{comma list2}
-% \end{syntax}
-% Sets the content of \meta{comma list1} equal to that of
-% \meta{comma list2}. This assignment is global and so is not
-% limited by the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \clist_clear:N |
-% \clist_clear:c |
-%}
-% \begin{syntax}
-% \cs{clist_clear:N} \meta{comma list}
-% \end{syntax}
-% Clears all entries from the \meta{comma list} within the scope of
-% the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \clist_gclear:N |
-% \clist_gclear:c |
-%}
-% \begin{syntax}
-% \cs{clist_gclear:N} \meta{comma list}
-% \end{syntax}
-% Clears all entries from the \meta{comma list} globally.
-%\end{function}
-%
-% \begin{function}{ \clist_clear_new:N |
-% \clist_clear_new:c |
-% \clist_gclear_new:N |
-% \clist_gclear_new:c }
-% \begin{syntax}
-% "\clist_clear_new:N" <comma-list>
-% \end{syntax}
-% These functions locally or globally clear <comma-list> if it exists or
-% otherwise allocates it.
-% \end{function}
-%
-% \section{Putting data in}
-%
-%\begin{function}{
-% \clist_put_left:Nn |
-% \clist_put_left:NV |
-% \clist_put_left:No |
-% \clist_put_left:Nx |
-% \clist_put_left:cn |
-% \clist_put_left:cV |
-% \clist_put_left:co |
-%}
-% \begin{syntax}
-% \cs{clist_put_left:Nn} \meta{comma list} \Arg{entry}
-% \end{syntax}
-% Adds \meta{entry} onto the left of the \meta{comma list}. The
-% assignment is restricted to the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \clist_gput_left:Nn |
-% \clist_gput_left:NV |
-% \clist_gput_left:No |
-% \clist_gput_left:Nx |
-% \clist_gput_left:cn |
-% \clist_gput_left:cV |
-% \clist_gput_left:co |
-%}
-% \begin{syntax}
-% \cs{clist_gput_left:Nn} \meta{comma list} \Arg{entry}
-% \end{syntax}
-% Adds \meta{entry} onto the left of the \meta{comma list}. The
-% assignment is global.
-%\end{function}
-%
-%\begin{function}{
-% \clist_put_right:Nn |
-% \clist_put_right:NV |
-% \clist_put_right:No |
-% \clist_put_right:Nx |
-% \clist_put_right:cn |
-% \clist_put_right:cV |
-% \clist_put_right:co |
-%}
-% \begin{syntax}
-% \cs{clist_put_right:Nn} \meta{comma list} \Arg{entry}
-% \end{syntax}
-% Adds \meta{entry} onto the right of the \meta{comma list}. The
-% assignment is restricted to the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \clist_gput_right:Nn |
-% \clist_gput_right:NV |
-% \clist_gput_right:No |
-% \clist_gput_right:Nx |
-% \clist_gput_right:cn |
-% \clist_gput_right:cV |
-% \clist_gput_right:co |
-%}
-% \begin{syntax}
-% \cs{clist_gput_right:Nn} \meta{comma list} \Arg{entry}
-% \end{syntax}
-% Adds \meta{entry} onto the right of the \meta{comma list}. The
-% assignment is global.
-%\end{function}
-%
-% \section{Getting data out}
-%
-%\begin{function}{
-% \clist_use:N / (EXP) |
-% \clist_use:c / (EXP) |
-%}
-% \begin{syntax}
-% \cs{clist_use:N} \meta{comma list}
-% \end{syntax}
-% Recovers the content of a \meta{comma list} and places it
-% directly in the input stream. An error will be raised if the variable
-% does not exist or if it is invalid. This function is intended mainly
-% for use when a \meta{comma list} is being saved to an auxiliary file.
-%\end{function}
-%
-% \begin{function}{ \clist_show:N |
-% \clist_show:c }
-% \begin{syntax}
-% "\clist_show:N" <clist>
-% \end{syntax}
-% Function that pauses the compilation and displays <clist> in the terminal
-% output and in the log file. (Usually used for diagnostic purposes.)
-% \end{function}
-%
-%\begin{function}{
-% \clist_display:N |
-% \clist_display:c |
-%}
-% \begin{syntax}
-% \cs{clist_display:N} \meta{comma list}
-% \end{syntax}
-% Displays the value of the \meta{comma list} on the terminal.
-%\end{function}
-%
-% \begin{function}{ \clist_get:NN |
-% \clist_get:cN }
-% \begin{syntax}
-% "\clist_get:NN" <comma-list> <tl var.>
-% \end{syntax}
-% Functions that locally assign the left-most item of <comma-list> to the
-% token list variable <tl var.>. Item is not removed from <comma-list>! If you
-% need a global return value you need to code something like this:
-% \begin{quote}
-% "\clist_get:NN" <comma-list> "\l_tmpa_tl" \\
-% "\tl_gset_eq:NN" <global tl var.> "\l_tmpa_tl"
-% \end{quote}
-% But if this kind of construction is used often enough a separate
-% function should be provided.
-% \end{function}
-%
-%
-% \section{Mapping functions}
-%
-%
-% We provide three types of mapping functions, each with their own
-% strengths. The "\clist_map_function:NN" is expandable whereas
-% "\clist_map_inline:Nn" type uses "##1" as a placeholder for the
-% current item in \m{clist}. Finally we have the
-% "\clist_map_variable:NNn" type which uses a user-defined variable as
-% placeholder. Both the |_inline| and |_variable| versions are nestable.
-%
-%\begin{function}{
-% \clist_map_function:NN / (EXP) |
-% \clist_map_function:Nc / (EXP) |
-% \clist_map_function:cN / (EXP) |
-% \clist_map_function:cc / (EXP) |
-% \clist_map_function:nN / (EXP) |
-% \clist_map_function:nc / (EXP) |
-%}
-% \begin{syntax}
-% \cs{clist_map_function:NN} \meta{comma list} \meta{function}
-% \end{syntax}
-% Applies \meta{function} to every \meta{entry} stored in the
-% \meta{comma list}. The \meta{function} will receive one argument for
-% each iteration. The \meta{entries} in the \meta{comma list} are
-% supplied to the \meta{function} reading from the left to the right.
-% These function may be nested.
-%\end{function}
-%
-%\begin{function}{
-% \clist_map_inline:Nn |
-% \clist_map_inline:cn |
-% \clist_map_inline:nn |
-%}
-% \begin{syntax}
-% \cs{clist_map_inline:Nn} \meta{comma list} \Arg{inline function}
-% \end{syntax}
-% Applies \meta{inline function} to every \meta{entry} stored
-% within the \meta{comma list}. The \meta{inline function} should
-% consist of code which will receive the \meta{entry} as "#1".
-% One inline mapping can be nested inside another. The \meta{entries}
-% in the \meta{comma list} are supplied to the \meta{function} reading
-% from the left to the right.
-%\end{function}
-%
-% \begin{function}{\clist_map_variable:NNn |
-% \clist_map_variable:cNn |
-% \clist_map_variable:nNn |
-% }
-% \begin{syntax}
-% "\clist_map_variable:NNn" <comma-list> <temp-var> \Arg{action}
-% \end{syntax}
-% Assigns <temp-var> to each element in <clist> and then executes
-% <action> which should contain <temp-var>. As the
-% operation performs an assignment, it is not expandable.
-% \begin{texnote}
-% These functions resemble the \LaTeXe{} function \tn{@for} but does
-% not borrow the somewhat strange syntax.
-% \end{texnote}
-% \end{function}
-%
-%\begin{function}{ \clist_map_break: / (EXP) }
-% \begin{syntax}
-% \cs{clist_map_break:}
-% \end{syntax}
-% Used to terminate a \cs{clist_map_\ldots} function before all
-% entries in the \meta{comma list} have been processed. This will
-% normally take place within a conditional statement, for example
-% \begin{verbatim}
-% \clist_map_inline:Nn \l_my_clist
-% {
-% \str_if_eq:nnTF { #1 } { bingo }
-% { \clist_map_break: }
-% {
-% % Do something useful
-% }
-% }
-% \end{verbatim}
-% Use outside of a \cs{clist_map_\ldots} scenario will lead low
-% level \TeX\ errors.
-%\end{function}
-%
-% \section{Predicates and conditionals}
-%
-%\begin{function}{
-% \clist_if_empty_p:N / (EXP) |
-% \clist_if_empty_p:c / (EXP) |
-% \clist_if_empty:N / (EXP) (TF) |
-% \clist_if_empty:c / (EXP) (TF) |
-%}
-% \begin{syntax}
-% \cs{clist_if_empty_p:N} \meta{clist}
-% \cs{clist_if_empty:NTF} \meta{clist} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if the \meta{comma list} is empty (containing no items). The
-% branching versions then leave either \meta{true code} or
-% \meta{false code} in the input stream, as appropriate to the truth of
-% the test and the variant of the function chosen. The logical truth of
-% the test is left in the input stream by the predicate version.
-%\end{function}
-%
-%\begin{function}{
-% \clist_if_eq_p:NN / (EXP) |
-% \clist_if_eq_p:Nc / (EXP) |
-% \clist_if_eq_p:cN / (EXP) |
-% \clist_if_eq_p:cc / (EXP) |
-% \clist_if_eq:NN / (EXP) (TF) |
-% \clist_if_eq:Nc / (EXP) (TF) |
-% \clist_if_eq:cN / (EXP) (TF) |
-% \clist_if_eq:cc / (EXP) (TF) |
-%}
-% \begin{syntax}
-% \cs{clist_if_eq_p:NN} \Arg{clist1} \Arg{clist2}
-% \cs{clist_if_eq:NNTF} \Arg{clist1} \Arg{clist2} \Arg{true code}
-% ~~\Arg{false code}
-% \end{syntax}
-% Compares the content of two \meta{comma lists} and
-% is logically \texttt{true} if the two contain the same list of
-% entries in the same order. The branching versions then leave either
-% \meta{true code} or \meta{false code} in the input stream, as
-% appropriate to the truth of the test and the variant of the function
-% chosen. The logical truth of the test is left in the input stream by
-% the predicate version.
-%\end{function}
-%
-%\begin{function}{
-% \clist_if_in:Nn / (TF) |
-% \clist_if_in:NV / (TF) |
-% \clist_if_in:No / (TF) |
-% \clist_if_in:cn / (TF) |
-% \clist_if_in:cV / (TF) |
-% \clist_if_in:co / (TF) |
-%}
-% \begin{syntax}
-% \cs{clist_if_in:NnTF} \meta{clist} \Arg{entry} \Arg{true code}
-% ~~\Arg{false code}
-% \end{syntax}
-% Tests if the \meta{entry} is present in the \meta{comma list} as
-% a discrete entry. The \meta{entry} cannot contain the tokens "{", "}"
-% or "#" (assuming the usual \TeX\ category codes apply). Either the
-% \meta{true code} or \meta{false code} in the input stream, as
-% appropriate to the truth of the test and the variant of the function
-% chosen.
-%\end{function}
-%
-% \section{Higher level functions}
-%
-%\begin{function}{
-% \clist_concat:NNN |
-% \clist_concat:ccc |
-%}
-% \begin{syntax}
-% \cs{clist_concat:NNN} \meta{clist1} \meta{clist2} \meta{clist3}
-% \end{syntax}
-% Concatenates the content of \meta{comma list2} and \meta{comma list3}
-% together and saves the result in \meta{comma list1}.
-% \meta{comma list2} will be placed at the left side of the new
-% comma list. This operation is local to the current \TeX\ group and
-% will remove any existing content in \meta{comma list1}.
-%\end{function}
-%
-%\begin{function}{
-% \clist_gconcat:NNN |
-% \clist_gconcat:ccc |
-%}
-% \begin{syntax}
-% \cs{clist_gconcat:NNN} \meta{clist1} \meta{clist2} \meta{clist3}
-% \end{syntax}
-% Concatenates the content of \meta{comma list2} and \meta{comma list3}
-% together and saves the result in \meta{comma list1}.
-% \meta{comma list2} will be placed at the left side of the new
-% comma list. This operation is global and will remove any existing
-% content in \meta{comma list1}.
-%\end{function}
-%
-%\begin{function}{ \clist_remove_duplicates:N }
-% \begin{syntax}
-% \cs{clist_remove_duplicates:N} \meta{comma list}
-% \end{syntax}
-% Removes duplicate entries from the \meta{comma list}, leaving
-% left most entry in the \meta{comma list}. The removal is local
-% to the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{ \clist_gremove_duplicates:N }
-% \begin{syntax}
-% \cs{clist_gremove_duplicates:N} \meta{comma list}
-% \end{syntax}
-% Removes duplicate entries from the \meta{comma list}, leaving
-% left most entry in the \meta{comma list}. The removal is applied
-% globally.
-%\end{function}
-%
-%\begin{function}{ \clist_remove_element:Nn }
-% \begin{syntax}
-% \cs{clist_remove_element:Nn} \meta{comma list} \Arg{entry}
-% \end{syntax}
-% Removes each occurrence of \meta{entry} from the \meta{comma list},
-% where \meta{entry} cannot contain the tokens "{", "}" or "#"
-% (assuming normal \TeX\ category codes). The removal is local
-% to the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{ \clist_gremove_element:Nn }
-% \begin{syntax}
-% \cs{clist_gremove_element:Nn} \meta{comma list} \Arg{entry}
-% \end{syntax}
-% Removes each occurrence of \meta{entry} from the \meta{comma list},
-% where \meta{entry} cannot contain the tokens "{", "}" or "#"
-% (assuming normal \TeX\ category codes). The removal applied
-% globally.
-%\end{function}
-%
-% \section{Functions for `comma-list stacks'}
-%
-% Special comma-lists in \LaTeX3 are `stacks' with their usual operations
-% of `push', `pop', and `top'. They are internally implemented as
-% comma-lists and share some of the functions (like "\clist_new:N" etc.)
-%
-%
-% \begin{function}{%
-% \clist_push:Nn |
-% \clist_push:NV |
-% \clist_push:No |
-% \clist_push:cn |
-% \clist_gpush:Nn |
-% \clist_gpush:NV |
-% \clist_gpush:No |
-% \clist_gpush:cn |
-% }
-% \begin{syntax}
-% "\clist_push:Nn" <stack> \Arg{token list}
-% \end{syntax}
-% Locally or globally pushes <token list> as a single item onto the
-% <stack>. <token list> might get expanded before the operation.
-% \end{function}
-%
-% \begin{function}{%
-% \clist_pop:NN |
-% \clist_pop:cN |
-% \clist_gpop:NN |
-% \clist_gpop:cN |
-% }
-% \begin{syntax}
-% "\clist_pop:NN" <stack> <tl var.>
-% \end{syntax}
-% Functions that assign the top item of <stack> to the token
-% list variable <tl var.> and removes it from <stack>!
-% \end{function}
-%
-% \begin{function}{%
-% \clist_top:NN |
-% \clist_top:cN |
-% }
-% \begin{syntax}
-% "\clist_top:NN" <stack> <tl var.>
-% \end{syntax}
-% Functions that locally assign the top item of <stack> to the token
-% list variable <tl var.>. Item is not removed from <stack>!
-% \end{function}
-%
-% \section{Internal functions}
-%
-% \begin{function}{\clist_if_empty_err:N}
-% \begin{syntax}
-% "\clist_if_empty_err:N" <comma-list>
-% \end{syntax}
-% Signals an \LaTeX3 error if <comma-list> is empty.
-% \end{function}
-%
-% \begin{function}{\clist_pop_aux:nnNN}
-% \begin{syntax}
-% "\clist_pop_aux:nnNN" <assign1> <assign2> <comma-list> <tl var.>
-% \end{syntax}
-% Function that assigns the left-most item of <comma-list> to <tl var.> using
-% <assign1> and assigns the tail to <comma-list> using <assign2>. This
-% function could be used to implement a global return function.
-% \end{function}
-%
-% \begin{function}{%
-% \clist_get_aux:w |
-% \clist_pop_aux:w |
-% \clist_pop_auxi:w |
-% \clist_put_aux:NNnnNn |
-% }
-% \begin{syntax}\end{syntax}
-% Functions used to implement put and get operations. They are not for
-% meant for direct use.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3clist} implementation}
-%
-% \TestFiles{m3clist002.lvt}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \subsection{Allocation and initialisation}
-%
-% \begin{macro}{\clist_new:N, \clist_new:c}
-% \UnitTested
-% Comma-Lists are implemented using token lists.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_new:N \tl_new:N
-\cs_generate_variant:Nn \clist_new:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\clist_clear:N, \clist_clear:c }
-% \UnitTested
-% \begin{macro}{\clist_gclear:N, \clist_gclear:c }
-% \UnitTested
-% Clearing a comma-list is the same as clearing a token list.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_clear:N \tl_clear:N
-\cs_generate_variant:Nn \clist_clear:N {c}
-\cs_new_eq:NN \clist_gclear:N \tl_gclear:N
-\cs_generate_variant:Nn \clist_gclear:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_clear_new:N, \clist_clear_new:c }
-% \UnitTested
-% \begin{macro}{\clist_gclear_new:N, \clist_gclear_new:c }
-% \UnitTested
-% Clearing a comma-list is the same as clearing a token list.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_clear_new:N \tl_clear_new:N
-\cs_generate_variant:Nn \clist_clear_new:N {c}
-\cs_new_eq:NN \clist_gclear_new:N \tl_gclear_new:N
-\cs_generate_variant:Nn \clist_gclear_new:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\clist_set_eq:NN, \clist_set_eq:cN,
-% \clist_set_eq:Nc, \clist_set_eq:cc }
-% \UnitTested
-% We can set one \meta{clist} equal to another.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_set_eq:NN \tl_set_eq:NN
-\cs_new_eq:NN \clist_set_eq:cN \tl_set_eq:cN
-\cs_new_eq:NN \clist_set_eq:Nc \tl_set_eq:Nc
-\cs_new_eq:NN \clist_set_eq:cc \tl_set_eq:cc
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_gset_eq:NN, \clist_gset_eq:cN,
-% \clist_gset_eq:Nc, \clist_gset_eq:cc }
-% \UnitTested
-% An of course globally which seems to be needed far more often.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_gset_eq:NN \tl_gset_eq:NN
-\cs_new_eq:NN \clist_gset_eq:cN \tl_gset_eq:cN
-\cs_new_eq:NN \clist_gset_eq:Nc \tl_gset_eq:Nc
-\cs_new_eq:NN \clist_gset_eq:cc \tl_gset_eq:cc
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \subsection{Predicates and conditionals}
-%
-% \begin{macro}{\clist_if_empty_p:N,\clist_if_empty_p:c}
-% \begin{macro}[TF]{\clist_if_empty:N,\clist_if_empty:c}
-% \UnitTested
-% \begin{macrocode}
-\prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N {p,TF,T,F}
-\prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c {p,TF,T,F}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_if_empty_err:N}
-% Signals an error if the comma-list is empty.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_if_empty_err:N #1 {
- \if_meaning:w #1 \c_empty_tl
- \tl_clear:N \l_kernel_testa_tl % catch prefixes
- \msg_kernel_bug:x {Empty~comma-list~`\token_to_str:N #1'}
- \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_if_eq_p:NN,\clist_if_eq_p:Nc,
-% \clist_if_eq_p:cN,\clist_if_eq_p:cc}
-% \begin{macro}[TF]{\clist_if_eq:NN,\clist_if_eq:cN,
-% \clist_if_eq:Nc,\clist_if_eq:cc}
-% Returns |\c_true| iff the two comma-lists are equal.
-% \begin{macrocode}
-\prg_new_eq_conditional:NNn \clist_if_eq:NN \tl_if_eq:NN {p,TF,T,F}
-\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN {p,TF,T,F}
-\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc {p,TF,T,F}
-\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc {p,TF,T,F}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}[TF]{\clist_if_in:Nn}
-% \UnitTested
-% \begin{macro}[TF]{\clist_if_in:NV,\clist_if_in:No,\clist_if_in:cn,
-% \clist_if_in:cV,\clist_if_in:co}
-% \UnitTested
-% |\clist_if_in:NnTF| \m{clist}\m{item} \m{true~case} \m{false~case}
-% will check whether \m{item} is in \m{clist} and then either execute
-% the \m{true~case} or the \m{false~case}. \m{true~case} and
-% \m{false~case} may contain incomplete |\if_charcode:w|
-% statements.
-% \begin{macrocode}
-\prg_new_protected_conditional:Nnn \clist_if_in:Nn {TF,T,F} {
- \cs_set:Npn \clist_tmp:w ##1,#2,##2##3 \q_stop {
- \if_meaning:w \q_no_value ##2
- \prg_return_false: \else: \prg_return_true: \fi:
- }
- \exp_last_unbraced:NNo \clist_tmp:w , #1 , #2 , \q_no_value \q_stop
-}
-% \end{macrocode}
-% \begin{macrocode}
-\cs_generate_variant:Nn \clist_if_in:NnTF {NV,No,cn,cV,co}
-\cs_generate_variant:Nn \clist_if_in:NnT {NV,No,cn,cV,co}
-\cs_generate_variant:Nn \clist_if_in:NnF {NV,No,cn,cV,co}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Retrieving data}
-%
-% \begin{macro}{\clist_use:N, \clist_use:c}
-% \UnitTested
-% Using a \meta{clist} is just executing it but
-% if \m{clist} equals |\scan_stop:| it is probably stemming
-% from a |\cs:w ... \cs_end:| that was created by mistake somewhere.
-% \begin{macrocode}
-\cs_new_nopar:Npn \clist_use:N #1 {
- \if_meaning:w #1 \scan_stop:
- \msg_kernel_bug:x {
- Comma~list~ `\token_to_str:N #1'~ has~ an~ erroneous~ structure!}
- \else:
- \exp_after:wN #1
- \fi:
-}
-\cs_generate_variant:Nn \clist_use:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\clist_get:NN, \clist_get:cN}
-% \UnitTested
-% |\clist_get:NN |\meta{comma-list}\meta{cmd} defines \meta{cmd} to be the
-% left-most element of \meta{comma-list}.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_get:NN #1 {
- \clist_if_empty_err:N #1
- \exp_after:wN \clist_get_aux:w #1,\q_stop
-}
-\cs_generate_variant:Nn \clist_get:NN {cN}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[aux]{\clist_get_aux:w}
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_get_aux:w #1,#2\q_stop #3 { \tl_set:Nn #3{#1} }
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}[aux]{\clist_pop_aux:nnNN}
-% \begin{macro}[aux]{\clist_pop_aux:w}
-% \begin{macro}[aux]{\clist_pop_auxi:w}
-% |\clist_pop_aux:nnNN| \meta{def$\sb1$} \meta{def$\sb2$} \meta{comma-list}
-% \meta{cmd} assigns the left-most element of \meta{comma-list} to
-% \meta{cmd} using \meta{def$\sb2$}, and assigns the tail of
-% \meta{comma-list} to \meta{comma-list} using \meta{def$\sb1$}.
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_pop_aux:nnNN #1#2#3 {
- \clist_if_empty_err:N #3
- \exp_after:wN \clist_pop_aux:w #3,\q_nil\q_stop #1#2#3
-}
-% \end{macrocode}
-% After the assignmnets below, if there was only one element in the original
-% clist, it now contains only |\q_nil|.
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_pop_aux:w #1,#2\q_stop #3#4#5#6 {
- #4 #6 {#1}
- #3 #5 {#2}
- \quark_if_nil:NTF #5 { #3 #5 {} }{ \clist_pop_auxi:w #2 #3#5 }
-}
-% \end{macrocode}
-% \begin{macrocode}
-\cs_new:Npn \clist_pop_auxi:w #1,\q_nil #2#3 { #2#3{#1} }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\clist_show:N}
-% \begin{macro}{\clist_show:c}
-% \begin{macrocode}
-\cs_new_eq:NN \clist_show:N \tl_show:N
-\cs_new_eq:NN \clist_show:c \tl_show:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\clist_display:N}
-% \begin{macro}{\clist_display:c}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_display:N #1 {
- \iow_term:x { Comma-list~\token_to_str:N #1~contains~
- the~elements~(without~outer~braces): }
- \toks_clear:N \l_tmpa_toks
- \clist_map_inline:Nn #1 {
- \toks_if_empty:NF \l_tmpa_toks {
- \toks_put_right:Nx \l_tmpa_toks {^^J>~}
- }
- \toks_put_right:Nx \l_tmpa_toks {
- \c_space_tl \iow_char:N \{ \exp_not:n {##1} \iow_char:N \}
- }
- }
- \toks_show:N \l_tmpa_toks
-}
-\cs_generate_variant:Nn \clist_display:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Storing data}
-%
-% \begin{macro}[aux]{\clist_put_aux:NNnnNn}
-% The generic put function.
-% When adding we have to distinguish between an empty \meta{clist}
-% and one that contains at least one item (otherwise we accumulate
-% commas).
-%
-% MH says: Perhaps we should make sure that empty arguments don't get
-% on the stack as that is probably a mistake. That's what I've
-% implemented here. Since |\tl_if_empty:nF| is expandable prefixes
-% are still allowed.
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6 {
- \clist_if_empty:NTF #5 { #1 #5 {#6} } {
- \tl_if_empty:nF {#6} { #2 #5{#3#6#4} }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\clist_put_left:Nn, \clist_put_left:NV,
-% \clist_put_left:No, \clist_put_left:Nx,
-% \clist_put_left:cn, \clist_put_left:cV,
-% \clist_put_left:co}
-% \UnitTested
-% The operations for adding to the left.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_put_left:Nn {
- \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_left:Nn {} ,
-}
-\cs_generate_variant:Nn \clist_put_left:Nn {NV,No,Nx,cn,cV,co}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_gput_left:Nn, \clist_gput_left:NV,
-% \clist_gput_left:No, \clist_gput_left:Nx,
-% \clist_gput_left:cn, \clist_gput_left:cV,
-% \clist_gput_left:co}
-% \UnitTested
-% Global versions.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_gput_left:Nn {
- \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_left:Nn {} ,
-}
-\cs_generate_variant:Nn \clist_gput_left:Nn {NV,No,Nx,cn,cV,co}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\clist_put_right:Nn, \clist_put_right:NV,
-% \clist_put_right:No, \clist_put_right:Nx,
-% \clist_put_right:cn, \clist_put_right:cV,
-% \clist_put_right:co}
-% \UnitTested
-% Adding something to the right side is almost the same.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_put_right:Nn {
- \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_right:Nn , {}
-}
-\cs_generate_variant:Nn \clist_put_right:Nn {NV,No,Nx,cn,cV,co}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\clist_gput_right:Nn, \clist_gput_right:NV,
-% \clist_gput_right:No, \clist_gput_right:Nx,
-% \clist_gput_right:cn, \clist_gput_right:cV,
-% \clist_gput_right:co}
-% \UnitTested
-% And here the global variants.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_gput_right:Nn {
- \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_right:Nn , {}
-}
-\cs_generate_variant:Nn \clist_gput_right:Nn {NV,No,Nx,cn,cV,co}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsection{Mapping}
-%
-% \begin{macro}{\clist_map_function:NN, \clist_map_function:Nc,
-% \clist_map_function:cN, \clist_map_function:cc,
-% \clist_map_function:nN,\clist_map_function:nc }
-% \UnitTested
-% \begin{macro}{\clist_map_inline:Nn, \clist_map_inline:nn }
-% \UnitTested
-%\begin{macro}{\clist_map_break:}
-% Using the above creating the comma mappings is easy..
-% \begin{macrocode}
-\prg_new_map_functions:Nn , { clist }
-\cs_generate_variant:Nn \clist_map_function:NN { Nc }
-\cs_generate_variant:Nn \clist_map_function:NN { c }
-\cs_generate_variant:Nn \clist_map_function:NN { cc }
-\cs_generate_variant:Nn \clist_map_inline:Nn { c }
-\cs_generate_variant:Nn \clist_map_inline:Nn { nc }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_map_variable:nNn, \clist_map_variable:NNn,
-% \clist_map_variable:cNn}
-% \UnitTested
-% |\clist_map_variable:NNn| \meta{comma-list} \meta{temp} \meta{action} assigns
-% \meta{temp} to each element and executes \meta{action}.
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_map_variable:nNn #1#2#3 {
- \tl_if_empty:nF {#1} {
- \clist_map_variable_aux:Nnw #2 {#3} #1
- , \q_recursion_tail , \q_recursion_stop
- }
-}
-% \end{macrocode}
-% Something for v/V
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_map_variable:NNn {\exp_args:No \clist_map_variable:nNn}
-\cs_generate_variant:Nn\clist_map_variable:NNn {cNn}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}[aux]{\clist_map_variable_aux:Nnw}
-% The general loop. Assign the temp variable |#1| to the current item
-% |#3| and then check if that's the stop marker. If it is, break the
-% loop. If not, execute the action |#2| and continue.
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3,{
- \cs_set_nopar:Npn #1{#3}
- \quark_if_recursion_tail_stop:N #1
- #2 \clist_map_variable_aux:Nnw #1{#2}
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \subsection{Higher level functions}
-%
-% \begin{macro}{\clist_concat:NNN, \clist_concat:ccc}
-% \UnitTested
-% \begin{macro}{\clist_gconcat:NNN,\clist_gconcat:ccc}
-% \UnitTested
-% \begin{macro}[aux]{\clist_concat_aux:NNNN}
-% |\clist_gconcat:NNN| \m{clist~1} \m{clist~2} \m{clist~3} will globally
-% assign \m{clist~1} the concatenation of \m{clist~2} and
-% \m{clist~3}.
-%
-% Again the situation is a bit more complicated because of the use
-% of commas between items, so if either list is empty we have to avoid
-% adding a comma.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_concat_aux:NNNN #1#2#3#4 {
- \tl_set:No \l_tmpa_tl {#3}
- \tl_set:No \l_tmpb_tl {#4}
- #1 #2 {
- \exp_not:V \l_tmpa_tl
- \tl_if_empty:NF \l_tmpa_tl { \tl_if_empty:NF \l_tmpb_tl , }
- \exp_not:V \l_tmpb_tl
- }
-}
-\cs_new_protected_nopar:Npn \clist_concat:NNN { \clist_concat_aux:NNNN \tl_set:Nx }
-\cs_new_protected_nopar:Npn \clist_gconcat:NNN { \clist_concat_aux:NNNN \tl_gset:Nx }
-\cs_generate_variant:Nn \clist_concat:NNN {ccc}
-\cs_generate_variant:Nn \clist_gconcat:NNN {ccc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\l_clist_remove_clist}
-% A common scratch space for the removal routines.
-% \begin{macrocode}
-\clist_new:N \l_clist_remove_clist
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[aux]{\clist_remove_duplicates_aux:NN}
-% \begin{macro}[aux]{\clist_remove_duplicates_aux:n}
-% \begin{macro}{\clist_remove_duplicates:N}
-% \UnitTested
-% \begin{macro}{\clist_gremove_duplicates:N}
-% \UnitTested
-% Removing duplicate entries in a \meta{clist} is fairly straight
-% forward. We use a temporary variable and then go through the list
-% from left to right. For each element check if the element is
-% already present in the list.
-% \begin{macrocode}
-\cs_new_protected:Npn \clist_remove_duplicates_aux:NN #1#2 {
- \clist_clear:N \l_clist_remove_clist
- \clist_map_function:NN #2 \clist_remove_duplicates_aux:n
- #1 #2 \l_clist_remove_clist
-}
-\cs_new_protected:Npn \clist_remove_duplicates_aux:n #1 {
- \clist_if_in:NnF \l_clist_remove_clist {#1} {
- \clist_put_right:Nn \l_clist_remove_clist {#1}
- }
-}
-% \end{macrocode}
-% The high level functions are just for telling if it should be a
-% local or global setting.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_remove_duplicates:N {
- \clist_remove_duplicates_aux:NN \clist_set_eq:NN
-}
-\cs_new_protected_nopar:Npn \clist_gremove_duplicates:N {
- \clist_remove_duplicates_aux:NN \clist_gset_eq:NN
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}{\clist_remove_element:Nn}
-%\begin{macro}{\clist_gremove_element:Nn}
-%\begin{macro}[aux]{\clist_remove_element_aux:NNn}
-%\begin{macro}[aux]{\clist_remove_element_aux:n}
-% The same general idea is used for removing elements: the parent
-% functions just set things up for the internal ones.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_remove_element:Nn {
- \clist_remove_element_aux:NNn \clist_set_eq:NN
-}
-\cs_new_protected_nopar:Npn \clist_gremove_element:Nn {
- \clist_remove_element_aux:NNn \clist_gset_eq:NN
-}
-\cs_new_protected:Npn \clist_remove_element_aux:NNn #1#2#3 {
- \clist_clear:N \l_clist_remove_clist
- \cs_set:Npn \clist_remove_element_aux:n ##1 {
- \str_if_eq:nnF {#3} {##1} {
- \clist_put_right:Nn \l_clist_remove_clist {##1}
- }
- }
- \clist_map_function:NN #2 \clist_remove_element_aux:n
- #1 #2 \l_clist_remove_clist
-}
-\cs_new:Npn \clist_remove_element_aux:n #1 { }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \subsection{Stack operations}
-%
-% We build stacks from comma-lists, but here we put the
-% specific functions together.
-%
-%
-% \begin{macro}{\clist_push:Nn, \clist_push:No,
-% \clist_push:NV, \clist_push:cn}
-% \UnitTested
-% \begin{macro}{\clist_pop:NN, \clist_pop:cN}
-% \UnitTested
-% Since comma-lists can be used as stacks, we ought to have both
-% `push' and `pop'. In most cases they are nothing more then new
-% names for old functions.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_push:Nn \clist_put_left:Nn
-\cs_new_eq:NN \clist_push:NV \clist_put_left:NV
-\cs_new_eq:NN \clist_push:No \clist_put_left:No
-\cs_new_eq:NN \clist_push:cn \clist_put_left:cn
-\cs_new_protected_nopar:Npn \clist_pop:NN {\clist_pop_aux:nnNN \tl_set:Nn \tl_set:Nn}
-\cs_generate_variant:Nn \clist_pop:NN {cN}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\clist_gpush:Nn, \clist_gpush:No,
-% \clist_gpush:NV, \clist_gpush:cn}
-% \UnitTested
-% \begin{macro}{\clist_gpop:NN, \clist_gpop:cN}
-% \UnitTested
-% I don't agree with Denys that one needs only local stacks,
-% actually I believe that one will probably need the functions
-% here more often. In case of |\clist_gpop:NN| the value is
-% nevertheless returned locally.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_gpush:Nn \clist_gput_left:Nn
-\cs_new_eq:NN \clist_gpush:NV \clist_gput_left:NV
-\cs_new_eq:NN \clist_gpush:No \clist_gput_left:No
-\cs_generate_variant:Nn \clist_gpush:Nn {cn}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \clist_gpop:NN {\clist_pop_aux:nnNN \tl_gset:Nn \tl_set:Nn}
-\cs_generate_variant:Nn \clist_gpop:NN {cN}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\clist_top:NN,\clist_top:cN}
-% \UnitTested
-% Looking at the top element of the stack without removing it is
-% done with this operation.
-% \begin{macrocode}
-\cs_new_eq:NN \clist_top:NN \clist_get:NN
-\cs_new_eq:NN \clist_top:cN \clist_get:cN
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-%
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3doc.dtx b/Master/texmf-dist/source/latex/expl3/l3doc.dtx
deleted file mode 100644
index 9ea04f3260a..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3doc.dtx
+++ /dev/null
@@ -1,2104 +0,0 @@
-% \iffalse
-%% File: l3doc.dtx Copyright (C) 1990-2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver>
-\def\nameofplainTeX{plain}
-\ifx\fmtname\nameofplainTeX\else
- \expandafter\begingroup
-\fi
-\input docstrip.tex
-\askforoverwritefalse
-\preamble
-
-
-EXPERIMENTAL CODE
-
-Do not distribute this file without also distributing the
-source files specified above.
-
-Do not distribute a modified version of this file.
-
-
-\endpreamble
-% stop docstrip adding \endinput
-\postamble
-\endpostamble
-\generate{\file{l3doc.cls}{\from{l3doc.dtx}{class}}}
-\generate{\file{l3doc.ist}{\from{l3doc.dtx}{docist}}}
-\ifx\fmtname\nameofplainTeX
- \expandafter\endbatchfile
-\else
- \expandafter\endgroup
-\fi
-%</driver>
-%
-%<*driver|class>
-\RequirePackage{l3names}
-%</driver|class>
-%
-% Need to protect the file metadata for any modules that load l3doc.
-% This is restored after "\ProvideExplClass" below.
-% \begin{macrocode}
-%<class>\let \filenameOld \filename
-%<class>\let \filenameextOld \filenameext
-%<class>\let \filedateOld \filedate
-%<class>\let \fileversionOld \fileversion
-%<class>\let \filedescriptionOld \filedescription
-% \end{macrocode}
-%
-%<*driver|class>
-\GetIdInfo$Id: l3doc.dtx 2228 2011-04-10 08:37:13Z joseph $
- {L3 Experimental documentation class}
-%</driver|class>
-%
-%<*driver>
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-\documentclass{l3doc}
-\usepackage{framed}
-\begin{document}
-\DocInput{l3doc.dtx}
-\end{document}
-%</driver>
-%
-% This isn't included in the typeset documentation because it's a bit ugly:
-%<*class>
-\ProvidesExplClass
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\RequirePackage{expl3,xparse}
-\let \filename \filenameOld
-\let \filenameext \filenameextOld
-\let \filedate \filedateOld
-\let \fileversion \fileversionOld
-\let \filedescription \filedescriptionOld
-%</class>
-% \fi
-%
-% \title{The \pkg{l3doc} class\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-% \tableofcontents
-%
-% \begin{documentation}
-%
-% \section{Introduction}
-%
-% This is an ad-hoc class for documenting the \pkg{expl3} bundle,
-% a collection of modules or packages that make up \LaTeX3's programming
-% environment. Eventually it will replace the "ltxdoc" class for \LaTeX3,
-% but not before the good ideas in \pkg{hypdoc}, \cls{xdoc2}, \pkg{docmfp}, and
-% \cls{gmdoc} are incorporated.
-%
-% \textbf{It is even less stable than the main \pkg{expl3} packages. Use at own risk!}
-%
-% It is written as a `self-contained' docstrip file: executing
-% "latex l3doc.dtx"
-% will generate the "l3doc.cls" file and typeset this
-% documentation; execute "tex l3doc.dtx" to only generate the ".cls" file.
-%
-% \section{Features of other packages}
-%
-% This class builds on the \pkg{ltxdoc} class and the \pkg{doc} package, but
-% in the time since they were originally written some
-% improvements and replacements have appeared that we would like to use as
-% inspiration.
-%
-% These packages or classes are \pkg{hypdoc}, \pkg{docmfp}, \pkg{gmdoc},
-% and \pkg{xdoc}. I have summarised them below in order to work out what
-% sort of features we should aim at a minimum for \pkg{l3doc}.
-%
-% \subsection{The \pkg{hypdoc} package}
-%
-% This package provides hyperlink support for the \pkg{doc} package. I have
-% included it in this list to remind me that cross-referencing between
-% documentation and implementation of methods is not very good. (E.g., it
-% would be nice to be able to automatically hyperlink the documentation for
-% a function from its implementation and vice-versa.)
-%
-% \subsection{The \pkg{docmfp} package}
-%
-% \begin{itemize}
-% \item Provides "\DescribeRoutine" and the "routine" environment (etc.)
-% for MetaFont and MetaPost code.
-% \item Provides "\DescribeVariable" and the "variable" environment (etc.)
-% for more general code.
-% \item Provides "\Describe" and the "Code" environment (etc.) as a
-% generalisation of the above two instantiations.
-% \item Small tweaks to the DocStrip system to aid non-\LaTeX\ use.
-% \end{itemize}
-%
-% \subsection{The \pkg{xdoc2} package}
-%
-% \begin{itemize}
-% \item Two-sided printing.
-% \item "\NewMacroEnvironment", "\NewDescribeEnvironment"; similar idea
-% to \pkg{docmfp} but more comprehensive.
-% \item Tons of small improvements.
-% \end{itemize}
-%
-% \subsection{The \pkg{gmdoc} package}
-%
-% Radical re-implementation of \pkg{doc} as a package or class.
-% \begin{itemize}
-% \item Requires no "\begin{macrocode}" blocks!
-% \item Automatically inserts "\begin{macro}" blocks!
-% \item And a whole bunch of other little things.
-% \end{itemize}
-%
-% \section{Problems \& Todo}
-%
-% Problems at the moment: (1)~not flexible in the types of things that can be documented; (2)~very nonstandard markup (e.g., the odd `"/ (...)"' tags; (3)~no obvious link between the "\begin{function}" environment for documenting things to the "\begin{macro}" function that's used analogously in the implementation.
-%
-% The "macro" should probably be renamed to "function" when it is used within
-% an implementation section. But they should have the same syntax before that happens!
-%
-% Furthermore, we need another `layer' of documentation commands to
-% account for `user-macro' as opposed to `code-functions'; the \pkg{expl3}
-% functions should be documented differently, probably, to the \pkg{xparse}
-% user macros (at least in terms of indexing).
-%
-% In no particular order, a list of things to do:
-% \begin{itemize}
-% \item Rename \env{function}/\env{macro} environments to better describe
-% their use.
-% \item Generalise \env{function}/\env{macro} for documenting `other things',
-% such as environment names, package options, even keyval options.
-% \item Use \pkg{xparse}.
-% \item New function like "\part" but for files (remove awkward `File' as "\partname").
-% \item Something better to replace "\StopEventually"; I'm thinking two
-% environments \env{documentation} and \env{implementation} that can
-% conditionally typeset/ignore their material.
-% (This has been implemented but needs further consideration.)
-% \item Hyperlink documentation and implementation of macros (see
-% the \textsc{dtx} file of \pkg{svn-multi} v2 as an example).
-% \end{itemize}
-%
-% \section{Bugs}
-%
-% \begin{itemize}
-% \item Spaces are ignored entirely within \env{function} and \env{macro}
-% arguments. This is just waiting for a convenient space-trimming
-% macro in \pkg{expl3}.
-% \end{itemize}
-%
-% \section{Documentation}
-%
-% \subsection{Configuration}
-%
-% Before class options are processed, \pkg{l3doc} loads a configuration
-% file "l3doc.cfg" if it exists, allowing you to customise the behaviour of
-% the class without having to change the documentation source files.
-%
-% For example, to produce documentation on letter-sized paper instead of the
-% default A4 size, create |l3doc.cfg| and include the line
-% \begin{verbatim}
-% \PassOptionsToClass{letterpaper}{l3doc}
-% \end{verbatim}
-%
-% By default, \pkg{l3doc} selects the |T1| font encoding and loads the
-% Latin Modern fonts.
-% To prevent this, use the class option |cm-default|.
-%
-% \subsection{Partitioning documentation and implementation}
-%
-% \pkg{doc} uses the "\OnlyDocumentation"/"\AlsoImplementation" macros
-% to guide the use of "\StopEventually{}", which is intended to be placed
-% to partition the documentation and implementation within a single DTX file.
-%
-% This isn't very flexible, since it assumes that we \emph{always} want
-% to print the documentation. For the \pkg{expl3} sources, I wanted to be
-% be able to input DTX files in two modes: only displaying the documentation,
-% and only displaying the implementation. For example:
-%
-% \begin{verbatim}
-% \DisableImplementation
-% \DocInput{l3basics,l3prg,...}
-% \EnableImplementation
-% \DisableDocumentation
-% \DocInputAgain
-% \end{verbatim}
-%
-% The idea being that the entire \pkg{expl3} bundle can be documented,
-% with the implementation included at the back. Now, this isn't perfect,
-% but it's a start.
-%
-% Use "\begin{documentation}...\end{documentation}" around the documentation,
-% and "\begin{implementation}...\end{implementation}" around the implementation.
-% The "\EnableDocumentation"/"\EnableImplementation" will cause them to be typeset
-% when the DTX file is "\DocInput"; use "\DisableDocumentation"/"\DisableImplementation"
-% to omit the contents of those environments.
-%
-% Note that \cmd\DocInput\ now takes comma-separated arguments, and \cmd\DocInputAgain\
-% can be used to re-input all DTX files previously input in this way.
-%
-% \subsection{Describing functions in the documentation}
-%
-% \DescribeEnv{function}
-% \DescribeEnv{syntax}
-% Two heavily-used environments are defined to describe the syntax
-% of \textsf{expl3} functions and variables.
-% \begin{framed}
-% \vspace{-\baselineskip}
-% \begin{verbatim}
-% \begin{function}{ list_of , functions }
-% \begin{syntax}
-% "\foo_bar:" \Arg{meta} <test1>
-% \end{syntax}
-% <description>
-% \end{function}
-% \end{verbatim}
-% \vspace{-2\baselineskip}
-% \hrulefill
-% \begin{function}{ list_of , functions }
-% \begin{syntax}
-% "\foo_bar:" \Arg{meta} <test1>
-% \end{syntax}
-% <description>
-% \end{function}
-% \end{framed}
-%
-% Function environments take an optional argument to indicate whether the function(s) it
-% describes are expandable or defined in conditional forms. Use "EXP", "TF", or "pTF"
-% for this; note that "pTF" implies "EXP" since predicates must always be expandable.
-% As an example:
-% \begin{framed}
-% \vspace{-\baselineskip}
-% \begin{verbatim}
-% \begin{function}[pTF]{ \cs_if_exist:N }
-% \begin{syntax}
-% "\cs_if_exist_p:N" <cs>
-% \end{syntax}
-% <description>
-% \end{function}
-% \end{verbatim}
-% \vspace{-2\baselineskip}
-% \hrulefill
-% \begin{function}[pTF]{ \cs_if_exist:N }
-% \begin{syntax}
-% "\cs_if_exist_p:N" <cs>
-% \end{syntax}
-% <description>
-% \end{function}
-% \end{framed}
-%
-% Note that the list of functions used to use "|" as a separator instead,
-% and this syntax is still supported.
-%
-% In the old syntax, individual functions could be suffixed by an optional flag or
-% two to indicate the same information given in the optional argument.
-% This is still supported; use "/" to separate the function name
-% from the flag(s) and then add any of "(EXP)", "(TF)", or "(pTF)".
-%
-% \DescribeEnv{variable}
-% If you are documenting a variable instead of a function, use the "variable" environment instead; it behaves identically to the "function" environment above.
-%
-% \subsection{Describing functions in the implementation}
-%
-% \DescribeEnv{macro}
-% The well-used environment from \LaTeXe\ for marking up the implementation
-% of macros/functions remains the \env{macro} environment.
-% Some changes in \pkg{l3doc}: it now accepts comma-separated lists
-% of functions, to avoid a very large number of consecutive "\end{macro}"
-% statements.
-% \begin{verbatim}
-% % \begin{macro}{\foo:N,\foo:c}
-% % \begin{macrocode}
-% ... code for \foo:N and \foo:c ...
-% % \end{macrocode}
-% % \end{macro}
-% \end{verbatim}
-% If you are documenting an auxiliary macro, it's generally not 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 "function"
-% environment. In this case, write "\begin[aux]{macro}" and it will be
-% marked as such; its margin call-out will be printed in grey.
-%
-% Similarly, an internal package function still requires documentation
-% but usually will not be documented for users to see; these can be marked
-% as such with "\begin[internal]{macro}".
-%
-% 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.
-%
-%
-% \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 documentation.
-%
-% \DescribeMacro{\UnitTested}
-% Within a "macro" environment, it is a good idea to mark whether a unit test has
-% been created for the commands it defines. This is indicated by writing \cs{UnitTested}
-% anywhere within "\begin{macro}" \dots "\end{macro}".
-%
-% If the class option "checktest" is enabled, then it is an \emph{error} to have a
-% "macro" environment without a \cs{testfile} file. This is intended for large packages such
-% as \pkg{expl3} that should have absolutely comprehensive tests suites and whose authors
-% may not always be as sharp at adding new tests with new code as they should be.
-%
-% \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 printed at the end of the
-% compilation run.
-%
-% \DescribeEnv{variable}
-% When documenting variable definitions, use the "variable" environment instead.
-% It will, here, behave identically to the "macro" environment, except that if the class
-% option "checktest" is enabled, variables will not be required to have a test file.
-%
-% \DescribeEnv{arguments}
-% Within a \env{macro} environment, you may use the \env{arguments} environment
-% to describe the arguments taken by the function(s). It behaves
-% like a modified enumerate environment.
-% \begin{verbatim}
-% % \begin{macro}{\foo:nn,\foo:VV}
-% % \begin{arguments}
-% % \item Name of froozle to be frazzled
-% % \item Name of muble to be jubled
-% % \end{arguments}
-% % \begin{macrocode}
-% ... code for \foo:nn and \foo:VV ...
-% % \end{macrocode}
-% % \end{macro}
-% \end{verbatim}
-%
-% \bigskip
-% \textbf{OPTIONS FOR THE FUTURE}\qquad Any improvements to the markup
-% for the \env{function} environment would be good to mirror in \env{macro}.
-%
-% Perhaps this would be a better syntax for describing arguments?
-% \begin{verbatim}
-% \begin{macro}{\foo:nn,foo:VV}
-% \dArg{Name of froozle to be frazzled}
-% \dArg{Name of mumble to be jumbled}
-% ...
-% \end{verbatim}
-% I.e., get rid of the environment and do things like in, say, \pkg{fontspec}.
-%
-% \subsection{Keeping things consistent}
-%
-% Whenever a function is either documented or defined with \env{function}
-% and \env{macro} respectively, its name is stored in a sequence for later
-% processing.
-%
-% At the end of the document (i.e., after the \textsc{dtx} file has finished
-% processing), the list of names is analysed to check whether all defined
-% functions have been documented and vice versa. The results are printed
-% in the console output.
-%
-% If you need to do more serious work with these lists of names, take a
-% look at the implementation for the data structures and methods used to
-% store and access them directly.
-%
-% \subsection{Documenting templates}
-%
-% The following macros are provided for documenting templates; might
-% end up being something completely different but who knows.
-% \begin{quote}\parskip=0pt\obeylines
-% "\begin{TemplateInterfaceDescription}" \Arg{template type name}
-% " \TemplateArgument{none}{---}"
-% \textsc{or one or more of these:}
-% " \TemplateArgument" \Arg{arg no} \Arg{meaning}
-% \textsc{and}
-% "\TemplateSemantics"
-% " " \meta{text describing the template type semantics}
-% "\end{TemplateInterfaceDescription}"
-% \end{quote}
-%
-% \begin{quote}\parskip=0pt\obeylines
-% "\begin{TemplateDescription}" \Arg{template type name} \Arg{name}
-% \textsc{one or more of these:}
-% " \TemplateKey" \marg{key name} \marg{type of key}
-% " "\marg{textual description of meaning}
-% " "\marg{default value if any}
-% \textsc{and}
-% "\TemplateSemantics"
-% " " \meta{text describing special additional semantics of the template}
-% "\end{TemplateDescription}"
-% \end{quote}
-%
-% \begin{quote}\parskip=0pt\obeylines
-% "\begin{InstanceDescription}" \oarg{text to specify key column width (optional)}
-% \hfill\marg{template type name}\marg{instance name}\marg{template name}
-% \textsc{one or more of these:}
-% " \InstanceKey" \marg{key name} \marg{value}
-% \textsc{and}
-% "\InstanceSemantics"
-% " " \meta{text describing the result of this instance}
-% "\end{InstanceDescription}"
-% \end{quote}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3doc} implementation}
-%
-% \begin{macrocode}
-%<*class>
-% \end{macrocode}
-%
-% The Guilty Parties.
-% \begin{macrocode}
-\cs_new_nopar:Npn\Team{%
- The~\LaTeX3~Project\thanks{%
- Frank~Mittelbach,~Denys~Duchier,~Chris~Rowley,~
- Rainer~Sch\"opf,~Johannes~Braams,~Michael~Downes,~
- David~Carlisle,~Alan~Jeffrey,~Morten~H\o{}gholm,~Thomas~Lotze,~
- Javier~Bezos,~Will~Robertson,~Joseph~Wright}}
-% \end{macrocode}
-%
-% \subsection{Options and configuration}
-%
-% \begin{macrocode}
-\DeclareOption{a5paper}{\@latexerr{Option not supported}{}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\bool_new:N \g_doc_full_bool
-\bool_new:N \g_doc_lmodern_bool
-\bool_new:N \g_doc_checkfunc_bool
-\bool_new:N \g_doc_checktest_bool
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareOption{full}{ \bool_set_true:N \g_doc_full_bool }
-\DeclareOption{onlydoc}{ \bool_set_false:N \g_doc_full_bool }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareOption{check}{ \bool_set_true:N \g_doc_checkfunc_bool }
-\DeclareOption{nocheck}{ \bool_set_false:N \g_doc_checkfunc_bool }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareOption{checktest}{ \bool_set_true:N \g_doc_checktest_bool }
-\DeclareOption{nochecktest}{ \bool_set_false:N \g_doc_checktest_bool }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareOption{cm-default}{ \bool_set_false:N \g_doc_lmodern_bool }
-\DeclareOption{lm-default}{ \bool_set_true:N \g_doc_lmodern_bool }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
-\ExecuteOptions{full,a4paper,nocheck,nochecktest,lm-default}
-% \end{macrocode}
-%
-% Input a local configuration file, if it exists.
-%
-% \begin{macrocode}
-\InputIfFileExists{l3doc.cfg}
- {
- \typeout{*************************************^^J
- *~Local~config~file~l3doc.cfg~used ^^J
- *************************************}
- }
- { \@input{l3doc.ltx} }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\ProcessOptions
-% \end{macrocode}
-%
-%
-% \subsection{Class and package loading}
-%
-% \begin{macrocode}
-\LoadClass{article}
-\RequirePackage{doc}
-\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore,csquotes}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\bool_if:NT \g_doc_lmodern_bool {
- \RequirePackage[T1]{fontenc}
- \RequirePackage{lmodern}
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\RequirePackage{hypdoc}
-% \end{macrocode}
-% Just want the "comment" environment from \pkg{verbatim}:
-% \begin{macrocode}
-\let\doc@verbatim\verbatim
-\let\enddoc@verbatim\endverbatim
-\let\doc@@verbatim\@verbatim
-\expandafter\let\csname doc@verbatim*\expandafter\endcsname
- \csname verbatim*\endcsname
-\expandafter\let\csname enddoc@verbatim*\expandafter\endcsname
- \csname endverbatim*\endcsname
-\expandafter\let\csname doc@@verbatim*\expandafter\endcsname
- \csname @verbatim*\endcsname
-\RequirePackage{verbatim}
-\AtBeginDocument{%
- \let\verbatim\doc@verbatim
- \let\endverbatim\enddoc@verbatim
- \let\@verbatim\doc@@verbatim
- \expandafter\let\csname verbatim*\expandafter\endcsname
- \csname doc@verbatim*\endcsname
- \expandafter\let\csname endverbatim*\expandafter\endcsname
- \csname enddoc@verbatim*\endcsname
- \expandafter\let\csname @verbatim*\expandafter\endcsname
- \csname doc@@verbatim*\endcsname
-}
-% \end{macrocode}
-%
-% \subsection{Configuration}
-%
-% \begin{macro}{\MakePrivateLetters}
-% \begin{macrocode}
-\cs_set_nopar:Npn \MakePrivateLetters {
- \char_make_letter:N \@
- \char_make_letter:N \_
- \char_make_letter:N \:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\setcounter{StandardModuleDepth}{1}
-\@addtoreset{CodelineNo}{part}
-\cs_set_nopar:Npn \theCodelineNo {
- \textcolor[gray]{0.5}{ \sffamily\tiny\arabic{CodelineNo} }
-}
-% \end{macrocode}
-%
-%
-%
-% \subsection{Design}
-%
-% Increase the text width slightly so that width the standard fonts
-% 72 columns of code may appear in a |macrocode| environment.
-% Increase the marginpar width slightly, for long command names.
-% And increase the left margin by a similar amount.
-% \begin{macrocode}
-\setlength \textwidth { 385pt }
-\addtolength \marginparwidth { 30pt }
-\addtolength \oddsidemargin { 20pt }
-\addtolength \evensidemargin { 20pt }
-% \end{macrocode}
-% (These were introduced when "article" was the documentclass, but
-% I've left them here for now to remind me to do something about them
-% later; we still have the problem of \emph{very long} command names.)
-%
-% Customise lists:
-% \begin{macrocode}
-\cs_set_eq:NN \@@oldlist\list
-\cs_set_nopar:Npn \list#1#2{\@@oldlist{#1}{#2\listparindent\z@}}
-\setlength \parindent { 0pt }
-\setlength \itemindent { 0pt }
-\setlength \parskip { \medskipamount }
-% \end{macrocode}
-%
-% \subsection{Text markup}
-%
-% Make "|" and |"| be `short verb' characters, but not in
-% the document preamble, where an active character may interfere
-% with packages that are loaded.
-% \begin{macrocode}
-\AtBeginDocument {
- \MakeShortVerb \"
- \MakeShortVerb \|
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\providecommand*\eTeX{
- \if b\expandafter\@car\f@series\@nil\boldmath\fi
- $\m@th\varepsilon$-\TeX
-}
-\providecommand*\IniTeX{Ini\TeX}
-\providecommand*\Lua{Lua}
-\providecommand*\LuaTeX{\Lua\TeX}
-\providecommand*\pdfTeX{pdf\TeX}
-\RequirePackage{graphicx}
-\cs_if_free:NT \XeTeX {
- \cs_new_protected_nopar:Npn \XeTeX
- {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX}
-}
-% \end{macrocode}
-%
-% \begin{macro}{\cmd,\cs}
-% |\cmd{\foo}| Prints |\foo| verbatim. It may be used inside moving
-% arguments. |\cs{foo}| also prints |\foo|, for those who prefer that
-% syntax.
-% \begin{macrocode}
-\cs_set_nopar:Npn \cmd #1 { \cs{\expandafter\cmd@to@cs\string#1} }
-\cs_set_nopar:Npn \cmd@to@cs #1#2 { \char\number`#2\relax }
-\DeclareRobustCommand \cs [1] { \texttt { \char`\\ #1 } }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\marg,\oarg,\parg}
-% |\marg{text}| prints \marg{text}, `mandatory argument'.\\
-% |\oarg{text}| prints \oarg{text}, `optional argument'.\\
-% |\parg{te,xt}| prints \parg{te,xt}, `picture mode argument'.
-% \begin{macrocode}
-\providecommand\marg[1]{ \texttt{\char`\{} \meta{#1} \texttt{\char`\}} }
-\providecommand\oarg[1]{ \texttt[ \meta{#1} \texttt] }
-\providecommand\parg[1]{ \texttt( \meta{#1} \texttt) }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\m,\file,\env,\pkg,\cls}
-% This list may change\dots this is just my preference for markup.
-% \begin{macrocode}
-\cs_set_eq:NN \m \meta
-\cs_set_eq:NN \file \nolinkurl
-\DeclareRobustCommand \env {\texttt}
-\DeclareRobustCommand \pkg {\textsf}
-\DeclareRobustCommand \cls {\textsf}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{texnote}
-% \begin{macrocode}
-\newenvironment{texnote}{
- \endgraf
- \vspace{3mm}
- \small\textbf{\TeX~hackers~note:}
-}{
- \vspace{3mm}
-}
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{macro}{\tn}
-% As \cs{cs}. Use this to mark up all \TeX\ and \LaTeXe\ commands; they
-% then end up together in the index. TODO: hyperlinks in the index entries.
-% \begin{macrocode}
-\newcommand\tn[1]{
- \texttt{\bslash #1}
- \index{TeX~and~LaTeX2e~commands\actualchar
- \string\TeX{}~and~\string\LaTeXe{}~commands:\levelchar
- #1\actualchar{\string\ttfamily\string\bslash{}#1}}}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{documentation}
-% \begin{environment}{implementation}
-% \begin{macro}{\EnableDocumentation,\EnableImplementation}
-% \begin{macro}{\DisableDocumentation,\DisableImplementation}
-% \begin{macrocode}
-\cs_new:Npn \doc_implementation: {
- \cs_set:Npn \variable {\macro[var]}
-}
-\cs_new:Npn \doc_docu: {
- \cs_set_eq:NN \variable \variabledoc
-}
-\AtEndOfPackage{\doc_docu:}
-\newenvironment{documentation}{\doc_docu:}{}
-\newenvironment{implementation}{\doc_implementation:}{}
-\newcommand\EnableDocumentation{%
- \renewenvironment{documentation}{\doc_docu:}{}%
-}
-\newcommand\EnableImplementation{%
- \renewenvironment{implementation}{\doc_implementation:}{}%
-}
-\newcommand\DisableDocumentation{%
- \cs_set_eq:NN \documentation \comment
- \cs_set_eq:NN \enddocumentation \endcomment
-}
-\newcommand\DisableImplementation{%
- \cs_set_eq:NN \implementation \comment
- \cs_set_eq:NN \endimplementation \endcomment
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{environment}
-% \end{environment}
-%
-% \begin{environment}{arguments}
-% This environment is designed to be used within a \env{macro} environment
-% to describe the arguments of the macro/function.
-% \begin{macrocode}
-\newenvironment{arguments}{
- \enumerate[
- nolistsep,
- label=\texttt{\#\arabic*}~:,
- labelsep=*,
- ]
-}{
- \endenumerate
-}
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{environment}{function}
-% \begin{environment}{variabledoc}
-% Environment for documenting function(s).
-% Stick the function names in a box. Use a "|" as delimiter and
-% allow |<...>| to be used as markup for |\meta{...}|.
-% Ignore spaces and sanitize with catcodes before reading argument.
-% \begin{macrocode}
-\char_make_active:N \<
-\DeclareDocumentCommand \function { O{} } {
-
- \phantomsection
-
- \bool_gset_false:N \l_doc_meta_TF_bool
- \bool_gset_false:N \l_doc_meta_pTF_bool
- \bool_gset_false:N \l_doc_meta_EXP_bool
-
- \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} }
- \KV_parse_space_removal_sanitize:n {#1}
-
- \char_make_active:N \<
- \cs_set_eq:NN < \doc_open_meta:n
-
- \group_begin:
- \MakePrivateLetters
- \char_make_other:N \|
- \char_make_other:N \\
- \char_make_space:N \~
- \char_make_ignore:N \ % space
- \char_make_ignore:N \^^M
- \char_make_ignore:N \^^I
- \function_aux:n
-}
-\char_make_other:N \<
-\cs_set_eq:NN \variabledoc \function
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \doc_meta_opt_TF: {
- \bool_gset_true:N \l_doc_meta_TF_bool
-}
-\cs_set:Nn \doc_meta_opt_EXP: {
- \bool_gset_true:N \l_doc_meta_EXP_bool
-}
-\cs_set:Nn \doc_meta_opt_pTF: {
- \bool_gset_true:N \l_doc_meta_pTF_bool
- \bool_gset_true:N \l_doc_meta_TF_bool
- \bool_gset_true:N \l_doc_meta_EXP_bool
-}
-% \end{macrocode}
-%
-% \begin{macro}{\function_aux:n}
-% \begin{arguments}
-% \item Vertical bar--separated list of functions with optional metadata;
-% input has already been sanitised by catcode changes before reading
-% the argument.
-% \end{arguments}
-% Because vertical bars are odd delimiters to choose, we also now iterate over commas!
-% \begin{macrocode}
-\group_begin:
-\char_make_other:N \|
-\cs_gset_nopar:Npn \function_aux:n #1 {
- \cs_set_nopar:Npn \nextnewline{\cs_gset_nopar:Npn\nextnewline{\\}}
- \tl_gset_eq:NN \g_doc_macro_tl \c_empty_tl
- \bigskip\endgraf\noindent\ttfamily
- \tabular[b]{ | l @{} c | }
- \hline
- \clist_map_inline:nn {#1} {\doc_showmacro:w ##1 | \q_stop} \\
- \hline
- \endtabular
- \group_end:
-}
-\group_end:
-% \end{macrocode}
-% \end{macro}
-% \end{environment}
-% \end{environment}
-%
-% \begin{macro}{\doc_showmacro:w}
-% This function reads in a "|"-separated list, passing each item to
-% the auxiliary function "\doc_showmacro_aux:w".
-% \begin{macrocode}
-\group_begin:
-\char_make_other:N \|
-\cs_gset_nopar:Npn \doc_showmacro:w #1 | {
- \tl_if_blank:nTF {#1} {
- \use_none:n
- }{
- \doc_showmacro_aux:w #1 / \q_stop
- \peek_meaning:NTF \q_stop { \use_none:n } { \doc_showmacro:w }
- }
-}
-\group_end:
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\bool_new:N \l_doc_meta_TF_bool
-\bool_new:N \l_doc_meta_pTF_bool
-\bool_new:N \l_doc_meta_EXP_bool
-% \end{macrocode}
-%
-% \begin{macro}{\doc_showmacro_aux:w}
-% This macro is passed one of:
-% \begin{quote}
-% "\abc:cnx / (EXP) / \q_stop" \\
-% "\abc:cnx / \q_stop" \\
-% \end{quote}
-% We also have some code here to print out every documented macro at the end
-% of the document.
-% \begin{arguments}
-% \item Function/macro/variable name \item Metadata tags (if any)
-% \end{arguments}
-% \begin{macrocode}
-\cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop {
-
- \tl_if_in:nnT {#2} { (TF) } {
- \bool_gset_true:N \l_doc_meta_TF_bool
- }
-
- \tl_if_in:nnT {#2} { (EXP) } {
- \bool_gset_true:N \l_doc_meta_EXP_bool
- }
-
- \tl_if_in:nnT {#2} { (pTF) } {
- \bool_gset_true:N \l_doc_meta_TF_bool
- \bool_gset_true:N \l_doc_meta_pTF_bool
- \bool_gset_true:N \l_doc_meta_EXP_bool
- }
-
- \bool_if:NT \l_doc_meta_pTF_bool {
- \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil }
- \doc_special_main_index:o { \l_doc_pTF_name_tl }
- \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:N \l_doc_pTF_name_tl }
- }
-
- \bool_if:NTF \l_doc_meta_TF_bool {
- \doc_special_main_index:o { #1 TF }
- \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 TF } }
- \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 T } }
- \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 F } }
- }{
- \doc_special_main_index:o { #1 }
- \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 } }
- }
-
- \bool_if:NTF \l_doc_meta_pTF_bool {
- \bool_gset_false:N \l_doc_meta_TF_bool
- \exp_after:wN \doc_showmacro_aux_ii:w \l_doc_pTF_name_tl ::\q_stop
- \bool_gset_true:N \l_doc_meta_TF_bool
- \doc_showmacro_aux_ii:w #1::\q_stop
- }{
- \doc_showmacro_aux_ii:w #1::\q_stop
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\doc_showmacro_aux_ii:w}
-% This macro is passed arguments in the following ways:
-% \begin{quote}
-% "\doc_showmacro_aux_ii:w "^^A
-% \makebox[\widthof{\texttt{123456}}]{\meta{name}}^^A
-% " ::\q_stop" \\
-% "\doc_showmacro_aux_ii:w \foo ::\q_stop" \\
-% "\doc_showmacro_aux_ii:w \foo: ::\q_stop" \\
-% "\doc_showmacro_aux_ii:w \foo:Z ::\q_stop" \\
-% \end{quote}
-% Notice that for "\foo", "#2" and "#3" are empty,\\
-% for "\foo:", "#2" is empty, and "#3" is `":"'\\
-% for "\foo:Z", "#2" is `"Z"' and "#3" is `":"' .
-% \begin{arguments}
-% \item Function name \item Possible arg.\ spec. \item Possible colon
-% \end{arguments}
-% \begin{macrocode}
-\cs_set_nopar:Npn \doc_showmacro_aux_ii:w #1:#2:#3 \q_stop {
- \nextnewline
- \str_if_eq:xxTF {#1} {\g_doc_macro_tl} {
- \doc_typeset_aux:n
- }{
- \tl_gset:Nn \g_doc_macro_tl {#1}
- \use:n
- }
- { \g_doc_macro_tl }
- #3
- #2
- \bool_if:NT \l_doc_meta_TF_bool { \doc_typeset_TF: }
- &
- \bool_if:NT \l_doc_meta_EXP_bool {
- \hspace{\tabcolsep}
- $\star$
- }
- \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl }
- \exp_args:NNf \tl_replace_all_in:Nnn \g_doc_macro_tl {\token_to_str:N _} {/}
- \exp_args:NNf \tl_replace_all_in:Nnn \g_doc_macro_tl {\@backslashchar} {}
- \bool_if:NT \g_doc_full_bool {
- \exp_args:Nf\label{doc/function/\g_doc_macro_tl#3#2}
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{syntax}
-% Syntax block placed next to the list of functions to illustrate their use.
-% \begin{macrocode}
-\dim_new:N \g_doc_syntax_dim
-\dim_set:Nn \g_doc_syntax_dim {0.7\textwidth}
-\newenvironment{syntax}{
- \minipage[b]{\g_doc_syntax_dim}
- \cs_set_nopar:Npn \meta@font@select{\rmfamily\itshape} % (Will: I HATE italic cmtt!)
- \small\ttfamily\raggedright
- \obeyspaces\obeylines
-}{
- \endminipage
- \hfil\break
- \global\@ignoretrue
-}
-% \end{macrocode}
-% \end{environment}
-%
-% Perhaps these belong in \file{l3token}?
-% \begin{macrocode}
-\tl_map_inline:nn {0123456789} { \cs_gset_eq:cN {char_other_#1} #1 }
-% \end{macrocode}
-%
-% \begin{macro}{\doc_open_meta:n,\doc_close_meta:n}
-% This code turns all numbers within "<...>" markup to be set as subscripts.
-% You can use escaped numbers to get the real thing (e.g., "\1" = `1').
-% \begin{macrocode}
-\group_begin:
- \tl_map_inline:nn {0123456789} { \char_make_active:N #1 }
- \cs_new:Npn \doc_open_meta:n {
- \group_begin:
- \tl_map_function:nN {0123456789} \doc_assign_num:n
- \doc_close_meta:w
- }
- \cs_new:Npn \Arg {
- \texttt{ \char`\{ }
- \group_begin:
- \tl_map_function:nN {0123456789} \doc_assign_num:n
- \doc_close_Arg:n
- }
-\group_end:
-\cs_new_nopar:Npn \doc_close_meta:w #1> { \meta {#1} \group_end: }
-\cs_new_nopar:Npn \doc_close_Arg:n #1 {
- \meta {#1}
- \group_end:
- \texttt{ \char`\} }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\doc_assign_num:n}
-% This function takes a numeral (`0'), defines its escaped self to be equal
-% to itself ("\0" $\to$ `0'), makes it active, and turns itself into a subscript
-% instead (`0' $\to$ `${}_0$').
-% \begin{macrocode}
-\cs_new_nopar:Npn \doc_assign_num:n #1 {
- \cs_set_eq:cc { \string #1 } { char_other_\string #1 }
- \char_make_active:N #1
- \cs_set_nopar:Npn #1 { \unskip \, $ {} \sb { \use:c { char_other_\string #1 } } $ }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{macro}
-% We want to extend the old definition to allow comma-separated lists of
-% macros, rather than one at a time. keyval processing is very rudimentary;
-% awaiting a more robust solution.
-% \begin{macrocode}
-\renewcommand \macro [1][] {
-
- \int_compare:nNnTF \currentgrouplevel=2
- { \int_gzero:N \g_doc_nested_macro_int }
- { \int_incr:N \g_doc_nested_macro_int }
-
- \bool_set_false:N \l_doc_macro_aux_bool
- \bool_set_false:N \l_doc_macro_internal_bool
- \bool_set_false:N \l_doc_macro_TF_bool
- \bool_set_false:N \l_doc_macro_pTF_bool
- \bool_set_false:N \l_doc_macro_var_bool
- \bool_set_false:N \l_doc_tested_bool
-
- \cs_set_eq:NN \doc_macroname_prefix:n \use:n
- \cs_set_eq:NN \doc_macroname_suffix: \c_empty_tl
-
- \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_macro_opt_##1:} }
- \KV_parse_space_removal_sanitize:n {#1}
-
- \cs_set_eq:NN \testfile \doc_print_testfile:n
-
- \group_begin:
- \MakePrivateLetters
- \char_make_letter:N \\
- \char_make_ignore:N \ % space
- \char_make_ignore:N \^^M
- \char_make_ignore:N \^^I
- \doc_macro_aux:n
-}
-% \end{macrocode}
-% After changing the catcodes, parse the arguments:
-% \begin{macrocode}
-\cs_new_nopar:Npn \doc_macro_aux:n #1 {
- \group_end:
- \cs_set:Npn \l_doc_macro_input_clist {#1}
- \bool_if:NTF \l_doc_macro_pTF_bool
- {
- \clist_map_inline:nn {#1}
- {
- \tl_if_blank:nF {##1}
- {
- \exp_args:Nf \doc_macro_single
- { \doc_predicate_from_base:w ##1 \q_nil }
- }
- }
- \bool_set_true:N \l_doc_macro_TF_bool
- \clist_map_inline:nn {#1}
- { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } }
- \bool_set_false:N \l_doc_macro_TF_bool
- }
- {
- \clist_map_inline:nn {#1}
- { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } }
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\bool_new:N \l_doc_macro_internal_bool
-\bool_new:N \l_doc_macro_aux_bool
-\bool_new:N \l_doc_macro_TF_bool
-\bool_new:N \l_doc_macro_pTF_bool
-\bool_new:N \l_doc_macro_var_bool
-\cs_set_nopar:Npn \doc_macro_opt_aux: { \bool_set_true:N \l_doc_macro_aux_bool }
-\cs_set_nopar:Npn \doc_macro_opt_internal: { \bool_set_true:N \l_doc_macro_internal_bool }
-\cs_set_nopar:Npn \doc_macro_opt_TF: { \bool_set_true:N \l_doc_macro_TF_bool }
-\cs_set_nopar:Npn \doc_macro_opt_pTF: { \bool_set_true:N \l_doc_macro_pTF_bool }
-\cs_set_nopar:Npn \doc_macro_opt_var: { \bool_set_true:N \l_doc_macro_var_bool }
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{macrocode}
-\cs_set:Npn \doc_predicate_from_base:w #1:#2 \q_nil {#1_p:#2}
-% \end{macrocode}
-%
-% \begin{environment}{doc_macro_single}
-% Let's start to mess around with "doc"'s "macro" environment. See \file{doc.dtx}
-% for a full explanation of the original environment. It's
-% rather \emph{enthusiastically} commented.
-% \begin{arguments}
-% \item Macro/function/whatever name; input has already been sanitised.
-% \end{arguments}
-% \begin{macrocode}
-\int_new:N \l_doc_macro_int
-\cs_set_nopar:Npn \doc_macro_single #1 {
- \int_incr:N \l_doc_macro_int
- \tl_set:Nx \saved@macroname { \token_to_str:N #1 }
- \topsep\MacroTopsep
- \trivlist
- \cs_set_nopar:Npn \makelabel ##1 { \llap{##1} }
- \if@inlabel
- \cs_set_eq:NN \@tempa \@empty
- \count@ \macro@cnt
- \loop \ifnum\count@>\z@
- \cs_set_nopar:Npx \@tempa{\@tempa\hbox{\strut}}
- \advance\count@\m@ne
- \repeat
- \cs_set_nopar:Npx \makelabel ##1 {
- \llap{\vtop to\baselineskip {\@tempa\hbox{##1}\vss}}
- }
- \advance \macro@cnt \@ne
- \else
- \macro@cnt \@ne
- \fi
-
- \bool_if:NT \l_doc_macro_aux_bool {
- \cs_set_eq:NN \doc_macroname_prefix:n \doc_typeset_aux:n
- }
- \bool_if:NT \l_doc_macro_TF_bool {
- \cs_set_eq:NN \doc_macroname_suffix: \doc_typeset_TF:
- }
-
- \bool_if:NF \l_doc_macro_aux_bool {
- \tl_gset:Nx \l_doc_macro_tl { \tl_to_str:n {#1} }
- \exp_args:NNf \tl_greplace_all_in:Nnn \l_doc_macro_tl {\token_to_str:N _} {/}
- \exp_args:NNf \tl_greplace_all_in:Nnn \l_doc_macro_tl {\@backslashchar} {}
- }
-
- \use:x {
- \exp_not:N \item [ \exp_not:N \doc_print_macroname:n {
- \tl_to_str:n {#1}
- }]
- }
- \global\advance \c@CodelineNo \@ne
-
- \bool_if:NF \l_doc_macro_aux_bool {
- \bool_if:NTF \l_doc_macro_TF_bool {
- \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 TF } }
- \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 T } }
- \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 F } }
- }{
- \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n {#1} }
- }
- }
- \bool_if:NTF \l_doc_macro_TF_bool {
- \SpecialMainIndex{#1 TF}\nobreak
- \DoNotIndex{#1 TF}
- }{
- \SpecialMainIndex{#1}\nobreak
- \DoNotIndex{#1}
- }
-
- \global\advance \c@CodelineNo \m@ne
- \ignorespaces
-}
-% \end{macrocode}
-%
-% \begin{macro}{\doc_print_macroname:n}
-% \begin{macrocode}
-\tl_clear:N \l_doc_macro_tl
-\cs_set_nopar:Npn \doc_print_macroname:n #1 {
- \strut
- \int_compare:nTF { \tl_elt_count:n {#1} <= 28 }
- { \MacroFont } { \MacroLongFont }
-
- % INEFFICIENT: (!)
- \exp_args:NNx \seq_if_in:NnTF \g_doc_functions_seq
- { #1 \bool_if:NT \l_doc_macro_TF_bool { \tl_to_str:n {TF} } }
- {
- \hyperref [doc/function/\l_doc_macro_tl]
- }
- { \use:n }
- {
- \doc_macroname_prefix:n {#1} \doc_macroname_suffix: \ % space!
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{environment}
-%
-% \begin{macro}{\MacroLongFont}
-% \begin{macrocode}
-\providecommand \MacroLongFont {
- \fontfamily{lmtt}\fontseries{lc}\small
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\doc_typeset_TF:,\doc_typeset_aux:n}
-% Used by \cs{doc_macro_single} and \cs{doc_showmacro_aux_ii:w} to typeset
-% conditionals and auxiliary functions.
-% \begin{macrocode}
-\cs_set_nopar:Npn \doc_typeset_TF: {
- \itshape TF%
- \makebox[0pt][r]{%
- \color[gray]{0.5}
- \underline { \phantom{\itshape TF} \kern-0.1em }
- }
-}
-\cs_set_nopar:Npn \doc_typeset_aux:n #1 {
- {\color[gray]{0.5} #1}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\doc_print_testfile:n}
-% Used to show that a macro has a test, somewhere.
-% \begin{macrocode}
-\DeclareDocumentCommand \doc_print_testfile:n {m} {
- \bool_set_true:N \l_doc_tested_bool
- \tl_if_eq:nnF {#1} {*} {
- \seq_if_in:NnF \g_doc_testfiles_seq {#1}
- {
- \par{\footnotesize(\textit{
- The~ test~ suite~ for~ this~ command,~ and~ others~ in~ this~ file,~ is~ \textsf{#1}}.
- )\par}
- \seq_gput_right:Nn \g_doc_testfiles_seq {#1}
- }
- }
-}
-\seq_new:N \g_doc_testfiles_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\TestFiles}
-% \begin{macrocode}
-\DeclareDocumentCommand \TestFiles {m} {
- \par
- {\itshape
- The~ following~ test~ files~ are~ used~ for~ this~ code:~ \textsf{#1}.
- }
- \par\ignorespaces
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\UnitTested}
-% \begin{macrocode}
-\DeclareDocumentCommand \UnitTested {} {
- \testfile*
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\TestMissing}
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_gput:Nnn {NVx}
-\prop_new:N \g_doc_missing_tests_prop
-\DeclareDocumentCommand \TestMissing {m} {
- \prop_if_in:NVTF \g_doc_missing_tests_prop \l_doc_macro_input_clist
- {
- \prop_get:NVN \g_doc_missing_tests_prop \l_doc_macro_input_clist \l_tmpa_tl
- \prop_gput:NVx \g_doc_missing_tests_prop \l_doc_macro_input_clist
- {
- *~ \l_tmpa_tl
- ^^J \exp_not:n {\space\space\space\space\space\space}
- *~ #1
- }
- }
- { \prop_gput:NVn \g_doc_missing_tests_prop \l_doc_macro_input_clist {#1} }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% Delete these when they're finally available:
-% \begin{macrocode}
-\cs_set_nopar:Npn \clist_length:N #1 {
- \tex_number:D \etex_numexpr:D
- 0
- \clist_map_function:NN #1 \tl_elt_count_aux:n
- \scan_stop:
-}
-\cs_set_nopar:Npn \clist_length:n #1 {
- \tex_number:D \etex_numexpr:D
- 0
- \clist_map_function:nN {#1} \tl_elt_count_aux:n
- \scan_stop:
-}
-\cs_set_nopar:Npn \clist_item:Nn #1#2 {
- \exp_args:No \clist_item:nn {#1} {#2}
-}
-\cs_generate_variant:Nn \clist_item:Nn { c }
-\cs_set:Npn \clist_item:nn #1#2 {
- \int_compare:nNnTF {#2} < { 0 }
- {
- \exp_args:Nf \clist_item_aux:nw
- { \clist_length:n {#1} + #2 }
- #1 , \q_recursion_tail \q_recursion_stop
- }
- {
- \clist_item_aux:nw {#2} #1
- , \q_recursion_tail \q_recursion_stop
- }
-}
-\cs_set:Npn \clist_item_aux:nw #1#2 , #3 {
- \int_compare:nNnTF {#1} = { 0 }
- { \use_i_delimit_by_q_recursion_stop:nw {#2} }
- {
- \quark_if_recursion_tail_stop:n {#3}
- \clist_item_aux:nw { #1 - 1 } #3
- }
-}
-% \end{macrocode}
-%
-% \begin{macro}{\endmacro}
-% \begin{macrocode}
-\int_new:N \g_doc_nested_macro_int
-\cs_set:Nn \doc_texttt_comma:n {\,,~\texttt{#1}}
-\cs_set:Npn \endmacro {
- \int_compare:nT {\g_doc_nested_macro_int<1}
- {
- \par\nobreak{\footnotesize(\emph{
- End~ definition~ for~
- \prg_case_int:nnn { \clist_length:N \l_doc_macro_input_clist }
- {
- {1} { \texttt{ \clist_use:N \l_doc_macro_input_clist }. }
- {2}
- {
- \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} }
- \tl_set:Nx \l_clist_last_tl { \clist_item:Nn \l_doc_macro_input_clist {1} }
- \texttt{\l_clist_first_tl}\,~ and~ \texttt{\l_clist_last_tl}\,.
- }
- {3}
- {
- \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} }
- \tl_set:Nx \l_clist_mid_tl { \clist_item:Nn \l_doc_macro_input_clist {1} }
- \tl_set:Nx \l_clist_last_tl { \clist_item:Nn \l_doc_macro_input_clist {2} }
- \texttt{\l_clist_first_tl}\,,~
- \texttt{\l_clist_mid_tl}\,,~
- and~ \texttt{\l_clist_last_tl}\,.
- }
- }
- {
- \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} }
- \texttt{\l_clist_first_tl}\,~and~others.
- }
- \bool_if:nT {
- !\l_doc_macro_aux_bool &&
- !\l_doc_macro_internal_bool &&
- \int_compare_p:n {\g_doc_nested_macro_int<1}
- }
- {
- \int_compare:nNnTF \l_doc_macro_int=1 {~This~} {~These~}
- \bool_if:NTF \l_doc_macro_var_bool{variable}{function}
- \int_compare:nNnTF \l_doc_macro_int=1 {~is~}{s~are~}
- documented~on~page~
- \exp_args:Nx\pageref{doc/function/\l_doc_macro_tl}.
- }
- })\par}
- }
- \bool_if:nT
- { \g_doc_checktest_bool &&
- !( \l_doc_macro_aux_bool || \l_doc_macro_var_bool ) &&
- !\l_doc_tested_bool
- }
- {
- \seq_gput_right:Nx \g_doc_not_tested_seq
- {
- \l_doc_macro_input_clist
- \bool_if:NT \l_doc_macro_pTF_bool {~(pTF)}
- \bool_if:NT \l_doc_macro_TF_bool {~(TF)}
- }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\DescribeOption}
-% For describing package options. Due to Joseph Wright.
-% Name/usage might change soon.
-% \begin{macrocode}
-\newcommand*{\DescribeOption}{
- \leavevmode
- \@bsphack
- \begingroup
- \MakePrivateLetters
- \Describe@Option
-}
-\newcommand*{\Describe@Option}[1]{
- \endgroup
- \marginpar{
- \raggedleft
- \PrintDescribeEnv{#1}
- }
- \SpecialOptionIndex{#1}
- \@esphack
- \ignorespaces
-}
-\newcommand*{\SpecialOptionIndex}[1]{
- \@bsphack
- \begingroup
- \HD@target
- \let\HDorg@encapchar\encapchar
- \edef\encapchar usage{
- \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}
- }
- \index{
- #1\actualchar{\protect\ttfamily#1}~(option)
- \encapchar usage
- }
- \index{
- options:\levelchar#1\actualchar{\protect\ttfamily#1}
- \encapchar usage
- }
- \endgroup
- \@esphack
-}
-% \end{macrocode}
-% \end{macro}
-%
-% Here are some definitions for additional markup that will help to
-% structure your documentation.
-%
-% \begin{environment}{danger}
-% \begin{environment}{ddanger}
-% \begin{syntax}
-% |\begin{[d]danger}|\\
-% dangerous code\\
-% |\end{[d]danger}|
-% \end{syntax}
-%
-% \begin{danger}
-% Provides a danger bend, as known from the \TeX{}book.
-% \end{danger}
-% The actual character from the font |manfnt|:
-% \begin{macrocode}
-\font\manual=manfnt
-\cs_set_nopar:Npn \dbend { {\manual\char127} }
-% \end{macrocode}
-%
-% Defines the single danger bend. Use it whenever there is a feature in your
-% package that might be tricky to use.
-% FIXME: Has to be fixed when in combination with a macro-definition.
-% \begin{macrocode}
-\newenvironment {danger} {
- \begin{trivlist}\item[]\noindent
- \begingroup\hangindent=2pc\hangafter=-2
- \cs_set_nopar:Npn \par{\endgraf\endgroup}
- \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces
-}{
- \par\end{trivlist}
-}
-% \end{macrocode}
-%
-% \begin{ddanger}
-% Use the double danger bend if there is something which could cause serious
-% problems when used in a wrong way. Better the normal user does not know
-% about such things.
-% \end{ddanger}
-% \begin{macrocode}
-\newenvironment {ddanger} {
- \begin{trivlist}\item[]\noindent
- \begingroup\hangindent=3.5pc\hangafter=-2
- \cs_set_nopar:Npn \par{\endgraf\endgroup}
- \hbox to0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\ignorespaces
-}{
- \par\end{trivlist}
-}
-% \end{macrocode}
-% \end{environment}
-% \end{environment}
-%
-% \subsection{Documenting templates}
-%
-% \begin{macrocode}
-\newenvironment{TemplateInterfaceDescription}[1]
- {\subsection{The~object~type~`#1'}%
- \begingroup
- \@beginparpenalty\@M
- \description
- \def\TemplateArgument##1##2{\item[Arg:~##1]##2\par}%
- \def\TemplateSemantics{\enddescription\endgroup
- \subsubsection*{Semantics:}}%
- }
- {\par\bigskip}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newenvironment{TemplateDescription}[2]
- {\subsection{The~template~`#2'~(object~type~#1)}%
- \subsubsection*{Attributes:}%
- \begingroup
- \@beginparpenalty\@M
- \description
- \def\TemplateKey##1##2##3##4{\item[##1~(##2)]##3%
- \ifx\TemplateKey##4\TemplateKey\else
-% \hskip0ptplus3em\penalty-500\hskip 0pt plus 1filll Default:~##4%
- \hfill\penalty500\hbox{}\hfill Default:~##4%
- \nobreak\hskip-\parfillskip\hskip0pt\relax
- \fi
- \par}%
- \def\TemplateSemantics{\enddescription\endgroup
- \subsubsection*{Semantics~\&~Comments:}}%
- }
- {\par\bigskip}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newenvironment{InstanceDescription}[4][xxxxxxxxxxxxxxx]
- {\subsubsection{The~instance~`#3'~(template~#2/#4)}%
- \subsubsection*{Attribute~values:}%
- \begingroup
- \@beginparpenalty\@M
- \def\InstanceKey##1##2{\>\textbf{##1}\>##2\\}%
- \def\InstanceSemantics{\endtabbing\endgroup
- \vskip-30pt\vskip0pt
- \subsubsection*{Layout~description~\&~Comments:}}%
- \tabbing
- xxxx\=#1\=\kill
- }
- {\par\bigskip}
-% \end{macrocode}
-%
-% \subsection{Inheriting doc}
-%
-% Code here is taken from \pkg{doc}, stripped of comments and translated
-% into \pkg{expl3} syntax. New features are added in various places.
-%
-% \begin{macro}{\StopEventually,\Finale,\AlsoImplementation,\OnlyDescription}
-% \begin{macrocode}
-\bool_new:N \g_doc_implementation_bool
-\cs_set_nopar:Npn \AlsoImplementation {
- \bool_set_true:N \g_doc_implementation_bool
- \cs_set:Npn \StopEventually ##1 {
- \@bsphack
- \cs_gset_nopar:Npn \Finale { ##1 \check@checksum }
- \init@checksum
- \@esphack
- }
-}
-\AlsoImplementation
-\cs_set_nopar:Npn \OnlyDescription {
- \@bsphack
- \bool_set_false:N \g_doc_implementation_bool
- \cs_set:Npn \StopEventually ##1 { ##1 \endinput }
- \@esphack
-}
-\cs_set_eq:NN \Finale \relax
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\cs_set_nopar:Npn \partname{File}
-% \end{macrocode}
-%
-% \begin{macro}{\DocInput}
-% From \pkg{doc}. Now accepts comma-list input (who has commas in filenames?).
-% \begin{macrocode}
-\clist_new:N \g_docinput_clist
-\cs_set:Npn \DocInput #1 {
- \clist_map_inline:nn {#1} {
- \clist_put_right:Nn \g_docinput_clist {##1}
- \MakePercentIgnore
- \input{##1}
- \MakePercentComment
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\DocInputAgain}
-% Uses "\g_docinput_clist" to re-input whatever's already been "\DocInput"-ed until now.
-% May be used multiple times.
-% \begin{macrocode}
-\cs_set:Npn \DocInputAgain {
- \clist_map_inline:Nn \g_docinput_clist {
- \MakePercentIgnore
- \input{##1}
- \MakePercentComment
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\DocInclude}
-% More or less exactly the same as |\include|, but uses |\DocInput|
-% on a |dtx| file, not |\input| on a |tex| file.
-% \begin{macrocode}
-\cs_set_nopar:Npn \partname{File}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand*{\DocInclude}[1]{%
- \relax\clearpage
- \docincludeaux
- \IfFileExists{#1.fdd}{
- \cs_set_nopar:Npn \currentfile{#1.fdd}
- }{
- \cs_set_nopar:Npn \currentfile{#1.dtx}
- }
- \ifnum\@auxout=\@partaux
- \@latexerr{\string\include\space cannot~be~nested}\@eha
- \else
- \@docinclude #1
- \fi
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set_nopar:Npn \@docinclude #1 {
- \clearpage
- \immediate\write\@mainaux{\string\@input{#1.aux}}
- \@tempswatrue
- \if@partsw
- \@tempswafalse
- \cs_set_nopar:Npx \@tempb{#1}
- \@for\@tempa:=\@partlist\do{
- \ifx\@tempa\@tempb\@tempswatrue\fi
- }
- \fi
- \if@tempswa
- \cs_set_eq:NN \@auxout\@partaux
- \immediate\openout\@partaux #1.aux
- \immediate\write\@partaux{\relax}
- \cs_set_eq:NN \@ltxdoc@PrintIndex\PrintIndex
- \cs_set_eq:NN \PrintIndex\relax
- \cs_set_eq:NN \@ltxdoc@PrintChanges\PrintChanges
- \cs_set_eq:NN \PrintChanges\relax
- \cs_set_eq:NN \@ltxdoc@theglossary\theglossary
- \cs_set_eq:NN \@ltxdoc@endtheglossary\endtheglossary
- \part{\currentfile}
- {
- \cs_set_eq:NN \ttfamily\relax
- \cs_gset_nopar:Npx \filekey{\filekey, \thepart={\ttfamily\currentfile}}
- }
- \DocInput{\currentfile}
- \cs_set_eq:NN \PrintIndex\@ltxdoc@PrintIndex
- \cs_set_eq:NN \PrintChanges\@ltxdoc@PrintChanges
- \cs_set_eq:NN \theglossary\@ltxdoc@theglossary
- \cs_set_eq:NN \endtheglossary\@ltxdoc@endtheglossary
- \clearpage
- \@writeckpt{#1}
- \immediate\closeout\@partaux
- \else
- \@nameuse{cp@#1}
- \fi
- \cs_set_eq:NN \@auxout\@mainaux
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_gset_nopar:Npn \codeline@wrindex #1 {
- \immediate\write\@indexfile {
- \string\indexentry{#1}
- {\filesep\number\c@CodelineNo}
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\cs_set_eq:NN \filesep \@empty
-% \end{macrocode}
-%
-% \begin{macro}{\docincludeaux}
-% \begin{macrocode}
-\cs_set_nopar:Npn \docincludeaux {
- \cs_set_nopar:Npn \thepart {\alphalph{part}}
- \cs_set_nopar:Npn \filesep {\thepart-}
- \cs_set_eq:NN \filekey\@gobble
- \g@addto@macro\index@prologue{
- \cs_gset_nopar:Npn\@oddfoot{
- \parbox{\textwidth}{
- \strut\footnotesize
- \raggedright{\bfseries File~Key:}~\filekey
- }
- }
- \cs_set_eq:NN \@evenfoot\@oddfoot
- }
- \cs_gset_eq:NN \docincludeaux\relax
- \cs_gset_nopar:Npn\@oddfoot{
- \expandafter\ifx\csname ver@\currentfile\endcsname\relax
- File~\thepart :~{\ttfamily\currentfile}~
- \else
- \GetFileInfo{\currentfile}
- File~\thepart :~{\ttfamily\filename}~
- Date:~\filedate\ % space
- Version~\fileversion
- \fi
- \hfill\thepage
- }
- \cs_set_eq:NN \@evenfoot \@oddfoot
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{At end document}
-%
-% Print all defined and documented macros/functions.
-%
-% \begin{macrocode}
-\seq_new:N \g_doc_functions_seq
-\seq_new:N \g_doc_macros_seq
-\seq_new:N \g_doc_not_tested_seq
-% \end{macrocode}
-%
-% \begin{macrocode}
-\iow_open:Nn \g_write_func_stream { \jobname.cmds }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_nopar:Npn \doc_show_functions_defined: {
- \bool_if:nT { \g_doc_implementation_bool && \g_doc_checkfunc_bool } {
- \typeout{ ======================================== ^^J }
-
- \tl_clear:N \l_tmpa_tl
- \seq_map_inline:Nn \g_doc_functions_seq {
- \seq_if_in:NnT \g_doc_macros_seq {##1} {
- \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J }
- \iow_now:Nn \g_write_func_stream { ##1 }
- }
- }
- \iow_close:N \g_write_func_stream
- \doc_functions_typeout:n {
- Functions~both~documented~and~defined:^^J (In~order~of~being~documented)
- }
-
- \seq_map_inline:Nn \g_doc_functions_seq {
- \seq_if_in:NnF \g_doc_macros_seq {##1} {
- \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J }
- }
- }
- \doc_functions_typeout:n { Functions~documented~but~not~defined: }
-
- \seq_map_inline:Nn \g_doc_macros_seq {
- \seq_if_in:NnF \g_doc_functions_seq {##1} {
- \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J }
- }
- }
- \doc_functions_typeout:n { Functions~defined~but~not~documented: }
-
- \typeout{ ======================================== }
- }
-}
-\AtEndDocument{ \doc_show_functions_defined: }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set_nopar:Npn \doc_functions_typeout:n #1 {
- \tl_if_empty:NF \l_tmpa_tl {
- \typeout{
- -------------------------------------- ^^J #1 ^^J
- -------------------------------------- ^^J \l_tmpa_tl
- }
- \tl_clear:N \l_tmpa_tl
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new:Npn \doc_show_not_tested: {
- \bool_if:NT \g_doc_checktest_bool
- {
- \bool_if:nT { !(\seq_if_empty_p:N \g_doc_not_tested_seq) ||
- !(\prop_if_empty_p:N \g_doc_missing_tests_prop) }
- {
- \tl_clear:N \l_tmpa_tl
- \prop_if_empty:NF \g_doc_missing_tests_prop
- {
- \tl_put_right:Nn \l_tmpa_tl
- {
- ^^J^^JThe~ following~ macro(s)~ have~ incomplete~ tests:^^J
- }
- \prop_map_inline:Nn \g_doc_missing_tests_prop
- {
- \tl_put_right:Nn \l_tmpa_tl
- {^^J\space\space\space\space ##1
- ^^J\space\space\space\space\space\space ##2}
- }
- }
- \seq_if_empty:NF \g_doc_not_tested_seq
- {
- \tl_put_right:Nn \l_tmpa_tl
- {
- ^^J^^J
- The~ following~ macro(s)~ do~ not~ have~ any~ tests:^^J
- }
- \seq_map_inline:Nn \g_doc_not_tested_seq
- {
- \clist_map_inline:nn {##1}
- {
- \tl_put_right:Nn \l_tmpa_tl {^^J\space\space\space\space ####1}
- }
- }
- \int_set:Nn \l_tmpa_int {\etex_interactionmode:D}
- \errorstopmode
- \ClassError{l3doc}{\l_tmpa_tl}{}
- \int_set:Nn \etex_interactionmode:D {\l_tmpa_int}
- }
- }
- }
-}
-\AtEndDocument{ \doc_show_not_tested: }
-% \end{macrocode}
-%
-% \subsection{Indexing}
-%
-% Fix index (for now):
-% \begin{macrocode}
-\g@addto@macro\theindex{\MakePrivateLetters}
-\cs_set:Npn \verbatimchar {&}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\setcounter{IndexColumns}{2}
-% \end{macrocode}
-%
-% Set up the Index to use "\part"
-% \begin{macrocode}
-\IndexPrologue{
- \part*{Index}
- \markboth{Index}{Index}
- \addcontentsline{toc}{part}{Index}
- The~italic~numbers~denote~the~pages~where~the~
- corresponding~entry~is~described,~
- numbers~underlined~point~to~the~definition,~
- all~others~indicate~the~places~where~it~is~used.
-}
-% \end{macrocode}
-%
-%
-% \begin{macro}{\doc_special_main_index:n,\doc_special_main_index:o,\hdpgindex}
-% Heiko's replacement to play nicely with |hypdoc|:
-% \begin{macrocode}
-
-\cs_set_nopar:Npn \doc_special_main_index:n #1 {
- \index{
- \@gobble#1
- \actualchar
- \string\verb\quotechar*\verbatimchar#1\verbatimchar
- \encapchar
- hdpgindex{\thepage}{usage}
- }
-}
-\cs_set_nopar:Npn \doc_special_main_index:o { \exp_args:No \doc_special_main_index:n }
-% \end{macrocode}
-% \begin{macrocode}
-\cs_set_nopar:Npn \hdpgindex #1#2#3 {
- \csname\ifx\\#2\\relax\else#2\fi\endcsname{
- \hyperlink{page.#1}{#3}
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\g@addto@macro \PrintIndex { \AtEndDocument{ \typeout{^^J
- ========================================^^J
- Generate~the~index~by~executing^^J
- \c_space_tl \c_space_tl \c_space_tl \c_space_tl
- makeindex~-s~l3doc.ist~-o~\jobname.ind~\jobname.idx^^J
- ========================================^^J
- }}
-}
-% \end{macrocode}
-%
-% \subsection{Change history}
-%
-% Set the change history to use "\part".
-% Allow control names to be hyphenated in here...
-% \begin{macrocode}
-\GlossaryPrologue{
- \part*{Change~History}
- {\GlossaryParms\ttfamily\hyphenchar\font=`\-}
- \markboth{Change~History}{Change~History}
- \addcontentsline{toc}{part}{Change~History}
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\g@addto@macro \PrintChanges { \AtEndDocument{ \typeout{^^J
- ========================================^^J
- Generate~the~change~list~by~executing^^J
- \c_space_tl \c_space_tl \c_space_tl \c_space_tl
- makeindex~-s~gglo.ist~~-o~\jobname.gls~\jobname.glo^^J
- ========================================^^J
- }}
-}
-% \end{macrocode}
-%
-%^^A The standard \changes command modified slightly to better cope with
-%^^A this multiple file document.
-%^^A\def\changes@#1#2#3{%
-%^^A \let\protect\@unexpandable@protect
-%^^A \edef\@tempa{\noexpand\glossary{#2\space\currentfile\space#1\levelchar
-%^^A \ifx\saved@macroname\@empty
-%^^A \space
-%^^A \actualchar
-%^^A \generalname
-%^^A \else
-%^^A \expandafter\@gobble
-%^^A \saved@macroname
-%^^A \actualchar
-%^^A \string\verb\quotechar*%
-%^^A \verbatimchar\saved@macroname
-%^^A \verbatimchar
-%^^A \fi
-%^^A :\levelchar #3}}%
-%^^A \@tempa\endgroup\@esphack}
-%
-% \subsection{cfg}
-%
-% \begin{macrocode}
-\bool_if:NTF \g_doc_full_bool {
- \RecordChanges
- \CodelineIndex
- \EnableCrossrefs
- \AlsoImplementation
-}{
- \CodelineNumbered
- \DisableCrossrefs
- \OnlyDescription
-}
-% \end{macrocode}
-%
-%
-% \begin{macrocode}
-%</class>
-% \end{macrocode}
-%
-%
-% \subsection{Makeindex configuration}
-%
-% The makeindex style "l3doc.ist" is used in place of the usual
-% "gind.ist" to ensure that I is used in the sequence I J K
-% not I II II, which would be the default makeindex behaviour.
-%
-% Will: Do we need this?
-%
-% \begin{macrocode}
-%<*docist>
-actual '='
-quote '!'
-level '#'
-preamble
-"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
-postamble
-"\n\n \\end{theindex}\n"
-item_x1 "\\efill \n \\subitem "
-item_x2 "\\efill \n \\subsubitem "
-delim_0 "\\pfill "
-delim_1 "\\pfill "
-delim_2 "\\pfill "
-% The next lines will produce some warnings when
-% running Makeindex as they try to cover two different
-% versions of the program:
-lethead_prefix "{\\bfseries\\hfil "
-lethead_suffix "\\hfil}\\nopagebreak\n"
-lethead_flag 1
-heading_prefix "{\\bfseries\\hfil "
-heading_suffix "\\hfil}\\nopagebreak\n"
-headings_flag 1
-
-% and just for source3:
-% Remove R so I is treated in sequence I J K not I II III
-page_precedence "rnaA"
-%</docist>
-% \end{macrocode}
-%
-% \section{Testing}
-%\ExplSyntaxOn
-%\cs_set_eq:NN\g_saved_doc_functions_seq\g_doc_functions_seq
-%\cs_set_eq:NN\g_saved_doc_macros_seq\g_doc_macros_seq
-%\ExplSyntaxOff
-%
-% \begin{function}{\example_foo:N|\example_foo:c}
-% \begin{syntax}
-% "\example_foo:N" <arg1>
-% \end{syntax}
-% <0123456789> <\0\1\2\3\4\5\6\7\8\9> \Arg{arg1} ":("
-% \end{function}
-%
-% \begin{function}{ \foo | \foo: | \foo:x | \barrz: }
-% \begin{syntax}
-% "\example_foo:N" <arg1>
-% \end{syntax}
-% <0123456789> <\0\1\2\3\4\5\6\7\8\9>
-% \end{function}
-%
-% \begin{function}{\foo:N / (TF) | \foo_if:c / (TF) (EXP)}
-% Test.
-% \end{function}
-%
-% \begin{function}[EXP]{\fffoo:N}
-% Test.
-% \end{function}
-% \begin{function}[TF]{\ffffoo:N}
-% Test.
-% \end{function}
-% \begin{function}[pTF]{\ffoo:N}
-% Test.
-% \end{function}
-%
-% \begin{function}{ \bar / (EXP) | \bar: / (EXP) | \bar:x / (EXP) | }
-% \begin{syntax}
-% "\example_foo:N" <arg1>
-% \end{syntax}
-% <0123456789> <\0\1\2\3\4\5\6\7\8\9>
-% \end{function}
-%
-% \begin{macro}{ \foo , \foo: , \foo:x }
-% Testing.
-% \end{macro}
-%
-% \bigskip\bigskip
-%
-% \begin{macro}[aux]{ \foo_aux: }
-% Testing.
-% \end{macro}
-%
-% \bigskip\bigskip
-%
-% \begin{macro}[TF]{ \foo_if:c }
-% Testing.
-% \end{macro}
-%
-% \begin{macro}[internal]{ \foo_if:d }
-% Testing.
-% \end{macro}
-%
-% \bigskip\bigskip
-%
-% \begin{macro}{\aaaa_bbbb_cccc_dddd_eeee_ffff_gggg_hhhh}
-% Long macro names need to be printed in a shorter font.
-% \begin{macrocode}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\c_minus_one,
-% \c_zero,
-% \c_one,
-% \c_two,
-% \c_three,
-% \c_four,
-% \c_five,
-% \c_six,
-% \c_seven,
-% \c_eight,
-% \c_nine,
-% \c_ten,
-% \c_eleven,
-% \c_sixteen,
-% \c_thirty_two,
-% \c_hundred_one,
-% \c_twohundred_fifty_five,
-% \c_twohundred_fifty_six,
-% \c_thousand,
-% \c_ten_thousand,
-% \c_ten_thousand_one}
-% \begin{arguments}
-% \item name
-% \item parameters
-% \end{arguments}
-% Another test.
-% \end{macro}
-%
-%
-%\ExplSyntaxOn
-%\cs_set_eq:NN\g_doc_functions_seq\g_saved_doc_functions_seq
-%\cs_set_eq:NN\g_doc_macros_seq\g_saved_doc_macros_seq
-%\ExplSyntaxOff
-%
-%
-% \subsection{Macros}
-% \raggedright
-% \ExplSyntaxOn
-% \seq_map_inline:Nn \g_doc_macros_seq { `\texttt{#1}' \quad }
-% \ExplSyntaxOff
-%
-% \subsection{Functions}
-% \ExplSyntaxOn
-% \seq_map_inline:Nn \g_doc_functions_seq { `\texttt{#1}' \quad }
-% \ExplSyntaxOff
-%
-% \end{implementation}
-%
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3expan.dtx b/Master/texmf-dist/source/latex/expl3/l3expan.dtx
deleted file mode 100644
index 9055ca588df..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3expan.dtx
+++ /dev/null
@@ -1,1264 +0,0 @@
-% \iffalse
-%% File: l3expan.dtx Copyright (C) 1990-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3expan.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental Argument Expansion module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3expan.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \pkg{l3expan} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Controlling Expansion of Function Arguments}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \section{Brief overview}
-%
-% The functions in this module all have prefix |exp|.
-%
-% Not all possible variations are implemented for every base
-% function. Instead only those that are used within the \LaTeX3 kernel
-% or otherwise seem to be of general interest are implemented.
-% Consult the module description to find out which functions are
-% actually defined. The next section explains how to define missing
-% variants.
-%
-%
-% \section{Defining new variants}
-%
-% The definition of variant forms for base functions may be necessary
-% when writing new functions or when applying a kernel function in a
-% situation that we haven't thought of before.
-%
-% Internally preprocessing of arguments is done with functions from the
-% "\exp_" module. They all look alike, an example would be
-% "\exp_args:NNo". This function has three arguments, the first and the
-% second are a single tokens the third argument gets
-% expanded once. If "\seq_gpush:No" wouldn't be defined the example
-% above could be coded in the following way:
-% \begin{verbatim}
-% \exp_args:NNo\seq_gpush:Nn
-% \g_file_name_stack
-% \l_tmpa_tl
-% \end{verbatim}
-% In other words, the first argument to "\exp_args:NNo" is the base
-% function and the other arguments are preprocessed and then passed to
-% this base function. In the example the first argument to the base
-% function should be a single token which is left unchanged while the
-% second argument is expanded once. From this example we can also see
-% how the variants are defined. They just expand into the appropriate
-% "\exp_" function followed by the desired base function, e.g.
-% \begin{quote}
-% "\cs_new_nopar:Npn\seq_gpush:No{\exp_args:NNo\seq_gpush:Nn}"
-% \end{quote}
-% Providing variants in this way in style files is uncritical as the
-% "\cs_new_nopar:Npn" function will silently accept definitions whenever the
-% new definition is identical to an already given one. Therefore adding
-% such definition to later releases of the kernel will not make such
-% style files obsolete.
-%
-% The steps above may be automated by using the function
-% "\cs_generate_variant:Nn", described next.
-%
-% \subsection{Methods for defining variants}
-%
-%
-%\begin{function}{ \cs_generate_variant:Nn }
-% \begin{syntax}
-% \cs{cs_generate_variant:Nn} \meta{parent control sequence}
-% ~~\Arg{variant argument specifier}
-% \end{syntax}
-% The \meta{parent control sequence} is first separated into the
-% \meta{base name} and \meta{original} argument specifier. The
-% \meta{variant} is then used to modify this by replacing the beginning
-% of the \meta{original} with the \meta{variant}. Thus the \meta{variant}
-% must be no longer than the \meta{original} argument specifier. This
-% new specifier is used to create a modified function which will expand
-% its arguments as required. 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 \cs{foo:cn} which will expand its first
-% argument into a control sequence name and pass the result to
-% \cs{foo:Nn}. Similarly
-% \begin{verbatim}
-% \cs_generate_variant:Nn \foo:Nn { NV }
-% \cs_generate_variant:Nn \foo:Nn { cV }
-% \end{verbatim}
-% would generate the functions \cs{foo:NV} and \cs{foo:cV} in the
-% same way. \cs{cs_generate_variant:Nn} can only be applied if the
-% \meta{parent control sequence} is already defined. If the
-% \meta{parent control sequence} is protected then the new sequence
-% will also be protected. The variants are generated globally.
-%\end{function}
-%
-% \paragraph{Internal functions} \mbox{}
-%
-% \begin{function}{\cs_generate_internal_variant:n}
-% \begin{syntax}
-% "\cs_generate_internal_variant:n" \Arg{args}
-% \end{syntax}
-% Defines the appropriate "\exp_args:N"<args> function, if necessary,
-% to perform the expansion control specified by <args>.
-% \end{function}
-%
-% \section{Introducing the variants}
-%
-% The available internal functions for argument expansion come in two
-% flavours, some of them are faster then others. Therefore it is usually
-% best to follow the following guidelines when defining new functions
-% that are supposed to come with variant forms:
-% \begin{itemize}
-% \item
-% Arguments that might need expansion should come first in the list of
-% arguments to make processing faster.
-% \item
-% Arguments that should consist of single tokens should come first.
-% \item
-% Arguments that need full expansion (i.e., are denoted with "x")
-% should be avoided if possible as they can not be processed very fast.
-% \item
-% In general "n", "x", and "o" (if not in the last position) will
-% need special processing which is not fast and not expandable,
-% i.e., functions of this type may not work correctly in arguments
-% that are itself subject to "x" expansion. Therefore it is best to
-% use the ``expandable'' functions (i.e., those that contain only
-% "c", "N", "o" or "f" in the last position) whenever possible.
-% \end{itemize}
-%
-% The |V| type returns the value of a register, which can be one of
-% |tl|, |num|, |int|, |skip|, |dim|, |toks|, or built-in \TeX\
-% registers. The |v| type is the same except it first creates a
-% control sequence out of its argument before returning the
-% value. This recent addition to the argument specifiers may shake
-% things up a bit as most places where |o| is used will be replaced by
-% |V|. The documentation you are currently reading will therefore
-% require a fair bit of re-writing.
-%
-% In general, the programmer should not need to be concerned with
-% expansion control. When simply using the content of a variable,
-% functions with a "V" specifier should be used. For those referred to by
-% (cs)name, the "v" specifier is available for the same purpose. Only when
-% specific expansion steps are needed, such as when using delimited
-% arguments, should the lower-level functions with "o" specifiers be employed.
-%
-% The |f| type is so special that it deserves an example.
-% Let's pretend we want to set "\aaa" equal to the control sequence
-% stemming from turning "b \l_tmpa_tl b" into a control
-% sequence. Furthermore we want to store the execution of it in a
-% \m{toks} register. In this example we assume "\l_tmpa_tl" contains
-% the text string "lur". The straight forward approach is
-% \begin{quote}
-% "\toks_set:No \l_tmpa_toks {\cs_set_eq:Nc \aaa {b \l_tmpa_tl b}}"
-% \end{quote}
-% Unfortunately this only puts
-% "\exp_args:NNc \cs_set_eq:NN \aaa {b \l_tmpa_tl b}" into "\l_tmpa_toks"
-% and not "\cs_set_eq:NwN \aaa = \blurb" as we probably wanted. Using
-% "\toks_set:Nx" is not an option as that will die horribly. Instead
-% we can do a
-% \begin{quote}
-% "\toks_set:Nf \l_tmpa_toks {\cs_set_eq:Nc \aaa {b \l_tmpa_tl b}}"
-% \end{quote}
-% which puts the desired result in "\l_tmpa_toks". It requires
-% "\toks_set:Nf" to be defined as
-% \begin{quote}
-% "\cs_set_nopar:Npn \toks_set:Nf {\exp_args:NNf \toks_set:Nn}"
-% \end{quote}
-% If you use this type of expansion in conditional processing then
-% you should stick to using "TF" type functions only as it does not
-% try to finish any "\if... \fi:" itself!
-%
-%
-%
-%
-% \section{Manipulating the first argument}
-%
-% \begin{function}{ \exp_args:No / (EXP) }
-% \begin{syntax}
-% " \exp_args:No" <funct> <arg1> <arg2> "..."
-% \end{syntax}
-% The first argument of <funct> (i.e., <arg1>) is expanded once, the
-% result is surrounded by braces and passed to <funct>. <funct> may have
-% more than one argument---all others are passed unchanged.
-% \end{function}
-%
-% \begin{function}{ \exp_args:Nc / (EXP) | \exp_args:cc / (EXP) }
-% \begin{syntax}
-% " \exp_args:Nc" <funct> <arg1> <arg2> "..."
-% \end{syntax}
-% The first argument of <funct> (i.e., <arg1>) is expanded until only
-% characters remain. (An internal error occurs if something else is the
-% result of this expansion.) Then the result is turned into a control
-% sequence and passed to <funct> as the first argument. <funct> may have
-% more than one argument---all others are passed unchanged.
-%
-% In the ":cc" variant, the <funct> control sequence itself is constructed
-% (with the same process as described above) before <arg1> is turned into a
-% control sequence and passed as its argument.
-% \end{function}
-%
-% \begin{function}{ \exp_args:NV / (EXP) }
-% \begin{syntax}
-% " \exp_args:NV" <funct> <register>
-% \end{syntax}
-% The first argument of <funct> (i.e., <register>) is expanded to its
-% value. By value we mean a number stored in an |int| or |num|
-% register, the length value of a |dim|, |skip| or |muskip| register, the
-% contents of a |toks| register or the unexpanded contents of a |tl var.|
-% register. The value is passed onto <funct> in braces.
-% \end{function}
-%
-% \begin{function}{ \exp_args:Nv / (EXP) }
-% \begin{syntax}
-% " \exp_args:Nv" <funct> \Arg{register}
-% \end{syntax}
-% Like the |V| type except the register is given by a list of
-% characters from which a control sequence name is generated.
-% \end{function}
-%
-% \begin{function}{ \exp_args:Nx }
-% \begin{syntax}
-% " \exp_args:Nx" <funct> <arg1> <arg2> "..."
-% \end{syntax}
-% The first argument of <funct> (i.e., <arg1>) is fully expanded until
-% only unexpandable tokens remain, the result is surrounded by braces
-% and passed to <funct>. <funct> may have more than one argument---all
-% others are passed unchanged.
-% As mentioned before, this type of function is relatively slow.
-% \end{function}
-%
-% \begin{function}{ \exp_args:Nf / (EXP) }
-% \begin{syntax}
-% " \exp_args:Nf" <funct> <arg1> <arg2> "..."
-% \end{syntax}
-% The first argument of <funct> (i.e., <arg1>) undergoes full
-% expansion until the first unexpandable token is encountered, the
-% result is surrounded by braces and passed to <funct>. <funct> may
-% have more than one argument---all others are passed unchanged.
-% Beware of its special behavior as explained above.
-% \end{function}
-%
-% \section{Manipulating two arguments}
-%
-% \begin{function}{%
-% \exp_args:NNx |
-% \exp_args:Nnx |
-% \exp_args:Ncx |
-% \exp_args:Nox |
-% \exp_args:Nxo |
-% \exp_args:Nxx |
-% }
-% \begin{syntax}
-% "\exp_args:Nnx" <funct> <arg1> <arg2> "..."
-% \end{syntax}
-% The above functions all manipulate the first two arguments of <funct>.
-% They are all slow and non-expandable.
-% \end{function}
-%
-% \begin{function}{%
-% \exp_args:NNo / (EXP) |
-% \exp_args:NNc / (EXP) |
-% \exp_args:NNv / (EXP) |
-% \exp_args:NNV / (EXP) |
-% \exp_args:NNf / (EXP) |
-% \exp_args:Nno / (EXP) |
-% \exp_args:NnV / (EXP) |
-% \exp_args:Nnf / (EXP) |
-% \exp_args:Noo / (EXP) |
-% \exp_args:Noc / (EXP) |
-% \exp_args:Nco / (EXP) |
-% \exp_args:Ncf / (EXP) |
-% \exp_args:Ncc / (EXP) |
-% \exp_args:Nff / (EXP) |
-% \exp_args:Nfo / (EXP) |
-% \exp_args:NVV / (EXP) |
-% }
-% \begin{syntax}
-% "\exp_args:NNo" <funct> <arg1> <arg2> "..."
-% \end{syntax}
-% These are the fast and expandable functions for the first two arguments.
-% \end{function}
-%
-% \section{Manipulating three arguments}
-%
-% So far not all possible functions are provided and even the selection
-% below may be reduced in the future as far as the non-expandable
-% functions are concerned.
-%
-% \begin{function}{%
-% \exp_args:NNnx |
-% \exp_args:NNox |
-% \exp_args:Nnnx |
-% \exp_args:Nnox |
-% \exp_args:Noox |
-% \exp_args:Ncnx |
-% \exp_args:Nccx |
-% }
-% \begin{syntax}
-% "\exp_args:Nnnx" <funct> <arg1> <arg2> <arg3> "..."
-% \end{syntax}
-% All the above functions are non-expandable.
-% \end{function}
-%
-% \begin{function}{%
-% \exp_args:NNNo / (EXP) |
-% \exp_args:NNNV / (EXP) |
-% \exp_args:NNoo / (EXP) |
-% \exp_args:NNno / (EXP) |
-% \exp_args:Nnno / (EXP) |
-% \exp_args:Nnnc / (EXP) |
-% \exp_args:Nooo / (EXP) |
-% \exp_args:Nccc / (EXP) |
-% \exp_args:NcNc / (EXP) |
-% \exp_args:NcNo / (EXP) |
-% \exp_args:Ncco / (EXP) |
-% }
-% \begin{syntax}
-% "\exp_args:NNoo" <funct> <arg1> <arg2> <arg3> "..."
-% \end{syntax}
-% These are the fast and expandable functions for the first three
-% arguments.
-% \end{function}
-%
-% \section{Preventing expansion}
-%
-% \begin{function}{\exp_not:N |
-% \exp_not:c |
-% \exp_not:n }
-% \begin{syntax}
-% "\exp_not:N" <token>
-% "\exp_not:n" \Arg{token list}
-% \end{syntax}
-% This function will prohibit the expansion of <token> in situation
-% where <token> would otherwise be replaced by it definition, e.g.,
-% inside an argument that is handled by the "x" convention.
-% \begin{texnote}
-% "\exp_not:N" is the primitive \tn{noexpand} renamed and "\exp_not:n"
-% is the \eTeX{} primitive \tn{unexpanded}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\exp_not:o |
-% \exp_not:f }
-% \begin{syntax}
-% "\exp_not:o" \Arg{token list}
-% \end{syntax}
-% Same as "\exp_not:n" except <token list> is expanded once for the
-% "o" type and for the "f" type the token list is expanded until an
-% unexpandable token is found, and the result of these expansions is then
-% prohibited from being expanded further.
-% \end{function}
-%
-% \begin{function}{\exp_not:V |
-% \exp_not:v }
-% \begin{syntax}
-% "\exp_not:V" <register>
-% "\exp_not:v" \Arg{token list}
-% \end{syntax}
-% The value of <register> is retrieved and then passed on to
-% "\exp_not:n" which will prohibit further expansion. The |v| type
-% first creates a control sequence from <token list> but is otherwise
-% identical to |V|.
-% \end{function}
-%
-% \begin{function}{\exp_stop_f:}
-% \begin{syntax}
-% <f expansion> ... "\exp_stop_f:"
-% \end{syntax}
-% This function stops an "f" type expansion. An example use is one such as
-% \begin{verbatim}
-% \tl_set:Nf \l_tmpa_tl {
-% \if_case:w \l_tmpa_int
-% \or: \use_i_after_orelse:nw {\exp_stop_f: \textbullet}
-% \or: \use_i_after_orelse:nw {\exp_stop_f: \textendash}
-% \else: \use_i_after_fi:nw {\exp_stop_f: else-item}
-% \fi:
-% }
-% \end{verbatim}
-% This ensures the expansion in stopped right after finishing the
-% conditional but without expanding "\textbullet" etc.
-% \begin{texnote}
-% This function is a space token but it is better to distinguish
-% this expansion stopping token from a desired space token when
-% writing code.
-% \end{texnote}
-% \end{function}
-%
-% \section{Unbraced expansion}
-%
-% \begin{function}{
-% \exp_last_unbraced:Nf|
-% \exp_last_unbraced:NV|
-% \exp_last_unbraced:No|
-% \exp_last_unbraced:Nv|
-% \exp_last_unbraced:NcV|
-% \exp_last_unbraced:NNV|
-% \exp_last_unbraced:NNo|
-% \exp_last_unbraced:NNNV|
-% \exp_last_unbraced:NNNo|
-% }
-% \begin{syntax}
-% "\exp_last_unbraced:NV" <token> <variable name>
-% \end{syntax}
-% There are a small number of occasions where the last argument
-% in an expansion run must be expanded unbraced. These functions
-% should only be used inside functions, \emph{not} for creating
-% variants.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3expan} implementation}
-%
-% \subsection{Internal functions and variables}
-%
-% \begin{function}{\exp_after:wN}
-% \begin{syntax}
-% "\exp_after:wN" <token1> <token2>
-% \end{syntax}
-% This will expand <token2> once before processing <token1>. This is
-% similar to "\exp_args:No" except that no braces are put around the
-% result of expanding <token2>.
-% \begin{texnote}
-% This is the primitive \tn{expandafter} which was renamed to fit into
-% the naming conventions of \LaTeX3.
-% \end{texnote}
-% \end{function}
-%
-% \begin{variable}{\l_exp_tl}
-% \begin{syntax}\end{syntax}
-% The "\exp_" module has its private variables to temporarily store
-% results of the argument expansion. This is done to avoid interference
-% with other functions using temporary variables.
-% \end{variable}
-%
-% \begin{function}{ \exp_eval_register:N / (EXP) |
-% \exp_eval_register:c / (EXP) }
-% \begin{syntax}
-% "\exp_eval_register:N" <register>
-% \end{syntax}
-% These functions evaluates a register as part of a "V" or "v" expansion
-% (respectively). A register might exist as
-% one of two things: A parameter-less non-long, non-protected macro
-% or a built-in \TeX\ register such as |\count|.
-% \end{function}
-%
-% \begin{function}{\exp_eval_error_msg:w}
-% \begin{syntax}
-% "\exp_eval_error_msg:w" <register>
-% \end{syntax}
-% Used to generate an error message if a variable called as part of a
-% "v" or "V" expansion is defined as \cs{scan_stop:}. This typically
-% indicates that an incorrect cs name has been used.
-% \end{function}
-%
-% \begin{function}{\::n|\::N|\::c|\::o|\::f|\::x|\::v|\::V|\:::}
-% \begin{syntax}
-% "\cs_set_nopar:Npn \exp_args:Ncof {\::c\::o\::f\:::}"
-% \end{syntax}
-% Internal forms for the base expansion types.
-% \end{function}
-%
-% \subsection{Module code}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macro}{\exp_after:wN}
-% \begin{macro}{\exp_not:N}
-% \begin{macro}{\exp_not:n}
-% These are defined in \pkg{l3basics}.
-% \begin{macrocode}
-%<*bootstrap>
-\cs_set_eq:NwN \exp_after:wN \tex_expandafter:D
-\cs_set_eq:NwN \exp_not:N \tex_noexpand:D
-\cs_set_eq:NwN \exp_not:n \etex_unexpanded:D
-%</bootstrap>
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{General expansion}
-%
-% In this section a general mechanism for defining functions to handle
-% argument handling is defined. These general expansion functions are
-% expandable unless |x| is used. (Any version of |x| is going to have
-% to use one of the \LaTeX3\ names for |\cs_set_nopar:Npx| at some point, and
-% so is never going to be expandable.\footnote{However, some
-% primitives have certain characteristics that means that their
-% arguments undergo an \texttt{x} type expansion but the primitive
-% is in fact still expandable. We shall make it very clear when such
-% a function is expandable.})
-%
-% The definition of expansion functions with this technique happens
-% in section~\ref{sec:gendef}.
-% In section~\ref{sec:handtune} some common cases are coded by a more direct
-% method for efficiency, typically using calls to |\exp_after:wN|.
-%
-% \begin{macro}{\l_exp_tl}
-% We need a scratch token list variable.
-% We don't use "tl" methods so that \pkg{l3expan} can be loaded earlier.
-% \begin{macrocode}
-\cs_new_nopar:Npn \l_exp_tl {}
-% \end{macrocode}
-% \end{macro}
-%
-% This code uses internal functions with names that start with |\::|
-% to perform the expansions. All macros are |long| as this turned out
-% to be desirable since the tokens undergoing expansion may be
-% arbitrary user input.
-%
-% An argument manipulator |\::|\meta{Z} always has signature |#1\:::#2#3|
-% where |#1| holds the remaining argument manipulations to be performed,
-% |\:::| serves as an end marker for the list of manipulations, |#2|
-% is the carried over result of the previous expansion steps and |#3| is
-% the argument about to be processed.
-%
-% \begin{macro}[aux]{\exp_arg_next:nnn}
-% \begin{macro}[aux]{\exp_arg_next_nobrace:nnn}
-% |#1| is the result of an expansion step, |#2| is the remaining
-% argument manipulations and |#3| is the current result of the
-% expansion chain. This auxilliary 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
-% 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
-% require a set of braces.
-% \begin{macrocode}
-\cs_new:Npn\exp_arg_next:nnn#1#2#3{
- #2\:::{#3{#1}}
-}
-\cs_new:Npn\exp_arg_next_nobrace:nnn#1#2#3{
- #2\:::{#3#1}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\:::}
-% The end marker is just another name for the identity function.
-% \begin{macrocode}
-\cs_new:Npn\:::#1{#1}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\::n}
-% This function is used to skip an argument that doesn't need to
-% be expanded.
-% \begin{macrocode}
-\cs_new:Npn\::n#1\:::#2#3{
- #1\:::{#2{#3}}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\::N}
-% This function is used to skip an argument that consists of a
-% single token and doesn't need to be expanded.
-% \begin{macrocode}
-\cs_new:Npn\::N#1\:::#2#3{
- #1\:::{#2#3}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\::c}
-% This function is used to skip an argument that is turned into
-% as control sequence without expansion.
-% \begin{macrocode}
-\cs_new:Npn\::c#1\:::#2#3{
- \exp_after:wN\exp_arg_next_nobrace:nnn\cs:w #3\cs_end:{#1}{#2}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\::o}
-% This function is used to expand an argument once.
-% \begin{macrocode}
-\cs_new:Npn\::o#1\:::#2#3{
- \exp_after:wN\exp_arg_next:nnn\exp_after:wN{#3}{#1}{#2}
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\::f}
-% \begin{macro}{\exp_stop_f:}
-% This function is used to expand a token list until the first
-% unexpandable token is found. The underlying "\tex_romannumeral:D -`0"
-% expands everything in its way to find something terminating the
-% number and thereby expands the function in front of it. This
-% scanning procedure is terminated once the expansion hits
-% something non-expandable or a space. We introduce "\exp_stop_f:"
-% to mark such an end of expansion marker; in case the scanner hits
-% a number, this number also terminates the scanning and is left
-% untouched. In the example shown earlier the scanning was stopped
-% once \TeX{} had fully expanded "\cs_set_eq:Nc \aaa {b \l_tmpa_tl b}"
-% into "\cs_set_eq:NwN \aaa = \blurb" which then turned out to contain
-% the non-expandable token "\cs_set_eq:NwN". Since the expansion of
-% "\tex_romannumeral:D -`0" is \m{null}, we wind up with a fully
-% expanded list, only \TeX{} has not tried to execute any of the
-% non-expandable tokens. This is what differentiates this function
-% from the "x" argument type.
-% \begin{macrocode}
-\cs_new:Npn\::f#1\:::#2#3{
- \exp_after:wN\exp_arg_next:nnn
- \exp_after:wN{\tex_romannumeral:D -`0 #3}
- {#1}{#2}
-}
-\cs_new_nopar:Npn \exp_stop_f: {~}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\::x}
-% This function is used to expand an argument fully.
-% We could use the new expandable primitive "\expanded" here, but we
-% don't want to create incompatibilities between engines.
-% \begin{macrocode}
- \cs_new_protected:Npn \::x #1 \::: #2#3 {
- \cs_set_nopar:Npx \l_exp_tl {{#3}}
- \exp_after:wN \exp_arg_next:nnn \l_exp_tl {#1}{#2}
- }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\::v}
-% \begin{macro}{\::V}
-% These functions return the value of a register, i.e., one of
-% |tl|, |num|, |int|, |skip|, |dim| and |muskip|. The |V| version
-% 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 sequence |\tex_romannumeral:D -`0| sets off an |f| type
-% expansion. The argument is returned in braces.
-% \begin{macrocode}
-\cs_new:Npn \::V#1\:::#2#3{
- \exp_after:wN\exp_arg_next:nnn
- \exp_after:wN{
- \tex_romannumeral:D -`0
- \exp_eval_register:N #3
- }
- {#1}{#2}
-}
-\cs_new:Npn \::v#1\:::#2#3{
- \exp_after:wN\exp_arg_next:nnn
- \exp_after:wN{
- \tex_romannumeral:D -`0
- \exp_eval_register:c {#3}
- }
- {#1}{#2}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\exp_eval_register:N,\exp_eval_register:c}
-% \begin{macro}{\exp_eval_error_msg:w}
-% This function evaluates a register. Now a register might exist as
-% one of two things: A parameter-less macro or a built-in \TeX\
-% register such as |\count|. For the \TeX\ registers we have to
-% utilize a |\tex_the:D| whereas for the macros we merely have to
-% expand them once. The trick is to find out when to use
-% |\tex_the:D| and when not to. What we do here is try to find out
-% whether the token will expand to something else when hit with
-% |\exp_after:wN|. The technique is to compare the meaning of the
-% register in question when it has been prefixed with |\exp_not:N|
-% and the register itself. If it is a macro, the prefixed
-% |\exp_not:N| will temporarily turn it into the primitive
-% |\tex_relax:D|.
-% \begin{macrocode}
-\cs_set_nopar:Npn \exp_eval_register:N #1{
- \exp_after:wN \if_meaning:w \exp_not:N #1#1
-% \end{macrocode}
-% If the token was not a macro it may be a malformed variable from a
-% |c| expansion in which case it is equal to the primitive
-% |\tex_relax:D|. In that case we throw an error. We could let \TeX\
-% do it for us but that would result in the rather obscure
-% \begin{quote}
-% |! You can't use `\relax' after \the.|
-% \end{quote}
-% which while quite true doesn't give many hints as to what actually
-% went wrong. We provide something more sensible.
-% \begin{macrocode}
- \if_meaning:w \tex_relax:D #1
- \exp_eval_error_msg:w
- \fi:
-% \end{macrocode}
-% The next bit requires some explanation. The function must be
-% initiated by the sequence |\tex_romannumeral:D -`0| and we want to
-% terminate this expansion chain by inserting an |\exp_stop_f:|
-% token. However, we have to expand the register |#1| before we do
-% that. If it is a \TeX\ register, we need to execute the sequence
-% |\exp_after:wN\exp_stop_f:\tex_the:D #1| and if it is a macro we
-% need to execute |\exp_after:wN\exp_stop_f: #1|. We therefore issue
-% the longer of the two sequences and if the register is a macro, we
-% remove the |\tex_the:D|.
-% \begin{macrocode}
- \else:
- \exp_after:wN \use_i_ii:nnn
- \fi:
- \exp_after:wN \exp_stop_f: \tex_the:D #1
-}
-\cs_set_nopar:Npn \exp_eval_register:c #1{
- \exp_after:wN\exp_eval_register:N\cs:w #1\cs_end:
-}
-% \end{macrocode}
-% Clean up nicely, then call the undefined control sequence. The
-% result is an error message looking like this:
-% \begin{verbatim}
-% ! Undefined control sequence.
-% \exp_eval_error_msg:w ...erroneous variable used!
-%
-% l.55 \tl_set:Nv \l_tmpa_tl {undefined_tl}
-% \end{verbatim}
-% \begin{macrocode}
-\group_begin:%
-\tex_catcode:D`\!=11\tex_relax:D%
-\tex_catcode:D`\ =11\tex_relax:D%
-\cs_gset:Npn\exp_eval_error_msg:w#1\tex_the:D#2{%
-\fi:\fi:\erroneous variable used!}%
-\group_end:%
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Hand-tuned definitions}
-% \label{sec:handtune}
-%
-% One of the most important features of these functions is that they
-% are fully expandable and therefore allow to prefix them with
-% |\pref_global:D| for example. This together with the fact that the
-% `general' concept above is slower means that we should convert
-% whenever possible and perhaps remove all remaining occurences by
-% hand-encoding in the end.
-%
-% \begin{macro}{\exp_args:No}
-% \begin{macro}{\exp_args:NNo}
-% \begin{macro}{\exp_args:NNNo}
-% \begin{macrocode}
-\cs_new:Npn \exp_args:No #1#2{\exp_after:wN#1\exp_after:wN{#2}}
-\cs_new:Npn \exp_args:NNo #1#2#3{\exp_after:wN#1\exp_after:wN#2
- \exp_after:wN{#3}}
-\cs_new:Npn \exp_args:NNNo #1#2#3#4{\exp_after:wN#1\exp_after:wN#2
- \exp_after:wN#3\exp_after:wN{#4}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\exp_args:Nc,\exp_args:cc,\exp_args:NNc,\exp_args:Ncc,\exp_args:Nccc}
-% Here are the functions that turn their argument into csnames but
-% are expandable.
-% \begin{macrocode}
-\cs_set:Npn \exp_args:Nc #1#2{\exp_after:wN#1\cs:w#2\cs_end:}
-\cs_new:Npn \exp_args:cc #1#2{\cs:w #1\exp_after:wN\cs_end:\cs:w #2\cs_end:}
-\cs_new:Npn \exp_args:NNc #1#2#3{\exp_after:wN#1\exp_after:wN#2
- \cs:w#3\cs_end:}
-\cs_new:Npn \exp_args:Ncc #1#2#3{\exp_after:wN#1
- \cs:w#2\exp_after:wN\cs_end:\cs:w#3\cs_end:}
-\cs_new:Npn \exp_args:Nccc #1#2#3#4{\exp_after:wN#1
- \cs:w#2\exp_after:wN\cs_end:\cs:w#3\exp_after:wN
- \cs_end:\cs:w #4\cs_end:}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\exp_args:Nco}
-% If we force that the third argument
-% always has braces, we could implement this function
-% with less tokens and only two arguments.
-% \begin{macrocode}
-\cs_new:Npn \exp_args:Nco #1#2#3{\exp_after:wN#1\cs:w#2\exp_after:wN
- \cs_end:\exp_after:wN{#3}}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Definitions with the `general' technique}
-% \label{sec:gendef}
-%
-% \begin{macro}{\exp_args:Nf,\exp_args:NV,\exp_args:Nv,\exp_args:Nx}
-% \begin{macrocode}
-\cs_set_nopar:Npn \exp_args:Nf {\::f\:::}
-\cs_set_nopar:Npn \exp_args:Nv {\::v\:::}
-\cs_set_nopar:Npn \exp_args:NV {\::V\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nx {\::x\:::}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\exp_args:NNV,\exp_args:NNv,\exp_args:NNf,\exp_args:NNx,
-% \exp_args:NVV,
-% \exp_args:Ncx,
-% \exp_args:Nfo,\exp_args:Nff,
-% \exp_args:Ncf,\exp_args:Nco,
-% \exp_args:Nnf,\exp_args:Nno,\exp_args:NnV,\exp_args:Nnx,
-% \exp_args:Noo,\exp_args:Noc,\exp_args:Nox,
-% \exp_args:Nxo,\exp_args:Nxx}
-% Here are the actual function definitions, using the helper functions
-% above.
-% \begin{macrocode}
-\cs_set_nopar:Npn \exp_args:NNf {\::N\::f\:::}
-\cs_set_nopar:Npn \exp_args:NNv {\::N\::v\:::}
-\cs_set_nopar:Npn \exp_args:NNV {\::N\::V\:::}
-\cs_set_protected_nopar:Npn \exp_args:NNx {\::N\::x\:::}
-
-\cs_set_protected_nopar:Npn \exp_args:Ncx {\::c\::x\:::}
-\cs_set_nopar:Npn \exp_args:Nfo {\::f\::o\:::}
-\cs_set_nopar:Npn \exp_args:Nff {\::f\::f\:::}
-\cs_set_nopar:Npn \exp_args:Ncf {\::c\::f\:::}
-\cs_set_nopar:Npn \exp_args:Nnf {\::n\::f\:::}
-\cs_set_nopar:Npn \exp_args:Nno {\::n\::o\:::}
-\cs_set_nopar:Npn \exp_args:NnV {\::n\::V\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nnx {\::n\::x\:::}
-
-\cs_set_nopar:Npn \exp_args:Noc {\::o\::c\:::}
-\cs_set_nopar:Npn \exp_args:Noo {\::o\::o\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nox {\::o\::x\:::}
-
-\cs_set_nopar:Npn \exp_args:NVV {\::V\::V\:::}
-
-\cs_set_protected_nopar:Npn \exp_args:Nxo {\::x\::o\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nxx {\::x\::x\:::}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\exp_args:Ncco,
-% \exp_args:Nccx,
-% \exp_args:Ncnx,
-% \exp_args:NcNc,
-% \exp_args:NcNo,
-% \exp_args:NNno,
-% \exp_args:NNNV,
-% \exp_args:Nnno,
-% \exp_args:Nnnx,
-% \exp_args:Nnox,
-% \exp_args:Nooo,
-% \exp_args:Noox,
-% \exp_args:Nnnc,
-% \exp_args:NNnx,
-% \exp_args:NNoo,
-% \exp_args:NNox}
-% \begin{macrocode}
-\cs_set_nopar:Npn \exp_args:NNNV {\::N\::N\::V\:::}
-
-\cs_set_nopar:Npn \exp_args:NNno {\::N\::n\::o\:::}
-\cs_set_protected_nopar:Npn \exp_args:NNnx {\::N\::n\::x\:::}
-\cs_set_nopar:Npn \exp_args:NNoo {\::N\::o\::o\:::}
-\cs_set_protected_nopar:Npn \exp_args:NNox {\::N\::o\::x\:::}
-
-\cs_set_nopar:Npn \exp_args:Nnnc {\::n\::n\::c\:::}
-\cs_set_nopar:Npn \exp_args:Nnno {\::n\::n\::o\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nnnx {\::n\::n\::x\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nnox {\::n\::o\::x\:::}
-
-\cs_set_nopar:Npn \exp_args:NcNc {\::c\::N\::c\:::}
-\cs_set_nopar:Npn \exp_args:NcNo {\::c\::N\::o\:::}
-\cs_set_nopar:Npn \exp_args:Ncco {\::c\::c\::o\:::}
-\cs_set_nopar:Npn \exp_args:Ncco {\::c\::c\::o\:::}
-\cs_set_protected_nopar:Npn \exp_args:Nccx {\::c\::c\::x\:::}
-\cs_set_protected_nopar:Npn \exp_args:Ncnx {\::c\::n\::x\:::}
-
-\cs_set_protected_nopar:Npn \exp_args:Noox {\::o\::o\::x\:::}
-\cs_set_nopar:Npn \exp_args:Nooo {\::o\::o\::o\:::}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsection{Preventing expansion}
-%
-%
-% \begin{macro}{\exp_not:o}
-% \begin{macro}{\exp_not:f}
-% \begin{macro}{\exp_not:v}
-% \begin{macro}{\exp_not:V}
-% \begin{macrocode}
-\cs_new:Npn\exp_not:o#1{\exp_not:n\exp_after:wN{#1}}
-\cs_new:Npn\exp_not:f#1{
- \exp_not:n\exp_after:wN{\tex_romannumeral:D -`0 #1}
-}
-\cs_new:Npn\exp_not:v#1{
- \exp_not:n\exp_after:wN{\tex_romannumeral:D -`0 \exp_eval_register:c {#1}}
-}
-\cs_new:Npn\exp_not:V#1{
- \exp_not:n\exp_after:wN{\tex_romannumeral:D -`0 \exp_eval_register:N #1}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\exp_not:c}
-% A helper function.
-% \begin{macrocode}
-\cs_new:Npn\exp_not:c#1{\exp_after:wN\exp_not:N\cs:w#1\cs_end:}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \subsection{Defining function variants}
-%
-%
-% \begin{macro}{\cs_generate_variant:Nn}
-% \begin{macro}[aux]{\cs_generate_variant_aux:nnNn}
-% \begin{macro}[aux]{\cs_generate_variant_aux:nnw}
-% \begin{macro}[aux]{\cs_generate_variant_aux:N}
-% \begin{arguments}
-% \item Base form of a function; e.g., "\tl_set:Nn"
-% \item One or more variant argument specifiers; e.g., "{Nx,c,cx}"
-% \end{arguments}
-% Split up the original base function to grab its name and signature
-% consisting of $k$ letters. Then we wish to iterate through the list
-% of variant argument specifiers, and for each one construct a new
-% function name using the original base name, the variant signature
-% consisting of $l$ letters and the last $k-l$ letters of the base
-% signature. For example, for a base function "\tl_set:Nn" which
-% needs a "c" variant form, we want the new signature to be "cn".
-% \begin{macrocode}
-\cs_new_protected:Npn \cs_generate_variant:Nn #1 {
- \chk_if_exist_cs:N #1
- \cs_split_function:NN #1 \cs_generate_variant_aux:nnNn
-}
-% \end{macrocode}
-% We discard the boolean and then set off a loop through the desired
-% variant forms.
-% \begin{macrocode}
-\cs_set:Npn \cs_generate_variant_aux:nnNn #1#2#3#4{
- \cs_generate_variant_aux:nnw {#1}{#2} #4,?,\q_recursion_stop
-}
-% \end{macrocode}
-% Next is the real work to be done. We now have 1: base name, 2: base
-% signature, 3: beginning of variant signature. To construct the new
-% csname and the "\exp_args:Ncc" form, we need the variant signature.
-% In our example, we wanted to discard the first two letters of the
-% base signature because the variant form started with "cc". This is
-% the same as putting first "cc" in the signature and then
-% "\use_none:nn" followed by the base signature "NNn". We therefore
-% call a small loop that outputs an "n" for each letter in the variant
-% signature and use this to call the correct "\use_none:" variant.
-% Firstly though, we check whether to terminate the loop.
-% \begin{macrocode}
-\cs_set:Npn \cs_generate_variant_aux:nnw #1 #2 #3, {
- \if:w ? #3
- \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
- \fi:
-% \end{macrocode}
-% Then check if the variant form has already been defined.
-% \begin{macrocode}
- \cs_if_free:cTF {
- #1:#3\use:c {use_none:\cs_generate_variant_aux:N #3 ?}#2
- }
- {
-% \end{macrocode}
-% If not, then define it and then additionally check if
-% the |\exp_args:N| form needed is defined.
-% \begin{macrocode}
- \_cs_generate_variant_aux:ccpx { #1 : #2 }
- {
- #1:#3 \use:c{use_none:\cs_generate_variant_aux:N #3 ?}#2
- }
- {
- \exp_not:c { exp_args:N #3} \exp_not:c {#1:#2}
- }
- \cs_generate_internal_variant:n {#3}
- }
-% \end{macrocode}
-% Otherwise tell that it was already defined.
-% \begin{macrocode}
- {
- \iow_log:x{
- Variant~\token_to_str:c {
- #1:#3\use:c {use_none:\cs_generate_variant_aux:N #3 ?}#2
- }~already~defined;~ not~ changing~ it~on~line~
- \tex_the:D \tex_inputlineno:D
- }
- }
-% \end{macrocode}
-% Recurse.
-% \begin{macrocode}
- \cs_generate_variant_aux:nnw{#1}{#2}
-}
-% \end{macrocode}
-% The small loop for defining the required number of "n"s. Break when
-% seeing a "?".
-% \begin{macrocode}
-\cs_set:Npn \cs_generate_variant_aux:N #1{
- \if:w ?#1 \exp_after:wN\use_none:nn \fi: n \cs_generate_variant_aux:N
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}[aux]{\_cs_generate_variant_aux:Ncpx}
-%\begin{macro}[aux]{\_cs_generate_variant_aux:ccpx}
-%\begin{macro}[aux]{\_cs_generate_variant_aux:w}
-% The idea here is to pick up protected parent functions, using the
-% nature of the meaning string that they generate. The test here is
-% almost the same as \cs{tl_if_empty:nTF}, but has to be hard-coded as
-% that function is not yet available and because it has to match both
-% long and short macros.
-% \begin{macrocode}
-\group_begin:
- \tex_lccode:D `\Z = `\d \scan_stop:
- \tex_lccode:D `\? =`\\ \scan_stop:
- \tex_catcode:D `\P = 12 \scan_stop:
- \tex_catcode:D `\R = 12 \scan_stop:
- \tex_catcode:D `\O = 12 \scan_stop:
- \tex_catcode:D `\T = 12 \scan_stop:
- \tex_catcode:D `\E = 12 \scan_stop:
- \tex_catcode:D `\C = 12 \scan_stop:
- \tex_catcode:D `\Z = 12 \scan_stop:
-\tex_lowercase:D {
- \group_end:
- \cs_new_nopar:Npn \_cs_generate_variant_aux:Ncpx #1
- {
- \exp_after:wN \_cs_generate_variant_aux:w
- \tex_meaning:D #1 ? PROTECTEZ \q_stop
- }
- \cs_new_nopar:Npn \_cs_generate_variant_aux:ccpx
- { \exp_args:Nc \_cs_generate_variant_aux:Ncpx}
- \cs_new:Npn \_cs_generate_variant_aux:w
- #1 ? PROTECTEZ #2 \q_stop
- {
- \exp_after:wN \tex_ifx:D \exp_after:wN
- \q_no_value \etex_detokenize:D {#1} \q_no_value
- \exp_after:wN \cs_new_protected_nopar:cpx
- \tex_else:D
- \exp_after:wN \cs_new_nopar:cpx
- \tex_fi:D
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-% \begin{macro}{\cs_generate_internal_variant:n}
-% Test if |exp_args:N #1| is already defined
-% and if not define it via the
-% |\::| commands using the chars in |#1|
-% \begin{macrocode}
-\cs_new_protected:Npn \cs_generate_internal_variant:n #1 {
- \cs_if_free:cT { exp_args:N #1 }{
-% \end{macrocode}
-% We use "new" to log the definition if we have to make one.
-% \begin{macrocode}
- \cs_new:cpx { exp_args:N #1 }
- { \cs_generate_internal_variant_aux:n #1 : }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[aux]{\cs_generate_internal_variant_aux:n}
-% This command grabs char by char outputting |\::#1| (not expanded
-% further) until we see a |:|. That colon is in fact also turned into
-% |\:::| so that the required structure for |\exp_args...| commands
-% is correctly terminated.
-% \begin{macrocode}
-\cs_new:Npn \cs_generate_internal_variant_aux:n #1 {
- \exp_not:c{::#1}
- \if_meaning:w #1 :
- \exp_after:wN \use_none:n
- \fi:
- \cs_generate_internal_variant_aux:n
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Last-unbraced versions}
-%
-%\begin{macro}[aux]{\exp_arg_last_unbraced:nn}
-%\begin{macro}[aux]{\::f_unbraced}
-%\begin{macro}[aux]{\::o_unbraced}
-%\begin{macro}[aux]{\::V_unbraced}
-%\begin{macro}[aux]{\::v_unbraced}
-% There are a few places where the last argument needs to be available
-% unbraced. First some helper macros.
-% \begin{macrocode}
-\cs_new:Npn \exp_arg_last_unbraced:nn #1#2 { #2#1 }
-\cs_new:Npn \::f_unbraced \:::#1#2 {
- \exp_after:wN \exp_arg_last_unbraced:nn
- \exp_after:wN { \tex_romannumeral:D -`0 #2 } {#1}
-}
-\cs_new:Npn \::o_unbraced \:::#1#2 {
- \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN {#2 }{#1}
-}
-\cs_new:Npn \::V_unbraced \:::#1#2 {
- \exp_after:wN \exp_arg_last_unbraced:nn
- \exp_after:wN { \tex_romannumeral:D -`0 \exp_eval_register:N #2 } {#1}
-}
-\cs_new:Npn \::v_unbraced \:::#1#2 {
- \exp_after:wN \exp_arg_last_unbraced:nn
- \exp_after:wN {
- \tex_romannumeral:D -`0 \exp_eval_register:c {#2}
- } {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\exp_last_unbraced:NV}
-%\begin{macro}{\exp_last_unbraced:No}
-%\begin{macro}{\exp_last_unbraced:Nv}
-%\begin{macro}{\exp_last_unbraced:Nf}
-%\begin{macro}{\exp_last_unbraced:NcV}
-%\begin{macro}{\exp_last_unbraced:NNV}
-%\begin{macro}{\exp_last_unbraced:NNo}
-%\begin{macro}{\exp_last_unbraced:NNNV}
-%\begin{macro}{\exp_last_unbraced:NNNo}
-% Now the business end.
-% \begin{macrocode}
-\cs_new_nopar:Npn \exp_last_unbraced:Nf { \::f_unbraced \::: }
-\cs_new_nopar:Npn \exp_last_unbraced:NV { \::V_unbraced \::: }
-\cs_new_nopar:Npn \exp_last_unbraced:No { \::o_unbraced \::: }
-\cs_new_nopar:Npn \exp_last_unbraced:Nv { \::v_unbraced \::: }
-\cs_new_nopar:Npn \exp_last_unbraced:NcV {
- \::c \::V_unbraced \:::
-}
-\cs_new_nopar:Npn \exp_last_unbraced:NNV {
- \::N \::V_unbraced \:::
-}
-\cs_new:Npn \exp_last_unbraced:NNo #1#2#3 {
- \exp_after:wN #1 \exp_after:wN #2 #3
-}
-\cs_new_nopar:Npn \exp_last_unbraced:NNNV {
- \::N \::N \::V_unbraced \:::
-}
-\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 {
- \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Items held from earlier}
-%
-%\begin{macro}{\str_if_eq_p:Vn}
-%\begin{macro}[TF]{\str_if_eq:Vn}
-%\begin{macro}{\str_if_eq_p:on}
-%\begin{macro}[TF]{\str_if_eq:on}
-%\begin{macro}{\str_if_eq_p:nV}
-%\begin{macro}[TF]{\str_if_eq:nV}
-%\begin{macro}{\str_if_eq_p:no}
-%\begin{macro}[TF]{\str_if_eq:no}
-%\begin{macro}{\str_if_eq_p:VV}
-%\begin{macro}[TF]{\str_if_eq:VV}
-% These cannot come earlier as they need \cs{cs_generate_variant:Nn}.
-% \begin{macrocode}
-\cs_generate_variant:Nn \str_if_eq_p:nn { V }
-\cs_generate_variant:Nn \str_if_eq_p:nn { o }
-\cs_generate_variant:Nn \str_if_eq_p:nn { nV }
-\cs_generate_variant:Nn \str_if_eq_p:nn { no }
-\cs_generate_variant:Nn \str_if_eq_p:nn { VV }
-\cs_generate_variant:Nn \str_if_eq:nnT { V }
-\cs_generate_variant:Nn \str_if_eq:nnT { o }
-\cs_generate_variant:Nn \str_if_eq:nnT { nV }
-\cs_generate_variant:Nn \str_if_eq:nnT { no }
-\cs_generate_variant:Nn \str_if_eq:nnT { VV }
-\cs_generate_variant:Nn \str_if_eq:nnF { V }
-\cs_generate_variant:Nn \str_if_eq:nnF { o }
-\cs_generate_variant:Nn \str_if_eq:nnF { nV }
-\cs_generate_variant:Nn \str_if_eq:nnF { no }
-\cs_generate_variant:Nn \str_if_eq:nnF { VV }
-\cs_generate_variant:Nn \str_if_eq:nnTF { V }
-\cs_generate_variant:Nn \str_if_eq:nnTF { o }
-\cs_generate_variant:Nn \str_if_eq:nnTF { nV }
-\cs_generate_variant:Nn \str_if_eq:nnTF { no }
-\cs_generate_variant:Nn \str_if_eq:nnTF { VV }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3file.dtx b/Master/texmf-dist/source/latex/expl3/l3file.dtx
deleted file mode 100644
index 63c21100ba8..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3file.dtx
+++ /dev/null
@@ -1,418 +0,0 @@
-% \iffalse meta-comment
-%
-%% File: l3file.dtx Copyright (C) 2009-2011 by
-%% The LaTeX3 Project <latex-team@latex-project.org>
-%%
-%% 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 "expl3 bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX3 Project.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-\GetIdInfo$Id: l3file.dtx 2242 2011-04-21 08:07:24Z joseph $
- {The LaTeX3 kernel: file operations}
-%</driver|package>
-%<*driver>
-\documentclass[full]{l3doc}
-\usepackage{csquotes}
-\begin{document}
- \DocInput{\jobname.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \GetFileInfo{\jobname.sty}
-%
-% \title{^^A
-% \fileinfo
-% \thanks{This file describes v\fileversion, last revised \filedate.}^^A
-% }
-%
-% \author{^^A
-% The \LaTeX3 Project\thanks
-% {^^A
-% E-mail:
-% \href{mailto:latex-team@latex-project.org}
-% {latex-team@latex-project.org}^^A
-% }^^A
-% }
-%
-% \date{Released \filedate}
-%
-% \maketitle
-%
-% \begin{documentation}
-%
-% In contrast to the \pkg{l3io} module, which deals with the lowest
-% level of file management, the \pkg{l3file} module provides a higher
-% level interface for handling file contents. This involves providing
-% convenient wrappers around many of the functions in \pkg{l3io}
-% to make them more generally accessible.
-%
-% It is important to remember that \TeX{} will attempt to locate files using
-% 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.
-%
-% \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_job_name_tl} at the start of a \LaTeX{}
-% run and will be modified each time a file is read using
-% \cs{file_input:n}.
-% \end{variable}
-%
-% \begin{function}[TF]{\file_if_exist:n}
-% \begin{syntax}
-% \cs{file_if_exist:nTF} \Arg{file name} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Searches for \meta{file name} using the current \TeX{} search
-% path and the additional paths controlled by
-% \cs{file_path_include:n}). The branching versions then leave
-% either \meta{true code} or \meta{false code} in the input stream,
-% as appropriate to the truth of the test and the variant of the
-% function chosen.
-% \begin{texnote}
-% The \meta{file name} may contain both literal items and expandable
-% content, which should on full expansion be the desired file name.
-% The expansion occurs when \TeX{} searches for the file.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\file_add_path:nN}
-% \begin{syntax}
-% \cs{file_add_path:nN} \Arg{file name} \meta{tl 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
-% 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 be empty.
-% \begin{texnote}
-% The \meta{file name} may contain both literal items and expandable
-% content, which should on full expansion be the desired file name.
-% The expansion occurs when \TeX{} searches for the file.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\file_input:n}
-% \begin{syntax}
-% \cs{file_input:n} \Arg{file name}
-% \end{syntax}
-% Searches for \meta{file name} in the path as detailed for
-% \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.
-% \begin{texnote}
-% The \meta{file name} may contain both literal items and expandable
-% content, which should on full expansion be the desired file name.
-% The expansion occurs when \TeX{} searches for the file.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\file_path_include:n}
-% \begin{syntax}
-% \cs{file_path_include:n} \Arg{path}
-% \end{syntax}
-% Adds \meta{path} to the list of those used to search for files
-% by the \cs{file_input:n} and \cs{file_if_exist:n} function. The
-% assignment is local.
-% \end{function}
-%
-% \begin{function}{\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 for files
-% by the \cs{file_input:n} and \cs{file_if_exist:n} function. The
-% assignment is local.
-% \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.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{Internal file functions}
-%
-% \begin{function}{\g_file_stack_seq}
-% Stores the stack of nested files loaded using \cs{file_input:n}. This
-% is needed to restore the appropriate file name to
-% \cs{g_file_current_name_tl} at the end of each file.
-% \end{function}
-%
-% \begin{function}{\g_file_record_seq}
-% Stores the name of every file loaded using \cs{file_input:n}. In
-% contrast to \cs{g_file_stack_seq}, no items are ever removed from this
-% sequence.
-% \end{function}
-%
-% \begin{function}{\l_file_name_tl}
-% Used to return the full name of a file for internal use.
-% \end{function}
-%
-% \begin{function}{\l_file_search_path_seq}
-% The sequence of file paths to search when loading a file.
-% \end{function}
-%
-% \begin{function}{\l_file_search_path_saved_seq}
-% When loaded on top of \LaTeXe{}, there is a need to save the search
-% path so that \cs{input@path} can be used as appropriate.
-% \end{function}
-%
-% \section{File operation implementation}
-%
-% \TestFiles{m3file001}
-%
-% \begin{macrocode}
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-% \end{macrocode}
-%
-% \begin{macro}{\g_file_current_name_tl}
-% The name of the current file should be available at all times.
-% \begin{macrocode}
-\tl_new:N \g_file_current_name_tl
-% \end{macrocode}
-% For the format the file name needs to be picked up at the start of the
-% file. In package mode the current file name is collected from \LaTeXe{}.
-% \begin{macrocode}
-%<*initex>
-\tex_everyjob:D \exp_after:wN
- {
- \tex_the:D \tex_everyjob:D
- \tl_gset:Nx \g_file_current_name_tl { \tex_jobname:D }
- }
-%</initex>
-%<*package>
-\tl_gset_eq:NN \g_file_current_name_tl \@currname
-%</package>
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\g_file_stack_seq}
-% The input list of files is stored as a sequence stack.
-% \begin{macrocode}
-\seq_new:N \g_file_stack_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\g_file_record_seq}
-% The total list of files used is recorded separately from the current file
-% stack, as nothing is ever popped from this list.
-% \begin{macrocode}
-\seq_new:N \g_file_record_seq
-% \end{macrocode}
-% The current file name should be included in the file list!
-% \begin{macrocode}
-%<*initex>
-\tex_everyjob:D \exp_after:wN
- {
- \tex_the:D \tex_everyjob:D
- \seq_gput_right:NV \g_file_record_seq \g_file_current_name_tl
- }
-%</initex>
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\l_file_name_tl}
-% Used to return the fully-qualified name of a file.
-% \begin{macrocode}
-\tl_new:N \l_file_name_tl
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\l_file_search_path_seq}
-% The current search path.
-% \begin{macrocode}
-\seq_new:N \l_file_search_path_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\l_file_search_path_saved_seq}
-% The current search path has to be saved for package use.
-% \begin{macrocode}
-%<*package>
-\seq_new:N \l_file_search_path_saved_seq
-%</package>
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\file_add_path:nN}
-% \begin{macro}[aux]{\g_file_test_stream}
-% \begin{macro}[aux]{\file_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{macrocode}
-\cs_new_protected_nopar:Npn \file_add_path:nN #1#2
- {
- \ior_open:Nn \g_file_test_stream {#1}
- \ior_if_eof:NTF \g_file_test_stream
- { \file_add_path_search:nN {#1} #2 }
- {
- \ior_close:N \g_file_test_stream
- \tl_set:Nx #2 {#1}
- }
- }
-\cs_new_protected_nopar:Npn \file_add_path_search:nN #1#2
- {
- \tl_clear:N #2
-%<*package>
- \cs_if_exist:NT \input@path
- {
- \seq_set_eq:NN \l_file_search_path_saved_seq \l_file_search_path_seq
- \clist_map_inline:Nn \input@path
- { \seq_put_right:Nn \l_file_search_path_seq {##1} }
- }
-%</package>
- \seq_map_inline:Nn \l_file_search_path_seq
- {
- \ior_open:Nn \g_file_test_stream { ##1 #1 }
- \ior_if_eof:NF \g_file_test_stream
- {
- \tl_set:Nx #2 { ##1 #1 }
- \seq_map_break:
- }
- }
-%<*package>
- \cs_if_exist:NT \input@path
- { \seq_set_eq:NN \l_file_search_path_seq \l_file_search_path_saved_seq }
-%</package>
- \ior_close:N \g_file_test_stream
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \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 something,
-% whereas if the file was not located then the return value will be empty.
-% \begin{macrocode}
-\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF }
- {
- \file_add_path:nN {#1} \l_file_name_tl
- \tl_if_empty:NTF \l_file_name_tl
- { \prg_return_false: }
- { \prg_return_true: }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\file_input:n}
-% Loading a file is done in a safe way, checking first that the file
-% exists and loading only if it does.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \file_input:n #1
- {
- \file_add_path:nN {#1} \l_file_name_tl
- \tl_if_empty:NF \l_file_name_tl
- {
-%<*initex>
- \seq_gput_right:Nx \g_file_record_seq {#1}
-%</initex>
-%<*package>
- \@addtofilelist {#1}
-%</package>
- \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl
- \tl_gset:Nn \g_file_current_name_tl {#1}
- \tex_expandafter:D \tex_input:D \l_file_name_tl ~
- \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl
- }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\file_path_include:n}
-% \begin{macro}{\file_path_remove:n}
-% Wrapper functions to manage the search path.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \file_path_include:n #1
- {
- \seq_if_in:NnF \l_file_search_path_seq {#1}
- { \seq_put_right:Nn \l_file_search_path_seq {#1} }
- }
-\cs_new_protected_nopar:Npn \file_path_remove:n #1
- { \seq_remove_all:Nn \l_file_search_path_seq {#1} }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\file_list:}
-% A function to list all files used to the log.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \file_list:
- {
- \seq_remove_duplicates:N \g_file_record_seq
- \iow_log:n { *~File~List~* }
- \seq_map_inline:Nn \g_file_record_seq { \iow_log:n {##1} }
- \iow_log:n { ************* }
- }
-% \end{macrocode}
-% \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.
-% \begin{macrocode}
-%<*package>
-\AtBeginDocument
- {
- \clist_map_inline:Nn \@filelist
- { \seq_put_right:Nn \g_file_record_seq {#1} }
- }
-%</package>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-% \end{implementation}
-%
-% \PrintIndex \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/expl3/l3final.dtx b/Master/texmf-dist/source/latex/expl3/l3final.dtx
deleted file mode 100644
index 7ada8b18da6..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3final.dtx
+++ /dev/null
@@ -1,267 +0,0 @@
-% \iffalse
-%% File: l3final.dtx Copyright (C) 1990-2006 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%<*-ini>
-%\fi
-\GetIdInfo$Id: l3final.dtx 2063 2010-10-03 08:26:49Z mittelba $
- {L3 Experimental final module}
-%\iffalse
-%</-ini>
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-%\fi
-%
-%\section{Finalising \textsf{expl3}}
-%
-% This module is the end of \pkg{expl3}, and finishes off the
-% format. It also contains the loading code for the rest of \LaTeX3,
-% along with those parts of the document structure which need to be
-% in place for the rest of \LaTeX3 to load successfully.
-%
-%\begin{function}{
-% \execute_at_document_begin:n |
-% \execute_at_document_end:n |
-% \execute_at_text_begin:n |
-% \execute_at_text_end:n |
-%}
-% \begin{syntax}
-% "\execute_at_document_begin:n" \marg{code}
-% \end{syntax}
-% Executes \meta{code} at the stated place in the document.
-% \cs{execute_at_document_begin:n} code is executed at the
-% beginning of |\begin{document}|, while \cs{execute_at_text_begin:n}
-% is at the end of |\begin{document}|, \emph{i.e}.~the start of the
-% text. In the same way, \cs{execute_at_text_end:n} code is run
-% by |\end{document}| immediately, while
-% \cs{execute_at_document_end:n} is the final part of the document
-% before calling \cs{tex_end:D}.
-% \begin{texnote}
-% \cs{execute_at_text_begin:n} is similar to \cs{AtBeginDocument}
-% in \LaTeXe, while \cs{execute_at_text_end:n} is similar to
-% \cs{AtEndDocument}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{variable}{
-% \g_execute_document_begin_tl |
-% \g_execute_document_end_tl |
-% \g_execute_text_begin_tl |
-% \g_execute_text_end_tl |
-%}
-% The \meta{code} stored by the \cs{execute_at\ldots} functions is
-% stored in these token registers.
-%\end{variable}
-%
-%\begin{function}{\par}
-% \begin{syntax}
-% "\par"
-% \end{syntax}
-% \cs{par} needs to be defined, as \TeX\ uses it in some runaway
-% situations.
-%\end{function}
-%
-%\subsection{Minimal document support}
-%
-% Some temporary material to allow testing of the \pkg{xpackages} in
-% \texttt{initex} mode.
-%
-%\begin{macro}{\g_execute_document_begin_tl}
-%\begin{macro}{\g_execute_document_end_tl}
-%\begin{macro}{\g_execute_text_begin_tl}
-%\begin{macro}{\g_execute_text_end_tl}
-% Token registers to hold material to be executed at the start
-% and end of the document.
-% \begin{macrocode}
-%<*initex>
-\tl_new:N \g_execute_document_begin_tl
-\tl_new:N \g_execute_document_end_tl
-\tl_new:N \g_execute_text_begin_tl
-\tl_new:N \g_execute_text_end_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\execute_at_document_begin:n}
-%\begin{macro}{\execute_at_document_end:n}
-%\begin{macro}{\execute_at_text_begin:n}
-%\begin{macro}{\execute_at_text_end:n}
-% Four commands which add material to the token registers. In each
-% case, the commands are set up to self-deactivate as the first thing
-% that will happen when the hooks are executed.
-% \begin{macrocode}
-\cs_new_protected:Npn \execute_at_document_begin:n #1 {
- \tl_gput_right:Nn \g_execute_document_begin_tl {#1}
-}
-\cs_new_protected:Npn \execute_at_document_end:n #1 {
- \tl_gput_right:Nn \g_execute_document_end_tl {#1}
-}
-\cs_new_protected:Npn \execute_at_text_begin:n #1 {
- \tl_gput_right:Nn \g_execute_text_begin_tl {#1}
-}
-\cs_new_protected:Npn \execute_at_text_end:n #1 {
- \tl_gput_right:Nn \g_execute_text_end_tl {#1}
-}
-\execute_at_document_begin:n {
- \tl_gclear:N \g_execute_document_begin_tl
- \cs_set_eq:NN \execute_at_document_begin:n \use:n
-}
-\execute_at_document_end:n {
- \tl_gclear:N \g_execute_document_end_tl
- \cs_set_eq:NN \execute_at_document_end:n \use:n
-}
-\execute_at_text_begin:n {
- \tl_gclear:N \g_execute_text_begin_tl
- \cs_set_eq:NN \execute_at_text_begin:n \use:n
-}
-\execute_at_text_end:n {
- \tl_gclear:N \g_execute_text_end_tl
- \cs_set_eq:NN \execute_at_text_end:n \use:n
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% Two \emph{temporary} functions to allow testing: these are
-% very basic and just do enough for things to work! The real
-% implementation of the document environment will end up somewhere
-% else in the end.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \document {
- \tl_use:N \g_execute_document_begin_tl
- % Code will go here
- \tl_use:N \g_execute_text_begin_tl
-}
-\cs_new_protected_nopar:Npn \enddocument {
- \tl_use:N \g_execute_text_end_tl
- % Code will go here
- \tl_use:N \g_execute_document_end_tl
- \tex_end:D
-}
-% \end{macrocode}
-%
-% No-ops for \cs{begin} and \cs{end}, so that they can be used in
-% error messages, \emph{etc}.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \begin #1 { }
-\cs_new_protected_nopar:Npn \end #1 { }
-% \end{macrocode}
-%
-%\subsection{Higher-level \LaTeX3}
-%
-% Here, the rest of \LaTeX3 is loaded in a `chain'.
-% \begin{macrocode}
-\clist_map_inline:nn
- {
- xparse ,
- xtemplate ,
- }
- {
- \file_if_exist:nT { #1 .ltx }
- { \tex_input:D #1 .ltx ~ }
- }
-% \end{macrocode}
-%
-%\subsection{Dumping the format}
-%
-%\begin{macro}{\par}
-% \TeX\ has a nasty habit of inserting a command with the name \cs{par}
-% so we had better make sure that that command at least has a definition.
-% \begin{macrocode}
-\cs_set_eq:NN \par \tex_par:D
-% \end{macrocode}
-%\end{macro}
-%
-% Until the start of the document, \cs{tex_everypar:D} is set up to
-% print an error if there is any text. Using \cs{tex_nullfont:D} means
-% that whitespace is not important between material in the preamble.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { document } { missing-begin-document }
- {Missing \begin{document}.}
- {
- You've tried to print something before \begin{document}\\%
- This probably means there's a mistake somewhere in your source.%
- }
-\tex_everypar:D {
- \msg_kernel_error:nn { document } { missing-begin-document }
-}
-\tex_nullfont:D
-% \end{macrocode}
-%
-%\begin{macro}{\ExplSyntaxOff}
-% We re-define \cs{ExplSyntaxOff} as the version that comes through
-% from \pkg{l3names} is defined using \TeX\ primitives, which we no
-% longer have! Here, we can also make a fixed decision about the
-% category codes to fix.
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \ExplSyntaxOff {
- \int_if_odd:nT { \ExplSyntaxStatus }
- {
- \tl_set:Nn \ExplSyntaxStatus { 0 }
- \char_set_catcode:nn { 126 } { 13 }
- \char_set_catcode:nn { 32 } { 10 }
- \char_set_catcode:nn { 9 } { 10 }
- \char_set_catcode:nn { 95 } { 8 }
- \char_set_catcode:nn { 58 } { 12 }
- \tex_endlinechar:D = 13 \scan_stop:
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\latex_format_dump:}
-% The last action to take is to dump the format.
-% \begin{macrocode}
-\use:n {
- \ExplSyntaxOff
- \tex_dump:D
-}
-%</initex>
-% \end{macrocode}
-%
-%\endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3font.dtx b/Master/texmf-dist/source/latex/expl3/l3font.dtx
deleted file mode 100644
index 2999b41ef4a..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3font.dtx
+++ /dev/null
@@ -1,264 +0,0 @@
-% \iffalse
-%% File: l3font.dtx Copyright (C) 1990-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3font.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental Font Loading}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full,checktest]{l3doc}
-\begin{document}
-\DocInput{l3font.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3font} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% ``Fonts''}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% This module covers basic font loading commands.
-% Functions are provided to load font faces and extract various
-% properties from them.
-%
-% Some features within are specific to \XeTeX\ and \LuaTeX; such functions
-% will be explicitly noted.
-%
-% This module is currently a work in progress as we incorporate \LaTeXe's
-% font loading into \pkg{expl3}. The successor to the NFSS
-% (tentatively denoted "xfss")
-% will provide
-% (backwards compatible) user-level functions for font selection.
-%
-% \section{Naming and scope}
-%
-% The "l3font" module largely provides commands for selecting and working
-% with typefaces selected at specific sizes.
-% (Many fonts have different shapes intended for use at different physical
-% sizes.)
-% We call a font at some size a "fontface" which is the function prefix
-% used for these commands and also should be the variable suffix for
-% denoting variables of this type.
-%
-% We reserve for future use the module name and variable type "font" for
-% higher-level font selection commands, such as for font families which have
-% linked bold, italic, etc., shapes with automatically-chosen optical sizes.
-% (I.e., what is currently provided in \LaTeXe\ by the NFSS.)
-%
-%
-% \section{Functions}
-%
-%
-% \begin{function}{\fontface_set:Nnn,\fontface_gset:Nnn,
-% \fontface_set:cnn,\fontface_gset:cnn}
-% \begin{syntax}
-% "\fontface_set:Nnn" <font cs> \Arg{font name} \Arg{font size}
-% "\fontface_set:Nnn \l_tenrm_fontface {cmr10} {10pt}"
-% \end{syntax}
-% Defines <cs> as a command to select the font defined by <font name>
-% at the <font size>. If the <font size> is empty, the font will be loaded
-% at its design size, which is usually specified by the font designer.
-% For fonts without a typical design size, this will usually be 10\,pt.
-% \end{function}
-%
-% \begin{function}{\fontface_set_eq:NN,\fontface_gset_eq:NN}
-% \begin{syntax}
-% "\fontface_set_eq:NN" <font cs1> <font cs2>
-% \end{syntax}
-% Copies <font cs2> into <font cs1>.
-% \end{function}
-%
-% \begin{function}{\fontface_set_to_current:N,\fontface_gset_to_current:N}
-% \begin{syntax}
-% "\fontface_set_to_current:N" <font cs>
-% \end{syntax}
-% Sets <font cs> to the font that is currently selected.
-% \end{function}
-%
-% \begin{function}{ \fontface_if_null:N / (pTF) }
-% \begin{syntax}
-% "\fontface_if_null:NTF" <font cs> \Arg{true} \Arg{false}
-% \end{syntax}
-% Conditional to switch whether the control sequence is the `null font'.
-% \end{function}
-%
-% \begin{function}{\font_suppress_not_found_error:,\font_enable_not_found_error:}
-% \begin{syntax}
-% "\font_suppress_not_found_error:"
-% "\font_enable_not_found_error:"
-% \end{syntax}
-% \emph{Not available in pdf\TeX.}
-% In LuaTeX or XeTeX, the error when a font is selected but does not exist
-% can be toggled with these two commands. The non-existance of a font can
-% then be tested with the "\fontface_if_null_p:N" conditional.
-% \end{function}
-%
-%
-%
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3font} implementation}
-%
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \TestFiles{m3font001.lvt}
-%
-% \begin{macro}{\fontface_set:Nnn,\fontface_gset:Nnn,
-% \fontface_set:cnn,\fontface_gset:cnn}
-% \UnitTested
-% \begin{arguments}
-% \item csname \item fontname \item size (dimension)
-% \end{arguments}
-% Note that the fontname needs to be escaped appropriately in "xetex"
-% or "luatex".
-% \begin{macrocode}
-\cs_new_protected:Npn \fontface_set:Nnn #1#2#3 {
- \tex_font:D #1 = #2 ~at~ #3 \scan_stop:
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected:Npn \fontface_gset:Nnn #1#2#3 {
- \tex_global:D \tex_font:D #1 = #2 ~at~ #3 \scan_stop:
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \fontface_set:Nnn {c}
-\cs_generate_variant:Nn \fontface_gset:Nnn {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\fontface_set_eq:NN}
-% \UnitTested
-% \begin{macrocode}
-\cs_set_eq:NN \fontface_set_eq:NN \tex_let:D
-\cs_set_protected:Npn \fontface_gset_eq:NN { \tex_global:D \tex_let:D }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\fontface_set_to_current:N,\fontface_gset_to_current:N}
-% \UnitTested
-% \begin{macrocode}
-\cs_set:Npn \fontface_set_to_current:N #1 {
- \exp_after:wN \fontface_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D
-}
-\cs_set:Npn \fontface_gset_to_current:N #1 {
- \tex_global:D \exp_after:wN \fontface_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\font_suppress_not_found_error:,\font_enable_not_found_error:}
-% \UnitTested ^^A THIS IS A BIG LIE! NOT TESTED, BUT OH WELL
-% \begin{macrocode}
-\luatex_if_engine:TF
-{
- \cs_new:Npn \font_suppress_not_found_error:
- {\luatexsuppressfontnotfounderror=\c_one}
- \cs_new:Npn \font_enable_not_found_error:
- {\luatexsuppressfontnotfounderror=\c_zero}
-}
-{
- \xetex_if_engine:TF
- {
- \cs_new:Npn \font_suppress_not_found_error:
- {\suppressfontnotfounderror=\c_one}
- \cs_new:Npn \font_enable_not_found_error:
- {\suppressfontnotfounderror=\c_zero}
- }
- {
- \cs_new:Npn \font_suppress_not_found_error:
- {
- \msg_kernel_warning:nnx {l3font} {cmd-pdftex-unavail}
- {\font_suppress_not_found_error:}
- }
- }
-}
-\msg_kernel_new:nnn {l3font} {cmd-pdftex-unavail} {
- The~ command~ `\exp_not:n{#1}'~ is~ not~ available~ for~ the~ pdfTeX~ format.
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}[pTF]{\fontface_if_null:N}
-% \UnitTested
-% \begin{macrocode}
-\prg_new_conditional:Nnn \fontface_if_null:N {p,TF,T,F} {
- \if_meaning:w #1 \tex_nullfont:D
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3fp.dtx b/Master/texmf-dist/source/latex/expl3/l3fp.dtx
deleted file mode 100644
index 8e592fe9a88..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3fp.dtx
+++ /dev/null
@@ -1,5893 +0,0 @@
-% \iffalse
-%% File: l3fp.dtx Copyright (C) 2010-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3fp.dtx 2201 2011-03-19 17:16:13Z joseph $
- {L3 Experimental floating-point operations}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{l3fp.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3fp} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Floating point arithmetic}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-%\begin{documentation}
-%
-%\section{Floating point numbers}
-%
-% A floating point number is one which is stored as a mantissa and
-% a separate exponent. This module implements arithmetic using radix
-% \( 10 \) floating point numbers. This means that the mantissa should
-% be a real number in the range \( 1 \le \expandafter\mathopen\string|
-% x \expandafter\mathclose\string| < 10 \), with the
-% exponent given as an integer between \( -99 \) and \( 99 \). In the
-% input, the exponent part is represented starting with an \texttt{e}.
-% As this is a low-level module, error-checking is minimal. Numbers
-% which are too large for the floating point unit to handle will result
-% in errors, either from \TeX\ or from \LaTeX. The \LaTeX\ code does not
-% check that the input will not overflow, hence the possibility of a
-% \TeX\ error. On the other hand, numbers which are too small will be
-% dropped, which will mean that extra decimal digits will simply be
-% lost.
-%
-% When parsing numbers, any missing parts will be interpreted as
-% zero. So for example
-%\begin{verbatim}
-% \fp_set:Nn \l_my_fp { }
-% \fp_set:Nn \l_my_fp { . }
-% \fp_set:Nn \l_my_fp { - }
-%\end{verbatim}
-% will all be interpreted as zero values without raising an error.
-%
-% Operations which give an undefined result (such as division by
-% \( 0 \)) will not lead to errors. Instead special marker values are
-% returned, which can be tested for using fr example
-% \cs{fp_if_undefined:N(TF)}. In this way it is possible to work with
-% asymptotic functions without first checking the input. If these
-% special values are carried forward in calculations they will be
-% treated as \( 0 \).
-%
-% Floating point numbers are stored in the \texttt{fp} floating point
-% variable type. This has a standard range of functions for
-% variable management.
-%
-%\subsection{Constants}
-%
-%\begin{variable}{ \c_e_fp }
-% The value of the base of natural numbers, \( \mathrm{e} \).
-%\end{variable}
-%
-%\begin{variable}{ \c_one_fp }
-% A floating point variable with permanent value \( 1 \): used for
-% speeding up some comparisons.
-%\end{variable}
-%
-%\begin{variable}{ \c_pi_fp }
-% The value of \( \pi \).
-%\end{variable}
-%
-%\begin{variable}{ \c_undefined_fp }
-% A special marker floating point variable representing the result of
-% an operation which does not give a defined result (such as division
-% by \( 0 \)).
-%\end{variable}
-%
-%\begin{variable}{ \c_zero_fp }
-% A permanently zero floating point variable.
-%\end{variable}
-%
-%\subsection{Floating-point variables}
-%
-%\begin{function}{
-% \fp_new:N |
-% \fp_new:c |
-%}
-% \begin{syntax}
-% \cs{fp_new:N} \meta{floating point variable}
-% \end{syntax}
-% Creates a new \meta{floating point variable} or raises an error if
-% the name is already taken. The declaration global. The
-% \meta{floating point} will initially be set to "+0.000000000e0"
-% (the zero floating point).
-%\end{function}
-%
-%\begin{function}{
-% \fp_const:Nn |
-% \fp_const:cn |
-%}
-% \begin{syntax}
-% \cs{fp_const:Nn} \meta{floating point variable} \Arg{value}
-% \end{syntax}
-% Creates a new constant \meta{floating point variable} or raises an
-% error if the name is already taken. The value of the
-% \meta{floating point variable} will be set globally to the
-% \meta{value}.
-%\end{function}
-%
-%\begin{function}{
-% \fp_set_eq:NN |
-% \fp_set_eq:cN |
-% \fp_set_eq:Nc |
-% \fp_set_eq:cc |
-%}
-% \begin{syntax}
-% \cs{fp_set_eq:NN} \meta{fp var1} \meta{fp var2}
-% \end{syntax}
-% Sets the value of \meta{floating point variable1} equal to that of
-% \meta{floating point variable2}. This assignment is restricted to the
-% current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gset_eq:NN |
-% \fp_gset_eq:cN |
-% \fp_gset_eq:Nc |
-% \fp_gset_eq:cc |
-%}
-% \begin{syntax}
-% \cs{fp_gset_eq:NN} \meta{fp var1} \meta{fp var2}
-% \end{syntax}
-% Sets the value of \meta{floating point variable1} equal to that of
-% \meta{floating point variable2}. This assignment is global and so is
-% not limited by the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \fp_zero:N |
-% \fp_zero:c |
-%}
-% \begin{syntax}
-% \cs{fp_zero:N} \meta{floating point variable}
-% \end{syntax}
-% Sets the \meta{floating point variable} to "+0.000000000e0" within
-% the current scope.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gzero:N |
-% \fp_gzero:c |
-%}
-% \begin{syntax}
-% \cs{fp_gzero:N} \meta{floating point variable}
-% \end{syntax}
-% Sets the \meta{floating point variable} to "+0.000000000e0" globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_set:Nn |
-% \fp_set:cn |
-%}
-% \begin{syntax}
-% \cs{fp_set:Nn} \meta{floating point variable} \Arg{value}
-% \end{syntax}
-% Sets the \meta{floating point variable} variable to \meta{value}
-% within the scope of the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gset:Nn |
-% \fp_gset:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gset:Nn} \meta{floating point variable} \Arg{value}
-% \end{syntax}
-% Sets the \meta{floating point variable} variable to \meta{value}
-% globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_set_from_dim:Nn |
-% \fp_set_from_dim:cn |
-%}
-% \begin{syntax}
-% \cs{fp_set_from_dim:Nn} \meta{floating point variable} \Arg{dimexpr}
-% \end{syntax}
-% Sets the \meta{floating point variable} to the distance represented
-% by the \meta{dimension expression} in the units points. This means
-% that distances given in other units are first converted to points
-% before being assigned to the \meta{floating point variable}. The
-% assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gset_from_dim:Nn |
-% \fp_gset_from_dim:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gset_from_dim:Nn} \meta{floating point variable} \Arg{dimexpr}
-% \end{syntax}
-% Sets the \meta{floating point variable} to the distance represented
-% by the \meta{dimension expression} in the units points. This means
-% that distances given in other units are first converted to points
-% before being assigned to the \meta{floating point variable}. The
-% assignment is global.
-%\end{function}
-%
-%\begin{function}{
-% \fp_use:N / (EXP) |
-% \fp_use:c / (EXP) |
-%}
-% \begin{syntax}
-% \cs{fp_use:N} \meta{floating point variable}
-% \end{syntax}
-% Inserts the value of the \meta{floating point variable} into the
-% input stream. The value will be given as a real number without any
-% exponent part, and will always include a decimal point. For example,
-% \begin{verbatim}
-% \fp_new:Nn \test
-% \fp_set:Nn \test { 1.234 e 5 }
-% \fp_use:N \test
-% \end{verbatim}
-% will insert `\texttt{12345.00000}' into the input stream.
-% As illustrated, a floating point will always be inserted with ten
-% significant digits given. Very large and very small values will
-% include additional zeros for place value.
-%\end{function}
-%
-%\begin{function}{
-% \fp_show:N |
-% \fp_show:c |
-%}
-% \begin{syntax}
-% \cs{fp_show:N} \meta{floating point variable}
-% \end{syntax}
-% Displays the content of the \meta{floating point variable} on the
-% terminal.
-%\end{function}
-%
-%\subsection{Conversion to other formats}
-%
-% It is useful to be able to convert floating point variables to
-% other forms. These functions are expandable, so that the material
-% can be used in a variety of contexts. The \cs{fp_use:N} function
-% should also be consulted in this context, as it will insert the
-% value of the floating point variable as a real number.
-%
-%\begin{function}{
-% \fp_to_dim:N / (EXP) |
-% \fp_to_dim:c / (EXP) |
-%}
-% \begin{syntax}
-% \cs{fp_to_dim:N} \meta{floating point variable}
-% \end{syntax}
-% Inserts the value of the \meta{floating point variable}
-% into the input stream converted into a dimension in points.
-%\end{function}
-%
-%\begin{function}{
-% \fp_to_int:N / (EXP) |
-% \fp_to_int:c / (EXP) |
-%}
-% \begin{syntax}
-% \cs{fp_to_int:N} \meta{floating point variable}
-% \end{syntax}
-% Inserts the integer value of the \meta{floating point variable}
-% into the input stream. The decimal part of the number will not be
-% included, but will be used to round the integer.
-%\end{function}
-%
-%\begin{function}{
-% \fp_to_tl:N / (EXP) |
-% \fp_to_tl:c / (EXP) |
-%}
-% \begin{syntax}
-% \cs{fp_to_tl:N} \meta{floating point variable}
-% \end{syntax}
-% Inserts a representation of the \meta{floating point variable} into
-% the input stream as a token list. The representation follows the
-% conventions of a pocket calculator:
-% \begin{center}
-% \ttfamily
-% \begin{tabular}{r@{.}lr@{.}l}
-% \toprule
-% \multicolumn{2}{l}{\rmfamily{Floating point value}} &
-% \multicolumn{2}{l}{\rmfamily{Representation}} \\
-% \midrule
-% 1 & 234000000000e0 & 1 & 234 \\
-% -1 & 234000000000e0 & -1 & 234 \\
-% 1 & 234000000000e3 & \multicolumn{2}{l}{1234} \\
-% 1 & 234000000000e13 & \multicolumn{2}{l}{1234e13} \\
-% 1 & 234000000000e-1 & 0 & 1234 \\
-% 1 & 234000000000e-2 & 0 & 01234 \\
-% 1 & 234000000000e-3 & 1 & 234e-3 \\
-% \bottomrule
-% \end{tabular}
-% \end{center}
-% Notice that trailing zeros are removed in this process, and that
-% numbers which do not require a decimal part do \emph{not} include
-% a decimal marker.
-%\end{function}
-%
-%\subsection{Rounding floating point values}
-%
-% The module can round floating point values to either decimal places
-% or significant figures using the usual method in which exact halves
-% are rounded up.
-%
-%\begin{function}{
-% \fp_round_figures:Nn |
-% \fp_round_figures:cn |
-%}
-% \begin{syntax}
-% \cs{fp_round_figures:Nn} \meta{floating point variable} \Arg{target}
-% \end{syntax}
-% Rounds the \meta{floating point variable} to the \meta{target} number
-% of significant figures (an integer expression). The rounding is
-% carried out locally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_ground_figures:Nn |
-% \fp_ground_figures:cn |
-%}
-% \begin{syntax}
-% \cs{fp_ground_figures:Nn} \meta{floating point variable} \Arg{target}
-% \end{syntax}
-% Rounds the \meta{floating point variable} to the \meta{target} number
-% of significant figures (an integer expression). The rounding is
-% carried out globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_round_places:Nn |
-% \fp_round_places:cn |
-%}
-% \begin{syntax}
-% \cs{fp_round_places:Nn} \meta{floating point variable} \Arg{target}
-% \end{syntax}
-% Rounds the \meta{floating point variable} to the \meta{target} number
-% of decimal places (an integer expression). The rounding is
-% carried out locally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_ground_places:Nn |
-% \fp_ground_places:cn |
-%}
-% \begin{syntax}
-% \cs{fp_ground_places:Nn} \meta{floating point variable} \Arg{target}
-% \end{syntax}
-% Rounds the \meta{floating point variable} to the \meta{target} number
-% of decimal places (an integer expression). The rounding is
-% carried out globally.
-%\end{function}
-%
-%\subsection{Tests on floating-point values}
-%
-%\begin{function}{
-% \fp_if_undefined_p:N / (EXP) |
-% \fp_if_undefined:N / (EXP) (TF) |
-%}
-% \begin{syntax}
-% \cs{fp_if_undefined_p:N} \meta{fixed-point}
-% \cs{fp_if_undefined:NTF} \meta{fixed-point}
-% ~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if \meta{floating point} is undefined (\emph{i.e}.~equal to the
-% special \cs{c_undefined_fp} variable). The branching versions then
-% leave either \meta{true code} or \meta{false code} in the input
-% stream, as appropriate to the truth of the test and the variant of
-% the function chosen. The logical truth of the test is left in the
-% input stream by the predicate version.
-%\end{function}
-%
-%\begin{function}{
-% \fp_if_zero_p:N / (EXP) |
-% \fp_if_zero:N / (EXP) (TF) |
-%}
-% \begin{syntax}
-% \cs{fp_if_zero_p:N} \meta{fixed-point}
-% \cs{fp_if_zero:NTF} \meta{fixed-point} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if \meta{floating point} is equal to zero (\emph{i.e}.~equal to
-% the special \cs{c_zero_fp} variable). The branching versions then
-% leave either \meta{true code} or \meta{false code} in the input
-% stream, as appropriate to the truth of the test and the variant of
-% the function chosen. The logical truth of the test is left in the
-% input stream by the predicate version.
-%\end{function}
-%
-%\begin{function}{ \fp_compare:nNn / (TF) }
-% \begin{syntax}
-% \cs{fp_compare:nNnTF}
-% ~~\Arg{floating point1} \meta{relation} \Arg{floating point2}
-% ~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% This function compared the two \meta{floating point} values, which
-% may be stored as \texttt{fp} variables, using the \meta{relation}:
-% \begin{center}
-% \begin{tabular}{ll}
-% Equal & "=" \\
-% Greater than & ">" \\
-% Less than & "<" \\
-% \end{tabular}
-% \end{center}
-% Either \meta{true code} or \meta{false code} is then left in the
-% input stream, as appropriate to the truth of the test and the variant
-% of the function chosen. The tests treat undefined floating points as
-% zero as the comparison is intended for real numbers only.
-%\end{function}
-%
-%\subsection{Unary operations}
-%
-% The unary operations alter the value stored within an \texttt{fp}
-% variable.
-%
-%\begin{function}{
-% \fp_abs:N |
-% \fp_abs:c |
-%}
-% \begin{syntax}
-% \cs{fp_abs:N} \meta{floating point variable}
-% \end{syntax}
-% Converts the \meta{floating point variable} to its absolute value,
-% assigning the result within the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gabs:N |
-% \fp_gabs:c |
-%}
-% \begin{syntax}
-% \cs{fp_gabs:N} \meta{floating point variable}
-% \end{syntax}
-% Converts the \meta{floating point variable} to its absolute value,
-% assigning the result globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_neg:N |
-% \fp_neg:c |
-%}
-% \begin{syntax}
-% \cs{fp_neg:N} \meta{floating point variable}
-% \end{syntax}
-% Reverse the sign of the \meta{floating point variable}, assigning the
-% result within the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gneg:N |
-% \fp_gneg:c |
-%}
-% \begin{syntax}
-% \cs{fp_gneg:N} \meta{floating point variable}
-% \end{syntax}
-% Reverse the sign of the \meta{floating point variable}, assigning the
-% result globally.
-%\end{function}
-%
-%\subsection{Arithmetic operations}
-%
-% Binary arithmetic operations act on the value stored in an
-% \texttt{fp}, so for example
-%\begin{verbatim}
-% \fp_set:Nn \l_my_fp { 1.234 }
-% \fp_sub:Nn \l_my_fp { 5.678 }
-%\end{verbatim}
-% sets \cs{l_my_fp} to the result of \( 1.234 - 5.678 \)
-% (\emph{i.e}.~\( -4.444 \)).
-%
-%\begin{function}{
-% \fp_add:Nn |
-% \fp_add:cn |
-%}
-% \begin{syntax}
-% \cs{fp_add:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Adds the \meta{value} to the \meta{floating point}, making the
-% assignment within the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gadd:Nn |
-% \fp_gadd:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gadd:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Adds the \meta{value} to the \meta{floating point}, making the
-% assignment globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_sub:Nn |
-% \fp_sub:cn |
-%}
-% \begin{syntax}
-% \cs{fp_sub:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Subtracts the \meta{value} from the \meta{floating point}, making the
-% assignment within the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gsub:Nn |
-% \fp_gsub:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gsub:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Subtracts the \meta{value} from the \meta{floating point}, making the
-% assignment globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_mul:Nn |
-% \fp_mul:cn |
-%}
-% \begin{syntax}
-% \cs{fp_mul:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Multiples the \meta{floating point} by the \meta{value}, making the
-% assignment within the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gmul:Nn |
-% \fp_gmul:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gmul:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Multiples the \meta{floating point} by the \meta{value}, making the
-% assignment globally.
-%\end{function}
-%
-%\begin{function}{
-% \fp_div:Nn |
-% \fp_div:cn |
-%}
-% \begin{syntax}
-% \cs{fp_div:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Divides the \meta{floating point} by the \meta{value}, making the
-% assignment within the current \TeX\ group level. If the \meta{value}
-% is zero, the \meta{floating point} will be set to
-% \cs{c_undefined_fp}.The assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gdiv:Nn |
-% \fp_gdiv:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gdiv:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Divides the \meta{floating point} by the \meta{value}, making the
-% assignment globally. If the \meta{value} is zero, the
-% \meta{floating point} will be set to \cs{c_undefined_fp}.
-% The assignment is global.
-%\end{function}
-%
-%\subsection{Power operations}
-%
-%\begin{function}{
-% \fp_pow:Nn |
-% \fp_pow:cn |
-%}
-% \begin{syntax}
-% \cs{fp_pow:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Raises the \meta{floating point} to the given \meta{value}. If the
-% \meta{floating point} is negative, then the \meta{value} should be
-% either a positive real number or a negative integer. If the
-% \meta{floating point} is positive, then the \meta{value} may be any
-% real value. Mathematically invalid operations such as \( 0^{0} \)
-% will give set the \meta{floating point} to to \cs{c_undefined_fp}.
-% The assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gpow:Nn |
-% \fp_gpow:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gpow:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Raises the \meta{floating point} to the given \meta{value}. If the
-% \meta{floating point} is negative, then the \meta{value} should be
-% either a positive real number or a negative integer. If the
-% \meta{floating point} is positive, then the \meta{value} may be any
-% real value. Mathematically invalid operations such as \( 0^{0} \)
-% will give set the \meta{floating point} to to \cs{c_undefined_fp}.
-% The assignment is global.
-%\end{function}
-%
-%\subsection{Exponential and logarithm functions}
-%
-%\begin{function}{
-% \fp_exp:Nn |
-% \fp_exp:cn |
-%}
-% \begin{syntax}
-% \cs{fp_exp:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Calculates the exponential of the \meta{value} and assigns this
-% to the \meta{floating point}. The assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gexp:Nn |
-% \fp_gexp:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gexp:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Calculates the exponential of the \meta{value} and assigns this
-% to the \meta{floating point}. The assignment is global.
-%\end{function}
-%
-%\begin{function}{
-% \fp_ln:Nn |
-% \fp_ln:cn |
-%}
-% \begin{syntax}
-% \cs{fp_ln:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Calculates the natural logarithm of the \meta{value} and assigns
-% this to the \meta{floating point}. The assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gln:Nn |
-% \fp_gln:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gln:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Calculates the natural logarithm of the \meta{value} and assigns
-% this to the \meta{floating point}. The assignment is global.
-%\end{function}
-%
-%\subsection{Trigonometric functions}
-%
-% The trigonometric functions all work in radians. They accept a maximum
-% input value of \( 100\,000\,000 \), as there are issues with range
-% reduction and very large input values.
-%
-%\begin{function}{
-% \fp_sin:Nn |
-% \fp_sin:cn |
-%}
-% \begin{syntax}
-% \cs{fp_sin:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Assigns the sine of the \meta{value} to the \meta{floating point}.
-% The \meta{value} should be given in radians. The assignment is
-% local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gsin:Nn |
-% \fp_gsin:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gsin:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Assigns the sine of the \meta{value} to the \meta{floating point}.
-% The \meta{value} should be given in radians. The assignment is
-% global.
-%\end{function}
-%
-%\begin{function}{
-% \fp_cos:Nn |
-% \fp_cos:cn |
-%}
-% \begin{syntax}
-% \cs{fp_cos:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Assigns the cosine of the \meta{value} to the \meta{floating point}.
-% The \meta{value} should be given in radians. The assignment is
-% local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gcos:Nn |
-% \fp_gcos:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gcos:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Assigns the cosine of the \meta{value} to the \meta{floating point}.
-% The \meta{value} should be given in radians. The assignment is
-% global.
-%\end{function}
-%
-%\begin{function}{
-% \fp_tan:Nn |
-% \fp_tan:cn |
-%}
-% \begin{syntax}
-% \cs{fp_tan:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Assigns the tangent of the \meta{value} to the \meta{floating point}.
-% The \meta{value} should be given in radians. The assignment is
-% local.
-%\end{function}
-%
-%\begin{function}{
-% \fp_gtan:Nn |
-% \fp_gtan:cn |
-%}
-% \begin{syntax}
-% \cs{fp_gtan:Nn} \meta{floating point} \Arg{value}
-% \end{syntax}
-% Assigns the tangent of the \meta{value} to the \meta{floating point}.
-% The \meta{value} should be given in radians. The assignment is
-% global.
-%\end{function}
-%
-%\subsection{Notes on the floating point unit}
-%
-% As calculation of the elemental transcendental functions is
-% computationally expensive compared to storage of results, after
-% calculating a trigonometric function, exponent, \emph{etc}.~the module
-% stored the result for reuse. Thus the performance of the module for
-% repeated operations, most probably trigonometric functions, should be
-% much higher than if the values were re-calculated every time they
-% were needed.
-%
-% Anyone with experience of programming floating point calculations will
-% know that this is a complex area. The aim of the unit is to be
-% accurate enough for the likely applications in a typesetting context.
-% The arithmetic operations are therefore intended to provide ten digit
-% accuracy with the last digit accurate to \( \pm 1 \). The elemental
-% transcendental functions may not provide such high accuracy in every
-% case, although the design aim has been to provide \( 10 \) digit
-% accuracy for cases likely to be relevant in typesetting situations.
-% A good overview of the challenges in this area can be found in
-% J.-M.~Muller, \emph{Elementary functions: algorithms and
-% implementation}, 2nd edition, Birkh{\"a}uer Boston, New York, USA,
-% 2006.
-%
-% The internal representation of numbers is tuned to the needs of the
-% underlying \TeX\ system. This means that the format is somewhat
-% different from that used in, for example, computer floating point
-% units. Programming in \TeX\ makes it most convenient to use a
-% radix \( 10 \) system, using \TeX\ \texttt{count} registers for
-% storage and taking advantage where possible of delimited arguments.
-%
-%\end{documentation}
-%
-%\begin{implementation}
-%
-%\section{Implementation}
-%
-% \TestFiles{m3fp003.lvt}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%\subsection{Constants}
-%
-%\begin{macro}[aux]{\c_forty_four}
-%\begin{macro}[aux]{\c_one_hundred}
-%\begin{macro}[aux]{\c_one_thousand}
-%\begin{macro}[aux]{\c_one_million}
-%\begin{macro}[aux]{\c_one_hundred_million}
-%\begin{macro}[aux]{\c_five_hundred_million}
-%\begin{macro}[aux]{\c_one_thousand_million}
-% There is some speed to gain by moving numbers into fixed positions.
-% \begin{macrocode}
-\int_const:Nn \c_forty_four { 44 }
-\int_const:Nn \c_one_hundred { 100 }
-\int_const:Nn \c_one_thousand { 1000 }
-\int_const:Nn \c_one_million { 1 000 000 }
-\int_const:Nn \c_one_hundred_million { 100 000 000 }
-\int_const:Nn \c_five_hundred_million { 500 000 000 }
-\int_const:Nn \c_one_thousand_million { 1 000 000 000 }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\c_fp_pi_by_four_decimal_int}
-%\begin{macro}[aux]{\c_fp_pi_by_four_extended_int}
-%\begin{macro}[aux]{\c_fp_pi_decimal_int}
-%\begin{macro}[aux]{\c_fp_pi_extended_int}
-%\begin{macro}[aux]{\c_fp_two_pi_decimal_int}
-%\begin{macro}[aux]{\c_fp_two_pi_extended_int}
-% Parts of \( \pi \) for trigonometric range reduction, implemented
-% as \texttt{int} variables for speed.
-% \begin{macrocode}
-\int_new:N \c_fp_pi_by_four_decimal_int
-\int_set:Nn \c_fp_pi_by_four_decimal_int { 785 398 158 }
-\int_new:N \c_fp_pi_by_four_extended_int
-\int_set:Nn \c_fp_pi_by_four_extended_int { 897 448 310 }
-\int_new:N \c_fp_pi_decimal_int
-\int_set:Nn \c_fp_pi_decimal_int { 141 592 653 }
-\int_new:N \c_fp_pi_extended_int
-\int_set:Nn \c_fp_pi_extended_int { 589 793 238 }
-\int_new:N \c_fp_two_pi_decimal_int
-\int_set:Nn \c_fp_two_pi_decimal_int { 283 185 307 }
-\int_new:N \c_fp_two_pi_extended_int
-\int_set:Nn \c_fp_two_pi_extended_int { 179 586 477 }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\c_e_fp}
-% The value \( \mathrm{e} \) as a `machine number'.
-% \begin{macrocode}
-\tl_new:N \c_e_fp
-\tl_set:Nn \c_e_fp { + 2.718281828 e 0 }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_one_fp}
-% The constant value \( 1 \): used for fast comparisons.
-% \begin{macrocode}
-\tl_new:N \c_one_fp
-\tl_set:Nn \c_one_fp { + 1.000000000 e 0 }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_pi_fp}
-% The value \( \pi \) as a `machine number'.
-% \begin{macrocode}
-\tl_new:N \c_pi_fp
-\tl_set:Nn \c_pi_fp { + 3.141592654 e 0 }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_undefined_fp}
-% A marker for undefined values.
-% \begin{macrocode}
-\tl_new:N \c_undefined_fp
-\tl_set:Nn \c_undefined_fp { X 0.000000000 e 0 }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_zero_fp}
-% The constant zero value.
-% \begin{macrocode}
-\tl_new:N \c_zero_fp
-\tl_set:Nn \c_zero_fp { + 0.000000000 e 0 }
-% \end{macrocode}
-%\end{macro}
-%
-%\subsection{Variables}
-%
-%\begin{macro}[aux]{\l_fp_arg_tl}
-% A token list to store the formalised representation of the input
-% for transcendental functions.
-% \begin{macrocode}
-\tl_new:N \l_fp_arg_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_count_int}
-% A counter for things like the number of divisions possible.
-% \begin{macrocode}
-\int_new:N \l_fp_count_int
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_div_offset_int}
-% When carrying out division, an offset is used for the results to
-% get the decimal part correct.
-% \begin{macrocode}
-\int_new:N \l_fp_div_offset_int
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_exp_integer_int}
-%\begin{macro}[aux]{\l_fp_exp_decimal_int}
-%\begin{macro}[aux]{\l_fp_exp_extended_int}
-%\begin{macro}[aux]{\l_fp_exp_exponent_int}
-% Used for the calculation of exponent values.
-% \begin{macrocode}
-\int_new:N \l_fp_exp_integer_int
-\int_new:N \l_fp_exp_decimal_int
-\int_new:N \l_fp_exp_extended_int
-\int_new:N \l_fp_exp_exponent_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_input_a_sign_int}
-%\begin{macro}[aux]{\l_fp_input_a_integer_int}
-%\begin{macro}[aux]{\l_fp_input_a_decimal_int}
-%\begin{macro}[aux]{\l_fp_input_a_exponent_int}
-%\begin{macro}[aux]{\l_fp_input_b_sign_int}
-%\begin{macro}[aux]{\l_fp_input_b_integer_int}
-%\begin{macro}[aux]{\l_fp_input_b_decimal_int}
-%\begin{macro}[aux]{\l_fp_input_b_exponent_int}
-% Storage for the input: two storage areas as there are at most two
-% inputs.
-% \begin{macrocode}
-\int_new:N \l_fp_input_a_sign_int
-\int_new:N \l_fp_input_a_integer_int
-\int_new:N \l_fp_input_a_decimal_int
-\int_new:N \l_fp_input_a_exponent_int
-\int_new:N \l_fp_input_b_sign_int
-\int_new:N \l_fp_input_b_integer_int
-\int_new:N \l_fp_input_b_decimal_int
-\int_new:N \l_fp_input_b_exponent_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_input_a_extended_int}
-%\begin{macro}[aux]{\l_fp_input_b_extended_int}
-% For internal use, `extended' floating point numbers are
-% needed.
-% \begin{macrocode}
-\int_new:N \l_fp_input_a_extended_int
-\int_new:N \l_fp_input_b_extended_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_mul_a_i_int}
-%\begin{macro}[aux]{\l_fp_mul_a_ii_int}
-%\begin{macro}[aux]{\l_fp_mul_a_iii_int}
-%\begin{macro}[aux]{\l_fp_mul_a_iv_int}
-%\begin{macro}[aux]{\l_fp_mul_a_v_int}
-%\begin{macro}[aux]{\l_fp_mul_a_vi_int}
-%\begin{macro}[aux]{\l_fp_mul_b_i_int}
-%\begin{macro}[aux]{\l_fp_mul_b_ii_int}
-%\begin{macro}[aux]{\l_fp_mul_b_iii_int}
-%\begin{macro}[aux]{\l_fp_mul_b_iv_int}
-%\begin{macro}[aux]{\l_fp_mul_b_v_int}
-%\begin{macro}[aux]{\l_fp_mul_b_vi_int}
-% Multiplication requires that the decimal part is split into parts
-% so that there are no overflows.
-% \begin{macrocode}
-\int_new:N \l_fp_mul_a_i_int
-\int_new:N \l_fp_mul_a_ii_int
-\int_new:N \l_fp_mul_a_iii_int
-\int_new:N \l_fp_mul_a_iv_int
-\int_new:N \l_fp_mul_a_v_int
-\int_new:N \l_fp_mul_a_vi_int
-\int_new:N \l_fp_mul_b_i_int
-\int_new:N \l_fp_mul_b_ii_int
-\int_new:N \l_fp_mul_b_iii_int
-\int_new:N \l_fp_mul_b_iv_int
-\int_new:N \l_fp_mul_b_v_int
-\int_new:N \l_fp_mul_b_vi_int
-% \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}
-%
-%\begin{macro}[aux]{\l_fp_mul_output_int}
-%\begin{macro}[aux]{\l_fp_mul_output_tl}
-% Space for multiplication results.
-% \begin{macrocode}
-\int_new:N \l_fp_mul_output_int
-\tl_new:N \l_fp_mul_output_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_output_sign_int}
-%\begin{macro}[aux]{\l_fp_output_integer_int}
-%\begin{macro}[aux]{\l_fp_output_decimal_int}
-%\begin{macro}[aux]{\l_fp_output_exponent_int}
-% Output is stored in the same way as input.
-% \begin{macrocode}
-\int_new:N \l_fp_output_sign_int
-\int_new:N \l_fp_output_integer_int
-\int_new:N \l_fp_output_decimal_int
-\int_new:N \l_fp_output_exponent_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_output_extended_int}
-% Again, for calculations an extended part.
-% \begin{macrocode}
-\int_new:N \l_fp_output_extended_int
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_round_carry_bool}
-% To indicate that a digit needs to be carried forward.
-% \begin{macrocode}
-\bool_new:N \l_fp_round_carry_bool
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_round_decimal_tl}
-% A temporary store when rounding, to build up the decimal part without
-% needing to do any maths.
-% \begin{macrocode}
-\tl_new:N \l_fp_round_decimal_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_round_position_int}
-%\begin{macro}[aux]{\l_fp_round_target_int}
-% Used to check the position for rounding.
-% \begin{macrocode}
-\int_new:N \l_fp_round_position_int
-\int_new:N \l_fp_round_target_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_sign_tl}
-% There are places where the sign needs to be set up `early',
-% so that the registers can be re-used.
-% \begin{macrocode}
-\tl_new:N \l_fp_sign_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_split_sign_int}
-% When splitting the input it is fastest to use a fixed name for the
-% sign part, and to transfer it after the split is complete.
-% \begin{macrocode}
-\int_new:N \l_fp_split_sign_int
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_tmp_int}
-% A scratch \texttt{int}: used only where the value is not carried
-% forward.
-% \begin{macrocode}
-\int_new:N \l_fp_tmp_int
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_tmp_tl}
-% A scratch token list variable for expanding material.
-% \begin{macrocode}
-\tl_new:N \l_fp_tmp_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_trig_octant_int}
-% To track which octant the trigonometric input is in.
-% \begin{macrocode}
-\int_new:N \l_fp_trig_octant_int
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\l_fp_trig_sign_int}
-%\begin{macro}[aux]{\l_fp_trig_decimal_int}
-%\begin{macro}[aux]{\l_fp_trig_extended_int}
-% Used for the calculation of trigonometric values.
-% \begin{macrocode}
-\int_new:N \l_fp_trig_sign_int
-\int_new:N \l_fp_trig_decimal_int
-\int_new:N \l_fp_trig_extended_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Parsing numbers}
-%
-%\begin{macro}{\fp_read:N}
-%\begin{macro}[aux]{\fp_read_aux:w}
-% Reading a stored value is made easier as the format is designed to
-% match the delimited function. This is always used to read the first
-% value (register "a").
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_read:N #1 {
- \tex_expandafter:D \fp_read_aux:w #1 \q_stop
-}
-\cs_new_protected_nopar:Npn \fp_read_aux:w #1#2 . #3 e #4 \q_stop {
- \tex_if:D #1 -
- \l_fp_input_a_sign_int \c_minus_one
- \tex_else:D
- \l_fp_input_a_sign_int \c_one
- \tex_fi:D
- \l_fp_input_a_integer_int #2 \scan_stop:
- \l_fp_input_a_decimal_int #3 \scan_stop:
- \l_fp_input_a_exponent_int #4 \scan_stop:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\fp_split:Nn}
-%\begin{macro}[aux]{\fp_split_sign:}
-%\begin{macro}[aux]{\fp_split_exponent:}
-%\begin{macro}[aux]{\fp_split_aux_i:w}
-%\begin{macro}[aux]{\fp_split_aux_ii:w}
-%\begin{macro}[aux]{\fp_split_aux_iii:w}
-%\begin{macro}[aux]{\fp_split_decimal:w}
-%\begin{macro}[aux]{\fp_split_decimal_aux:w}
-% The aim here is to use as much of \TeX's mechanism as possible to pick
-% up the numerical input without any mistakes. In particular, negative
-% numbers have to be filtered out first in case the integer part is
-% \( 0 \) (in which case \TeX\ would drop the "-" sign). That process
-% has to be done in a loop for cases where the sign is repeated.
-% Finding an exponent is relatively easy, after which the next phase is
-% to find the integer part, which will terminate with a ".", and trigger
-% the decimal-finding code. The later will allow the decimal to be too
-% long, truncating the result.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_split:Nn #1#2 {
- \tl_set:Nx \l_fp_tmp_tl {#2}
- \tl_set_rescan:Nno \l_fp_tmp_tl { \char_make_ignore:n { 32 } }
- { \l_fp_tmp_tl }
- \l_fp_split_sign_int \c_one
- \fp_split_sign:
- \use:c { l_fp_input_ #1 _sign_int } \l_fp_split_sign_int
- \tex_expandafter:D \fp_split_exponent:w \l_fp_tmp_tl e e \q_stop #1
-}
-\cs_new_protected_nopar:Npn \fp_split_sign: {
- \tex_ifnum:D \pdf_strcmp:D
- { \tex_expandafter:D \tl_head:w \l_fp_tmp_tl ? \q_stop } { - }
- = \c_zero
- \tl_set:Nx \l_fp_tmp_tl
- {
- \tex_expandafter:D
- \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_stop
- }
- \l_fp_split_sign_int -\l_fp_split_sign_int
- \tex_expandafter:D \fp_split_sign:
- \tex_else:D
- \tex_ifnum:D \pdf_strcmp:D
- { \tex_expandafter:D \tl_head:w \l_fp_tmp_tl ? \q_stop } { + }
- = \c_zero
- \tl_set:Nx \l_fp_tmp_tl
- {
- \tex_expandafter:D
- \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_stop
- }
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_split_sign:
- \tex_fi:D
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_split_exponent:w #1 e #2 e #3 \q_stop #4 {
- \use:c { l_fp_input_ #4 _exponent_int }
- \etex_numexpr:D 0 #2 \scan_stop:
- \tex_afterassignment:D \fp_split_aux_i:w
- \use:c { l_fp_input_ #4 _integer_int }
- \etex_numexpr:D 0 #1 . . \q_stop #4
-}
-\cs_new_protected_nopar:Npn \fp_split_aux_i:w #1 . #2 . #3 \q_stop {
- \fp_split_aux_ii:w #2 000000000 \q_stop
-}
-\cs_new_protected_nopar:Npn \fp_split_aux_ii:w #1#2#3#4#5#6#7#8#9 {
- \fp_split_aux_iii:w {#1#2#3#4#5#6#7#8#9}
-}
-\cs_new_protected_nopar:Npn \fp_split_aux_iii:w #1#2 \q_stop {
- \l_fp_tmp_int 1 #1 \scan_stop:
- \tex_expandafter:D \fp_split_decimal:w
- \int_use:N \l_fp_tmp_int 000000000 \q_stop
-}
-\cs_new_protected_nopar:Npn \fp_split_decimal:w #1#2#3#4#5#6#7#8#9 {
- \fp_split_decimal_aux:w {#2#3#4#5#6#7#8#9}
-}
-\cs_new_protected_nopar:Npn \fp_split_decimal_aux:w #1#2#3 \q_stop #4 {
- \use:c { l_fp_input_ #4 _decimal_int } #1#2 \scan_stop:
- \tex_ifnum:D
- \etex_numexpr:D
- \use:c { l_fp_input_ #4 _integer_int } +
- \use:c { l_fp_input_ #4 _decimal_int }
- \scan_stop:
- = \c_zero
- \use:c { l_fp_input_ #4 _sign_int } \c_one
- \tex_fi:D
- \tex_ifnum:D
- \use:c { l_fp_input_ #4 _integer_int } < \c_one_thousand_million
- \tex_else:D
- \tex_expandafter:D \fp_overflow_msg:
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\fp_standardise:NNNN}
-%\begin{macro}[aux]{\fp_standardise_aux:NNNN}
-%\begin{macro}[aux]{\fp_standardise_aux:}
-%\begin{macro}[aux]{\fp_standardise_aux:w}
-% The idea here is to shift the input into a known exponent range. This
-% is done using \TeX\ tokens where possible, as this is faster than
-% arithmetic.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_standardise:NNNN #1#2#3#4 {
- \tex_ifnum:D
- \etex_numexpr:D #2 + #3 = \c_zero
- #1 \c_one
- #4 \c_zero
- \tex_expandafter:D \use_none:nnnn
- \tex_else:D
- \tex_expandafter:D \fp_standardise_aux:NNNN
- \tex_fi:D
- #1#2#3#4
-}
-\cs_new_protected_nopar:Npn \fp_standardise_aux:NNNN #1#2#3#4 {
- \cs_set_protected_nopar:Npn \fp_standardise_aux:
- {
- \tex_ifnum:D #2 = \c_zero
- \tex_advance:D #3 \c_one_thousand_million
- \tex_expandafter:D \fp_standardise_aux:w
- \int_use:N #3 \q_stop
- \tex_expandafter:D \fp_standardise_aux:
- \tex_fi:D
- }
- \cs_set_protected_nopar:Npn
- \fp_standardise_aux:w ##1##2##3##4##5##6##7##8##9 \q_stop
- {
- #2 ##2 \scan_stop:
- #3 ##3##4##5##6##7##8##9 0 \scan_stop:
- \tex_advance:D #4 \c_minus_one
- }
- \fp_standardise_aux:
- \cs_set_protected_nopar:Npn \fp_standardise_aux:
- {
- \tex_ifnum:D #2 > \c_nine
- \tex_advance:D #2 \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_standardise_aux:w \int_use:N #2
- \tex_expandafter:D \fp_standardise_aux:
- \tex_fi:D
- }
- \cs_set_protected_nopar:Npn
- \fp_standardise_aux:w ##1##2##3##4##5##6##7##8##9
- {
- #2 ##1##2##3##4##5##6##7##8 \scan_stop:
- \tex_advance:D #3 \c_one_thousand_million
- \tex_divide:D #3 \c_ten
- \tl_set:Nx \l_fp_tmp_tl
- {
- ##9
- \tex_expandafter:D \use_none:n \int_use:N #3
- }
- #3 \l_fp_tmp_tl \scan_stop:
- \tex_advance:D #4 \c_one
- }
- \fp_standardise_aux:
- \tex_ifnum:D #4 < \c_one_hundred
- \tex_ifnum:D #4 > -\c_one_hundred
- \tex_else:D
- #1 \c_one
- #2 \c_zero
- #3 \c_zero
- #4 \c_zero
- \tex_fi:D
- \tex_else:D
- \tex_expandafter:D \fp_overflow_msg:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_standardise_aux: { }
-\cs_new_protected_nopar:Npn \fp_standardise_aux:w { }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Internal utilities}
-%
-%\begin{macro}{\fp_level_input_exponents:}
-%\begin{macro}[aux]{\fp_level_input_exponents_a:}
-%\begin{macro}[aux]{\fp_level_input_exponents_a:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_level_input_exponents_b:}
-%\begin{macro}[aux]{\fp_level_input_exponents_b:NNNNNNNNN}
-% The routines here are similar to those used to standardise the
-% exponent. However, the aim here is different: the two exponents need
-% to end up the same.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_level_input_exponents: {
- \tex_ifnum:D \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int
- \tex_expandafter:D \fp_level_input_exponents_a:
- \tex_else:D
- \tex_expandafter:D \fp_level_input_exponents_b:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_level_input_exponents_a: {
- \tex_ifnum:D \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int
- \tex_advance:D \l_fp_input_b_integer_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_level_input_exponents_a:NNNNNNNNN
- \int_use:N \l_fp_input_b_integer_int
- \tex_expandafter:D \fp_level_input_exponents_a:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_level_input_exponents_a:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \l_fp_input_b_integer_int #1#2#3#4#5#6#7#8 \scan_stop:
- \tex_advance:D \l_fp_input_b_decimal_int \c_one_thousand_million
- \tex_divide:D \l_fp_input_b_decimal_int \c_ten
- \tl_set:Nx \l_fp_tmp_tl
- {
- #9
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_b_decimal_int
- }
- \l_fp_input_b_decimal_int \l_fp_tmp_tl \scan_stop:
- \tex_advance:D \l_fp_input_b_exponent_int \c_one
-}
-\cs_new_protected_nopar:Npn \fp_level_input_exponents_b: {
- \tex_ifnum:D \l_fp_input_b_exponent_int > \l_fp_input_a_exponent_int
- \tex_advance:D \l_fp_input_a_integer_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_level_input_exponents_b:NNNNNNNNN
- \int_use:N \l_fp_input_a_integer_int
- \tex_expandafter:D \fp_level_input_exponents_b:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_level_input_exponents_b:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \l_fp_input_a_integer_int #1#2#3#4#5#6#7#8 \scan_stop:
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_divide:D \l_fp_input_a_decimal_int \c_ten
- \tl_set:Nx \l_fp_tmp_tl
- {
- #9
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- }
- \l_fp_input_a_decimal_int \l_fp_tmp_tl \scan_stop:
- \tex_advance:D \l_fp_input_a_exponent_int \c_one
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\fp_tmp:w}
-% Used for output of results, cutting down on \cs{tex_expandafter:D}.
-% This is just a place holder definition.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_tmp:w #1#2 { }
-% \end{macrocode}
-%\end{macro}
-%
-%\subsection{Operations for \texttt{fp} variables}
-%
-% The format of \texttt{fp} variables is tightly defined, so that
-% they can be read quickly by the internal code. The format is a single
-% sign token, a single number, the decimal point, nine decimal numbers,
-% an "e" and finally the exponent. This final part may vary in length.
-% When stored, floating points will always be stored with a value in
-% the integer position unless the number is zero.
-%
-%\begin{macro}{\fp_new:N, \fp_new:c}
-%\UnitTested
-% Fixed-points always have a value, and of course this has to be
-% initialised globally.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_new:N #1 {
- \tl_new:N #1
- \tl_gset_eq:NN #1 \c_zero_fp
-}
-\cs_generate_variant:Nn \fp_new:N { c }
-% \end{macrocode}
-%\end{macro}
-%
-%
-%\begin{macro}{\fp_const:Nn, \fp_const:cn}
-% A simple wrapper.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_const:Nn #1#2 {
- \cs_if_free:NTF #1
- {
- \fp_new:N #1
- \fp_gset:Nn #1 {#2}
- }
- {
- \msg_kernel_error:nx { variable-already-defined }
- { \token_to_str:N #1 }
- }
-}
-\cs_generate_variant:Nn \fp_const:Nn { c }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_zero:N, \fp_zero:c }
-%\UnitTested
-%\begin{macro}{\fp_gzero:N, \fp_gzero:c }
-%\UnitTested
-% Zeroing fixed-points is pretty obvious.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_zero:N #1 {
- \tl_set_eq:NN #1 \c_zero_fp
-}
-\cs_new_protected_nopar:Npn \fp_gzero:N #1 {
- \tl_gset_eq:NN #1 \c_zero_fp
-}
-\cs_generate_variant:Nn \fp_zero:N { c }
-\cs_generate_variant:Nn \fp_gzero:N { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\fp_set:Nn, \fp_set:cn}
-%\UnitTested
-%\begin{macro}{\fp_gset:Nn, \fp_gset:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_set_aux:NNn}
-% To trap any input errors, a very simple version of the parser is run
-% here. This will pick up any invalid characters at this stage, saving
-% issues later. The splitting approach is the same as the more
-% advanced function later.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_set:Nn {
- \fp_set_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gset:Nn {
- \fp_set_aux:NNn \tl_gset:Nn
-}
-\cs_new_protected_nopar:Npn \fp_set_aux:NNn #1#2#3 {
- \group_begin:
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- }
- \fp_tmp:w
-}
-\cs_generate_variant:Nn \fp_set:Nn { c }
-\cs_generate_variant:Nn \fp_gset:Nn { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\fp_set_from_dim:Nn, \fp_set_from_dim:cn}
-%\UnitTested
-%\begin{macro}{\fp_gset_from_dim:Nn, \fp_gset_from_dim:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_set_from_dim_aux:NNn}
-%\begin{macro}[aux]{\fp_set_from_dim_aux:w}
-%\begin{macro}[aux]{\l_fp_tmp_dim}
-%\begin{macro}[aux]{\l_fp_tmp_skip}
-% Here, dimensions are converted to fixed-points \emph{via} a
-% temporary variable. This ensures that they always convert as points.
-% The code is then essentially the same as for \cs{fp_set:Nn}, but with
-% the dimension passed so that it will be striped of the "pt" on the
-% way through. The passage through a skip is used to remove any rubber
-% part.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_set_from_dim:Nn {
- \fp_set_from_dim_aux:NNn \tl_set:Nx
-}
-\cs_new_protected_nopar:Npn \fp_gset_from_dim:Nn {
- \fp_set_from_dim_aux:NNn \tl_gset:Nx
-}
-\cs_new_protected_nopar:Npn \fp_set_from_dim_aux:NNn #1#2#3 {
- \group_begin:
- \l_fp_tmp_skip \etex_glueexpr:D #3 \scan_stop:
- \l_fp_tmp_dim \l_fp_tmp_skip
- \fp_split:Nn a
- {
- \tex_expandafter:D \fp_set_from_dim_aux:w
- \dim_use:N \l_fp_tmp_dim
- }
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- }
- \fp_tmp:w
-}
-\cs_set_protected_nopar:Npx \fp_set_from_dim_aux:w {
- \cs_set_nopar:Npn \exp_not:N \fp_set_from_dim_aux:w
- ##1 \tl_to_str:n { pt } {##1}
-}
-\fp_set_from_dim_aux:w
-\cs_generate_variant:Nn \fp_set_from_dim:Nn { c }
-\cs_generate_variant:Nn \fp_gset_from_dim:Nn { c }
-\dim_new:N \l_fp_tmp_dim
-\skip_new:N \l_fp_tmp_skip
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\fp_set_eq:NN, \fp_set_eq:cN,
-% \fp_set_eq:Nc, \fp_set_eq:cc}
-%\UnitTested
-%\begin{macro}{\fp_gset_eq:NN, \fp_gset_eq:cN,
-% \fp_gset_eq:Nc, \fp_gset_eq:cc}
-%\UnitTested
-% Pretty simple, really.
-% \begin{macrocode}
-\cs_new_eq:NN \fp_set_eq:NN \tl_set_eq:NN
-\cs_new_eq:NN \fp_set_eq:cN \tl_set_eq:cN
-\cs_new_eq:NN \fp_set_eq:Nc \tl_set_eq:Nc
-\cs_new_eq:NN \fp_set_eq:cc \tl_set_eq:cc
-\cs_new_eq:NN \fp_gset_eq:NN \tl_gset_eq:NN
-\cs_new_eq:NN \fp_gset_eq:cN \tl_gset_eq:cN
-\cs_new_eq:NN \fp_gset_eq:Nc \tl_gset_eq:Nc
-\cs_new_eq:NN \fp_gset_eq:cc \tl_gset_eq:cc
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\fp_show:N, \fp_show:c}
-%\UnitTested
-% Simple showing of the underlying variable.
-% \begin{macrocode}
-\cs_new_eq:NN \fp_show:N \tl_show:N
-\cs_new_eq:NN \fp_show:c \tl_show:c
-% \end{macrocode}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\fp_use:N, \fp_use:c}
-% \UnitTested
-%\begin{macro}[aux]{\fp_use_aux:w}
-%\begin{macro}[aux]{\fp_use_none:w}
-%\begin{macro}[aux]{\fp_use_small:w}
-%\begin{macro}[aux]{\fp_use_large:w}
-%\begin{macro}[aux]{\fp_use_large_aux_i:w}
-%\begin{macro}[aux]{\fp_use_large_aux_1:w}
-%\begin{macro}[aux]{\fp_use_large_aux_2:w}
-%\begin{macro}[aux]{\fp_use_large_aux_3:w}
-%\begin{macro}[aux]{\fp_use_large_aux_4:w}
-%\begin{macro}[aux]{\fp_use_large_aux_5:w}
-%\begin{macro}[aux]{\fp_use_large_aux_6:w}
-%\begin{macro}[aux]{\fp_use_large_aux_7:w}
-%\begin{macro}[aux]{\fp_use_large_aux_8:w}
-%\begin{macro}[aux]{\fp_use_large_aux_i:w}
-%\begin{macro}[aux]{\fp_use_large_aux_ii:w}
-% The idea of the \cs{fp_use:N} function to convert the stored
-% value into something suitable for \TeX\ to use as a number in an
-% expandable manner. The first step is to deal with the sign, then
-% work out how big the input is.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_use:N #1 {
- \tex_expandafter:D \fp_use_aux:w #1 \q_stop
-}
-\cs_generate_variant:Nn \fp_use:N { c }
-\cs_new_nopar:Npn \fp_use_aux:w #1#2 e #3 \q_stop {
- \tex_if:D #1 -
- -
- \tex_fi:D
- \tex_ifnum:D #3 > \c_zero
- \tex_expandafter:D \fp_use_large:w
- \tex_else:D
- \tex_ifnum:D #3 < \c_zero
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_use_small:w
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_use_none:w
- \tex_fi:D
- \tex_fi:D
- #2 e #3 \q_stop
-}
-% \end{macrocode}
-% When the exponent is zero, the input is simply returned as output.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_use_none:w #1 e #2 \q_stop {#1}
-% \end{macrocode}
-% For small numbers (less than \( 1 \)) the correct number of zeros
-% have to be inserted, but the decimal point is easy.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_use_small:w #1 . #2 e #3 \q_stop {
- 0 .
- \prg_replicate:nn { -#3 - 1 } { 0 }
- #1#2
-}
-% \end{macrocode}
-% Life is more complex for large numbers. The decimal point needs to
-% be shuffled, with potentially some zero-filling for very large values.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_use_large:w #1 . #2 e #3 \q_stop {
- \tex_ifnum:D #3 < \c_ten
- \tex_expandafter:D \fp_use_large_aux_i:w
- \tex_else:D
- \tex_expandafter:D \fp_use_large_aux_ii:w
- \tex_fi:D
- #1#2 e #3 \q_stop
-}
-\cs_new_nopar:Npn \fp_use_large_aux_i:w #1#2 e #3 \q_stop {
- #1
- \use:c { fp_use_large_aux_ #3 :w } #2 \q_stop
-}
-\cs_new_nopar:cpn { fp_use_large_aux_1:w } #1#2 \q_stop { #1 . #2 }
-\cs_new_nopar:cpn { fp_use_large_aux_2:w } #1#2#3 \q_stop {
- #1#2 . #3
-}
-\cs_new_nopar:cpn { fp_use_large_aux_3:w } #1#2#3#4 \q_stop {
- #1#2#3 . #4
-}
-\cs_new_nopar:cpn { fp_use_large_aux_4:w } #1#2#3#4#5 \q_stop {
- #1#2#3#4 . #5
-}
-\cs_new_nopar:cpn { fp_use_large_aux_5:w } #1#2#3#4#5#6 \q_stop {
- #1#2#3#4#5 . #6
-}
-\cs_new_nopar:cpn { fp_use_large_aux_6:w } #1#2#3#4#5#6#7 \q_stop {
- #1#2#3#4#5#6 . #7
-}
-\cs_new_nopar:cpn { fp_use_large_aux_7:w } #1#2#3#4#5#6#7#8 \q_stop {
- #1#2#3#4#6#7 . #8
-}
-\cs_new_nopar:cpn { fp_use_large_aux_8:w } #1#2#3#4#5#6#7#8#9 \q_stop {
- #1#2#3#4#5#6#7#8 . #9
-}
-\cs_new_nopar:cpn { fp_use_large_aux_9:w } #1 \q_stop { #1 . }
-\cs_new_nopar:Npn \fp_use_large_aux_ii:w #1 e #2 \q_stop {
- #1
- \prg_replicate:nn { #2 - 9 } { 0 }
- .
-}
-% \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}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Transferring to other types}
-%
-% The \cs{fp_use:N} function converts a floating point variable to
-% a form that can be used by \TeX. Here, the functions are slightly
-% different, as some information may be discarded.
-%
-%\begin{macro}{\fp_to_dim:N, \fp_to_dim:c}
-% A very simple wrapper.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_dim:N #1 { \fp_use:N #1 pt }
-\cs_generate_variant:Nn \fp_to_dim:N { c }
-% \end{macrocode}
-%\end{macro}
-%
-%
-%\begin{macro}{\fp_to_int:N, \fp_to_int:c}
-%\UnitTested
-%\begin{macro}[aux]{\fp_to_int_aux:w}
-%\begin{macro}[aux]{\fp_to_int_none:w}
-%\begin{macro}[aux]{\fp_to_int_small:w}
-%\begin{macro}[aux]{\fp_to_int_large:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_i:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_1:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_2:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_3:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_4:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_5:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_6:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_7:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_8:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux_i:w}
-%\begin{macro}[aux]{\fp_to_int_large_aux:nnn}
-%\begin{macro}[aux]{\fp_to_int_large_aux_ii:w}
-% Converting to integers in an expandable manner is very similar to
-% simply using floating point variables, particularly in the lead-off.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_int:N #1 {
- \tex_expandafter:D \fp_to_int_aux:w #1 \q_stop
-}
-\cs_generate_variant:Nn \fp_to_int:N { c }
-\cs_new_nopar:Npn \fp_to_int_aux:w #1#2 e #3 \q_stop {
- \tex_if:D #1 -
- -
- \tex_fi:D
- \tex_ifnum:D #3 < \c_zero
- \tex_expandafter:D \fp_to_int_small:w
- \tex_else:D
- \tex_expandafter:D \fp_to_int_large:w
- \tex_fi:D
- #2 e #3 \q_stop
-}
-% \end{macrocode}
-% For small numbers, if the decimal part is greater than a half then
-% there is rounding up to do.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_int_small:w #1 . #2 e #3 \q_stop {
- \tex_ifnum:D #3 > \c_one
- \tex_else:D
- \tex_ifnum:D #1 < \c_five
- 0
- \tex_else:D
- 1
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% For large numbers, the idea is to split off the part for rounding,
-% do the rounding and fill if needed.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_int_large:w #1 . #2 e #3 \q_stop {
- \tex_ifnum:D #3 < \c_ten
- \tex_expandafter:D \fp_to_int_large_aux_i:w
- \tex_else:D
- \tex_expandafter:D \fp_to_int_large_aux_ii:w
- \tex_fi:D
- #1#2 e #3 \q_stop
-}
-\cs_new_nopar:Npn \fp_to_int_large_aux_i:w #1#2 e #3 \q_stop {
- \use:c { fp_to_int_large_aux_ #3 :w } #2 \q_stop {#1}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_1:w } #1#2 \q_stop {
- \fp_to_int_large_aux:nnn { #2 0 } {#1}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_2:w } #1#2#3 \q_stop {
- \fp_to_int_large_aux:nnn { #3 00 } {#1#2}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_3:w } #1#2#3#4 \q_stop {
- \fp_to_int_large_aux:nnn { #4 000 } {#1#2#3}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_4:w } #1#2#3#4#5 \q_stop {
- \fp_to_int_large_aux:nnn { #5 0000 } {#1#2#3#4}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_5:w } #1#2#3#4#5#6 \q_stop {
- \fp_to_int_large_aux:nnn { #6 00000 } {#1#2#3#4#5}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_6:w } #1#2#3#4#5#6#7 \q_stop {
- \fp_to_int_large_aux:nnn { #7 000000 } {#1#2#3#4#5#6}
-}
-\cs_new_nopar:cpn
- { fp_to_int_large_aux_7:w } #1#2#3#4#5#6#7#8 \q_stop {
- \fp_to_int_large_aux:nnn { #8 0000000 } {#1#2#3#4#5#6#7}
-}
-\cs_new_nopar:cpn
- { fp_to_int_large_aux_8:w } #1#2#3#4#5#6#7#8#9 \q_stop {
- \fp_to_int_large_aux:nnn { #9 00000000 } {#1#2#3#4#5#6#7#8}
-}
-\cs_new_nopar:cpn { fp_to_int_large_aux_9:w } #1 \q_stop {#1}
-\cs_new_nopar:Npn \fp_to_int_large_aux:nnn #1#2#3 {
- \tex_ifnum:D #1 < \c_five_hundred_million
- #3#2
- \tex_else:D
- \tex_number:D \etex_numexpr:D #3#2 + 1 \scan_stop:
- \tex_fi:D
-}
-\cs_new_nopar:Npn \fp_to_int_large_aux_ii:w #1 e #2 \q_stop {
- #1
- \prg_replicate:nn { #2 - 9 } { 0 }
-}
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_to_tl:N, \fp_to_tl:c}
-%\UnitTested
-%\begin{macro}[aux]{\fp_to_tl_aux:w}
-%\begin{macro}[aux]{\fp_to_tl_large:w}
-%\begin{macro}[aux]{\fp_to_tl_large_aux_i:w}
-%\begin{macro}[aux]{\fp_to_tl_large_aux_ii:w}
-%\begin{macro}[aux]{\fp_to_tl_large_0:w}
-%\begin{macro}[aux]{\fp_to_tl_large_1:w}
-%\begin{macro}[aux]{\fp_to_tl_large_2:w}
-%\begin{macro}[aux]{\fp_to_tl_large_3:w}
-%\begin{macro}[aux]{\fp_to_tl_large_4:w}
-%\begin{macro}[aux]{\fp_to_tl_large_5:w}
-%\begin{macro}[aux]{\fp_to_tl_large_6:w}
-%\begin{macro}[aux]{\fp_to_tl_large_7:w}
-%\begin{macro}[aux]{\fp_to_tl_large_8:w}
-%\begin{macro}[aux]{\fp_to_tl_large_8_aux:w}
-%\begin{macro}[aux]{\fp_to_tl_large_9:w}
-%\begin{macro}[aux]{\fp_to_tl_small:w}
-%\begin{macro}[aux]{\fp_to_tl_small_one:w}
-%\begin{macro}[aux]{\fp_to_tl_small_two:w}
-%\begin{macro}[aux]{\fp_to_tl_small_aux:w}
-%\begin{macro}[aux]{\fp_to_tl_large_zeros:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_to_tl_small_zeros:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_use_iix_ix:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_use_ix:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_use_i_to_vii:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_use_i_to_iix:NNNNNNNNN}
-% Converting to integers in an expandable manner is very similar to
-% simply using floating point variables, particularly in the lead-off.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_tl:N #1 {
- \tex_expandafter:D \fp_to_tl_aux:w #1 \q_stop
-}
-\cs_generate_variant:Nn \fp_to_tl:N { c }
-\cs_new_nopar:Npn \fp_to_tl_aux:w #1#2 e #3 \q_stop {
- \tex_if:D #1 -
- -
- \tex_fi:D
- \tex_ifnum:D #3 < \c_zero
- \tex_expandafter:D \fp_to_tl_small:w
- \tex_else:D
- \tex_expandafter:D \fp_to_tl_large:w
- \tex_fi:D
- #2 e #3 \q_stop
-}
-% \end{macrocode}
-% For `large' numbers (exponent \( \ge 0 \)) there are two
-% cases. For very large exponents (\( \ge 10 \)) life is easy: apart
-% from dropping extra zeros there is no work to do. On the other hand,
-% for intermediate exponent values the decimal needs to be moved, then
-% zeros can be dropped.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_tl_large:w #1 e #2 \q_stop {
- \tex_ifnum:D #2 < \c_ten
- \tex_expandafter:D \fp_to_tl_large_aux_i:w
- \tex_else:D
- \tex_expandafter:D \fp_to_tl_large_aux_ii:w
- \tex_fi:D
- #1 e #2 \q_stop
-}
-\cs_new_nopar:Npn \fp_to_tl_large_aux_i:w #1 e #2 \q_stop {
- \use:c { fp_to_tl_large_ #2 :w } #1 \q_stop
-}
-\cs_new_nopar:Npn \fp_to_tl_large_aux_ii:w #1 . #2 e #3 \q_stop {
- #1
- \fp_to_tl_large_zeros:NNNNNNNNN #2
- e #3
-}
-\cs_new_nopar:cpn { fp_to_tl_large_0:w } #1 . #2 \q_stop {
- #1
- \fp_to_tl_large_zeros:NNNNNNNNN #2
-}
-\cs_new_nopar:cpn { fp_to_tl_large_1:w } #1 . #2#3 \q_stop {
- #1#2
- \fp_to_tl_large_zeros:NNNNNNNNN #3 0
-}
-\cs_new_nopar:cpn { fp_to_tl_large_2:w } #1 . #2#3#4 \q_stop {
- #1#2#3
- \fp_to_tl_large_zeros:NNNNNNNNN #4 00
-}
-\cs_new_nopar:cpn { fp_to_tl_large_3:w } #1 . #2#3#4#5 \q_stop {
- #1#2#3#4
- \fp_to_tl_large_zeros:NNNNNNNNN #5 000
-}
-\cs_new_nopar:cpn { fp_to_tl_large_4:w } #1 . #2#3#4#5#6 \q_stop {
- #1#2#3#4#5
- \fp_to_tl_large_zeros:NNNNNNNNN #6 0000
-}
-\cs_new_nopar:cpn { fp_to_tl_large_5:w } #1 . #2#3#4#5#6#7 \q_stop {
- #1#2#3#4#5#6
- \fp_to_tl_large_zeros:NNNNNNNNN #7 00000
-}
-\cs_new_nopar:cpn { fp_to_tl_large_6:w } #1 . #2#3#4#5#6#7#8 \q_stop {
- #1#2#3#4#5#6#7
- \fp_to_tl_large_zeros:NNNNNNNNN #8 000000
-}
-\cs_new_nopar:cpn { fp_to_tl_large_7:w } #1 . #2#3#4#5#6#7#8#9 \q_stop {
- #1#2#3#4#5#6#7#8
- \fp_to_tl_large_zeros:NNNNNNNNN #9 0000000
-}
-\cs_new_nopar:cpn { fp_to_tl_large_8:w } #1 . {
- #1
- \use:c { fp_to_tl_large_8_aux:w }
-}
-\cs_new_nopar:cpn
- { fp_to_tl_large_8_aux:w } #1#2#3#4#5#6#7#8#9 \q_stop {
- #1#2#3#4#5#6#7#8
- \fp_to_tl_large_zeros:NNNNNNNNN #9 00000000
-}
-\cs_new_nopar:cpn { fp_to_tl_large_9:w } #1 . #2 \q_stop {#1#2}
-% \end{macrocode}
-% Dealing with small numbers is a bit more complex as there has to be
-% rounding. This makes life rather awkward, as there need to be a series
-% of tests and calculations, as things cannot be stored in an
-% expandable system.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_tl_small:w #1 e #2 \q_stop {
- \tex_ifnum:D #2 = \c_minus_one
- \tex_expandafter:D \fp_to_tl_small_one:w
- \tex_else:D
- \tex_ifnum:D #2 = -\c_two
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_to_tl_small_two:w
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_to_tl_small_aux:w
- \tex_fi:D
- \tex_fi:D
- #1 e #2 \q_stop
-}
-\cs_new_nopar:Npn \fp_to_tl_small_one:w #1 . #2 e #3 \q_stop {
- \tex_ifnum:D \fp_use_ix:NNNNNNNNN #2 > \c_four
- \tex_ifnum:D
- \etex_numexpr:D #1 \fp_use_i_to_iix:NNNNNNNNN #2 + 1
- < \c_one_thousand_million
- 0.
- \tex_expandafter:D \fp_to_tl_small_zeros:NNNNNNNNN
- \tex_number:D
- \etex_numexpr:D
- #1 \fp_use_i_to_iix:NNNNNNNNN #2 + 1
- \scan_stop:
- \tex_else:D
- 1
- \tex_fi:D
- \tex_else:D
- 0. #1
- \fp_to_tl_small_zeros:NNNNNNNNN #2
- \tex_fi:D
-}
-\cs_new_nopar:Npn \fp_to_tl_small_two:w #1 . #2 e #3 \q_stop {
- \tex_ifnum:D \fp_use_iix_ix:NNNNNNNNN #2 > \c_forty_four
- \tex_ifnum:D
- \etex_numexpr:D #1 \fp_use_i_to_vii:NNNNNNNNN #2 0 + \c_ten
- < \c_one_thousand_million
- 0.0
- \tex_expandafter:D \fp_to_tl_small_zeros:NNNNNNNNN
- \tex_number:D
- \etex_numexpr:D
- #1 \fp_use_i_to_vii:NNNNNNNNN #2 0 + \c_ten
- \scan_stop:
- \tex_else:D
- 0.1
- \tex_fi:D
- \tex_else:D
- 0.0
- #1
- \fp_to_tl_small_zeros:NNNNNNNNN #2
- \tex_fi:D
-}
-\cs_new_nopar:Npn \fp_to_tl_small_aux:w #1 . #2 e #3 \q_stop {
- #1
- \fp_to_tl_large_zeros:NNNNNNNNN #2
- e #3
-}
-% \end{macrocode}
-% Rather than a complex recursion, the tests for finding trailing zeros
-% are written out long-hand. The difference between the two is only the
-% need for a decimal marker.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_to_tl_large_zeros:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \tex_ifnum:D #9 = \c_zero
- \tex_ifnum:D #8 = \c_zero
- \tex_ifnum:D #7 = \c_zero
- \tex_ifnum:D #6 = \c_zero
- \tex_ifnum:D #5 = \c_zero
- \tex_ifnum:D #4 = \c_zero
- \tex_ifnum:D #3 = \c_zero
- \tex_ifnum:D #2 = \c_zero
- \tex_ifnum:D #1 = \c_zero
- \tex_else:D
- . #1
- \tex_fi:D
- \tex_else:D
- . #1#2
- \tex_fi:D
- \tex_else:D
- . #1#2#3
- \tex_fi:D
- \tex_else:D
- . #1#2#3#4
- \tex_fi:D
- \tex_else:D
- . #1#2#3#4#5
- \tex_fi:D
- \tex_else:D
- . #1#2#3#4#5#6
- \tex_fi:D
- \tex_else:D
- . #1#2#3#4#5#6#7
- \tex_fi:D
- \tex_else:D
- . #1#2#3#4#5#6#7#8
- \tex_fi:D
- \tex_else:D
- . #1#2#3#4#5#6#7#8#9
- \tex_fi:D
-}
-\cs_new_nopar:Npn \fp_to_tl_small_zeros:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \tex_ifnum:D #9 = \c_zero
- \tex_ifnum:D #8 = \c_zero
- \tex_ifnum:D #7 = \c_zero
- \tex_ifnum:D #6 = \c_zero
- \tex_ifnum:D #5 = \c_zero
- \tex_ifnum:D #4 = \c_zero
- \tex_ifnum:D #3 = \c_zero
- \tex_ifnum:D #2 = \c_zero
- \tex_ifnum:D #1 = \c_zero
- \tex_else:D
- #1
- \tex_fi:D
- \tex_else:D
- #1#2
- \tex_fi:D
- \tex_else:D
- #1#2#3
- \tex_fi:D
- \tex_else:D
- #1#2#3#4
- \tex_fi:D
- \tex_else:D
- #1#2#3#4#5
- \tex_fi:D
- \tex_else:D
- #1#2#3#4#5#6
- \tex_fi:D
- \tex_else:D
- #1#2#3#4#5#6#7
- \tex_fi:D
- \tex_else:D
- #1#2#3#4#5#6#7#8
- \tex_fi:D
- \tex_else:D
- #1#2#3#4#5#6#7#8#9
- \tex_fi:D
-}
-% \end{macrocode}
-% Some quick `return a few' functions.
-% \begin{macrocode}
-\cs_new_nopar:Npn \fp_use_iix_ix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {#8#9}
-\cs_new_nopar:Npn \fp_use_ix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {#9}
-\cs_new_nopar:Npn \fp_use_i_to_vii:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- #1#2#3#4#5#6#7
-}
-\cs_new_nopar:Npn \fp_use_i_to_iix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- #1#2#3#4#5#6#7#8
-}
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Rounding numbers}
-%
-% The results may well need to be rounded. A couple of related functions
-% to do this for a stored value.
-%
-%
-%\begin{macro}{\fp_round_figures:Nn, \fp_round_figures:cn}
-%\UnitTested
-%\begin{macro}{\fp_ground_figures:Nn, \fp_ground_figures:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_round_figures_aux:NNn}
-% Rounding to figures needs only an adjustment to the target by one
-% (as the target is in decimal places).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_round_figures:Nn {
- \fp_round_figures_aux:NNn \tl_set:Nn
-}
-\cs_generate_variant:Nn \fp_round_figures:Nn { c }
-\cs_new_protected_nopar:Npn \fp_ground_figures:Nn {
- \fp_round_figures_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_ground_figures:Nn { c }
-\cs_new_protected_nopar:Npn \fp_round_figures_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \int_set:Nn \l_fp_round_target_int { #3 - 1 }
- \tex_ifnum:D \l_fp_round_target_int < \c_ten
- \tex_expandafter:D \fp_round:
- \tex_fi:D
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- }
- \fp_tmp:w
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\fp_round_places:Nn, \fp_round_places:cn}
-%\UnitTested
-%\begin{macro}{\fp_ground_places:Nn, \fp_ground_places:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_round_places_aux:NNn}
-% Rounding to places needs an adjustment for the exponent value, which
-% will mean that everything should be correct.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_round_places:Nn {
- \fp_round_places_aux:NNn \tl_set:Nn
-}
-\cs_generate_variant:Nn \fp_round_places:Nn { c }
-\cs_new_protected_nopar:Npn \fp_ground_places:Nn {
- \fp_round_places_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_ground_places:Nn { c }
-\cs_new_protected_nopar:Npn \fp_round_places_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \int_set:Nn \l_fp_round_target_int
- { #3 + \l_fp_input_a_exponent_int }
- \tex_ifnum:D \l_fp_round_target_int < \c_ten
- \tex_expandafter:D \fp_round:
- \tex_fi:D
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- }
- \fp_tmp:w
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\fp_round:}
-%\begin{macro}[aux]{\fp_round_aux:NNNNNNNNN}
-%\begin{macro}{\fp_round_loop:N}
-% The rounding approach is the same for decimal places and significant
-% figures. There are always nine decimal digits to round, so the code
-% can be written to account for this. The basic logic is simply to
-% find the rounding, track any carry digit and move along. At the end
-% of the loop there is a possible shuffle if the integer part has
-% become \( 10 \).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_round: {
- \bool_set_false:N \l_fp_round_carry_bool
- \l_fp_round_position_int \c_eight
- \tl_clear:N \l_fp_round_decimal_tl
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_round_aux:NNNNNNNNN \int_use:N \l_fp_input_a_decimal_int
-}
-\cs_new_protected_nopar:Npn \fp_round_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \fp_round_loop:N #9#8#7#6#5#4#3#2#1
- \bool_if:NT \l_fp_round_carry_bool
- { \tex_advance:D \l_fp_input_a_integer_int \c_one }
- \l_fp_input_a_decimal_int \l_fp_round_decimal_tl \scan_stop:
- \tex_ifnum:D \l_fp_input_a_integer_int < \c_ten
- \tex_else:D
- \l_fp_input_a_integer_int \c_one
- \tex_divide:D \l_fp_input_a_decimal_int \c_ten
- \tex_advance:D \l_fp_input_a_exponent_int \c_one
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_round_loop:N #1 {
- \tex_ifnum:D \l_fp_round_position_int < \l_fp_round_target_int
- \bool_if:NTF \l_fp_round_carry_bool
- { \l_fp_tmp_int \etex_numexpr:D #1 + \c_one \scan_stop: }
- { \l_fp_tmp_int \etex_numexpr:D #1 \scan_stop: }
- \tex_ifnum:D \l_fp_tmp_int = \c_ten
- \l_fp_tmp_int \c_zero
- \tex_else:D
- \bool_set_false:N \l_fp_round_carry_bool
- \tex_fi:D
- \tl_set:Nx \l_fp_round_decimal_tl
- { \int_use:N \l_fp_tmp_int \l_fp_round_decimal_tl }
- \tex_else:D
- \tl_set:Nx \l_fp_round_decimal_tl { 0 \l_fp_round_decimal_tl }
- \tex_ifnum:D \l_fp_round_position_int = \l_fp_round_target_int
- \tex_ifnum:D #1 > \c_four
- \bool_set_true:N \l_fp_round_carry_bool
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
- \tex_advance:D \l_fp_round_position_int \c_minus_one
- \tex_ifnum:D \l_fp_round_position_int > \c_minus_one
- \tex_expandafter:D \fp_round_loop:N
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\subsection{Unary functions}
-%
-%\begin{macro}{\fp_abs:N, \fp_abs:c}
-%\UnitTested
-%\begin{macro}{\fp_gabs:N, \fp_gabs:c}
-%\UnitTested
-%\begin{macro}[aux]{\fp_abs_aux:NN}
-% Setting the absolute value is easy: read the value, ignore the sign,
-% return the result.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_abs:N {
- \fp_abs_aux:NN \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gabs:N {
- \fp_abs_aux:NN \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_abs:N { c }
-\cs_generate_variant:Nn \fp_gabs:N { c }
-\cs_new_protected_nopar:Npn \fp_abs_aux:NN #1#2 {
- \group_begin:
- \fp_read:N #2
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- +
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- }
- \fp_tmp:w
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\fp_neg:N, \fp_neg:c}
-%\UnitTested
-%\begin{macro}{\fp_gneg:N, \fp_gneg:c}
-%\UnitTested
-%\begin{macro}[aux]{\fp_neg:NN}
-% Just a bit more complex: read the input, reverse the sign and
-% output the result.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_neg:N {
- \fp_neg_aux:NN \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gneg:N {
- \fp_neg_aux:NN \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_neg:N { c }
-\cs_generate_variant:Nn \fp_gneg:N { c }
-\cs_new_protected_nopar:Npn \fp_neg_aux:NN #1#2 {
- \group_begin:
- \fp_read:N #2
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tl_set:Nx \l_fp_tmp_tl
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_input_a_decimal_int
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- \tex_expandafter:D \group_end: \tex_expandafter:D
- #1 \tex_expandafter:D #2 \tex_expandafter:D { \l_fp_tmp_tl }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\subsection{Basic arithmetic}
-%
-%\begin{macro}{\fp_add:Nn, \fp_add:cn}
-%\UnitTested
-%\begin{macro}{\fp_gadd:Nn,\fp_gadd:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_add_aux:NNn}
-%\begin{macro}[aux]{\fp_add_core:}
-%\begin{macro}[aux]{\fp_add_sum:}
-%\begin{macro}[aux]{\fp_add_difference:}
-% The various addition functions are simply different ways to call the
-% single master function below. This pattern is repeated for the
-% other arithmetic functions.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_add:Nn {
- \fp_add_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gadd:Nn {
- \fp_add_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_add:Nn { c }
-\cs_generate_variant:Nn \fp_gadd:Nn { c }
-% \end{macrocode}
-% Addition takes place using one of two paths. If the signs of the
-% two parts are the same, they are simply combined. On the other
-% hand, if the signs are different the calculation finds this
-% difference.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_add_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \fp_split:Nn b {#3}
- \fp_standardise:NNNN
- \l_fp_input_b_sign_int
- \l_fp_input_b_integer_int
- \l_fp_input_b_decimal_int
- \l_fp_input_b_exponent_int
- \fp_add_core:
- \fp_tmp:w #1#2
-}
-\cs_new_protected_nopar:Npn \fp_add_core: {
- \fp_level_input_exponents:
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_sign_int * \l_fp_input_b_sign_int
- \scan_stop:
- > \c_zero
- \tex_expandafter:D \fp_add_sum:
- \tex_else:D
- \tex_expandafter:D \fp_add_difference:
- \tex_fi:D
- \l_fp_output_exponent_int \l_fp_input_a_exponent_int
- \fp_standardise:NNNN
- \l_fp_output_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2
- {
- \tex_ifnum:D \l_fp_output_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_output_exponent_int
- }
- }
-}
-% \end{macrocode}
-% Finding the sum of two numbers is trivially easy.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_add_sum: {
- \l_fp_output_sign_int \l_fp_input_a_sign_int
- \l_fp_output_integer_int
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_b_integer_int
- \scan_stop:
- \l_fp_output_decimal_int
- \etex_numexpr:D
- \l_fp_input_a_decimal_int + \l_fp_input_b_decimal_int
- \scan_stop:
- \tex_ifnum:D \l_fp_output_decimal_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_output_integer_int \c_one
- \tex_advance:D \l_fp_output_decimal_int -\c_one_thousand_million
- \tex_fi:D
-}
-% \end{macrocode}
-% When the signs of the two parts of the input are different, the
-% absolute difference is worked out first. There is then a calculation
-% to see which way around everything has worked out, so that the final
-% sign is correct. The difference might also give a zero result with
-% a negative sign, which is reversed as zero is regarded as positive.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_add_difference: {
- \l_fp_output_integer_int
- \etex_numexpr:D
- \l_fp_input_a_integer_int - \l_fp_input_b_integer_int
- \scan_stop:
- \l_fp_output_decimal_int
- \etex_numexpr:D
- \l_fp_input_a_decimal_int - \l_fp_input_b_decimal_int
- \scan_stop:
- \tex_ifnum:D \l_fp_output_decimal_int < \c_zero
- \tex_advance:D \l_fp_output_integer_int \c_minus_one
- \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_output_integer_int < \c_zero
- \l_fp_output_sign_int \l_fp_input_b_sign_int
- \tex_ifnum:D \l_fp_output_decimal_int = \c_zero
- \l_fp_output_integer_int -\l_fp_output_integer_int
- \tex_else:D
- \l_fp_output_decimal_int
- \etex_numexpr:D
- \c_one_thousand_million - \l_fp_output_decimal_int
- \scan_stop:
- \l_fp_output_integer_int
- \etex_numexpr:D
- - \l_fp_output_integer_int - \c_one
- \scan_stop:
- \tex_fi:D
- \tex_else:D
- \l_fp_output_sign_int \l_fp_input_a_sign_int
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\fp_sub:Nn, \fp_sub:cn}
-%\UnitTested
-%\begin{macro}{\fp_gsub:Nn,\fp_gsub:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_sub_aux:NNn}
-% Subtraction is essentially the same as addition, but with the sign
-% of the second component reversed. Thus the core of the two function
-% groups is the same, with just a little set up here.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_sub:Nn {
- \fp_sub_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gsub:Nn {
- \fp_sub_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_sub:Nn { c }
-\cs_generate_variant:Nn \fp_gsub:Nn { c }
-\cs_new_protected_nopar:Npn \fp_sub_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \fp_split:Nn b {#3}
- \fp_standardise:NNNN
- \l_fp_input_b_sign_int
- \l_fp_input_b_integer_int
- \l_fp_input_b_decimal_int
- \l_fp_input_b_exponent_int
- \tex_multiply:D \l_fp_input_b_sign_int \c_minus_one
- \fp_add_core:
- \fp_tmp:w #1#2
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_mul:Nn, \fp_mul:cn}
-%\UnitTested
-%\begin{macro}{\fp_gmul:Nn,\fp_gmul:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_mul_aux:NNn}
-%\begin{macro}[aux]{\fp_mul_internal:}
-%\begin{macro}[aux]{\fp_mul_split:NNNN}
-%\begin{macro}[aux]{\fp_mul_split:w}
-%\begin{macro}[aux]{\fp_mul_end_level:}
-%\begin{macro}[aux]{\fp_mul_end_level:NNNNNNNNN}
-% The pattern is much the same for multiplication.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul:Nn {
- \fp_mul_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gmul:Nn {
- \fp_mul_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_mul:Nn { c }
-\cs_generate_variant:Nn \fp_gmul:Nn { c }
-% \end{macrocode}
-% The approach to multiplication is as follows. First, the two numbers
-% are split into blocks of three digits. These are then multiplied
-% together to find products for each group of three output digits. This
-% is al written out in full for speed reasons. Between each block of
-% three digits in the output, there is a carry step. The very lowest
-% digits are not calculated, while
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \fp_split:Nn b {#3}
- \fp_standardise:NNNN
- \l_fp_input_b_sign_int
- \l_fp_input_b_integer_int
- \l_fp_input_b_decimal_int
- \l_fp_input_b_exponent_int
- \fp_mul_internal:
- \l_fp_output_exponent_int
- \etex_numexpr:D
- \l_fp_input_a_exponent_int + \l_fp_input_b_exponent_int
- \scan_stop:
- \fp_standardise:NNNN
- \l_fp_output_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_sign_int * \l_fp_input_b_sign_int
- < \c_zero
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_output_integer_int + \l_fp_output_decimal_int
- = \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_output_exponent_int
- }
- }
- \fp_tmp:w
-}
-% \end{macrocode}
-% Done separately so that the internal use is a bit easier.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul_internal: {
- \fp_mul_split:NNNN \l_fp_input_a_decimal_int
- \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int
- \fp_mul_split:NNNN \l_fp_input_b_decimal_int
- \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int
- \l_fp_mul_output_int \c_zero
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int
- \tex_divide:D \l_fp_mul_output_int \c_one_thousand
- \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_input_b_integer_int
- \fp_mul_end_level:
- \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_input_b_integer_int
- \fp_mul_end_level:
- \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_input_b_integer_int
- \fp_mul_end_level:
- \l_fp_output_decimal_int 0 \l_fp_mul_output_tl \scan_stop:
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_input_b_integer_int
- \fp_mul_end_level:
- \l_fp_output_integer_int 0 \l_fp_mul_output_tl \scan_stop:
-}
-% \end{macrocode}
-% The split works by making a \( 10 \) digit number, from which
-% the first digit can then be dropped using a delimited argument. The
-% groups of three digits are then assigned to the various parts of
-% the input: notice that "##9" contains the last two digits of the
-% smallest part of the input.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul_split:NNNN #1#2#3#4 {
- \tex_advance:D #1 \c_one_thousand_million
- \cs_set_protected_nopar:Npn \fp_mul_split_aux:w
- ##1##2##3##4##5##6##7##8##9 \q_stop {
- #2 ##2##3##4 \scan_stop:
- #3 ##5##6##7 \scan_stop:
- #4 ##8##9 \scan_stop:
- }
- \tex_expandafter:D \fp_mul_split_aux:w \int_use:N #1 \q_stop
- \tex_advance:D #1 -\c_one_thousand_million
-}
-\cs_new_protected_nopar:Npn \fp_mul_product:NN #1#2 {
- \l_fp_mul_output_int
- \etex_numexpr:D \l_fp_mul_output_int + #1 * #2 \scan_stop:
-}
-% \end{macrocode}
-% At the end of each output group of three, there is a transfer of
-% information so that there is no danger of an overflow. This is done by
-% expansion to keep the number of calculations down.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul_end_level: {
- \tex_advance:D \l_fp_mul_output_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_mul_end_level:NNNNNNNNN \int_use:N \l_fp_mul_output_int
-}
-\cs_new_protected_nopar:Npn \fp_mul_end_level:NNNNNNNNN
- #1#2#3#4#5#6#7#8#9 {
- \tl_set:Nx \l_fp_mul_output_tl { #7#8#9 \l_fp_mul_output_tl }
- \l_fp_mul_output_int #1#2#3#4#5#6 \scan_stop:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_div:Nn, \fp_div:cn}
-%\UnitTested
-%\begin{macro}{\fp_gdiv:Nn,\fp_gdiv:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_div_aux:NNn}
-%\begin{macro}{\fp_div_internal:}
-%\begin{macro}[aux]{\fp_div_loop:}
-%\begin{macro}[aux]{\fp_div_divide:}
-%\begin{macro}[aux]{\fp_div_divide_aux:}
-%\begin{macro}[aux]{\fp_div_store:}
-%\begin{macro}[aux]{\fp_div_store_integer:}
-%\begin{macro}[aux]{\fp_div_store_decimal:}
-% The pattern is much the same for multiplication.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div:Nn {
- \fp_div_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gdiv:Nn {
- \fp_div_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_div:Nn { c }
-\cs_generate_variant:Nn \fp_gdiv:Nn { c }
-% \end{macrocode}
-% Division proper starts with a couple of tests. If the denominator is
-% zero then a error is issued. On the other hand, if the numerator is
-% zero then the result must be \( 0.0 \) and can be given with no
-% further work.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \fp_split:Nn b {#3}
- \fp_standardise:NNNN
- \l_fp_input_b_sign_int
- \l_fp_input_b_integer_int
- \l_fp_input_b_decimal_int
- \l_fp_input_b_exponent_int
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int
- = \c_zero
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- #1 \exp_not:N #2 { \c_undefined_fp }
- }
- \tex_else:D
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int
- = \c_zero
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- #1 \exp_not:N #2 { \c_zero_fp }
- }
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_div_internal:
- \tex_fi:D
- \tex_fi:D
- \fp_tmp:w #1#2
-}
-% \end{macrocode}
-% The main division algorithm works by finding how many times "b" can
-% be removed from "a", storing the result and doing the subtraction.
-% Input "a" is then multiplied by \( 10 \), and the process is repeated.
-% The looping ends either when there is nothing left of "a"
-% (\emph{i.e.}~an exact result) or when the code reaches the ninth
-% decimal place. Most of the process takes place in the loop function
-% below.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div_internal: {
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \c_zero
- \cs_set_eq:NN \fp_div_store: \fp_div_store_integer:
- \l_fp_div_offset_int \c_one_hundred_million
- \fp_div_loop:
- \l_fp_output_exponent_int
- \etex_numexpr:D
- \l_fp_input_a_exponent_int - \l_fp_input_b_exponent_int
- \scan_stop:
- \fp_standardise:NNNN
- \l_fp_output_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2
- {
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_sign_int * \l_fp_input_b_sign_int
- < \c_zero
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_output_integer_int + \l_fp_output_decimal_int
- = \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
- }
-}
-% \end{macrocode}
-% The main loop implements the approach described above. The storing
-% function is done as a function so that the integer and decimal parts
-% can be done separately but rapidly.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div_loop: {
- \l_fp_count_int \c_zero
- \fp_div_divide:
- \fp_div_store:
- \tex_multiply:D \l_fp_input_a_integer_int \c_ten
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_expandafter:D \fp_div_loop_step:w
- \int_use:N \l_fp_input_a_decimal_int \q_stop
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int
- > \c_zero
- \tex_ifnum:D \l_fp_div_offset_int > \c_zero
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_div_loop:
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% Checking to see if the numerator can be divides needs quite an
-% involved check. Either the integer part has to be bigger for the
-% numerator or, if it is not smaller then the decimal part of the
-% numerator must not be smaller than that of the denominator. Once
-% the test is right the rest is much as elsewhere.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div_divide: {
- \tex_ifnum:D \l_fp_input_a_integer_int > \l_fp_input_b_integer_int
- \tex_expandafter:D \fp_div_divide_aux:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_integer_int < \l_fp_input_b_integer_int
- \tex_else:D
- \tex_ifnum:D
- \l_fp_input_a_decimal_int < \l_fp_input_b_decimal_int
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_div_divide_aux:
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_div_divide_aux: {
- \tex_advance:D \l_fp_count_int \c_one
- \tex_advance:D \l_fp_input_a_integer_int -\l_fp_input_b_integer_int
- \tex_advance:D \l_fp_input_a_decimal_int -\l_fp_input_b_decimal_int
- \tex_ifnum:D \l_fp_input_a_decimal_int < \c_zero
- \tex_advance:D \l_fp_input_a_integer_int \c_minus_one
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_fi:D
- \fp_div_divide:
-}
-% \end{macrocode}
-% Storing the number of each division is done differently for the
-% integer and decimal. The integer is easy and a one-off, while the
-% decimal also needs to account for the position of the digit to store.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div_store: { }
-\cs_new_protected_nopar:Npn \fp_div_store_integer: {
- \l_fp_output_integer_int \l_fp_count_int
- \cs_set_eq:NN \fp_div_store: \fp_div_store_decimal:
-}
-\cs_new_protected_nopar:Npn \fp_div_store_decimal: {
- \l_fp_output_decimal_int
- \etex_numexpr:D
- \l_fp_output_decimal_int +
- \l_fp_count_int * \l_fp_div_offset_int
- \scan_stop:
- \tex_divide:D \l_fp_div_offset_int \c_ten
-}
-\cs_new_protected_nopar:Npn
- \fp_div_loop_step:w #1#2#3#4#5#6#7#8#9 \q_stop {
- \l_fp_input_a_integer_int
- \etex_numexpr:D
- #2 + \l_fp_input_a_integer_int
- \scan_stop:
- \l_fp_input_a_decimal_int #3#4#5#6#7#8#9 0 \scan_stop:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%\subsection{Arithmetic for internal use}
-%
-% For the more complex functions, it is only possible to deliver
-% reliable \( 10 \) digit accuracy if the internal calculations are
-% carried out to a higher degree of precision. This is done using a
-% second set of functions so that the `user' versions are not
-% slowed down. These versions are also focussed on the needs of internal
-% calculations. No error checking, sign checking or exponent levelling
-% is done. For addition and subtraction, the arguments are:
-% \begin{itemize}
-% \item Integer part of input "a".
-% \item Decimal part of input "a".
-% \item Additional decimal part of input "a".
-% \item Integer part of input "b".
-% \item Decimal part of input "b".
-% \item Additional decimal part of input "b".
-% \item Integer part of output.
-% \item Decimal part of output.
-% \item Additional decimal part of output.
-% \end{itemize}
-% The situation for multiplication and division is a little different as
-% they only deal with the decimal part.
-%
-%\begin{macro}{\fp_add:NNNNNNNNN}
-% The internal sum is always exactly that: it is always a sum and there
-% is no sign check.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_add:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- #7 \etex_numexpr:D #1 + #4 \scan_stop:
- #8 \etex_numexpr:D #2 + #5 \scan_stop:
- #9 \etex_numexpr:D #3 + #6 \scan_stop:
- \tex_ifnum:D #9 < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D #8 \c_one
- \tex_advance:D #9 -\c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D #8 < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D #7 \c_one
- \tex_advance:D #8 -\c_one_thousand_million
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_sub:NNNNNNNNN}
-% Internal subtraction is needed only when the first number is bigger
-% than the second, so there is no need to worry about the sign. This is
-% a good job as there are no arguments left. The flipping flag is
-% used in the rare case where a sign change is possible.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_sub:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- #7 \etex_numexpr:D #1 - #4 \scan_stop:
- #8 \etex_numexpr:D #2 - #5 \scan_stop:
- #9 \etex_numexpr:D #3 - #6 \scan_stop:
- \tex_ifnum:D #9 < \c_zero
- \tex_advance:D #8 \c_minus_one
- \tex_advance:D #9 \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D #8 < \c_zero
- \tex_advance:D #7 \c_minus_one
- \tex_advance:D #8 \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D #7 < \c_zero
- \tex_ifnum:D \etex_numexpr:D #8 + #9 = \c_zero
- #7 -#7
- \tex_else:D
- \tex_advance:D #7 \c_one
- #8 \etex_numexpr:D \c_one_thousand_million - #8 \scan_stop:
- #9 \etex_numexpr:D \c_one_thousand_million - #9 \scan_stop:
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_mul:NNNNNN}
-% Decimal-part only multiplication but with higher accuracy than the
-% user version.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul:NNNNNN #1#2#3#4#5#6 {
- \fp_mul_split:NNNN #1
- \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int
- \fp_mul_split:NNNN #2
- \l_fp_mul_a_iv_int \l_fp_mul_a_v_int \l_fp_mul_a_vi_int
- \fp_mul_split:NNNN #3
- \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int
- \fp_mul_split:NNNN #4
- \l_fp_mul_b_iv_int \l_fp_mul_b_v_int \l_fp_mul_b_vi_int
- \l_fp_mul_output_int \c_zero
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_vi_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_v_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_vi_int \l_fp_mul_b_i_int
- \tex_divide:D \l_fp_mul_output_int \c_one_thousand
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_v_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_i_int
- \fp_mul_end_level:
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_i_int
- \fp_mul_end_level:
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int
- \fp_mul_end_level:
- #6 0 \l_fp_mul_output_tl \scan_stop:
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int
- \fp_mul_end_level:
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int
- \fp_mul_end_level:
- \fp_mul_end_level:
- #5 0 \l_fp_mul_output_tl \scan_stop:
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_mul:NNNNNNNNN}
-% For internal multiplication where the integer does need to be
-% retained. This means of course that this code is quite slow, and so
-% is only used when necessary.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_mul:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \fp_mul_split:NNNN #2
- \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int
- \fp_mul_split:NNNN #3
- \l_fp_mul_a_iv_int \l_fp_mul_a_v_int \l_fp_mul_a_vi_int
- \fp_mul_split:NNNN #5
- \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int
- \fp_mul_split:NNNN #6
- \l_fp_mul_b_iv_int \l_fp_mul_b_v_int \l_fp_mul_b_vi_int
- \l_fp_mul_output_int \c_zero
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_vi_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_v_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_vi_int \l_fp_mul_b_i_int
- \tex_divide:D \l_fp_mul_output_int \c_one_thousand
- \fp_mul_product:NN #1 \l_fp_mul_b_vi_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_v_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_vi_int #4
- \fp_mul_end_level:
- \fp_mul_product:NN #1 \l_fp_mul_b_v_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_v_int #4
- \fp_mul_end_level:
- \fp_mul_product:NN #1 \l_fp_mul_b_iv_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_iv_int #4
- \fp_mul_end_level:
- #9 0 \l_fp_mul_output_tl \scan_stop:
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN #1 \l_fp_mul_b_iii_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_iii_int #4
- \fp_mul_end_level:
- \fp_mul_product:NN #1 \l_fp_mul_b_ii_int
- \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_ii_int #4
- \fp_mul_end_level:
- \fp_mul_product:NN #1 \l_fp_mul_b_i_int
- \fp_mul_product:NN \l_fp_mul_a_i_int #4
- \fp_mul_end_level:
- #8 0 \l_fp_mul_output_tl \scan_stop:
- \tl_clear:N \l_fp_mul_output_tl
- \fp_mul_product:NN #1 #4
- \fp_mul_end_level:
- #7 0 \l_fp_mul_output_tl \scan_stop:
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_div_integer:NNNNN}
-% Here, division is always by an integer, and so it is possible to
-% use \TeX's native calculations rather than doing it in macros.
-% The idea here is to divide the decimal part, find any remainder,
-% then do the real division of the two parts before adding in what
-% is needed for the remainder.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_div_integer:NNNNN #1#2#3#4#5 {
- \l_fp_tmp_int #1
- \tex_divide:D \l_fp_tmp_int #3
- \l_fp_tmp_int \etex_numexpr:D #1 - \l_fp_tmp_int * #3 \scan_stop:
- #4 #1
- \tex_divide:D #4 #3
- #5 #2
- \tex_divide:D #5 #3
- \tex_multiply:D \l_fp_tmp_int \c_one_thousand
- \tex_divide:D \l_fp_tmp_int #3
- #5 \etex_numexpr:D #5 + \l_fp_tmp_int * \c_one_million \scan_stop:
- \tex_ifnum:D #5 > \c_one_thousand_million
- \tex_advance:D #4 \c_one
- \tex_advancd:D #5 -\c_one_thousand_million
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_extended_normalise:}
-%\begin{macro}[aux]{\fp_extended_normalise_aux_i:}
-%\begin{macro}[aux]{\fp_extended_normalise_aux_i:w}
-%\begin{macro}[aux]{\fp_extended_normalise_aux_ii:w}
-%\begin{macro}[aux]{\fp_extended_normalise_aux_ii:}
-%\begin{macro}[aux]{\fp_extended_normalise_aux:NNNNNNNNN}
-% The `extended' integers for internal use are mainly used in
-% fixed-point mode. This comes up in a few places, so a generalised
-% utility is made available to carry out the change. This function
-% simply calls the two loops to shift the input to the point of
-% having a zero exponent.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_extended_normalise: {
- \fp_extended_normalise_aux_i:
- \fp_extended_normalise_aux_ii:
-}
-\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_i: {
- \tex_ifnum:D \l_fp_input_a_exponent_int > \c_zero
- \tex_multiply:D \l_fp_input_a_integer_int \c_ten
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_expandafter:D \fp_extended_normalise_aux_i:w
- \int_use:N \l_fp_input_a_decimal_int \q_stop
- \tex_expandafter:D \fp_extended_normalise_aux_i:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_extended_normalise_aux_i:w #1#2#3#4#5#6#7#8#9 \q_stop {
- \l_fp_input_a_integer_int
- \etex_numexpr:D \l_fp_input_a_integer_int + #2 \scan_stop:
- \l_fp_input_a_decimal_int #3#4#5#6#7#8#9 0 \scan_stop:
- \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million
- \tex_expandafter:D \fp_extended_normalise_aux_ii:w
- \int_use:N \l_fp_input_a_extended_int \q_stop
-}
-\cs_new_protected_nopar:Npn
- \fp_extended_normalise_aux_ii:w #1#2#3#4#5#6#7#8#9 \q_stop {
- \l_fp_input_a_decimal_int
- \etex_numexpr:D \l_fp_input_a_decimal_int + #2 \scan_stop:
- \l_fp_input_a_extended_int #3#4#5#6#7#8#9 0 \scan_stop:
- \tex_advance:D \l_fp_input_a_exponent_int \c_minus_one
-}
-\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_ii: {
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_zero
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_extended_normalise_ii_aux:NNNNNNNNN
- \int_use:N \l_fp_input_a_decimal_int
- \tex_expandafter:D \fp_extended_normalise_aux_ii:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_extended_normalise_ii_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \tex_ifnum:D \l_fp_input_a_integer_int = \c_zero
- \l_fp_input_a_decimal_int #1#2#3#4#5#6#7#8 \scan_stop:
- \tex_else:D
- \tl_set:Nx \l_fp_tmp_tl
- {
- \int_use:N \l_fp_input_a_integer_int
- #1#2#3#4#5#6#7#8
- }
- \l_fp_input_a_integer_int \c_zero
- \l_fp_input_a_decimal_int \l_fp_tmp_tl \scan_stop:
- \tex_fi:D
- \tex_divide:D \l_fp_input_a_extended_int \c_ten
- \tl_set:Nx \l_fp_tmp_tl
- {
- #9
- \int_use:N \l_fp_input_a_extended_int
- }
- \l_fp_input_a_extended_int \l_fp_tmp_tl \scan_stop:
- \tex_advance:D \l_fp_input_a_exponent_int \c_one
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\fp_extended_normalise_output:}
-%\begin{macro}[aux]{\fp_extended_normalise_output_aux_i:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_extended_normalise_output_aux_ii:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_extended_normalise_output_aux:N}
-% At some stages in working out extended output, it is possible for the
-% value to need shifting to keep the integer part in range. This only
-% ever happens such that the integer needs to be made smaller.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_extended_normalise_output: {
- \tex_ifnum:D \l_fp_output_integer_int > \c_nine
- \tex_advance:D \l_fp_output_integer_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_extended_normalise_output_aux_i:NNNNNNNNN
- \int_use:N \l_fp_output_integer_int
- \tex_expandafter:D \fp_extended_normalise_output:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_extended_normalise_output_aux_i:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \l_fp_output_integer_int #1#2#3#4#5#6#7#8 \scan_stop:
- \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million
- \tl_set:Nx \l_fp_tmp_tl
- {
- #9
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_output_decimal_int
- }
- \tex_expandafter:D \fp_extended_normalise_output_aux_ii:NNNNNNNNN
- \l_fp_tmp_tl
-}
-\cs_new_protected_nopar:Npn
- \fp_extended_normalise_output_aux_ii:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \l_fp_output_decimal_int #1#2#3#4#5#6#7#8#9 \scan_stop:
- \fp_extended_normalise_output_aux:N
-}
-\cs_new_protected_nopar:Npn \fp_extended_normalise_output_aux:N #1 {
- \tex_advance:D \l_fp_output_extended_int \c_one_thousand_million
- \tex_divide:D \l_fp_output_extended_int \c_ten
- \tl_set:Nx \l_fp_tmp_tl
- {
- #1
- \tex_expandafter:D \use_none:n
- \int_use:N \l_fp_output_extended_int
- }
- \l_fp_output_extended_int \l_fp_tmp_tl \scan_stop:
- \tex_advance:D \l_fp_output_exponent_int \c_one
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Trigonometric functions}
-%
-%\begin{macro}{\fp_trig_normalise:}
-%\begin{macro}[aux]{\fp_trig_normalise_aux:}
-%\begin{macro}[aux]{\fp_trig_sub:NNN}
-% For normalisation, the code essentially switches to fixed-point
-% arithmetic. There is a shift of the exponent, then repeated
-% subtractions. The end result is a number in the range
-% \( -\pi < x \le \pi \).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_trig_normalise: {
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_ten
- \l_fp_input_a_extended_int \c_zero
- \fp_extended_normalise:
- \fp_trig_normalise_aux:
- \tex_ifnum:D \l_fp_input_a_integer_int < \c_zero
- \l_fp_input_a_sign_int -\l_fp_input_a_sign_int
- \l_fp_input_a_integer_int -\l_fp_input_a_integer_int
- \tex_fi:D
- \tex_expandafter:D \fp_trig_octant:
- \tex_else:D
- \l_fp_input_a_sign_int \c_one
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \c_zero
- \l_fp_output_exponent_int \c_zero
- \tex_expandafter:D \fp_trig_overflow_msg:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_trig_normalise_aux: {
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_three
- \fp_trig_sub:NNN
- \c_six \c_fp_two_pi_decimal_int \c_fp_two_pi_extended_int
- \tex_expandafter:D \fp_trig_normalise_aux:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_two
- \tex_ifnum:D \l_fp_input_a_decimal_int > \c_fp_pi_decimal_int
- \fp_trig_sub:NNN
- \c_six \c_fp_two_pi_decimal_int \c_fp_two_pi_extended_int
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_trig_normalise_aux:
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% Here, there may be a sign change but there will never be any
-% variation in the input. So a dedicated function can be used.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_trig_sub:NNN #1#2#3 {
- \l_fp_input_a_integer_int
- \etex_numexpr:D \l_fp_input_a_integer_int - #1 \scan_stop:
- \l_fp_input_a_decimal_int
- \etex_numexpr:D \l_fp_input_a_decimal_int - #2 \scan_stop:
- \l_fp_input_a_extended_int
- \etex_numexpr:D \l_fp_input_a_extended_int - #3 \scan_stop:
- \tex_ifnum:D \l_fp_input_a_extended_int < \c_zero
- \tex_advance:D \l_fp_input_a_decimal_int \c_minus_one
- \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_input_a_decimal_int < \c_zero
- \tex_advance:D \l_fp_input_a_integer_int \c_minus_one
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_input_a_integer_int < \c_zero
- \l_fp_input_a_sign_int -\l_fp_input_a_sign_int
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int
- = \c_zero
- \l_fp_input_a_integer_int -\l_fp_input_a_integer_int
- \tex_else:D
- \l_fp_input_a_integer_int
- \etex_numexpr:D
- - \l_fp_input_a_integer_int - \c_one
- \scan_stop:
- \l_fp_input_a_decimal_int
- \etex_numexpr:D
- \c_one_thousand_million - \l_fp_input_a_decimal_int
- \scan_stop:
- \l_fp_input_a_extended_int
- \etex_numexpr:D
- \c_one_thousand_million - \l_fp_input_a_extended_int
- \scan_stop:
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\fp_trig_octant:}
-%\begin{macro}[aux]{\fp_trig_octant_aux:}
-% Here, the input is further reduced into the range
-% \( 0 \le x < \pi / 4 \). This is pretty simple: check if
-% \( \pi / 4 \) can be taken off and if it can do it and loop. The
-% check at the end is to `mop up' values which are so close to
-% \( \pi / 4 \) that they should be treated as such. The test for
-% an even octant is needed as the `remainder' needed is from
-% the nearest \( \pi / 2 \).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_trig_octant: {
- \l_fp_trig_octant_int \c_one
- \fp_trig_octant_aux:
- \tex_ifnum:D \l_fp_input_a_decimal_int < \c_ten
- \l_fp_input_a_decimal_int \c_zero
- \l_fp_input_a_extended_int \c_zero
- \tex_fi:D
- \tex_ifodd:D \l_fp_trig_octant_int
- \tex_else:D
- \fp_sub:NNNNNNNNN
- \c_zero \c_fp_pi_by_four_decimal_int \c_fp_pi_by_four_extended_int
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_trig_octant_aux: {
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_zero
- \fp_sub:NNNNNNNNN
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \c_zero \c_fp_pi_by_four_decimal_int \c_fp_pi_by_four_extended_int
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \tex_advance:D \l_fp_trig_octant_int \c_one
- \tex_expandafter:D \fp_trig_octant_aux:
- \tex_else:D
- \tex_ifnum:D
- \l_fp_input_a_decimal_int > \c_fp_pi_by_four_decimal_int
- \fp_sub:NNNNNNNNN
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \c_zero \c_fp_pi_by_four_decimal_int
- \c_fp_pi_by_four_extended_int
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \tex_advance:D \l_fp_trig_octant_int \c_one
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_trig_octant_aux:
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_sin:Nn, \fp_sin:cn}
-%\UnitTested
-%\begin{macro}{\fp_gsin:Nn,\fp_gsin:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_sin_aux:NNn}
-%\begin{macro}[aux]{\fp_sin_aux_i:}
-%\begin{macro}[aux]{\fp_sin_aux_ii:}
-% Calculating the sine starts off in the usual way. There is a check
-% to see if the value has already been worked out before proceeding
-% further.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_sin:Nn {
- \fp_sin_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gsin:Nn {
- \fp_sin_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_sin:Nn { c }
-\cs_generate_variant:Nn \fp_gsin:Nn { c }
-% \end{macrocode}
-% The internal routine for sines does a check to see if the value is
-% already known. This saves a lot of repetition when doing rotations.
-% For very small values it is best to simply return the input as the
-% sine: the cut-off is \( 1 \times 10^{-5} \).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_sin_aux:NNn #1#2#3 {
- \group_begin:
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tl_set:Nx \l_fp_arg_tl
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_input_a_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- \tex_ifnum:D \l_fp_input_a_exponent_int < -\c_five
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2 { \l_fp_arg_tl }
- }
- \tex_else:D
- \etex_ifcsname:D
- c_fp_sin ( \l_fp_arg_tl ) _fp
- \tex_endcsname:D
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_sin_aux_i:
- \tex_fi:D
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- { \use:c { c_fp_sin ( \l_fp_arg_tl ) _fp } }
- }
- \tex_fi:D
- \fp_tmp:w
-}
-% \end{macrocode}
-% The internals for sine first normalise the input into an octant, then
-% choose the correct set up for the Taylor series. The sign for the sine
-% function is easy, so there is no worry about it. So the only thing to
-% do is to get the output standardised.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_sin_aux_i: {
- \fp_trig_normalise:
- \fp_sin_aux_ii:
- \tex_ifnum:D \l_fp_output_integer_int = \c_one
- \l_fp_output_exponent_int \c_zero
- \tex_else:D
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_decimal_int \l_fp_output_extended_int
- \l_fp_output_exponent_int -\c_nine
- \tex_fi:D
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \tl_new:c { c_fp_sin ( \l_fp_arg_tl ) _fp }
- \tl_gset:cx { c_fp_sin ( \l_fp_arg_tl ) _fp }
- {
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
-}
-\cs_new_protected_nopar:Npn \fp_sin_aux_ii: {
- \tex_ifcase:D \l_fp_trig_octant_int
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_sin:
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_cos:
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_cos:
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_sin:
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_cos:Nn, \fp_cos:cn}
-%\UnitTested
-%\begin{macro}{\fp_gcos:Nn,\fp_gcos:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_cos_aux:NNn}
-%\begin{macro}[aux]{\fp_cos_aux_i:}
-%\begin{macro}[aux]{\fp_cos_aux_ii:}
-% Cosine is almost identical, but there is no short cut code here.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_cos:Nn {
- \fp_cos_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gcos:Nn {
- \fp_cos_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_cos:Nn { c }
-\cs_generate_variant:Nn \fp_gcos:Nn { c }
-\cs_new_protected_nopar:Npn \fp_cos_aux:NNn #1#2#3 {
- \group_begin:
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tl_set:Nx \l_fp_arg_tl
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_input_a_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- \etex_ifcsname:D c_fp_cos ( \l_fp_arg_tl ) _fp \tex_endcsname:D
- \tex_else:D
- \tex_expandafter:D \fp_cos_aux_i:
- \tex_fi:D
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- { \use:c { c_fp_cos ( \l_fp_arg_tl ) _fp } }
- }
- \fp_tmp:w
-}
-% \end{macrocode}
-% Almost the same as for sine: just a bit of correction for the sign
-% of the output.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_cos_aux_i: {
- \fp_trig_normalise:
- \fp_cos_aux_ii:
- \tex_ifnum:D \l_fp_output_integer_int = \c_one
- \l_fp_output_exponent_int \c_zero
- \tex_else:D
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_decimal_int \l_fp_output_extended_int
- \l_fp_output_exponent_int -\c_nine
- \tex_fi:D
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \tl_new:c { c_fp_cos ( \l_fp_arg_tl ) _fp }
- \tl_gset:cx { c_fp_cos ( \l_fp_arg_tl ) _fp }
- {
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
-}
-\cs_new_protected_nopar:Npn \fp_cos_aux_ii: {
- \tex_ifcase:D \l_fp_trig_octant_int
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_cos:
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_sin:
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_sin:
- \tex_or:D
- \tex_expandafter:D \fp_trig_calc_cos:
- \tex_fi:D
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \tex_ifnum:D \l_fp_trig_octant_int > \c_two
- \l_fp_input_a_sign_int \c_minus_one
- \tex_fi:D
- \tex_else:D
- \tex_ifnum:D \l_fp_trig_octant_int > \c_two
- \tex_else:D
- \l_fp_input_a_sign_int \c_one
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_trig_calc_cos:}
-%\begin{macro}{\fp_trig_calc_sin:}
-%\begin{macro}[aux]{\fp_trig_calc_Taylor:}
-% These functions actually do the calculation for sine and cosine.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_trig_calc_cos: {
- \tex_ifnum:D \l_fp_input_a_decimal_int = \c_zero
- \l_fp_output_integer_int \c_one
- \l_fp_output_decimal_int \c_zero
- \tex_else:D
- \l_fp_trig_sign_int \c_minus_one
- \fp_mul:NNNNNN
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \fp_div_integer:NNNNN
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \c_two
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \l_fp_count_int \c_three
- \tex_ifnum:D \l_fp_trig_extended_int = \c_zero
- \tex_ifnum:D \l_fp_trig_decimal_int = \c_zero
- \l_fp_output_integer_int \c_one
- \l_fp_output_decimal_int \c_zero
- \l_fp_output_extended_int \c_zero
- \tex_else:D
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \c_one_thousand_million
- \l_fp_output_extended_int \c_zero
- \tex_fi:D
- \tex_else:D
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int 999999999 \scan_stop:
- \l_fp_output_extended_int \c_one_thousand_million
- \tex_fi:D
- \tex_advance:D \l_fp_output_extended_int -\l_fp_trig_extended_int
- \tex_advance:D \l_fp_output_decimal_int -\l_fp_trig_decimal_int
- \tex_expandafter:D \fp_trig_calc_Taylor:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_trig_calc_sin: {
- \l_fp_output_integer_int \c_zero
- \tex_ifnum:D \l_fp_input_a_decimal_int = \c_zero
- \l_fp_output_decimal_int \c_zero
- \tex_else:D
- \l_fp_output_decimal_int \l_fp_input_a_decimal_int
- \l_fp_output_extended_int \l_fp_input_a_extended_int
- \l_fp_trig_sign_int \c_one
- \l_fp_trig_decimal_int \l_fp_input_a_decimal_int
- \l_fp_trig_extended_int \l_fp_input_a_extended_int
- \l_fp_count_int \c_two
- \tex_expandafter:D \fp_trig_calc_Taylor:
- \tex_fi:D
-}
-% \end{macrocode}
-% This implements a Taylor series calculation for the trigonometric
-% functions. Lots of shuffling about as \TeX\ is not exactly a natural
-% choice for this sort of thing.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_trig_calc_Taylor: {
- \l_fp_trig_sign_int -\l_fp_trig_sign_int
- \fp_mul:NNNNNN
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \fp_mul:NNNNNN
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \fp_div_integer:NNNNN
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \l_fp_count_int
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \tex_advance:D \l_fp_count_int \c_one
- \fp_div_integer:NNNNN
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \l_fp_count_int
- \l_fp_trig_decimal_int \l_fp_trig_extended_int
- \tex_advance:D \l_fp_count_int \c_one
- \tex_ifnum:D \l_fp_trig_decimal_int > \c_zero
- \tex_ifnum:D \l_fp_trig_sign_int > \c_zero
- \tex_advance:D \l_fp_output_decimal_int \l_fp_trig_decimal_int
- \tex_advance:D \l_fp_output_extended_int
- \l_fp_trig_extended_int
- \tex_ifnum:D \l_fp_output_extended_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_output_decimal_int \c_one
- \tex_advance:D \l_fp_output_extended_int
- -\c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_output_decimal_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_output_integer_int \c_one
- \tex_advance:D \l_fp_output_decimal_int
- -\c_one_thousand_million
- \tex_fi:D
- \tex_else:D
- \tex_advance:D \l_fp_output_decimal_int -\l_fp_trig_decimal_int
- \tex_advance:D \l_fp_output_extended_int
- -\l_fp_input_a_extended_int
- \tex_ifnum:D \l_fp_output_extended_int < \c_zero
- \tex_advance:D \l_fp_output_decimal_int \c_minus_one
- \tex_advance:D \l_fp_output_extended_int \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_output_decimal_int < \c_zero
- \tex_advance:D \l_fp_output_integer_int \c_minus_one
- \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million
- \tex_fi:D
- \tex_fi:D
- \tex_expandafter:D \fp_trig_calc_Taylor:
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\fp_tan:Nn, \fp_tan:cn}
-%\UnitTested
-%\begin{macro}{\fp_gtan:Nn,\fp_gtan:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_tan_aux:NNn}
-%\begin{macro}[aux]{\fp_tan_aux_i:}
-%\begin{macro}[aux]{\fp_tan_aux_ii:}
-%\begin{macro}[aux]{\fp_tan_aux_iii:}
-%\begin{macro}[aux]{\fp_tan_aux_iv:}
-% As might be expected, tangents are calculated from the sine and cosine
-% by division. So there is a bit of set up, the two subsidiary pieces
-% of work are done and then a division takes place. For small numbers,
-% the same approach is used as for sines, with the input value simply
-% returned as is.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_tan:Nn {
- \fp_tan_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gtan:Nn {
- \fp_tan_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_tan:Nn { c }
-\cs_generate_variant:Nn \fp_gtan:Nn { c }
-\cs_new_protected_nopar:Npn \fp_tan_aux:NNn #1#2#3 {
- \group_begin:
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tl_set:Nx \l_fp_arg_tl
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_input_a_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- \tex_ifnum:D \l_fp_input_a_exponent_int < -\c_five
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2 { \l_fp_arg_tl }
- }
- \tex_else:D
- \etex_ifcsname:D
- c_fp_tan ( \l_fp_arg_tl ) _fp
- \tex_endcsname:D
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_tan_aux_i:
- \tex_fi:D
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- { \use:c { c_fp_tan ( \l_fp_arg_tl ) _fp } }
- }
- \tex_fi:D
- \fp_tmp:w
-}
-% \end{macrocode}
-% The business of the calculation does not check for stored sines or
-% cosines as there would then be an overhead to reading them back in.
-% There is also no need to worry about `small' sine values as
-% these will have been dealt with earlier. There is a two-step lead off
-% so that undefined division is not even attempted.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_tan_aux_i: {
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_ten
- \tex_expandafter:D \fp_tan_aux_ii:
- \tex_else:D
- \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp }
- \c_zero_fp
- \tex_expandafter:D \fp_trig_overflow_msg:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_tan_aux_ii: {
- \fp_trig_normalise:
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \tex_ifnum:D \l_fp_trig_octant_int > \c_two
- \l_fp_output_sign_int \c_minus_one
- \tex_else:D
- \l_fp_output_sign_int \c_one
- \tex_fi:D
- \tex_else:D
- \tex_ifnum:D \l_fp_trig_octant_int > \c_two
- \l_fp_output_sign_int \c_one
- \tex_else:D
- \l_fp_output_sign_int \c_minus_one
- \tex_fi:D
- \tex_fi:D
- \fp_cos_aux_ii:
- \tex_ifnum:D \l_fp_input_a_decimal_int = \c_zero
- \tex_ifnum:D \l_fp_input_a_integer_int = \c_zero
- \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp }
- \c_undefined_fp
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_tan_aux_iii:
- \tex_fi:D
- \tex_else:D
- \tex_expandafter:D \fp_tan_aux_iii:
- \tex_fi:D
-}
-% \end{macrocode}
-% The division is done here using the same code as the standard division
-% unit, shifting the digits in the calculated sine and cosine to
-% maintain accuracy.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_tan_aux_iii: {
- \l_fp_input_b_integer_int \l_fp_output_decimal_int
- \l_fp_input_b_decimal_int \l_fp_output_extended_int
- \l_fp_input_b_exponent_int -\c_nine
- \fp_standardise:NNNN
- \l_fp_input_b_sign_int
- \l_fp_input_b_integer_int
- \l_fp_input_b_decimal_int
- \l_fp_input_b_exponent_int
- \fp_sin_aux_ii:
- \l_fp_input_a_integer_int \l_fp_output_decimal_int
- \l_fp_input_a_decimal_int \l_fp_output_extended_int
- \l_fp_input_a_exponent_int -\c_nine
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tex_ifnum:D \l_fp_input_a_decimal_int = \c_zero
- \tex_ifnum:D \l_fp_input_a_integer_int = \c_zero
- \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp }
- \c_zero_fp
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_tan_aux_iv:
- \tex_fi:D
- \tex_else:D
- \tex_expandafter:D \fp_tan_aux_iv:
- \tex_fi:D
-}
- \cs_new_protected_nopar:Npn \fp_tan_aux_iv: {
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \c_zero
- \cs_set_eq:NN \fp_div_store: \fp_div_store_integer:
- \l_fp_div_offset_int \c_one_hundred_million
- \fp_div_loop:
- \l_fp_output_exponent_int
- \etex_numexpr:D
- \l_fp_input_a_exponent_int - \l_fp_input_b_exponent_int
- \scan_stop:
- \fp_standardise:NNNN
- \l_fp_output_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \tl_new:c { c_fp_tan ( \l_fp_arg_tl ) _fp }
- \tl_gset:cx { c_fp_tan ( \l_fp_arg_tl ) _fp }
- {
- \tex_ifnum:D \l_fp_output_sign_int > \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%
-%\subsection{Exponent and logarithm functions}
-%
-%\begin{macro}[aux]{\c_fp_exp_1_tl}
-%\begin{macro}[aux]{\c_fp_exp_2_tl}
-%\begin{macro}[aux]{\c_fp_exp_3_tl}
-%\begin{macro}[aux]{\c_fp_exp_4_tl}
-%\begin{macro}[aux]{\c_fp_exp_5_tl}
-%\begin{macro}[aux]{\c_fp_exp_6_tl}
-%\begin{macro}[aux]{\c_fp_exp_7_tl}
-%\begin{macro}[aux]{\c_fp_exp_8_tl}
-%\begin{macro}[aux]{\c_fp_exp_9_tl}
-%\begin{macro}[aux]{\c_fp_exp_10_tl}
-%\begin{macro}[aux]{\c_fp_exp_20_tl}
-%\begin{macro}[aux]{\c_fp_exp_30_tl}
-%\begin{macro}[aux]{\c_fp_exp_40_tl}
-%\begin{macro}[aux]{\c_fp_exp_50_tl}
-%\begin{macro}[aux]{\c_fp_exp_60_tl}
-%\begin{macro}[aux]{\c_fp_exp_70_tl}
-%\begin{macro}[aux]{\c_fp_exp_80_tl}
-%\begin{macro}[aux]{\c_fp_exp_90_tl}
-%\begin{macro}[aux]{\c_fp_exp_100_tl}
-%\begin{macro}[aux]{\c_fp_exp_200_tl}
-% Calculation of exponentials requires a number of precomputed values:
-% first the positive integers.
-% \begin{macrocode}
-\tl_new:c { c_fp_exp_1_tl }
-\tl_set:cn { c_fp_exp_1_tl }
- { { 2 } { 718281828 } { 459045235 } { 0 } }
-\tl_new:c { c_fp_exp_2_tl }
-\tl_set:cn { c_fp_exp_2_tl }
- { { 7 } { 389056098 } { 930650227 } { 0 } }
-\tl_new:c { c_fp_exp_3_tl }
-\tl_set:cn { c_fp_exp_3_tl }
- { { 2 } { 008553692 } { 318766774 } { 1 } }
-\tl_new:c { c_fp_exp_4_tl }
-\tl_set:cn { c_fp_exp_4_tl }
- { { 5 } { 459815003 } { 314423908 } { 1 } }
-\tl_new:c { c_fp_exp_5_tl }
-\tl_set:cn { c_fp_exp_5_tl }
- { { 1 } { 484131591 } { 025766034 } { 2 } }
-\tl_new:c { c_fp_exp_6_tl }
-\tl_set:cn { c_fp_exp_6_tl }
- { { 4 } { 034287934 } { 927351226 } { 2 } }
-\tl_new:c { c_fp_exp_7_tl }
-\tl_set:cn { c_fp_exp_7_tl }
- { { 1 } { 096633158 } { 428458599 } { 3 } }
-\tl_new:c { c_fp_exp_8_tl }
-\tl_set:cn { c_fp_exp_8_tl }
- { { 2 } { 980957987 } { 041728275 } { 3 } }
-\tl_new:c { c_fp_exp_9_tl }
-\tl_set:cn { c_fp_exp_9_tl }
- { { 8 } { 103083927 } { 575384008 } { 3 } }
-\tl_new:c { c_fp_exp_10_tl }
-\tl_set:cn { c_fp_exp_10_tl }
- { { 2 } { 202646579 } { 480671652 } { 4 } }
-\tl_new:c { c_fp_exp_20_tl }
-\tl_set:cn { c_fp_exp_20_tl }
- { { 4 } { 851651954 } { 097902280 } { 8 } }
-\tl_new:c { c_fp_exp_30_tl }
-\tl_set:cn { c_fp_exp_30_tl }
- { { 1 } { 068647458 } { 152446215 } { 13 } }
-\tl_new:c { c_fp_exp_40_tl }
-\tl_set:cn { c_fp_exp_40_tl }
- { { 2 } { 353852668 } { 370199854 } { 17 } }
-\tl_new:c { c_fp_exp_50_tl }
-\tl_set:cn { c_fp_exp_50_tl }
- { { 5 } { 184705528 } { 587072464 } { 21 } }
-\tl_new:c { c_fp_exp_60_tl }
-\tl_set:cn { c_fp_exp_60_tl }
- { { 1 } { 142007389 } { 815684284 } { 26 } }
-\tl_new:c { c_fp_exp_70_tl }
-\tl_set:cn { c_fp_exp_70_tl }
- { { 2 } { 515438670 } { 919167006 } { 30 } }
-\tl_new:c { c_fp_exp_80_tl }
-\tl_set:cn { c_fp_exp_80_tl }
- { { 5 } { 540622384 } { 393510053 } { 34 } }
-\tl_new:c { c_fp_exp_90_tl }
-\tl_set:cn { c_fp_exp_90_tl }
- { { 1 } { 220403294 } { 317840802 } { 39 } }
-\tl_new:c { c_fp_exp_100_tl }
-\tl_set:cn { c_fp_exp_100_tl }
- { { 2 } { 688117141 } { 816135448 } { 43 } }
-\tl_new:c { c_fp_exp_200_tl }
-\tl_set:cn { c_fp_exp_200_tl }
- { { 7 } { 225973768 } { 125749258 } { 86 } }
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}[aux]{\c_fp_exp_-1_tl}
-%\begin{macro}[aux]{\c_fp_exp_-2_tl}
-%\begin{macro}[aux]{\c_fp_exp_-3_tl}
-%\begin{macro}[aux]{\c_fp_exp_-4_tl}
-%\begin{macro}[aux]{\c_fp_exp_-5_tl}
-%\begin{macro}[aux]{\c_fp_exp_-6_tl}
-%\begin{macro}[aux]{\c_fp_exp_-7_tl}
-%\begin{macro}[aux]{\c_fp_exp_-8_tl}
-%\begin{macro}[aux]{\c_fp_exp_-9_tl}
-%\begin{macro}[aux]{\c_fp_exp_-10_tl}
-%\begin{macro}[aux]{\c_fp_exp_-20_tl}
-%\begin{macro}[aux]{\c_fp_exp_-30_tl}
-%\begin{macro}[aux]{\c_fp_exp_-40_tl}
-%\begin{macro}[aux]{\c_fp_exp_-50_tl}
-%\begin{macro}[aux]{\c_fp_exp_-60_tl}
-%\begin{macro}[aux]{\c_fp_exp_-70_tl}
-%\begin{macro}[aux]{\c_fp_exp_-80_tl}
-%\begin{macro}[aux]{\c_fp_exp_-90_tl}
-%\begin{macro}[aux]{\c_fp_exp_-100_tl}
-%\begin{macro}[aux]{\c_fp_exp_-200_tl}
-% Now the negative integers.
-% \begin{macrocode}
-\tl_new:c { c_fp_exp_-1_tl }
-\tl_set:cn { c_fp_exp_-1_tl }
- { { 3 } { 678794411 } { 71442322 } { -1 } }
-\tl_new:c { c_fp_exp_-2_tl }
-\tl_set:cn { c_fp_exp_-2_tl }
- { { 1 } { 353352832 } { 366132692 } { -1 } }
-\tl_new:c { c_fp_exp_-3_tl }
-\tl_set:cn { c_fp_exp_-3_tl }
- { { 4 } { 978706836 } { 786394298 } { -2 } }
-\tl_new:c { c_fp_exp_-4_tl }
-\tl_set:cn { c_fp_exp_-4_tl }
- { { 1 } { 831563888 } { 873418029 } { -2 } }
-\tl_new:c { c_fp_exp_-5_tl }
-\tl_set:cn { c_fp_exp_-5_tl }
- { { 6 } { 737946999 } { 085467097 } { -3 } }
-\tl_new:c { c_fp_exp_-6_tl }
-\tl_set:cn { c_fp_exp_-6_tl }
- { { 2 } { 478752176 } { 666358423 } { -3 } }
-\tl_new:c { c_fp_exp_-7_tl }
-\tl_set:cn { c_fp_exp_-7_tl }
- { { 9 } { 118819655 } { 545162080 } { -4 } }
-\tl_new:c { c_fp_exp_-8_tl }
-\tl_set:cn { c_fp_exp_-8_tl }
- { { 3 } { 354626279 } { 025118388 } { -4 } }
-\tl_new:c { c_fp_exp_-9_tl }
-\tl_set:cn { c_fp_exp_-9_tl }
- { { 1 } { 234098040 } { 866795495 } { -4 } }
-\tl_new:c { c_fp_exp_-10_tl }
-\tl_set:cn { c_fp_exp_-10_tl }
- { { 4 } { 539992976 } { 248451536 } { -5 } }
-\tl_new:c { c_fp_exp_-20_tl }
-\tl_set:cn { c_fp_exp_-20_tl }
- { { 2 } { 061153622 } { 438557828 } { -9 } }
-\tl_new:c { c_fp_exp_-30_tl }
-\tl_set:cn { c_fp_exp_-30_tl }
- { { 9 } { 357622968 } { 840174605 } { -14 } }
-\tl_new:c { c_fp_exp_-40_tl }
-\tl_set:cn { c_fp_exp_-40_tl }
- { { 4 } { 248354255 } { 291588995 } { -18 } }
-\tl_new:c { c_fp_exp_-50_tl }
-\tl_set:cn { c_fp_exp_-50_tl }
- { { 1 } { 928749847 } { 963917783 } { -22 } }
-\tl_new:c { c_fp_exp_-60_tl }
-\tl_set:cn { c_fp_exp_-60_tl }
- { { 8 } { 756510762 } { 696520338 } { -27 } }
-\tl_new:c { c_fp_exp_-70_tl }
-\tl_set:cn { c_fp_exp_-70_tl }
- { { 3 } { 975449735 } { 908646808 } { -31 } }
-\tl_new:c { c_fp_exp_-80_tl }
-\tl_set:cn { c_fp_exp_-80_tl }
- { { 1 } { 804851387 } { 845415172 } { -35 } }
-\tl_new:c { c_fp_exp_-90_tl }
-\tl_set:cn { c_fp_exp_-90_tl }
- { { 8 } { 194012623 } { 990515430 } { -40 } }
-\tl_new:c { c_fp_exp_-100_tl }
-\tl_set:cn { c_fp_exp_-100_tl }
- { { 3 } { 720075976 } { 020835963 } { -44 } }
-\tl_new:c { c_fp_exp_-200_tl }
-\tl_set:cn { c_fp_exp_-200_tl }
- { { 1 } { 383896526 } { 736737530 } { -87 } }
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%
-%
-%\begin{macro}{\fp_exp:Nn, \fp_exp:cn}
-%\UnitTested
-%\begin{macro}{\fp_gexp:Nn,\fp_gexp:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_exp_aux:NNn}
-%\begin{macro}[aux]{\fp_exp_internal:}
-%\begin{macro}[aux]{\fp_exp_aux:}
-%\begin{macro}[aux]{\fp_exp_integer:}
-%\begin{macro}[aux]{\fp_exp_integer_tens:}
-%\begin{macro}[aux]{\fp_exp_integer_units:}
-%\begin{macro}[aux]{\fp_exp_integer_const:n}
-%\begin{macro}[aux]{\fp_exp_integer_const:nnnn}
-%\begin{macro}[aux]{\fp_exp_decimal:}
-%\begin{macro}[aux]{\fp_exp_Taylor:}
-%\begin{macro}[aux]{\fp_exp_const:Nx}
-%\begin{macro}[aux]{\fp_exp_const:cx}
-% The calculation of an exponent starts off starts in much the same
-% way as the trigonometric functions: normalise the input, look for
-% a pre-defined value and if one is not found hand off to the real
-% workhorse function. The test for a definition of the result is used
-% so that overflows do not result in any outcome being defined.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp:Nn {
- \fp_exp_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gexp:Nn {
- \fp_exp_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_exp:Nn { c }
-\cs_generate_variant:Nn \fp_gexp:Nn { c }
-\cs_new_protected_nopar:Npn \fp_exp_aux:NNn #1#2#3 {
- \group_begin:
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \l_fp_input_a_extended_int \c_zero
- \tl_set:Nx \l_fp_arg_tl
- {
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- -
- \tex_else:D
- +
- \tex_fi:D
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_input_a_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- \etex_ifcsname:D c_fp_exp ( \l_fp_arg_tl ) _fp \tex_endcsname:D
- \tex_else:D
- \tex_expandafter:D \fp_exp_internal:
- \tex_fi:D
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- #1 \exp_not:N #2
- {
- \etex_ifcsname:D c_fp_exp ( \l_fp_arg_tl ) _fp
- \tex_endcsname:D
- \use:c { c_fp_exp ( \l_fp_arg_tl ) _fp }
- \tex_else:D
- \c_zero_fp
- \tex_fi:D
- }
- }
- \fp_tmp:w
-}
-% \end{macrocode}
-% The first real step is to convert the input into a fixed-point
-% representation for further calculation: anything which is dropped
-% here as too small would not influence the output in any case. There
-% are a couple of overflow tests: the maximum
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_internal: {
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_three
- \fp_extended_normalise:
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \tex_ifnum:D \l_fp_input_a_integer_int < 230 \scan_stop:
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_exp_aux:
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_exp_overflow_msg:
- \tex_fi:D
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_integer_int < 230 \scan_stop:
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_exp_aux:
- \tex_else:D
- \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp }
- { \c_zero_fp }
- \tex_fi:D
- \tex_fi:D
- \tex_else:D
- \tex_expandafter:D \fp_exp_overflow_msg:
- \tex_fi:D
-}
-% \end{macrocode}
-% The main algorithm makes use of the fact that
-% \[
-% \mathrm{e}^{nmp.q} =
-% \mathrm{e}^{n}
-% \mathrm{e}^{m}
-% \mathrm{e}^{p}
-% \mathrm{e}^{0.q}
-% \]
-% and that there is a Taylor series that can be used to calculate
-% \( \mathrm{e}^{0.q} \). Thus the approach needed is in three parts.
-% First, the exponent of the integer part of the input is found
-% using the pre-calculated constants. Second, the Taylor series is
-% used to find the exponent for the decimal part of the input. Finally,
-% the two parts are multiplied together to give the result. As the
-% normalisation code will already have dealt with any overflowing
-% values, there are no further checks needed.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_aux: {
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_zero
- \tex_expandafter:D \fp_exp_integer:
- \tex_else:D
- \l_fp_output_integer_int \c_one
- \l_fp_output_decimal_int \c_zero
- \l_fp_output_extended_int \c_zero
- \l_fp_output_exponent_int \c_zero
- \tex_expandafter:D \fp_exp_decimal:
- \tex_fi:D
-}
-% \end{macrocode}
-% The integer part calculation starts with the hundreds. This is
-% set up such that very large negative numbers can short-cut the entire
-% procedure and simply return zero. In other cases, the code either
-% recovers the exponent of the hundreds value or sets the appropriate
-% storage to one (so that multiplication works correctly).
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_integer: {
- \tex_ifnum:D \l_fp_input_a_integer_int < \c_one_hundred
- \l_fp_exp_integer_int \c_one
- \l_fp_exp_decimal_int \c_zero
- \l_fp_exp_extended_int \c_zero
- \l_fp_exp_exponent_int \c_zero
- \tex_expandafter:D \fp_exp_integer_tens:
- \tex_else:D
- \tl_set:Nx \l_fp_tmp_tl
- {
- \tex_expandafter:D \use_i:nnn
- \int_use:N \l_fp_input_a_integer_int
- }
- \l_fp_input_a_integer_int
- \etex_numexpr:D
- \l_fp_input_a_integer_int - \l_fp_tmp_tl 00
- \scan_stop:
- \tex_ifnum:D \l_fp_input_a_sign_int < \c_zero
- \tex_ifnum:D \l_fp_output_integer_int > 200 \scan_stop:
- \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp }
- { \c_zero_fp }
- \tex_else:D
- \fp_exp_integer_const:n { - \l_fp_tmp_tl 00 }
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_exp_integer_tens:
- \tex_fi:D
- \tex_else:D
- \fp_exp_integer_const:n { \l_fp_tmp_tl 00 }
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_exp_integer_tens:
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% The tens and units parts are handled in a similar way, with a
-% multiplication step to build up the final value. That also includes a
-% correction step to avoid an overflow of the integer part.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_integer_tens: {
- \l_fp_output_integer_int \l_fp_exp_integer_int
- \l_fp_output_decimal_int \l_fp_exp_decimal_int
- \l_fp_output_extended_int \l_fp_exp_extended_int
- \l_fp_output_exponent_int \l_fp_exp_exponent_int
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_nine
- \tl_set:Nx \l_fp_tmp_tl
- {
- \tex_expandafter:D \use_i:nn
- \int_use:N \l_fp_input_a_integer_int
- }
- \l_fp_input_a_integer_int
- \etex_numexpr:D
- \l_fp_input_a_integer_int - \l_fp_tmp_tl 0
- \scan_stop:
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \fp_exp_integer_const:n { \l_fp_tmp_tl 0 }
- \tex_else:D
- \fp_exp_integer_const:n { - \l_fp_tmp_tl 0 }
- \tex_fi:D
- \fp_mul:NNNNNNNNN
- \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \tex_advance:D \l_fp_output_exponent_int \l_fp_exp_exponent_int
- \fp_extended_normalise_output:
- \tex_fi:D
- \fp_exp_integer_units:
-}
-\cs_new_protected_nopar:Npn \fp_exp_integer_units: {
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_zero
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \fp_exp_integer_const:n { \int_use:N \l_fp_input_a_integer_int }
- \tex_else:D
- \fp_exp_integer_const:n
- { - \int_use:N \l_fp_input_a_integer_int }
- \tex_fi:D
- \fp_mul:NNNNNNNNN
- \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \tex_advance:D \l_fp_output_exponent_int \l_fp_exp_exponent_int
- \fp_extended_normalise_output:
- \tex_fi:D
- \fp_exp_decimal:
-}
-% \end{macrocode}
-% Recovery of the stored constant values into the separate registers
-% is done with a simple expansion then assignment.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_integer_const:n #1 {
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_exp_integer_const:nnnn
- \tex_csname:D c_fp_exp_ #1 _tl \tex_endcsname:D
-}
-\cs_new_protected_nopar:Npn \fp_exp_integer_const:nnnn #1#2#3#4 {
- \l_fp_exp_integer_int #1 \scan_stop:
- \l_fp_exp_decimal_int #2 \scan_stop:
- \l_fp_exp_extended_int #3 \scan_stop:
- \l_fp_exp_exponent_int #4 \scan_stop:
-}
-% \end{macrocode}
-% Finding the exponential for the decimal part of the number requires
-% a Taylor series calculation. The set up is done here with the loop
-% itself a separate function. Once the decimal part is available this
-% is multiplied by the integer part already worked out to give
-% the final result.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_decimal: {
- \tex_ifnum:D \l_fp_input_a_decimal_int > \c_zero
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \l_fp_exp_integer_int \c_one
- \l_fp_exp_decimal_int \l_fp_input_a_decimal_int
- \l_fp_exp_extended_int \l_fp_input_a_extended_int
- \tex_else:D
- \l_fp_exp_integer_int \c_zero
- \tex_ifnum:D \l_fp_exp_extended_int = \c_zero
- \l_fp_exp_decimal_int
- \etex_numexpr:D
- \c_one_thousand_million - \l_fp_input_a_decimal_int
- \scan_stop:
- \l_fp_exp_extended_int \c_zero
- \tex_else:D
- \l_fp_exp_decimal_int
- \etex_numexpr:D
- 999999999 - \l_fp_input_a_decimal_int
- \scan_stop:
- \l_fp_exp_extended_int
- \etex_numexpr:D
- \c_one_thousand_million - \l_fp_input_a_extended_int
- \scan_stop:
- \tex_fi:D
- \tex_fi:D
- \l_fp_input_b_sign_int \l_fp_input_a_sign_int
- \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int
- \l_fp_input_b_extended_int \l_fp_input_a_extended_int
- \l_fp_count_int \c_one
- \fp_exp_Taylor:
- \fp_mul:NNNNNNNNN
- \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \tex_fi:D
- \tex_ifnum:D \l_fp_output_extended_int < \c_five_hundred_million
- \tex_else:D
- \tex_advance:D \l_fp_output_decimal_int \c_one
- \tex_ifnum:D \l_fp_output_decimal_int < \c_one_thousand_million
- \tex_else:D
- \l_fp_output_decimal_int \c_zero
- \tex_advance:D \l_fp_output_integer_int \c_one
- \tex_fi:D
- \tex_fi:D
- \fp_standardise:NNNN
- \l_fp_output_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp }
- {
- +
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
-}
-% \end{macrocode}
-% The Taylor series for \( \exp(x) \) is
-%\[
-% 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots
-%\]
-% which converges for \( -1 < x < 1 \). The code above sets up
-% the \( x \) part, leaving the loop to multiply the running
-% value by \( x / n \) and add it onto the sum. The way that this is
-% done is that the running total is stored in the \texttt{exp} set of
-% registers, while the current item is stored as \texttt{input_b}.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_Taylor: {
- \tex_advance:D \l_fp_count_int \c_one
- \tex_multiply:D \l_fp_input_b_sign_int \l_fp_input_a_sign_int
- \fp_mul:NNNNNN
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_input_b_decimal_int \l_fp_input_b_extended_int
- \l_fp_input_b_decimal_int \l_fp_input_b_extended_int
- \fp_div_integer:NNNNN
- \l_fp_input_b_decimal_int \l_fp_input_b_extended_int
- \l_fp_count_int
- \l_fp_input_b_decimal_int \l_fp_input_b_extended_int
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_b_decimal_int + \l_fp_input_b_extended_int
- > \c_zero
- \tex_ifnum:D \l_fp_input_b_sign_int > \c_zero
- \tex_advance:D \l_fp_exp_decimal_int \l_fp_input_b_decimal_int
- \tex_advance:D \l_fp_exp_extended_int
- \l_fp_input_b_extended_int
- \tex_ifnum:D \l_fp_exp_extended_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_exp_decimal_int \c_one
- \tex_advance:D \l_fp_exp_extended_int
- -\c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_exp_decimal_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_exp_integer_int \c_one
- \tex_advance:D \l_fp_exp_decimal_int
- -\c_one_thousand_million
- \tex_fi:D
- \tex_else:D
- \tex_advance:D \l_fp_exp_decimal_int -\l_fp_input_b_decimal_int
- \tex_advance:D \l_fp_exp_extended_int
- -\l_fp_input_a_extended_int
- \tex_ifnum:D \l_fp_exp_extended_int < \c_zero
- \tex_advance:D \l_fp_exp_decimal_int \c_minus_one
- \tex_advance:D \l_fp_exp_extended_int \c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_exp_decimal_int < \c_zero
- \tex_advance:D \l_fp_exp_integer_int \c_minus_one
- \tex_advance:D \l_fp_exp_decimal_int \c_one_thousand_million
- \tex_fi:D
- \tex_fi:D
- \tex_expandafter:D \fp_exp_Taylor:
- \tex_fi:D
-}
-% \end{macrocode}
-% This is set up as a function so that the power code can redirect
-% the effect.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_exp_const:Nx #1#2 {
- \tl_new:N #1
- \tl_gset:Nx #1 {#2}
-}
-\cs_generate_variant:Nn \fp_exp_const:Nx { c }
-% \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]{\c_fp_ln_10_1_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_2_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_3_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_4_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_5_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_6_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_7_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_8_tl}
-%\begin{macro}[aux]{\c_fp_ln_10_9_tl}
-% Constants for working out logarithms: first those for the powers of
-% ten.
-% \begin{macrocode}
-\tl_new:c { c_fp_ln_10_1_tl }
-\tl_set:cn { c_fp_ln_10_1_tl }
- { { 2 } { 302585092 } { 994045684 } { 0 } }
-\tl_new:c { c_fp_ln_10_2_tl }
-\tl_set:cn { c_fp_ln_10_2_tl }
- { { 4 } { 605170185 } { 988091368 } { 0 } }
-\tl_new:c { c_fp_ln_10_3_tl }
-\tl_set:cn { c_fp_ln_10_3_tl }
- { { 6 } { 907755278 } { 982137052 } { 0 } }
-\tl_new:c { c_fp_ln_10_4_tl }
-\tl_set:cn { c_fp_ln_10_4_tl }
- { { 9 } { 210340371 } { 976182736 } { 0 } }
-\tl_new:c { c_fp_ln_10_5_tl }
-\tl_set:cn { c_fp_ln_10_5_tl }
- { { 1 } { 151292546 } { 497022842 } { 1 } }
-\tl_new:c { c_fp_ln_10_6_tl }
-\tl_set:cn { c_fp_ln_10_6_tl }
- { { 1 } { 381551055 } { 796427410 } { 1 } }
-\tl_new:c { c_fp_ln_10_7_tl }
-\tl_set:cn { c_fp_ln_10_7_tl }
- { { 1 } { 611809565 } { 095831979 } { 1 } }
-\tl_new:c { c_fp_ln_10_8_tl }
-\tl_set:cn { c_fp_ln_10_8_tl }
- { { 1 } { 842068074 } { 395226547 } { 1 } }
-\tl_new:c { c_fp_ln_10_9_tl }
-\tl_set:cn { c_fp_ln_10_9_tl }
- { { 2 } { 072326583 } { 694641116 } { 1 } }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\c_fp_ln_2_1_tl }
-%\begin{macro}[aux]{\c_fp_ln_2_2_tl }
-%\begin{macro}[aux]{\c_fp_ln_2_3_tl }
-% The smaller set for powers of two.
-% \begin{macrocode}
-\tl_new:c { c_fp_ln_2_1_tl }
-\tl_set:cn { c_fp_ln_2_1_tl }
- { { 0 } { 693147180 } { 559945309 } { 0 } }
-\tl_new:c { c_fp_ln_2_2_tl }
-\tl_set:cn { c_fp_ln_2_2_tl }
- { { 1 } { 386294361 } { 119890618 } { 0 } }
-\tl_new:c { c_fp_ln_2_3_tl }
-\tl_set:cn { c_fp_ln_2_3_tl }
- { { 2 } { 079441541 } { 679835928 } { 0 } }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\fp_ln:Nn, \fp_ln:cn}
-%\UnitTested
-%\begin{macro}{\fp_gln:Nn,\fp_gln:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_ln_aux:NNn}
-%\begin{macro}[aux]{\fp_ln_aux:}
-%\begin{macro}[aux]{\fp_ln_exponent:}
-%\begin{macro}[aux]{\fp_ln_internal:}
-%\begin{macro}[aux]{\fp_ln_exponent_units:}
-%\begin{macro}[aux]{\fp_ln_normalise:}
-%\begin{macro}[aux]{\fp_ln_nornalise_aux:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_ln_mantissa:}
-%\begin{macro}[aux]{\fp_ln_mantissa_aux:}
-%\begin{macro}[aux]{\fp_ln_mantissa_divide_two:}
-%\begin{macro}[aux]{\fp_ln_integer_const:nn}
-%\begin{macro}[aux]{\fp_ln_Taylor:}
-%\begin{macro}[aux]{\fp_ln_fixed:}
-%\begin{macro}[aux]{\fp_ln_fixed_aux:NNNNNNNNN}
-%\begin{macro}[aux]{\fp_ln_Taylor_aux:}
-% The approach for logarithms is again based on a mix of tables and
-% Taylor series. Here, the initial validation is a bit easier and so it
-% is set up earlier, meaning less need to escape later on.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln:Nn {
- \fp_ln_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gln:Nn {
- \fp_ln_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_ln:Nn { c }
-\cs_generate_variant:Nn \fp_gln:Nn { c }
-\cs_new_protected_nopar:Npn \fp_ln_aux:NNn #1#2#3 {
- \group_begin:
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int
- > \c_zero
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_ln_aux:
- \tex_else:D
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 \exp_not:N ##2 { \c_zero_fp }
- }
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_ln_error_msg:
- \tex_fi:D
- \tex_else:D
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 \exp_not:N ##2 { \c_zero_fp }
- }
- \tex_expandafter:D \fp_ln_error_msg:
- \tex_fi:D
- \fp_tmp:w #1 #2
-}
-% \end{macrocode}
-% As the input at this stage meets the validity criteria above, the
-% argument can now be saved for further processing. There is no need
-% to look at the sign of the input as it must be positive. The function
-% here simply sets up to either do the full calculation or recover
-% the stored value, as appropriate.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_aux: {
- \tl_set:Nx \l_fp_arg_tl
- {
- +
- \int_use:N \l_fp_input_a_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_input_a_decimal_int + \c_one_thousand_million
- e
- \int_use:N \l_fp_input_a_exponent_int
- }
- \etex_ifcsname:D c_fp_ln ( \l_fp_arg_tl ) _fp \tex_endcsname:D
- \tex_else:D
- \tex_expandafter:D \fp_ln_exponent:
- \tex_fi:D
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 \exp_not:N ##2
- { \use:c { c_fp_ln ( \l_fp_arg_tl ) _fp } }
- }
-}
-% \end{macrocode}
-% The main algorithm here uses the fact the logarithm can be divided
-% up, first taking out the powers of ten, then powers of two and finally
-% using a Taylor series for the remainder.
-%\[
-% \ln ( 10^{n} \times 2^{m} \times x )
-% = \ln ( 10^{n} ) \times \ln ( 2^{m} ) \times \ln ( x )
-%\]
-% The second point to remember is that
-%\[
-% \ln ( x^{-1} ) = - \ln ( x )
-%\]
-% which means that for the powers of \( 10 \) and \( 2 \) constants
-% are only needed for positive powers.
-%
-% The first step is to set up the sign for the output functions and
-% work out the powers of ten in the exponent. First the larger powers
-% are sorted out. The values for the constants are the same as those
-% for the smaller ones, just with a shift in the exponent.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_exponent: {
- \fp_ln_internal:
- \tex_ifnum:D \l_fp_output_extended_int < \c_five_hundred_million
- \tex_else:D
- \tex_advance:D \l_fp_output_decimal_int \c_one
- \tex_ifnum:D \l_fp_output_decimal_int < \c_one_thousand_million
- \tex_else:D
- \l_fp_output_decimal_int \c_zero
- \tex_advance:D \l_fp_output_integer_int \c_one
- \tex_fi:D
- \tex_fi:D
- \fp_standardise:NNNN
- \l_fp_output_sign_int
- \l_fp_output_integer_int
- \l_fp_output_decimal_int
- \l_fp_output_exponent_int
- \tl_new:c { c_fp_ln ( \l_fp_arg_tl ) _fp }
- \tl_gset:cx { c_fp_ln ( \l_fp_arg_tl ) _fp }
- {
- \tex_ifnum:D \l_fp_output_sign_int > \c_zero
- +
- \tex_else:D
- -
- \tex_fi:D
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
-}
-\cs_new_protected_nopar:Npn \fp_ln_internal: {
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_zero
- \l_fp_input_a_exponent_int -\l_fp_input_a_exponent_int
- \l_fp_output_sign_int \c_minus_one
- \tex_else:D
- \l_fp_output_sign_int \c_one
- \tex_fi:D
- \tex_ifnum:D \l_fp_input_a_exponent_int > \c_nine
- \tl_set:Nx \l_fp_tmp_tl
- {
- \tex_expandafter:D \use_i:nn
- \int_use:N \l_fp_input_a_exponent_int
- }
- \l_fp_input_a_exponent_int
- \etex_numexpr:D
- \l_fp_input_a_exponent_int - \l_fp_tmp_tl 0
- \scan_stop:
- \fp_ln_const:nn { 10 } { \l_fp_tmp_tl }
- \tex_advance:D \l_fp_exp_exponent_int \c_one
- \l_fp_output_integer_int \l_fp_exp_integer_int
- \l_fp_output_decimal_int \l_fp_exp_decimal_int
- \l_fp_output_extended_int \l_fp_exp_extended_int
- \l_fp_output_exponent_int \l_fp_exp_exponent_int
- \tex_else:D
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \c_zero
- \l_fp_output_extended_int \c_zero
- \l_fp_output_exponent_int \c_zero
- \tex_fi:D
- \fp_ln_exponent_units:
-}
-% \end{macrocode}
-% Next the smaller powers of ten, which will need to be combined
-% with the above: always an additive process.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_exponent_units: {
- \tex_ifnum:D \l_fp_input_a_exponent_int > \c_zero
- \fp_ln_const:nn { 10 } { \int_use:N \l_fp_input_a_exponent_int }
- \fp_ln_normalise:
- \fp_add:NNNNNNNNN
- \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \tex_fi:D
- \fp_ln_mantissa:
-}
-% \end{macrocode}
-% The smaller table-based parts may need to be exponent shifted so that
-% they stay in line with the larger parts. This is similar to the
-% approach in other places, but here there is a need to watch the
-% extended part of the number.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_normalise: {
- \tex_ifnum:D \l_fp_exp_exponent_int < \l_fp_output_exponent_int
- \tex_advance:D \l_fp_exp_decimal_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_ln_normalise_aux:NNNNNNNNN
- \int_use:N \l_fp_exp_decimal_int
- \tex_expandafter:D \fp_ln_normalise:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_ln_normalise_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \tex_ifnum:D \l_fp_exp_integer_int = \c_zero
- \l_fp_exp_decimal_int #1#2#3#4#5#6#7#8 \scan_stop:
- \tex_else:D
- \tl_set:Nx \l_fp_tmp_tl
- {
- \int_use:N \l_fp_exp_integer_int
- #1#2#3#4#5#6#7#8
- }
- \l_fp_exp_integer_int \c_zero
- \l_fp_exp_decimal_int \l_fp_tmp_tl \scan_stop:
- \tex_fi:D
- \tex_divide:D \l_fp_exp_extended_int \c_ten
- \tl_set:Nx \l_fp_tmp_tl
- {
- #9
- \int_use:N \l_fp_exp_extended_int
- }
- \l_fp_exp_extended_int \l_fp_tmp_tl \scan_stop:
- \tex_advance:D \l_fp_exp_exponent_int \c_one
-}
-% \end{macrocode}
-% The next phase is to decompose the mantissa by division by two to
-% leave a value which is in the range \( 1 \le x < 2 \). The sum of the
-% two powers needs to take account of the sign of the output: if it
-% is negative then the result gets \emph{smaller} as the mantissa gets
-% \emph{bigger}.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_mantissa: {
- \l_fp_count_int \c_zero
- \l_fp_input_a_extended_int \c_zero
- \fp_ln_mantissa_aux:
- \tex_ifnum:D \l_fp_count_int > \c_zero
- \fp_ln_const:nn { 2 } { \int_use:N \l_fp_count_int }
- \fp_ln_normalise:
- \tex_ifnum:D \l_fp_output_sign_int > \c_zero
- \tex_expandafter:D \fp_add:NNNNNNNNN
- \tex_else:D
- \tex_expandafter:D \fp_sub:NNNNNNNNN
- \tex_fi:D
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \tex_fi:D
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int > \c_one
- \scan_stop:
- \tex_expandafter:D \fp_ln_Taylor:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn \fp_ln_mantissa_aux: {
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_one
- \tex_advance:D \l_fp_count_int \c_one
- \fp_ln_mantissa_divide_two:
- \tex_expandafter:D \fp_ln_mantissa_aux:
- \tex_fi:D
-}
-% \end{macrocode}
-% A fast one-shot division by two.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_mantissa_divide_two: {
- \tex_ifodd:D \l_fp_input_a_decimal_int
- \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million
- \tex_fi:D
- \tex_ifodd:D \l_fp_input_a_integer_int
- \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million
- \tex_fi:D
- \tex_divide:D \l_fp_input_a_integer_int \c_two
- \tex_divide:D \l_fp_input_a_decimal_int \c_two
- \tex_divide:D \l_fp_input_a_extended_int \c_two
-}
-% \end{macrocode}
-% Recovering constants makes use of the same auxiliary code as for
-% exponents.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_const:nn #1#2 {
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_exp_integer_const:nnnn
- \tex_csname:D c_fp_ln_ #1 _ #2 _tl \tex_endcsname:D
-}
-% \end{macrocode}
-% The Taylor series for the logarithm function is best implemented using
-% the identity
-%\[
-% \ln(x) = \ln\left( \frac{y + 1}{y - 1} \right)
-%\]
-% with
-%\[
-% y = \frac{x - 1}{x + 1}
-%\]
-% This leads to the series
-%\[
-% \ln(x)
-% = 2y
-% \left(
-% 1 + y^{2}
-% \left(
-% \frac{1}{3} + y^{2}
-% \left(
-% \frac{1}{5} + y^{2}
-% \left(
-% \frac{1}{7} + y^{2}
-% \left(
-% \frac{1}{9} + \cdots
-% \right)
-% \right)
-% \right)
-% \right)
-% \right)
-%\]
-% This expansion has the advantage that a lot of the work can be
-% loaded up early by finding \( y^{2} \) before the loop itself starts.
-% (In practice, the implementation does the multiplication by two at the
-% end of the loop, and expands out the brackets as this is an overall
-% more efficient approach.)
-%
-% At the implementation level, the code starts by calculating \( y \)
-% and storing that in input \texttt{a} (which is no longer needed
-% for other purposes). That is done using the full division system
-% avoiding the parsing step. The value is then switched to a fixed-point
-% representation. There is then some shuffling to get all of the working
-% space set up. At this stage, a lot of registers are in use and so
-% the Taylor series is calculated within a group so that the
-% \texttt{output} variables can be used to hold the result. The value
-% of \( y^{2} \) is held in input \texttt{b} (there are a few
-% assignments saved by choosing this over \texttt{a}), while input
-% \texttt{a} is used for the `loop value'.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_Taylor: {
- \group_begin:
- \l_fp_input_a_integer_int \c_zero
- \l_fp_input_a_exponent_int \c_zero
- \l_fp_input_b_integer_int \c_two
- \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int
- \l_fp_input_b_exponent_int \c_zero
- \fp_div_internal:
- \fp_ln_fixed:
- \l_fp_input_a_integer_int \l_fp_output_integer_int
- \l_fp_input_a_decimal_int \l_fp_output_decimal_int
- \l_fp_input_a_exponent_int \l_fp_output_exponent_int
- \l_fp_input_a_extended_int \c_zero
- \l_fp_output_decimal_int \c_zero
- \l_fp_output_decimal_int \l_fp_input_a_decimal_int
- \l_fp_output_extended_int \l_fp_input_a_extended_int
- \fp_mul:NNNNNN
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_input_b_decimal_int \l_fp_input_b_extended_int
- \l_fp_count_int \c_one
- \fp_ln_Taylor_aux:
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- \exp_not:N \l_fp_exp_decimal_int
- \int_use:N \l_fp_output_decimal_int \scan_stop:
- \exp_not:N \l_fp_exp_extended_int
- \int_use:N \l_fp_output_extended_int \scan_stop:
- \exp_not:N \l_fp_exp_exponent_int
- \int_use:N \l_fp_output_exponent_int \scan_stop:
- }
- \fp_tmp:w
-% \end{macrocode}
-% After the loop part of the Taylor series, the factor of \( 2 \) needs
-% to be included. The total for the result can then be constructed.
-% \begin{macrocode}
- \tex_advance:D \l_fp_exp_decimal_int \l_fp_exp_decimal_int
- \tex_ifnum:D \l_fp_exp_extended_int < \c_five_hundred_million
- \tex_else:D
- \tex_advance:D \l_fp_exp_extended_int -\c_five_hundred_million
- \tex_advance:D \l_fp_exp_decimal_int \c_one
- \tex_fi:D
- \tex_advance:D \l_fp_exp_extended_int \l_fp_exp_extended_int
- \tex_ifnum:D \l_fp_output_sign_int > \c_zero
- \tex_expandafter:D \fp_add:NNNNNNNNN
- \tex_else:D
- \tex_expandafter:D \fp_sub:NNNNNNNNN
- \tex_fi:D
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
- \c_zero \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \l_fp_output_integer_int \l_fp_output_decimal_int
- \l_fp_output_extended_int
-}
-% \end{macrocode}
-% The usual shifts to move to fixed-point working. This is done using
-% the \texttt{output} registers as this saves a reassignment here.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_fixed: {
- \tex_ifnum:D \l_fp_output_exponent_int < \c_zero
- \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million
- \tex_expandafter:D \use_i:nn \tex_expandafter:D
- \fp_ln_fixed_aux:NNNNNNNNN
- \int_use:N \l_fp_output_decimal_int
- \tex_expandafter:D \fp_ln_fixed:
- \tex_fi:D
-}
-\cs_new_protected_nopar:Npn
- \fp_ln_fixed_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {
- \tex_ifnum:D \l_fp_output_integer_int = \c_zero
- \l_fp_output_decimal_int #1#2#3#4#5#6#7#8 \scan_stop:
- \tex_else:D
- \tl_set:Nx \l_fp_tmp_tl
- {
- \int_use:N \l_fp_output_integer_int
- #1#2#3#4#5#6#7#8
- }
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \l_fp_tmp_tl \scan_stop:
- \tex_fi:D
- \tex_advance:D \l_fp_output_exponent_int \c_one
-}
-% \end{macrocode}
-% The main loop for the Taylor series: unlike some of the other similar
-% functions, the result here is not the final value and is therefore
-% subject to further manipulation outside of the loop.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_ln_Taylor_aux: {
- \tex_advance:D \l_fp_count_int \c_two
- \fp_mul:NNNNNN
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_input_b_decimal_int \l_fp_input_b_extended_int
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int
- > \c_zero
- \fp_div_integer:NNNNN
- \l_fp_input_a_decimal_int \l_fp_input_a_extended_int
- \l_fp_count_int
- \l_fp_exp_decimal_int \l_fp_exp_extended_int
- \tex_advance:D \l_fp_output_decimal_int \l_fp_exp_decimal_int
- \tex_advance:D \l_fp_output_extended_int \l_fp_exp_extended_int
- \tex_ifnum:D \l_fp_output_extended_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_output_decimal_int \c_one
- \tex_advance:D \l_fp_output_extended_int
- -\c_one_thousand_million
- \tex_fi:D
- \tex_ifnum:D \l_fp_output_decimal_int < \c_one_thousand_million
- \tex_else:D
- \tex_advance:D \l_fp_output_integer_int \c_one
- \tex_advance:D \l_fp_output_decimal_int
- -\c_one_thousand_million
- \tex_fi:D
- \tex_expandafter:D \fp_ln_Taylor_aux:
- \tex_fi:D
-}
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\fp_pow:Nn, \fp_pow:cn}
-%\UnitTested
-%\begin{macro}{\fp_gpow:Nn,\fp_gpow:cn}
-%\UnitTested
-%\begin{macro}[aux]{\fp_pow_aux:NNn}
-%\begin{macro}[aux]{\fp_pow_aux_i:}
-%\begin{macro}[aux]{\fp_pow_positive:}
-%\begin{macro}[aux]{\fp_pow_negative:}
-%\begin{macro}[aux]{\fp_pow_aux_ii:}
-%\begin{macro}[aux]{\fp_pow_aux_iii:}
-%\begin{macro}[aux]{\fp_pow_aux_iv:}
-% The approach used for working out powers is to first filter out the
-% various special cases and then do most of the work using the
-% logarithm and exponent functions. The two storage areas are used
-% in the reverse of the `natural' logic as this avoids some
-% re-assignment in the sanity checking code.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_pow:Nn {
- \fp_pow_aux:NNn \tl_set:Nn
-}
-\cs_new_protected_nopar:Npn \fp_gpow:Nn {
- \fp_pow_aux:NNn \tl_gset:Nn
-}
-\cs_generate_variant:Nn \fp_pow:Nn { c }
-\cs_generate_variant:Nn \fp_gpow:Nn { c }
-\cs_new_protected_nopar:Npn \fp_pow_aux:NNn #1#2#3 {
- \group_begin:
- \fp_read:N #2
- \l_fp_input_b_sign_int \l_fp_input_a_sign_int
- \l_fp_input_b_integer_int \l_fp_input_a_integer_int
- \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int
- \l_fp_input_b_exponent_int \l_fp_input_a_exponent_int
- \fp_split:Nn a {#3}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int
- = \c_zero
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int
- = \c_zero
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2 { \c_undefined_fp }
- }
- \tex_else:D
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2 { \c_zero_fp }
- }
- \tex_fi:D
- \tex_else:D
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int
- = \c_zero
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2 { \c_one_fp }
- }
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_pow_aux_i:
- \tex_fi:D
- \tex_fi:D
- \fp_tmp:w #1 #2
-}
-% \end{macrocode}
-% Simply using the logarithm function directly will fail when negative
-% numbers are raised to integer powers, which is a mathematically valid
-% operation. So there are some more tests to make, after forcing the
-% power into an integer and decimal parts, if necessary.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_pow_aux_i: {
- \tex_ifnum:D \l_fp_input_b_sign_int > \c_zero
- \tl_set:Nn \l_fp_sign_tl { + }
- \tex_expandafter:D \fp_pow_aux_ii:
- \tex_else:D
- \l_fp_input_a_extended_int \c_zero
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_ten
- \group_begin:
- \fp_extended_normalise:
- \tex_ifnum:D
- \etex_numexpr:D
- \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int
- = \c_zero
- \group_end:
- \tl_set:Nn \l_fp_sign_tl { - }
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_pow_aux_ii:
- \tex_else:D
- \group_end:
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2 { \c_undefined_fp }
- }
- \tex_fi:D
- \tex_else:D
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2 { \c_undefined_fp }
- }
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% The approach used here for powers works well in most cases but gives
-% poorer results for negative integer powers, which often have exact
-% values. So there is some filtering to do. For negative powers where
-% the power is small, an alternative approach is used in which the
-% positive value is worked out and the reciprocal is then taken. The
-% filtering is unfortunately rather long.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_pow_aux_ii: {
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \tex_expandafter:D \fp_pow_aux_iv:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_exponent_int < \c_ten
- \group_begin:
- \l_fp_input_a_extended_int \c_zero
- \fp_extended_normalise:
- \tex_ifnum:D \l_fp_input_a_decimal_int = \c_zero
- \tex_ifnum:D \l_fp_input_a_integer_int > \c_ten
- \group_end:
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_pow_aux_iv:
- \tex_else:D
- \group_end:
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_pow_aux_iii:
- \tex_fi:D
- \tex_else:D
- \group_end:
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \tex_expandafter:D \fp_pow_aux_iv:
- \tex_fi:D
- \tex_else:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
- \fp_pow_aux_iv:
- \tex_fi:D
- \tex_fi:D
- \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2
- {
- \group_end:
- ##1 ##2
- {
- \l_fp_sign_tl
- \int_use:N \l_fp_output_integer_int
- .
- \tex_expandafter:D \use_none:n
- \tex_number:D \etex_numexpr:D
- \l_fp_output_decimal_int + \c_one_thousand_million
- \scan_stop:
- e
- \int_use:N \l_fp_output_exponent_int
- }
- }
-}
-% \end{macrocode}
-% For the small negative integer powers, the calculation is done for
-% the positive power and the reciprocal is then taken.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_pow_aux_iii: {
- \l_fp_input_a_sign_int \c_one
- \fp_pow_aux_iv:
- \l_fp_input_a_integer_int \c_one
- \l_fp_input_a_decimal_int \c_zero
- \l_fp_input_a_exponent_int \c_zero
- \l_fp_input_b_integer_int \l_fp_output_integer_int
- \l_fp_input_b_decimal_int \l_fp_output_decimal_int
- \l_fp_input_b_exponent_int \l_fp_output_exponent_int
- \fp_div_internal:
-}
-% \end{macrocode}
-% The business end of the code starts by finding the logarithm of the
-% given base. There is a bit of a shuffle so that this does not have
-% to be re-parsed and so that the output ends up in the correct place.
-% There is also a need to enable using the short-cut for a
-% pre-calculated result. The internal part of the multiplication
-% function can then be used to do the second part of the calculation
-% directly. There is some more set up before doing the exponential:
-% the idea here is to deactivate some internals so that everything works
-% smoothly.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \fp_pow_aux_iv: {
- \group_begin:
- \l_fp_input_a_integer_int \l_fp_input_b_integer_int
- \l_fp_input_a_decimal_int \l_fp_input_b_decimal_int
- \l_fp_input_a_exponent_int \l_fp_input_b_exponent_int
- \fp_ln_internal:
- \cs_set_protected_nopar:Npx \fp_tmp:w
- {
- \group_end:
- \exp_not:N \l_fp_input_b_sign_int
- \int_use:N \l_fp_output_sign_int \scan_stop:
- \exp_not:N \l_fp_input_b_integer_int
- \int_use:N \l_fp_output_integer_int \scan_stop:
- \exp_not:N \l_fp_input_b_decimal_int
- \int_use:N \l_fp_output_decimal_int \scan_stop:
- \exp_not:N \l_fp_input_b_extended_int
- \int_use:N \l_fp_output_extended_int \scan_stop:
- \exp_not:N \l_fp_input_b_exponent_int
- \int_use:N \l_fp_output_exponent_int \scan_stop:
- }
- \fp_tmp:w
- \l_fp_input_a_extended_int \c_zero
- \fp_mul:NNNNNNNNN
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \l_fp_input_b_integer_int \l_fp_input_b_decimal_int
- \l_fp_input_b_extended_int
- \l_fp_input_a_integer_int \l_fp_input_a_decimal_int
- \l_fp_input_a_extended_int
- \tex_advance:D \l_fp_input_a_exponent_int \l_fp_input_b_exponent_int
- \l_fp_output_integer_int \c_zero
- \l_fp_output_decimal_int \c_zero
- \l_fp_output_exponent_int \c_zero
- \cs_set_eq:NN \fp_exp_const:Nx \use_none:nn
- \fp_exp_internal:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\subsection{Tests for special values}
-%
-%\begin{macro}{\fp_if_undefined_p:N}
-%\begin{macro}[TF]{\fp_if_undefined:N}
-%\UnitTested
-% Testing for an undefined value is easy.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \fp_if_undefined:N #1 { T , F , TF , p } {
- \tex_ifx:D #1 \c_undefined_fp
- \prg_return_true:
- \tex_else:D
- \prg_return_false:
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\fp_if_zero_p:N}
-%\begin{macro}[TF]{\fp_if_zero:N}
-%\UnitTested
-% Testing for a zero fixed-point is also easy.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \fp_if_zero:N #1 { T , F , TF , p } {
- \tex_ifx:D #1 \c_zero_fp
- \prg_return_true:
- \tex_else:D
- \prg_return_false:
- \tex_fi:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%
-%
-%\subsection{Floating-point conditionals}
-%
-%\begin{macro}[TF]{\fp_compare:nNn}
-%\begin{macro}[TF]{\fp_compare:NNN}
-%\UnitTested
-%\begin{macro}[aux]{\fp_compare_aux:N}
-%\begin{macro}[aux]{\fp_compare_=:}
-%\begin{macro}[aux]{\fp_compare_<:}
-%\begin{macro}[aux]{\fp_compare_<_aux:}
-%\begin{macro}[aux]{\fp_compare_absolute_a>b:}
-%\begin{macro}[aux]{\fp_compare_absolute_a<b:}
-%\begin{macro}[aux]{\fp_compare_>:}
-% The idea for the comparisons is to provide two versions: slower and
-% faster. The lead off for both is the same: get the two numbers
-% read and then look for a function to handle the comparison.
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \fp_compare:nNn #1#2#3
- { T , F , TF }
- {
- \group_begin:
- \fp_split:Nn a {#1}
- \fp_standardise:NNNN
- \l_fp_input_a_sign_int
- \l_fp_input_a_integer_int
- \l_fp_input_a_decimal_int
- \l_fp_input_a_exponent_int
- \fp_split:Nn b {#3}
- \fp_standardise:NNNN
- \l_fp_input_b_sign_int
- \l_fp_input_b_integer_int
- \l_fp_input_b_decimal_int
- \l_fp_input_b_exponent_int
- \fp_compare_aux:N #2
-}
-\prg_new_protected_conditional:Npnn \fp_compare:NNN #1#2#3
- { T , F , TF }
- {
- \group_begin:
- \fp_read:N #3
- \l_fp_input_b_sign_int \l_fp_input_a_sign_int
- \l_fp_input_b_integer_int \l_fp_input_a_integer_int
- \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int
- \l_fp_input_b_exponent_int \l_fp_input_a_exponent_int
- \fp_read:N #1
- \fp_compare_aux:N #2
-}
-\cs_new_protected_nopar:Npn \fp_compare_aux:N #1 {
- \cs_if_exist:cTF { fp_compare_#1: }
- { \use:c { fp_compare_#1: } }
- {
- \group_end:
- \prg_return_false:
- }
-}
-% \end{macrocode}
-% For equality, the test is pretty easy as things are either equal or
-% they are not.
-% \begin{macrocode}
-\cs_new_protected_nopar:cpn { fp_compare_=: } {
- \tex_ifnum:D \l_fp_input_a_sign_int = \l_fp_input_b_sign_int
- \tex_ifnum:D \l_fp_input_a_integer_int = \l_fp_input_b_integer_int
- \tex_ifnum:D \l_fp_input_a_decimal_int = \l_fp_input_b_decimal_int
- \tex_ifnum:D
- \l_fp_input_a_exponent_int = \l_fp_input_b_exponent_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
-}
-% \end{macrocode}
-% Comparing two values is quite complex. First, there is a filter step
-% to check if one or other of the given values is zero. If it is then
-% the result is relatively easy to determine.
-% \begin{macrocode}
-\cs_new_protected_nopar:cpn { fp_compare_>: } {
- \tex_ifnum:D \etex_numexpr:D
- \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int
- = \c_zero
- \tex_ifnum:D \etex_numexpr:D
- \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int
- = \c_zero
- \group_end:
- \prg_return_false:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_b_sign_int > \c_zero
- \group_end:
- \prg_return_false:
- \tex_else:D
- \group_end:
- \prg_return_true:
- \tex_fi:D
- \tex_fi:D
- \tex_else:D
- \tex_ifnum:D \etex_numexpr:D
- \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int
- = \c_zero
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \group_end:
- \prg_return_true:
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
- \tex_else:D
- \use:c { fp_compare_>_aux: }
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% Next, check the sign of the input: this again may give an obvious
-% result. If both signs are the same, then hand off to comparing the
-% absolute values.
-% \begin{macrocode}
-\cs_new_protected_nopar:cpn { fp_compare_>_aux: } {
- \tex_ifnum:D \l_fp_input_a_sign_int > \l_fp_input_b_sign_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_sign_int < \l_fp_input_b_sign_int
- \group_end:
- \prg_return_false:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero
- \use:c { fp_compare_absolute_a>b: }
- \tex_else:D
- \use:c { fp_compare_absolute_a<b: }
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% Rather long runs of checks, as there is the need to go through each
-% layer of the input and do the comparison. There is also the need to
-% avoid messing up with equal inputs at each stage.
-% \begin{macrocode}
-\cs_new_protected_nopar:cpn { fp_compare_absolute_a>b: } {
- \tex_ifnum:D \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_exponent_int < \l_fp_input_b_exponent_int
- \group_end:
- \prg_return_false:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_a_integer_int > \l_fp_input_b_integer_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \tex_ifnum:D
- \l_fp_input_a_integer_int < \l_fp_input_b_integer_int
- \group_end:
- \prg_return_false:
- \tex_else:D
- \tex_ifnum:D
- \l_fp_input_a_decimal_int > \l_fp_input_b_decimal_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
-}
-\cs_new_protected_nopar:cpn { fp_compare_absolute_a<b: } {
- \tex_ifnum:D \l_fp_input_b_exponent_int > \l_fp_input_a_exponent_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_b_exponent_int < \l_fp_input_a_exponent_int
- \group_end:
- \prg_return_false:
- \tex_else:D
- \tex_ifnum:D \l_fp_input_b_integer_int > \l_fp_input_a_integer_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \tex_ifnum:D
- \l_fp_input_b_integer_int < \l_fp_input_a_integer_int
- \group_end:
- \prg_return_false:
- \tex_else:D
- \tex_ifnum:D
- \l_fp_input_b_decimal_int > \l_fp_input_a_decimal_int
- \group_end:
- \prg_return_true:
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
- \tex_fi:D
-}
-% \end{macrocode}
-% This is just a case of reversing the two input values and then
-% running the tests already defined.
-% \begin{macrocode}
-\cs_new_protected_nopar:cpn { fp_compare_<: } {
- \tl_set:Nx \l_fp_tmp_tl
- {
- \int_set:Nn \exp_not:N \l_fp_input_a_sign_int
- { \int_use:N \l_fp_input_b_sign_int }
- \int_set:Nn \exp_not:N \l_fp_input_a_integer_int
- { \int_use:N \l_fp_input_b_integer_int }
- \int_set:Nn \exp_not:N \l_fp_input_a_decimal_int
- { \int_use:N \l_fp_input_b_decimal_int }
- \int_set:Nn \exp_not:N \l_fp_input_a_exponent_int
- { \int_use:N \l_fp_input_b_exponent_int }
- \int_set:Nn \exp_not:N \l_fp_input_b_sign_int
- { \int_use:N \l_fp_input_a_sign_int }
- \int_set:Nn \exp_not:N \l_fp_input_b_integer_int
- { \int_use:N \l_fp_input_a_integer_int }
- \int_set:Nn \exp_not:N \l_fp_input_b_decimal_int
- { \int_use:N \l_fp_input_a_decimal_int }
- \int_set:Nn \exp_not:N \l_fp_input_b_exponent_int
- { \int_use:N \l_fp_input_a_exponent_int }
- }
- \l_fp_tmp_tl
- \use:c { fp_compare_>: }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Messages}
-%
-%\begin{macro}{\fp_overflow_msg:}
-% A generic overflow message, used whenever there is a possible
-% overflow.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { fpu } { overflow }
- { Number~too~big. }
- {
- The~input~given~is~too~big~for~the~LaTeX~floating~point~unit. \\
- Further~errors~may~well~occur!
- }
-\cs_new_protected_nopar:Npn \fp_overflow_msg: {
- \msg_kernel_error:nn { fpu } { overflow }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_exp_overflow_msg:}
-% A slightly more helpful message for exponent overflows.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { fpu } { exponent-overflow }
- { Number~too~big~for~exponent~unit. }
- {
- The~exponent~of~the~input~given~is~too~big~for~the~floating~point~
- unit:~the~maximum~input~value~for~an~exponent~is~230.
- }
-\cs_new_protected_nopar:Npn \fp_exp_overflow_msg: {
- \msg_kernel_error:nn { fpu } { exponent-overflow }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_ln_error_msg:}
-% Logarithms are only valid for positive number
-% \begin{macrocode}
-\msg_kernel_new:nnnn { fpu } { logarithm-input-error }
- { Invalid~input~to~ln~function. }
- { Logarithms~can~only~be~calculated~for~positive~numbers. }
-\cs_new_protected_nopar:Npn \fp_ln_error_msg: {
- \msg_kernel_error:nn { fpu } { logarithm-input-error }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\fp_trig_overflow_msg:}
-% A slightly more helpful message for trigonometric overflows.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { fpu } { trigonometric-overflow }
- { Number~too~big~for~trigonometry~unit. }
- {
- The~trigonometry~code~can~only~work~with~numbers~smaller~
- than~1000000000.
- }
-\cs_new_protected_nopar:Npn \fp_trig_overflow_msg: {
- \msg_kernel_error:nn { fpu } { trigonometric-overflow }
-}
-% \end{macrocode}
-%\end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%\end{implementation}
-%
-%\PrintChanges
-%
-%\PrintIndex
diff --git a/Master/texmf-dist/source/latex/expl3/l3int.dtx b/Master/texmf-dist/source/latex/expl3/l3int.dtx
deleted file mode 100644
index 4bb794a4b82..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3int.dtx
+++ /dev/null
@@ -1,2453 +0,0 @@
-% \iffalse
-%% File: l3int.dtx Copyright (C) 1990-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3int.dtx 2229 2011-04-11 17:37:05Z joseph $
- {L3 Experimental Integer module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3int.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3int} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Integers/counters}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-%\section{Integer values}
-%
-%
-% Calculation and comparison of integer values can be carried out
-% using literal numbers, \texttt{int} registers, constants and
-% integers stored in token list variables. The standard operators
-% \texttt{+}, \texttt{-}, \texttt{/} and \texttt{*} and
-% parentheses can be used within such expressions to carry
-% arithmetic operations. This module carries out these functions
-% on \emph{integer expressions} (`\texttt{int expr}').
-%
-%\subsection{Integer expressions}
-%
-%\begin{function}{
-% \int_eval:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_eval:n} \Arg{integer expression}
-% \end{syntax}
-% Evaluates the \meta{integer expression}, expanding any
-% integer and token list variables within the \meta{expression}
-% to their content (without requiring \cs{int_use:N}/\cs{tl_use:N})
-% and applying the standard mathematical rules. For example both
-% \begin{verbatim}
-% \int_eval:n { 5 + 4 * 3 - ( 3 + 4 * 5 ) }
-% \end{verbatim}
-% and
-% \begin{verbatim}
-% \tl_new:N \l_my_tl
-% \tl_set:Nn \l_my_tl { 5 }
-% \int_new:N \l_my_int
-% \int\set:Nn \l_my_int { 4 }
-% \int_eval:n { \l_my_tl + \l_my_int * 3 - ( 3 + 4 * 5 ) }
-% \end{verbatim}
-% both evaluate to \( -6 \). The \Arg{integer expression} may
-% contain the operators \texttt{+}, \texttt{-}, \texttt{*} and
-% \texttt{/}, along with parenthesis \texttt{(} and \texttt{)}.
-% After two expansions, \cs{int_eval:n} yields a
-% \meta{integer donation} which is left in the input stream. This is
-% \emph{not} an \meta{internal integer}, and therefore requires
-% suitable termination if used in a \TeX-style integer assignment.
-%\end{function}
-%
-%\begin{function}{
-% \int_abs:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_abs:n} \Arg{integer expression}
-% \end{syntax}
-% Evaluates the \meta{integer expression} as described for
-% \cs{int_eval:n} and leaves the absolute value of the result in
-% the input stream as an \meta{integer denotation} after two
-% expansions.
-%\end{function}
-%
-%\begin{function}{ \int_div_round:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_div_round:nn} \Arg{intexpr1} \Arg{intexpr2}
-% \end{syntax}
-% Evaluates the two \meta{integer expressions} as described earlier,
-% then calculates the result of dividing the first value by the
-% second, rounding any remainder. Note that division using "/"
-% is identical to this function. The result is left in the input
-% stream as a \meta{integer denotation} after two expansions.
-%\end{function}
-%
-%\begin{function}{
-% \int_div_truncate:nn / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_div_truncate:nn} \Arg{intexpr1} \Arg{intexpr2}
-% \end{syntax}
-% Evaluates the two \meta{integer expressions} as described earlier,
-% then calculates the result of dividing the first value by the
-% second, truncating any remainder. Note that division using "/"
-% rounds the result. The result is left in the input stream as a
-% \meta{integer denotation} after two expansions.
-%\end{function}
-%
-%\begin{function}{
-% \int_max:nn / (EXP) |
-% \int_min:nn / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_max:nn} \Arg{intexpr1} \Arg{intexpr2}
-% \cs{int_min:nn} \Arg{intexpr1} \Arg{intexpr2}
-% \end{syntax}
-% Evaluates the \meta{integer expressions} as described for
-% \cs{int_eval:n} and leaves either the larger or smaller value
-% in the input stream as an \meta{integer denotation} after two
-% expansions.
-%\end{function}
-%
-%\begin{function}{
-% \int_mod:nn / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_mod:nn} \Arg{intexpr1} \Arg{intexpr2}
-% \end{syntax}
-% Evaluates the two \meta{integer expressions} as described earlier,
-% then calculates the integer remainder of dividing the first
-% expression by the second. This is left in the input stream as an
-% \meta{integer denotation} after two expansions.
-%\end{function}
-%
-%\subsection{Integer variables}
-%
-%\begin{function}{
-% \int_new:N |
-% \int_new:c |
-%}
-% \begin{syntax}
-% \cs{int_new:N} \meta{integer}
-% \end{syntax}
-% Creates a new \meta{inter} or raises an error if the name is
-% already taken. The declaration is global. The \meta{integer} will
-% initially be equal to \( 0 \).
-%\end{function}
-%
-%\begin{function}{
-% \int_set_eq:NN |
-% \int_set_eq:cN |
-% \int_set_eq:Nc |
-% \int_set_eq:cc |
-%}
-% \begin{syntax}
-% \cs{int_set_eq:NN} \meta{integer1} \meta{integer 2}
-% \end{syntax}
-% Sets the content of \meta{integer1} equal to that of
-% \meta{integer 2}. This assignment is restricted to the current
-% \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \int_gset_eq:NN |
-% \int_gset_eq:cN |
-% \int_gset_eq:Nc |
-% \int_gset_eq:cc |
-%}
-% \begin{syntax}
-% \cs{int_gset_eq:NN} \meta{integer1} \meta{integer2}
-% \end{syntax}
-% Sets the content of \meta{integer1} equal to that of \meta{integer2}.
-% This assignment is global and so is not limited by the current
-% \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \int_add:Nn |
-% \int_add:cn |
-%}
-% \begin{syntax}
-% \cs{int_add:Nn} \meta{integer} \Arg{integer expression}
-% \end{syntax}
-% Adds the result of the \meta{integer expression} to the current
-% content of the \meta{integer}. This assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \int_gadd:Nn |
-% \int_gadd:cn |
-%}
-% \begin{syntax}
-% \cs{int_gadd:Nn} \meta{integer} \Arg{integer expression}
-% \end{syntax}
-% Adds the result of the \meta{integer expression} to the current
-% content of the \meta{integer}. This assignment is global.
-%\end{function}
-%
-%\begin{function}{
-% \int_decr:N |
-% \int_decr:c |
-%}
-% \begin{syntax}
-% \cs{int_decr:N} \meta{integer}
-% \end{syntax}
-% Decreases the value stored in \meta{integer} by \( 1 \) within
-% the scope of the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \int_gdecr:N |
-% \int_gdecr:c |
-%}
-% \begin{syntax}
-% \cs{int_incr:N} \meta{integer}
-% \end{syntax}
-% Decreases the value stored in \meta{integer} by \( 1 \) globally
-% (\emph{i.e}.~not limited by the current group level).
-%\end{function}
-%
-%\begin{function}{
-% \int_incr:N |
-% \int_incr:c |
-%}
-% \begin{syntax}
-% \cs{int_incr:N} \meta{integer}
-% \end{syntax}
-% Increases the value stored in \meta{integer} by \( 1 \) within
-% the scope of the current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \int_gincr:N |
-% \int_gincr:c |
-%}
-% \begin{syntax}
-% \cs{int_incr:N} \meta{integer}
-% \end{syntax}
-% Increases the value stored in \meta{integer} by \( 1 \) globally
-% (\emph{i.e}.~not limited by the current group level).
-%\end{function}
-%
-%\begin{function}{
-% \int_set:Nn |
-% \int_set:cn |
-%}
-% \begin{syntax}
-% \cs{int_set:Nn} \meta{integer} \Arg{integer expression}
-% \end{syntax}
-% Sets \meta{integer} to the value of \meta{integer expression},
-% which must evaluate to an integer (as described for
-% \cs{int_eval:n}). This assignment is restricted to the
-% current \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \int_gset:Nn |
-% \int_gset:cn |
-%}
-% \begin{syntax}
-% \cs{int_gset:Nn} \meta{integer} \Arg{integer expression}
-% \end{syntax}
-% Sets \meta{integer} to the value of \meta{integer expression},
-% which must evaluate to an integer (as described for
-% \cs{int_eval:n}). This assignment is global and is not limited
-% to the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \int_sub:Nn |
-% \int_sub:cn |
-%}
-% \begin{syntax}
-% \cs{int_sub:Nn} \meta{integer} \Arg{integer expression}
-% \end{syntax}
-% Subtracts the result of the \meta{integer expression} to the
-% current content of the \meta{integer}. This assignment is local.
-%\end{function}
-%
-%\begin{function}{
-% \int_gsub:Nn |
-% \int_gsub:cn |
-%}
-% \begin{syntax}
-% \cs{int_gsub:Nn} \meta{integer} \Arg{integer expression}
-% \end{syntax}
-% Subtracts the result of the \meta{integer expression} to the
-% current content of the \meta{integer}. This assignment is global.
-%\end{function}
-%
-%\begin{function}{
-% \int_zero:N |
-% \int_zero:c |
-%}
-% \begin{syntax}
-% \cs{int_zero:N} \meta{integer}
-% \end{syntax}
-% Sets \meta{integer} to \( 0 \) within the scope of the current
-% \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \int_gzero:N |
-% \int_gzero:c |
-%}
-% \begin{syntax}
-% \cs{int_gzero:N} \meta{integer}
-% \end{syntax}
-% Sets \meta{integer} to \( 0 \) globally, \emph{i.e}.~not
-% restricted by the current \TeX\ group level.
-%\end{function}
-%
-%\begin{function}{
-% \int_show:N |
-% \int_show:c |
-%}
-% \begin{syntax}
-% \cs{int_show:N} \meta{integer}
-% \end{syntax}
-% Displays the value of the \meta{integer} on the terminal.
-%\end{function}
-%
-%\begin{function}{
-% \int_use:N / (EXP) |
-% \int_use:c / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_use:N} \meta{integer}
-% \end{syntax}
-% Recovers the content of a \meta{integer} and places it directly
-% in the input stream. An error will be raised if the variable does
-% not exist or if it is invalid. Can be omitted in places where a
-% \meta{integer} is required (such as in the first and third arguments
-% of \cs{int_compare:nNnTF}).
-%\end{function}
-%
-%\subsection{Comparing integer expressions}
-%
-%\begin{function}{
-% \int_compare:nNn / (EXP) (pTF) |
-%}
-% \begin{syntax}
-% \cs{int_compare_p:nNn}
-% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2}
-% \cs{int_compare:nNnTF}
-% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2}
-% ~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% This function first evaluates each of the \meta{integer expressions}
-% as described for \cs{int_eval:n}. The two results are then
-% compared using the \meta{relation}:
-% \begin{center}
-% \begin{tabular}{ll}
-% Equal & "=" \\
-% Greater than & ">" \\
-% Less than & "<" \\
-% \end{tabular}
-% \end{center}
-% The branching versions then leave either \meta{true code} or
-% \meta{false code} in the input stream, as appropriate to the truth
-% of the test and the variant of the function chosen. The logical
-% truth of the test is left in the input stream by the predicate
-% version.
-%\end{function}
-%
-%\begin{function}{
-% \int_compare:n / (EXP) (pTF) |
-%}
-% \begin{syntax}
-% \cs{int_compare_p:n}
-% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \}
-% \cs{int_compare:nTF}
-% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \}
-% ~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% This function first evaluates each of the \meta{integer expressions}
-% as described for \cs{int_eval:n}. The two results are then
-% compared using the \meta{relation}:
-% \begin{center}
-% \begin{tabular}{ll}
-% Equal & "=" or "==" \\
-% Greater than or equal to & "=>" \\
-% Greater than & ">" \\
-% Less than or equal to & "=<" \\
-% Less than & "<" \\
-% Not equal & "!=" \\
-% \end{tabular}
-% \end{center}
-% The branching versions then leave either \meta{true code} or
-% \meta{false code} in the input stream, as appropriate to the truth
-% of the test and the variant of the function chosen. The logical
-% truth of the test is left in the input stream by the predicate
-% version.
-%\end{function}
-%
-%\begin{function}{
-% \int_if_even:n / (EXP) (pTF) |
-% \int_if_odd:n / (EXP) (pTF) |
-%}
-% \begin{syntax}
-% \cs{int_if_odd_p:n} \Arg{integer expression}
-% \cs{int_if_odd:nTF} \Arg{integer expression}
-% ~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% This function first evaluates the \meta{integer expression}
-% as described for \cs{int_eval:n}. It then evaluates if this
-% is odd or even, as appropriate. The branching versions then leave
-% either \meta{true code} or \meta{false code} in the input stream,
-% as appropriate to the truth of the test and the variant of the
-% function chosen. The logical truth of the test is left in the input
-% stream by the predicate version.
-%\end{function}
-%
-%\begin{function}{ \int_do_while:nNnn / (EXP) }
-% \begin{syntax}
-% \cs{int_do_while:nNnn}
-% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code}
-% \end{syntax}
-% Evaluates the relationship between the two \meta{integer expressions}
-% 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
-% \texttt{false}.
-% \end{function}
-%
-%\begin{function}{ \int_do_until:nNnn / (EXP) }
-% \begin{syntax}
-% \cs{int_do_until:nNnn}
-% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code}
-% \end{syntax}
-% Evaluates the relationship between the two \meta{integer expressions}
-% 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
-% \texttt{true}.
-% \end{function}
-%
-%\begin{function}{ \int_until_do:nNnn / (EXP) }
-% \begin{syntax}
-% \cs{int_until_do:nNnn}
-% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code}
-% \end{syntax}
-% 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
-% \meta{relation} is \texttt{true}.
-% \end{function}
-%
-%\begin{function}{ \int_while_do:nNnn / (EXP) }
-% \begin{syntax}
-% \cs{int_while_do:nNnn} \
-% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code}
-% \end{syntax}
-% 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
-% \meta{relation} is \texttt{false}.
-% \end{function}
-%
-%\begin{function}{ \int_do_while:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_do_while:nNnn}
-% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code}
-% \end{syntax}
-% Evaluates the relationship between the two \meta{integer expressions}
-% 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
-% \texttt{false}.
-% \end{function}
-%
-%\begin{function}{ \int_do_until:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_do_until:nn}
-% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code}
-% \end{syntax}
-% Evaluates the relationship between the two \meta{integer expressions}
-% 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
-% \texttt{true}.
-% \end{function}
-%
-%\begin{function}{ \int_until_do:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_until_do:nn}
-% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code}
-% \end{syntax}
-% 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: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
-% \meta{relation} is \texttt{true}.
-% \end{function}
-%
-%\begin{function}{ \int_while_do:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_while_do:nn} \
-% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code}
-% \end{syntax}
-% 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: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} is \texttt{false}.
-% \end{function}
-%
-%\subsection{Formatting integers}
-%
-% Integers can be placed into the output stream with formatting. These
-% conversions apply to any integer expressions.
-%
-%\begin{function}{ \int_to_arabic:n / (EXP) }
-% \begin{syntax}
-% \cs{int_to_arabic:n} \Arg{integer expression}
-% \end{syntax}
-% Places the value of the \meta{integer expression} in the input
-% stream as digits, with category code \( 12 \) (other).
-%\end{function}
-%
-%\begin{function}{
-% \int_to_alph:n / (EXP) |
-% \int_to_Alph:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_to_alph:n} \Arg{integer expression}
-% \end{syntax}
-% Evaluates the \meta{integer expression} and converts the result
-% into a series of letters, which are then left in the input stream.
-% The conversion rule uses the \( 26 \) letters of the English
-% alphabet, in order. Thus
-% \begin{verbatim}
-% \int_to_alph:n { 1 }
-% \end{verbatim}
-% places "a" in the input stream,
-% \begin{verbatim}
-% \int_to_alph:n { 26 }
-% \end{verbatim}
-% is represented as "z" and
-% \begin{verbatim}
-% \int_to_alph:n { 27 }
-% \end{verbatim}
-% is converted to `aa'. For conversions using other alphabets, use
-% \cs{int_convert_to_symbols:nnn} to define an alphabet-specific
-% function. The basic \cs{int_to_alph:n} and \cs{int_to_Alph:n}
-% functions should not be modified.
-%\end{function}
-%
-%\begin{function}{ \int_to_binary:n / (EXP) }
-% \begin{syntax}
-% \cs{int_to_binary:n} \Arg{integer expression}
-% \end{syntax}
-% Calculates the value of the \meta{integer expression} and places
-% the binary representation of the result in the input stream.
-%\end{function}
-%
-%\begin{function}{ \int_to_hexadecimal:n / (EXP) }
-% \begin{syntax}
-% \cs{int_to_binary:n} \Arg{integer expression}
-% \end{syntax}
-% Calculates the value of the \meta{integer expression} and places
-% the hexadecimal (base~\( 16 \)) representation of the result in the
-% input stream. Upper case letters are used for digits beyond \( 9 \).
-%\end{function}
-%
-%\begin{function}{ \int_to_octal:n / (EXP) }
-% \begin{syntax}
-% \cs{int_to_octal:n} \Arg{integer expression}
-% \end{syntax}
-% Calculates the value of the \meta{integer expression} and places
-% the octal (base~\( 8 \)) representation of the result in the input
-% stream.
-%\end{function}
-%
-%\begin{function}{
-% \int_to_roman:n / (EXP) |
-% \int_to_Roman:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{int_to_roman:n} \Arg{integer expression}
-% \end{syntax}
-% Places the value of the \meta{integer expression} in the input
-% stream as Roman numerals, either lower case (\cs{int_to_roman:n})
-% or upper case (\cs{int_to_Roman:n}). The numerals are letters
-% with category code \( 11 \) (letter).
-%\end{function}
-%
-%\begin{function}{ \int_to_symbol:n / (EXP) }
-% \begin{syntax}
-% \cs{int_to_symbol:n} \Arg{integer expression}
-% \end{syntax}
-% Calculates the value of the \meta{integer expression} and places
-% the symbol representation of the result in the input stream. The
-% list of symbols used is equivalent to \LaTeXe's \cs{@fnsymbol}
-% set.
-%\end{function}
-%
-%\subsection{Converting from other formats}
-%
-%\begin{function}{ \int_from_alph:n / (EXP) }
-% \begin{syntax}
-% \cs{int_from_alpa:n} \Arg{letters}
-% \end{syntax}
-% Converts the \meta{letters} into the integer (base~\( 10 \))
-% representation and leaves this in the input stream. The
-% \meta{letters} are treated using the English alphabet only, with
-% `a' equal to \( 1 \) through to `z' equal to \( 26 \). Either lower
-% or upper case letters may be used. This is the inverse function of
-% \cs{int_to_alph:n}.
-%\end{function}
-%
-%\begin{function}{ \int_from_binary:n / (EXP) }
-% \begin{syntax}
-% \cs{int_from_binary:n} \Arg{binary number}
-% \end{syntax}
-% Converts the \meta{binary number} into the integer (base~\( 10 \))
-% representation and leaves this in the input stream.
-%\end{function}
-%
-%\begin{function}{ \int_from_hexadecimal:n / (EXP) }
-% \begin{syntax}
-% \cs{int_from_binary:n} \Arg{hexadecimal number}
-% \end{syntax}
-% Converts the \meta{hexadecimal number} into the integer
-% (base~\( 10 \)) representation and leaves this in the input stream.
-% Digits greater than \( 9 \) may be represented in the
-% \meta{hexadecimal number} by upper or lower case letters.
-%\end{function}
-%
-%\begin{function}{ \int_from_octal:n / (EXP) }
-% \begin{syntax}
-% \cs{int_from_octal:n} \Arg{octal number}
-% \end{syntax}
-% Converts the \meta{octal number} into the integer (base~\( 10 \))
-% representation and leaves this in the input stream.
-%\end{function}
-%
-%\begin{function}{ \int_from_roman:n / (EXP) }
-% \begin{syntax}
-% \cs{int_from_roman:n} \Arg{roman numeral}
-% \end{syntax}
-% Converts the \meta{roman numeral} into the integer (base~\( 10 \))
-% representation and leaves this in the input stream. The
-% \meta{roman numeral} may be in upper or lower case; if the numeral
-% is not valid then the resulting value will be \( -1 \).
-%\end{function}
-%
-%\subsection{Low-level conversion functions}
-%
-% As well as the higher-level functions already documented, there
-% are a series of lower-level functions which can be used to carry out
-% generic conversions. These are used to create the higher-level
-% versions documented above.
-%
-%\begin{function}{ \int_convert_from_base_ten:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_convert_from_base_ten:nn} \Arg{integer expression}
-% ~~\Arg{base}
-% \end{syntax}
-% Calculates the value of the \meta{integer expression} and
-% converts it into the appropriate representation in the \meta{base};
-% the later may be given as an integer expression. For bases greater
-% than \( 10 \) the higher `digits' are represented by the upper case
-% letters from the English alphabet (with normal category codes). The
-% maximum \meta{base} value is \( 36 \).
-%\end{function}
-%
-%\begin{function}{ \int_convert_to_base_ten:nn / (EXP) }
-% \begin{syntax}
-% \cs{int_convert_to_base_ten:nn} \Arg{number}
-% ~~\Arg{base}
-% \end{syntax}
-% Converts the \meta{number} in \meta{base} into the appropriate
-% value in base \( 10 \). The \meta{number} should consist of
-% digits and letters (either lower or upper case), plus optionally
-% a leading sign. The maximum \meta{base} value is \( 36 \).
-%\end{function}
-%
-%\begin{function}{ \int_convert_to_symbols:nnn / (EXP) }
-% \begin{syntax}
-% \cs{int_convert_to_symbols:nnn}
-% ~~\Arg{integer expression} \Arg{total symbols}
-% ~~\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
-% 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
-% appropriate symbol. Thus the \cs{int_to_alph:n} function is defined
-% as
-% \begin{verbatim}
-% \cs_new:Npn \int_to_alph:n #1 {
-% \int_convert_to_sybols:nnn {#1} { 26 }
-% {
-% { 1 } { a }
-% { 2 } { b }
-% { 3 } { c }
-% { 4 } { d }
-% { 5 } { e }
-% { 6 } { f }
-% { 7 } { g }
-% { 8 } { h }
-% { 9 } { i }
-% { 10 } { j }
-% { 11 } { k }
-% { 12 } { l }
-% { 13 } { m }
-% { 14 } { n }
-% { 15 } { o }
-% { 16 } { p }
-% { 17 } { q }
-% { 18 } { r }
-% { 19 } { s }
-% { 20 } { t }
-% { 21 } { u }
-% { 22 } { v }
-% { 23 } { w }
-% { 24 } { x }
-% { 25 } { y }
-% { 26 } { z }
-% }
-% }
-% \end{verbatim}
-%\end{function}
-%
-%\section{Variables and constants}
-%
-% \begin{variable}{%
-% \l_tmpa_int |
-% \l_tmpb_int |
-% \l_tmpc_int |
-% \g_tmpa_int |
-% \g_tmpb_int |
-% }
-% Scratch register for immediate use. They are not used by conditionals
-% or predicate functions.
-% \end{variable}
-%
-%\begin{function}{
-% \int_const:Nn |
-% \int_const:cn |
-%}
-% \begin{syntax}
-% \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
-% globally to the \meta{integer expression}.
-%\end{function}
-%
-%\begin{variable}{ \c_max_int }
-% The maximum value that can be stored as an integer.
-%\end{variable}
-%
-%\begin{variable}{
-% \c_minus_one |
-% \c_zero |
-% \c_one |
-% \c_two |
-% \c_three |
-% \c_four |
-% \c_five |
-% \c_six |
-% \c_seven |
-% \c_eight |
-% \c_nine |
-% \c_ten |
-% \c_eleven |
-% \c_twelve |
-% \c_thirteen |
-% \c_fourteen |
-% \c_fifteen |
-% \c_sixteen |
-% \c_thirty_two |
-% \c_hundred_one |
-% \c_twohundred_fifty_five |
-% \c_twohundred_fifty_six |
-% \c_thousand |
-% \c_ten_thousand |
-% \c_ten_thousand_one |
-% \c_ten_thousand_two |
-% \c_ten_thousand_three |
-% \c_ten_thousand_four |
-% \c_twenty_thousand |
-%}
-% Integer values used with primitive tests and assignments:
-% self-terminating nature makes these more convenient and faster than
-% literal numbers.
-%\end{variable}
-%
-% \begin{variable}{\c_max_register_int}
-% Maximum number of registers.
-% \end{variable}
-%
-%\subsection{Internal functions}
-%
-% \begin{function}{\int_to_roman:w / (EXP)}
-% \begin{syntax}
-% "\int_to_roman:w" <integer> <space> \textit{or} <non-expandable token>
-% \end{syntax}
-% Converts <integer> to it lowercase roman representation. Note that
-% it produces a string of letters with catcode 12.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{romannumeral} renamed.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{
-% \int_roman_lcuc_mapping:Nnn |
-% \int_to_roman_lcuc:NN |
-% }
-% \begin{syntax}
-% "\int_roman_lcuc_mapping:Nnn" <roman_char> \Arg{licr} \Arg{LICR}
-% "\int_to_roman_lcuc:NN" <roman_char> <char>
-% \end{syntax}
-% "\int_roman_lcuc_mapping:Nnn" specifies how the roman
-% numeral <roman\_ char> (i, v, x, l, c, d, or m) should be
-% interpreted when converting the number. <licr> is the lower case and
-% <LICR> is the uppercase mapping. "\int_to_roman_lcuc:NN" is a
-% recursive function converting the roman numerals.
-% \end{function}
-%
-%
-% \begin{function}{
-% \int_convert_number_with_rule:nnN |
-% \int_symbol_math_conversion_rule:n |
-% \int_symbol_text_conversion_rule:n |
-% }
-% \begin{syntax}
-% "\int_convert_number_with_rule:nnN" \Arg{int1} \Arg{int2} <function>
-% \end{syntax}
-% "\int_convert_number_with_rule:nnN" converts <int1> into letters,
-% symbols, whatever as defined by <function>. <int2> denotes the base
-% number for the conversion.
-% \end{function}
-%
-%\begin{function}{
-% \if_num:w / (EXP) |
-% \if_int_compare:w / (EXP)
-%}
-% \begin{syntax}
-% "\if_num:w" <number1> <rel> <number2> <true> "\else:" <false> "\fi:"
-% \end{syntax}
-% Compare two integers using <rel>, which must be one of
-% \texttt{=}, "<" or ">" with category code \(12\).
-% The \cs{else:} branch is optional.
-% \begin{texnote}
-% These are both names for the \TeX\ primitive \cs{ifnum}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \if_case:w / (EXP) |
-% \or: / (EXP)
-%}
-% \begin{syntax}
-% "\if_case:w" <number> <case0> "\or:" <case1> "\or:" "..." "\else:"
-% <default> "\fi:"
-% \end{syntax}
-% Selects a case to execute based on the value of <number>. The first
-% case (<case0>) is executed if <number> is \(0\), the second
-% (<case1>) if the <number> is \(1\), \emph{etc}. The
-% <number> may be a literal, a constant or an integer
-% expression (\emph{e.g}.~using \cs{int_eval:n}).
-% \begin{texnote}
-% These are the \TeX\ primitives \cs{ifcase} and \cs{or}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\int_value:w / (EXP)}
-% \begin{syntax}
-% "\int_value:w" <integer>
-% "\int_value:w" <tokens> <optional space>
-% \end{syntax}
-% Expands <tokens> until an <integer> is formed. One space may be
-% gobbled in the process.
-% \begin{texnote}
-% This is the \TeX\ primitive \tn{number}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \int_eval:w / (EXP) |
-% \int_eval_end:
-%}
-% \begin{syntax}
-% "\int_eval:w" <int expr> "\int_eval_end:"
-% \end{syntax}
-% Evaluates <integer expression> as described for \cs{int_eval:n}.
-% The evalution stops when an unexpandable token with category code
-% other than \(12\) is read or when \cs{int_eval_end:} is
-% reached. The latter is gobbled by the scanner mechanism:
-% \cs{int_eval_end:} itself is unexpandable but used correctly
-% the entire construct is expandable.
-% \begin{texnote}
-% This is the \eTeX\ primitive \cs{numexpr}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\if_int_odd:w / (EXP)}
-% \begin{syntax}
-% "\if_int_odd:w" <tokens> <true> "\else:" <false> "\fi:"
-% "\if_int_odd:w" <number> <true> "\else:" <false> "\fi:"
-% \end{syntax}
-% Expands <tokens> until a non-numeric tokens is found, and
-% tests whether the resulting <number> is odd. If so, <true code>
-% is executed. The \cs{else:} branch is optional.
-% \begin{texnote}
-% This is the \TeX\ primitive \cs{ifodd}.
-% \end{texnote}
-%\end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3int} implementation}
-%
-% \TestFiles{m3int001.lvt,m3int002.lvt,m3int03.lvt}
-%
-% \subsection{Internal functions and variables}
-%
-% \begin{function}{\int_advance:w}
-% \begin{syntax}
-% "\int_advance:w" <int register> <optional `\texttt{by}'> <number> <space>
-% \end{syntax}
-% Increments the count register by the specified amount.
-% \begin{texnote}
-% This is \TeX's \tn{advance}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{\int_convert_number_to_letter:n / (EXP)}
-% \begin{syntax}
-% "\int_convert_number_to_letter:n" \Arg{integer expression}
-% \end{syntax}
-% Internal function for turning a number for a different base into a letter or digit.
-% \end{function}
-%
-% \begin{function}{\int_pre_eval_one_arg:Nn | \int_pre_eval_two_args:Nnn}
-% \begin{syntax}
-% "\int_pre_eval_one_arg:Nn" <function> \Arg{integer expression}
-% "\int_pre_eval_one_arg:Nnn" <function> \Arg{int~expr~1} \Arg{int~expr~2}
-% \end{syntax}
-% These are expansion helpers; they evaluate their integer expressions
-% before handing them off to the specified <function>.
-% \end{function}
-%
-% \begin{function}{ \int_get_sign_and_digits:n / (EXP) |
-% \int_get_sign:n / (EXP ) |
-% \int_get_digits:n / (EXP) }
-% \begin{syntax}
-% "\int_get_sign_and_digits:n" \Arg{number}
-% \end{syntax}
-% From an argument that may or may not include a "+" or "-" sign, these
-% functions expand to the respective components of the number.
-% \end{function}
-%
-% \subsection{Module loading and primitives definitions}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macro}{\int_value:w}
-% \begin{macro}{\int_eval:n,\int_eval:w,\int_eval_end:}
-% \begin{macro}{\if_int_compare:w}
-% \begin{macro}{\if_int_odd:w}
-% \begin{macro}{\if_num:w}
-% \begin{macro}{\if_case:w}
-% \begin{macro}{\int_to_roman:w}
-% \begin{macro}{\int_advance:w}
-% Here are the remaining primitives for number comparisons and
-% expressions.
-% \begin{macrocode}
-\cs_set_eq:NN \int_value:w \tex_number:D
-\cs_set_eq:NN \int_eval:w \etex_numexpr:D
-\cs_set_protected:Npn \int_eval_end: {\tex_relax:D}
-\cs_set_eq:NN \if_int_compare:w \tex_ifnum:D
-\cs_new_eq:NN \if_num:w \tex_ifnum:D
-\cs_set_eq:NN \if_int_odd:w \tex_ifodd:D
-\cs_new_eq:NN \if_case:w \tex_ifcase:D
-\cs_new_eq:NN \int_to_roman:w \tex_romannumeral:D
-\cs_new_eq:NN \int_advance:w \tex_advance:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_eval:n}
-% Wrapper for \cs{int_eval:w}. Can be used in an integer expression
-% or directly in the input stream.
-% \begin{macrocode}
-\cs_set:Npn \int_eval:n #1{
- \int_value:w \int_eval:w #1\int_eval_end:
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \subsection{Allocation and setting}
-%
-% \begin{macro}{\int_new:N,\int_new:c}
-% \UnitTested
-% For the \LaTeX3 format:
-% \begin{macrocode}
-%<*initex>
-\alloc_new:nnnN {int} {11} {\c_max_register_int} \tex_countdef:D
-%</initex>
-% \end{macrocode}
-% For `l3in2e':
-% \begin{macrocode}
-%<*package>
-\cs_new_protected_nopar:Npn \int_new:N #1 {
- \chk_if_free_cs:N #1
- \newcount #1
-}
-%</package>
-% \end{macrocode}
-% \begin{macrocode}
-\cs_generate_variant:Nn \int_new:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_set:Nn, \int_set:cn}
-% \UnitTested
-% \begin{macro}{\int_gset:Nn,\int_gset:cn}
-% \UnitTested
-% Setting counters is again something that I would like to make
-% uniform at the moment to get a better overview.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_set:Nn #1#2{#1 \int_eval:w #2\int_eval_end:
-%<*check>
-\chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_protected_nopar:Npn \int_gset:Nn {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \int_set:Nn }
-\cs_generate_variant:Nn\int_set:Nn {cn}
-\cs_generate_variant:Nn\int_gset:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-%\begin{macro}{\int_set_eq:NN,\int_set_eq:cN,
-% \int_set_eq:Nc,\int_set_eq:cc}
-% \UnitTested
-%\begin{macro}{\int_gset_eq:NN,\int_gset_eq:cN,
-% \int_gset_eq:Nc,\int_gset_eq:cc}
-% \UnitTested
-% Setting equal means using one integer inside the set function of
-% another.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_set_eq:NN #1#2 {
- \int_set:Nn #1 {#2}
-}
-\cs_generate_variant:Nn \int_set_eq:NN { c }
-\cs_generate_variant:Nn \int_set_eq:NN { Nc }
-\cs_generate_variant:Nn \int_set_eq:NN { cc }
-\cs_new_protected_nopar:Npn \int_gset_eq:NN #1#2 {
- \int_gset:Nn #1 {#2}
-}
-\cs_generate_variant:Nn \int_gset_eq:NN { c }
-\cs_generate_variant:Nn \int_gset_eq:NN { Nc }
-\cs_generate_variant:Nn \int_gset_eq:NN { cc }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-% \begin{macro}{\int_incr:N,\int_incr:c}
-% \UnitTested
-% \begin{macro}{\int_decr:N,\int_decr:c}
-% \UnitTested
-% \begin{macro}{\int_gincr:N,\int_gincr:c}
-% \UnitTested
-% \begin{macro}{\int_gdecr:N,\int_gdecr:c}
-% \UnitTested
-% Incrementing and decrementing of integer registers is done with
-% the following functions.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_incr:N #1{\int_advance:w#1\c_one
-%<*check>
- \chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_protected_nopar:Npn \int_decr:N #1{\int_advance:w#1\c_minus_one
-%<*check>
- \chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_protected_nopar:Npn \int_gincr:N {
-% \end{macrocode}
-% We make sure that a local variable is not updated globally by
-% changing the internal test (i.e.\ |\chk_local_or_pref_global:N|) before
-% making the assignment. This is done by |\pref_global_chk:| which also
-% issues the necessary |\pref_global:D|. This is not very efficient, but
-% this code will be only included for debugging purposes. Using
-% |\pref_global:D| in front of the local function is better in the
-% production versions.
-% \begin{macrocode}
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \int_incr:N}
-\cs_new_protected_nopar:Npn \int_gdecr:N {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \int_decr:N}
-% \end{macrocode}
-% With the |\int_add:Nn| functions we can shorten the above code.
-% If this makes it too slow \ldots
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \int_incr:N #1{\int_add:Nn#1\c_one}
-\cs_set_protected_nopar:Npn \int_decr:N #1{\int_add:Nn#1\c_minus_one}
-\cs_set_protected_nopar:Npn \int_gincr:N #1{\int_gadd:Nn#1\c_one}
-\cs_set_protected_nopar:Npn \int_gdecr:N #1{\int_gadd:Nn#1\c_minus_one}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \int_incr:N {c}
-\cs_generate_variant:Nn \int_decr:N {c}
-\cs_generate_variant:Nn \int_gincr:N {c}
-\cs_generate_variant:Nn \int_gdecr:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_zero:N,\int_zero:c}
-% \UnitTested
-% \begin{macro}{\int_gzero:N,\int_gzero:c}
-% \UnitTested
-% Functions that reset an \m{int} register to zero.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_zero:N #1 {#1=\c_zero}
-\cs_generate_variant:Nn \int_zero:N {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_gzero:N #1 {\pref_global:D #1=\c_zero}
-\cs_generate_variant:Nn \int_gzero:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\int_add:Nn,\int_add:cn}
-% \UnitTested
-% \begin{macro}{\int_gadd:Nn,\int_gadd:cn}
-% \UnitTested
-% \begin{macro}{\int_sub:Nn,\int_sub:cn}
-% \UnitTested
-% \begin{macro}{\int_gsub:Nn,\int_gsub:cn}
-% \UnitTested
-% Adding and substracting to and from a counter \ldots
-% We should think of using these functions
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_add:Nn #1#2{
-% \end{macrocode}
-% We need to say |by| in case the first argument is a register
-% accessed by its number, e.g., |\count23|. Not that it should
-% ever happen but\dots
-% \begin{macrocode}
- \int_advance:w #1 by \int_eval:w #2\int_eval_end:
-%<*check>
- \chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_nopar:Npn \int_sub:Nn #1#2{
- \int_advance:w #1-\int_eval:w #2\int_eval_end:
-%<*check>
-\chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_protected_nopar:Npn \int_gadd:Nn {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \int_add:Nn }
-\cs_new_protected_nopar:Npn \int_gsub:Nn {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \int_sub:Nn }
-\cs_generate_variant:Nn \int_add:Nn {cn}
-\cs_generate_variant:Nn \int_gadd:Nn {cn}
-\cs_generate_variant:Nn \int_sub:Nn {cn}
-\cs_generate_variant:Nn \int_gsub:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_use:N,\int_use:c}
-% \UnitTested
-% Here is how counters are accessed:
-% \begin{macrocode}
-\cs_new_eq:NN \int_use:N \tex_the:D
-\cs_new_nopar:Npn \int_use:c #1{\int_use:N \cs:w#1\cs_end:}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_show:N,\int_show:c}
-% \UnitTested
-% \begin{macrocode}
-\cs_new_eq:NN \int_show:N \kernel_register_show:N
-\cs_new_eq:NN \int_show:c \kernel_register_show:c
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\int_to_arabic:n}
-% \UnitTested
-% Nothing exciting here.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_to_arabic:n #1{ \int_eval:n{#1}}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}[aux]{\int_roman_lcuc_mapping:Nnn}
-% Using \TeX's built-in feature for producing roman numerals has some
-% surprising features. One is the the characters resulting from
-% |\int_to_roman:w| have category code~12 so they may fail in
-% certain comparison tests. Therefore we use a mapping from the
-% character \TeX{} produces to the character we actually want which
-% will give us letters with category code~11.%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_roman_lcuc_mapping:Nnn #1#2#3{
- \cs_set_nopar:cpn {int_to_lc_roman_#1:}{#2}
- \cs_set_nopar:cpn {int_to_uc_roman_#1:}{#3}
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% Here are the default mappings. I haven't found any examples of say
-% Turkish doing the mapping |i \i I| but at least there is a
-% possibility for it if needed. Note: I have now asked a Turkish
-% person and he tells me they do the |i I| mapping.
-% \begin{macrocode}
-\int_roman_lcuc_mapping:Nnn i i I
-\int_roman_lcuc_mapping:Nnn v v V
-\int_roman_lcuc_mapping:Nnn x x X
-\int_roman_lcuc_mapping:Nnn l l L
-\int_roman_lcuc_mapping:Nnn c c C
-\int_roman_lcuc_mapping:Nnn d d D
-\int_roman_lcuc_mapping:Nnn m m M
-% \end{macrocode}
-% For the delimiter we cheat and let it gobble its arguments instead.
-% \begin{macrocode}
-\int_roman_lcuc_mapping:Nnn Q \use_none:nn \use_none:nn
-% \end{macrocode}
-%
-% \begin{macro}{\int_to_roman:n, \int_to_Roman:n}
-% \UnitTested
-% \TestMissing{output is catcode 11}
-% \begin{macro}[aux]{\int_to_roman_lcuc:NN}
-% The commands for producing the lower and upper case roman numerals
-% run a loop on one character at a time and also carries some
-% information for upper or lower case with it. We put it through
-% |\int_eval:n| first which is safer and more flexible.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_to_roman:n #1 {
- \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN l
- \int_to_roman:w \int_eval:n {#1} Q
-}
-\cs_new_nopar:Npn \int_to_Roman:n #1 {
- \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN u
- \int_to_roman:w \int_eval:n {#1} Q
-}
-\cs_new_nopar:Npn \int_to_roman_lcuc:NN #1#2{
- \use:c {int_to_#1c_roman_#2:}
- \int_to_roman_lcuc:NN #1
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%\begin{macro}{\int_convert_to_symbols:nnn}
-%\UnitTested
-% For conversion of integers to arbitrary symbols the method is in
-% general as follows. The input number ("#1") is compared to the total
-% number of symbols available at each place ("#2"). If the input is larger
-% than the total number of symbols available then the modulus is needed,
-% with one added so that the positions don't have to number from
-% zero. Using an \texttt{f}-type expansion, this is done so that the system
-% is recursive. The actual conversion function therefore gets a `nice'
-% number at each stage. Of course, if the initial input was small enough
-% then there is no problem and everything is easy. This is more or less the
-% same as \cs{int_convert_number_with_rule:nnN} but `pre-packaged'.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_convert_to_symbols:nnn #1#2#3 {
- \int_compare:nNnTF {#1} > {#2}
- {
- \exp_args:Nf \int_convert_to_symbols:nnn
- { \int_div_truncate:nn { #1 - 1 } {#2} } {#2} {#3}
- \exp_args:Nf \prg_case_int:nnn
- { \int_eval:n { 1 + \int_mod:nn { #1 - 1 } {#2} } }
- {#3} { }
- }
- { \exp_args:Nf \prg_case_int:nnn { \int_eval:n {#1} } {#3} { } }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%
-%
-% \begin{macro}{\int_convert_number_with_rule:nnN}
-% This is our major workhorse for conversions. |#1| is the number we
-% want converted, |#2| is the base number, and |#3| is the function
-% converting the number. This function expects to receive a
-% non-negative integer and as such is ideal for something using
-% |\if_case:w| internally.
-%
-% The basic example is this: We want to convert the number 50 (|#1|)
-% into an alphabetic equivalent |ax|. For the English language our
-% list contains 26 elements so this is our argument |#2| while the
-% function |#3| just turns |1| into |a|, |2| into |b|, etc. Hence our
-% goal is to turn 50 into the sequence |#3{1}#1{24}| so what we do is
-% to first divide 50 by 26 and truncating the result returning 1.
-% Then before we execute this we call the function again but this time
-% on the result of the remainder of the division. This goes on until
-% the remainder is less than or equal to the base number where we just
-% call the function |#3| directly on the number.
-%
-% We do a little pre-expansion of the arguments below as they
-% otherwise have a tendency to grow quite large.
-% \begin{macrocode}
-\cs_set_nopar:Npn \int_convert_number_with_rule:nnN #1#2#3{
- \int_compare:nNnTF {#1}>{#2}
- {
- \exp_args:Nf \int_convert_number_with_rule:nnN
- { \int_div_truncate:nn {#1-1}{#2} }{#2}
- #3
-% \end{macrocode}
-% Note that we have to nudge our modulus function so it won't
-% return~$0$ as that wouldn't work with |\if_case:w| when that
-% expects a positive number to produce a letter.
-% \begin{macrocode}
- \exp_args:Nf #3 { \int_eval:n{1+\int_mod:nn {#1-1}{#2}} }
- }
- { \exp_args:Nf #3{ \int_eval:n{#1} } }
-}
-% \end{macrocode}
-% As can be seen it is even simpler to convert to number systems
-% that contain 0, since then we don't have to add or subtract 1
-% here and there.
-% \end{macro}
-%
-%
-%\begin{macro}{\int_to_alph:n,\int_to_Alph:n}
-%\UnitTested
-% These both use the above function with input functions that make sense
-% for the alphabet in English.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_to_alph:n #1 {
- \int_convert_to_symbols:nnn {#1} { 26 }
- {
- { 1 } { a }
- { 2 } { b }
- { 3 } { c }
- { 4 } { d }
- { 5 } { e }
- { 6 } { f }
- { 7 } { g }
- { 8 } { h }
- { 9 } { i }
- { 10 } { j }
- { 11 } { k }
- { 12 } { l }
- { 13 } { m }
- { 14 } { n }
- { 15 } { o }
- { 16 } { p }
- { 17 } { q }
- { 18 } { r }
- { 19 } { s }
- { 20 } { t }
- { 21 } { u }
- { 22 } { v }
- { 23 } { w }
- { 24 } { x }
- { 25 } { y }
- { 26 } { z }
- }
-}
-\cs_new_nopar:Npn \int_to_Alph:n #1 {
- \int_convert_to_symbols:nnn {#1} { 26 }
- {
- { 1 } { A }
- { 2 } { B }
- { 3 } { C }
- { 4 } { D }
- { 5 } { E }
- { 6 } { F }
- { 7 } { G }
- { 8 } { H }
- { 9 } { I }
- { 10 } { J }
- { 11 } { K }
- { 12 } { L }
- { 13 } { M }
- { 14 } { N }
- { 15 } { O }
- { 16 } { P }
- { 17 } { Q }
- { 18 } { R }
- { 19 } { S }
- { 20 } { T }
- { 21 } { U }
- { 22 } { V }
- { 23 } { W }
- { 24 } { X }
- { 25 } { Y }
- { 26 } { Z }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%
-% \begin{macro}{\int_to_symbol:n}
-% \UnitTested
-% Turning a number into a symbol is also easy enough.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_to_symbol:n #1{
- \mode_if_math:TF
- {
- \int_convert_number_with_rule:nnN {#1}{9}
- \int_symbol_math_conversion_rule:n
- }
- {
- \int_convert_number_with_rule:nnN {#1}{9}
- \int_symbol_text_conversion_rule:n
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\int_symbol_math_conversion_rule:n}
-% \begin{macro}{\int_symbol_text_conversion_rule:n}
-% Nothing spectacular here.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_symbol_math_conversion_rule:n #1 {
- \if_case:w #1
- \or: *
- \or: \dagger
- \or: \ddagger
- \or: \mathsection
- \or: \mathparagraph
- \or: \|
- \or: **
- \or: \dagger\dagger
- \or: \ddagger\ddagger
- \fi:
-}
-\cs_new_nopar:Npn \int_symbol_text_conversion_rule:n #1 {
- \if_case:w #1
- \or: \textasteriskcentered
- \or: \textdagger
- \or: \textdaggerdbl
- \or: \textsection
- \or: \textparagraph
- \or: \textbardbl
- \or: \textasteriskcentered\textasteriskcentered
- \or: \textdagger\textdagger
- \or: \textdaggerdbl\textdaggerdbl
- \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\l_tmpa_int}
-% \begin{macro}[aux]{\l_tmpb_int}
-% \begin{macro}[aux]{\l_tmpc_int}
-% \begin{macro}[aux]{\g_tmpa_int}
-% \begin{macro}[aux]{\g_tmpb_int}
-% We provide four local and two global scratch counters, maybe we
-% need more or less.
-% \begin{macrocode}
-\int_new:N \l_tmpa_int
-\int_new:N \l_tmpb_int
-\int_new:N \l_tmpc_int
-\int_new:N \g_tmpa_int
-\int_new:N \g_tmpb_int
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\int_pre_eval_one_arg:Nn}
-% \begin{macro}{\int_pre_eval_two_args:Nnn}
-% These are handy when handing down values to other
-% functions. All they do is evaluate the number in advance.
-% \begin{macrocode}
-\cs_set_nopar:Npn \int_pre_eval_one_arg:Nn #1#2{
- \exp_args:Nf#1{\int_eval:n{#2}}}
-\cs_set_nopar:Npn \int_pre_eval_two_args:Nnn #1#2#3{
- \exp_args:Nff#1{\int_eval:n{#2}}{\int_eval:n{#3}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-%
-%
-% \subsection{Scanning and conversion}
-%
-%
-% \begin{macro}{\int_from_roman:n}
-% \UnitTested
-% \TestMissing{boundary cases / wrong input?}
-%\begin{macro}[aux]{\int_from_roman_aux:NN}
-%\begin{macro}[aux]{\int_from_roman_end:w}
-%\begin{macro}[aux]{\int_from_roman_clean_up:w}
-% The method here is to iterate through the input, finding the
-% appropriate value for each letter and building up a sum. This is
-% then evaluated by \TeX.
-% \begin{macrocode}
-\cs_new_nopar:Npn \int_from_roman:n #1 {
- \tl_if_blank:nF {#1}
- {
- \tex_expandafter:D \int_from_roman_end:w
- \tex_number:D \etex_numexpr:D
- \int_from_roman_aux:NN #1 Q \q_stop
- }
-}
-\cs_new_nopar:Npn \int_from_roman_aux:NN #1#2 {
- \str_if_eq:nnTF {#1} { Q }
- {#1#2}
- {
- \str_if_eq:nnTF {#2} { Q }
- {
- \cs_if_exist:cF { c_int_from_roman_ #1 _int }
- { \int_from_roman_clean_up:w }
- +
- \use:c { c_int_from_roman_ #1 _int }
- #2
- }
- {
- \cs_if_exist:cF { c_int_from_roman_ #1 _int }
- { \int_from_roman_clean_up:w }
- \cs_if_exist:cF { c_int_from_roman_ #2 _int }
- { \int_from_roman_clean_up:w }
- \int_compare:nNnTF
- { \use:c { c_int_from_roman_ #1 _int } }
- <
- { \use:c { c_int_from_roman_ #2 _int } }
- {
- + \use:c { c_int_from_roman_ #2 _int }
- - \use:c { c_int_from_roman_ #1 _int }
- \int_from_roman_aux:NN
- }
- {
- + \use:c { c_int_from_roman_ #1 _int }
- \int_from_roman_aux:NN #2
- }
- }
- }
-}
-\cs_new_nopar:Npn \int_from_roman_end:w #1 Q #2 \q_stop {
- \tl_if_empty:nTF {#2} {#1} {#2}
-}
-\cs_new_nopar:Npn \int_from_roman_clean_up:w #1 Q { + 0 Q -1 }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%
-%\begin{macro}{\int_convert_from_base_ten:nn}
-% \UnitTested
-%\begin{macro}[aux]{\int_convert_from_base_ten_aux:nnn}
-%\begin{macro}{\int_convert_number_to_letter:n}
-% \UnitTested
-% Converting from base ten ("#1") to a second base ("#2") starts with
-% a simple sign check. As the input is base \( 10 \) \TeX\ can then
-% do the actual work with the sign itself.
-% \begin{macrocode}
-\cs_new:Npn \int_convert_from_base_ten:nn #1#2 {
- \int_compare:nNnTF {#1} < { 0 }
- {
- -
- \exp_args:Nnf \int_convert_from_base_ten_aux:nnn
- { } { \int_eval:n { 0 - ( #1 ) } } {#2}
- }
- {
- \exp_args:Nnf \int_convert_from_base_ten_aux:nnn
- { } { \int_eval:n {#1} } {#2}
- }
-}
-% \end{macrocode}
-% Here, the idea is to provide a recursive system to deal with the
-% input. The output is build up as argument "#1", which is why it
-% starts off empty in the above. At each pass, the value in "#2" is
-% checked to see if it is less than the new base ("#3"). If it is
-% the it is converted directly and the rest of the output is added in.
-% On the other hand, if the value to convert is greater than or equal
-% to the new base then the modulus and remainder values are found. The
-% modulus is converted to a symbol and the remainder is carried forward
-% to the next round.S
-% \begin{macrocode}
-\cs_new:Npn \int_convert_from_base_ten_aux:nnn #1#2#3 {
- \int_compare:nNnTF {#2} < {#3}
- {
- \int_convert_number_to_letter:n {#2}
- #1
- }
- {
- \exp_args:Nff \int_convert_from_base_ten_aux:nnn
- {
- \int_convert_number_to_letter:n
- { \int_mod:nn {#2} {#3} }
- #1
- }
- { \int_div_truncate:nn {#2} {#3} }
- {#3}
- }
-}
-% \end{macrocode}
-% Convert to a letter only if necessary, otherwise simply return the
-% value unchanged.
-% \begin{macrocode}
-\cs_new:Npn \int_convert_number_to_letter:n #1 {
- \prg_case_int:nnn { #1 - 9 }
- {
- { 1 } { A }
- { 2 } { B }
- { 3 } { C }
- { 4 } { D }
- { 5 } { E }
- { 6 } { F }
- { 7 } { G }
- { 8 } { H }
- { 9 } { I }
- { 10 } { J }
- { 11 } { K }
- { 12 } { L }
- { 13 } { M }
- { 14 } { N }
- { 15 } { O }
- { 16 } { P }
- { 17 } { Q }
- { 18 } { R }
- { 19 } { S }
- { 20 } { T }
- { 21 } { U }
- { 22 } { V }
- { 23 } { W }
- { 24 } { X }
- { 25 } { Y }
- { 26 } { Z }
- }
- {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\int_convert_to_base_ten:nn}
-% \UnitTested
-%\begin{macro}[aux]{\int_convert_to_base_ten_aux:nn}
-%\begin{macro}[aux]{\int_convert_to_base_ten_aux:nnN}
-%\begin{macro}[aux]{\int_convert_to_base_ten_aux:N}
-%\begin{macro}{\int_get_sign_and_digits:n}
-%\begin{macro}{\int_get_sign:n}
-%\begin{macro}{\int_get_digits:n}
-%\begin{macro}[aux]{\int_get_sign_and_digits_aux:nNNN}
-%\begin{macro}[aux]{\int_get_sign_and_digits_aux:oNNN}
-% Conversion to base ten means stripping off the sign then iterating
-% through the input one token at a time. The total number is then added
-% up as the code loops.
-% \begin{macrocode}
-\cs_new:Npn \int_convert_to_base_ten:nn #1#2 {
- \int_eval:n
- {
- \int_get_sign:n {#1}
- \exp_args:Nf \int_convert_to_base_ten_aux:nn
- { \int_get_digits:n {#1} } {#2}
- }
-}
-\cs_new:Npn \int_convert_to_base_ten_aux:nn #1#2 {
- \int_convert_to_base_ten_aux:nnN { 0 } { #2 } #1 \q_nil
-}
-\cs_new:Npn \int_convert_to_base_ten_aux:nnN #1#2#3 {
- \quark_if_nil:NTF #3
- {#1}
- {
- \exp_args:Nf \int_convert_to_base_ten_aux:nnN
- { \int_eval:n { #1 * #2 + \int_convert_to_base_ten_aux:N #3 } }
- {#2}
- }
-}
-% \end{macrocode}
-% The conversion here will take lower or upper case letters and turn
-% them into the appropriate number, hence the two-part nature of the
-% function.
-% \begin{macrocode}
-\cs_new:Npn \int_convert_to_base_ten_aux:N #1 {
- \int_compare:nNnTF { `#1 } < { 58 }
- {#1}
- {
- \int_eval:n
- { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 55 } { 87 } }
- }
-}
-% \end{macrocode}
-% Finding a number and its sign requires dealing with an arbitrary
-% list of "+" and "-" symbols. This is done by working through token
-% by token until there is something else at the start of the input.
-% The sign of the input is tracked by the first Boolean used by the
-% auxiliary function.
-% \begin{macrocode}
-\cs_new:Npn \int_get_sign_and_digits:n #1 {
- \int_get_sign_and_digits_aux:nNNN {#1}
- \c_true_bool \c_true_bool \c_true_bool
-}
-\cs_new:Npn \int_get_sign:n #1 {
- \int_get_sign_and_digits_aux:nNNN {#1}
- \c_true_bool \c_true_bool \c_false_bool
-}
-\cs_new:Npn \int_get_digits:n #1 {
- \int_get_sign_and_digits_aux:nNNN {#1}
- \c_true_bool \c_false_bool \c_true_bool
-}
-% \end{macrocode}
-% The auxiliary loops through, finding sign tokens and removing them.
-% The sign itself is carried through as a flag.
-% \begin{macrocode}
-\cs_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4 {
- \tl_if_head_eq_charcode:fNTF {#1} -
- {
- \bool_if:NTF #2
- {
- \int_get_sign_and_digits_aux:oNNN
- { \use_none:n #1 } \c_false_bool #3#4
- }
- {
- \int_get_sign_and_digits_aux:oNNN
- { \use_none:n #1 } \c_true_bool #3#4
- }
- }
- {
- \tl_if_head_eq_charcode:fNTF {#1} +
- { \int_get_sign_and_digits_aux:oNNN { \use_none:n #1 } #2#3#4 }
- {
- \bool_if:NT #3 { \bool_if:NF #2 - }
- \bool_if:NT #4 {#1}
- }
- }
-}
-\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN { o }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\int_from_binary:n,\int_from_hexadecimal:n,\int_from_octal:n}
-% \UnitTested
-%\begin{macro}{\int_to_binary:n,\int_to_hexadecimal:n,\int_to_octal:n}
-% \UnitTested
-% Wrappers around the generic function.
-% \begin{macrocode}
-\cs_new:Npn \int_from_binary:n #1 {
- \int_convert_to_base_ten:nn {#1} { 2 }
-}
-\cs_new:Npn \int_from_hexadecimal:n #1 {
- \int_convert_to_base_ten:nn {#1} { 16 }
-}
-\cs_new:Npn \int_from_octal:n #1 {
- \int_convert_to_base_ten:nn {#1} { 8 }
-}
-\cs_new:Npn \int_to_binary:n #1 {
- \int_convert_from_base_ten:nn {#1} { 2 }
-}
-\cs_new:Npn \int_to_hexadecimal:n #1 {
- \int_convert_from_base_ten:nn {#1} { 16 }
-}
-\cs_new:Npn \int_to_octal:n #1 {
- \int_convert_from_base_ten:nn {#1} { 8 }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-%\begin{macro}{\int_from_alph:n}
-% \UnitTested
-%\begin{macro}[aux]{\int_from_alph_aux:n}
-%\begin{macro}[aux]{\int_from_alph_aux:nN}
-%\begin{macro}[aux]{\int_from_alph_aux:N}
-% The aim here is to iterate through the input, converting one letter at
-% a time to a number. The same approach is also used for base
-% conversion, but this needs a different final auxiliary.
-% \begin{macrocode}
-\cs_new:Npn \int_from_alph:n #1 {
- \int_eval:n
- {
- \int_get_sign:n {#1}
- \exp_args:Nf \int_from_alph_aux:n
- { \int_get_digits:n {#1} }
- }
-}
-\cs_new:Npn \int_from_alph_aux:n #1 {
- \int_from_alph_aux:nN { 0 } #1 \q_nil
-}
-\cs_new:Npn \int_from_alph_aux:nN #1#2 {
- \quark_if_nil:NTF #2
- {#1}
- {
- \exp_args:Nf \int_from_alph_aux:nN
- { \int_eval:n { #1 * 26 + \int_from_alph_aux:N #2 } }
- }
-}
-\cs_new:Npn \int_from_alph_aux:N #1 {
- \int_eval:n
- { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 64 } { 96 } }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-% \begin{macro}[pTF]{\int_compare:n}
-% Comparison tests using a simple syntax where only one set of braces
-% is required and additional operators such as "!=" and ">=" are
-% supported. First some notes on the idea behind this. We wish to
-% support writing code like
-% \begin{verbatim}
-% \int_compare_p:n { 5 + \l_tmpa_int != 4 - \l_tmpb_int }
-% \end{verbatim}
-% In other words, we want to somehow add the missing "\int_eval:w"
-% where required. We can start evaluating from the left using
-% "\int_eval:w", and we know that since the relation symbols "<", ">",
-% "=" and "!" are not allowed in such expressions, they will terminate
-% the expression. Therefore, we first let \TeX\ evaluate this left
-% hand side of the (in)equality.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \int_compare:n #1{p,TF,T,F}{
- \exp_after:wN \int_compare_auxi:w \int_value:w
- \int_eval:w #1\q_stop
-}
-% \end{macrocode}
-% Then the next step is to figure out which relation we should use, so
-% we have to somehow get rid of the first evaluation so that we can
-% see what stopped it. "\tex_romannumeral:D" is handy here since its
-% expansion given a non-positive number is \m{null}. We therefore
-% simply check if the first token of the left hand side evaluation is
-% a minus. If not, we insert it and issue "\tex_romannumeral:D",
-% thereby ridding us of the left hand side evaluation. We do however
-% save it for later.
-% \begin{macrocode}
-\cs_set:Npn \int_compare_auxi:w #1#2\q_stop{
- \exp_after:wN \int_compare_auxii:w \tex_romannumeral:D
- \if:w #1- \else: -\fi: #1#2 \q_mark #1#2 \q_stop
-}
-% \end{macrocode}
-% This leaves the first relation symbol in front and assuming the
-% right hand side has been input, at least one other token as well. We
-% support the following forms: |=|, |<|, |>| and the extended |!=|,
-% |==|, |<=| and |>=|. All the extended forms have an extra |=| so we
-% check if that is present as well. Then use specific function to
-% perform the test.
-% \begin{macrocode}
-\cs_set:Npn \int_compare_auxii:w #1#2#3\q_mark{
- \use:c{
- int_compare_
- #1 \if_meaning:w =#2 = \fi:
- :w}
-}
-% \end{macrocode}
-% The actual comparisons are then simple function calls, using the
-% relation as delimiter for a delimited argument.
-% Equality is easy:
-% \begin{macrocode}
-\cs_set:cpn {int_compare_=:w} #1=#2\q_stop{
- \if_int_compare:w #1=\int_eval:w #2 \int_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% So is the one using |==| -- we just have to use |==| in the
-% parameter text.
-% \begin{macrocode}
-\cs_set:cpn {int_compare_==:w} #1==#2\q_stop{
- \if_int_compare:w #1=\int_eval:w #2 \int_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% Not equal is just about reversing the truth value.
-% \begin{macrocode}
-\cs_set:cpn {int_compare_!=:w} #1!=#2\q_stop{
- \if_int_compare:w #1=\int_eval:w #2 \int_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-% \end{macrocode}
-% Less than and greater than are also straight forward.
-% \begin{macrocode}
-\cs_set:cpn {int_compare_<:w} #1<#2\q_stop{
- \if_int_compare:w #1<\int_eval:w #2 \int_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_set:cpn {int_compare_>:w} #1>#2\q_stop{
- \if_int_compare:w #1>\int_eval:w #2 \int_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% The less than or equal operation is just the opposite of the greater
-% than operation. Vice versa for less than or equal.
-% \begin{macrocode}
-\cs_set:cpn {int_compare_<=:w} #1<=#2\q_stop{
- \if_int_compare:w #1>\int_eval:w #2 \int_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-\cs_set:cpn {int_compare_>=:w} #1>=#2\q_stop{
- \if_int_compare:w #1<\int_eval:w #2 \int_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}[pTF]{\int_compare:nNn}
-% \UnitTested
-% More efficient but less natural in typing.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \int_compare:nNn #1#2#3{p}{
- \if_int_compare:w \int_eval:w #1 #2 \int_eval:w #3
- \int_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_set_nopar:Npn \int_compare:nNnT #1#2#3 {
- \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop:
- \tex_expandafter:D \use:n
- \tex_else:D
- \tex_expandafter:D \use_none:n
- \tex_fi:D
-}
-\cs_set_nopar:Npn \int_compare:nNnF #1#2#3 {
- \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop:
- \tex_expandafter:D \use_none:n
- \tex_else:D
- \tex_expandafter:D \use:n
- \tex_fi:D
-}
-\cs_set_nopar:Npn \int_compare:nNnTF #1#2#3 {
- \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop:
- \tex_expandafter:D \use_i:nn
- \tex_else:D
- \tex_expandafter:D \use_ii:nn
- \tex_fi:D
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_max:nn}
-% \UnitTested
-% \begin{macro}{\int_min:nn}
-% \UnitTested
-% \begin{macro}{\int_abs:n}
-% \UnitTested
-% Functions for $\min$, $\max$, and absolute value.
-% \begin{macrocode}
-\cs_set:Npn \int_abs:n #1{
- \int_value:w
- \if_int_compare:w \int_eval:w #1<\c_zero
- -
- \fi:
- \int_eval:w #1\int_eval_end:
-}
-\cs_set:Npn \int_max:nn #1#2{
- \int_value:w \int_eval:w
- \if_int_compare:w
- \int_eval:w #1>\int_eval:w #2\int_eval_end:
- #1
- \else:
- #2
- \fi:
- \int_eval_end:
-}
-\cs_set:Npn \int_min:nn #1#2{
- \int_value:w \int_eval:w
- \if_int_compare:w
- \int_eval:w #1<\int_eval:w #2\int_eval_end:
- #1
- \else:
- #2
- \fi:
- \int_eval_end:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_div_truncate:nn}
-% \UnitTested
-% \begin{macro}{\int_div_round:nn}
-% \UnitTested
-% \begin{macro}{\int_mod:nn}
-% \UnitTested
-% As "\int_eval:w" rounds the result of a division we also
-% provide a version that truncates the result.
-% \begin{macrocode}
-% \end{macrocode}
-% Initial version didn't work correctly with e\TeX's implementation.
-% \begin{macrocode}
-%\cs_set:Npn \int_div_truncate_raw:nn #1#2 {
-% \int_eval:n{ (2*#1 - #2) / (2* #2) }
-%}
-% \end{macrocode}
-% New version by Heiko:
-% \begin{macrocode}
-\cs_set:Npn \int_div_truncate:nn #1#2 {
- \int_value:w \int_eval:w
- \if_int_compare:w \int_eval:w #1 = \c_zero
- 0
- \else:
- (#1
- \if_int_compare:w \int_eval:w #1 < \c_zero
- \if_int_compare:w \int_eval:w #2 < \c_zero
- -( #2 +
- \else:
- +( #2 -
- \fi:
- \else:
- \if_int_compare:w \int_eval:w #2 < \c_zero
- +( #2 +
- \else:
- -( #2 -
- \fi:
- \fi:
- 1)/2)
- \fi:
- /(#2)
- \int_eval_end:
-}
-% \end{macrocode}
-% For the sake of completeness:
-% \begin{macrocode}
-\cs_set:Npn \int_div_round:nn #1#2 {\int_eval:n{(#1)/(#2)}}
-% \end{macrocode}
-% Finally there's the modulus operation.
-% \begin{macrocode}
-\cs_set:Npn \int_mod:nn #1#2 {
- \int_value:w
- \int_eval:w
- #1 - \int_div_truncate:nn {#1}{#2} * (#2)
- \int_eval_end:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}[pTF]{\int_if_odd:n}
-% \UnitTested
-% \begin{macro}[pTF]{\int_if_even:n}
-% \UnitTested
-% A predicate function.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \int_if_odd:n #1 {p,TF,T,F} {
- \if_int_odd:w \int_eval:w #1\int_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\prg_set_conditional:Npnn \int_if_even:n #1 {p,TF,T,F} {
- \if_int_odd:w \int_eval:w #1\int_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_while_do:nn}
-% \UnitTested
-% \TestMissing{Boundary cases}
-% \begin{macro}{\int_until_do:nn}
-% \UnitTested
-% \TestMissing{Boundary cases}
-% \begin{macro}{\int_do_while:nn}
-% \UnitTested
-% \TestMissing{Boundary cases}
-% \begin{macro}{\int_do_until:nn}
-% \UnitTested
-% \TestMissing{Boundary cases}
-% These are quite easy given the above functions. The "while" versions
-% test first and then execute the body. The "do_while" does it the
-% other way round.
-% \begin{macrocode}
-\cs_set:Npn \int_while_do:nn #1#2{
- \int_compare:nT {#1}{#2 \int_while_do:nn {#1}{#2}}
-}
-\cs_set:Npn \int_until_do:nn #1#2{
- \int_compare:nF {#1}{#2 \int_until_do:nn {#1}{#2}}
-}
-\cs_set:Npn \int_do_while:nn #1#2{
- #2 \int_compare:nT {#1}{\int_do_while:nNnn {#1}{#2}}
-}
-\cs_set:Npn \int_do_until:nn #1#2{
- #2 \int_compare:nF {#1}{\int_do_until:nn {#1}{#2}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\int_while_do:nNnn}
-% \begin{macro}{\int_until_do:nNnn}
-% \begin{macro}{\int_do_while:nNnn}
-% \begin{macro}{\int_do_until:nNnn}
-% As above but not using the more natural syntax.
-% \begin{macrocode}
-\cs_set:Npn \int_while_do:nNnn #1#2#3#4{
- \int_compare:nNnT {#1}#2{#3}{#4 \int_while_do:nNnn {#1}#2{#3}{#4}}
-}
-\cs_set:Npn \int_until_do:nNnn #1#2#3#4{
- \int_compare:nNnF {#1}#2{#3}{#4 \int_until_do:nNnn {#1}#2{#3}{#4}}
-}
-\cs_set:Npn \int_do_while:nNnn #1#2#3#4{
- #4 \int_compare:nNnT {#1}#2{#3}{\int_do_while:nNnn {#1}#2{#3}{#4}}
-}
-\cs_set:Npn \int_do_until:nNnn #1#2#3#4{
- #4 \int_compare:nNnF {#1}#2{#3}{\int_do_until:nNnn {#1}#2{#3}{#4}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Defining constants}
-%
-% \begin{macro}{\int_const:Nn, \int_const:cn}
-% \UnitTested
-% As stated, most constants can be defined as |\tex_chardef:D| or
-% |\tex_mathchardef:D| but that's engine dependent.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_const:Nn #1#2 {
- \int_compare:nTF { #2 > \c_minus_one }
- {
- \int_compare:nTF { #2 > \c_max_register_int }
- {
- \int_new:N #1
- \int_gset:Nn #1 {#2}
- }
- {
- \chk_if_free_cs:N #1
- \tex_global:D \tex_mathchardef:D #1 =
- \etex_numexpr:D #2 \scan_stop:
- }
- }
- {
- \int_new:N #1
- \int_gset:Nn #1 {#2}
- }
-}
-\cs_generate_variant:Nn \int_const:Nn { c }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\c_minus_one,
-% \c_zero, \c_one, \c_two, \c_three, \c_four, \c_five, \c_six,
-% \c_seven, \c_eight, \c_nine, \c_ten,
-% \c_eleven, \c_twelve, \c_thirteen, \c_fourteen, \c_fifteen,
-% \c_sixteen, \c_thirty_two,
-% \c_hundred_one,
-% \c_twohundred_fifty_five, \c_twohundred_fifty_six,
-% \c_thousand,
-% \c_ten_thousand,
-% \c_ten_thousand_one, \c_ten_thousand_two,
-% \c_ten_thousand_three, \c_ten_thousand_four,
-% \c_twenty_thousand}
-% \TestMissing{Too simple for tests, but they aren't aux, so perhaps we should
-% add a test that they actually represent their numbers after
-% all}
-% \UnitTested
-% And the usual constants, others are still missing. Please, make
-% every constant a real constant at least for the moment. We can
-% easily convert things in the end when we have found what
-% constants are used in critical places and what not.
-% \begin{macrocode}
- %% \tex_countdef:D \c_minus_one = 10 \scan_stop:
- %% \c_minus_one = -1 \scan_stop: %% in l3basics
-%\int_const:Nn \c_zero {0} %% in l3basics
-\int_const:Nn \c_one {1}
-\int_const:Nn \c_two {2}
-\int_const:Nn \c_three {3}
-\int_const:Nn \c_four {4}
-\int_const:Nn \c_five {5}
-%\int_const:Nn \c_six {6} %% in l3basics
-%\int_const:Nn \c_seven {7} %% in l3basics
-\int_const:Nn \c_eight {8}
-\int_const:Nn \c_nine {9}
-\int_const:Nn \c_ten {10}
-\int_const:Nn \c_eleven {11}
-%\int_const:Nn \c_twelve {12} %% in l3basics
-\int_const:Nn \c_thirteen {13}
-\int_const:Nn \c_fourteen {14}
-\int_const:Nn \c_fifteen {15}
- %% \tex_chardef:D \c_sixteen = 16\scan_stop: %% in l3basics
-\int_const:Nn \c_thirty_two {32}
-% \end{macrocode}
-% The next one may seem a little odd (obviously!) but is useful when
-% dealing with logical operators.
-% \begin{macrocode}
-\int_const:Nn \c_hundred_one {101}
-\int_const:Nn \c_twohundred_fifty_five{255}
-\int_const:Nn \c_twohundred_fifty_six {256}
-\int_const:Nn \c_thousand {1000}
-\int_const:Nn \c_ten_thousand {10000}
-\int_const:Nn \c_ten_thousand_one {10001}
-\int_const:Nn \c_ten_thousand_two {10002}
-\int_const:Nn \c_ten_thousand_three {10003}
-\int_const:Nn \c_ten_thousand_four {10004}
-\int_const:Nn \c_twenty_thousand {20000}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\c_max_int}
-% The largest number allowed is $2^{31}-1$
-% \begin{macrocode}
-\int_const:Nn \c_max_int {2147483647}
-% \end{macrocode}
-% \end{macro}
-%
-%\begin{macro}[aux]{\c_int_from_roman_i_int}
-%\begin{macro}[aux]{\c_int_from_roman_v_int}
-%\begin{macro}[aux]{\c_int_from_roman_x_int}
-%\begin{macro}[aux]{\l_int_from_roman_l_int}
-%\begin{macro}[aux]{\c_int_from_roman_c_int}
-%\begin{macro}[aux]{\c_int_from_roman_d_int}
-%\begin{macro}[aux]{\c_int_from_roman_m_int}
-%\begin{macro}[aux]{\c_int_from_roman_I_int}
-%\begin{macro}[aux]{\c_int_from_roman_V_int}
-%\begin{macro}[aux]{\c_int_from_roman_X_int}
-%\begin{macro}[aux]{\c_int_from_roman_L_int}
-%\begin{macro}[aux]{\c_int_from_roman_C_int}
-%\begin{macro}[aux]{\c_int_from_roman_D_int}
-%\begin{macro}[aux]{\c_int_from_roman_M_int}
-% Delayed from earlier.
-% \begin{macrocode}
-\int_const:cn { c_int_from_roman_i_int } { 1 }
-\int_const:cn { c_int_from_roman_v_int } { 5 }
-\int_const:cn { c_int_from_roman_x_int } { 10 }
-\int_const:cn { c_int_from_roman_l_int } { 50 }
-\int_const:cn { c_int_from_roman_c_int } { 100 }
-\int_const:cn { c_int_from_roman_d_int } { 500 }
-\int_const:cn { c_int_from_roman_m_int } { 1000 }
-\int_const:cn { c_int_from_roman_I_int } { 1 }
-\int_const:cn { c_int_from_roman_V_int } { 5 }
-\int_const:cn { c_int_from_roman_X_int } { 10 }
-\int_const:cn { c_int_from_roman_L_int } { 50 }
-\int_const:cn { c_int_from_roman_C_int } { 100 }
-\int_const:cn { c_int_from_roman_D_int } { 500 }
-\int_const:cn { c_int_from_roman_M_int } { 1000 }
-% \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}
-%
-% Needed from other modules:
-% \begin{macrocode}
-\int_new:N \g_tl_inline_level_int
-\int_new:N\g_prg_inline_level_int
-% \end{macrocode}
-%
-% \subsection{Backwards compatibility}
-% \begin{macrocode}
-\cs_set_eq:NN \intexpr_value:w \int_value:w
-\cs_set_eq:NN \intexpr_eval:w \int_eval:w
-\cs_set_eq:NN \intexpr_eval_end: \int_eval_end:
-\cs_set_eq:NN \if_intexpr_compare:w \if_int_compare:w
-\cs_set_eq:NN \if_intexpr_odd:w \if_int_odd:w
-\cs_set_eq:NN \if_intexpr_case:w \if_case:w
-\cs_set_eq:NN \intexpr_eval:n \int_eval:n
-
-\cs_set_eq:NN \intexpr_compare_p:n \int_compare_p:n
-\cs_set_eq:NN \intexpr_compare:nTF \int_compare:nTF
-\cs_set_eq:NN \intexpr_compare:nT \int_compare:nT
-\cs_set_eq:NN \intexpr_compare:nF \int_compare:nF
-
-\cs_set_eq:NN \intexpr_compare_p:nNn \int_compare_p:nNn
-\cs_set_eq:NN \intexpr_compare:nNnTF \int_compare:nNnTF
-\cs_set_eq:NN \intexpr_compare:nNnT \int_compare:nNnT
-\cs_set_eq:NN \intexpr_compare:nNnF \int_compare:nNnF
-
-\cs_set_eq:NN \intexpr_abs:n \int_abs:n
-\cs_set_eq:NN \intexpr_max:nn \int_max:nn
-\cs_set_eq:NN \intexpr_min:nn \int_min:nn
-
-\cs_set_eq:NN \intexpr_div_truncate:nn \int_div_truncate:nn
-\cs_set_eq:NN \intexpr_div_round:nn \int_div_round:nn
-\cs_set_eq:NN \intexpr_mod:nn \int_mod:nn
-
-\cs_set_eq:NN \intexpr_if_odd_p:n \int_if_odd_p:n
-\cs_set_eq:NN \intexpr_if_odd:nTF \int_if_odd:nTF
-\cs_set_eq:NN \intexpr_if_odd:nT \int_if_odd:nT
-\cs_set_eq:NN \intexpr_if_odd:nF \int_if_odd:nF
-
-\cs_set_eq:NN \intexpr_if_even_p:n \int_if_even_p:n
-\cs_set_eq:NN \intexpr_if_even:nTF \int_if_even:nTF
-\cs_set_eq:NN \intexpr_if_even:nT \int_if_even:nT
-\cs_set_eq:NN \intexpr_if_even:nF \int_if_even:nF
-
-\cs_set_eq:NN \intexpr_while_do:nn \int_while_do:nn
-\cs_set_eq:NN \intexpr_until_do:nn \int_until_do:nn
-\cs_set_eq:NN \intexpr_do_while:nn \int_do_while:nn
-\cs_set_eq:NN \intexpr_do_until:nn \int_do_until:nn
-
-\cs_set_eq:NN \intexpr_while_do:nNnn \int_while_do:nNnn
-\cs_set_eq:NN \intexpr_until_do:nNnn \int_until_do:nNnn
-\cs_set_eq:NN \intexpr_do_while:nNnn \int_do_while:nNnn
-\cs_set_eq:NN \intexpr_do_until:nNnn \int_do_until:nNnn
-% \end{macrocode}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3io.dtx b/Master/texmf-dist/source/latex/expl3/l3io.dtx
deleted file mode 100644
index 4f31a349b71..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3io.dtx
+++ /dev/null
@@ -1,927 +0,0 @@
-% \iffalse
-%% File: l3io.dtx Copyright (C) 1990-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3io.dtx 2063 2010-10-03 08:26:49Z mittelba $
- {L3 Experimental i/o module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{l3io.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3io} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Low-level file i/o}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-%\begin{documentation}
-%
-% Reading and writing from file streams is handled in \LaTeX3 using
-% functions with prefixes \cs{iow_\ldots} (file reading) and
-% \cs{ior_\ldots} (file writing). Many of the basic functions are
-% very similar, with reading and writing using the same syntax and
-% function concepts. As a result, the reading and writing functions
-% are documented together where this makes sense.
-%
-% As \TeX\ is limited to \(16\) input streams and \(16\) 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 close streams
-% when they are no longer needed, to release them for other processes.
-%
-% Reading from or writing to a file requires a \meta{stream} to
-% be used. This is a csname which refers to the file being processed,
-% and is independent of the name of the file (except of course that
-% the file name is needed when the file is opened).
-%
-%\section{Opening and closing streams}
-%
-%\begin{function}{
-% \iow_new:N |
-% \iow_new:c |
-% \ior_new:N |
-% \ior_new:c
-%}
-% \begin{syntax}
-% "\iow_new:N" <stream>
-% \end{syntax}
-% Reserves the name <stream> for use in accessing a file stream.
-% This operation does not open a raw \TeX\ stream, which is handled
-% internally using a pool and is should not be accessed directly by
-% the programmer.
-%\end{function}
-%
-%\begin{function}{
-% \iow_open:Nn |
-% \iow_open:cn |
-% \ior_open:Nn |
-% \ior_open:cn
-%}
-% \begin{syntax}
-% "\iow_open:Nn" <stream> \Arg{file name}
-% "\iow_open:Nn" <stream> \Arg{file name}
-% \end{syntax}
-% Opens <file name> for writing (\cs{iow_\ldots}) or reading
-% (\cs{ior_\ldots}) using <stream> as the csname by which the
-% file is accessed. If <stream> was already open (for either writing
-% or reading) it is closed before the new operation begins. The
-% <stream> is available for access immediately after issuing an
-% \texttt{open} instruction. The <stream> will remain allocated
-% to <file name> until a \texttt{close} instruction is given or at
-% the end of the \TeX\ run.
-%
-% Opening a file for writing will clear any existing content in the
-% file (\emph{i.e}.~writing is \emph{not} additive). As the total
-% number of writing streams is limited, it may well be best to save
-% material to be written to an intermediate storage format (for example
-% a token list or toks), and to write the material in one `shot'
-% from this variable. In this way the file stream is only required
-% for a limited time.
-%\end{function}
-%
-%\begin{function}{
-% \iow_close:N |
-% \iow_close:c |
-% \ior_close:N |
-% \ior_close:c
-%}
-% \begin{syntax}
-% "\iow_close:N" <stream>
-% "\ior_close:N" <stream>
-% \end{syntax}
-% Closes <stream>, freeing up one of the underlying \TeX\ streams
-% for reuse. Streams should always be closed when they are finished
-% with as this ensures that they remain available to other
-% programmers (the resources here are limited). The name of
-% the <stream> will be freed at this stage, to ensure that any
-% further attempts to write to it result in an error.
-%\end{function}
-%
-%\begin{function}{
-% \iow_open_streams: |
-% \iow_open_streams:
-%}
-% \begin{syntax}
-% "\iow_open_streams:"
-% \end{syntax}
-% Displays a list of the file names associated with each open
-% stream: intended for tracking down problems.
-%\end{function}
-%
-%\subsection{Writing to files}
-%
-%\begin{function}{
-% \iow_now:Nx |
-% \iow_now:Nn
-%}
-% \begin{syntax}
-% "\iow_now:Nx" <stream> \Arg{tokens}
-% \end{syntax}
-% \cs{iow_now:Nx} immediately writes the expansion of <tokens> to the
-% output <stream>. If the <stream> is not open output goes to the
-% terminal. The variant \cs{iow_now:Nn} writes out <tokens> without any
-% further expansion.
-% \begin{texnote}
-% These are the equivalent of \TeX's "\immediate\write" with and
-% without expansion control.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \iow_log:n |
-% \iow_log:x |
-% \iow_term:n |
-% \iow_term:x
-%}
-% \begin{syntax}
-% "\iow_log:x" \Arg{tokens}
-% \end{syntax}
-% These are dedicated functions which write to the log (transcript)
-% file and the terminal, respectively. They are equivalent to using
-% \cs{iow_now:N(n/x)} to the streams \cs{c_iow_log_stream} and
-% \cs{c_iow_term_stream}. The writing takes place immediately.
-% \end{function}
-%
-%\begin{function}{
-% \iow_now_buffer_safe:Nn |
-% \iow_now_buffer_safe:Nx
-%}
-% \begin{syntax}
-% "\iow_now_buffer_safe:Nn" <stream> \Arg{tokens}
-% \end{syntax}
-% Immediately write <tokens> expanded to <stream>, with every space
-% converted into a newline. This mean that the file can be
-% read back without the danger that very long lines overflow
-% \TeX's buffer.
-% \end{function}
-%
-%\begin{function}{
-% \iow_now_when_avail:Nn |
-% \iow_now_when_avail:cn |
-% \iow_now_when_avail:Nx |
-% \iow_now_when_avail:cx
-%}
-% \begin{syntax}
-% "\iow_now_when_avail:Nn" <stream> \Arg{tokens}
-% \end{syntax}
-% If <stream> is open, writes the <tokens> to the <stream> in the
-% same manner as \cs{iow_now:N(n/x)}. If the <stream> is not open,
-% the <tokens> are simply thrown away.
-%\end{function}
-%
-%\begin{function}{
-% \iow_shipout:Nx |
-% \iow_shipout:Nn
-%}
-% \begin{syntax}
-% "\iow_shipout:Nx" <stream> \Arg{tokens}
-% \end{syntax}
-% Write <tokens> to <stream> at the point at which the current page
-% is finished. The <tokens> are either written unexpanded
-% (\cs{iow_shipout:Nn}) or expanded only at the point that the
-% function is used (\cs{iow_shipout:Nx}), \emph{i.e}.~no expansion
-% takes place when writing to the file.
-%\end{function}
-%
-%\begin{function}{
-% \iow_shipout_x:Nx |
-% \iow_shipout_x:Nn
-%}
-% \begin{syntax}
-% "\iow_shipout_x:Nx" <stream> \Arg{tokens}
-% \end{syntax}
-% Write <tokens> to <stream> at the point at which the current page
-% is finished. The <tokens> are expanded at the time of writing
-% in addition to any expansion at the time of use of the function.
-% This makes these functions suitable for including material finalised
-% during the page building process (such as the page number integer).
-% \begin{texnote}
-% These are the equivalent of \TeX's \cs{write} with and
-% without expansion control at point of use.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\iow_newline: / (EXP) }
-% \begin{syntax}
-% "\iow_newline:"
-% \end{syntax}
-% Function to add a new line within the <tokens> written to a file.
-% The function has no effect if writing is taking place without
-% expansion (\emph{e.g}.~in a \cs{iow_now:Nn} call).
-%\end{function}
-%
-%\begin{function}{\iow_char:N / (EXP) }
-% \begin{syntax}
-% "\iow_char:N" "\"<char>
-% "\iow_char:N" "\%"
-% \end{syntax}
-% Inserts <char> into the output stream. Useful when trying to write
-% difficult characters such as "%", "{", "}", \emph{etc}.~in messages,
-% for example:
-% \begin{verbatim}
-% \iow_now:Nx \g_my_stream { \iow_char:N \{ text \iow_char:N \} }
-% \end{verbatim}
-% The function has no effect if writing is taking place without
-% expansion (\emph{e.g}.~in a \cs{iow_now:Nn} call).
-%\end{function}
-%
-%\subsection{Reading from files}
-%
-%\begin{function}{
-% \ior_to:NN |
-% \ior_gto:NN
-%}
-% \begin{syntax}
-% "\ior_to:NN" <stream> <token list variable>
-% \end{syntax}
-% Functions that reads one or more lines (until an equal number of left
-% and right braces are found) from the input stream <stream> and places
-% the result locally or globally into the <token list variable>.
-% If <stream> is not open, input is requested from the terminal.
-%\end{function}
-%
-%\begin{function}{
-% \ior_if_eof_p:N / (EXP) |
-% \ior_if_eof:N / (EXP) (TF)
-%}
-% \begin{syntax}
-% "\ior_if_eof:NTF" <stream> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if the end of a <stream> has been reached during a reading
-% operation. The test will also return a \texttt{true} value if
-% the <stream> is not open or the <file name> associated with
-% a <stream> does not exist at all.
-%\end{function}
-%
-%\section{Internal functions}
-%
-%\begin{function}{
-% \iow_raw_new:N |
-% \iow_raw_new:c |
-% \ior_raw_new:N |
-% \ior_raw_new:c
-%}
-% \begin{syntax}
-% "\iow_raw_new:N" <stream>
-% \end{syntax}
-% Creates a new low-level <stream> for use in subsequent functions.
-% As allocations are made using a pool \emph{do not use this function!}
-% \begin{texnote}
-% This is \LaTeXe's \cs{newwrite}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\if_eof:w / (EXP) }
-% \begin{syntax}
-% "\if_eof:w" <stream> <true code> "\else:" <false code> "\fi:"
-% \end{syntax}
-% Tests if the end of <stream> has been reached during a reading
-% operation.
-% \begin{texnote}
-% This is the primitive \cs{ifeof}.
-% \end{texnote}
-%\end{function}
-%
-%\section{Variables and constants}
-%
-%\begin{variable}{\c_io_streams_tl}
-% A list of the positions available for stream allocation (numbers
-% \(0\) to \(15\)).
-%\end{variable}
-%
-%\begin{variable}{
-% \c_iow_term_stream |
-% \c_ior_term_stream |
-% \c_iow_log_stream |
-% \c_ior_log_stream
-%}
-% Fixed stream numbers for accessing to the log and the terminal. The
-% reading and writing values are the same but are provided so that the
-% meaning is clear.
-%\end{variable}
-%
-%\begin{variable}{
-% \g_iow_streams_prop |
-% \g_ior_streams_prop
-%}
-% Allocation records for streams, linking the stream number to
-% the current name being used for that stream.
-%\end{variable}
-%
-%\begin{variable}{
-% \g_iow_tmp_stream |
-% \g_ior_tmp_stream
-%}
-% Used when creating new streams at the \TeX\ level.
-%\end{variable}
-%
-%\begin{variable}{
-% \l_iow_stream_int |
-% \l_ior_stream_int
-%}
-% Number of stream currently being allocated.
-%\end{variable}
-%
-%\end{documentation}
-%
-%\begin{implementation}
-%
-%\section{\pkg{l3io} implementation}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%\subsection{Variables and constants}
-%
-%\begin{macro}{\c_iow_term_stream}
-%\begin{macro}{\c_ior_term_stream}
-%\begin{macro}{\c_iow_log_stream}
-%\begin{macro}{\c_ior_log_stream}
-% Here we allocate two output streams for writing to the transcript
-% file only (\cs{c_iow_log_stream}) and to both the terminal and
-% transcript file (\cs{c_iow_term_stream}). Both can be used to read
-% from and have equivalent \cs{c_ior} versions.
-% \begin{macrocode}
-\cs_new_eq:NN \c_iow_term_stream \c_sixteen
-\cs_new_eq:NN \c_ior_term_stream \c_sixteen
-\cs_new_eq:NN \c_iow_log_stream \c_minus_one
-\cs_new_eq:NN \c_ior_log_stream \c_minus_one
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\c_iow_streams_tl}
-%\begin{macro}{\c_ior_streams_tl}
-% The list of streams available, by number.
-% \begin{macrocode}
-\tl_const:Nn \c_iow_streams_tl
- {
- \c_zero
- \c_one
- \c_two
- \c_three
- \c_four
- \c_five
- \c_six
- \c_seven
- \c_eight
- \c_nine
- \c_ten
- \c_eleven
- \c_twelve
- \c_thirteen
- \c_fourteen
- \c_fifteen
- }
-\cs_new_eq:NN \c_ior_streams_tl \c_iow_streams_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\g_iow_streams_prop}
-%\begin{macro}{\g_ior_streams_prop}
-% The allocations for streams are stored in property lists, which
-% are set up to have a 'full' set of allocations from the start.
-% In package mode, a few slots are always taken, so these are
-% blocked off from use.
-% \begin{macrocode}
-\prop_new:N \g_iow_streams_prop
-\prop_new:N \g_ior_streams_prop
-%</initex|package>
-%<*package>
-\prop_put:Nnn \g_iow_streams_prop { 0 } { LaTeX2e~reserved }
-\prop_put:Nnn \g_iow_streams_prop { 1 } { LaTeX2e~reserved }
-\prop_put:Nnn \g_iow_streams_prop { 2 } { LaTeX2e~reserved }
-\prop_put:Nnn \g_ior_streams_prop { 0 } { LaTeX2e~reserved }
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_iow_stream_int}
-%\begin{macro}{\l_ior_stream_int}
-% Used to track the number allocated to the stream being created:
-% this is taken from the property list but does alter.
-% \begin{macrocode}
-\int_new:N \l_iow_stream_int
-\cs_new_eq:NN \l_ior_stream_int \l_iow_stream_int
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Stream management}
-%
-%\begin{macro}{\iow_raw_new:N}
-%\begin{macro}{\ior_raw_new:N}
-% The lowest level for stream management is actually creating raw \TeX\
-% streams. As these are very limited (even with \eTeX) this should not
-% be addressed directly.
-% \begin{macrocode}
-%</initex|package>
-%<*initex>
-\alloc_setup_type:nnn { iow } \c_zero \c_sixteen
-\cs_new_protected_nopar:Npn \iow_raw_new:N #1 {
- \alloc_reg:NnNN g { iow } \tex_chardef:D #1
-}
-\alloc_setup_type:nnn { ior } \c_zero \c_sixteen
-\cs_new_protected_nopar:Npn \ior_raw_new:N #1 {
- \alloc_reg:NnNN g { ior } \tex_chardef:D #1
-}
-%</initex>
-%<*package>
-\cs_set_eq:NN \iow_raw_new:N \newwrite
-\cs_set_eq:NN \ior_raw_new:N \newread
-%</package>
-%<*initex|package>
-\cs_generate_variant:Nn \iow_raw_new:N { c }
-\cs_generate_variant:Nn \ior_raw_new:N { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_new:N}
-%\begin{macro}{\iow_new:c}
-%\begin{macro}{\ior_new:N}
-%\begin{macro}{\ior_new:c}
-% These are not needed but are included for consistency with other
-% variable types.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_new:N #1 {
- \cs_new_eq:NN #1 \c_iow_log_stream
-}
-\cs_generate_variant:Nn \iow_new:N { c }
-\cs_new_protected_nopar:Npn \ior_new:N #1 {
- \cs_new_eq:NN #1 \c_ior_log_stream
-}
-\cs_generate_variant:Nn \ior_new:N { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_open:Nn}
-%\begin{macro}{\iow_open:cn}
-%\begin{macro}{\ior_open:Nn}
-%\begin{macro}{\ior_open:cn}
-% In both cases, opening a stream starts with a call to the closing
-% function: this is safest. There is then a loop through the
-% allocation number list to find the first free stream number.
-% When one is found the allocation can take place, the information
-% can be stored and finally the file can actually be opened.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_open:Nn #1#2 {
- \iow_close:N #1
- \int_set:Nn \l_iow_stream_int { \c_sixteen }
- \tl_map_function:NN \c_iow_streams_tl \iow_alloc_write:n
- \int_compare:nTF { \l_iow_stream_int = \c_sixteen }
- { \msg_kernel_error:nn { iow } { streams-exhausted } }
- {
- \iow_stream_alloc:N #1
- \prop_gput:NVn \g_iow_streams_prop \l_iow_stream_int {#2}
- \tex_immediate:D \tex_openout:D #1#2 \scan_stop:
- }
-}
-\cs_generate_variant:Nn \iow_open:Nn { c }
-\cs_new_protected_nopar:Npn \ior_open:Nn #1#2 {
- \ior_close:N #1
- \int_set:Nn \l_ior_stream_int { \c_sixteen }
- \tl_map_function:NN \c_ior_streams_tl \ior_alloc_read:n
- \int_compare:nTF { \l_ior_stream_int = \c_sixteen }
- { \msg_kernel_error:nn { ior } { streams-exhausted } }
- {
- \ior_stream_alloc:N #1
- \prop_gput:NVn \g_ior_streams_prop \l_ior_stream_int {#2}
- \tex_openin:D #1#2 \scan_stop:
- }
-}
-\cs_generate_variant:Nn \ior_open:Nn { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\iow_alloc_write:n}
-%\begin{macro}[aux]{\ior_alloc_read:n}
-% These functions are used to see if a particular stream is available.
-% The property list contains file names for streams in use, so
-% any unused ones are for the taking.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_alloc_write:n #1 {
- \prop_if_in:NnF \g_iow_streams_prop {#1}
- {
- \int_set:Nn \l_iow_stream_int {#1}
- \tl_map_break:
- }
-}
-\cs_new_protected_nopar:Npn \ior_alloc_read:n #1 {
- \prop_if_in:NnF \g_iow_streams_prop {#1}
- {
- \int_set:Nn \l_ior_stream_int {#1}
- \tl_map_break:
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\iow_stream_alloc:N}
-%\begin{macro}[aux]{\ior_stream_alloc:N}
-%\begin{macro}[aux]{\iow_stream_alloc_aux:}
-%\begin{macro}[aux]{\ior_stream_alloc_aux:}
-%\begin{macro}[aux]{\g_iow_tmp_stream}
-%\begin{macro}[aux]{\g_ior_tmp_stream}
-% Allocating a raw stream is much easier in initex mode than for
-% the package. For the format, all streams will be allocated by
-% \pkg{l3io} and so there is a simple check to see if a raw
-% stream is actually available. On the other hand, for the
-% package there will be non-managed streams. So if the managed
-% one is not open, a check is made to see if some other managed
-% stream is available before deciding to open a new one. If a new
-% one is needed, we get the number allocated by \LaTeXe\ to get
-% `back on track' with allocation.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_stream_alloc:N #1 {
- \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _stream }
- { \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _stream } }
- {
-%</initex|package>
-%<*package>
- \iow_stream_alloc_aux:
- \int_compare:nT { \l_iow_stream_int = \c_sixteen }
- {
- \iow_raw_new:N \g_iow_tmp_stream
- \int_set:Nn \l_iow_stream_int { \g_iow_tmp_stream }
- \cs_gset_eq:cN
- { g_iow_ \int_use:N \l_iow_stream_int _stream }
- \g_iow_tmp_stream
- }
-%</package>
-%<*initex>
- \iow_raw_new:c { g_iow_ \int_use:N \l_iow_stream_int _stream }
-%</initex>
-%<*initex|package>
- \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _stream }
- }
-}
-%</initex|package>
-%<*package>
-\cs_new_protected_nopar:Npn \iow_stream_alloc_aux: {
- \int_incr:N \l_iow_stream_int
- \int_compare:nT
- { \l_iow_stream_int < \c_sixteen }
- {
- \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _stream }
- {
- \prop_if_in:NVT \g_iow_streams_prop \l_iow_stream_int
- { \iow_stream_alloc_aux: }
- }
- { \iow_stream_alloc_aux: }
- }
-}
-%</package>
-%<*initex|package>
-\cs_new_protected_nopar:Npn \ior_stream_alloc:N #1 {
- \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _stream }
- { \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _stream } }
- {
-%</initex|package>
-%<*package>
- \ior_stream_alloc_aux:
- \int_compare:nT { \l_ior_stream_int = \c_sixteen }
- {
- \ior_raw_new:N \g_ior_tmp_stream
- \int_set:Nn \l_ior_stream_int { \g_ior_tmp_stream }
- \cs_gset_eq:cN
- { g_ior_ \int_use:N \l_iow_stream_int _stream }
- \g_ior_tmp_stream
- }
-%</package>
-%<*initex>
- \ior_raw_new:c { g_ior_ \int_use:N \l_ior_stream_int _stream }
-%</initex>
-%<*initex|package>
- \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _stream }
- }
-}
-%</initex|package>
-%<*package>
-\cs_new_protected_nopar:Npn \ior_stream_alloc_aux: {
- \int_incr:N \l_ior_stream_int
- \int_compare:nT
- { \l_ior_stream_int < \c_sixteen }
- {
- \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _stream }
- {
- \prop_if_in:NVT \g_ior_streams_prop \l_ior_stream_int
- { \ior_stream_alloc_aux: }
- }
- { \ior_stream_alloc_aux: }
- }
-}
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_close:N}
-%\begin{macro}{\iow_close:c}
-%\begin{macro}{\iow_close:N}
-%\begin{macro}{\iow_close:c}
-% Closing a stream is not quite the reverse of opening one. First,
-% the close operation is easier than the open one, and second as the
-% stream is actually a number we can use it directly to show that the
-% slot has been freed up.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_close:N #1 {
- \cs_if_exist:NT #1
- {
- \int_compare:nF { #1 = \c_minus_one }
- {
- \tex_immediate:D \tex_closeout:D #1
- \prop_gdel:NV \g_iow_streams_prop #1
- \cs_gundefine:N #1
- }
- }
-}
-\cs_generate_variant:Nn \iow_close:N { c }
-\cs_new_protected_nopar:Npn \ior_close:N #1 {
- \cs_if_exist:NT #1
- {
- \int_compare:nF { #1 = \c_minus_one }
- {
- \tex_closein:D #1
- \prop_gdel:NV \g_ior_streams_prop #1
- \cs_gundefine:N #1
- }
- }
-}
-\cs_generate_variant:Nn \ior_close:N { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_open_streams:}
-%\begin{macro}{\ior_open_streams:}
-% Simply show the property lists.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_open_streams: {
- \prop_display:N \g_iow_streams_prop
-}
-\cs_new_protected_nopar:Npn \ior_open_streams: {
- \prop_display:N \g_ior_streams_prop
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-% Text for the error messages.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { iow } { streams-exhausted }
- {Output streams exhausted}
- {%
- TeX can only open up to 16 output streams at one time.\\%
- All 16 are currently in use, and something wanted to open
- another one.%
- }
-\msg_kernel_new:nnnn { ior } { streams-exhausted }
- {Input streams exhausted}
- {%
- TeX can only open up to 16 input streams at one time.\\%
- All 16 are currently in use, and something wanted to open
- another one.%
- }
-% \end{macrocode}
-%
-%\subsection{Immediate writing}
-%
-%\begin{macro}{\iow_now:Nx}
-% An abbreviation for an often used operation, which immediately
-% writes its second argument expanded to the output stream.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_now:Nx { \tex_immediate:D \iow_shipout_x:Nn }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\iow_now:Nn}
-% This routine writes the second argument onto the output stream without
-% expansion. If this stream isn't open, the output goes to the terminal
-% instead. If the first argument is no output stream at all, we get an
-% internal error.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_now:Nn #1#2 {
- \iow_now:Nx #1 { \exp_not:n {#2} }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\iow_log:n}
-%\begin{macro}{\iow_log:x}
-%\begin{macro}{\iow_term:n}
-%\begin{macro}{\iow_term:x}
-% Now we redefine two functions for which we needed a definition
-% very early on.
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \iow_log:x { \iow_now:Nx \c_iow_log_stream }
-\cs_new_protected_nopar:Npn \iow_log:n { \iow_now:Nn \c_iow_log_stream }
-\cs_set_protected_nopar:Npn \iow_term:x { \iow_now:Nx \c_iow_term_stream }
-\cs_new_protected_nopar:Npn \iow_term:n { \iow_now:Nn \c_iow_term_stream }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_now_when_avail:Nn}
-%\begin{macro}{\iow_now_when_avail:cn}
-%\begin{macro}{\iow_now_when_avail:Nx}
-%\begin{macro}{\iow_now_when_avail:cx}
-% For writing only if the stream requested is open at all.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_now_when_avail:Nn #1 {
- \cs_if_free:NTF #1 { \use_none:n } { \iow_now:Nn #1 }
-}
-\cs_generate_variant:Nn \iow_now_when_avail:Nn { c }
-\cs_new_protected_nopar:Npn \iow_now_when_avail:Nx #1 {
- \cs_if_free:NTF #1 { \use_none:n } { \iow_now:Nx #1 }
-}
-\cs_generate_variant:Nn \iow_now_when_avail:Nx { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_now_buffer_safe:Nn}
-%\begin{macro}{\iow_now_buffer_safe:Nx}
-%\begin{macro}[aux]{\iow_now_buffer_safe_expanded_aux:w}
-% Another type of writing onto an output stream is used for
-% potentially long token sequences. We break the output lines at
-% every blank in the second argument. This avoids the problem of
-% buffer overflow when reading back, or badly broken lines on
-% systems with limited file records. The only thing we have to
-% take care of, is the danger of two blanks in succession since
-% these get converted into a \cs{par} when we read the stuff back.
-% But this can happen only if things like two spaces find their way
-% into the second argument. Usually, multiple spaces are removed by
-% \TeX's scanner.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_now_buffer_safe:Nn {
- \iow_now_buffer_safe_aux:w \iow_now:Nx
-}
-\cs_new_protected_nopar:Npn \iow_now_buffer_safe:Nx {
- \iow_now_buffer_safe_aux:w \iow_now:Nn
-}
-\cs_new_protected_nopar:Npn \iow_now_buffer_safe_aux:w #1#2#3 {
- \group_begin: \tex_newlinechar:D`\ #1#2 {#3} \group_end:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Deferred writing}
-%
-%\begin{macro}{\iow_shipout_x:Nn}
-%\begin{macro}{\iow_shipout_x:Nx}
-% First the easy part, this is the primitive.
-% \begin{macrocode}
-\cs_set_eq:NN \iow_shipout_x:Nn \tex_write:D
-\cs_generate_variant:Nn \iow_shipout_x:Nn {Nx }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\iow_shipout:Nn}
-%\begin{macro}{\iow_shipout:Nx}
-% With \eTeX\ available deferred writing is easy.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \iow_shipout:Nn #1#2 {
- \iow_shipout_x:Nn #1 { \exp_not:n {#2} }
-}
-\cs_generate_variant:Nn \iow_shipout:Nn { Nx }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\section{Special characters for writing}
-%
-%\begin{macro}{\iow_newline:}
-% Global variable holding the character that forces a new line when
-% something is written to an output stream.
-% \begin{macrocode}
-\cs_new_nopar:Npn \iow_newline: { ^^J }
-% \end{macrocode}
-% \end{macro}
-%
-%\begin{macro}{\iow_char:N}
-% Function to write any escaped char to an output stream.
-% \begin{macrocode}
-\cs_new:Npn \iow_char:N #1 { \cs_to_str:N #1 }
-% \end{macrocode}
-%\end{macro}
-%
-%\subsection{Reading input}
-%
-%\begin{macro}{\if_eof:w}
-% A simple primitive renaming.
-% \begin{macrocode}
-\cs_new_eq:NN \if_eof:w \tex_ifeof:D
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\ior_if_eof_p:N}
-%\begin{macro}[TF]{\ior_if_eof:N}
-% To test if some particular input stream is exhausted the following
-% conditional is provided. As the pool model means that closed
-% streams are undefined control sequences, the test has two parts.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \ior_if_eof:N { p , TF , T , F } {
- \cs_if_exist:NTF #1
- { \tex_ifeof:D #1 \prg_return_true: \else: \prg_return_false: \fi: }
- { \prg_return_true: }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}{\ior_to:NN}
-%\begin{macro}{\ior_gto:NN}
-% And here we read from files.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \ior_to:NN #1#2 {
- \tex_read:D #1 to #2
-}
-\cs_new_protected_nopar:Npn \ior_gto:NN {
- \pref_global:D \ior_to:NN
-}
-%</initex|package>
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-% \end{implementation}
diff --git a/Master/texmf-dist/source/latex/expl3/l3keys.dtx b/Master/texmf-dist/source/latex/expl3/l3keys.dtx
deleted file mode 100644
index 48a38c7ee84..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3keys.dtx
+++ /dev/null
@@ -1,1656 +0,0 @@
-% \iffalse
-%% File: l3keys.dtx Copyright (C) 2009-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3keys.dtx 2082 2010-11-11 11:34:57Z joseph $
- {L3 Experimental key-value support}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{l3keys.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3keys} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Key--value support}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-%\begin{documentation}
-%
-% The key--value method is a popular system for creating large numbers
-% of settings for controlling function or package behaviour. For the
-% user, the system normally results in input of the form
-%\begin{verbatim}
-% \PackageControlMacro{
-% key-one = value one,
-% key-two = value two
-% }
-%\end{verbatim}
-% or
-%\begin{verbatim}
-% \PackageMacro[
-% key-one = value one,
-% key-two = value two
-% ]{argument}.
-%\end{verbatim}
-% For the programmer, the original \pkg{keyval} package gives only
-% the most basic interface for this work. All key macros have to be
-% created one at a time, and as a result the \pkg{kvoptions} and
-% \pkg{xkeyval} packages have been written to extend the ease of
-% creating keys. A very different approach has been provided by
-% the \pkg{pgfkeys} package, which uses a key--value list to
-% generate keys.
-%
-% The \pkg{l3keys} package is aimed at creating a programming
-% interface for key--value controls in \LaTeX3. Keys are
-% created using a key--value interface, in a similar manner to
-% \pkg{pgfkeys}. Each key is created by setting one or more
-% \emph{properties} of the key:
-%\begin{verbatim}
-% \keys_define:nn { module }
-% key-one .code:n = code including parameter #1,
-% key-two .tl_set:N = \l_module_store_tl
-% }
-%\end{verbatim}
-% These values can then be set as with other key--value approaches:
-%\begin{verbatim}
-% \keys_set:nn { module }
-% key-one = value one,
-% key-two = value two
-% }
-%\end{verbatim}
-%
-% At a document level, \cs{keys_set:nn} is used within a
-% document function. For \LaTeXe, a generic set up function could be
-% created with
-%\begin{verbatim}
-% \newcommand*\SomePackageSetup[1]{%
-% \@nameuse{keys_set:nn}{module}{#1}%
-% }
-%\end{verbatim}
-% or to use key--value input as the optional argument for a macro:
-%\begin{verbatim}
-% \newcommand*\SomePackageMacro[2][]{%
-% \begingroup
-% \@nameuse{keys_set:nn}{module}{#1}%
-% % Main code for \SomePackageMacro
-% \endgroup
-% }
-%\end{verbatim}
-% The same concepts using \pkg{xparse} for \LaTeX3 use:
-%\begin{verbatim}
-% \DeclareDocumentCommand \SomePackageSetup { m } {
-% \keys_set:nn { module } { #1 }
-% }
-% \DeclareDocumentCommand \SomePackageMacro { o m } {
-% \group_begin:
-% \keys_set:nn { module } { #1 }
-% % Main code for \SomePackageMacro
-% \group_end:
-% }
-%\end{verbatim}
-%
-% Key names may contain any tokens, as they are handled internally
-% using \cs{tl_to_str:n}. As will be discussed in
-% section~\ref{sec:subdivision}, it is suggested that the character
-% `\texttt{/}' is reserved for sub-division of keys into logical
-% groups. Macros are \emph{not} expanded when creating key names,
-% and so
-%\begin{verbatim}
-% \tl_set:Nn \l_module_tmp_tl { key }
-% \keys_define:nn { module } {
-% \l_module_tmp_tl .code:n = code
-% }
-%\end{verbatim}
-% will create a key called \cs{l_module_tmp_tl}, and not one called
-% \texttt{key}.
-%
-%\section{Creating keys}
-%
-%\begin{function}{\keys_define:nn}
-% \begin{syntax}
-% "\keys_define:nn" \Arg{module} \Arg{keyval list}
-% \end{syntax}
-% Parses the <keyval list> and defines the keys listed there for
-% <module>. The <module> name should be a text value, but there are
-% no restrictions on the nature of the text. In practice the
-% <module> should be chosen to be unique to the module in question
-% (unless deliberately adding keys to an existing module).
-%
-% The <keyval list> should consist of one or more key names along
-% with an associated key \emph{property}. The properties of a key
-% determine how it acts. The individual properties are described
-% in the following text; a typical use of \cs{keys_define:nn} might
-% read
-% \begin{verbatim}
-% \keys_define:nn { mymodule } {
-% keyname .code:n = Some~code~using~#1,
-% keyname .value_required:
-% }
-% \end{verbatim}
-% where the properties of the key begin from the \texttt{.} after
-% the key name.
-%
-% The \cs{keys_define:nn} function does not skip spaces in the
-% input, and does not check the category codes for \texttt{,} and
-% \texttt{=} tokens. This means that it is intended for use with
-% code blocks and other environments where spaces are ignored.
-%\end{function}
-%
-%\begin{function}{
-% .bool_set:N |
-% .bool_gset:N
-%}
-% \begin{syntax}
-% <key> .bool_set:N = <bool>
-% \end{syntax}
-% Defines <key> to set <bool> to <value> (which must be either
-% \texttt{true} or \texttt{false}). Here, <bool> is a \LaTeX3
-% boolean variable (\emph{i.e}.~created using \cs{bool_new:N}).
-% If the variable does not exist, it will be created at the point
-% that the key is set up.
-%\end{function}
-%
-%\begin{function}{.choice:}
-% \begin{syntax}
-% <key> .choice:
-% \end{syntax}
-% Sets <key> to act as a multiple choice key. Each valid choice
-% for <key> must then be created, as discussed in
-% section~\ref{sec:choice}.
-%\end{function}
-%
-%\begin{function}{
-% .choice_code:n |
-% .choice_code:x
-%}
-% \begin{syntax}
-% <key> .choice_code:n = <code>
-% \end{syntax}
-% Stores <code> for use when \texttt{.generate_choices:n} creates one
-% or more choice sub-keys of the current key. Inside <code>,
-% \cs{l_keys_choice_tl} contains the name of the choice made, and
-% \cs{l_keys_choice_int} is the position of the choice in the list
-% given to \texttt{.generate_choices:n}. Choices are discussed in
-% detail in section~\ref{sec:choice}.
-%\end{function}
-%
-%\begin{function}{
-% .code:n |
-% .code:x
-% }
-% \begin{syntax}
-% <key> .code:n = <code>
-% \end{syntax}
-% Stores the <code> for execution when <key> is called. The <code> can
-% include one parameter ("#1"), which will be the <value> given for the
-% <key>. The \texttt{.code:x} variant will expand <code> at the point
-% where the <key> is created.
-%\end{function}
-%
-%\begin{function}{
-% .default:n |
-% .default:V
-% }
-% \begin{syntax}
-% <key> .default:n = <default>
-% \end{syntax}
-% Creates a <default> value for <key>, which is used if no value is
-% given. This will be used if only the key name is given, but not if
-% a blank <value> is given:
-% \begin{verbatim}
-% \keys_define:nn { module } {
-% key .code:n = Hello #1,
-% key .default:n = World
-% }
-% \keys_set:nn { module} {
-% key = Fred, % Prints 'Hello Fred'
-% key, % Prints 'Hello World'
-% key = , % Prints 'Hello '
-% }
-% \end{verbatim}
-% \begin{texnote}
-% The <default> is stored as a token list variable, and therefore
-% should not contain unescaped "#" tokens.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% .dim_set:N |
-% .dim_set:c |
-% .dim_gset:N |
-% .dim_gset:c |
-%}
-% \begin{syntax}
-% <key> .dim_set:N = <dimension>
-% \end{syntax}
-% Sets <key> to store the value it is given in <dimension>. Here,
-% <dimension> is a \LaTeX3 \texttt{dim} variable
-% (\emph{i.e}.~created using \cs{dim_new:N}) or a \LaTeXe\
-% \texttt{dimen} (\emph{i.e} created using \cs{newdimen}). If the
-% variable does not exist, it will be created 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 |
-%}
-% \begin{syntax}
-% <key> .fp_set:N = <floating point>
-% \end{syntax}
-% Sets <key> to store the value it is given in <floating point>. Here,
-% <floating point> is a \LaTeX3 \texttt{fp} variable
-% (\emph{i.e}.~created using \cs{fp_new:N}). If the
-% variable does not exist, it will be created at the point that the
-% key is set up.
-%\end{function}
-%
-%\begin{function}{.generate_choices:n}
-% \begin{syntax}
-% <key> .generate_choices:n = <comma list>
-% \end{syntax}
-% Makes <key> a multiple choice key, accepting the choices specified
-% in <comma list>. Each choice will execute code which should
-% previously have been defined using \texttt{.choice_code:n} or
-% \texttt{.choice_code:x}. Choices are discussed in detail in
-% section~\ref{sec:choice}.
-%\end{function}
-%
-%\begin{function}{
-% .int_set:N |
-% .int_set:c |
-% .int_gset:N |
-% .int_gset:c |
-%}
-% \begin{syntax}
-% <key> .int_set:N = <integer>
-% \end{syntax}
-% Sets <key> to store the value it is given in <integer>. Here,
-% <integer> is a \LaTeX3 \texttt{int} variable
-% (\emph{i.e}.~created using \cs{int_new:N}) or a \LaTeXe\
-% \texttt{count} (\emph{i.e} created using \cs{newcount}). If the
-% variable does not exist, it will be created at the point that the
-% key is set up.
-%\end{function}
-%
-%\begin{function}{
-% .meta:n |
-% .meta:x
-%}
-% \begin{syntax}
-% <key> .meta:n = <multiple keys>
-% \end{syntax}
-% Makes <key> a meta-key, which will set <multiple keys> in
-% one go. If <key> is given with a value at the time the key
-% is used, then the value will be passed through to the subsidiary
-% <keys> for processing (as "#1").
-%\end{function}
-%
-%\begin{function}{
-% .skip_set:N |
-% .skip_set:c |
-% .skip_gset:N |
-% .skip_gset:c |
-%}
-% \begin{syntax}
-% <key> .skip_set:N = <skip>
-% \end{syntax}
-% Sets <key> to store the value it is given in <skip>, which is
-% created if it does not already exist. Here,
-% <skip> is a \LaTeX3 \texttt{skip} variable
-% (\emph{i.e}.~created using \cs{skip_new:N}) or a \LaTeXe\
-% \texttt{skip} (\emph{i.e} created using \cs{newskip}). If the
-% variable does not exist, it will be created at the point that the
-% key is set up.
-%\end{function}
-%
-%\begin{function}{
-% .tl_set:N |
-% .tl_set:c |
-% .tl_set_x:N |
-% .tl_set_x:c |
-% .tl_gset:N |
-% .tl_gset:c |
-% .tl_gset_x:N |
-% .tl_gset_x:c |
-%}
-% \begin{syntax}
-% <key> .tl_set:N = <token list variable>
-% \end{syntax}
-% Sets <key> to store the value it is given in <token list variable>,
-% which is created if it does not already exist. Here,
-% <token list variable> is a \LaTeX3 \texttt{tl} variable
-% (\emph{i.e}.~created using \cs{tl_new:N}) or a \LaTeXe\
-% macro with no arguments (\emph{i.e}.~created using
-% \cs{newcommand} or \cs{def}). If the variable does not exist, it
-% will be created at the point that the key is set up. The \texttt{x}
-% variants perform an \texttt{x} expansion at the time the <value>
-% passed to the <key> is saved to the <token list variable>.
-%\end{function}
-%
-%\begin{function}{
-% .value_forbidden: |
-% .value_required: |
-% }
-% \begin{syntax}
-% <key> .value_forbidden:
-% \end{syntax}
-% Flags for forbidding and requiring a <value> for <key>. Giving a
-% <value> for a <key> which has the \texttt{.value_forbidden:}
-% property set will result in an error. In the same way, if a <key> has
-% the \texttt{.value_required:} property set then a <value> must be
-% given when the <key> is used.
-%\end{function}
-%
-%\section{Sub-dividing keys}
-%\label{sec:subdivision}
-%
-% When creating large numbers of keys, it may be desirable to divide
-% them into several sub-groups for a given module. This can be achieved
-% either by adding a sub-division to the module name:
-%\begin{verbatim}
-% \keys_define:nn { module / subgroup } {
-% key .code:n = code
-% }
-%\end{verbatim}
-% or to the key name:
-%\begin{verbatim}
-% \keys_define:nn { module } {
-% subgroup / key .code:n = code
-% }
-%\end{verbatim}
-% As illustrated, the best choice of token for sub-dividing keys in
-% this way is `\texttt{/}'. This is because of the method that is
-% 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
-% particularly relevant to making multiple choices.
-%
-%\subsection{Multiple choices}
-%\label{sec:choice}
-%
-% Multiple choices are created by setting the \texttt{.choice:}
-% property:
-%\begin{verbatim}
-% \keys_define:nn { module } {
-% key .choice:
-% }
-%\end{verbatim}
-% For keys which are set up as choices, the valid choices are generated
-% by creating sub-keys of the choice key. This can be carried out in
-% two ways.
-%
-% In many cases, choices execute similar code which is dependant only
-% on the name of the choice or the position of the choice in the
-% list of choices. Here, the keys can share the same code, and can
-% be rapidly created using the \texttt{.choice_code:n} and
-% \texttt{.generate_choices:n} properties:
-%\begin{verbatim}
-% \keys_define:nn { module } {
-% key .choice_code:n = {
-% You~gave~choice~``\int_use:N \l_keys_choice_tl'',~
-% which~is~in~position~
-% \int_use:N\l_keys_choice_int\space
-% in~the~list.
-% },
-% key .generate_choices:n = {
-% choice-a, choice-b, choice-c
-% }
-% }
-%\end{verbatim}
-% Following common computing practice, \cs{l_keys_choice_int} is
-% indexed from \(0\) (as an offset), so that the value of
-% \cs{l_keys_choice_int} for the first choice in a list will be
-% zero. This means that \cs{l_keys_choice_int} can be used directly
-% with \cs{if_case:w} and so on.
-%
-%\begin{variable}{
-% \l_keys_choice_int |
-% \l_keys_choice_tl
-%}
-% Inside the code block for a choice generated using
-% \texttt{.generate_choice:}, the variables \cs{l_keys_choice_tl} and
-% \cs{l_keys_choice_int} are available to indicate the name of the
-% current choice, and its position in the comma list. The position
-% is indexed from \(0\).
-%\end{variable}
-%
-% On the other hand, it is sometimes useful to create choices which
-% use entirely different code from one another. This can be achieved
-% by setting the \texttt{.choice:} property of a key, then manually
-% defining sub-keys.
-%\begin{verbatim}
-% \keys_define:nn { module } {
-% key .choice:n,
-% key / choice-a .code:n = code-a,
-% key / choice-b .code:n = code-b,
-% key / choice-c .code:n = code-c,
-% }
-%\end{verbatim}
-%
-% It is possible to mix the two methods, but manually-created choices
-% should \emph{not} use \cs{l_keys_choice_tl} or \cs{l_keys_choice_int}.
-% These variables do not have defined behaviour when used outside of
-% code created using \texttt{.generate_choices:n}
-% (\emph{i.e}.~anything might happen!).
-%
-%\section{Setting keys}
-%
-%\begin{function}{
-% \keys_set:nn |
-% \keys_set:nV |
-% \keys_set:nv
-%}
-% \begin{syntax}
-% "\keys_set:nn" \Arg{module} \Arg{keyval list}
-% \end{syntax}
-% Parses the <keyval list>, and sets those keys which are defined
-% for <module>. The behaviour on finding an unknown key can be
-% set by defining a special \texttt{unknown} key: this will be
-% illustrated later. In contrast to \cs{keys_define:nn}, this function
-% does check category codes and ignore spaces, and is therefore
-% suitable for user input.
-%\end{function}
-%
-% If a key is not known, \cs{keys_set:nn} will look for a special
-% \texttt{unknown} key for the same module. This mechanism can be
-% used to create new keys from user input.
-%\begin{verbatim}
-% \keys_define:nn { module } {
-% unknown .code:n =
-% You~tried~to~set~key~'\l_keys_path_tl'~to~'#1'
-% }
-%\end{verbatim}
-%
-%\begin{variable}{\l_keys_key_tl}
-% When processing an unknown key, the name of the key is available
-% as \cs{l_keys_key_tl}. Note that this will have been processed
-% using \cs{tl_to_str:N}. The value passed to the key (if any) is
-% available as the macro parameter "#1".
-%\end{variable}
-%
-%\subsection{Examining keys: internal representation}
-%
-%\begin{function}{\keys_if_exist:nn / (TF)}
-% \begin{syntax}
-% "\keys_if_exist:nnTF" \Arg{module} \Arg{key} \Arg{true code}
-% ~~~~\Arg{false code}
-% \end{syntax}
-% Tests if <key> exists for <module>, \emph{i.e}.~if any code has
-% been defined for <key>.
-% \begin{texnote}
-% The function works by testing for the existence of the internal
-% function \cs{keys > <module>/<key>.cmd:n}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\keys_show:nn}
-% \begin{syntax}
-% "\keys_show:nn" \Arg{module} \Arg{key}
-% \end{syntax}
-% Shows the internal representation of a <key>.
-% \begin{texnote}
-% Keys are stored as functions with names of the format
-% \cs{keys > <module>/<key>.cmd:n}.
-% \end{texnote}
-%\end{function}
-%
-%\section{Internal functions}
-%
-%\begin{function}{\keys_bool_set:Nn}
-% \begin{syntax}
-% "\keys_bool_set:Nn" <bool> \marg{scope}
-% \end{syntax}
-% Creates code to set <bool> when <key> is given, with setting using
-% <scope> (empty or \texttt{g} for local or global,
-% respectively). <bool> should be a \LaTeX3 boolean variable.
-%\end{function}
-%
-%\begin{function}{\keys_choice_code_store:x}
-% \begin{syntax}
-% "\keys_choice_code_store:x" <code>
-% \end{syntax}
-% Stores <code> for later use by \texttt{.generate_code:n}.
-%\end{function}
-%
-%\begin{function}{\keys_choice_make:}
-% \begin{syntax}
-% "\keys_choice_make:"
-% \end{syntax}
-% Makes <key> a choice key.
-%\end{function}
-%
-%\begin{function}{\keys_choices_generate:n}
-% \begin{syntax}
-% "\keys_choices_generate:n" \Arg{comma list}
-% \end{syntax}
-% Makes <comma list> choices for <key>.
-%\end{function}
-%
-%\begin{function}{\keys_choice_find:n}
-% \begin{syntax}
-% "\keys_choice_find:n" \Arg{choice}
-% \end{syntax}
-% Searches for <choice> as a sub-key of <key>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_cmd_set:nn |
-% \keys_cmd_set:nx
-%}
-% \begin{syntax}
-% "\keys_cmd_set:nn" \Arg{path} \Arg{code}
-% \end{syntax}
-% Creates a function for <path> using <code>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_default_set:n |
-% \keys_default_set:V
-%}
-% \begin{syntax}
-% "\keys_default_set:n" \Arg{default}
-% \end{syntax}
-% Sets <default> for <key>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_define_elt:n |
-% \keys_define_elt:nn
-%}
-% \begin{syntax}
-% "\keys_define_elt:nn" \Arg{key} \Arg{value}
-% \end{syntax}
-% Processing functions for key--value pairs when defining keys.
-%\end{function}
-%
-%\begin{function}{\keys_define_key:n}
-% \begin{syntax}
-% "\keys_define_key:n" \Arg{key}
-% \end{syntax}
-% Defines <key>.
-%\end{function}
-%
-%\begin{function}{\keys_execute:}
-% \begin{syntax}
-% "\keys_execute:"
-% \end{syntax}
-% Executes <key> (where the name of the <key> will be stored
-% internally).
-%\end{function}
-%
-%\begin{function}{\keys_execute_unknown:}
-% \begin{syntax}
-% "\keys_execute_unknown:"
-% \end{syntax}
-% Handles unknown <key> names.
-%\end{function}
-%
-%\begin{function}{\keys_if_value_requirement:nTF / (EXP)}
-% \begin{syntax}
-% "\keys_if_value_requirement:nTF" \Arg{requirement}
-% ~~~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% Check if <requirement> applies to <key>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_meta_make:n |
-% \keys_meta_make:x
-%}
-% \begin{syntax}
-% "\keys_meta_make:n" \Arg{keys}
-% \end{syntax}
-% Makes <key> a meta-key to set <keys>.
-%\end{function}
-%
-%\begin{function}{\keys_property_find:n}
-% \begin{syntax}
-% "\keys_property_find:n" \Arg{key}
-% \end{syntax}
-% Separates <key> from <property>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_property_new:nn |
-% \keys_property_new_arg:nn
-%}
-% \begin{syntax}
-% "\keys_property_new:nn" \Arg{property} \Arg{code}
-% \end{syntax}
-% Makes a new <property> expanding to <code>. The \texttt{arg}
-% version makes properties with one argument.
-%\end{function}
-%
-%\begin{function}{\keys_property_undefine:n}
-% \begin{syntax}
-% "\keys_property_undefine:n" \Arg{property}
-% \end{syntax}
-% Deletes <property> of <key>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_set_elt:n |
-% \keys_set_elt:nn
-%}
-% \begin{syntax}
-% "\keys_set_elt:nn" \Arg{key} \Arg{value}
-% \end{syntax}
-% Processing functions for key--value pairs when setting keys.
-%\end{function}
-%
-%\begin{function}{\keys_tmp:w}
-% \begin{syntax}
-% "\keys_tmp:w" <args>
-% \end{syntax}
-% Used to store <code> to execute a <key>.
-%\end{function}
-%
-%\begin{function}{\keys_value_or_default:n}
-% \begin{syntax}
-% "\keys_value_or_default:n" \Arg{value}
-% \end{syntax}
-% Sets \cs{l_keys_value_tl} to <value>, or <default> if
-% <value> was not given and if <default> is available.
-%\end{function}
-%
-%\begin{function}{\keys_value_requirement:n}
-% \begin{syntax}
-% "\keys_value_requirement:n" \Arg{requirement}
-% \end{syntax}
-% Sets <key> to have <requirement> concerning <value>.
-%\end{function}
-%
-%\begin{function}{
-% \keys_variable_set:NnNN |
-% \keys_variable_set:cnNN |
-%}
-% \begin{syntax}
-% "\keys_variable_set:NnNN" <var> <type> <scope> <expansion>
-% \end{syntax}
-% Sets <key> to assign <value> to <variable>. The <scope> (blank
-% for local, \texttt{g} for global) and <type> (\texttt{tl},
-% \texttt{int}, etc.) are given explicitly.
-%\end{function}
-%
-%\section{Variables and constants}
-%
-%\begin{variable}{
-% \c_keys_properties_root_tl |
-% \c_keys_root_tl
-%}
-% The root paths for keys and properties, used to generate the
-% names of the functions which store these items.
-%\end{variable}
-%
-%\begin{variable}{
-% \c_keys_value_forbidden_tl |
-% \c_keys_value_required_tl
-%}
-% Marker text containers: by storing the values the code can make
-% comparisons slightly faster.
-%\end{variable}
-%
-%\begin{variable}{\l_keys_choice_code_tl}
-% Used to transfer code from storage when making multiple choices.
-%\end{variable}
-%
-%\begin{variable}{
-% \l_keys_module_tl |
-% \l_keys_path_tl |
-% \l_keys_property_tl
-%}
-% Various key paths need to be stored. These are flexible items
-% that are set during the key reading process.
-%\end{variable}
-%
-%\begin{variable}{\l_keys_no_value_bool}
-% A marker for `no value' as key input.
-%\end{variable}
-%
-%\begin{variable}{\l_keys_value_tl}
-% Holds the currently supplied value, in a token register as
-% there may be "#" tokens.
-%\end{variable}
-%
-%\end{documentation}
-%
-%\begin{implementation}
-%
-% The usual preliminaries.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%\subsubsection{Variables and constants}
-%
-%\begin{macro}{\c_keys_root_tl}
-%\begin{macro}{\c_keys_properties_root_tl}
-% Where the keys are really stored.
-% \begin{macrocode}
-\tl_const:Nn \c_keys_root_tl { keys~>~ }
-\tl_const:Nn \c_keys_properties_root_tl { keys_properties }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\c_keys_value_forbidden_tl}
-%\begin{macro}{\c_keys_value_required_tl}
-% Two marker token lists.
-% \begin{macrocode}
-\tl_const:Nn \c_keys_value_forbidden_tl { forbidden }
-\tl_const:Nn \c_keys_value_required_tl { required }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_keys_choice_int}
-%\begin{macro}{\l_keys_choice_tl}
-% Used for the multiple choice system.
-% \begin{macrocode}
-\int_new:N \l_keys_choice_int
-\tl_new:N \l_keys_choice_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_keys_choice_code_tl}
-% When creating multiple choices, the code is stored here.
-% \begin{macrocode}
-\tl_new:N \l_keys_choice_code_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\l_keys_key_tl}
-%\begin{macro}{\l_keys_path_tl}
-%\begin{macro}{\l_keys_property_tl}
-% Storage for the current key name and the path of the key (key name
-% plus module name).
-% \begin{macrocode}
-\tl_new:N \l_keys_key_tl
-\tl_new:N \l_keys_path_tl
-\tl_new:N \l_keys_property_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_keys_module_tl}
-% The module for an entire set of keys.
-% \begin{macrocode}
-\tl_new:N \l_keys_module_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\l_keys_no_value_bool}
-% To indicate that no value has been given.
-% \begin{macrocode}
-\bool_new:N \l_keys_no_value_bool
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\l_keys_value_tl}
-% A token variable for the given value.
-% \begin{macrocode}
-\tl_new:N \l_keys_value_tl
-% \end{macrocode}
-%\end{macro}
-%
-%\subsubsection{Internal functions}
-%
-%\begin{macro}{\keys_bool_set:Nn}
-% Boolean keys are really just choices, but all done by hand.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_bool_set:Nn #1#2 {
- \keys_cmd_set:nx { \l_keys_path_tl / true } {
- \exp_not:c { bool_ #2 set_true:N }
- \exp_not:N #1
- }
- \keys_cmd_set:nx { \l_keys_path_tl / false } {
- \exp_not:N \use:c
- { bool_ #2 set_false:N }
- \exp_not:N #1
- }
- \keys_choice_make:
- \cs_if_exist:NF #1 {
- \bool_new:N #1
- }
- \keys_default_set:n { true }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_choice_code_store:x}
-% The code for making multiple choices is stored in a token list as there should
-% not be any "#" tokens.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_choice_code_store:x #1 {
- \tl_set:cx { \c_keys_root_tl \l_keys_path_tl .choice_code_tl } {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_choice_find:n}
-% Executing a choice has two parts. First, try the choice given, then
-% if that fails call the unknown key. That will exist, as it is created
-% when a choice is first made. So there is no need for any escape code.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_choice_find:n #1 {
- \keys_execute_aux:nn { \l_keys_path_tl / \tl_to_str:n {#1} } {
- \keys_execute_aux:nn { \l_keys_path_tl / unknown } { }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_choice_make:}
-% To make a choice from a key, two steps: set the code, and set the
-% unknown key.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_choice_make: {
- \keys_cmd_set:nn { \l_keys_path_tl } {
- \keys_choice_find:n {##1}
- }
- \keys_cmd_set:nn { \l_keys_path_tl / unknown } {
- \msg_kernel_error:nnxx { keys } { choice-unknown }
- { \l_keys_path_tl } {##1}
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_choices_generate:n}
-%\begin{macro}[aux]{\keys_choices_generate_aux:n}
-% Creating multiple-choices means setting up the ``indicator'' code,
-% then applying whatever the user wanted.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_choices_generate:n #1 {
- \keys_choice_make:
- \int_zero:N \l_keys_choice_int
- \cs_if_exist:cTF {
- \c_keys_root_tl \l_keys_path_tl .choice_code_tl
- } {
- \tl_set:Nv \l_keys_choice_code_tl {
- \c_keys_root_tl \l_keys_path_tl .choice_code_tl
- }
- }{
- \msg_kernel_error:nnx { keys } { generate-choices-before-code }
- { \l_keys_path_tl }
- }
- \clist_map_function:nN {#1} \keys_choices_generate_aux:n
-}
-\cs_new_protected_nopar:Npn \keys_choices_generate_aux:n #1 {
- \keys_cmd_set:nx { \l_keys_path_tl / #1 } {
- \exp_not:n { \tl_set:Nn \l_keys_choice_tl } {#1}
- \exp_not:n { \int_set:Nn \l_keys_choice_int }
- { \int_use:N \l_keys_choice_int }
- \exp_not:V \l_keys_choice_code_tl
- }
- \int_incr:N \l_keys_choice_int
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_cmd_set:nn}
-%\begin{macro}{\keys_cmd_set:nx}
-%\begin{macro}[aux]{\keys_cmd_set_aux:n}
-% Creating a new command means setting properties and then creating
-% a function with the correct number of arguments.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_cmd_set:nn #1#2 {
- \keys_cmd_set_aux:n {#1}
- \cs_generate_from_arg_count:cNnn { \c_keys_root_tl #1 .cmd:n }
- \cs_set:Npn 1 {#2}
-}
-\cs_new_protected:Npn \keys_cmd_set:nx #1#2 {
- \keys_cmd_set_aux:n {#1}
- \cs_generate_from_arg_count:cNnn { \c_keys_root_tl #1 .cmd:n }
- \cs_set:Npx 1 {#2}
-}
-\cs_new_protected_nopar:Npn \keys_cmd_set_aux:n #1 {
- \keys_property_undefine:n { #1 .default_tl }
- \cs_if_free:cT { \c_keys_root_tl #1 .req_tl }
- { \tl_new:c { \c_keys_root_tl #1 .req_tl } }
- \tl_clear:c { \c_keys_root_tl #1 .req_tl }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_default_set:n}
-%\begin{macro}{\keys_default_set:V}
-% Setting a default value is easy.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_default_set:n #1 {
- \cs_if_free:cT { \c_keys_root_tl \l_keys_path_tl .default_tl }
- { \tl_new:c { \c_keys_root_tl \l_keys_path_tl .default_tl } }
- \tl_set:cn { \c_keys_root_tl \l_keys_path_tl .default_tl } {#1}
-}
-\cs_generate_variant:Nn \keys_default_set:n { V }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_define:nn}
-%\begin{macro}[aux]{\keys_define_aux:nnn}
-%\begin{macro}[aux]{\keys_define_aux:onn}
-% The main key-defining function mainly sets up things for \pkg{l3keyval}
-% to use.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_define:nn {
- \keys_define_aux:onn { \l_keys_module_tl }
-}
-\cs_new_protected:Npn \keys_define_aux:nnn #1#2#3 {
- \tl_set:Nn \l_keys_module_tl {#2}
- \KV_process_no_space_removal_no_sanitize:NNn
- \keys_define_elt:n \keys_define_elt:nn {#3}
- \tl_set:Nn \l_keys_module_tl {#1}
-}
-\cs_generate_variant:Nn \keys_define_aux:nnn { o }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_define_elt:n}
-%\begin{macro}{\keys_define_elt:nn}
-% The element processors for defining keys.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_define_elt:n #1 {
- \bool_set_true:N \l_keys_no_value_bool
- \keys_define_elt_aux:nn {#1} { }
-}
-\cs_new_protected:Npn \keys_define_elt:nn #1#2 {
- \bool_set_false:N \l_keys_no_value_bool
- \keys_define_elt_aux:nn {#1} {#2}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\begin{macro}[aux]{\keys_define_elt_aux:nn}
-% The auxiliary function does most of the work.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 {
- \keys_property_find:n {#1}
- \cs_set_eq:Nc \keys_tmp:w
- { \c_keys_properties_root_tl \l_keys_property_tl }
- \cs_if_exist:NTF \keys_tmp:w {
- \keys_define_key:n {#2}
- }{
- \msg_kernel_error:nnxx { keys } { property-unknown }
- { \l_keys_property_tl } { \l_keys_path_tl }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_define_key:n}
-% Defining a new key means finding the code for the appropriate
-% property then running it. As properties have signatures, a check
-% can be made for required values without needing anything set
-% explicitly.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_define_key:n #1 {
- \bool_if:NTF \l_keys_no_value_bool {
- \int_compare:nTF {
- \exp_args:Nc \cs_get_arg_count_from_signature:N
- { \l_keys_property_tl } = \c_zero
- } {
- \keys_tmp:w
- }{
- \msg_kernel_error:nnxx { key } { property-requires-value }
- { \l_keys_property_tl } { \l_keys_path_tl }
- }
- }{
- \keys_tmp:w {#1}
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_execute:}
-%\begin{macro}{\keys_execute_unknown:}
-%\begin{macro}[aux]{\keys_execute_aux:nn}
-% Actually executing a key is done in two parts. First, look for the
-% key itself, then look for the \texttt{unknown} key with the same
-% path. If both of these fail, complain!
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_execute: {
- \keys_execute_aux:nn { \l_keys_path_tl } {
- \keys_execute_unknown:
- }
-}
-\cs_new_protected_nopar:Npn \keys_execute_unknown: {
- \keys_execute_aux:nn { \l_keys_module_tl / unknown } {
- \msg_kernel_error:nnxx { keys } { key-unknown } { \l_keys_path_tl }
- { \l_keys_module_tl }
- }
-}
-% \end{macrocode}
-% If there is only one argument required, it is wrapped in braces so
-% that everything is passed through properly. On the other hand, if more
-% than one is needed it is down to the user to have put things in
-% correctly! The use of \cs{q_keys_stop} here means that arguments
-% do not run away (hence the nine empty groups), but that the module
-% can clean up the spare groups at the end of executing the key.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_execute_aux:nn #1#2 {
- \cs_set_eq:Nc \keys_tmp:w { \c_keys_root_tl #1 .cmd:n }
- \cs_if_exist:NTF \keys_tmp:w {
- \exp_args:NV \keys_tmp:w \l_keys_value_tl
- }{
- #2
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[TF]{\keys_if_exist:nn}
-% A check for the existance of a key. This works by looking for the
-% command function for the key (which ends \texttt{.cmd:n}).
-% \begin{macrocode}
-\prg_set_conditional:Nnn \keys_if_exist:nn {TF,T,F} {
- \cs_if_exist:cTF { \c_keys_root_tl #1 / #2 .cmd:n } {
- \prg_return_true:
- }{
- \prg_return_false:
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_if_value_requirement:nTF}
-% To test if a value is required or forbidden. Only one version is
-% needed, so done by hand.
-% \begin{macrocode}
-\cs_new_nopar:Npn \keys_if_value_requirement:nTF #1 {
- \tl_if_eq:ccTF { c_keys_value_ #1 _tl } {
- \c_keys_root_tl \l_keys_path_tl .req_tl
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_meta_make:n}
-%\begin{macro}{\keys_meta_make:x}
-% To create a met-key, simply set up to pass data through.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_meta_make:n #1 {
- \exp_last_unbraced:NNo \keys_cmd_set:nn \l_keys_path_tl
- \exp_after:wN { \exp_after:wN \keys_set:nn \exp_after:wN { \l_keys_module_tl } {#1} }
-}
-\cs_new_protected_nopar:Npn \keys_meta_make:x #1 {
- \keys_cmd_set:nx { \l_keys_path_tl } {
- \exp_not:N \keys_set:nn { \l_keys_module_tl } {#1}
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_property_find:n}
-%\begin{macro}[aux]{\keys_property_find_aux:n}
-%\begin{macro}[aux]{\keys_property_find_aux:w}
-% Searching for a property means finding the last ``\texttt{.}'' in
-% the input, and storing the text before and after it.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_property_find:n #1 {
- \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / }
- \tl_if_in:nnTF {#1} {.} {
- \keys_property_find_aux:n {#1}
- }{
- \msg_kernel_error:nnx { keys } { key-no-property } {#1}
- }
-}
-\cs_new_protected_nopar:Npn \keys_property_find_aux:n #1 {
- \keys_property_find_aux:w #1 \q_stop
-}
-\cs_new_protected_nopar:Npn \keys_property_find_aux:w #1 . #2 \q_stop {
- \tl_if_in:nnTF {#2} { . } {
- \tl_set:Nx \l_keys_path_tl {
- \l_keys_path_tl \tl_to_str:n {#1} .
- }
- \keys_property_find_aux:w #2 \q_stop
- }{
- \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} }
- \tl_set:Nn \l_keys_property_tl { . #2 }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_property_new:nn}
-%\begin{macro}{\keys_property_new_arg:nn}
-% Creating a new property is simply a case of making the correctly-named
-% function.
-% \begin{macrocode}
-\cs_new_nopar:Npn \keys_property_new:nn #1#2 {
- \cs_new:cpn { \c_keys_properties_root_tl #1 } {#2}
-}
-\cs_new_protected_nopar:Npn \keys_property_new_arg:nn #1#2 {
- \cs_new:cpn { \c_keys_properties_root_tl #1 } ##1 {#2}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_property_undefine:n}
-% Removing a property means undefining it.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_property_undefine:n #1 {
- \cs_set_eq:cN { \c_keys_root_tl #1 } \c_undefined
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_set:nn}
-%\begin{macro}{\keys_set:nV}
-%\begin{macro}{\keys_set:nv}
-%\begin{macro}{\keys_set_aux:nnn}
-%\begin{macro}{\keys_set_aux:onn}
-% The main setting function just does the set up to get \pkg{l3keyval}
-% to do the hard work.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_set:nn {
- \keys_set_aux:onn { \l_keys_module_tl }
-}
-\cs_generate_variant:Nn \keys_set:nn { nV, nv }
-\cs_new_protected:Npn \keys_set_aux:nnn #1#2#3 {
- \tl_set:Nn \l_keys_module_tl {#2}
- \KV_process_space_removal_sanitize:NNn
- \keys_set_elt:n \keys_set_elt:nn {#3}
- \tl_set:Nn \l_keys_module_tl {#1}
-}
-\cs_generate_variant:Nn \keys_set_aux:nnn { o }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_set_elt:n}
-%\begin{macro}{\keys_set_elt:nn}
-% The two element processors are almost identical, and pass the data
-% through to the underlying auxiliary, which does the work.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_set_elt:n #1 {
- \bool_set_true:N \l_keys_no_value_bool
- \keys_set_elt_aux:nn {#1} { }
-}
-\cs_new_protected:Npn \keys_set_elt:nn #1#2 {
- \bool_set_false:N \l_keys_no_value_bool
- \keys_set_elt_aux:nn {#1} {#2}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\begin{macro}[aux]{\keys_set_elt_aux:nn}
-%\begin{macro}[aux]{\keys_set_elt_aux:}
-% First, set the current path and add a default if needed. There are
-% then checks to see if the a value is required or forbidden. If
-% everything passes, move on to execute the code.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_set_elt_aux:nn #1#2 {
- \tl_set:Nx \l_keys_key_tl { \tl_to_str:n {#1} }
- \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / \l_keys_key_tl }
- \keys_value_or_default:n {#2}
- \keys_if_value_requirement:nTF { required } {
- \bool_if:NTF \l_keys_no_value_bool {
- \msg_kernel_error:nnx { keys } { value-required }
- { \l_keys_path_tl }
- }{
- \keys_set_elt_aux:
- }
- }{
- \keys_set_elt_aux:
- }
-}
-\cs_new_protected_nopar:Npn \keys_set_elt_aux: {
- \keys_if_value_requirement:nTF { forbidden } {
- \bool_if:NTF \l_keys_no_value_bool {
- \keys_execute:
- }{
- \msg_kernel_error:nnxx { keys } { value-forbidden }
- { \l_keys_path_tl } { \tl_use:N \l_keys_value_tl }
- }
- }{
- \keys_execute:
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\keys_show:nn}
-% Showing a key is just a question of using the correct name.
-% \begin{macrocode}
-\cs_new_nopar:Npn \keys_show:nn #1#2 {
- \cs_show:c { \c_keys_root_tl #1 / \tl_to_str:n {#2} .cmd:n }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_tmp:w}
-% This scratch function is used to actually execute keys.
-% \begin{macrocode}
-\cs_new:Npn \keys_tmp:w {}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_value_or_default:n}
-% If a value is given, return it as "#1", otherwise send a default if
-% available.
-% \begin{macrocode}
-\cs_new_protected:Npn \keys_value_or_default:n #1 {
- \tl_set:Nn \l_keys_value_tl {#1}
- \bool_if:NT \l_keys_no_value_bool {
- \cs_if_exist:cT { \c_keys_root_tl \l_keys_path_tl .default_tl } {
- \tl_set:Nv \l_keys_value_tl {
- \c_keys_root_tl \l_keys_path_tl .default_tl
- }
- }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_value_requirement:n}
-% Values can be required or forbidden by having the appropriate marker
-% set.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_value_requirement:n #1 {
- \tl_set_eq:cc { \c_keys_root_tl \l_keys_path_tl .req_tl }
- { c_keys_value_ #1 _tl }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\keys_variable_set:NnNN}
-%\begin{macro}{\keys_variable_set:cnNN}
-% Setting a variable takes the type and scope separately so that
-% it is easy to make a new variable if needed.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \keys_variable_set:NnNN #1#2#3#4 {
- \cs_if_exist:NF #1 {
- \use:c { #2 _new:N } #1
- }
- \keys_cmd_set:nx { \l_keys_path_tl } {
- \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1}
- }
-}
-\cs_generate_variant:Nn \keys_variable_set:NnNN { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\subsubsection{Properties}
-%
-%\begin{macro}{.bool_set:N}
-%\begin{macro}{.bool_gset:N}
-% One function for this.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .bool_set:N } {
- \keys_bool_set:Nn #1 { }
-}
-\keys_property_new_arg:nn { .bool_gset:N } {
- \keys_bool_set:Nn #1 { g }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.choice:}
-% Making a choice is handled internally, as it is also needed by
-% \texttt{.generate_choices:n}.
-% \begin{macrocode}
-\keys_property_new:nn { .choice: } {
- \keys_choice_make:
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{.choice_code:n}
-%\begin{macro}{.choice_code:x}
-% Storing the code for choices, using \cs{exp_not:n} to avoid needing
-% two internal functions.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .choice_code:n } {
- \keys_choice_code_store:x { \exp_not:n {#1} }
-}
-\keys_property_new_arg:nn { .choice_code:x } {
- \keys_choice_code_store:x {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.code:n}
-%\begin{macro}{.code:x}
-% Creating code is simply a case of passing through to the underlying
-% \texttt{set} function.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .code:n } {
- \keys_cmd_set:nn { \l_keys_path_tl } {#1}
-}
-\keys_property_new_arg:nn { .code:x } {
- \keys_cmd_set:nx { \l_keys_path_tl } {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.default:n}
-%\begin{macro}{.default:V}
-% Expansion is left to the internal functions.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .default:n } {
- \keys_default_set:n {#1}
-}
-\keys_property_new_arg:nn { .default:V } {
- \keys_default_set:V #1
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.dim_set:N}
-%\begin{macro}{.dim_set:c}
-%\begin{macro}{.dim_gset:N}
-%\begin{macro}{.dim_gset:c}
-% Setting a variable is very easy: just pass the data along.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .dim_set:N } {
- \keys_variable_set:NnNN #1 { dim } { } n
-}
-\keys_property_new_arg:nn { .dim_set:c } {
- \keys_variable_set:cnNN {#1} { dim } { } n
-}
-\keys_property_new_arg:nn { .dim_gset:N } {
- \keys_variable_set:NnNN #1 { dim } g n
-}
-\keys_property_new_arg:nn { .dim_gset:c } {
- \keys_variable_set:cnNN {#1} { dim } g n
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.fp_set:N}
-%\begin{macro}{.fp_set:c}
-%\begin{macro}{.fp_gset:N}
-%\begin{macro}{.fp_gset:c}
-% Setting a variable is very easy: just pass the data along.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .fp_set:N } {
- \keys_variable_set:NnNN #1 { fp } { } n
-}
-\keys_property_new_arg:nn { .fp_set:c } {
- \keys_variable_set:cnNN {#1} { fp } { } n
-}
-\keys_property_new_arg:nn { .fp_gset:N } {
- \keys_variable_set:NnNN #1 { fp } g n
-}
-\keys_property_new_arg:nn { .fp_gset:c } {
- \keys_variable_set:cnNN {#1} { fp } g n
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.generate_choices:n}
-% Making choices is easy.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .generate_choices:n } {
- \keys_choices_generate:n {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{.int_set:N}
-%\begin{macro}{.int_set:c}
-%\begin{macro}{.int_gset:N}
-%\begin{macro}{.int_gset:c}
-% Setting a variable is very easy: just pass the data along.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .int_set:N } {
- \keys_variable_set:NnNN #1 { int } { } n
-}
-\keys_property_new_arg:nn { .int_set:c } {
- \keys_variable_set:cnNN {#1} { int } { } n
-}
-\keys_property_new_arg:nn { .int_gset:N } {
- \keys_variable_set:NnNN #1 { int } g n
-}
-\keys_property_new_arg:nn { .int_gset:c } {
- \keys_variable_set:cnNN {#1} { int } g n
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.meta:n}
-%\begin{macro}{.meta:x}
-% Making a meta is handled internally.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .meta:n } {
- \keys_meta_make:n {#1}
-}
-\keys_property_new_arg:nn { .meta:x } {
- \keys_meta_make:x {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.skip_set:N}
-%\begin{macro}{.skip_set:c}
-%\begin{macro}{.skip_gset:N}
-%\begin{macro}{.skip_gset:c}
-% Setting a variable is very easy: just pass the data along.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .skip_set:N } {
- \keys_variable_set:NnNN #1 { skip } { } n
-}
-\keys_property_new_arg:nn { .skip_set:c } {
- \keys_variable_set:cnNN {#1} { skip } { } n
-}
-\keys_property_new_arg:nn { .skip_gset:N } {
- \keys_variable_set:NnNN #1 { skip } g n
-}
-\keys_property_new_arg:nn { .skip_gset:c } {
- \keys_variable_set:cnNN {#1} { skip } g n
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.tl_set:N}
-%\begin{macro}{.tl_set:c}
-%\begin{macro}{.tl_set_x:N}
-%\begin{macro}{.tl_set_x:c}
-%\begin{macro}{.tl_gset:N}
-%\begin{macro}{.tl_gset:c}
-%\begin{macro}{.tl_gset_x:N}
-%\begin{macro}{.tl_gset_x:c}
-% Setting a variable is very easy: just pass the data along.
-% \begin{macrocode}
-\keys_property_new_arg:nn { .tl_set:N } {
- \keys_variable_set:NnNN #1 { tl } { } n
-}
-\keys_property_new_arg:nn { .tl_set:c } {
- \keys_variable_set:cnNN {#1} { tl } { } n
-}
-\keys_property_new_arg:nn { .tl_set_x:N } {
- \keys_variable_set:NnNN #1 { tl } { } x
-}
-\keys_property_new_arg:nn { .tl_set_x:c } {
- \keys_variable_set:cnNN {#1} { tl } { } x
-}
-\keys_property_new_arg:nn { .tl_gset:N } {
- \keys_variable_set:NnNN #1 { tl } g n
-}
-\keys_property_new_arg:nn { .tl_gset:c } {
- \keys_variable_set:cnNN {#1} { tl } g n
-}
-\keys_property_new_arg:nn { .tl_gset_x:N } {
- \keys_variable_set:NnNN #1 { tl } g x
-}
-\keys_property_new_arg:nn { .tl_gset_x:c } {
- \keys_variable_set:cnNN {#1} { tl } g x
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{.value_forbidden:}
-%\begin{macro}{.value_required:}
-% These are very similar, so both call the same function.
-% \begin{macrocode}
-\keys_property_new:nn { .value_forbidden: } {
- \keys_value_requirement:n { forbidden }
-}
-\keys_property_new:nn { .value_required: } {
- \keys_value_requirement:n { required }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\subsubsection{Messages}
-%
-% For when there is a need to complain.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { keys } { choice-unknown }
- { Choice~'#2'~unknown~for~key~'#1'. }
- {
- The~key~'#1'~takes~a~limited~number~of~values.\\
- The~input~given,~'#2',~is~not~on~the~list~accepted.
- }
-\msg_kernel_new:nnnn { keys } { generate-choices-before-code }
- { No~code~available~to~generate~choices~for~key~'#1'. }
- {
- \l_msg_coding_error_text_tl
- Before~using~.generate_choices:n~the~code~should~be~defined\\%
- with~.choice_code:n~or~.choice_code:x.
- }
-\msg_kernel_new:nnnn { keys } { key-no-property }
- { No~property~given~in~definition~of~key~'#1'. }
- {
- \c_msg_coding_error_text_tl
- Inside~\token_to_str:N \keys_define:nn \c_space_tl each~key~name
- needs~a~property: \\
- ~ ~ #1 .<property> \\
- LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property.
- }
-\msg_kernel_new:nnnn { keys } { key-unknown }
- { The~key~'#1'~is~unknown~and~is~being~ignored. }
- {
- The~module~'#2'~does~not~have~a~key~called~#1'.\\
- Check~that~you~have~spelled~the~key~name~correctly.
- }
-\msg_kernel_new:nnnn { keys } { property-requires-value }
- { The~property~'#1'~requires~a~value. }
- {
- \l_msg_coding_error_text_tl
- LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\
- No~value~was~given~for~the~property,~and~one~is~required.
- }
-\msg_kernel_new:nnnn { keys } { property-unknown }
- { The~key~property~'#1'~is~unknown. }
- {
- \l_msg_coding_error_text_tl
- LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':\\
- this~property~is~not~defined.
- }
-\msg_kernel_new:nnnn { keys } { value-forbidden }
- { The~key~'#1'~does~not~taken~a~value. }
- {
- The~key~'#1'~should~be~given~without~a~value.\\
- LaTeX~will~ignore~the~given~value~'#2'.
- }
-\msg_kernel_new:nnnn { keys } { value-required }
- { The~key~'#1'~requires~a~value. }
- {
- The~key~'#1'~must~have~a~value.\\
- No~value~was~present:~the~key~will~be~ignored.
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%\end{implementation}
diff --git a/Master/texmf-dist/source/latex/expl3/l3keyval.dtx b/Master/texmf-dist/source/latex/expl3/l3keyval.dtx
deleted file mode 100644
index e9bd88f9852..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3keyval.dtx
+++ /dev/null
@@ -1,831 +0,0 @@
-% \iffalse
-%% File: l3keyval.dtx Copyright (C) 2006-2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3keyval.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental keyval processing}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3keyval.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3keyval} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Key-value parsing}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% A key--value list is input of the form
-%\begin{verbatim}
-% KeyOne = ValueOne ,
-% KeyTwo = ValueTwo ,
-% KeyThree ,
-%\end{verbatim}
-% where each key--value pair is separated by a comma from the rest of
-% the list, and each key--value pair does not necessarily contain an
-% equals sign or a value! Processing this type of input correctly
-% requires a number of careful steps, to correctly account for
-% braces, spaces and the category codes of separators.
-%
-% This module provides the low-level machinery for processing arbitrary
-% key--value lists. The \pkg{l3keys} module provides a higher-level
-% interface for managing run-time settings using key--value input,
-% while other parts of \LaTeX3 also use key--value input based on
-% \pkg{l3keyval} (for example the \pkg{xtemplate} module).
-%
-%\section{Features of \pkg{l3keyval}}
-%
-% As \pkg{l3keyval} is a low-level module, its functions are
-% restricted to converting a \meta{keyval list} into keys and values
-% for further processing. Each key and value (or key alone)
-% has to be processed further by a function provided when
-% \pkg{l3keyval} is called. Typically, this will be \emph{via}
-% one of the \cs{KV_process\ldots} functions:
-%\begin{verbatim}
-% \KV_process_space_removal_sanitize:NNn
-% \my_processor_function_one:n
-% \my_processor_function_two:nn
-% { <keyval list> }
-%\end{verbatim}
-% The two processor functions here handle the cases where there is
-% only a key, and where there is both a key and value, respectively.
-%
-% \pkg{l3keyval} parses key--value lists in a manner that does not
-% double "#" tokens or expand any input. The module has processor
-% functions which will sanitize the category codes of \texttt{=}
-% and \texttt{,} tokens (for use in the document body) as well
-% as faster versions which do not do this (for use inside code
-% blocks). Spaces can be removed from each end of the key and
-% value (again for the document body), again with faster code
-% to be used where this is not necessary. Values which are wrapped
-% in braces will have exactly one set removed, meaning that
-%\begin{verbatim}
-% key = {value here},
-%\end{verbatim}
-% and
-%\begin{verbatim}
-% key = value here,
-%\end{verbatim}
-% are treated as identical (assuming that space removal is in force).
-% \pkg{l3keyval}
-%
-%\section{Functions for keyval processing}
-%
-% The \pkg{l3keyval} module should be accessed \emph{via} a small
-% set of external functions. These correctly set up the module
-% internals for use by other parts of \LaTeX3.
-%
-% In all cases, two functions have to be supplied by the programmer
-% to apply to the items from the <keyval list> after \pkg{l3keyval}
-% has separated out the entries. The first function should take
-% one argument, and will receive the names of keys for which no
-% value was supplied. The second function should take two arguments:
-% a key name and the associated value.
-%
-%\begin{function}{\KV_process_space_removal_sanitize:NNn}
-% \begin{syntax}
-% "\KV_process_space_removal_sanitize:NNn"
-% ~~~~<function 1> <function 2> \Arg{keyval list}
-% \end{syntax}
-% Parses the <keyval list> splitting it into keys and associated
-% values. Spaces are removed from the ends of both the key and
-% value by this function, and the category codes of non-braced
-% \texttt{=} and \texttt{,} tokens are normalised so that
-% parsing is `category code safe'. After parsing is completed,
-% <function 1> is used to process keys without values and
-% <function 2> deals with keys which have associated values.
-%\end{function}
-%
-%\begin{function}{\KV_process_space_removal_no_sanitize:NNn}
-% \begin{syntax}
-% "\KV_process_space_removal_no_sanitize:NNn"
-% ~~~~<function 1> <function 2> \Arg{keyval list}
-% \end{syntax}
-% Parses the <keyval list> splitting it into keys and associated
-% values. Spaces are removed from the ends of both the key and
-% value by this function, but category codes are not normalised.
-% After parsing is completed, <function 1> is used to process keys
-% without values and <function 2> deals with keys which have
-% associated values.
-%\end{function}
-%
-%\begin{function}{\KV_process_no_space_removal_no_sanitize:NNn}
-% \begin{syntax}
-% "\KV_process_no_space_removal_no_sanitize:NNn"
-% ~~~~<function 1> <function 2> \Arg{keyval list}
-% \end{syntax}
-% Parses the <keyval list> splitting it into keys and associated
-% values. Spaces are \emph{not} removed from the ends of
-% the key and value, and category codes are \emph{not} normalised.
-% After parsing is completed, <function 1> is used to process keys
-% without values and <function 2> deals with keys which have
-% associated values.
-%\end{function}
-%
-% \begin{variable}{\l_KV_remove_one_level_of_braces_bool}
-% This boolean controls whether or not one level of braces is
-% stripped from the key and value. The default value for this
-% boolean is \texttt{true} so that exactly one level of braces is
-% stripped. For certain applications it is desirable to keep the
-% braces in which case the programmer just has to set the boolean
-% false temporarily. Only applicable when spaces are being
-% removed.
-% \end{variable}
-%
-%\section{Internal functions}
-%
-% The remaining functions provided by \pkg{l3keyval} do not
-% have any protection for nesting of one call to the module
-% inside another. They should therefore not be called directly by
-% other modules.
-%
-% \begin{function}{\KV_parse_no_space_removal_no_sanitize:n}
-% \begin{syntax}
-% "\KV_parse_no_space_removal_no_sanitize:n" \Arg{keyval list}
-% \end{syntax}
-% Parses the keys and values, passing the results to
-% \cs{KV_key_no_value_elt:n} and \cs{KV_key_value_elt:nn} as
-% appropriate. Spaces are not removed in the parsing process and
-% the category codes of \texttt{=} and \texttt{,} are not
-% normalised.
-% \end{function}
-%
-% \begin{function}{\KV_parse_space_removal_no_sanitize:n}
-% \begin{syntax}
-% "\KV_parse_space_removal_no_sanitize:n" \Arg{keyval list}
-% \end{syntax}
-% Parses the keys and values, passing the results to
-% \cs{KV_key_no_value_elt:n} and \cs{KV_key_value_elt:nn} as
-% appropriate. Spaces are removed in the parsing process from the
-% ends of the key and value, but the category codes of \texttt{=}
-% and \texttt{,} are not normalised.
-% \end{function}
-%
-% \begin{function}{\KV_parse_space_removal_sanitize:n}
-% \begin{syntax}
-% "\KV_parse_space_removal_sanitize:n" \Arg{keyval list}
-% \end{syntax}
-% Parses the keys and values, passing the results to
-% \cs{KV_key_no_value_elt:n} and \cs{KV_key_value_elt:nn} as
-% appropriate. Spaces are removed in the parsing process from the
-% ends of the key and value and the category codes of \texttt{=}
-% and \texttt{,} are normalised at the outer level
-% (\emph{i.e}.~only unbraced tokens are affected).
-% \end{function}
-%
-% \begin{function}{
-% \KV_key_no_value_elt:n |
-% \KV_key_value_elt:nn
-% }
-% \begin{syntax}
-% "\KV_key_no_value_elt:n" \Arg{key} \\
-% "\KV_key_value_elt:n" \Arg{key} \Arg{value}
-% \end{syntax}
-% Used by \cs{KV_parse\ldots} functions to further process
-% keys with no values and keys with values, respectively. The
-% standard definitions are error functions: the programmer should
-% provide appropriate definitions for both at point of use.
-% \end{function}
-%
-%\section{Variables and constants}
-%
-%\begin{variable}{\c_KV_single_equal_sign_tl}
-% Constant token list to make finding \texttt{=} faster.
-%\end{variable}
-%
-%\begin{variable}{
-% \l_KV_tmpa_tl |
-% \l_KV_tmpb_tl
-%}
-% Scratch token lists.
-%\end{variable}
-%
-%\begin{variable}{
-% \l_KV_parse_tl |
-% \l_KV_currkey_tl |
-% \l_KV_currval_tl
-%}
-% Token list variables for various parts of the parsed input.
-%\end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3keyval} implementation}
-%
-% \begin{function}{ \KV_sanitize_outerlevel_active_equals:N |
-% \KV_sanitize_outerlevel_active_commas:N }
-% \begin{syntax}
-% "\KV_sanitize_outerlevel_active_equals:N" <tl var.>
-% \end{syntax}
-% Replaces catcode other "=" and "," within a <tl var.> with active characters.
-% \end{function}
-%
-% \begin{function}{ \KV_remove_surrounding_spaces:nw |
-% \KV_remove_surrounding_spaces_auxi:w / (EXP) }
-% \begin{syntax}
-%
-% "\KV_remove_surrounding_spaces:nw" <tl> <token list> "\q_nil"
-% "\KV_remove_surrounding_spaces_auxi:w" <token list> \verb*" Q"$\sb3$
-% \end{syntax}
-% Removes a possible
-% leading space plus a possible ending space from a <token list>.
-% The first version (which is not used in the code) stores it in <tl>.
-% \end{function}
-%
-% \begin{function}{ \KV_add_value_element:w | \KV_set_key_element:w }
-% \begin{syntax}
-% "\KV_set_key_element:w" <token list> "\q_nil"
-% "\KV_add_value_element:w" "\q_stop" <token list> "\q_nil"
-% \end{syntax}
-% Specialised functions to strip spaces from their input and set the
-% token registers "\l_KV_currkey_tl" or "\l_KV_currval_tl"
-% respectively.
-% \end{function}
-%
-% \begin{function}{ \KV_split_key_value_current:w |
-% \KV_split_key_value_space_removal:w |
-% \KV_split_key_value_space_removal_detect_error:wTF |
-% \KV_split_key_value_no_space_removal:w }
-% \begin{syntax}
-% "\KV_split_key_value_current:w" \dots
-% \end{syntax}
-% These functions split keyval lists into chunks depending which
-% sanitising method is being used. "\KV_split_key_value_current:w" is "\cs_set_eq:NN"
-% to whichever is appropriate.
-% \end{function}
-%
-% \subsection{Module code}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%
-% \begin{macro}{\l_KV_tmpa_tl}
-% \begin{macro}{\l_KV_tmpb_tl}
-% \begin{macro}{\c_KV_single_equal_sign_tl}
-% Various useful things.
-% \begin{macrocode}
-\tl_new:N \l_KV_tmpa_tl
-\tl_new:N \l_KV_tmpb_tl
-\tl_const:Nn \c_KV_single_equal_sign_tl { = }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\l_KV_parse_tl}
-% \begin{macro}{\l_KV_currkey_tl}
-% \begin{macro}{\l_KV_currval_tl}
-% Some more useful things.
-% \begin{macrocode}
-\tl_new:N \l_KV_parse_tl
-\tl_new:N \l_KV_currkey_tl
-\tl_new:N \l_KV_currval_tl
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}{\l_KV_level_int}
-% This is used to track how deeply nested calls to the keyval processor
-% are, so that the correct functions are always in use.
-% \begin{macrocode}
-\int_new:N \l_KV_level_int
-% \end{macrocode}
-%\end{macro}
-%
-% \begin{macro}{\l_KV_remove_one_level_of_braces_bool}
-% A boolean to control
-% \begin{macrocode}
-\bool_new:N \l_KV_remove_one_level_of_braces_bool
-\bool_set_true:N \l_KV_remove_one_level_of_braces_bool
-% \end{macrocode}
-% \end{macro}
-%
-%\begin{macro}{\KV_process_space_removal_sanitize:NNn}
-%\begin{macro}{\KV_process_space_removal_no_sanitize:NNn}
-%\begin{macro}{\KV_process_no_space_removal_no_sanitize:NNn}
-%\begin{macro}[aux]{\KV_process_aux:NNNn}
-% The wrapper function takes care of assigning the appropriate
-% \texttt{elt} functions before and after the parsing step. In that
-% way there is no danger of a mistake with the wrong functions being
-% used.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \KV_process_space_removal_sanitize:NNn {
- \KV_process_aux:NNNn \KV_parse_space_removal_sanitize:n
-}
-\cs_new_protected_nopar:Npn \KV_process_space_removal_no_sanitize:NNn {
- \KV_process_aux:NNNn \KV_parse_space_removal_no_sanitize:n
-}
-\cs_new_protected_nopar:Npn \KV_process_no_space_removal_no_sanitize:NNn {
- \KV_process_aux:NNNn \KV_parse_no_space_removal_no_sanitize:n
-}
-\cs_new_protected:Npn \KV_process_aux:NNNn #1#2#3#4 {
- \cs_set_eq:cN
- { KV_key_no_value_elt_ \int_use:N \l_KV_level_int :n }
- \KV_key_no_value_elt:n
- \cs_set_eq:cN
- { KV_key_value_elt_ \int_use:N \l_KV_level_int :nn }
- \KV_key_value_elt:nn
- \cs_set_eq:NN \KV_key_no_value_elt:n #2
- \cs_set_eq:NN \KV_key_value_elt:nn #3
- \int_incr:N \l_KV_level_int
- #1 {#4}
- \int_decr:N \l_KV_level_int
- \cs_set_eq:Nc \KV_key_no_value_elt:n
- { KV_key_no_value_elt_ \int_use:N \l_KV_level_int :n }
- \cs_set_eq:Nc \KV_key_value_elt:nn
- { KV_key_value_elt_ \int_use:N \l_KV_level_int :nn }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macro}{\KV_sanitize_outerlevel_active_equals:N}
-% \begin{macro}{\KV_sanitize_outerlevel_active_commas:N}
-% Some functions for sanitizing top level equals and commas. Replace
-% |=|$\sb{13}$ and |,|$\sb{13}$ with |=|$\sb{12}$ and |,|$\sb{12}$
-% resp.
-% \begin{macrocode}
-\group_begin:
-\char_set_catcode:nn{`\=}{13}
-\char_set_catcode:nn{`\,}{13}
-\char_set_lccode:nn{`\8}{`\=}
-\char_set_lccode:nn{`\9}{`\,}
-\tl_to_lowercase:n{\group_end:
-\cs_new_protected_nopar:Npn \KV_sanitize_outerlevel_active_equals:N #1{
- \tl_replace_all_in:Nnn #1 = 8
-}
-\cs_new_nopar:Npn \KV_sanitize_outerlevel_active_commas:N #1{
- \tl_replace_all_in:Nnn #1 , 9
-}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-%
-% \begin{macro}{\KV_remove_surrounding_spaces:nw}
-% \begin{macro}{\KV_remove_surrounding_spaces_auxi:w}
-% \begin{macro}[aux]{\KV_remove_surrounding_spaces_auxii:w}
-% \begin{macro}{\KV_set_key_element:w}
-% \begin{macro}{\KV_add_value_element:w}
-% The macro |\KV_remove_surrounding_spaces:nw| removes a possible
-% leading space plus a possible ending space from its second
-% argument and stores it in the token register |#1|.
-%
-% Based on Around the Bend No.~15 but with some enhancements. For
-% instance, this definition is purely expandable.
-%
-% We use a funny token |Q|$\sb3$ as a delimiter.
-% \begin{macrocode}
-\group_begin:
-\char_set_catcode:nn{`\Q}{3}
-% \end{macrocode}
-% \begin{macrocode}
-\cs_new:Npn\KV_remove_surrounding_spaces:nw#1#2\q_nil{
-% \end{macrocode}
-% The idea in this processing is to use a Q with strange catcode to
-% remove a trailing space. But first, how to get this expansion going?
-%
-% If you have read the fine print in the \textsf{l3expan} module,
-% you'll know that the |f| type expansion will expand until the first
-% non-expandable token is seen and if this token is a space, it will
-% be gobbled. Sounds useful for removing a leading space but we also
-% need to make sure that it does nothing but removing that space!
-% Therefore we prepend the argument to be trimmed with an
-% |\exp_not:N|. Now why is that? |\exp_not:N| in itself is an
-% expandable command so will allow the |f| expansion to continue. If
-% the first token in the argument to be trimmed is a space, it will be
-% gobbled and the expansion stop. If the first token isn't a space,
-% the |\exp_not:N| turns it temporarily into |\scan_stop:| which is
-% unexpandable. The processing stops but the token following directly
-% after |\exp_not:N| is now back to normal.
-%
-% The function here allows you to insert arbitrary functions in the
-% first argument but they should all be with an |f| type
-% expansion. For the application in this module, we use
-% |\tl_set:Nf|.
-%
-% Once the expansion has been kick-started, we apply
-% |\KV_remove_surrounding_spaces_auxi:w| to the replacement text of
-% |#2|, adding a leading |\exp_not:N|. Note that no braces are
-% stripped off of the original argument.
-% \begin{macrocode}
- #1{\KV_remove_surrounding_spaces_auxi:w \exp_not:N#2Q~Q}
-}
-% \end{macrocode}
-% |\KV_remove_surrounding_spaces_auxi:w| removes a trailing space if
-% present, then calls |\KV_remove_surrounding_spaces_auxii:w| to clean
-% up any leftover bizarre Qs. In order for
-% |\KV_remove_surrounding_spaces_auxii:w| to work properly we need to
-% put back a Q first.
-% \begin{macrocode}
-\cs_new:Npn\KV_remove_surrounding_spaces_auxi:w#1~Q{
- \KV_remove_surrounding_spaces_auxii:w #1 Q
-}
-% \end{macrocode}
-% Now all that is left to do is remove a leading space which should be
-% taken care of by the function used to initiate the expansion. Simply
-% return the argument before the funny Q.
-% \begin{macrocode}
-\cs_new:Npn\KV_remove_surrounding_spaces_auxii:w#1Q#2{#1}
-% \end{macrocode}
-%
-% Here are some specialized versions of the above. They do exactly
-% what we want in one go. First trim spaces from the value and then
-% put the result surrounded in braces onto |\l_KV_parse_tl|.
-% \begin{macrocode}
-\cs_new_protected:Npn\KV_add_value_element:w\q_stop#1\q_nil{
- \tl_set:Nf\l_KV_currval_tl {
- \KV_remove_surrounding_spaces_auxi:w \exp_not:N#1Q~Q
- }
- \tl_put_right:No\l_KV_parse_tl{
- \exp_after:wN { \l_KV_currval_tl }
- }
-}
-% \end{macrocode}
-% When storing the key we firstly remove spaces plus the prepended
-% |\q_no_value|.
-% \begin{macrocode}
-\cs_new_protected:Npn\KV_set_key_element:w#1\q_nil{
- \tl_set:Nf\l_KV_currkey_tl
- {
- \exp_last_unbraced:NNo \KV_remove_surrounding_spaces_auxi:w
- \exp_not:N \use_none:n #1Q~Q
- }
-% \end{macrocode}
-% Afterwards we gobble an extra level of braces if that's what we are
-% asked to do.
-% \begin{macrocode}
- \bool_if:NT \l_KV_remove_one_level_of_braces_bool
- {
- \exp_args:NNo \tl_set:No \l_KV_currkey_tl {
- \exp_after:wN \KV_add_element_aux:w \l_KV_currkey_tl \q_nil
- }
- }
-}
-\group_end:
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\KV_add_element_aux:w}
-% A helper function for fixing braces around keys and values.
-% \begin{macrocode}
-\cs_new:Npn \KV_add_element_aux:w#1\q_nil{#1}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% Parse a list of keyvals, put them into list form with entries like
-% |\KV_key_no_value_elt:n{key1}| and |\KV_key_value_elt:nn{key2}{val2}|.
-%
-% \begin{macro}[aux]{\KV_parse_sanitize_aux:n}
-% The slow parsing algorithm sanitizes active commas and equal signs
-% at the top level first. Then uses |#1| as inspector of each
-% element in the comma list.
-% \begin{macrocode}
-\cs_new_protected:Npn \KV_parse_sanitize_aux:n #1 {
- \group_begin:
- \tl_clear:N \l_KV_parse_tl
- \tl_set:Nn \l_KV_tmpa_tl {#1}
- \KV_sanitize_outerlevel_active_equals:N \l_KV_tmpa_tl
- \KV_sanitize_outerlevel_active_commas:N \l_KV_tmpa_tl
- \exp_last_unbraced:NNV \KV_parse_elt:w \q_no_value
- \l_KV_tmpa_tl , \q_nil ,
-% \end{macrocode}
-% We evaluate the parsed keys and values outside the group so the
-% token register is restored to its previous value.
-% \begin{macrocode}
- \exp_after:wN \group_end:
- \l_KV_parse_tl
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}[aux]{\KV_parse_no_sanitize_aux:n}
-% Like above but we don't waste time sanitizing. This is probably
-% the one we will use for preamble parsing where catcodes of |=| and
-% |,| are as expected!
-% \begin{macrocode}
-\cs_new_protected:Npn \KV_parse_no_sanitize_aux:n #1{
- \group_begin:
- \tl_clear:N \l_KV_parse_tl
- \KV_parse_elt:w \q_no_value #1 , \q_nil ,
- \exp_after:wN \group_end:
- \l_KV_parse_tl
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}[aux]{\KV_parse_elt:w}
-% This function will always have a |\q_no_value| stuffed in as the
-% rightmost token in |#1|. In case there was a blank entry in the
-% comma separated list we just run it again. The |\use_none:n| makes
-% sure to gobble the quark |\q_no_value|. A similar test is made to
-% check if we hit the end of the recursion.
-% \begin{macrocode}
-\cs_set:Npn \KV_parse_elt:w #1,{
- \tl_if_blank:oTF{\use_none:n #1}
- { \KV_parse_elt:w \q_no_value }
- {
- \quark_if_nil:oF {\use_ii:nn #1 }
-% \end{macrocode}
-% If we made it to here we can start parsing the key and value. When
-% done try, try again.
-% \begin{macrocode}
- {
- \KV_split_key_value_current:w #1==\q_nil
- \KV_parse_elt:w \q_no_value
- }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\KV_split_key_value_current:w}
-% The function called to split the keys and values.
-% \begin{macrocode}
-\cs_new:Npn \KV_split_key_value_current:w {\ERROR}
-% \end{macrocode}
-% \end{macro}
-%
-% We provide two functions for splitting keys and values. The reason
-% being that most of the time, we should probably be in the special
-% coding regime where spaces are ignored. Hence it makes no sense to
-% spend time searching for extra space tokens and we can do the
-% settings directly. When comparing these two versions (neither doing
-% any sanitizing) the |no_space_removal| version is more than 40\%
-% faster than |space_removal|.
-%
-% It is up to functions like |\DeclareTemplate| to check which catcode
-% regime is active and then pick up the version best suited for it.
-%
-%
-%
-% \begin{macro}{\KV_split_key_value_space_removal:w}
-% \begin{macro}{\KV_split_key_value_space_removal_detect_error:wTF}
-% \begin{macro}[aux]{\KV_split_key_value_space_removal_aux:w}
-% The code below removes extraneous spaces around the keys and
-% values plus one set of braces around the entire value.
-%
-% Unlike the version to be used when spaces are ignored, this one
-% only grabs the key which is everything up to the first = and save
-% the rest for closer inspection. Reason is that if a user has
-% entered |mykey={{myval}},| then the outer braces have already been
-% removed before we even look at what might come after the key. So
-% this is slightly more tedious (but only slightly) but at least it
-% always removes only one level of braces.
-% \begin{macrocode}
-\cs_new_protected:Npn \KV_split_key_value_space_removal:w #1 = #2\q_nil{
-% \end{macrocode}
-% First grab the key.
-% \begin{macrocode}
- \KV_set_key_element:w#1\q_nil
-% \end{macrocode}
-% Then we start checking. If only a key was entered, |#2| contains
-% |=| and nothing else, so we test for that first.
-% \begin{macrocode}
- \tl_set:Nn\l_KV_tmpa_tl{#2}
- \tl_if_eq:NNTF\l_KV_tmpa_tl\c_KV_single_equal_sign_tl
-% \end{macrocode}
-% Then we just insert the default key.
-% \begin{macrocode}
- {
- \tl_put_right:No\l_KV_parse_tl{
- \exp_after:wN \KV_key_no_value_elt:n
- \exp_after:wN {\l_KV_currkey_tl}
- }
- }
-% \end{macrocode}
-% Otherwise we must take a closer look at what is left. The remainder
-% of the original list up to the comma is now stored in |#2| plus an
-% additional |==|, which wasn't gobbled during the initial reading of
-% arguments. If there is an error then we can see at least one more
-% |=| so we call an auxiliary function to check for this.
-% \begin{macrocode}
- {
- \KV_split_key_value_space_removal_detect_error:wTF#2\q_no_value\q_nil
- {\KV_split_key_value_space_removal_aux:w \q_stop #2}
- { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } }
- }
-}
-% \end{macrocode}
-% The error test.
-% \begin{macrocode}
-\cs_new_protected:Npn
- \KV_split_key_value_space_removal_detect_error:wTF#1=#2#3\q_nil{
- \tl_if_head_eq_meaning:nNTF{#3}\q_no_value
-}
-% \end{macrocode}
-% Now we can start extracting the value. Recall that |#1| here starts
-% with |\q_stop| so all braces are still there! First we try to see
-% how much is left if we gobble three brace groups from |#1|. If |#1|
-% is empty or blank, all three quarks are gobbled. If |#1| consists of
-% exactly one token or brace group, only the latter quark is left.
-% \begin{macrocode}
-\cs_new:Npn \KV_val_preserve_braces:NnN #1#2#3{{#2}}
-\cs_new_protected:Npn\KV_split_key_value_space_removal_aux:w #1=={
- \tl_set:Nx\l_KV_tmpa_tl{\exp_not:o{\use_none:nnn#1\q_nil\q_nil}}
- \tl_put_right:No\l_KV_parse_tl{
- \exp_after:wN \KV_key_value_elt:nn
- \exp_after:wN {\l_KV_currkey_tl}
- }
-% \end{macrocode}
-% If there a blank space or nothing at all, |\l_KV_tmpa_tl| is now
-% completely empty.
-% \begin{macrocode}
- \tl_if_empty:NTF\l_KV_tmpa_tl
-% \end{macrocode}
-% We just put an empty value on the stack.
-% \begin{macrocode}
- { \tl_put_right:Nn\l_KV_parse_tl{{}} }
- {
-% \end{macrocode}
-% If there was exactly one brace group or token in |#1|,
-% |\l_KV_tmpa_tl| is now equal to |\q_nil|. Then we can just pick it
-% up as the second argument of |#1|. This will also take care of any
-% spaces which might surround it.
-% \begin{macrocode}
- \quark_if_nil:NTF\l_KV_tmpa_tl
- {
- \bool_if:NTF \l_KV_remove_one_level_of_braces_bool
- {
- \tl_put_right:No\l_KV_parse_tl{
- \exp_after:wN{\use_ii:nnn #1\q_nil}
- }
- }
- {
- \tl_put_right:No\l_KV_parse_tl{
- \exp_after:wN{\KV_val_preserve_braces:NnN #1\q_nil}
- }
- }
- }
-% \end{macrocode}
-% Otherwise we grab the value.
-% \begin{macrocode}
- { \KV_add_value_element:w #1\q_nil }
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\KV_split_key_value_no_space_removal:w}
-% This version is for when in the special coding regime where spaces
-% are ignored so there is no need to do any fancy space hacks,
-% however fun they may be. Since there are no spaces, a set of
-% braces around a value is automatically stripped by \TeX.
-% \begin{macrocode}
-\cs_new_protected:Npn \KV_split_key_value_no_space_removal:w #1#2=#3=#4\q_nil{
- \tl_set:Nn\l_KV_tmpa_tl{#4}
- \tl_if_empty:NTF \l_KV_tmpa_tl
- {
- \tl_put_right:Nn\l_KV_parse_tl{\KV_key_no_value_elt:n{#2}}
- }
- {
- \tl_if_eq:NNTF\c_KV_single_equal_sign_tl\l_KV_tmpa_tl
- {
- \tl_put_right:Nn\l_KV_parse_tl{\KV_key_value_elt:nn{#2}{#3}}
- }
- { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\KV_key_no_value_elt:n}
-% \begin{macro}{\KV_key_value_elt:nn}
-% \begin{macrocode}
-\cs_new:Npn \KV_key_no_value_elt:n #1{\ERROR}
-\cs_new:Npn \KV_key_value_elt:nn #1#2{\ERROR}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\KV_parse_no_space_removal_no_sanitize:n}
-% Finally we can put all the things
-% together. |\KV_parse_no_space_removal_no_sanitize:n| is the
-% version that disallows unmatched conditional and does no space
-% removal.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \KV_parse_no_space_removal_no_sanitize:n {
- \cs_set_eq:NN \KV_split_key_value_current:w \KV_split_key_value_no_space_removal:w
- \KV_parse_no_sanitize_aux:n
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\KV_parse_space_removal_sanitize:n}
-% \begin{macro}{\KV_parse_space_removal_no_sanitize:n}
-% The other varieties can be defined in a similar manner. For the
-% version needed at the document level, we can use this one.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \KV_parse_space_removal_sanitize:n {
- \cs_set_eq:NN \KV_split_key_value_current:w \KV_split_key_value_space_removal:w
- \KV_parse_sanitize_aux:n
-}
-% \end{macrocode}
-% For preamble use by the non-programmer this is probably best.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \KV_parse_space_removal_no_sanitize:n {
- \cs_set_eq:NN \KV_split_key_value_current:w \KV_split_key_value_space_removal:w
- \KV_parse_no_sanitize_aux:n
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macrocode}
-\msg_kernel_new:nnnn { keyval } { misplaced-equals-sign }
- {Misplaced~equals~sign~in~key--value~input~\msg_line_context:}
- {
- I~am~trying~to~read~some~key--value~input~but~found~two~equals~
- signs\\%
- without~a~comma~between~them.
- }
-% \end{macrocode}
-%
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3luatex.dtx b/Master/texmf-dist/source/latex/expl3/l3luatex.dtx
deleted file mode 100644
index cabdde3192c..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3luatex.dtx
+++ /dev/null
@@ -1,463 +0,0 @@
-% \iffalse
-%% File: l3luatex.dtx Copyright (C) 2010,2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3luatex.dtx 1985 2010-07-18 09:05:56Z joseph $
- {L3 Experimental LuaTeX functions}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{l3luatex.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3luatex} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% \LuaTeX-specific functions}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-%\begin{documentation}
-%
-%\section{Breaking out to \Lua}
-%
-% The \LuaTeX\ engine provides access to the \Lua\ programming language,
-% and with it access to the '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{engine_if_luatex:T} to avoid this. Details of coding
-% the \LuaTeX\ engine are detailed in the \LuaTeX\ manual.
-%
-%\begin{function}{
-% \lua_now:n / (EXP) |
-% \lua_now:x / (EXP) |
-%}
-% \begin{syntax}
-% \cs{lua_now:n} \Arg{token list}
-% \end{syntax}
-% The \meta{token list} is first tokenized by \TeX, which will include
-% converting line ends to spaces in the usual \TeX\ manner and which
-% respects currently-applicable \TeX\ category codes. The resulting
-% \meta{\Lua\ input} is passed to the \Lua\ interpreter for processing.
-% Each \cs{lua_now:n} block is treated by \Lua\ as a separate chunk.
-% The \Lua\ interpreter will execute the \meta{\Lua\ input} immediately,
-% and in an expandable manner.
-% \begin{texnote}
-% \cs{lua_now:x} is the \LuaTeX\ primitive \cs{directlua} renamed.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \lua_shipout:n |
-% \lua_shipout:x |
-%}
-% \begin{syntax}
-% \cs{lua_shipout:x} \Arg{token list}
-% \end{syntax}
-% The \meta{token list} is first tokenized by \TeX, which will include
-% converting line ends to spaces in the usual \TeX\ manner and which
-% respects currently-applicable \TeX\ category codes. The resulting
-% \meta{\Lua\ input} is passed to the \Lua\ interpreter when the
-% current page is finalised (\emph{i.e}.~at shipout). Each
-% \cs{lua_shipout:n} block is treated by Lua as a separate chunk.
-% The \Lua\ interpreter will execute the \meta{\Lua\ input} during the
-% page-building routine: no \TeX\ expansion of the \meta{\Lua\ input}
-% will occur at this stage.
-% \begin{texnote}
-% At a \TeX\ level, the \meta{\Lua\ input} is stored as a
-% `whatsit'.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \lua_shipout_x:n |
-% \lua_shipout_x:x |
-%}
-% \begin{syntax}
-% \cs{lua_shipout:n} \Arg{token list}
-% \end{syntax}
-% The \meta{token list} is first tokenized by \TeX, which will include
-% converting line ends to spaces in the usual \TeX\ manner and which
-% respects currently-applicable \TeX\ category codes. The resulting
-% \meta{\Lua\ input} is passed to the \Lua\ interpreter when the
-% current page is finalised (\emph{i.e}.~at shipout). Each
-% \cs{lua_shipout:n} block is treated by Lua as a separate chunk.
-% The \Lua\ interpreter will execute the \meta{\Lua\ input} during the
-% page-building routine: the \meta{\Lua\ input} is expanded during this
-% process in addition to any expansion when the argument was read. This
-% makes these functions suitable for including material finalised
-% during the page building process (such as the page number).
-% \begin{texnote}
-% \cs{lua_sjhipout_x:n} is the \LuaTeX\ primitive \cs{latelua}
-% named using the \LaTeX3 scheme.
-%
-% At a \TeX\ level, the \meta{\Lua\ input} is stored as a
-% `whatsit'.
-% \end{texnote}
-%\end{function}
-%
-%\section{Category code tables}
-%
-% As well as providing methods to break out into \Lua, there are
-% places where additional \LaTeX3 functions are provided by the
-% \LuaTeX\ engine. In particular, \LuaTeX\ provides category code
-% tables. These can be used to ensure that a set of category codes
-% are in force in a more robust way than is possible with other
-% engines. These are therefore used by \cs{ExplSyntaxOn} and
-% \pkg{ExplSyntaxOff} when using the \LuaTeX\ engine.
-%
-%\begin{function}{ \cctab_new:N }
-% \begin{syntax}
-% \cs{cctab_new:N} \meta{category code table}
-% \end{syntax}
-% Creates a new category code table, initially with the codes as
-% used by \IniTeX.
-%\end{function}
-%
-%\begin{function}{ \cctab_gset:Nn }
-% \begin{syntax}
-% \cs{cctab_gset:Nn} \meta{category code table}
-% \Arg{category code set up}
-% \end{syntax}
-% Sets the \meta{category code table} to apply the category codes
-% which apply when the prevailing regime is modified by the
-% \meta{category code set up}. Thus within a standard code block
-% the starting point will be the code applied by \cs{c_code_cctab}.
-% The assignment of the table is global: the underlying primitive does
-% not respect grouping.
-%\end{function}
-%
-%\begin{function}{ \cctab_begin:N }
-% \begin{syntax}
-% \cs{cctab_begin:N} \meta{category code table}
-% \end{syntax}
-% Switches the category codes in force to those stored in the
-% \meta{category code table}. The prevailing codes before the
-% function is called are added to a stack, for use with
-% \cs{cctab_end:}.
-%\end{function}
-%
-%\begin{function}{ \cctab_end: }
-% \begin{syntax}
-% \cs{cctab_end:}
-% \end{syntax}
-% Ends the scope of a \meta{category code table} started using
-% \cs{cctab_begin:N}, retuning the codes to those in force before the
-% matching \cs{cctab_begin:N} was used.
-%\end{function}
-%
-%\begin{variable}{ \c_code_cctab }
-% Category code table for the code environment. This does not include
-% setting the behaviour of the line-end character, which is only
-% altered by \cs{ExplSyntaxOn}.
-%\end{variable}
-%
-%\begin{variable}{ \c_document_cctab }
-% Category code table for a standard \LaTeX\ document. This does not
-% include setting the behaviour of the line-end character, which is
-% only altered by \cs{ExplSyntaxOff}.
-%\end{variable}
-%
-%\begin{variable}{ \c_initex_cctab }
-% Category code table as set up by \IniTeX.
-%\end{variable}
-%
-%\begin{variable}{ \c_other_cctab }
-% Category code table where all characters have category code \( 12 \)
-% (other).
-%\end{variable}
-%
-%\begin{variable}{ \c_string_cctab }
-% Category code table where all characters have category code \( 12 \)
-% (other) with the exception of spaces, which have category code
-% \( 10 \) (space).
-%\end{variable}
-%
-%\end{documentation}
-%
-%\begin{implementation}
-%
-%\section{Implementation}
-%
-% Announce and ensure that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-%\begin{macro}{\lua_now:n}
-%\begin{macro}{\lua_now:x}
-%\begin{macro}{\lua_shipout_x:n}
-%\begin{macro}{\lua_shipout_x:x}
-%\begin{macro}{\lua_shipout:n}
-%\begin{macro}{\lua_shipout:x}
-%\begin{macro}{\lua_wrong_engine:}
-% When \LuaTeX\ is in use, this is all a question of primitives with new
-% names. On the other hand, for \pdfTeX\ and \XeTeX\ the argument should
-% be removed from the input stream before issuing an error. This needs
-% to be expandable, so the same idea is used as for \texttt{V}-type
-% expansion, with an appropriately-named but undefined function.
-% \begin{macrocode}
-\luatex_if_engine:TF
- {
- \cs_new_eq:NN \lua_now:x \luatex_directlua:D
- \cs_new_eq:NN \lua_shipout_x:n \luatex_latelua:D
- }
- {
- \cs_new:Npn \lua_now:x #1 { \lua_wrong_engine: }
- \cs_new_protected:Npn \lua_shipout_x:n #1 { \lua_wrong_engine: }
- }
-\cs_new:Npn \lua_now:n #1 {
- \lua_now:x { \exp_not:n {#1} }
-}
-\cs_generate_variant:Nn \lua_shipout_x:n { x }
-\cs_new_protected:Npn \lua_shipout:n #1 {
- \lua_shipout_x:n { \exp_not:n {#1} }
-}
-\cs_generate_variant:Nn \lua_shipout:n { x }
-\group_begin:
-\char_make_letter:N\!
-\char_make_letter:N\ %
-\cs_gset:Npn\lua_wrong_engine:{%
-\LuaTeX engine not in use!%
-}%
-\group_end:%
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Category code tables}
-%
-%\begin{macro}{\g_cctab_allocate_int}
-%\begin{macro}{\g_cctab_stack_int}
-%\begin{macro}{\g_cctab_stack_seq}
-% To allocate category code tables, both the read-only and stack
-% tables need to be followed. There is also a sequence stack for the
-% dynamic tables themselves.
-% \begin{macrocode}
-\int_new:N \g_cctab_allocate_int
-\int_set:Nn \g_cctab_allocate_int { -1 }
-\int_new:N \g_cctab_stack_int
-\seq_new:N \g_cctab_stack_seq
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\cctab_new:N}
-% Creating a new category code table is done slightly differently
-% from other registers. Low-numbered tables are more efficiently-stored
-% than high-numbered ones. There is also a need to have a stack of
-% flexible tables as well as the set of read-only ones. To satisfy both
-% of these requirements, odd numbered tables are used for read-only
-% tables, and even ones for the stack. Here, therefore, the odd numbers
-% are allocated.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \cctab_new:N #1 {
- \cs_if_free:NTF #1
- {
- \int_gadd:Nn \g_cctab_allocate_int { 2 }
- \int_compare:nNnTF
- { \g_cctab_allocate_int } < { \c_allocate_max_tl + 1 }
- {
- \tex_global:D \tex_mathchardef:D #1 \g_cctab_allocate_int
- \luatex_initcatcodetable:D #1
- }
- {
- \msg_kernel_error:nnx { code } { out-of-registers } { cctab }
- }
- }
- {
- \msg_kernel_error:nnx { code } { variable-already-defined }
- { \token_to_str:N #1 }
- }
-}
-\luatex_if_engine:F {
- \cs_set_protected_nopar:Npn \cctab_new:N #1 { \lua_wrong_engine: }
-}
-%<*package>
-\luatex_if_engine:T {
- \cs_set_protected_nopar:Npn \cctab_new:N #1
- {
- \newcatcodetable #1
- \luatex_initcatcodetable:D #1
- }
-}
-%</package>
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\cctab_begin:N}
-%\begin{macro}{\cctab_end:}
-%\begin{macro}{\l_cctab_tmp_tl}
-% The aim here is to ensure that the saved tables are read-only. This is
-% done by using a stack of tables which are not read only, and actually
-% having them as 'in use' copies.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \cctab_begin:N #1 {
- \seq_gpush:Nx \g_cctab_stack_seq { \tex_the:D \luatex_catcodetable:D }
- \luatex_catcodetable:D #1
- \int_gadd:Nn \g_cctab_stack_int { 2 }
- \int_compare:nNnT { \g_cctab_stack_int } > { 268435453 }
- { \msg_kernel_error:nn { code } { cctab-stack-full } }
- \luatex_savecatcodetable:D \g_cctab_stack_int
- \luatex_catcodetable:D \g_cctab_stack_int
-}
-\cs_new_protected_nopar:Npn \cctab_end: {
- \int_gsub:Nn \g_cctab_stack_int { 2 }
- \seq_gpop:NN \g_cctab_stack_seq \l_cctab_tmp_tl
- \quark_if_no_value:NT \l_cctab_tmp_tl
- { \tl_set:Nn \l_cctab_tmp_tl { 0 } }
- \luatex_catcodetable:D \l_cctab_tmp_tl \scan_stop:
-}
-\luatex_if_engine:F {
- \cs_set_protected_nopar:Npn \cctab_begin:N #1 { \lua_wrong_engine: }
- \cs_set_protected_nopar:Npn \cctab_end: { \lua_wrong_engine: }
-}
-%<*package>
-\luatex_if_engine:T {
- \cs_set_protected_nopar:Npn \cctab_begin:N #1
- { \BeginCatcodeRegime #1 }
- \cs_set_protected_nopar:Npn \cctab_end:
- { \EndCatcodeRegime }
-}
-%</package>
-\tl_new:N \l_cctab_tmp_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\cctab_gset:Nn}
-% Category code tables are always global, so only one version is needed.
-% The set up here is simple, and means that at the point of use there is
-% no need to worry about escaping category codes.
-% \begin{macrocode}
-\cs_new_protected:Npn \cctab_gset:Nn #1#2 {
- \group_begin:
- #2
- \luatex_savecatcodetable:D #1
- \group_end:
-}
-\luatex_if_engine:F {
- \cs_set_protected_nopar:Npn \cctab_gset:Nn #1#2 { \lua_wrong_engine: }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_code_cctab}
-%\begin{macro}{\c_document_cctab}
-%\begin{macro}{\c_initex_cctab}
-%\begin{macro}{\c_other_cctab}
-%\begin{macro}{\c_string_cctab}
-% Creating category code tables is easy using the function above.
-% The \texttt{other} and \texttt{string} ones are done by completely
-% ignoring the existing codes as this makes life a lot less complex. The
-% table for \pkg{expl3} category codes is always needed, whereas when in
-% package mode the rest can be copied from the existing \LaTeXe\ package
-% \pkg{luatex}.
-% \begin{macrocode}
-\luatex_if_engine:T {
- \cctab_new:N \c_code_cctab
- \cctab_gset:Nn \c_code_cctab { }
-}
-%<*package>
-\luatex_if_engine:T {
- \cs_new_eq:NN \c_document_cctab \CatcodeTableLaTeX
- \cs_new_eq:NN \c_initex_cctab \CatcodeTableIniTeX
- \cs_new_eq:NN \c_other_cctab \CatcodeTableOther
- \cs_new_eq:NN \c_string_cctab \CatcodeTableString
-}
-%</package>
-%<*!package>
-\luatex_if_engine:T {
- \cctab_new:N \c_document_cctab
- \cctab_new:N \c_other_cctab
- \cctab_new:N \c_string_cctab
- \cctab_gset:Nn \c_document_cctab
- {
- \char_make_space:n { 9 }
- \char_make_space:n { 32 }
- \char_make_other:n { 58 }
- \char_make_subscript:n { 95 }
- \char_make_active:n { 126 }
- }
- \cctab_gset:Nn \c_other_cctab
- {
- \prg_stepwise_inline:nnnn { 0 } { 1 } { 127 }
- { \char_make_other:n {#1} }
- }
- \cctab_gset:Nn \c_string_cctab
- {
- \prg_stepwise_inline:nnnn { 0 } { 1 } { 127 }
- { \char_make_other:n {#1} }
- \char_make_space:n { 32 }
- }
-}
-%</!package>
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%\end{implementation}
-%
-%\PrintChanges
-%
-%\PrintIndex \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/expl3/l3msg.dtx b/Master/texmf-dist/source/latex/expl3/l3msg.dtx
deleted file mode 100644
index 26c631177ee..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3msg.dtx
+++ /dev/null
@@ -1,1402 +0,0 @@
-% \iffalse
-%% File: l3msg.dtx Copyright (C) 2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3msg.dtx 2052 2010-10-02 16:04:38Z will $
- {L3 Experimental LaTeX Messages module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3msg.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3msg} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Communicating with the user}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% Messages need to be passed to the user by modules, either when errors
-% occur or to indicate how the code is proceeding. The \pkg{l3msg}
-% module provides a consistent method for doing this (as opposed to
-% writing directly to the terminal or log).
-%
-% The system used by \pkg{l3msg} to create messages divides the process
-% into two distinct parts. Named messages are created in the first part
-% of the process; at this stage, no decision is made about the type
-% output that the message will produce. The second part of the process
-% is actually producing a message. At this stage a choice of message
-% \emph{class} has to be made, for example \texttt{error},
-% \texttt{warning} or \texttt{info}.
-%
-% By separating out the creation and use of messages, several benefits
-% are available. First, the messages can be altered later without
-% needing details of where they are used in the code. This makes it
-% possible to alter the language used, the detail level and so on.
-% Secondly, the output which results from a given message can be
-% altered. This can be done on a message class, module or message name
-% basis. In this way, message behaviour can be altered and messages can
-% be entirely suppressed.
-%
-%\section{Creating new messages}
-%
-% All messages have to be created before they can be used. Inside the
-% message text, spaces are \emph{not} ignored. A space where \TeX\
-% would normally gobble one can be created using |\ |, and a new line
-% with |\\|. New lines may have `continuation' text added by the
-% output system.
-%
-%\begin{function}{
-% \msg_new:nnnn |
-% \msg_new:nnn |
-% \msg_set:nnnn |
-% \msg_set:nnn
-%}
-% \begin{syntax}
-% "\msg_new:nnnn" \marg{module} \marg{message} \marg{text}
-% ~~~~\marg{more text}
-% \end{syntax}
-% Creates new <message> for <module> to produce <text> initially
-% and <more text> if requested by the user. <text> and <more text> can
-% use up to four macro parameters (|#1| to |#4|), which are supplied by
-% the message system. At the point where <message> is printed, the
-% material supplied for |#1| to |#4| will be subject to an x-type
-% expansion.
-%
-% An error will be raised by the \texttt{new} functions if the
-% message already exists: the \texttt{set} functions do not
-% carry any checking. For messages defined using
-% \cs{msg_new:nnn} or \cs{msg_set:nnn} \LaTeX3 will supply a
-% standard <more text> at the point the message is used, if this
-% is required.
-%\end{function}
-%
-%\section{Message classes}
-%
-% Creating message output requires the message to be given a class.
-%
-%\begin{function}{
-% \msg_class_new:nn |
-% \msg_class_set:nn
-%}
-% \begin{syntax}
-% "\msg_class_new:nn" \marg{class} \marg{code}
-% \end{syntax}
-% Creates new <class> to output a message, using <code> to process
-% the message text. The <class> should be a text value, while
-% the <code> may be any arbitrary material.
-%\end{function}
-%
-% The module defines several common message classes. The following
-% describes the standard behaviour of each class if no redirection of
-% the class or message is active. In all cases, the message may be
-% issued supplying \(0\) to \(4\) arguments. The code will
-% ensure that there an no errors if the number of arguments supplied
-% here does not match the number in the definition of the message
-% (although of course the sense of the message may be impaired).
-%
-%\begin{function}{
-% \msg_fatal:nnxxxx |
-% \msg_fatal:nnxxx |
-% \msg_fatal:nnxx |
-% \msg_fatal:nnx |
-% \msg_fatal:nn
-%}
-% \begin{syntax}
-% "\msg_fatal:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Issues <module> error message <name>, passing <arg one> to
-% <arg four> to the text-creating functions. After issuing a
-% fatal error the \TeX\ run will halt.
-%\end{function}
-%
-%\begin{function}{
-% \msg_error:nnxxxx |
-% \msg_error:nnxxx |
-% \msg_error:nnxx |
-% \msg_error:nnx |
-% \msg_error:nn
-%}
-% \begin{syntax}
-% "\msg_error:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Issues <module> error message <name>, passing <arg one> to
-% <arg four> to the text-creating functions.
-% \begin{texnote}
-% The standard output here is similar to \cs{PackageError}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \msg_warning:nnxxxx |
-% \msg_warning:nnxxx |
-% \msg_warning:nnxx |
-% \msg_warning:nnx |
-% \msg_warning:nn
-%}
-% \begin{syntax}
-% "\msg_warning:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Prints <module> message <name> to the terminal, passing <arg one> to
-% <arg four> to the text-creating functions.
-% \begin{texnote}
-% The standard output here is similar to \cs{PackageWarningNoLine}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \msg_info:nnxxxx |
-% \msg_info:nnxxx |
-% \msg_info:nnxx |
-% \msg_info:nnx |
-% \msg_info:nn
-%}
-% \begin{syntax}
-% "\msg_info:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Prints <module> message <name> to the log, passing <arg one> to
-% <arg four> to the text-creating functions.
-% \begin{texnote}
-% The standard output here is similar to \cs{PackageInfoNoLine}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{
-% \msg_log:nnxxxx|
-% \msg_log:nnxxx|
-% \msg_log:nnxx|
-% \msg_log:nnx|
-% \msg_log:nn
-%}
-% \begin{syntax}
-% "\msg_log:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Prints <module> message <name> to the log, passing <arg one> to
-% <arg four> to the text-creating functions. No continuation text is
-% added.
-%\end{function}
-%
-%\begin{function}{
-% \msg_trace:nnxxxx|
-% \msg_trace:nnxxx|
-% \msg_trace:nnxx|
-% \msg_trace:nnx|
-% \msg_trace:nn
-%}
-% \begin{syntax}
-% "\msg_trace:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Prints <module> message <name> to the log, passing <arg one> to
-% <arg four> to the text-creating functions. No continuation text is
-% added.
-%\end{function}
-%
-%\begin{function}{
-% \msg_none:nnxxxx|
-% \msg_none:nnxxx|
-% \msg_none:nnxx|
-% \msg_none:nnx|
-% \msg_none:nn
-%}
-% \begin{syntax}
-% "\msg_none:nnxxxx" \marg{module} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Does nothing: used for redirecting other message classes. Gobbles
-% arguments given.
-%\end{function}
-%
-% \section{Redirecting messages}
-%
-%\begin{function}{\msg_redirect_class:nn}
-% \begin{syntax}
-% "\msg_redirect_class:nn" \marg{class one} \marg{class two}
-% \end{syntax}
-% Changes the behaviour of messages of <class one> so that they
-% are processed using the code for those of <class two>. Multiple
-% redirections are possible. Redirection to a missing class or
-% infinite loops will raise errors when the messages are used,
-% rather than at the point of redirection.
-%\end{function}
-%
-%\begin{function}{\msg_redirect_module:nnn}
-% \begin{syntax}
-% "\msg_redirect_module:nnn" \marg{module} \marg{class one}
-% \marg{class two}
-% \end{syntax}
-% Redirects message of <class one> for <module> to act as though
-% they were from <class two>. Messages of <class one> from
-% sources other than <module> are not affected by this redirection.
-% \begin{texnote}
-% This function can be used to make some messages `silent' by
-% default. For example, all of the \texttt{trace} messages of
-% <module> could be turned off with:
-% \begin{verbatim}
-% \msg_redirect_module:nnn { module } { trace } { none }
-% \end{verbatim}
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\msg_redirect_name:nnn}
-% \begin{syntax}
-% "\msg_redirect_name:nnn" \marg{module} \marg{message} \marg{class}
-% \end{syntax}
-% Redirects a specific <message> from a specific <module> to act
-% as a member of <class> of messages.
-% \begin{texnote}
-% This function can be used to make a selected message `silent'
-% without changing global parameters:
-% \begin{verbatim}
-% \msg_redirect_name:nnn { module } { annoying-message } { none }
-% \end{verbatim}
-% \end{texnote}
-%\end{function}
-%
-% \section{Support functions for output}
-%
-%\begin{function}{\msg_line_context:}
-% \begin{syntax}
-% "\msg_line_context:"
-% \end{syntax}
-% Prints the text specified in \cs{c_msg_on_line_tl} followed by
-% the current line in the current input file.
-% \begin{texnote}
-% This is similar to the text added to messages by \LaTeXe's
-% \cs{PackageWarning} and \cs{PackageInfo}.
-% \end{texnote}
-%\end{function}
-%
-%\begin{function}{\msg_line_number:}
-% \begin{syntax}
-% "\msg_line_number:"
-% \end{syntax}
-% Prints the current line number in the current input file.
-%\end{function}
-%
-%\begin{function}{
-% \msg_newline: |
-% \msg_two_newlines:
-%}
-% \begin{syntax}
-% "\msg_newline:"
-% \end{syntax}
-% Print one or two newlines with no continuation information.
-%\end{function}
-%
-% \section{Low-level functions}
-%
-% The low-level functions do not make assumptions about module names.
-% The output functions here produce messages directly, and do not
-% respond to redirection.
-%
-%\begin{function}{
-% \msg_generic_new:nnn |
-% \msg_generic_new:nn |
-% \msg_generic_set:nnn |
-% \msg_generic_set:nn
-%}
-% \begin{syntax}
-% "\msg_generic_new:nnn" \marg{name} \marg{text} \marg{more text}
-% \end{syntax}
-% Creates new message <name> to produce <text> initially and
-% <more text> if requested by the user. <text> and <more text> can use
-% up to four macro parameters ("#1" to "#4"), which are supplied by the
-% message system. Inside <text> and <more text> spaces are not ignored.
-%\end{function}
-%
-%\begin{function}{\msg_direct_interrupt:xxxxx}
-% \begin{syntax}
-% "\msg_direct_interrupt:xxxxx" \marg{first line} \marg{text}
-% ~~~~\marg{continuation} \marg{last line} \marg{more text}
-% \end{syntax}
-% Executes a \TeX\ error, interrupting compilation. The <first line>
-% is displayed followed by <text> and the input prompt. <more text> is
-% displays if requested by the user. If <more text> is blank a default
-% is supplied. Each line of <text> (broken with "\\") begins with
-% <continuation> and finishes off with <last line>.
-% <last line> has a period appended to it; do not add one yourself.
-%\end{function}
-%
-%\begin{function}{
-% \msg_direct_log:xx|
-% \msg_direct_term:xx
-%}
-% \begin{syntax}
-% "\msg_direct_log:xx" \marg{text} \marg{continuation}
-% \end{syntax}
-% Prints <text> to either the log or terminal. New lines (broken
-% with "\\") start with <continuation>.
-%\end{function}
-%
-% \section{Kernel-specific functions}
-%
-%\begin{function}{
-% \msg_kernel_new:nnnn |
-% \msg_kernel_new:nnn |
-% \msg_kernel_set:nnnn |
-% \msg_kernel_set:nnn
-%}
-% \begin{syntax}
-% "\msg_kernel_new:nnnn" \marg{divsion} \marg{name} \marg{text}
-% ~~~~\marg{more text}
-% \end{syntax}
-% Creates new kernel message <name> to produce <text> initially and
-% <more text> if requested by the user. <text> and <more text> can use
-% up to four macro parameters ("#1" to "#4"), which are supplied by the
-% message system. Kernel messages are divided into <divisions>, roughly
-% equivalent to the \LaTeXe\ package names used.
-%\end{function}
-%
-%\begin{function}{
-% \msg_kernel_fatal:nnxxxx |
-% \msg_kernel_fatal:nnxxx |
-% \msg_kernel_fatal:nnxx |
-% \msg_kernel_fatal:nnx |
-% \msg_kernel_fatal:nn
-%}
-% \begin{syntax}
-% "\msg_kernel_fatal:nnxx" \marg{division} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Issues kernel error message <name> for <division>, passing <arg one>
-% to <arg four> to the text-creating functions. The \TeX\ run then
-% halts. Cannot be redirected.
-%\end{function}
-%
-%\begin{function}{
-% \msg_kernel_error:nnxxxx |
-% \msg_kernel_error:nnxxx |
-% \msg_kernel_error:nnxx |
-% \msg_kernel_error:nnx |
-% \msg_kernel_error:nn
-%}
-% \begin{syntax}
-% "\msg_kernel_error:nnxx" \marg{division} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Issues kernel error message <name> for <division>, passing <arg one>
-% to <arg four> to the text-creating functions. Cannot be redirected.
-%\end{function}
-%
-%\begin{function}{
-% \msg_kernel_warning:nnxxxx |
-% \msg_kernel_warning:nnxxx |
-% \msg_kernel_warning:nnxx |
-% \msg_kernel_warning:nnx |
-% \msg_kernel_warning:nn
-%}
-% \begin{syntax}
-% "\msg_kernel_warning:nnxx" \marg{division} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Prints kernel message <name> for <division> to the terminal, passing
-% <arg one> to <arg four> to the text-creating functions.
-%\end{function}
-%
-%\begin{function}{
-% \msg_kernel_info:nnxxxx |
-% \msg_kernel_info:nnxxx |
-% \msg_kernel_info:nnxx |
-% \msg_kernel_info:nnx |
-% \msg_kernel_info:nn
-%}
-% \begin{syntax}
-% "\msg_kernel_info:nxx" \marg{division} \marg{name} \marg{arg one}
-% ~~~~\marg{arg two} \marg{arg three} \marg{arg four}
-% \end{syntax}
-% Prints kernel message <name> for <division> to the log, passing
-% <arg one> to <arg four> to the text-creating functions.
-%\end{function}
-%
-%\begin{function}{\msg_kernel_bug:x}
-% \begin{syntax}
-% "\msg_kernel_bug:x" \marg{text}
-% \end{syntax}
-% Short-cut for `This is a LaTeX bug: check coding' errors.
-%\end{function}
-%
-% \begin{function}{\msg_fatal_text:n}
-% \begin{syntax}
-% "\msg_fatal_text:n" \marg{package}
-% \end{syntax}
-% Prints `Fatal <package> error' for use in error messages.
-% \end{function}
-%
-%
-% \section{Variables and constants}
-%
-%\begin{variable}{
-% \c_msg_error_tl |
-% \c_msg_warning_tl |
-% \c_msg_info_tl
-%}
-% Simple headers for errors. Although these are marked as constants,
-% they could be changed for printing errors in a different language.
-%\end{variable}
-%
-%\begin{variable}{
-% \c_msg_coding_error_text_tl |
-% \c_msg_fatal_text_tl |
-% \c_msg_help_text_tl |
-% \c_msg_kernel_bug_text_tl |
-% \c_msg_kernel_bug_more_text_tl |
-% \c_msg_no_info_text_tl |
-% \c_msg_return_text_tl
-%}
-% Various pieces of text for use in messages, which are not changed by
-% the code here although they could be to alter the language. Although
-% these are marked as constants, they could be changed for printing
-% errors in a different language.
-%\end{variable}
-%
-%\begin{variable}{\c_msg_on_line_tl}
-% The `on line' phrase for line numbers. Although marked as a constant,
-% they could be changed for printing errors in a different language.
-%\end{variable}
-%
-%\begin{variable}{
-% \c_msg_text_prefix_tl |
-% \c_msg_more_text_prefix_tl
-%}
-% Header information for storing the `paths' to parts of a message.
-% Although these are marked as constants, they could be changed for
-% printing errors in a different language.
-%\end{variable}
-%
-%\begin{variable}{
-% \l_msg_class_tl |
-% \l_msg_current_class_tl |
-% \l_msg_current_module_tl
-%}
-% Information about message method, used for filtering.
-%\end{variable}
-%
-%\begin{variable}{\l_msg_names_clist}
-% List of all of the message names defined.
-%\end{variable}
-%
-%\begin{variable}{
-% \l_msg_redirect_classes_prop |
-% \l_msg_redirect_names_prop
-%}
-% Re-direction lists containing the class of message to convert an
-% different one.
-%\end{variable}
-%
-%\begin{variable}{\l_msg_redirect_classes_clist}
-% List so that filtering does not loop.
-%\end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3msg} implementation}
-%
-% The usual lead-off.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \LaTeX\ is handling context, so the \TeX\ ``noise'' is turned down.
-% \begin{macrocode}
-\int_set:Nn \tex_errorcontextlines:D { \c_minus_one }
-% \end{macrocode}
-%
-% \subsection{Variables and constants}
-%
-%\begin{macro}{\c_msg_error_tl}
-%\begin{macro}{\c_msg_warning_tl}
-%\begin{macro}{\c_msg_info_tl}
-% Header information.
-% \begin{macrocode}
-\tl_const:Nn \c_msg_error_tl { error }
-\tl_const:Nn \c_msg_warning_tl { warning }
-\tl_const:Nn \c_msg_info_tl { info }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-% \begin{macro}{\msg_fatal_text:n,\msg_see_documentation_text:n}
-% Contextual header/footer information.
-% \begin{macrocode}
-\cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error }
-\cs_new:Npn \msg_see_documentation_text:n #1
- { See~the~#1~documentation~for~further~information }
-% \end{macrocode}
-% \end{macro}
-%
-%
-%\begin{macro}{\c_msg_coding_error_text_tl}
-%\begin{macro}{\c_msg_fatal_text_tl}
-%\begin{macro}{\c_msg_help_text_tl}
-%\begin{macro}{\c_msg_kernel_bug_text_tl}
-%\begin{macro}{\c_msg_kernel_bug_more_text_tl}
-%\begin{macro}{\c_msg_no_info_text_tl}
-%\begin{macro}{\c_msg_return_text_tl}
-% Simple pieces of text for messages.
-% \begin{macrocode}
-\tl_const:Nn \c_msg_coding_error_text_tl {
- This~is~a~coding~error.
- \msg_two_newlines:
-}
-\tl_const:Nn \c_msg_fatal_text_tl {
- This~is~a~fatal~error:~LaTeX~will~abort
-}
-\tl_const:Nn \c_msg_help_text_tl {
- For~immediate~help~type~H~<return>
-}
-\tl_const:Nn \c_msg_kernel_bug_text_tl {
- This~is~a~LaTeX~bug:~check~coding!
-}
-\tl_const:Nn \c_msg_kernel_bug_more_text_tl {
- There~is~a~coding~bug~somewhere~around~here. \\
- This~probably~needs~examining~by~an~expert.
- \c_msg_return_text_tl
-}
-\tl_const:Nn \c_msg_no_info_text_tl {
- LaTeX~does~not~know~anything~more~about~this~error,~sorry.
- \c_msg_return_text_tl
-}
-\tl_const:Nn \c_msg_return_text_tl {
- \\ \\
- Try~typing~<return>~to~proceed.
- \\
- If~that~doesn't~work,~type~X~<return>~to~quit
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\c_msg_hide_tl<spaces>}
-% An empty variable with a number of (category code 11) periods at the
-% end of its name. This is used to push the \TeX\ part of an error
-% message ``off the screen''.
-% \begin{macrocode}
-\group_begin:
-\char_make_letter:N \.
-\tl_to_lowercase:n {
- \group_end:
- \tl_const:Nn \c_msg_hide_tl................................................
- {}
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_msg_on_line_tl}
-% Text for ``on line''.
-% \begin{macrocode}
-\tl_const:Nn \c_msg_on_line_tl { on~line }
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\c_msg_text_prefix_tl}
-%\begin{macro}{\c_msg_more_text_prefix_tl}
-% Prefixes for storage areas.
-% \begin{macrocode}
-\tl_const:Nn \c_msg_text_prefix_tl { msg_text ~>~ }
-\tl_const:Nn \c_msg_more_text_prefix_tl { msg_text_more ~>~ }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_msg_class_tl}
-%\begin{macro}{\l_msg_current_class_tl}
-%\begin{macro}{\l_msg_current_module_tl}
-% For holding the current message method and that for redirection.
-% \begin{macrocode}
-\tl_new:N \l_msg_class_tl
-\tl_new:N \l_msg_current_class_tl
-\tl_new:N \l_msg_current_module_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_msg_names_clist}
-% Lists used for filtering.
-% \begin{macrocode}
-\clist_new:N \l_msg_names_clist
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\l_msg_redirect_classes_prop}
-%\begin{macro}{\l_msg_redirect_names_prop}
-% For filtering messages, a list of all messages and of those which have
-% to be modified is required.
-% \begin{macrocode}
-\prop_new:N \l_msg_redirect_classes_prop
-\prop_new:N \l_msg_redirect_names_prop
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\l_msg_redirect_classes_clist}
-% To prevent an infinite loop.
-% \begin{macrocode}
-\clist_new:N \l_msg_redirect_classes_clist
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\l_msg_tmp_tl}
-% A scratch variable.
-% \begin{macrocode}
-\tl_new:N \l_msg_tmp_tl
-% \end{macrocode}
-%\end{macro}
-%
-% \subsection{Output helper functions}
-%
-%\begin{macro}{\msg_line_number:}
-%\begin{macro}{\msg_line_context:}
-% For writing the line number nicely.
-% \begin{macrocode}
-\cs_new_nopar:Npn \msg_line_number: {
- \toks_use:N \tex_inputlineno:D
-}
-\cs_new_nopar:Npn \msg_line_context: {
- \c_msg_on_line_tl
- \c_space_tl
- \msg_line_number:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_newline:}
-%\begin{macro}{\msg_two_newlines:}
-% Always forces a new line.
-% \begin{macrocode}
-\cs_new_nopar:Npn \msg_newline: { ^^J }
-\cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Generic functions}
-%
-% The lowest level functions make no assumptions about modules,
-% \emph{etc.}
-%
-%\begin{macro}{\msg_generic_new:nnn}
-%\begin{macro}{\msg_generic_new:nn}
-% Creating a new message is basically the same as the non-checking
-% version, and so after a check everything hands over.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_generic_new:nnn #1 {
- \chk_if_free_cs:c { \c_msg_text_prefix_tl #1 :xxxx }
- \msg_generic_set:nnn {#1}
-}
-\cs_new_protected_nopar:Npn \msg_generic_new:nn #1 {
- \chk_if_free_cs:c { \c_msg_text_prefix_tl #1 :xxxx }
- \msg_generic_set:nn {#1}
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_generic_set:nnn}
-%\begin{macro}{\msg_generic_set:nn}
-%\begin{macro}[aux]{\msg_generic_set_clist:n}
-% Creating a message is quite simple. There must be a short text part,
-% while the longer text may or may not be available.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_generic_set:nnn #1#2#3 {
- \msg_generic_set_clist:n {#1}
- \cs_set:cpn { \c_msg_text_prefix_tl #1 :xxxx } ##1##2##3##4 {#2}
- \cs_set:cpn { \c_msg_more_text_prefix_tl #1 :xxxx } ##1##2##3##4 {#3}
-}
-\cs_new_protected_nopar:Npn \msg_generic_set:nn #1#2 {
- \msg_generic_set_clist:n {#1}
- \cs_set:cpn { \c_msg_text_prefix_tl #1 :xxxx } ##1##2##3##4 {#2}
- \cs_set_eq:cN { \c_msg_more_text_prefix_tl #1 :xxxx } \c_undefined
-}
-\cs_new_protected_nopar:Npn \msg_generic_set_clist:n #1 {
- \clist_if_in:NnF \l_msg_names_clist { // #1 / } {
- \clist_put_right:Nn \l_msg_names_clist { // #1 / }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_direct_interrupt:xxxxx}
-%\begin{macro}[aux]{\msg_direct_interrupt:n}
-% The low-level interruption macro is rather opaque, unfortunately. The
-% idea here is to create a a message which hides all of \TeX's own
-% information by filling the output up with dots. To achieve this,
-% dots have to be letters. The odd
-% \cs{c_msg_hide_tl<dots>} actually does the hiding: it is the
-% large run of dots in the name that is important here. The meaning
-% of "\\" is altered so that the explanation text is a simple run
-% whilst the initial error has line-continuation shown.
-% \begin{macrocode}
-\group_begin:
- \char_set_lccode:nn {`\&} {`\ } % {
- \char_set_lccode:w `\} = `\ \scan_stop:
- \char_set_lccode:w `\& = `\!\scan_stop:
- \char_make_active:N \&
- \char_make_letter:N \.
-\tl_to_lowercase:n{
- \group_end:
- \cs_new_protected:Npn \msg_direct_interrupt:xxxxx #1#2#3#4#5 {
- \group_begin:
- \cs_set_nopar:Npn \\ {\msg_newline:}
- \cs_set_eq:NN \ \c_space_tl
- \tl_set:Nx \l_tmpa_tl {#5}
- \tl_set:Nx \l_tmpb_tl {\c_msg_no_info_text_tl}
- \msg_direct_interrupt_aux:n {#5}
- \tex_errhelp:D \l_msg_tmp_tl
- \cs_set_nopar:Npn \\ {\msg_newline: !~#3}
- \iow_term:x
- {\msg_newline: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
- \cs_set:Npn & {
- \tex_errmessage:D{
- \\ #1 \\ \\ #2 \\ \\ #4
- \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl
- { . \\ \c_msg_help_text_tl }
- \c_msg_hide_tl................................................
- }
- }
- &
- \group_end:
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected:Npn \msg_direct_interrupt_aux:n #1 {
- \cs_set_nopar:Npn \\ {\msg_newline: |~}
- \tl_if_empty:nTF {#1} {
- \tl_set:Nx \l_msg_tmp_tl { { \c_msg_no_info_text_tl } }
- }{
- \tl_set:Nx \l_msg_tmp_tl { {
- |'''''''''''''''''''''''''''''''''''''''''''''''\\
- #1^^J
- |...............................................^^J
- } }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_direct_log:xx}
-%\begin{macro}{\msg_direct_term:xx}
-% Printing to the log or terminal without a stop is rather easier.
-% \begin{macrocode}
-\cs_new_protected:Npn \msg_direct_log:xx #1#2 {
- \group_begin:
- \cs_set:Npn \\ { \msg_newline: #2 }
- \cs_set_eq:NN \ \c_space_tl
- \iow_log:x { #1 \msg_newline: }
- \group_end:
-}
-\cs_new_protected:Npn \msg_direct_term:xx #1#2 {
- \group_begin:
- \cs_set:Npn \\ { \msg_newline: #2 }
- \cs_set_eq:NN \ \c_space_tl
- \iow_term:x { #1 \msg_newline: }
- \group_end:
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{General functions}
-%
-% The main functions for messaging are built around the separation of
-% module from the message name. These have short names as they will be
-% widely used.
-%
-%\begin{macro}{\msg_new:nnnn}
-%\begin{macro}{\msg_new:nnn}
-%\begin{macro}{\msg_set:nnnn}
-%\begin{macro}{\msg_set:nnn}
-% For making messages: all aliases.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_new:nnnn #1#2 {
- \msg_generic_new:nnn { #1 / #2 }
-}
-\cs_new_protected_nopar:Npn \msg_new:nnn #1#2 {
- \msg_generic_new:nn { #1 / #2 }
-}
-\cs_new_protected_nopar:Npn \msg_set:nnnn #1#2 {
- \msg_generic_set:nnn { #1 / #2 }
-}
-\cs_new_protected_nopar:Npn \msg_set:nnn #1#2 {
- \msg_generic_set:nn { #1 / #2 }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_class_new:nn}
-%\begin{macro}{\msg_class_set:nn}
-% Creating a new class produces three new functions, with varying
-% numbers of arguments. The \cs{msg_class_loop:n} function is set up
-% so that redirection will work as desired.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_class_new:nn #1 {
- \chk_if_free_cs:c { msg_ #1 :nnxxxx }
- \prop_new:c { l_msg_redirect_ #1 _prop }
- \msg_class_set:nn {#1}
-}
-\cs_new_protected_nopar:Npn \msg_class_set:nn #1#2 {
- \prop_clear:c { l_msg_redirect_ #1 _prop }
- \cs_set_protected:cpn { msg_ #1 :nnxxxx } ##1##2##3##4##5##6 {
- \msg_use:nnnnxxxx {#1} {#2} {##1} {##2} {##3} {##4} {##5} {##6}
- }
- \cs_set_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 {
- \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { }
- }
- \cs_set_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 {
- \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { }
- }
- \cs_set_protected:cpx { msg_ #1 :nnx } ##1##2##3 {
- \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { }
- }
- \cs_set_protected:cpx { msg_ #1 :nn } ##1##2 {
- \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} { } { } { } { }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\msg_use:nnnnxxxx}
-% The main message-using macro creates two auxiliary functions: one
-% containing the code for the message, and the second a loop function.
-% There is then a hand-off to the system for checking if redirection is
-% needed.
-% \begin{macrocode}
-\cs_new_protected:Npn \msg_use:nnnnxxxx #1#2#3#4#5#6#7#8 {
- \cs_set_nopar:Npn \msg_use_code: {
- \clist_clear:N \l_msg_redirect_classes_clist
- #2
- }
- \cs_set:Npn \msg_use_loop:n ##1 {
- \clist_if_in:NnTF \l_msg_redirect_classes_clist {#1} {
- \msg_kernel_error:nn { msg } { redirect-loop } {#1}
- }{
- \clist_put_right:Nn \l_msg_redirect_classes_clist {#1}
- \cs_if_exist:cTF { msg_ ##1 :nnxxxx } {
- \use:c { msg_ ##1 :nnxxxx } {#3} {#4} {#5} {#6} {#7} {#8}
- }{
- \msg_kernel_error:nnx { msg } { message-class-unknown } {##1}
- }
- }
- }
- \cs_if_exist:cTF { \c_msg_text_prefix_tl #3 / #4 :xxxx } {
- \msg_use_aux:nnn {#1} {#3} {#4}
- }{
- \msg_kernel_error:nnxx { msg } { message-unknown } {#3} {#4}
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}[aux]{\msg_use_code:}
-%\begin{macro}[aux]{\msg_use_loop:}
-% Blank definitions are initially created for these functions.
-% \begin{macrocode}
-\cs_new_nopar:Npn \msg_use_code: { }
-\cs_new:Npn \msg_use_loop:n #1 { }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\msg_use_aux:nnn}
-% The first auxiliary macro looks for a match by name: the most
-% restrictive check.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_use_aux:nnn #1#2#3 {
- \tl_set:Nn \l_msg_current_class_tl {#1}
- \tl_set:Nn \l_msg_current_module_tl {#2}
- \prop_if_in:NnTF \l_msg_redirect_names_prop { // #2 / #3 / } {
- \msg_use_loop_check:nn { names } { // #2 / #3 / }
- }{
- \msg_use_aux:nn {#1} {#2}
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\msg_use_aux:nn}
-% The second function checks for general matches by module or for
-% all modules.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_use_aux:nn #1#2 {
- \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } {#2} {
- \msg_use_loop_check:nn {#1} {#2}
- }{
- \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } { * } {
- \msg_use_loop_check:nn {#1} { * }
- }{
- \msg_use_code:
- }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\msg_use_loop_check:nn}
-% When checking whether to loop, the same code is needed in a few
-% places.
-% \begin{macrocode}
-\cs_new_protected:Npn \msg_use_loop_check:nn #1#2 {
- \prop_get:cnN { l_msg_redirect_ #1 _prop } {#2} \l_msg_class_tl
- \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl {
- \msg_use_code:
- }{
- \msg_use_loop:n { \l_msg_class_tl }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\msg_fatal:nnxxxx}
-%\begin{macro}{\msg_fatal:nnxxx}
-%\begin{macro}{\msg_fatal:nnxx}
-%\begin{macro}{\msg_fatal:nnx}
-%\begin{macro}{\msg_fatal:nn}
-% For fatal errors, after the error message \TeX\ bails out.
-% \begin{macrocode}
-\msg_class_new:nn { fatal } {
- \msg_direct_interrupt:xxxxx
- { \msg_fatal_text:n {#1} : ~ "#2" }
- {
- \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6}
- }
- {}
- { \msg_see_documentation_text:n {#1} }
- { \c_msg_fatal_text_tl }
- \tex_end:D
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_error:nnxxxx}
-%\begin{macro}{\msg_error:nnxxx}
-%\begin{macro}{\msg_error:nnxx}
-%\begin{macro}{\msg_error:nnx}
-%\begin{macro}{\msg_error:nn}
-% For an error, the interrupt routine is called, then any recovery code
-% is tried.
-% \begin{macrocode}
-\msg_class_new:nn { error } {
- \msg_direct_interrupt:xxxxx
- { #1~ \c_msg_error_tl : ~ "#2" }
- {
- \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6}
- }
- {}
- { \msg_see_documentation_text:n {#1} }
- {
- \cs_if_exist:cTF { \c_msg_more_text_prefix_tl #1 / #2 :xxxx }
- {
- \use:c { \c_msg_more_text_prefix_tl #1 / #2 :xxxx }
- {#3} {#4} {#5} {#6}
- }
- { \c_msg_no_info_text_tl }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_warning:nnxxxx}
-%\begin{macro}{\msg_warning:nnxxx}
-%\begin{macro}{\msg_warning:nnxx}
-%\begin{macro}{\msg_warning:nnx}
-%\begin{macro}{\msg_warning:nn}
-% Warnings are printed to the terminal.
-% \begin{macrocode}
-\msg_class_new:nn { warning } {
- \msg_direct_term:xx {
- \c_space_tl #1 ~ \c_msg_warning_tl :~
- \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6}
- }
- { ( #1 ) \c_space_tl \c_space_tl }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_info:nnxxxx}
-%\begin{macro}{\msg_info:nnxxx}
-%\begin{macro}{\msg_info:nnxx}
-%\begin{macro}{\msg_info:nnx}
-%\begin{macro}{\msg_info:nn}
-% Information only goes into the log.
-% \begin{macrocode}
-\msg_class_new:nn { info } {
- \msg_direct_log:xx {
- \c_space_tl #1~\c_msg_info_tl :~
- \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6}
- }
- { ( #1 ) \c_space_tl \c_space_tl }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_log:nnxxxx}
-%\begin{macro}{\msg_log:nnxxx}
-%\begin{macro}{\msg_log:nnxx}
-%\begin{macro}{\msg_log:nnx}
-%\begin{macro}{\msg_log:nn}
-% ``Log'' data is very similar to information, but with no extras
-% added.
-% \begin{macrocode}
-\msg_class_new:nn { log } {
- \msg_direct_log:xx {
- \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6}
- }
- { }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_trace:nnxxxx}
-%\begin{macro}{\msg_trace:nnxxx}
-%\begin{macro}{\msg_trace:nnxx}
-%\begin{macro}{\msg_trace:nnx}
-%\begin{macro}{\msg_trace:nn}
-% Trace data is the same as log data, more or less
-% \begin{macrocode}
-\msg_class_new:nn { trace } {
- \msg_direct_log:xx {
- \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6}
- }
- { }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_none:nnxxxx}
-%\begin{macro}{\msg_none:nnxxx}
-%\begin{macro}{\msg_none:nnxx}
-%\begin{macro}{\msg_none:nnx}
-%\begin{macro}{\msg_none:nn}
-% The \texttt{none} message type is needed so that input can be gobbled.
-% \begin{macrocode}
-\msg_class_new:nn { none } { }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Redirection functions}
-%
-%\begin{macro}{\msg_redirect_class:nn}
-% Converts class one into class two.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_redirect_class:nn #1#2 {
- \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#2}
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\msg_redirect_module:nnn}
-% For when all messages of a class should be altered for a given module.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_redirect_module:nnn #1#2#3 {
- \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#3}
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\msg_redirect_name:nnn}
-% Named message will always use the given class.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_redirect_name:nnn #1#2#3 {
- \prop_put:Nnn \l_msg_redirect_names_prop { // #1 / #2 / } {#3}
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\subsection{Kernel-specific functions}
-%
-%\begin{macro}{\msg_kernel_new:nnnn}
-%\begin{macro}{\msg_kernel_new:nnn}
-%\begin{macro}{\msg_kernel_set:nnnn}
-%\begin{macro}{\msg_kernel_set:nnn}
-% The kernel needs some messages of its own. These are created using
-% pre-built functions. Two functions are provided: one more general
-% and one which only has the short text part.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_kernel_new:nnnn #1#2 {
- \msg_new:nnnn { LaTeX } { #1 / #2 }
-}
-\cs_new_protected_nopar:Npn \msg_kernel_new:nnn #1#2 {
- \msg_new:nnn { LaTeX } { #1 / #2 }
-}
-\cs_new_protected_nopar:Npn \msg_kernel_set:nnnn #1#2 {
- \msg_set:nnnn { LaTeX } { #1 / #2 }
-}
-\cs_new_protected_nopar:Npn \msg_kernel_set:nnn #1#2 {
- \msg_set:nnn { LaTeX } { #1 / #2 }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}[aux]{\msg_kernel_classes_new:n}
-% Quickly make the fewer-arguments versions.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_kernel_classes_new:n #1 {
- \cs_new_protected:cpx { msg_kernel_ #1 :nnxxx } ##1##2##3##4##5
- {
- \exp_not:c { msg_kernel_ #1 :nnxxxx }
- {##1} {##2} {##3} {##4} {##5} { }
- }
- \cs_new_protected:cpx { msg_kernel_ #1 :nnxx } ##1##2##3##4
- {
- \exp_not:c { msg_kernel_ #1 :nnxxxx }
- {##1} {##2} {##3} {##4} { } { }
- }
- \cs_new_protected:cpx { msg_kernel_ #1 :nnx } ##1##2##3
- {
- \exp_not:c { msg_kernel_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { }
- }
- \cs_new_protected:cpx { msg_kernel_ #1 :nn } ##1##2
- {
- \exp_not:c { msg_kernel_ #1 :nnxxxx } {##1} {##2} { } { } { } { }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\msg_kernel_fatal:nnxxxx}
-%\begin{macro}{\msg_kernel_fatal:nnxxx}
-%\begin{macro}{\msg_kernel_fatal:nnxx}
-%\begin{macro}{\msg_kernel_fatal:nnx}
-%\begin{macro}{\msg_kernel_fatal:nn}
-% Fatal kernel errors cannot be re-defined.
-% \begin{macrocode}
-\cs_new_protected:Npn \msg_kernel_fatal:nnxxxx #1#2#3#4#5#6 {
- \msg_direct_interrupt:xxxxx
- { \msg_fatal_text:n {LaTeX} }
- {
- \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 :xxxx }
- {#3} {#4} {#5} {#6}
- }
- {}
- { \msg_see_documentation_text:n {LaTeX3} }
- { \c_msg_fatal_text_tl }
- \tex_end:D
-}
-\msg_kernel_classes_new:n { fatal }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_kernel_error:nnxxxx}
-%\begin{macro}{\msg_kernel_error:nnxxx}
-%\begin{macro}{\msg_kernel_error:nnxx}
-%\begin{macro}{\msg_kernel_error:nnx}
-%\begin{macro}{\msg_kernel_error:nn}
-% Neither can kernel errors.
-% \begin{macrocode}
-\cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 {
- \msg_direct_interrupt:xxxxx
- { LaTeX~\c_msg_error_tl \c_space_tl "#2" }
- {
- \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 :xxxx }
- {#3} {#4} {#5} {#6}
- }
- {}
- { \msg_see_documentation_text:n {LaTeX3} }
- {
- \cs_if_exist:cTF
- { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 :xxxx }
- {
- \use:c { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 :xxxx }
- {#3} {#4} {#5} {#6}
- }
- { \c_msg_no_info_text_tl }
- }
-}
-\msg_kernel_classes_new:n { error }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\msg_kernel_warning:nnxxxx}
-%\begin{macro}{\msg_kernel_warning:nnxxx}
-%\begin{macro}{\msg_kernel_warning:nnxx}
-%\begin{macro}{\msg_kernel_warning:nnx}
-%\begin{macro}{\msg_kernel_warning:nn}
-%\begin{macro}{\msg_kernel_info:nnxxxx}
-%\begin{macro}{\msg_kernel_info:nnxxx}
-%\begin{macro}{\msg_kernel_info:nnxx}
-%\begin{macro}{\msg_kernel_info:nnx}
-%\begin{macro}{\msg_kernel_info:nn}
-% Life is much more simple for warnings and information messages, as
-% these are just short-cuts to the standard classes.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \msg_kernel_warning:nnxxxx #1#2 {
- \msg_warning:nnxxxx { LaTeX } { #1 / #2 }
-}
-\msg_kernel_classes_new:n { warning }
-\cs_new_protected_nopar:Npn \msg_kernel_info:nnxxxx #1#2 {
- \msg_info:nnxxxx { LaTeX } { #1 / #2 }
-}
-\msg_kernel_classes_new:n { info }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% Error messages needed to actually implement the message system
-% itself.
-% \begin{macrocode}
-\msg_kernel_new:nnnn { msg } { message-unknown }
- { Unknown~message~'#2'~for~module~'#1'.}
- {
- \c_msg_coding_error_text_tl
- LaTeX~was~asked~to~display~a~message~called~'#2'\\
- by~the~module~'#1'~module:~this~message~does~not~exist.
- \c_msg_return_text_tl
- }
-\msg_kernel_new:nnnn { msg } { message-class-unknown }
- { Unknown~message~class~'#1'. }
- {
- LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\
- this~was~never~defined.
-
- \c_msg_return_text_tl
- }
-\msg_kernel_new:nnnn { msg } { redirect-loop }
- { Message~redirection~loop~for~message~class~'#1'. }
- {
- LaTeX~has~been~asked~to~redirect~messages~in~an~infinite~loop.\\
- The~original~message~here~has~been~lost.
- \c_msg_return_text_tl
- }
-% \end{macrocode}
-%
-%\begin{macro}{\msg_kernel_bug:x}
-% The \LaTeX\ coding bug error gets re-visited here.
-% \begin{macrocode}
-\cs_set_protected:Npn \msg_kernel_bug:x #1 {
- \msg_direct_interrupt:xxxxx
- { \c_msg_kernel_bug_text_tl }
- { #1 }
- {}
- { \msg_see_documentation_text:n {LaTeX3} }
- { \c_msg_kernel_bug_more_text_tl }
-}
-% \end{macrocode}
-%\end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-% \end{implementation}
-%
-% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/expl3/l3names.dtx b/Master/texmf-dist/source/latex/expl3/l3names.dtx
deleted file mode 100644
index 729fd8e6434..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3names.dtx
+++ /dev/null
@@ -1,1523 +0,0 @@
-% \iffalse
-%% File: l3names.dtx Copyright (C) 1990-2006,2009-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%^^A At least at the moment this code is needed as the code proper
-%^^A starts with \GetInfoId
-%<*initex>
-\catcode`\{=1 % left brace is begin-group character
-\catcode`\}=2 % right brace is end-group character
-\catcode`\#=6 % hash mark is macro parameter character
-\catcode`\^=7 % circumflex is superscript character
-\catcode`\^^I=10 % ascii tab is a blank space
-%</initex>
-%<package>\begingroup
-%<*initex|package>
-\def\GetIdInfo$#1${%
- \begingroup
- \def\GetIdInfoString{#1}%
- \def\IdInfoStringUnexp{Id}%
- \ifx\GetIdInfoString\IdInfoStringUnexp
- \def\next{\endgroup\GetIdInfoMissing}%
- \else
- \def\next{\endgroup\GetIdInfoFull$#1$}%
- \fi
- \next
-}
-\def\GetIdInfoFull$#1 #2.#3 #4 #5 #6 #7${%
- \GetIdInfoAux #5\relax{#2}#5\relax{#4}%
-}
-\def\GetIdInfoAux #1#2#3#4#5#6\relax{%
- \ifx#5/%
- \expandafter\GetIdInfoAuxCVS
- \else
- \expandafter\GetIdInfoAuxSVN
- \fi
-}
-%</initex|package>
-%<*initex>
-\def\GetIdInfoAuxCVS #1#2\relax#3#4{%
- \immediate\write-1{#1; v#2, #3; #4}%
-}
-\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{%
- \immediate\write-1{#1; #2/#3/#4 v#5 #6}%
-}
-\def\GetIdInfoMissing#1{%
- \gdef\fileversion{000}%
- \gdef\filedate{0000/00/00}%
- \gdef\filedescription{#1}%
- \immediate\write-1{[Loading unknown package: #1]}%
-}
-%</initex>
-%<*package>
-\def\GetIdInfoAuxCVS #1#2\relax#3#4{%
- \gdef\fileversion{#3}%
- \gdef\filedate{#2}%
- \gdef\filedescription{#4}%
- \ProvidesPackage{#1}[#2 v#3 #4]%
-}
-\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{%
- \gdef\fileversion{#5}%
- \gdef\filedate{#2/#3/#4}%
- \gdef\filedescription{#6}%
- \ProvidesPackage{#1}[#2/#3/#4 v#5 #6]
-}
-\def\GetIdInfoMissing#1{%
- \gdef\fileversion{000}%
- \gdef\filedate{0000/00/00}%
- \gdef\filedescription{#1}%
- \ProvidesPackage{[unknown package]}[0000/00/00 v0.0 #1]
-}
-%</package>
-%<*driver>
-\RequirePackage{l3names}
-%</driver>
-%\fi
-\GetIdInfo$Id: l3names.dtx 2122 2011-01-08 09:14:28Z joseph $
- {L3 Experimental Naming Scheme for TeX Primitives}
-%\iffalse
-%<package>\endgroup
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3names} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% A systematic naming scheme for \TeX}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \section{Setting up the \LaTeX3 programming language}
-%
-% This module is at the core of the \LaTeX3 programming language. It
-% performs the following tasks:
-% \begin{itemize}
-% \item defines new names for all \TeX{} primitives;
-% \item defines catcode regimes for programming;
-% \item provides settings for when the code is used in a format;
-% \item provides tools for when the code is used as a package within a
-% \LaTeXe\ context.
-% \end{itemize}
-%
-% \section{Using the modules}
-%
-% The modules documented in \file{source3} are designed to be used on top of
-% \LaTeXe\ and are loaded all as one with the usual "\usepackage{expl3}" or
-% "\RequirePackage{expl3}" instructions. These modules will also form the
-% basis of the \LaTeX3 format, but work in this area is incomplete and not
-% included in this documentation.
-%
-% As the modules use a coding syntax different from standard
-% \LaTeX\ it provides a few functions for setting it up.
-%
-% \begin{function}{
-% \ExplSyntaxOn |
-% \ExplSyntaxOff
-% }
-% \begin{syntax}
-% "\ExplSyntaxOn" <code> "\ExplSyntaxOff"
-% \end{syntax}
-% Issues a catcode regime where spaces are ignored and colon and
-% underscore are letters. A space character may by input with "~" instead.
-% \end{function}
-%
-% \begin{function}{
-% \ExplSyntaxNamesOn |
-% \ExplSyntaxNamesOff
-% }
-% \begin{syntax}
-% "\ExplSyntaxNamesOn" <code> "\ExplSyntaxNamesOff"
-% \end{syntax}
-% Issues a catcode regime where colon and underscore are letters, but
-% spaces remain the same.
-% \end{function}
-%
-% \begin{function}{
-% \ProvidesExplPackage |
-% \ProvidesExplClass |
-% \ProvidesExplFile
-% }
-% \begin{syntax}
-% "\RequirePackage{expl3}" \\
-% "\ProvidesExplPackage" \Arg{package}
-% \Arg{date} \Arg{version} \Arg{description}
-% \end{syntax}
-% The package "l3names" (this module) provides
-% "\ProvidesExplPackage" which is a wrapper for "\ProvidesPackage"
-% and sets up the \LaTeX3 catcode settings for programming
-% automatically. Similar for the relationship between
-% "\ProvidesExplClass" and "\ProvidesClass". Spaces are not ignored
-% in the arguments of these commands.
-% \end{function}
-%
-% \begin{function}{
-% \GetIdInfo |
-% \filename |
-% \filenameext |
-% \filedate |
-% \fileversion |
-% \filetimestamp |
-% \fileauthor |
-% \filedescription
-% }
-% \begin{syntax}
-% "\RequirePackage{l3names}" \\
-% "\GetIdInfo" "$Id:" <cvs or svn info field> "$" \Arg{description}
-% \end{syntax}
-% Extracts all information from a CVS or SVN field. Spaces are not
-% ignored in these fields. The information pieces are stored in
-% separate control sequences with "\filename" for the part of the
-% file name leading up to the period, "\filenameext" for the
-% extension, "\filedate" for date, "\fileversion" for version,
-% "\filetimestamp" for the time and "\fileauthor" for the author.
-% \end{function}
-%
-% To summarize: Every single package using this syntax should identify
-% itself using one of the above methods. Special care is taken so that
-% every package or class file loaded with "\RequirePackage" or alike
-% are loaded with usual \LaTeX\ catcodes and the \LaTeX3 catcode
-% scheme is reloaded when needed afterwards. See implementation for
-% details. If you use the "\GetIdInfo" command you can use the
-% information when loading a package with
-% \begin{verbatim}
-% \ProvidesExplPackage{\filename}{\filedate}{\fileversion}{\filedescription}
-% \end{verbatim}
-%
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3names} implementation}
-%
-% This is the base part of \LaTeX3 defining things like |catcode|s
-% and redefining the \TeX{} primitives, as well as setting up the code
-% to load \pkg{expl3} modules in \LaTeXe.
-%
-% \subsection{Internal functions}
-%
-% \begin{function}{ \ExplSyntaxStatus | \ExplSyntaxPopStack | \ExplSyntaxStack }
-% Functions used to track the state of the catcode regime.
-% \end{function}
-%
-% \begin{function}{\@pushfilename | \@popfilename}
-% Re-definitions of \LaTeX's file-loading functions to support "\ExplSyntax".
-% \end{function}
-%
-%\subsection{Bootstrap code}
-%
-% The very first thing to do is to bootstrap the \IniTeX\ system so
-% that everything else will actually work. \TeX\ does not start with
-% some pretty basic character codes set up.
-% \begin{macrocode}
-%<*!package>
-\catcode `\{ = 1 \relax
-\catcode `\} = 2 \relax
-\catcode `\# = 6 \relax
-\catcode `\^ = 7 \relax
-%</!package>
-% \end{macrocode}
-%
-% Tab characters should not show up in the code, but to be on the
-% safe side.
-% \begin{macrocode}
-%<*!package>
-\catcode `\^^I = 10 \relax
-%</!package>
-% \end{macrocode}
-%
-% For \LuaTeX\ the extra primitives need to be enabled before
-% they can be use. No \cs{ifdefined} yet, so do it the old-fashioned
-% way. The primitive \cs{strcmp} is simulated using some \Lua\
-% code, which currently has to be applied to every job as the \Lua\
-% code is not part of the format. Thanks to Taco Hoekwater for this
-% code. The odd \cs{csname} business is needed so that the later
-% deletion code will work.
-% \begin{macrocode}
-%<*!package>
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname directlua\endcsname\relax
-\else
- \directlua
- {
- tex.enableprimitives('',tex.extraprimitives ())
- lua.bytecode[1] = function ()
- function strcmp (A, B)
- if A == B then
- tex.write("0")
- elseif A < B then
- tex.write("-1")
- else
- tex.write("1")
- end
- end
- end
- lua.bytecode[1]()
- }
- \everyjob\expandafter
- {\csname tex_directlua:D\endcsname{lua.bytecode[1]()}}
- \long\edef\pdfstrcmp#1#2%
- {%
- \expandafter\noexpand\csname tex_directlua:D\endcsname
- {%
- strcmp(%
- "\noexpand\luaescapestring{#1}",%
- "\noexpand\luaescapestring{#2}"%
- )%
- }%
- }
-\fi
-%</!package>
-% \end{macrocode}
-% When loaded as a package this can all be handed off to other
-% \LaTeXe\ code.
-% \begin{macrocode}
-%<*package>
-\def\@tempa{%
- \def\@tempa{}%
- \RequirePackage{luatex}%
- \RequirePackage{pdftexcmds}%
- \let\pdfstrcmp\pdf@strcmp
-}
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname directlua\endcsname\relax
-\else
- \expandafter\@tempa
-\fi
-%</package>
-% \end{macrocode}
-%
-% \XeTeX\ calls the primitive \cs{strcmp}, so there needs to be a
-% check for that too.
-% \begin{macrocode}
-\begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname pdfstrcmp\endcsname\relax
- \let\pdfstrcmp\strcmp
-\fi
-% \end{macrocode}
-%
-%\subsection{Requirements}
-%
-% Currently, the code requires the \eTeX\ primitives and functionality
-% equivalent to \cs{pdfstrcmp}. Any package which provides the later
-% will provide the former, so the test can be done only for
-% \cs{pdfstrcmp}.
-% \begin{macrocode}
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname pdfstrcmp\endcsname\relax
-%<*package>
- \PackageError{l3names}{Required primitive not found: \protect\pdfstrcmp}
- {%
- LaTeX3 requires the e-TeX primitives and
- \string\pdfstrcmp.\MessageBreak
- These are available in engine versions: \MessageBreak
- - pdfTeX 1.30 \MessageBreak
- - XeTeX 0.9994 \MessageBreak
- - LuaTeX 0.60 \MessageBreak
- or later. \MessageBreak
- \MessageBreak
- Loading of l3names will abort!
- }
-%</package>
-%<*!package>
- \newlinechar`\^^J\relax
- \errhelp{%
- LaTeX3 requires the e-TeX primitives and
- \string\pdfstrcmp. ^^J
- These are available in engine versions: ^^J
- - pdfTeX 1.30 ^^J
- - XeTeX 0.9994 ^^J
- - LuaTeX 0.60 ^^J
- or later. ^^J
- For pdfTeX and XeTeX the '-etex' command-line switch is also
- needed.^^J
- ^^J
- Format building will abort!
- }
-%</!package>
- \expandafter\endinput
-\fi
-% \end{macrocode}
-%
-% \subsection{Catcode assignments}
-%
-% Catcodes for begingroup, endgroup, macro parameter, superscript, and tab,
-% are all assigned before the start of the documented code. (See the beginning
-% of \file{l3names.dtx}.)
-%
-% Reason for |\endlinechar=32| is that a line ending with a backslash
-% will be interpreted as the token \verb*|\ | which seems most natural
-% and since spaces are ignored it works as we intend elsewhere.
-%
-% Before we do this we must however record the settings for the
-% catcode regime as it was when we start changing it.
-% \begin{macrocode}
-%<*initex|package>
-\protected\edef\ExplSyntaxOff{
- \unexpanded{\ifodd \ExplSyntaxStatus\relax
- \def\ExplSyntaxStatus{0}
- }
- \catcode 126=\the \catcode 126 \relax
- \catcode 32=\the \catcode 32 \relax
- \catcode 9=\the \catcode 9 \relax
- \endlinechar =\the \endlinechar \relax
- \catcode 95=\the \catcode 95 \relax
- \catcode 58=\the \catcode 58 \relax
- \catcode 124=\the \catcode 124 \relax
- \catcode 38=\the \catcode 38 \relax
- \catcode 94=\the \catcode 94 \relax
- \catcode 34=\the \catcode 34 \relax
- \noexpand\fi
-}
-\catcode126=10\relax % tilde is a space char.
-\catcode32=9\relax % space is ignored
-\catcode9=9\relax % tab also ignored
-\endlinechar=32\relax % endline is space
-\catcode95=11\relax % underscore letter
-\catcode58=11\relax % colon letter
-\catcode124=12\relax % vert bar, other
-\catcode38=4\relax % ampersand, alignment token
-\catcode34=12\relax % doublequote, other
-\catcode94=7\relax % caret, math superscript
-% \end{macrocode}
-%
-% \subsection{Setting up primitive names}
-%
-% Here is the function that renames \TeX{}'s primitives.
-%
-% Normally the old name is left untouched, but the possibility of
-% undefining the original names is made available by docstrip and
-% package options.
-% If nothing else, this gives a way of checking what `old code' a
-% package depends on\ldots\
-%
-% If the package option `removeoldnames' is used then some trick code
-% is run after the end of this file, to skip past the code which has
-% been inserted by \LaTeXe\ to manage the file name stack, this code
-% would break if run once the \TeX\ primitives have been undefined.
-% (What a surprise!) \textbf{The option has been temporarily
-% disabled.}
-%
-% To get things started, give a new name for |\let|.
-% \begin{macrocode}
-\let \tex_let:D \let
-%</initex|package>
-% \end{macrocode}
-%
-% and now an internal function to possibly
-% remove the old name: for the moment.
-%
-% \begin{macrocode}
-%<*initex>
-\long \def \name_undefine:N #1 {
- \tex_let:D #1 \c_undefined
-}
-%</initex>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%<*package>
-\DeclareOption{removeoldnames}{
- \long\def\name_undefine:N#1{
- \tex_let:D#1\c_undefined}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareOption{keepoldnames}{
- \long\def\name_undefine:N#1{}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\ExecuteOptions{keepoldnames}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\ProcessOptions
-%</package>
-% \end{macrocode}
-%
-% The internal function to give the new name and possibly undefine
-% the old name.
-% \begin{macrocode}
-%<*initex|package>
-\long \def \name_primitive:NN #1#2 {
- \tex_let:D #2 #1
- \name_undefine:N #1
-}
-% \end{macrocode}
-%
-% \subsection{Reassignment of primitives}
-%
-% In the current incarnation of this package, all \TeX\ primitives
-% are given a new name of the form |\tex_|\emph{oldname}|:D|.
-% But first three special cases which have symbolic original names.
-% These are given modified new names, so that they may be entered
-% without catcode tricks.
-% \begin{macrocode}
-\name_primitive:NN \ \tex_space:D
-\name_primitive:NN \/ \tex_italiccor:D
-\name_primitive:NN \- \tex_hyphen:D
-% \end{macrocode}
-%
-% Now all the other primitives.
-% \begin{macrocode}
-\name_primitive:NN \let \tex_let:D
-\name_primitive:NN \def \tex_def:D
-\name_primitive:NN \edef \tex_edef:D
-\name_primitive:NN \gdef \tex_gdef:D
-\name_primitive:NN \xdef \tex_xdef:D
-\name_primitive:NN \chardef \tex_chardef:D
-\name_primitive:NN \countdef \tex_countdef:D
-\name_primitive:NN \dimendef \tex_dimendef:D
-\name_primitive:NN \skipdef \tex_skipdef:D
-\name_primitive:NN \muskipdef \tex_muskipdef:D
-\name_primitive:NN \mathchardef \tex_mathchardef:D
-\name_primitive:NN \toksdef \tex_toksdef:D
-\name_primitive:NN \futurelet \tex_futurelet:D
-\name_primitive:NN \advance \tex_advance:D
-\name_primitive:NN \divide \tex_divide:D
-\name_primitive:NN \multiply \tex_multiply:D
-\name_primitive:NN \font \tex_font:D
-\name_primitive:NN \fam \tex_fam:D
-\name_primitive:NN \global \tex_global:D
-\name_primitive:NN \long \tex_long:D
-\name_primitive:NN \outer \tex_outer:D
-\name_primitive:NN \setlanguage \tex_setlanguage:D
-\name_primitive:NN \globaldefs \tex_globaldefs:D
-\name_primitive:NN \afterassignment \tex_afterassignment:D
-\name_primitive:NN \aftergroup \tex_aftergroup:D
-\name_primitive:NN \expandafter \tex_expandafter:D
-\name_primitive:NN \noexpand \tex_noexpand:D
-\name_primitive:NN \begingroup \tex_begingroup:D
-\name_primitive:NN \endgroup \tex_endgroup:D
-\name_primitive:NN \halign \tex_halign:D
-\name_primitive:NN \valign \tex_valign:D
-\name_primitive:NN \cr \tex_cr:D
-\name_primitive:NN \crcr \tex_crcr:D
-\name_primitive:NN \noalign \tex_noalign:D
-\name_primitive:NN \omit \tex_omit:D
-\name_primitive:NN \span \tex_span:D
-\name_primitive:NN \tabskip \tex_tabskip:D
-\name_primitive:NN \everycr \tex_everycr:D
-\name_primitive:NN \if \tex_if:D
-\name_primitive:NN \ifcase \tex_ifcase:D
-\name_primitive:NN \ifcat \tex_ifcat:D
-\name_primitive:NN \ifnum \tex_ifnum:D
-\name_primitive:NN \ifodd \tex_ifodd:D
-\name_primitive:NN \ifdim \tex_ifdim:D
-\name_primitive:NN \ifeof \tex_ifeof:D
-\name_primitive:NN \ifhbox \tex_ifhbox:D
-\name_primitive:NN \ifvbox \tex_ifvbox:D
-\name_primitive:NN \ifvoid \tex_ifvoid:D
-\name_primitive:NN \ifx \tex_ifx:D
-\name_primitive:NN \iffalse \tex_iffalse:D
-\name_primitive:NN \iftrue \tex_iftrue:D
-\name_primitive:NN \ifhmode \tex_ifhmode:D
-\name_primitive:NN \ifmmode \tex_ifmmode:D
-\name_primitive:NN \ifvmode \tex_ifvmode:D
-\name_primitive:NN \ifinner \tex_ifinner:D
-\name_primitive:NN \else \tex_else:D
-\name_primitive:NN \fi \tex_fi:D
-\name_primitive:NN \or \tex_or:D
-\name_primitive:NN \immediate \tex_immediate:D
-\name_primitive:NN \closeout \tex_closeout:D
-\name_primitive:NN \openin \tex_openin:D
-\name_primitive:NN \openout \tex_openout:D
-\name_primitive:NN \read \tex_read:D
-\name_primitive:NN \write \tex_write:D
-\name_primitive:NN \closein \tex_closein:D
-\name_primitive:NN \newlinechar \tex_newlinechar:D
-\name_primitive:NN \input \tex_input:D
-\name_primitive:NN \endinput \tex_endinput:D
-\name_primitive:NN \inputlineno \tex_inputlineno:D
-\name_primitive:NN \errmessage \tex_errmessage:D
-\name_primitive:NN \message \tex_message:D
-\name_primitive:NN \show \tex_show:D
-\name_primitive:NN \showthe \tex_showthe:D
-\name_primitive:NN \showbox \tex_showbox:D
-\name_primitive:NN \showlists \tex_showlists:D
-\name_primitive:NN \errhelp \tex_errhelp:D
-\name_primitive:NN \errorcontextlines \tex_errorcontextlines:D
-\name_primitive:NN \tracingcommands \tex_tracingcommands:D
-\name_primitive:NN \tracinglostchars \tex_tracinglostchars:D
-\name_primitive:NN \tracingmacros \tex_tracingmacros:D
-\name_primitive:NN \tracingonline \tex_tracingonline:D
-\name_primitive:NN \tracingoutput \tex_tracingoutput:D
-\name_primitive:NN \tracingpages \tex_tracingpages:D
-\name_primitive:NN \tracingparagraphs \tex_tracingparagraphs:D
-\name_primitive:NN \tracingrestores \tex_tracingrestores:D
-\name_primitive:NN \tracingstats \tex_tracingstats:D
-\name_primitive:NN \pausing \tex_pausing:D
-\name_primitive:NN \showboxbreadth \tex_showboxbreadth:D
-\name_primitive:NN \showboxdepth \tex_showboxdepth:D
-\name_primitive:NN \batchmode \tex_batchmode:D
-\name_primitive:NN \errorstopmode \tex_errorstopmode:D
-\name_primitive:NN \nonstopmode \tex_nonstopmode:D
-\name_primitive:NN \scrollmode \tex_scrollmode:D
-\name_primitive:NN \end \tex_end:D
-\name_primitive:NN \csname \tex_csname:D
-\name_primitive:NN \endcsname \tex_endcsname:D
-\name_primitive:NN \ignorespaces \tex_ignorespaces:D
-\name_primitive:NN \relax \tex_relax:D
-\name_primitive:NN \the \tex_the:D
-\name_primitive:NN \mag \tex_mag:D
-\name_primitive:NN \language \tex_language:D
-\name_primitive:NN \mark \tex_mark:D
-\name_primitive:NN \topmark \tex_topmark:D
-\name_primitive:NN \firstmark \tex_firstmark:D
-\name_primitive:NN \botmark \tex_botmark:D
-\name_primitive:NN \splitfirstmark \tex_splitfirstmark:D
-\name_primitive:NN \splitbotmark \tex_splitbotmark:D
-\name_primitive:NN \fontname \tex_fontname:D
-\name_primitive:NN \escapechar \tex_escapechar:D
-\name_primitive:NN \endlinechar \tex_endlinechar:D
-\name_primitive:NN \mathchoice \tex_mathchoice:D
-\name_primitive:NN \delimiter \tex_delimiter:D
-\name_primitive:NN \mathaccent \tex_mathaccent:D
-\name_primitive:NN \mathchar \tex_mathchar:D
-\name_primitive:NN \mskip \tex_mskip:D
-\name_primitive:NN \radical \tex_radical:D
-\name_primitive:NN \vcenter \tex_vcenter:D
-\name_primitive:NN \mkern \tex_mkern:D
-\name_primitive:NN \above \tex_above:D
-\name_primitive:NN \abovewithdelims \tex_abovewithdelims:D
-\name_primitive:NN \atop \tex_atop:D
-\name_primitive:NN \atopwithdelims \tex_atopwithdelims:D
-\name_primitive:NN \over \tex_over:D
-\name_primitive:NN \overwithdelims \tex_overwithdelims:D
-\name_primitive:NN \displaystyle \tex_displaystyle:D
-\name_primitive:NN \textstyle \tex_textstyle:D
-\name_primitive:NN \scriptstyle \tex_scriptstyle:D
-\name_primitive:NN \scriptscriptstyle \tex_scriptscriptstyle:D
-\name_primitive:NN \nonscript \tex_nonscript:D
-\name_primitive:NN \eqno \tex_eqno:D
-\name_primitive:NN \leqno \tex_leqno:D
-\name_primitive:NN \abovedisplayshortskip \tex_abovedisplayshortskip:D
-\name_primitive:NN \abovedisplayskip \tex_abovedisplayskip:D
-\name_primitive:NN \belowdisplayshortskip \tex_belowdisplayshortskip:D
-\name_primitive:NN \belowdisplayskip \tex_belowdisplayskip:D
-\name_primitive:NN \displaywidowpenalty \tex_displaywidowpenalty:D
-\name_primitive:NN \displayindent \tex_displayindent:D
-\name_primitive:NN \displaywidth \tex_displaywidth:D
-\name_primitive:NN \everydisplay \tex_everydisplay:D
-\name_primitive:NN \predisplaysize \tex_predisplaysize:D
-\name_primitive:NN \predisplaypenalty \tex_predisplaypenalty:D
-\name_primitive:NN \postdisplaypenalty \tex_postdisplaypenalty:D
-\name_primitive:NN \mathbin \tex_mathbin:D
-\name_primitive:NN \mathclose \tex_mathclose:D
-\name_primitive:NN \mathinner \tex_mathinner:D
-\name_primitive:NN \mathop \tex_mathop:D
-\name_primitive:NN \displaylimits \tex_displaylimits:D
-\name_primitive:NN \limits \tex_limits:D
-\name_primitive:NN \nolimits \tex_nolimits:D
-\name_primitive:NN \mathopen \tex_mathopen:D
-\name_primitive:NN \mathord \tex_mathord:D
-\name_primitive:NN \mathpunct \tex_mathpunct:D
-\name_primitive:NN \mathrel \tex_mathrel:D
-\name_primitive:NN \overline \tex_overline:D
-\name_primitive:NN \underline \tex_underline:D
-\name_primitive:NN \left \tex_left:D
-\name_primitive:NN \right \tex_right:D
-\name_primitive:NN \binoppenalty \tex_binoppenalty:D
-\name_primitive:NN \relpenalty \tex_relpenalty:D
-\name_primitive:NN \delimitershortfall \tex_delimitershortfall:D
-\name_primitive:NN \delimiterfactor \tex_delimiterfactor:D
-\name_primitive:NN \nulldelimiterspace \tex_nulldelimiterspace:D
-\name_primitive:NN \everymath \tex_everymath:D
-\name_primitive:NN \mathsurround \tex_mathsurround:D
-\name_primitive:NN \medmuskip \tex_medmuskip:D
-\name_primitive:NN \thinmuskip \tex_thinmuskip:D
-\name_primitive:NN \thickmuskip \tex_thickmuskip:D
-\name_primitive:NN \scriptspace \tex_scriptspace:D
-\name_primitive:NN \noboundary \tex_noboundary:D
-\name_primitive:NN \accent \tex_accent:D
-\name_primitive:NN \char \tex_char:D
-\name_primitive:NN \discretionary \tex_discretionary:D
-\name_primitive:NN \hfil \tex_hfil:D
-\name_primitive:NN \hfilneg \tex_hfilneg:D
-\name_primitive:NN \hfill \tex_hfill:D
-\name_primitive:NN \hskip \tex_hskip:D
-\name_primitive:NN \hss \tex_hss:D
-\name_primitive:NN \vfil \tex_vfil:D
-\name_primitive:NN \vfilneg \tex_vfilneg:D
-\name_primitive:NN \vfill \tex_vfill:D
-\name_primitive:NN \vskip \tex_vskip:D
-\name_primitive:NN \vss \tex_vss:D
-\name_primitive:NN \unskip \tex_unskip:D
-\name_primitive:NN \kern \tex_kern:D
-\name_primitive:NN \unkern \tex_unkern:D
-\name_primitive:NN \hrule \tex_hrule:D
-\name_primitive:NN \vrule \tex_vrule:D
-\name_primitive:NN \leaders \tex_leaders:D
-\name_primitive:NN \cleaders \tex_cleaders:D
-\name_primitive:NN \xleaders \tex_xleaders:D
-\name_primitive:NN \lastkern \tex_lastkern:D
-\name_primitive:NN \lastskip \tex_lastskip:D
-\name_primitive:NN \indent \tex_indent:D
-\name_primitive:NN \par \tex_par:D
-\name_primitive:NN \noindent \tex_noindent:D
-\name_primitive:NN \vadjust \tex_vadjust:D
-\name_primitive:NN \baselineskip \tex_baselineskip:D
-\name_primitive:NN \lineskip \tex_lineskip:D
-\name_primitive:NN \lineskiplimit \tex_lineskiplimit:D
-\name_primitive:NN \clubpenalty \tex_clubpenalty:D
-\name_primitive:NN \widowpenalty \tex_widowpenalty:D
-\name_primitive:NN \exhyphenpenalty \tex_exhyphenpenalty:D
-\name_primitive:NN \hyphenpenalty \tex_hyphenpenalty:D
-\name_primitive:NN \linepenalty \tex_linepenalty:D
-\name_primitive:NN \doublehyphendemerits \tex_doublehyphendemerits:D
-\name_primitive:NN \finalhyphendemerits \tex_finalhyphendemerits:D
-\name_primitive:NN \adjdemerits \tex_adjdemerits:D
-\name_primitive:NN \hangafter \tex_hangafter:D
-\name_primitive:NN \hangindent \tex_hangindent:D
-\name_primitive:NN \parshape \tex_parshape:D
-\name_primitive:NN \hsize \tex_hsize:D
-\name_primitive:NN \lefthyphenmin \tex_lefthyphenmin:D
-\name_primitive:NN \righthyphenmin \tex_righthyphenmin:D
-\name_primitive:NN \leftskip \tex_leftskip:D
-\name_primitive:NN \rightskip \tex_rightskip:D
-\name_primitive:NN \looseness \tex_looseness:D
-\name_primitive:NN \parskip \tex_parskip:D
-\name_primitive:NN \parindent \tex_parindent:D
-\name_primitive:NN \uchyph \tex_uchyph:D
-\name_primitive:NN \emergencystretch \tex_emergencystretch:D
-\name_primitive:NN \pretolerance \tex_pretolerance:D
-\name_primitive:NN \tolerance \tex_tolerance:D
-\name_primitive:NN \spaceskip \tex_spaceskip:D
-\name_primitive:NN \xspaceskip \tex_xspaceskip:D
-\name_primitive:NN \parfillskip \tex_parfillskip:D
-\name_primitive:NN \everypar \tex_everypar:D
-\name_primitive:NN \prevgraf \tex_prevgraf:D
-\name_primitive:NN \spacefactor \tex_spacefactor:D
-\name_primitive:NN \shipout \tex_shipout:D
-\name_primitive:NN \vsize \tex_vsize:D
-\name_primitive:NN \interlinepenalty \tex_interlinepenalty:D
-\name_primitive:NN \brokenpenalty \tex_brokenpenalty:D
-\name_primitive:NN \topskip \tex_topskip:D
-\name_primitive:NN \maxdeadcycles \tex_maxdeadcycles:D
-\name_primitive:NN \maxdepth \tex_maxdepth:D
-\name_primitive:NN \output \tex_output:D
-\name_primitive:NN \deadcycles \tex_deadcycles:D
-\name_primitive:NN \pagedepth \tex_pagedepth:D
-\name_primitive:NN \pagestretch \tex_pagestretch:D
-\name_primitive:NN \pagefilstretch \tex_pagefilstretch:D
-\name_primitive:NN \pagefillstretch \tex_pagefillstretch:D
-\name_primitive:NN \pagefilllstretch \tex_pagefilllstretch:D
-\name_primitive:NN \pageshrink \tex_pageshrink:D
-\name_primitive:NN \pagegoal \tex_pagegoal:D
-\name_primitive:NN \pagetotal \tex_pagetotal:D
-\name_primitive:NN \outputpenalty \tex_outputpenalty:D
-\name_primitive:NN \hoffset \tex_hoffset:D
-\name_primitive:NN \voffset \tex_voffset:D
-\name_primitive:NN \insert \tex_insert:D
-\name_primitive:NN \holdinginserts \tex_holdinginserts:D
-\name_primitive:NN \floatingpenalty \tex_floatingpenalty:D
-\name_primitive:NN \insertpenalties \tex_insertpenalties:D
-\name_primitive:NN \lower \tex_lower:D
-\name_primitive:NN \moveleft \tex_moveleft:D
-\name_primitive:NN \moveright \tex_moveright:D
-\name_primitive:NN \raise \tex_raise:D
-\name_primitive:NN \copy \tex_copy:D
-\name_primitive:NN \lastbox \tex_lastbox:D
-\name_primitive:NN \vsplit \tex_vsplit:D
-\name_primitive:NN \unhbox \tex_unhbox:D
-\name_primitive:NN \unhcopy \tex_unhcopy:D
-\name_primitive:NN \unvbox \tex_unvbox:D
-\name_primitive:NN \unvcopy \tex_unvcopy:D
-\name_primitive:NN \setbox \tex_setbox:D
-\name_primitive:NN \hbox \tex_hbox:D
-\name_primitive:NN \vbox \tex_vbox:D
-\name_primitive:NN \vtop \tex_vtop:D
-\name_primitive:NN \prevdepth \tex_prevdepth:D
-\name_primitive:NN \badness \tex_badness:D
-\name_primitive:NN \hbadness \tex_hbadness:D
-\name_primitive:NN \vbadness \tex_vbadness:D
-\name_primitive:NN \hfuzz \tex_hfuzz:D
-\name_primitive:NN \vfuzz \tex_vfuzz:D
-\name_primitive:NN \overfullrule \tex_overfullrule:D
-\name_primitive:NN \boxmaxdepth \tex_boxmaxdepth:D
-\name_primitive:NN \splitmaxdepth \tex_splitmaxdepth:D
-\name_primitive:NN \splittopskip \tex_splittopskip:D
-\name_primitive:NN \everyhbox \tex_everyhbox:D
-\name_primitive:NN \everyvbox \tex_everyvbox:D
-\name_primitive:NN \nullfont \tex_nullfont:D
-\name_primitive:NN \textfont \tex_textfont:D
-\name_primitive:NN \scriptfont \tex_scriptfont:D
-\name_primitive:NN \scriptscriptfont \tex_scriptscriptfont:D
-\name_primitive:NN \fontdimen \tex_fontdimen:D
-\name_primitive:NN \hyphenchar \tex_hyphenchar:D
-\name_primitive:NN \skewchar \tex_skewchar:D
-\name_primitive:NN \defaulthyphenchar \tex_defaulthyphenchar:D
-\name_primitive:NN \defaultskewchar \tex_defaultskewchar:D
-\name_primitive:NN \number \tex_number:D
-\name_primitive:NN \romannumeral \tex_romannumeral:D
-\name_primitive:NN \string \tex_string:D
-\name_primitive:NN \lowercase \tex_lowercase:D
-\name_primitive:NN \uppercase \tex_uppercase:D
-\name_primitive:NN \meaning \tex_meaning:D
-\name_primitive:NN \penalty \tex_penalty:D
-\name_primitive:NN \unpenalty \tex_unpenalty:D
-\name_primitive:NN \lastpenalty \tex_lastpenalty:D
-\name_primitive:NN \special \tex_special:D
-\name_primitive:NN \dump \tex_dump:D
-\name_primitive:NN \patterns \tex_patterns:D
-\name_primitive:NN \hyphenation \tex_hyphenation:D
-\name_primitive:NN \time \tex_time:D
-\name_primitive:NN \day \tex_day:D
-\name_primitive:NN \month \tex_month:D
-\name_primitive:NN \year \tex_year:D
-\name_primitive:NN \jobname \tex_jobname:D
-\name_primitive:NN \everyjob \tex_everyjob:D
-\name_primitive:NN \count \tex_count:D
-\name_primitive:NN \dimen \tex_dimen:D
-\name_primitive:NN \skip \tex_skip:D
-\name_primitive:NN \toks \tex_toks:D
-\name_primitive:NN \muskip \tex_muskip:D
-\name_primitive:NN \box \tex_box:D
-\name_primitive:NN \wd \tex_wd:D
-\name_primitive:NN \ht \tex_ht:D
-\name_primitive:NN \dp \tex_dp:D
-\name_primitive:NN \catcode \tex_catcode:D
-\name_primitive:NN \delcode \tex_delcode:D
-\name_primitive:NN \sfcode \tex_sfcode:D
-\name_primitive:NN \lccode \tex_lccode:D
-\name_primitive:NN \uccode \tex_uccode:D
-\name_primitive:NN \mathcode \tex_mathcode:D
-% \end{macrocode}
-%
-%
-%
-%
-% Since \LaTeX3 requires at least the \eTeX{} extensions,
-% we also rename the additional primitives. These are all
-% given the prefix |\etex_|.
-% \begin{macrocode}
-\name_primitive:NN \ifdefined \etex_ifdefined:D
-\name_primitive:NN \ifcsname \etex_ifcsname:D
-\name_primitive:NN \unless \etex_unless:D
-\name_primitive:NN \eTeXversion \etex_eTeXversion:D
-\name_primitive:NN \eTeXrevision \etex_eTeXrevision:D
-\name_primitive:NN \marks \etex_marks:D
-\name_primitive:NN \topmarks \etex_topmarks:D
-\name_primitive:NN \firstmarks \etex_firstmarks:D
-\name_primitive:NN \botmarks \etex_botmarks:D
-\name_primitive:NN \splitfirstmarks \etex_splitfirstmarks:D
-\name_primitive:NN \splitbotmarks \etex_splitbotmarks:D
-\name_primitive:NN \unexpanded \etex_unexpanded:D
-\name_primitive:NN \detokenize \etex_detokenize:D
-\name_primitive:NN \scantokens \etex_scantokens:D
-\name_primitive:NN \showtokens \etex_showtokens:D
-\name_primitive:NN \readline \etex_readline:D
-\name_primitive:NN \tracingassigns \etex_tracingassigns:D
-\name_primitive:NN \tracingscantokens \etex_tracingscantokens:D
-\name_primitive:NN \tracingnesting \etex_tracingnesting:D
-\name_primitive:NN \tracingifs \etex_tracingifs:D
-\name_primitive:NN \currentiflevel \etex_currentiflevel:D
-\name_primitive:NN \currentifbranch \etex_currentifbranch:D
-\name_primitive:NN \currentiftype \etex_currentiftype:D
-\name_primitive:NN \tracinggroups \etex_tracinggroups:D
-\name_primitive:NN \currentgrouplevel \etex_currentgrouplevel:D
-\name_primitive:NN \currentgrouptype \etex_currentgrouptype:D
-\name_primitive:NN \showgroups \etex_showgroups:D
-\name_primitive:NN \showifs \etex_showifs:D
-\name_primitive:NN \interactionmode \etex_interactionmode:D
-\name_primitive:NN \lastnodetype \etex_lastnodetype:D
-\name_primitive:NN \iffontchar \etex_iffontchar:D
-\name_primitive:NN \fontcharht \etex_fontcharht:D
-\name_primitive:NN \fontchardp \etex_fontchardp:D
-\name_primitive:NN \fontcharwd \etex_fontcharwd:D
-\name_primitive:NN \fontcharic \etex_fontcharic:D
-\name_primitive:NN \parshapeindent \etex_parshapeindent:D
-\name_primitive:NN \parshapelength \etex_parshapelength:D
-\name_primitive:NN \parshapedimen \etex_parshapedimen:D
-\name_primitive:NN \numexpr \etex_numexpr:D
-\name_primitive:NN \dimexpr \etex_dimexpr:D
-\name_primitive:NN \glueexpr \etex_glueexpr:D
-\name_primitive:NN \muexpr \etex_muexpr:D
-\name_primitive:NN \gluestretch \etex_gluestretch:D
-\name_primitive:NN \glueshrink \etex_glueshrink:D
-\name_primitive:NN \gluestretchorder \etex_gluestretchorder:D
-\name_primitive:NN \glueshrinkorder \etex_glueshrinkorder:D
-\name_primitive:NN \gluetomu \etex_gluetomu:D
-\name_primitive:NN \mutoglue \etex_mutoglue:D
-\name_primitive:NN \lastlinefit \etex_lastlinefit:D
-\name_primitive:NN \interlinepenalties \etex_interlinepenalties:D
-\name_primitive:NN \clubpenalties \etex_clubpenalties:D
-\name_primitive:NN \widowpenalties \etex_widowpenalties:D
-\name_primitive:NN \displaywidowpenalties \etex_displaywidowpenalties:D
-\name_primitive:NN \middle \etex_middle:D
-\name_primitive:NN \savinghyphcodes \etex_savinghyphcodes:D
-\name_primitive:NN \savingvdiscards \etex_savingvdiscards:D
-\name_primitive:NN \pagediscards \etex_pagediscards:D
-\name_primitive:NN \splitdiscards \etex_splitdiscards:D
-\name_primitive:NN \TeXXETstate \etex_TeXXETstate:D
-\name_primitive:NN \beginL \etex_beginL:D
-\name_primitive:NN \endL \etex_endL:D
-\name_primitive:NN \beginR \etex_beginR:D
-\name_primitive:NN \endR \etex_endR:D
-\name_primitive:NN \predisplaydirection \etex_predisplaydirection:D
-\name_primitive:NN \everyeof \etex_everyeof:D
-\name_primitive:NN \protected \etex_protected:D
-% \end{macrocode}
-%
-%
-% All major distributions use
-% pdf\eTeX{} as engine so we add these names as well. Since the
-% pdf\TeX{} team has been very good at prefixing most primitives
-% with |pdf| (so far only five do not start with |pdf|) we do not
-% give then a double |pdf| prefix. The list below covers pdf\TeX
-% v~1.30.4.
-% \begin{macrocode}
-%% integer registers:
-\name_primitive:NN \pdfoutput \pdf_output:D
-\name_primitive:NN \pdfminorversion \pdf_minorversion:D
-\name_primitive:NN \pdfcompresslevel \pdf_compresslevel:D
-\name_primitive:NN \pdfdecimaldigits \pdf_decimaldigits:D
-\name_primitive:NN \pdfimageresolution \pdf_imageresolution:D
-\name_primitive:NN \pdfpkresolution \pdf_pkresolution:D
-\name_primitive:NN \pdftracingfonts \pdf_tracingfonts:D
-\name_primitive:NN \pdfuniqueresname \pdf_uniqueresname:D
-\name_primitive:NN \pdfadjustspacing \pdf_adjustspacing:D
-\name_primitive:NN \pdfprotrudechars \pdf_protrudechars:D
-\name_primitive:NN \efcode \pdf_efcode:D
-\name_primitive:NN \lpcode \pdf_lpcode:D
-\name_primitive:NN \rpcode \pdf_rpcode:D
-\name_primitive:NN \pdfforcepagebox \pdf_forcepagebox:D
-\name_primitive:NN \pdfoptionalwaysusepdfpagebox \pdf_optionalwaysusepdfpagebox:D
-\name_primitive:NN \pdfinclusionerrorlevel\pdf_inclusionerrorlevel:D
-\name_primitive:NN \pdfoptionpdfinclusionerrorlevel \pdf_optionpdfinclusionerrorlevel:D
-\name_primitive:NN \pdfimagehicolor \pdf_imagehicolor:D
-\name_primitive:NN \pdfimageapplygamma \pdf_imageapplygamma:D
-\name_primitive:NN \pdfgamma \pdf_gamma:D
-\name_primitive:NN \pdfimagegamma \pdf_imagegamma:D
-%% dimen registers:
-\name_primitive:NN \pdfhorigin \pdf_horigin:D
-\name_primitive:NN \pdfvorigin \pdf_vorigin:D
-\name_primitive:NN \pdfpagewidth \pdf_pagewidth:D
-\name_primitive:NN \pdfpageheight \pdf_pageheight:D
-\name_primitive:NN \pdflinkmargin \pdf_linkmargin:D
-\name_primitive:NN \pdfdestmargin \pdf_destmargin:D
-\name_primitive:NN \pdfthreadmargin \pdf_threadmargin:D
-%% token registers:
-\name_primitive:NN \pdfpagesattr \pdf_pagesattr:D
-\name_primitive:NN \pdfpageattr \pdf_pageattr:D
-\name_primitive:NN \pdfpageresources \pdf_pageresources:D
-\name_primitive:NN \pdfpkmode \pdf_pkmode:D
-%% expandable commands:
-\name_primitive:NN \pdftexrevision \pdf_texrevision:D
-\name_primitive:NN \pdftexbanner \pdf_texbanner:D
-\name_primitive:NN \pdfcreationdate \pdf_creationdate:D
-\name_primitive:NN \pdfpageref \pdf_pageref:D
-\name_primitive:NN \pdfxformname \pdf_xformname:D
-\name_primitive:NN \pdffontname \pdf_fontname:D
-\name_primitive:NN \pdffontobjnum \pdf_fontobjnum:D
-\name_primitive:NN \pdffontsize \pdf_fontsize:D
-\name_primitive:NN \pdfincludechars \pdf_includechars:D
-\name_primitive:NN \leftmarginkern \pdf_leftmarginkern:D
-\name_primitive:NN \rightmarginkern \pdf_rightmarginkern:D
-\name_primitive:NN \pdfescapestring \pdf_escapestring:D
-\name_primitive:NN \pdfescapename \pdf_escapename:D
-\name_primitive:NN \pdfescapehex \pdf_escapehex:D
-\name_primitive:NN \pdfunescapehex \pdf_unescapehex:D
-\name_primitive:NN \pdfstrcmp \pdf_strcmp:D
-\name_primitive:NN \pdfuniformdeviate \pdf_uniformdeviate:D
-\name_primitive:NN \pdfnormaldeviate \pdf_normaldeviate:D
-\name_primitive:NN \pdfmdfivesum \pdf_mdfivesum:D
-\name_primitive:NN \pdffilemoddate \pdf_filemoddate:D
-\name_primitive:NN \pdffilesize \pdf_filesize:D
-\name_primitive:NN \pdffiledump \pdf_filedump:D
-%% read-only integers:
-\name_primitive:NN \pdftexversion \pdf_texversion:D
-\name_primitive:NN \pdflastobj \pdf_lastobj:D
-\name_primitive:NN \pdflastxform \pdf_lastxform:D
-\name_primitive:NN \pdflastximage \pdf_lastximage:D
-\name_primitive:NN \pdflastximagepages \pdf_lastximagepages:D
-\name_primitive:NN \pdflastannot \pdf_lastannot:D
-\name_primitive:NN \pdflastxpos \pdf_lastxpos:D
-\name_primitive:NN \pdflastypos \pdf_lastypos:D
-\name_primitive:NN \pdflastdemerits \pdf_lastdemerits:D
-\name_primitive:NN \pdfelapsedtime \pdf_elapsedtime:D
-\name_primitive:NN \pdfrandomseed \pdf_randomseed:D
-\name_primitive:NN \pdfshellescape \pdf_shellescape:D
-%% general commands:
-\name_primitive:NN \pdfobj \pdf_obj:D
-\name_primitive:NN \pdfrefobj \pdf_refobj:D
-\name_primitive:NN \pdfxform \pdf_xform:D
-\name_primitive:NN \pdfrefxform \pdf_refxform:D
-\name_primitive:NN \pdfximage \pdf_ximage:D
-\name_primitive:NN \pdfrefximage \pdf_refximage:D
-\name_primitive:NN \pdfannot \pdf_annot:D
-\name_primitive:NN \pdfstartlink \pdf_startlink:D
-\name_primitive:NN \pdfendlink \pdf_endlink:D
-\name_primitive:NN \pdfoutline \pdf_outline:D
-\name_primitive:NN \pdfdest \pdf_dest:D
-\name_primitive:NN \pdfthread \pdf_thread:D
-\name_primitive:NN \pdfstartthread \pdf_startthread:D
-\name_primitive:NN \pdfendthread \pdf_endthread:D
-\name_primitive:NN \pdfsavepos \pdf_savepos:D
-\name_primitive:NN \pdfinfo \pdf_info:D
-\name_primitive:NN \pdfcatalog \pdf_catalog:D
-\name_primitive:NN \pdfnames \pdf_names:D
-\name_primitive:NN \pdfmapfile \pdf_mapfile:D
-\name_primitive:NN \pdfmapline \pdf_mapline:D
-\name_primitive:NN \pdffontattr \pdf_fontattr:D
-\name_primitive:NN \pdftrailer \pdf_trailer:D
-\name_primitive:NN \pdffontexpand \pdf_fontexpand:D
-%%\name_primitive:NN \vadjust [<pre spec>] <filler> { <vertical mode material> } (h, m)
-\name_primitive:NN \pdfliteral \pdf_literal:D
-%%\name_primitive:NN \special <pdfspecial spec>
-\name_primitive:NN \pdfresettimer \pdf_resettimer:D
-\name_primitive:NN \pdfsetrandomseed \pdf_setrandomseed:D
-\name_primitive:NN \pdfnoligatures \pdf_noligatures:D
-% \end{macrocode}
-%
-% Only a little bit of \XeTeX\ and Lua\TeX\ at the moment.
-% \begin{macrocode}
-\name_primitive:NN \XeTeXversion \xetex_version:D
-\name_primitive:NN \catcodetable \luatex_catcodetable:D
-\name_primitive:NN \directlua \luatex_directlua:D
-\name_primitive:NN \initcatcodetable \luatex_initcatcodetable:D
-\name_primitive:NN \latelua \luatex_latelua:D
-\name_primitive:NN \savecatcodetable \luatex_savecatcodetable:D
-% \end{macrocode}
-%
-% XeTeX adds \cs{strcmp} to the set of primitives, with the same
-% implementation as \cs{pdfstrcmp} but a different name. To avoid
-% having to worry about this later, the same internal name is used.
-% Note that we want to use the original primitive name here so that
-% |\name_undefine:N| (if used) will remove it.
-% \begin{macrocode}
-\tex_begingroup:D
- \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D
-\tex_endgroup:D
-\tex_expandafter:D \tex_ifx:D \tex_csname:D xetex_version:D\tex_endcsname:D
- \tex_relax:D \tex_else:D
- \name_primitive:NN \strcmp \pdf_strcmp:D
-\tex_fi:D
-% \end{macrocode}
-%
-% \subsection{\pkg{expl3} code switches}
-%
-% \begin{macro}{\ExplSyntaxOn}
-% \begin{macro}{\ExplSyntaxOff}
-% \begin{macro}{\ExplSyntaxStatus}
-% Here we define functions that are used to turn on and off the
-% special conventions used in the kernel of \LaTeX3.
-%
-% First of all, the space, tab and the return characters will all
-% be ignored inside \LaTeX3 code, the latter because endline is set
-% to a space instead. When space characters are needed in \LaTeX3
-% code the |~| character will be used for that purpose.
-%
-% Specification of the desired behavior:
-% \begin{itemize}
-% \item ExplSyntax can be either On or Off.
-% \item The On switch is \meta{null} if ExplSyntax is on.
-% \item The Off switch is \meta{null} if ExplSyntax is off.
-% \item If the On switch is issued and not \meta{null}, it records
-% the current catcode scheme just prior to it being issued.
-% \item An Off switch restores the catcode scheme to what it was just
-% prior to the previous On switch.
-% \end{itemize}
-%
-% \begin{macrocode}
-\etex_protected:D \tex_def:D \ExplSyntaxOn {
- \tex_ifodd:D \ExplSyntaxStatus \tex_relax:D
- \tex_else:D
- \etex_protected:D \tex_edef:D \ExplSyntaxOff {
- \etex_unexpanded:D{
- \tex_ifodd:D \ExplSyntaxStatus \tex_relax:D
- \tex_def:D \ExplSyntaxStatus{0}
- }
- \tex_catcode:D 126=\tex_the:D \tex_catcode:D 126 \tex_relax:D
- \tex_catcode:D 32=\tex_the:D \tex_catcode:D 32 \tex_relax:D
- \tex_catcode:D 9=\tex_the:D \tex_catcode:D 9 \tex_relax:D
- \tex_endlinechar:D =\tex_the:D \tex_endlinechar:D \tex_relax:D
- \tex_catcode:D 95=\tex_the:D \tex_catcode:D 95 \tex_relax:D
- \tex_catcode:D 58=\tex_the:D \tex_catcode:D 58 \tex_relax:D
- \tex_catcode:D 124=\tex_the:D \tex_catcode:D 124 \tex_relax:D
- \tex_catcode:D 38=\tex_the:D \tex_catcode:D 38 \tex_relax:D
- \tex_catcode:D 94=\tex_the:D \tex_catcode:D 94 \tex_relax:D
- \tex_catcode:D 34=\tex_the:D \tex_catcode:D 34 \tex_relax:D
- \tex_noexpand:D \tex_fi:D
- }
- \tex_def:D \ExplSyntaxStatus { 1 }
- \tex_catcode:D 126=10 \tex_relax:D % tilde is a space char.
- \tex_catcode:D 32=9 \tex_relax:D % space is ignored
- \tex_catcode:D 9=9 \tex_relax:D % tab also ignored
- \tex_endlinechar:D =32 \tex_relax:D % endline is space
- \tex_catcode:D 95=11 \tex_relax:D % underscore letter
- \tex_catcode:D 58=11 \tex_relax:D % colon letter
- \tex_catcode:D 124=12 \tex_relax:D % vertical bar, other
- \tex_catcode:D 38=4 \tex_relax:D % ampersand, alignment token
- \tex_catcode:D 94=7 \tex_relax:D % caret, math superscript
- \tex_catcode:D 34=12 \tex_relax:D % doublequote, other
- \tex_fi:D
-}
-% \end{macrocode}
-% At this point we better set the status.
-% \begin{macrocode}
-\tex_def:D \ExplSyntaxStatus { 1 }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\ExplSyntaxNamesOn}
-% \begin{macro}{\ExplSyntaxNamesOff}
-% Sometimes we need to be able to use names from the kernel of
-% \LaTeX3 without adhering it's conventions according to space
-% characters. These macros provide the necessary settings.
-% \begin{macrocode}
-\etex_protected:D \tex_def:D \ExplSyntaxNamesOn {
- \tex_catcode:D `\_=11\tex_relax:D
- \tex_catcode:D `\:=11\tex_relax:D
-}
-\etex_protected:D \tex_def:D \ExplSyntaxNamesOff {
- \tex_catcode:D `\_=8\tex_relax:D
- \tex_catcode:D `\:=12\tex_relax:D
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Package loading}
-%
-%
-% \begin{macro}{\GetIdInfo}
-% \begin{macro}{ \filedescription ,
-% \filename ,
-% \fileversion ,
-% \fileauthor ,
-% \filedate ,
-% \filenameext ,
-% \filetimestamp }
-% \begin{macro}[aux]{\GetIdInfoAuxi:w}
-% \begin{macro}[aux]{\GetIdInfoAuxii:w}
-% \begin{macro}[aux]{\GetIdInfoAuxCVS:w}
-% \begin{macro}[aux]{\GetIdInfoAuxSVN:w}
-% Extract all information from a cvs or svn field. The
-% formats are slightly different but at least the information is in
-% the same positions so we check in the date format so see if it
-% contains a "/" after the four-digit year. If it does it is cvs
-% else svn and we extract information. To be on the safe side we
-% ensure that spaces in the argument are seen.
-% \begin{macrocode}
-\etex_protected:D \tex_def:D \GetIdInfo {
- \tex_begingroup:D
- \tex_catcode:D 32=10 \tex_relax:D % needed? Probably for now.
- \GetIdInfoMaybeMissing:w
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\etex_protected:D \tex_def:D\GetIdInfoMaybeMissing:w$#1$#2{
- \tex_def:D \l_kernel_tmpa_tl {#1}
- \tex_def:D \l_kernel_tmpb_tl {Id}
- \tex_ifx:D \l_kernel_tmpa_tl \l_kernel_tmpb_tl
- \tex_def:D \l_kernel_tmpa_tl {
- \tex_endgroup:D
- \tex_def:D\filedescription{#2}
- \tex_def:D\filename {[unknown~name]}
- \tex_def:D\fileversion {000}
- \tex_def:D\fileauthor {[unknown~author]}
- \tex_def:D\filedate {0000/00/00}
- \tex_def:D\filenameext {[unknown~ext]}
- \tex_def:D\filetimestamp {[unknown~timestamp]}
- }
- \tex_else:D
- \tex_def:D \l_kernel_tmpa_tl {\GetIdInfoAuxi:w$#1${#2}}
- \tex_fi:D
- \l_kernel_tmpa_tl
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\etex_protected:D \tex_def:D\GetIdInfoAuxi:w$#1~#2.#3~#4~#5~#6~#7~#8$#9{
- \tex_endgroup:D
- \tex_def:D\filename{#2}
- \tex_def:D\fileversion{#4}
- \tex_def:D\filedescription{#9}
- \tex_def:D\fileauthor{#7}
- \GetIdInfoAuxii:w #5\tex_relax:D
- #3\tex_relax:D#5\tex_relax:D#6\tex_relax:D
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\etex_protected:D \tex_def:D\GetIdInfoAuxii:w #1#2#3#4#5#6\tex_relax:D{
- \tex_ifx:D#5/
- \tex_expandafter:D\GetIdInfoAuxCVS:w
- \tex_else:D
- \tex_expandafter:D\GetIdInfoAuxSVN:w
- \tex_fi:D
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\etex_protected:D \tex_def:D\GetIdInfoAuxCVS:w #1,v\tex_relax:D
- #2\tex_relax:D#3\tex_relax:D{
- \tex_def:D\filedate{#2}
- \tex_def:D\filenameext{#1}
- \tex_def:D\filetimestamp{#3}
-% \end{macrocode}
-% When creating the format we want the information in the log straight
-% away.
-% \begin{macrocode}
-%<initex>\tex_immediate:D\tex_write:D-1
-%<initex> {\filename;~ v\fileversion,~\filedate;~\filedescription}
-}
-\etex_protected:D \tex_def:D\GetIdInfoAuxSVN:w #1\tex_relax:D#2-#3-#4
- \tex_relax:D#5Z\tex_relax:D{
- \tex_def:D\filenameext{#1}
- \tex_def:D\filedate{#2/#3/#4}
- \tex_def:D\filetimestamp{#5}
-%<-package>\tex_immediate:D\tex_write:D-1
-%<-package> {\filename;~ v\fileversion,~\filedate;~\filedescription}
-}
-%</initex|package>
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% Finally some corrections in the case we are running over \LaTeXe.
-%
-% We want to set things up so that experimental packages and regular
-% packages can coexist with the former using the \LaTeX3 programming
-% catcode settings. Since it cannot be the task of the end user to
-% know how a package is constructed under the hood we make it so that
-% the experimental packages have to identify themselves. As an example
-% it can be done as
-% \begin{verbatim}
-% \RequirePackage{l3names}
-% \ProvidesExplPackage{agent}{2007/08/28}{007}{bonding module}
-% \end{verbatim}
-% or by using the "\file"\meta{field} informations from "\GetIdInfo"
-% as the packages in this distribution do like this:
-% \begin{verbatim}
-% \RequirePackage{l3names}
-% \GetIdInfo$Id: l3names.dtx 2122 2011-01-08 09:14:28Z joseph $
-% {L3 Experimental Box module}
-% \ProvidesExplPackage
-% {\filename}{\filedate}{\fileversion}{\filedescription}
-% \end{verbatim}
-%
-%
-% \begin{macro}{\ProvidesExplPackage}
-% \begin{macro}{\ProvidesExplClass}
-% \begin{macro}{\ProvidesExplFile}
-% First up is the identification. Rather trivial as we don't allow for
-% options just yet.
-% \begin{macrocode}
-%<*package>
-\etex_protected:D \tex_def:D \ProvidesExplPackage#1#2#3#4{
- \ProvidesPackage{#1}[#2~v#3~#4]
- \ExplSyntaxOn
-}
-\etex_protected:D \tex_def:D \ProvidesExplClass#1#2#3#4{
- \ProvidesClass{#1}[#2~v#3~#4]
- \ExplSyntaxOn
-}
-\etex_protected:D \tex_def:D \ProvidesExplFile#1#2#3#4{
- \ProvidesFile{#1}[#2~v#3~#4]
- \ExplSyntaxOn
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\@pushfilename}
-% \begin{macro}{\@popfilename}
-% The idea behind the code is to record whether or not the \LaTeX3
-% syntax is on or off when about to load a file with class or
-% package extension. This status stored in the parameter
-% |\ExplSyntaxStatus| and set by |\ExplSyntaxOn| and
-% |\ExplSyntaxOff| to |1| and |0| respectively is pushed onto the
-% stack |\ExplSyntaxStack|. Then the catcodes are set back to
-% normal, the file loaded with its options and finally the stack is
-% popped again. The whole thing is a bit problematical. So let's
-% take a look at what the desired behavior is: A package or class
-% which declares itself of Expl type by using |\ProvidesExplClass|
-% or |\ProvidesExplPackage| should automatically ensure the correct
-% catcode scheme as soon as the identification part is
-% over. Similarly, a package or class which uses the traditional
-% |\ProvidesClass| or |\ProvidesPackage| commands should go back to
-% the traditional catcode scheme. An example:
-% \begin{verbatim}
-% \RequirePackage{l3names}
-% \ProvidesExplPackage{foobar}{2009/05/07}{0.1}{Foobar package}
-% \cs_new:Npn \foo_bar:nn #1#2 {#1,#2}
-% ...
-% \RequirePackage{array}
-% ...
-% \cs_new:Npn \foo_bar:nnn #1#2#3 {#3,#2,#1}
-% \end{verbatim}
-% Inside the \pkg{array} package, everything should behave as normal
-% under traditional \LaTeX\ but as soon as we are back at the top
-% level, we should use the new catcode regime.
-%
-%
-% Whenever \LaTeX\ inputs a package file or similar, it calls upon
-% |\@pushfilename| to push the name, the extension and the catcode
-% of @ of the file it was currently processing onto a file name
-% stack. Similarly, after inputting such a file, this file name
-% stack is popped again and the catcode of @ is set to what it was
-% before. If it is a package within package, @ maintains catcode 11
-% whereas if it is package within document preamble @ is reset to
-% what it was in the preamble (which is usually catcode 12). We wish
-% to adopt a similar technique. Every time an Expl package or class
-% is declared, they will issue an ExplSyntaxOn. Then whenever we are
-% about to load another file, we will first push this status onto a
-% stack and then turn it off again. Then when done loading a file,
-% we pop the stack and if ExplSyntax was On right before, so should
-% it be now. The only problem with this is that we cannot guarantee
-% that we get to the file name stack very early on. Therefore, if
-% the ExplSyntaxStack is empty when trying to pop it, we ensure to
-% turn ExplSyntax off again.
-%
-% |\@pushfilename| is prepended with a small function pushing the
-% current ExplSyntaxStatus (true/false) onto a stack. Then the
-% current catcode regime is recorded and ExplSyntax is switched off.
-%
-% |\@popfilename| is appended with a function for popping the
-% ExplSyntax stack. However, chances are we didn't get to hook into
-% the file stack early enough so \LaTeX\ might try to pop the file
-% name stack while the ExplSyntaxStack is empty. If the latter is
-% empty, we just switch off ExplSyntax.
-% \begin{macrocode}
-\tex_edef:D \@pushfilename{
- \etex_unexpanded:D{
- \tex_edef:D \ExplSyntaxStack{ \ExplSyntaxStatus \ExplSyntaxStack }
- \ExplSyntaxOff
- }
- \etex_unexpanded:D\tex_expandafter:D{\@pushfilename }
-}
-\tex_edef:D \@popfilename{
- \etex_unexpanded:D\tex_expandafter:D{\@popfilename
- \tex_if:D 2\ExplSyntaxStack 2
- \ExplSyntaxOff
- \tex_else:D
- \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\q_stop
- \tex_fi:D
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\ExplSyntaxPopStack}
-% \begin{macro}{\ExplSyntaxStack}
-% Popping the stack is simple: Take the first token which is either
-% 0 (false) or 1 (true) and test if it is odd. Save the rest. The
-% stack is initially empty set to 0 signalling that before
-% \pkg{l3names} was loaded, the ExplSyntax was off.
-% \begin{macrocode}
-\etex_protected:D\tex_def:D\ExplSyntaxPopStack#1#2\q_stop{
- \tex_def:D\ExplSyntaxStack{#2}
- \tex_ifodd:D#1\tex_relax:D
- \ExplSyntaxOn
- \tex_else:D
- \ExplSyntaxOff
- \tex_fi:D
-}
-\tex_def:D \ExplSyntaxStack{0}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Finishing up}
-%
-% A few of the `primitives' assigned above have already been stolen
-% by \LaTeX, so assign them by hand to the saved real primitive.
-% \begin{macrocode}
-\tex_let:D\tex_input:D \@@input
-\tex_let:D\tex_underline:D \@@underline
-\tex_let:D\tex_end:D \@@end
-\tex_let:D\tex_everymath:D \frozen@everymath
-\tex_let:D\tex_everydisplay:D \frozen@everydisplay
-\tex_let:D\tex_italiccor:D \@@italiccorr
-\tex_let:D\tex_hyphen:D \@@hyph
-\tex_let:D\luatex_catcodetable:D \luatexcatcodetable
-\tex_let:D\luatex_initcatcodetable:D \luatexinitcatcodetable
-\tex_let:D\luatex_latelua:D \luatexlatelua
-\tex_let:D\luatex_savecatcodetable:D \luatexsavecatcodetable
-% \end{macrocode}
-%
-% \TeX\ has a nasty habit of inserting a command with the name |\par|
-% so we had better make sure that that command at least has a definition.
-% \begin{macrocode}
-\tex_let:D\par \tex_par:D
-% \end{macrocode}
-%
-% This is the end for \file{l3names} when used on top of \LaTeXe:
-%
-% \begin{macrocode}
-\tex_ifx:D\name_undefine:N\@gobble
- \tex_def:D\name_pop_stack:w{}
-\tex_else:D
-% \end{macrocode}
-%
-% But if traditional \TeX\ code is disabled, do this\ldots
-%
-% As mentioned above, The \LaTeXe\ package mechanism will insert some code
-% to handle the filename stack, and reset the package options, this
-% code will die if the \TeX\ primitives have gone, so skip past it
-% and insert some equivalent code that will work.
-%
-% First a version of |\ProvidesPackage| that can cope.
-% \begin{macrocode}
-\tex_def:D\ProvidesPackage{
- \tex_begingroup:D
- \ExplSyntaxOff
- \package_provides:w}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\tex_def:D\package_provides:w#1#2[#3]{
- \tex_endgroup:D
- \tex_immediate:D\tex_write:D-1{Package:~#1#2~#3}
- \tex_expandafter:D\tex_xdef:D
- \tex_csname:D ver@#1.sty\tex_endcsname:D{#1}}
-% \end{macrocode}
-%
-% In this case the catcode preserving stack is not maintained and
-% |\ExplSyntaxOn| conventions stay in force once on. You'll need
-% to turn then off explicitly with |\ExplSyntaxOff| (although as currently
-% built on 2e, nothing except very experimental code will run in
-% this mode!) Also note that |\RequirePackage| is a simple definition, just for
-% one file, with no options.
-% \begin{macrocode}
-\tex_def:D\name_pop_stack:w#1\relax{%
- \ExplSyntaxOff
- \tex_expandafter:D\@p@pfilename\@currnamestack\@nil
- \tex_let:D\default@ds\@unknownoptionerror
- \tex_global:D\tex_let:D\ds@\@empty
- \tex_global:D\tex_let:D\@declaredoptions\@empty}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\tex_def:D\@p@pfilename#1#2#3#4\@nil{%
- \tex_gdef:D\@currname{#1}%
- \tex_gdef:D\@currext{#2}%
- \tex_catcode:D`\@#3%
- \tex_gdef:D\@currnamestack{#4}}
-% \end{macrocode}
-%
-% \begin{macrocode}
- \tex_def:D\NeedsTeXFormat#1{}
- \tex_def:D\RequirePackage#1{
- \tex_expandafter:D\tex_ifx:D
- \tex_csname:D ver@#1.sty\tex_endcsname:D\tex_relax:D
- \ExplSyntaxOn
- \tex_input:D#1.sty\tex_relax:D
- \tex_fi:D}
-\tex_fi:D
-% \end{macrocode}
-%
-%
-% The |\futurelet| just forces the special end of file marker to vanish,
-% so the argument of |\name_pop_stack:w| does not cause an end-of-file
-% error. (Normally I use |\expandafter| for this trick, but here the next
-% token is in fact |\let| and that may be undefined.)
-% \begin{macrocode}
-\tex_futurelet:D\name_tmp:\name_pop_stack:w
-% \end{macrocode}
-%
-% \paragraph{\pkg{expl3} dependency checks}
-% We want the \pkg{expl3} bundle to be loaded `as one'; this command is
-% used to ensure that one of the "l3" packages isn't loaded on its own.
-% \begin{macrocode}
-%<*!initex>
-\etex_protected:D\tex_def:D \package_check_loaded_expl: {
- \@ifpackageloaded{expl3}{}{
- \PackageError{expl3}{Cannot~load~the~expl3~modules~separately}{
- The~expl3~modules~cannot~be~loaded~separately;\MessageBreak
- please~\protect\usepackage{expl3}~instead.
- }
- }
-}
-%</!initex>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%</package>
-% \end{macrocode}
-%
-% \subsection{Showing memory usage}
-%
-% This section is from some old code from 1993; it'd be good to work out
-% how it should be used in our code today.
-%
-% During the development of the \LaTeX3 kernel we need to be able
-% to keep track of the memory usage. Therefore we generate empty
-% pages while loading the kernel code, just to be able to check the
-% memory usage.
-%
-% \begin{macrocode}
-%<*showmemory>
-\g_trace_statistics_status=2\scan_stop:
-\cs_set_nopar:Npn\showMemUsage{
- \if_horizontal_mode:
- \tex_errmessage:D{Wrong~ mode~ H:~ something~ triggered~
- hmode~ above}
- \else:
- \tex_message:D{Mode ~ okay}
- \fi:
- \tex_shipout:D\hbox:w{}
-}
-\showMemUsage
-%</showmemory>
-% \end{macrocode}
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3num.dtx b/Master/texmf-dist/source/latex/expl3/l3num.dtx
deleted file mode 100644
index 45759166b46..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3num.dtx
+++ /dev/null
@@ -1,505 +0,0 @@
-% \iffalse
-%% File: l3num.dtx Copyright (C) 2005-2010 Frank Mittelbach, LaTeX3 project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3c of this
-%% 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3num.dtx 2063 2010-10-03 08:26:49Z mittelba $
- {L3 Experimental token numbers}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3num.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3num} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Integers in macros}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% Instead of using counter registers for manipulation of
-% integer values it is sometimes useful to keep such values in
-% macros. For this \LaTeX3 offers the type ``num''.
-%
-% One reason is the limited number of registers inside
-% \TeX{}. However, when using \eTeX{} this is no longer an issue. It
-% remains to be seen if there are other compelling reasons to keep
-% this module.
-%
-% It turns out there might be as with a \meta{num} data type, the
-% allocation module can do its bookkeeping without the aid of
-% \meta{int} registers.
-%
-% \section{Functions}
-%
-% \begin{function}{%
-% \num_new:N |
-% \num_new:c |
-% }
-% \begin{syntax}
-% "\num_new:N" <num>
-% \end{syntax}
-% Defines <num> to be a new variable of type "num" (initialized to
-% zero). There is no way to
-% define constant counters with these functions.
-% \end{function}
-%
-% \begin{function}{%
-% \num_incr:N |
-% \num_incr:c |
-% \num_gincr:N |
-% \num_gincr:c
-% }
-% \begin{syntax}
-% "\num_incr:N" <num>
-% \end{syntax}
-% Increments <num> by one. For global variables the global versions
-% should be used.
-% \end{function}
-%
-% \begin{function}{%
-% \num_decr:N |
-% \num_decr:c |
-% \num_gdecr:N |
-% \num_gdecr:c |
-% }
-% \begin{syntax}
-% "\num_decr:N" <num>
-% \end{syntax}
-% Decrements <num> by one. For global variables the global versions
-% should be used.
-% \end{function}
-%
-% \begin{function}{%
-% \num_zero:N |
-% \num_zero:c |
-% \num_gzero:N |
-% \num_gzero:c |
-% }
-% \begin{syntax}
-% "\num_zero:N" <num>
-% \end{syntax}
-% Resets <num> to zero. For global variables the global versions
-% should be used.
-% \end{function}
-%
-% \begin{function}{%
-% \num_set:Nn |
-% \num_set:cn |
-% \num_gset:Nn |
-% \num_gset:cn |
-% }
-% \begin{syntax}
-% "\num_set:Nn" <num> \Arg{integer}
-% \end{syntax}
-% These functions will set the <num> register to the <integer> value.
-% \end{function}
-%
-% \begin{function}{%
-% \num_set_eq:NN |
-% \num_set_eq:cN |
-% \num_set_eq:Nc |
-% \num_set_eq:cc |
-% }
-% \begin{syntax}
-% "\num_gset_eq:NN" <num1> <num2>
-% \end{syntax}
-% These functions will set the <num1> register equal to <num2>.
-% \end{function}
-%
-% \begin{function}{%
-% \num_gset_eq:NN |
-% \num_gset_eq:cN |
-% \num_gset_eq:Nc |
-% \num_gset_eq:cc |
-% }
-% \begin{syntax}
-% "\num_gset_eq:NN" <num1> <num2>
-% \end{syntax}
-% These functions will globally set the <num1> register equal to <num2>.
-% \end{function}
-%
-% \begin{function}{%
-% \num_add:Nn |
-% \num_add:cn |
-% \num_gadd:Nn |
-% \num_gadd:cn |
-% }
-% \begin{syntax}
-% "\num_add:Nn" <num> \Arg{integer}
-% \end{syntax}
-% These functions will add to the <num> register the value <integer>. If
-% the second argument is a <num> register too, the surrounding braces
-% can be left out.
-%
-% \end{function}
-%
-%
-% \begin{function}{%
-% \num_use:N |
-% \num_use:c |
-% }
-% \begin{syntax}
-% "\num_use:N" <num>
-% \end{syntax}
-% This function returns the integer value kept in <num> in a way
-% suitable for further processing.
-% \begin{texnote}
-% Since these <num>s are implemented as macros, the function
-% "\num_use:N" is effectively a noop and mainly there for
-% consistency with similar functions in other modules.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \num_show:N |
-% \num_show:c }
-% \begin{syntax}
-% "\num_show:N" <num>
-% \end{syntax}
-% This function pauses the compilation and displays the integer value kept
-% in <num> on the console output.
-% \end{function}
-%
-%
-%
-% \begin{function}{%
-% \num_elt_count:n |
-% \num_elt_count_prop:Nn |
-% }
-% \begin{syntax}
-% "\num_elt_count:n" \Arg{balanced text}
-% "\num_elt_count_prop:Nn" <prop> \Arg{balanced text}
-% \end{syntax}
-% Discards their arguments and puts a "+1" in the input stream. Used
-% to count elements in a token list.
-% \end{function}
-%
-% \section{Formatting a counter value}
-%
-% See the \textsf{l3int} module for ways of doing this.
-%
-% \section{Variable and constants}
-%
-% \begin{variable}{ \c_max_register_num }
-% Maximum number of registers; possibly engine-specific.
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_tmpa_num |
-% \l_tmpb_num |
-% \l_tmpc_num |
-% \g_tmpa_num |
-% \g_tmpb_num |
-% }
-% Scratch register for immediate use. They are not used by conditionals
-% or predicate functions.
-% \end{variable}
-%
-% \section{Primitive functions}
-%
-%
-% \begin{function}{%
-% \if_num:w |
-% }
-% \begin{syntax}
-% "\if_num:w" <number1> <rel> <number2> <true> "\else:" <false> "\fi:"
-% \end{syntax}
-% Compare two numbers. It is recommended to use "\int_eval:n" to
-% correctly evaluate and terminate these numbers. <rel> is one of
-% "<", "=" or ">" with catcode 12.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{ifnum}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \if_case:w |
-% \or: |
-% }
-% \begin{syntax}
-% "\if_case:w" <number> <case0> "\or:" <case1> "\or:" "..." "\else:"
-% <default> "\fi:"
-% \end{syntax}
-% Chooses case <number>. If you wish to use negative numbers as well,
-% you can offset them with "\int_eval:n".
-% \begin{texnote}
-% These are the \TeX{} primitives \tn{ifcase} and \tn{or}.
-% \end{texnote}
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3num} implementation}
-%
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macro}{\if_num:w}
-% \begin{macro}{\if_case:w}
-% Here are the remaining primitives for number comparisons and
-% expressions.
-% \begin{macrocode}
-\cs_set_eq:NN \if_num:w \tex_ifnum:D
-\cs_set_eq:NN \if_case:w \tex_ifcase:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% Functions that support \LaTeX's user accessible counters should be
-% added here, too. But first the internal counters.
-%
-% \begin{macro}{\num_incr:N}
-% \begin{macro}{\num_decr:N}
-% \begin{macro}{\num_gincr:N}
-% \begin{macro}{\num_gdecr:N}
-% Incrementing and decrementing of integer registers is done with
-% the following functions.
-% \begin{macrocode}
-\cs_set_protected_nopar:Npn \num_incr:N #1{\num_add:Nn#1 1}
-\cs_set_protected_nopar:Npn \num_decr:N #1{\num_add:Nn#1 \c_minus_one}
-\cs_set_protected_nopar:Npn \num_gincr:N #1{\num_gadd:Nn#1 1}
-\cs_set_protected_nopar:Npn \num_gdecr:N #1{\num_gadd:Nn#1 \c_minus_one}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_incr:c}
-% \begin{macro}{\num_decr:c}
-% \begin{macro}{\num_gincr:c}
-% \begin{macro}{\num_gdecr:c}
-% We also need \ldots
-% \begin{macrocode}
-\cs_generate_variant:Nn \num_incr:N {c}
-\cs_generate_variant:Nn \num_decr:N {c}
-\cs_generate_variant:Nn \num_gincr:N {c}
-\cs_generate_variant:Nn \num_gdecr:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_zero:N}
-% \begin{macro}{\num_zero:c}
-% \begin{macro}{\num_gzero:N}
-% \begin{macro}{\num_gzero:c}
-% We also need \ldots
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \num_zero:N #1 {\num_set:Nn #1 0}
-\cs_new_protected_nopar:Npn \num_gzero:N #1 {\num_gset:Nn #1 0}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \num_zero:N {c}
-\cs_generate_variant:Nn \num_gzero:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\num_new:N}
-% \begin{macro}{\num_new:c}
-% Allocate a new \m{num} variable and initialize it with zero.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \num_new:N #1{\tl_new:Nn #1{0}}
-\cs_generate_variant:Nn \num_new:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_set:Nn}
-% \begin{macro}{\num_set:cn}
-% \begin{macro}{\num_gset:Nn}
-% \begin{macro}{\num_gset:cn}
-% Assigning values to \m{num} registers.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \num_set:Nn #1#2{
- \tl_set:No #1{ \tex_number:D \int_eval:n {#2} }
-}
-\cs_generate_variant:Nn\num_set:Nn {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \num_gset:Nn {\pref_global:D \num_set:Nn}
-\cs_generate_variant:Nn\num_gset:Nn {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_set_eq:NN}
-% \begin{macro}{\num_set_eq:cN}
-% \begin{macro}{\num_set_eq:Nc}
-% \begin{macro}{\num_set_eq:cc}
-% Setting \m{num} registers equal to each other.
-% \begin{macrocode}
-\cs_new_eq:NN \num_set_eq:NN \tl_set_eq:NN
-\cs_generate_variant:Nn\num_set_eq:NN {c,Nc,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_gset_eq:NN}
-% \begin{macro}{\num_gset_eq:cN}
-% \begin{macro}{\num_gset_eq:Nc}
-% \begin{macro}{\num_gset_eq:cc}
-% Setting \m{num} registers equal to each other.
-% \begin{macrocode}
-\cs_new_eq:NN \num_gset_eq:NN \tl_gset_eq:NN
-\cs_generate_variant:Nn\num_gset_eq:NN {c,Nc,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_add:Nn}
-% \begin{macro}{\num_add:cn}
-% \begin{macro}{\num_gadd:Nn}
-% \begin{macro}{\num_gadd:cn}
-% Adding is easily done as the second argument goes through
-% |\int_eval:n|.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \num_add:Nn #1#2 {\num_set:Nn #1{#1+#2}}
-\cs_generate_variant:Nn\num_add:Nn {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \num_gadd:Nn {\pref_global:D \num_add:Nn}
-\cs_generate_variant:Nn\num_gadd:Nn {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\num_use:N}
-% \begin{macro}{\num_use:c}
-% Here is how num macros are accessed:
-% \begin{macrocode}
-\cs_new_eq:NN\num_use:N \use:n
-\cs_new_eq:NN\num_use:c \use:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\num_show:N}
-% \begin{macro}{\num_show:c}
-% Here is how num macros are diagnosed:
-% \begin{macrocode}
-\cs_new_eq:NN\num_show:N \cs_show:N
-\cs_new_eq:NN\num_show:c \cs_show:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\num_elt_count:n}
-% \begin{macro}{\num_elt_count_prop:Nn}
-% Helper function for counting elements in a list.
-% \begin{macrocode}
-\cs_new:Npn \num_elt_count:n #1 { + 1 }
-\cs_new:Npn \num_elt_count_prop:Nn #1#2 { + 1 }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\l_tmpa_num}
-% \begin{macro}{\l_tmpb_num}
-% \begin{macro}{\l_tmpc_num}
-% \begin{macro}{\g_tmpa_num}
-% \begin{macro}{\g_tmpb_num}
-% We provide an number local and two global \m{num}s, maybe we
-% need more or less.
-% \begin{macrocode}
-\num_new:N \l_tmpa_num
-\num_new:N \l_tmpb_num
-\num_new:N \l_tmpc_num
-\num_new:N \g_tmpa_num
-\num_new:N \g_tmpb_num
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\c_max_register_num}
-% \begin{macrocode}
-\tex_mathchardef:D \c_max_register_num = 32767 \scan_stop:
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3precom.dtx b/Master/texmf-dist/source/latex/expl3/l3precom.dtx
deleted file mode 100644
index 8d238b8b01f..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3precom.dtx
+++ /dev/null
@@ -1,435 +0,0 @@
-% \iffalse
-%% File: l3precom.dtx Copyright (C) 1990-2006,2009 Frank Mittelbach, LaTeX3 project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3c of this
-%% 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3precom.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental precompilation module}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3precom} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Precompilation of complex data}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \section{Introduction}
-%
-% It is possible speed up the processing of documents when complex parts
-% of the document style file are `precompiled' and stored in a
-% separate file.
-%
-% \section{Control sequence functions extended \ldots}
-%
-% \begin{function}{\cs_gen_sym:N |
-% \cs_ggen_sym:N}
-% \begin{syntax}
-% "\cs_gen_sym:N" <tl var.>
-% \end{syntax}
-% These functions will generate a new control sequence name for use as a
-% pointer, e.g.\ some tree structure like the LDB. The new unique name
-% is returned locally in <tl var.> for further use. The names are generated
-% using the roman numeral representation of some special counters
-% together with a prefix of "\l*" (local) or "\g*"( global).
-% \end{function}
-%
-% \begin{function}{\cs_record_name:N|\cs_record_name:c}
-% \begin{syntax}
-% "\cs_record_name:N" <cs>
-% \end{syntax}
-% Takes the <cs> and saves it in a special place for pre-compiling
-% purposes on a file later on. All control sequences that are recorded
-% with this function will be dumped by "\cs_dump:". This function is
-% internally automatically used to record all symbols generated by
-% "\cs_gen_sym:N" and "\cs_ggen_sym:N".
-% \end{function}
-%
-% \begin{function}{\cs_record_meaning:N}
-% \begin{syntax}
-% "\cs_record_meaning:N" <cs>
-% \end{syntax}
-% Takes the <cs> and saves its meaning in a special place for pre-compiling
-% purposes on a file later on. Used for tracing purposes.
-% \end{function}
-%
-% \begin{function}{\register_record_name:N}
-% \begin{syntax}
-% "\register_record_name:N" <register>
-% \end{syntax}
-% Takes the <register> and saves it in a special places for pre-compiling
-% purposes on a file later on. All control sequences that are recorded
-% with this function will be dumped by "\cs_dump:".
-% \end{function}
-%
-% \begin{function}{\cs_load_dump:n}
-% \begin{syntax}
-% "\cs_load_dump:n" \Arg{file name}
-% \end{syntax}
-% Loads and executes the file <file name> if found. Then scans
-% further ignoring everything until finding "\cs_dump:" where normal
-% execution continues. If <file name> is not found, the name is saved
-% and normal execution of all following code is done until "\cs_dump:" is
-% scanned. Then all symbols marked for dumping are dumped into <file
-% name>.
-% \end{function}
-%
-% \begin{function}{\cs_dump:}
-% Dumps the symbols recorded by "\cs_record_name:N" in the file given
-% by the argument in "\cs_load_dump:n". Dumping means that for every
-% <cs> recorded by "\cs_record_name:N" a line
-% \begin{quote}
-% "\cs_set_nopar:Npn" <cs> \Arg{current meaning of cs}
-% \end{quote}
-% is written to this file. This means that when loading the file the
-% definitions of all these <cs>'s are directly available.
-% \end{function}
-%
-% \begin{function}{\dumpLaTeXstate}
-% \begin{syntax}
-% "\dumpLaTeXstate" \Arg{file}
-% \end{syntax}
-% This function is used to write control sequences
-% and registers, together with their meaning or value in the <file>|.dmp|
-% file.
-% \end{function}
-%
-% \section{Internal variables}
-%
-% \begin{variable}{\g_gen_sym_num |
-% \g_ggen_sym_num} Holds the number of the last
-% generated symbol by "\cs_gen_sym:N" or "\cs_ggen_sym:N".
-% \end{variable}
-%
-% \begin{variable}{\g_cs_dump_seq}
-% Sequence in which the symbols to be dumped are stored.
-% \end{variable}
-%
-% \begin{variable}{\g_cs_dump_stream}
-% Output stream used for writing out the definitions of the
-% recorded <tl var.>.
-% \end{variable}
-%
-% \begin{variable}{\g_cs_dump_name_tl}
-% Used to store the name of the file to dump to.
-% \end{variable}
-%
-% \begin{variable}{\g_cs_trace_seq}
-% Sequence which holds the control sequence names that are to
-% be dumped with their corresponding meanings. Used for tracing purposes.
-% \end{variable}
-%
-% \begin{variable}{\g_register_trace_seq}
-% Sequence holding the register names to be dumped with their
-% corresponding values. Used for tracing purposes.
-% \end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3precom} implementation}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-% \end{macrocode}
-%
-% \begin{macro}{\g_cs_dump_name_tl}
-% This \m{tl var.}~is used to store the name of the file.
-%
-% \begin{macrocode}
-%<*initex|package>
-%<*precompile>
-\tl_new:N \g_cs_dump_name_tl
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\g_cs_dump_seq}
-% While processing the documentstyle we build up a list of
-% control sequence names to be dumped. For this purpose
-% we use the |\g_cs_dump_seq| sequence.
-%
-% \begin{macrocode}
-\seq_new:N\g_cs_dump_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\cs_record_name:N,\cs_record_name:c}
-% These functions mark a control sequence for dumping into a
-% precompiled style.
-%
-% When the {\sf trace} `module' is included in the code we also write
-% information about the control sequence into a |.dmp| file.
-% \begin{macrocode}
-\cs_new_nopar:Npn\cs_record_name:N#1{
-%<*trace>
-\seq_gput_left:Nn
- \g_cs_trace_seq#1
-%</trace>
-\seq_gput_left:Nn
- \g_cs_dump_seq#1}
-\cs_generate_variant:Nn \cs_record_name:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\cs_dump:}
-% When a document style\marginpar{\small As you can see from the
-% wording this pre-dates \LaTeXe{} \quad \emph{Frank}}
-% calls |\cs_dump:| it triggers this code
-% to write all the precompilation information out to a file.
-%
-% Before dumping, we write a message to the terminal informing the
-% `user' of this fact.
-% \begin{macrocode}
-\cs_new_nopar:Npn\cs_dump:{
-\iow_term:x{Precompiling~style~into~(\g_cs_dump_name_tl)}
-\iow_open:Nn\g_cs_dump_stream{\g_cs_dump_name_tl}
-% \end{macrocode}
-% The first thing we write on a `dump' file is a command that
-% allows us to use |*| in control sequences. We also need to be
-% able to write to (and read from) the file internal control
-% sequences, containing |_| and |:|.
-% \begin{macrocode}
-\iow_now:Nx\g_cs_dump_stream
-{\group_begin:
-\tex_catcode:D`\token_to_str:N\*=11\scan_stop:
-\token_to_str:N\ExplSyntaxOn
-}
-\seq_map_inline:Nn
-\g_cs_dump_seq
-{\tex_message:D{.}
-\iow_now:Nx\g_cs_dump_stream
-% \end{macrocode}
-% We use a direct |\cs_gset_nopar:Npn| to disable any type of local/global
-% check on the pointers.
-% \begin{macrocode}
- {\exp_not:n{\cs_gset_nopar:Npn ##1}
- {\tl_to_str:N##1}}
-}
-% \end{macrocode}
-% We also need to remember the current values of the
-% |\g_gen_sym_int| and |\g_ggen_sym_int| counters to allow
-% further updates after a database was dumped.
-% \begin{macrocode}
-\iow_now:Nx \g_cs_dump_stream {\exp_not:n{\int_gset:Nn
- \g_gen_sym_int}
- {\int_use:N\g_gen_sym_int}^^J
-\exp_not:n{\int_gset:Nn \g_ggen_sym_int}
- {\int_use:N\g_ggen_sym_int}}
-\iow_now:Nx
-\g_cs_dump_stream
-{\group_end:}
-\iow_close:N\g_cs_dump_stream
-\tex_message:D{~finished}
-}
-%</precompile>
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\cs_load_dump:n}
-% A function to read a precompiled file into memory and skip until a
-% |\cs_dump:| command is found. If no such file is found, processing
-% continues and a subsequent |\cs_dump:| command will then create the
-% dump file.
-% \begin{macrocode}
-\cs_new_nopar:Npn \cs_load_dump:n #1 {
- \file_if_exist:nTF { #1 .cmp } {
- \file_input:n { #1 .cmp }
- \cs_set_eq:NN \cs_dump: \fi:
- \if_false:
- }{
-%<*precompile>
- \tl_gset:Nn \g_cs_dump_name_tl { #1 .cmp }
-%</precompile>
-%<*!precompile>
- \tex_errmessage:D { Cannot~ dump~ with~ this~ format }
-%</!precompile>
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\g_gen_sym_int}
-% \begin{macro}{\g_ggen_sym_int}
-% Two counters to make up new local or global \textsl{short} names
-% in pointer structures like the \textsc{ldb}.
-% \begin{macrocode}
-\int_new:N\g_gen_sym_int \int_gset:Nn\g_gen_sym_int{0}
-\int_new:N\g_ggen_sym_int \int_gset:Nn\g_ggen_sym_int{0}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\cs_gen_sym:N}
-% \begin{macro}{\cs_ggen_sym:N}
-% We need to be able to generate control sequences on the fly.
-% They will exist of a prefix, either |l*| or |g*|, followed
-% by the value of the counter |\g_gen_sym_num| (|\g_ggen_sym_num|)
-% in roman numeral representation. The generated control sequence
-% is locally stored in the token that was passed in |#1|.
-%
-% \begin{macrocode}
-\cs_new_nopar:Npn\cs_gen_sym:N#1{
-\int_gincr:N\g_gen_sym_num
-\tl_set:Nc#1{l*\tex_romannumeral:D\int_use:N\g_gen_sym_int}
-%<*precompile>
-\exp_after:wN\cs_record_name:N#1
-%</precompile>
-% \end{macrocode}
-% We still want to define the initial value for the new symbol
-% globally to make sure that during compilation something is
-% written to the output file.
-% \begin{macrocode}
-\exp_after:wN\tl_clear_new:N#1}
-% \end{macrocode}
-% The global variant
-% \begin{macrocode}
-\cs_new_nopar:Npn\cs_ggen_sym:N#1{
-\int_gincr:N\g_ggen_sym_int
-\tl_set:Nc#1{g*\tex_romannumeral:D\int_use:N\g_ggen_sym_int}
-%<*precompile>
-\exp_after:wN\cs_record_name:N#1
-%</precompile>
-\exp_after:wN\tl_clear_new:N#1}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\g_cs_trace_seq}
-% A sequence which holds the control sequence names that are to
-% be dumped. They are stored together with their meaning.
-%
-% ATTENTION: as we currently don't distribute allocation routines
-% for primitive registers this code will have no effect!
-% \begin{macrocode}
-%<*trace>
-\seq_new:N\g_cs_trace_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\g_register_trace_seq}
-% Sequence holding the register names to be dumped with their
-% corresponding values.
-%
-% ATTENTION: as we currently don't distribute allocation routines
-% for primitive registers this code will have no effect!
-% \begin{macrocode}
-\seq_new:N\g_register_trace_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\cs_record_meaning:N}
-% Function marking a control sequence for dumping with meaning.
-% \begin{macrocode}
-\cs_set_nopar:Npn\cs_record_meaning:N#1{
-\seq_gput_left:Nn
- \g_cs_trace_seq#1}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\register_record_name:N}
-% Function marking a register for dumping with value.
-% \begin{macrocode}
-\cs_set_nopar:Npn\register_record_name:N#1{
-\seq_gput_left:Nn
- \g_register_trace_seq#1}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\dumpLaTeXstate}
-% The function |\dumpLaTeXstate| is used to write control sequences
-% and registers, together with their meaning or value in the |.dmp|
-% file. We write informational messages to the terminal during the
-% dump.
-%
-% ATTENTION: as we currently don't distribute allocation routines
-% for primitive registers this part of the code will dump nothing
-% unless |\register_record_name:N| is explicitly used.
-% \begin{macrocode}
-\cs_new_nopar:Npn\dumpLaTeXstate#1{
- \iow_term:x{Dumping~commands~into~(#1.dmp)}
- \iow_open:Nn\g_cs_dump_stream{#1.dmp}
- \seq_map_inline:Nn
- \g_cs_trace_seq
- {\tex_message:D{.}
- \iow_now:Nx\g_cs_dump_stream
- {\token_to_str:N##1~
- \token_to_meaning:N##1}
- }
- \tex_message:D{~registers}
- \seq_map_inline:Nn
- \g_register_trace_seq
- {\tex_message:D{.}
- \iow_now:Nx\g_cs_dump_stream
- {\token_to_str:N##1
- \toks_use:N##1}
- }
- \iow_clos:Nn \g_cs_dump_stream
- \tex_message:D{~finished}
-}
-%</trace>
-%</initex|package>
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3prg.dtx b/Master/texmf-dist/source/latex/expl3/l3prg.dtx
deleted file mode 100644
index b9dcafa7f09..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3prg.dtx
+++ /dev/null
@@ -1,1965 +0,0 @@
-% \iffalse
-%% File: l3prg.dtx Copyright (C) 2005-2011 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3prg.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental control structures}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3prg.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3prg} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Program control structures}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \section{Conditionals and logical operations}
-%
-% Conditional processing in \LaTeX3 is defined as something that
-% performs a series of tests, possibly involving assignments and
-% calling other functions that do not read further ahead in the input
-% stream. After processing the input, a \emph{state} is returned. The
-% typical states returned are \meta{true} and \meta{false} but other
-% states are possible, say an \meta{error} state for erroneous
-% input, e.g., text as input in a function comparing integers.
-%
-%
-%
-% \LaTeX3 has two primary forms of conditional flow processing based
-% on these states. One type is predicate functions that turn the
-% returned state into a boolean \meta{true} or \meta{false}. For
-% example, the function "\cs_if_free_p:N" checks whether the control
-% sequence given as its argument is free and then returns the boolean
-% \meta{true} or \meta{false} values to be used in testing with
-% "\if_predicate:w" or in functions to be described below. The other type
-% is the kind of functions choosing a particular argument from the
-% input stream based on the result of the testing as in
-% "\cs_if_free:NTF" which also takes one argument (the "N") and then
-% executes either \meta{true} or \meta{false} depending on the
-% result. Important to note here is that the arguments are executed
-% after exiting the underlying "\if...\fi:" structure
-%
-%
-%
-%
-%
-%
-%
-% \section{Defining a set of conditional functions}
-%
-% \begin{function}{ \prg_return_true: |
-% \prg_return_false: }
-% These functions exit conditional processing when used in
-% conjunction with the generating functions listed below.
-% \end{function}
-%
-% \begin{function}{%
-% \prg_set_conditional:Nnn |
-% \prg_set_conditional:Npnn |
-% \prg_new_conditional:Nnn |
-% \prg_new_conditional:Npnn |
-% \prg_set_protected_conditional:Nnn |
-% \prg_set_protected_conditional:Npnn |
-% \prg_new_protected_conditional:Nnn |
-% \prg_new_protected_conditional:Npnn |
-% \prg_set_eq_conditional:NNn |
-% \prg_new_eq_conditional:NNn
-% }
-% \begin{syntax}
-% "\prg_set_conditional:Nnn" <test> <conds> <code>
-% "\prg_set_conditional:Npnn" <test> <param> <conds> <code>
-% \end{syntax}
-% This defines a conditional \meta{base function} which upon
-% evaluation using |\prg_return_true:| and |\prg_return_false:| to
-% finish branches,
-% returns a state. Currently the states are either \meta{true} or
-% \meta{false} although this can change as more states may be
-% introduced, say an \meta{error} state. \meta{conds} is a comma
-% separated list possibly consisting of |p| for denoting a predicate function
-% returning the boolean \meta{true} or \meta{false} values and |TF|,
-% |T| and |F| for the functions that act on the tokens following in
-% the input stream. The |:Nnn| form implicitly determines the number
-% of arguments from the function being defined whereas the |:Npnn|
-% form expects a primitive parameter text.
-%
-% An example can easily clarify matters here:
-% \begin{verbatim}
-% \prg_set_conditional:Nnn \foo_if_bar:NN {p,TF,T} {
-% \if_meaning:w \l_tmpa_tl #1
-% \prg_return_true:
-% \else:
-% \if_meaning:w \l_tmpa_tl #2
-% \prg_return_true:
-% \else:
-% \prg_return_false:
-% \fi:
-% \fi:
-% }
-% \end{verbatim}
-% This defines the function |\foo_if_bar_p:NN|, |\foo_if_bar:NNTF|,
-% |\foo_if_bar:NNT| but not |\foo_if_bar:NNF| (because "F" is missing from
-% the \meta{conds} list). The return statements
-% take care of resolving the remaining |\else:| and |\fi:| before
-% returning the state. There must be a return statement for each
-% branch, failing to do so will result in an error if that branch is
-% executed.
-% \end{function}
-%
-%
-%
-%
-%
-% \section{The boolean data type}
-%
-% This section describes a boolean data type which is closely
-% connected to conditional processing as sometimes you want to
-% execute some code depending on the value of a switch
-% (e.g.,~draft/final) and other times you perhaps want to use it as a
-% predicate function in an "\if_predicate:w" test. The problem of the
-% primitive "\if_false:" and "\if_true:" tokens is that it is not
-% always safe to pass them around as they may interfere with scanning
-% for termination of primitive conditional processing. Therefore, we
-% employ two canonical booleans: "\c_true_bool" or
-% "\c_false_bool". Besides preventing problems as described above, it
-% also allows us to implement a simple boolean parser supporting the
-% logical operations And, Or, Not, etc.\ which can then be used on
-% both the boolean type and predicate functions.
-%
-% All conditonal "\bool_" functions are expandable and expect the
-% input to also be fully expandable (which will generally mean being
-% constructed from predicate functions, possibly nested).
-%
-% \begin{function}{%
-% \bool_new:N |
-% \bool_new:c |
-% }
-% \begin{syntax}
-% "\bool_new:N" <bool>
-% \end{syntax}
-% Define a new boolean variable. The initial value is <false>. A
-% boolean is actually just either "\c_true_bool" or "\c_false_bool".
-% \end{function}
-%
-% \begin{function}{%
-% \bool_set_true:N |
-% \bool_set_true:c |
-% \bool_set_false:N |
-% \bool_set_false:c |
-% \bool_gset_true:N |
-% \bool_gset_true:c |
-% \bool_gset_false:N |
-% \bool_gset_false:c |
-% }
-% \begin{syntax}
-% "\bool_gset_false:N" <bool>
-% \end{syntax}
-% Set <bool> either <true> or <false>. We can also do this globally.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \bool_set_eq:NN |
-% \bool_set_eq:Nc |
-% \bool_set_eq:cN |
-% \bool_set_eq:cc |
-% \bool_gset_eq:NN |
-% \bool_gset_eq:Nc |
-% \bool_gset_eq:cN |
-% \bool_gset_eq:cc |
-%
-% }
-% \begin{syntax}
-% "\bool_set_eq:NN" <bool1> <bool2>
-% \end{syntax}
-% Set <bool1> equal to the value of <bool2>.
-% \end{function}
-%
-% \begin{function}{ \bool_if:N / (pTF) |
-% \bool_if:c / (pTF) }
-% \begin{syntax}
-% "\bool_if:NTF" <bool> \Arg{true} \Arg{false} \\
-% "\bool_if_p:N" <bool>
-% \end{syntax}
-% Test the truth value of <bool> and execute the \m{true} or
-% \m{false} code. "\bool_if_p:N" is a predicate function for use in
-% "\if_predicate:w" tests or "\bool_if:nTF"-type functions described below.
-% \end{function}
-%
-% \begin{function}{%
-% \bool_while_do:Nn |
-% \bool_while_do:cn |
-% \bool_until_do:Nn |
-% \bool_until_do:cn |
-% \bool_do_while:Nn |
-% \bool_do_while:cn |
-% \bool_do_until:Nn |
-% \bool_do_until:cn |
-%
-% }
-% \begin{syntax}
-% "\bool_while_do:Nn" <bool> \Arg{code} \\
-% "\bool_until_do:Nn" <bool> \Arg{code} \\
-% \end{syntax}
-% The `while' versions execute <code> as long as the boolean is
-% true and the `until' versions execute <code> as long as the
-% boolean is false. The "while_do" functions execute the body after
-% testing the boolean and the "do_while" functions executes the body
-% first and then tests the boolean.
-% \end{function}
-%
-%
-%
-% \section{Boolean expressions}
-%
-% As we have a boolean datatype and predicate functions returning
-% boolean \meta{true} or \meta{false} values, it seems only fitting
-% that we also provide a parser for \meta{boolean expressions}.
-%
-% A boolean expression is an expression which given input in the form
-% of predicate functions and boolean variables, return boolean
-% \meta{true} or \meta{false}. It supports the logical operations And,
-% Or and Not as the well-known infix operators "&&", "||" and "!". In
-% addition to this, parentheses can be used to isolate
-% sub-expressions. For example,
-% \begin{verbatim}
-% \int_compare_p:n {1=1} &&
-% (
-% \int_compare_p:n {2=3} ||
-% \int_compare_p:n {4=4} ||
-% \int_compare_p:n {1=\error} % is skipped
-% ) &&
-% !(\int_compare_p:n {2=4})
-% \end{verbatim}
-% is a valid boolean expression. Note that minimal evaluation is
-% carried out whenever possible so that whenever a truth value cannot
-% be changed anymore, the remainding tests within the current group
-% are skipped.
-%
-% \begin{function}{ \bool_if:n / (pTF) }
-% \begin{syntax}
-% "\bool_if:nTF" \Arg{boolean expression} \Arg{true}
-% \Arg{false}
-% \end{syntax}
-% The functions evaluate the truth value of \m{boolean expression}
-% where each predicate is separated by \verb+&&+ or \verb+||+
-% denoting logical `And' and `Or' functions. "(" and ")" denote
-% grouping of sub-expressions while "!" is used to as a prefix to
-% either negate a single expression or a group. Hence
-% \begin{verbatim}
-% \bool_if_p:n{
-% \int_compare_p:n {1=1} &&
-% (
-% \int_compare_p:n {2=3} ||
-% \int_compare_p:n {4=4} ||
-% \int_compare_p:n {1=\error} % is skipped
-% ) &&
-% !(\int_compare_p:n {2=4})
-% }
-% \end{verbatim}
-% from above returns \meta{true}.
-%
-% Logical operators take higher precedence the later in the predicate they
-% appear. ``<x> "||" <y> "&&" <z>'' is interpreted as the equivalent of
-% ``<x> \textsc{or} [~<y> \textsc{and} <z>~]'' (but now we have grouping
-% you shouldn't write this sort of thing, anyway).
-% \end{function}
-%
-%
-%
-% \begin{function}{ \bool_not_p:n / (EXP) }
-% \begin{syntax}
-% "\bool_not_p:n" \Arg{boolean expression}
-% \end{syntax}
-% Longhand for writing "!("\meta{boolean expression}")" within a boolean
-% expression. Might not stick around.
-% \end{function}
-%
-% \begin{function}{ \bool_xor_p:nn / (EXP) }
-% \begin{syntax}
-% "\bool_xor_p:nn" \Arg{boolean expression} \Arg{boolean expression}
-% \end{syntax}
-% Implements an `exclusive or' operation between two boolean
-% expressions. There is no infix operation for this.
-% \end{function}
-%
-% \begin{function}{\bool_set:Nn |\bool_set:cn |\bool_gset:Nn |\bool_gset:cn}
-% \begin{syntax}
-% "\bool_set:Nn" <bool> \Arg{boolean expression}
-% \end{syntax}
-% Sets <bool> to the logical outcome of evaluating <boolean expression>.
-% \end{function}
-%
-%
-% \section{Case switches}
-%
-%
-% \begin{function}{ \prg_case_int:nnn / (EXP) }
-% \begin{syntax}
-% "\prg_case_int:nnn" \Arg{integer expr} "{"
-% ~~\Arg{integer expr 1} \Arg{code 1}\\
-% ~~\Arg{integer expr 2} \Arg{code 2}\\
-% ~~\dots\\
-% ~~\Arg{integer expr\,$\sb n$} \Arg{code\,$\sb n$}\\
-% "}" \Arg{else case}
-% \end{syntax}
-% This function evaluates the first \meta{integer expr} and then compares it
-% to the values found in the list. Thus the expression
-% \begin{verbatim}
-% \prg_case_int:nnn{2*5}{
-% {5}{Small} {4+6}{Medium} {-2*10}{Negative}
-% }{Other}
-% \end{verbatim}
-% evaluates first the term to look for and then tries to find this
-% value in the list of values. If the value is found, the code on its
-% right is executed after removing the remainder of the list. If the
-% value is not found, the \meta{else case} is executed. The example
-% above will return ``Medium''.
-%
-% The function is expandable and is written in such a way that
-% \texttt{f} style expansion can take place cleanly, i.e., no tokens
-% from within the function are left over.
-% \end{function}
-%
-% \begin{function}{ \prg_case_dim:nnn / (EXP) }
-% \begin{syntax}
-% "\prg_case_int:nnn" \Arg{dim expr} "{"\\
-% ~~\Arg{dim expr 1} \Arg{code 1}\\
-% ~~\Arg{dim expr 2} \Arg{code 2}\\
-% ~~"..."\\
-% ~~\Arg{dim expr\,$\sb n$} \Arg{code\,$\sb n$}\\
-% "}" \Arg{else case}
-% \end{syntax}
-% This function works just like |\prg_case_int:nnn| except it works
-% for \meta{dim} registers.
-% \end{function}
-%
-% \begin{function}{ \prg_case_str:nnn / (EXP) }
-% \begin{syntax}
-% "\prg_case_str:nnn" \Arg{string} "{" \\
-% ~~\Arg{string 1} \Arg{code 1}\\
-% ~~\Arg{string 2} \Arg{code 2}\\
-% ~~"..."\\
-% ~~\Arg{string\,$\sb n$} \Arg{code,$\sb n$}\\
-% "}" \Arg{else case}
-% \end{syntax}
-% This function works just like |\prg_case_int:nnn| except it
-% compares strings. Each string is evaluated fully using \texttt{x}
-% style expansion.
-%
-% The function is expandable\footnote{Provided you use pdfTeX v1.30 or
-% later} and is written in such a way that
-% \texttt{f} style expansion can take place cleanly, i.e., no tokens
-% from within the function are left over.
-% \end{function}
-%
-% \begin{function}{ \prg_case_tl:Nnn / (EXP) }
-% \begin{syntax}
-% "\prg_case_tl:Nnn" <tl var.> "{"
-% ~~<tl var.\ 1> \Arg{code 1} <tl var.\ 2> \Arg{code 2} "..." <tl var.\,$\sb n$> \Arg{code\,$\sb n$}\\
-% "}" \Arg{else case}
-% \end{syntax}
-% This function works just like |\prg_case_int:nnn| except it
-% compares token list variables.
-%
-% The function is expandable\footnote{Provided you use pdfTeX v1.30 or
-% later} and is written in such a way that
-% \texttt{f} style expansion can take place cleanly, i.e., no tokens
-% from within the function are left over.
-% \end{function}
-%
-% \section{Generic loops}
-%
-%
-% \begin{function}{ \bool_while_do:nn |
-% \bool_until_do:nn |
-% \bool_do_while:nn |
-% \bool_do_until:nn }
-% \begin{syntax}
-% "\bool_while_do:nn" \Arg{boolean expression} \Arg{code} \\
-% "\bool_until_do:nn" \Arg{boolean expression} \Arg{code}
-% \end{syntax}
-% The `while' versions execute the code as long as <boolean
-% expression> is true and the `until' versions execute <code> as long
-% as <boolean expression> is false. The "while_do" functions execute
-% the body after testing the boolean and the "do_while" functions
-% executes the body first and then tests the boolean.
-% \end{function}
-%
-% \section{Choosing modes}
-%
-% \begin{function}{ \mode_if_vertical: / (pTF) }
-% \begin{syntax}
-% "\mode_if_vertical:TF" \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Determines if \TeX{} is in vertical mode or not and executes either
-% <true code> or <false code> accordingly.
-% \end{function}
-%
-% \begin{function}{ \mode_if_horizontal: / (pTF) }
-% \begin{syntax}
-% "\mode_if_horizontal:TF" \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Determines if \TeX{} is in horizontal mode or not and executes either
-% <true code> or <false code> accordingly.
-% \end{function}
-%
-%
-% \begin{function}{ \mode_if_inner: / (pTF) }
-% \begin{syntax}
-% "\mode_if_inner:TF" \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Determines if \TeX{} is in inner mode or not and executes either
-% <true code> or <false code> accordingly.
-% \end{function}
-%
-% \begin{function}{ \mode_if_math: / (pTF) }
-% \begin{syntax}
-% "\mode_if_math:TF" \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Determines if \TeX{} is in math mode or not and executes either
-% <true code> or <false code> accordingly.
-% \begin{texnote}
-% This version will choose the right branch even at the beginning of
-% an alignment cell.
-% \end{texnote}
-% \end{function}
-%
-%
-% \section{Alignment safe grouping and scanning}
-%
-% \begin{function}{\scan_align_safe_stop:}
-% \begin{syntax}
-% "\scan_align_safe_stop:"
-% \end{syntax}
-% This function gets \TeX{} on the right track inside an alignment
-% cell but without destroying any kerning.
-% \end{function}
-%
-%
-% \begin{function}{\group_align_safe_begin:|
-% \group_align_safe_end:}
-% \begin{syntax}
-% "\group_align_safe_begin:" <...> "\group_align_safe_end:"
-% \end{syntax}
-% Encloses <...> inside a group but is safe inside an alignment cell.
-% See the implementation of |\peek_token_generic:NNTF| for an
-% application.
-% \end{function}
-%
-%
-% \section{Producing $n$ copies}
-%
-% There are often several different requirements for producing
-% multiple copies of something. Sometimes one might want to produce a
-% number of identical copies of a sequence of tokens whereas at other
-% times the goal is to simulate a for loop as known from most real
-% programming languages.
-%
-% \begin{function}{\prg_replicate:nn / (EXP) }
-% \begin{syntax}
-% "\prg_replicate:nn" \Arg{number} \Arg{arg}
-% \end{syntax}
-% Creates <number> copies of <arg>. Note that it is expandable.
-% \end{function}
-%
-%
-% \begin{function}{\prg_stepwise_function:nnnN / (EXP) }
-% \begin{syntax}
-% "\prg_stepwise_function:nnnN" \Arg{start} \Arg{step}
-% \Arg{end} <function>
-% \end{syntax}
-% This function performs <action> once for each step starting at
-% <start> and ending once <end> is passed. <function> is placed
-% directly in front of a brace group holding the current number so it
-% should usually be a function taking one argument.
-% \end{function}
-%
-% \begin{function}{\prg_stepwise_inline:nnnn}
-% \begin{syntax}
-% "\prg_stepwise_inline:nnnn" \Arg{start} \Arg{step} \Arg{end}
-% \Arg{action}
-% \end{syntax}
-% Same as |\prg_stepwise_function:nnnN| except here <action> is
-% performed each time with |##1| as a placeholder for the number
-% currently being tested. This function is not expandable and it is
-% nestable.
-% \end{function}
-%
-% \begin{function}{\prg_stepwise_variable:nnnNn}
-% \begin{syntax}
-% "\prg_stepwise_variable:nnnn" \Arg{start} \Arg{step} \Arg{end}
-% <temp-var> \Arg{action}
-% \end{syntax}
-% Same as |\prg_stepwise_inline:nnnn| except here the current value is
-% stored in <temp-var> and the programmer can use it in <action>. This
-% function is not expandable.
-% \end{function}
-%
-% \section{Sorting}
-%
-%
-% \begin{function}{
-% \prg_quicksort:n |
-% }
-% \begin{syntax}
-% "\prg_quicksort:n" "{" \Arg{item~1} \Arg{item~2} \dots \Arg{item~n} "}"
-% \end{syntax}
-% Performs a Quicksort on the token list. The comparisons are
-% performed by the function |\prg_quicksort_compare:nnTF| which is up
-% to the programmer to define. When the sorting process is over, all
-% items are given as argument to the function
-% |\prg_quicksort_function:n| which the programmer also controls.
-% \end{function}
-%
-% \begin{function}{
-% \prg_quicksort_function:n |
-% \prg_quicksort_compare:nnTF
-% }
-% \begin{syntax}
-% "\prg_quicksort_function:n" \Arg{element} \\
-% "\prg_quicksort_compare:nnTF" \Arg{element 1} \Arg{element 2}\\
-% \end{syntax}
-% The two functions the programmer must define before calling
-% |\prg_quicksort:n|. As an example we could define
-% \begin{quote}
-% |\cs_set_nopar:Npn\prg_quicksort_function:n #1{{#1}}|\\
-% |\cs_set_nopar:Npn\prg_quicksort_compare:nnTF #1#2#3#4 {\int_compare:nNnTF{#1}>{#2}}|
-% \end{quote}
-% Then the function call
-% \begin{quote}
-% |\prg_quicksort:n {876234520}|
-% \end{quote}
-% would return |{0}{2}{2}{3}{4}{5}{6}{7}{8}|. An alternative example
-% where one sorts a list of words, |\prg_quicksort_compare:nnTF| could
-% be defined as
-% \begin{quote}
-% |\cs_set_nopar:Npn\prg_quicksort_compare:nnTF #1#2 {|\\
-% | \int_compare:nNnTF{\tl_compare:nn{#1}{#2}}>\c_zero }|
-% \end{quote}
-%
-% \end{function}
-%
-% \subsection{Variable type and scope}
-%
-%\begin{function}{\prg_variable_get_scope:N / (EXP) }
-% \begin{syntax}
-% "\prg_variable_get_scope:N" <variable>
-% \end{syntax}
-% Returns the scope (\texttt{g} for global, blank otherwise) for the
-% <variable>.
-%\end{function}
-%
-%\begin{function}{\prg_variable_get_type:N / (EXP) }
-% \begin{syntax}
-% "\prg_variable_get_type:N" <variable>
-% \end{syntax}
-% Returns the type of <variable> (\texttt{tl}, \texttt{int}, etc.)
-%\end{function}
-%
-%\subsection{Mapping to variables}
-%
-%\begin{function}{ \prg_new_map_functions:Nn }
-% \begin{syntax}
-% \cs{prg_new_map_functions:Nn} \meta{token} \Arg{name}
-% \end{syntax}
-% Creates a family of mapping functions which can be applied to
-% a token list, dividing the list up at each occurance of the
-% \meta{token}. The functions defined will be
-% \begin{itemize}
-% \item \cs{\meta{name}_map_function:NN}
-% \item \cs{\meta{name}_map_function:nN}
-% \item \cs{\meta{name}_map_inline:Nn}
-% \item \cs{\meta{name}_map_inline:nn}
-% \item \cs{\meta{name}_map_break:}
-% \end{itemize}
-% Of these, the \texttt{inline} functions are not expandable but
-% the other functions can be used in expansion contexts. The use of
-% each function is best illustrated by the \cs{clist_map_\ldots}
-% family defined by \LaTeX3 itself for mapping to comma-separated
-% lists. An error will be raised if the \meta{name} has already been
-% used to generate a family of mapping functions. All of the
-% definitions are created globally.
-%\end{function}
-%
-%\begin{function}{ \prg_set_map_functions:Nn }
-% \begin{syntax}
-% \cs{prg_set_map_functions:Nn} \meta{token} \Arg{name}
-% \end{syntax}
-% Creates a family of mapping functions which can be applied to
-% a token list, dividing the list up at each occurance of the
-% \meta{token}. The functions defined will be
-% \begin{itemize}
-% \item \cs{\meta{name}_map_function:NN}
-% \item \cs{\meta{name}_map_function:nN}
-% \item \cs{\meta{name}_map_inline:Nn}
-% \item \cs{\meta{name}_map_inline:nn}
-% \item \cs{\meta{name}_map_break:}
-% \end{itemize}
-% Of these, the \texttt{inline} functions are not expandable but
-% the other functions can be used in expansion contexts. The use of
-% each function is best illustrated by the \cs{clist_map_\ldots}
-% family defined by \LaTeX3 itself for mapping to comma-separated
-% lists. Any existing defintions for the \meta{name} will be
-% overwritten. All of the definitions are created globally.
-%\end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3prg} implementation}
-%
-% \TestFiles{m3prg001.lvt,m3prg002.lvt,m3prg003.lvt}
-%
-% \subsection{Variables}
-%
-% \begin{function}{ \l_tmpa_bool | \g_tmpa_bool }
-% Reserved booleans.
-% \end{function}
-%
-% \begin{variable}{\g_prg_inline_level_int}
-% Global variable to track the nesting of the stepwise inline loop.
-% \end{variable}
-%
-% \subsection{Module code}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macro}{\prg_return_true:}
-% \TestMissing{This function is implicitly tested with all other conditionals!}
-% \begin{macro}{\prg_return_false:}
-% \TestMissing{This function is also implicitly tested with all other conditionals!}
-% \begin{macro}{
-% \prg_set_conditional:Npnn,
-% \prg_new_conditional:Npnn,
-% \prg_set_protected_conditional:Npnn,
-% \prg_new_protected_conditional:Npnn
-%}
-% \begin{macro}{
-% \prg_set_conditional:Nnn,
-% \prg_new_conditional:Nnn,
-% \prg_set_protected_conditional:Nnn,
-% \prg_new_protected_conditional:Nnn
-%}
-% \begin{macro}{
-% \prg_set_eq_conditional:NNn,
-% \prg_new_eq_conditional:NNn
-%}
-% These are all defined in \pkg{l3basics}, as they are needed ``early''.
-% This is just a reminder that that is the case!
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \newpage ^^A because the previous macro margin block is really big!
-% \subsection{Choosing modes}
-%
-% \begin{macro}[pTF]{\mode_if_vertical:}
-% \UnitTested
-% For testing vertical mode. Strikes me here on the bus with David,
-% that as long as we are just talking about returning true and
-% false states, we can just use the primitive conditionals for this
-% and gobbling the |\c_zero| in the input stream. However this
-% requires knowledge of the implementation so we keep things nice
-% and clean and use the return statements.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \mode_if_vertical: {p,TF,T,F}{
- \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\mode_if_horizontal:}
-% \UnitTested
-% For testing horizontal mode.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \mode_if_horizontal: {p,TF,T,F}{
- \if_mode_horizontal: \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\mode_if_inner:}
-% \UnitTested
-% For testing inner mode.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \mode_if_inner: {p,TF,T,F}{
- \if_mode_inner: \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\mode_if_math:}
-% \UnitTested
-% For testing math mode. Uses the kern-save |\scan_align_safe_stop:|.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \mode_if_math: {p,TF,T,F}{
- \scan_align_safe_stop: \if_mode_math:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \paragraph{Alignment safe grouping and scanning}
-%
-%
-% \begin{macro}{\group_align_safe_begin:,\group_align_safe_end:}
-% \TeX's alignment structures present many problems. As Knuth says
-% himself in \emph{\TeX : The Program}: ``It's sort of a miracle
-% whenever |\halign| or |\valign| work, [\ldots]'' One problem relates
-% to commands that internally issues a |\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
-% sort of weird error message because the underlying
-% |\tex_futurelet:D| will store the token at the end of the alignment
-% template. This could be a |&|$\sb4$ giving a message like
-% |! Misplaced \cr.| or even worse: it could be the |\endtemplate|
-% token causing even more trouble! To solve this we have to open a
-% special group so that \TeX{} still thinks it's on safe ground but at
-% the same time we don't want to introduce any brace group that may
-% find its way to the output. The following functions help with this
-% by using code documented only in Appendix~D of
-% \emph{The \TeX book}\dots
-% \begin{macrocode}
-\cs_new_nopar:Npn \group_align_safe_begin: {
- \if_false:{\fi:\if_num:w`}=\c_zero\fi:}
-\cs_new_nopar:Npn \group_align_safe_end: {\if_num:w`{=\c_zero}\fi:}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\scan_align_safe_stop:}
-% When \TeX{} is in the beginning of an align cell (right after the
-% |\cr|) it is in a somewhat strange mode as it is looking ahead to
-% find an |\tex_omit:D| or |\tex_noalign:D| and hasn't looked at the
-% preamble yet. Thus an |\tex_ifmmode:D| test will always fail unless
-% we insert |\scan_stop:| to stop \TeX's scanning ahead. On the other
-% hand we don't want to insert a |\scan_stop:| every time as that will
-% destroy kerning between letters\footnote{Unless we enforce an extra
-% pass with an appropriate value of \texttt{\string\pretolerance}.}
-% Unfortunately there is no way to detect if we're in the beginning of
-% an alignment cell as they have different characteristics depending
-% on column number etc. However we \emph{can} detect if we're in an
-% alignment cell by checking the current group type and we can also
-% check if the previous node was a character or ligature. What is done
-% here is that |\scan_stop:| is only inserted iff a)~we're in the
-% outer part of an alignment cell and b)~the last node \emph{wasn't} a
-% char node or a ligature node.
-% \begin{macrocode}
-\cs_new_nopar:Npn \scan_align_safe_stop: {
- \int_compare:nNnT \etex_currentgrouptype:D = \c_six
- {
- \int_compare:nNnF \etex_lastnodetype:D = \c_zero
- {
- \int_compare:nNnF \etex_lastnodetype:D = \c_seven
- \scan_stop:
- }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Producing $n$ copies}
-%
-% \begin{macro}{\prg_replicate:nn}
-% \UnitTested
-% \begin{macro}[aux]{\prg_replicate_aux:N,\prg_replicate_first_aux:N}
-% This function uses a cascading csname technique by David Kastrup
-% (who else :-)
-%
-% The idea is to make the input "25" result in first adding five, and
-% then 20 copies of the code to be replicated. The technique uses
-% cascading csnames which means that we start building several csnames
-% so we end up with a list of functions to be called in reverse
-% order. This is important here (and other places) because it means
-% that we can for instance make the function that inserts five copies
-% of something to also hand down ten to the next function in
-% line. This is exactly what happens here: in the example with "25"
-% then the next function is the one that inserts two copies but it
-% sees the ten copies handed down by the previous function. In order
-% to avoid the last function to insert say, 100 copies of the original
-% argument just to gobble them again we define separate functions to
-% be inserted first. Finally we must ensure that the cascade comes to
-% a peaceful end so we make it so that the original csname \TeX{} is
-% creating is simply "\prg_do_nothing:" expanding to nothing.
-%
-% This function has one flaw though: Since it constantly passes down
-% ten copies of its previous argument it will severely affect 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. An
-% alternative approach is to create a string of "m"'s with
-% "\int_to_roman:w" which can be done with just four macros but that
-% method has its own problems since it can exhaust the string
-% pool. Also, it is considerably slower than what we use here so the
-% few extra csnames are well spent I would say.
-% \begin{macrocode}
-\cs_new_nopar:Npn \prg_replicate:nn #1{
- \cs:w prg_do_nothing:
- \exp_after:wN\prg_replicate_first_aux:N
- \tex_romannumeral:D -`\q \int_eval:n{#1} \cs_end:
- \cs_end:
-}
-\cs_new_nopar:Npn \prg_replicate_aux:N#1{
- \cs:w prg_replicate_#1:n\prg_replicate_aux:N
-}
-\cs_new_nopar:Npn \prg_replicate_first_aux:N#1{
- \cs:w prg_replicate_first_#1:n\prg_replicate_aux:N
-}
-% \end{macrocode}
-% \end{macro}
-%
-% Then comes all the functions that do the hard work of inserting all
-% the copies.
-% \begin{macrocode}
-\cs_new_nopar:Npn \prg_replicate_ :n #1{}% no, this is not a typo!
-\cs_new:cpn {prg_replicate_0:n}#1{\cs_end:{#1#1#1#1#1#1#1#1#1#1}}
-\cs_new:cpn {prg_replicate_1:n}#1{\cs_end:{#1#1#1#1#1#1#1#1#1#1}#1}
-\cs_new:cpn {prg_replicate_2:n}#1{\cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1}
-\cs_new:cpn {prg_replicate_3:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1}
-\cs_new:cpn {prg_replicate_4:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1#1}
-\cs_new:cpn {prg_replicate_5:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_6:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_7:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_8:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_9:n}#1{
- \cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1#1#1#1#1#1#1#1}
-% \end{macrocode}
-% Users shouldn't ask for something to be replicated once or even
-% not at all but\dots
-% \begin{macrocode}
-\cs_new:cpn {prg_replicate_first_-:n}#1{\cs_end: \ERROR }
-\cs_new:cpn {prg_replicate_first_0:n}#1{\cs_end: }
-\cs_new:cpn {prg_replicate_first_1:n}#1{\cs_end: #1}
-\cs_new:cpn {prg_replicate_first_2:n}#1{\cs_end: #1#1}
-\cs_new:cpn {prg_replicate_first_3:n}#1{\cs_end: #1#1#1}
-\cs_new:cpn {prg_replicate_first_4:n}#1{\cs_end: #1#1#1#1}
-\cs_new:cpn {prg_replicate_first_5:n}#1{\cs_end: #1#1#1#1#1}
-\cs_new:cpn {prg_replicate_first_6:n}#1{\cs_end: #1#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_first_7:n}#1{\cs_end: #1#1#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_first_8:n}#1{\cs_end: #1#1#1#1#1#1#1#1}
-\cs_new:cpn {prg_replicate_first_9:n}#1{\cs_end: #1#1#1#1#1#1#1#1#1}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\prg_stepwise_function:nnnN}
-% \UnitTested
-% \begin{macro}[aux]{\prg_stepwise_function_incr:nnnN,
-% \prg_stepwise_function_decr:nnnN}
-% A stepwise function. Firstly we check the direction of the steps
-% |#2| since that will depend on which test we should use. If the
-% step is positive we use a greater than test, otherwise a less than
-% test. If the test comes out true exit, otherwise perform |#4|,
-% add the step to |#1| and try again with this new value of |#1|.
-% \begin{macrocode}
-\cs_new:Npn \prg_stepwise_function:nnnN #1#2{
- \int_compare:nNnTF{#2}<\c_zero
- {\exp_args:Nf\prg_stepwise_function_decr:nnnN }
- {\exp_args:Nf\prg_stepwise_function_incr:nnnN }
- {\int_eval:n{#1}}{#2}
-}
-\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4{
- \int_compare:nNnF {#1}>{#3}
- {
- #4{#1}
- \exp_args:Nf \prg_stepwise_function_incr:nnnN
- {\int_eval:n{#1 + #2}}
- {#2}{#3}{#4}
- }
-}
-\cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4{
- \int_compare:nNnF {#1}<{#3}
- {
- #4{#1}
- \exp_args:Nf \prg_stepwise_function_decr:nnnN
- {\int_eval:n{#1 + #2}}
- {#2}{#3}{#4}
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prg_stepwise_inline:nnnn}
-% \UnitTested
-% \begin{variable}{\g_prg_inline_level_int}
-% \begin{macro}[aux]{\prg_stepwise_inline_decr:nnnn,
-% \prg_stepwise_inline_incr:nnnn}
-% This function uses the same approach as for instance
-% |\clist_map_inline:Nn| to allow arbitrary nesting. First construct
-% the special function and then call an auxiliary one which just
-% carries the newly constructed csname. Must make assignments global
-% when we maintain our own stack.
-% \begin{macrocode}
-\cs_new_protected:Npn\prg_stepwise_inline:nnnn #1#2#3#4{
- \int_gincr:N \g_prg_inline_level_int
- \cs_gset_nopar:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4}
- \int_compare:nNnTF {#2}<\c_zero
- {\exp_args:Ncf \prg_stepwise_inline_decr:Nnnn }
- {\exp_args:Ncf \prg_stepwise_inline_incr:Nnnn }
- {prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}
- {\int_eval:n{#1}} {#2} {#3}
- \int_gdecr:N \g_prg_inline_level_int
-}
-\cs_new:Npn \prg_stepwise_inline_incr:Nnnn #1#2#3#4{
- \int_compare:nNnF {#2}>{#4}
- {
- #1{#2}
- \exp_args:NNf \prg_stepwise_inline_incr:Nnnn #1
- {\int_eval:n{#2 + #3}} {#3}{#4}
- }
-}
-\cs_new:Npn \prg_stepwise_inline_decr:Nnnn #1#2#3#4{
- \int_compare:nNnF {#2}<{#4}
- {
- #1{#2}
- \exp_args:NNf \prg_stepwise_inline_decr:Nnnn #1
- {\int_eval:n{#2 + #3}} {#3}{#4}
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{variable}
-% \end{macro}
-%
-% \begin{macro}{\prg_stepwise_variable:nnnNn}
-% \UnitTested
-% \begin{macro}[aux]{\prg_stepwise_variable_decr:nnnNn,
-% \prg_stepwise_variable_incr:nnnNn}
-% Almost the same as above. Just store the value in |#4| and execute
-% |#5|.
-% \begin{macrocode}
-\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2 {
- \int_compare:nNnTF {#2}<\c_zero
- {\exp_args:Nf\prg_stepwise_variable_decr:nnnNn}
- {\exp_args:Nf\prg_stepwise_variable_incr:nnnNn}
- {\int_eval:n{#1}}{#2}
-}
-\cs_new_protected:Npn \prg_stepwise_variable_incr:nnnNn #1#2#3#4#5 {
- \int_compare:nNnF {#1}>{#3}
- {
- \cs_set_nopar:Npn #4{#1} #5
- \exp_args:Nf \prg_stepwise_variable_incr:nnnNn
- {\int_eval:n{#1 + #2}}{#2}{#3}#4{#5}
- }
-}
-\cs_new_protected:Npn \prg_stepwise_variable_decr:nnnNn #1#2#3#4#5 {
- \int_compare:nNnF {#1}<{#3}
- {
- \cs_set_nopar:Npn #4{#1} #5
- \exp_args:Nf \prg_stepwise_variable_decr:nnnNn
- {\int_eval:n{#1 + #2}}{#2}{#3}#4{#5}
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Booleans}
-% For normal booleans we set them to either "\c_true_bool" or "\c_false_bool"
-% and then use "\if_bool:N" to choose the right branch. The functions
-% return either the TF, T, or F case \emph{after} ending the |\if_bool:N|.
-% We only define the |N| versions here as the |c| versions can easily
-% be constructed with the expansion module.
-%
-% \begin{macro}{\bool_new:N,\bool_new:c,
-% \bool_set_true:N,\bool_set_true:c,
-% \bool_set_false:N,\bool_set_false:c,
-% \bool_gset_true:N,\bool_gset_true:c,
-% \bool_gset_false:N,\bool_gset_false:c}
-% \UnitTested
-% Defining and setting a boolean is easy.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool }
-\cs_new_protected_nopar:Npn \bool_new:c #1 { \cs_new_eq:cN {#1} \c_false_bool }
-\cs_new_protected_nopar:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool }
-\cs_new_protected_nopar:Npn \bool_set_true:c #1 { \cs_set_eq:cN {#1} \c_true_bool }
-\cs_new_protected_nopar:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool }
-\cs_new_protected_nopar:Npn \bool_set_false:c #1 { \cs_set_eq:cN {#1} \c_false_bool }
-\cs_new_protected_nopar:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool }
-\cs_new_protected_nopar:Npn \bool_gset_true:c #1 { \cs_gset_eq:cN {#1} \c_true_bool }
-\cs_new_protected_nopar:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool }
-\cs_new_protected_nopar:Npn \bool_gset_false:c #1 { \cs_gset_eq:cN {#1} \c_false_bool }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\bool_set_eq:NN,
-% \bool_set_eq:Nc,
-% \bool_set_eq:cN,
-% \bool_set_eq:cc,
-% \bool_gset_eq:NN,
-% \bool_gset_eq:Nc,
-% \bool_gset_eq:cN,
-% \bool_gset_eq:cc}
-% \UnitTested
-% Setting a boolean to another is also pretty easy.
-% \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
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{variable}{\l_tmpa_bool,\g_tmpa_bool}
-% A few booleans just if you need them.
-% \begin{macrocode}
-\bool_new:N \l_tmpa_bool
-\bool_new:N \g_tmpa_bool
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}[pTF]{\bool_if:N,\bool_if:c}
-% \UnitTested
-% Straight forward here. We could optimize here if we wanted to as
-% the boolean can just be input directly.
-% \begin{macrocode}
-\prg_set_conditional:Npnn \bool_if:N #1 {p,TF,T,F}{
- \if_bool:N #1 \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \bool_if_p:N {c}
-\cs_generate_variant:Nn \bool_if:NTF {c}
-\cs_generate_variant:Nn \bool_if:NT {c}
-\cs_generate_variant:Nn \bool_if:NF {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\bool_while_do:Nn,\bool_while_do:cn,
-% \bool_until_do:Nn,\bool_until_do:cn}
-% \UnitTested
-% \UnitTested
-% A "while" loop where the boolean is tested before executing the
-% statement. The `while' version executes the code as long as the
-% boolean is true; the `until' version executes the code as
-% long as the boolean is false.
-% \begin{macrocode}
-\cs_new:Npn \bool_while_do:Nn #1 #2 {
- \bool_if:NT #1 {#2 \bool_while_do:Nn #1 {#2}}
-}
-\cs_generate_variant:Nn \bool_while_do:Nn {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new:Npn \bool_until_do:Nn #1 #2 {
- \bool_if:NF #1 {#2 \bool_until_do:Nn #1 {#2}}
-}
-\cs_generate_variant:Nn \bool_until_do:Nn {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\bool_do_while:Nn,\bool_do_while:cn,
-% \bool_do_until:Nn,\bool_do_until:cn}
-% \UnitTested
-% \UnitTested
-% A "do-while" loop where the body is performed at least once and the
-% boolean is tested after executing the body. Otherwise identical to
-% the above functions.
-% \begin{macrocode}
-\cs_new:Npn \bool_do_while:Nn #1 #2 {
- #2 \bool_if:NT #1 {\bool_do_while:Nn #1 {#2}}
-}
-\cs_generate_variant:Nn \bool_do_while:Nn {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new:Npn \bool_do_until:Nn #1 #2 {
- #2 \bool_if:NF #1 {\bool_do_until:Nn #1 {#2}}
-}
-\cs_generate_variant:Nn \bool_do_until:Nn {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \subsection{Parsing boolean expressions}
-%
-% \begin{macro}[pTF]{\bool_if:n}
-% \UnitTested
-% \begin{macro}[aux]{\bool_get_next:N, \bool_cleanup:N, \bool_choose:NN,
-% \bool_!:w,
-% \bool_Not:w,
-% \bool_Not:w,
-% \bool_(:w,
-% \bool_p:w,
-% \bool_8_1:w,
-% \bool_I_1:w,
-% \bool_8_0:w,
-% \bool_I_0:w,
-% \bool_)_0:w,
-% \bool_)_1:w,
-% \bool_S_0:w,
-% \bool_S_1:w}
-%
-% Evaluating the truth value of a list of predicates is done using
-% an input syntax somewhat similar to the one found in other
-% programming languages with "(" and ")" for grouping, "!" for
-% logical `Not', "&&" for logical `And' and "||" for logical
-% "Or". We shall use the terms Not, And, Or, Open and Close for
-% these operations.
-%
-% Any expression is terminated by a Close operation. Evaluation
-% happens from left to right in the following manner using a GetNext
-% function:
-% \begin{itemize}
-% \item If an Open is seen, start evaluating a new expression using
-% the Eval function and
-% call GetNext again.
-% \item If a Not is seen, insert a negating function (if-even in
-% this case) and call GetNext.
-% \item If none of the above, start evaluating a new expression by
-% reinserting the token found (this is supposed to be a predicate
-% function) in front of Eval.
-% \end{itemize}
-% The Eval function then contains a post-processing operation which
-% grabs the instruction following the predicate. This is either And,
-% Or or Close. In each case the truth value is used to determine
-% where to go next. The following situations can arise:
-% \begin{description}
-% \item[\meta{true}And] Current truth value is true, logical And
-% seen, continue with GetNext to examine truth value of next
-% boolean (sub-)expression.
-% \item[\meta{false}And] Current truth value is false, logical And
-% seen, stop evaluating the predicates within this sub-expression
-% and break to the nearest Close. Then return \meta{false}.
-% \item[\meta{true}Or] Current truth value is true, logical Or
-% seen, stop evaluating the predicates within this sub-expression
-% and break to the nearest Close. Then return \meta{true}.
-% \item[\meta{false}Or] Current truth value is false, logical Or
-% seen, continue with GetNext to examine truth value of next
-% boolean (sub-)expression.
-% \item[\meta{true}Close] Current truth value is true, Close
-% seen, return \meta{true}.
-% \item[\meta{false}Close] Current truth value is false, Close
-% seen, return \meta{false}.
-% \end{description}
-% We introduce an additional Stop operation with the following
-% semantics:
-% \begin{description}
-% \item[\meta{true}Stop] Current truth value is true, return
-% \meta{true}.
-% \item[\meta{false}Stop] Current truth value is false, return
-% \meta{false}.
-% \end{description}
-% The reasons for this follow below.
-%
-% Now for how these works in practice. The canonical true and false
-% values have numerical values 1 and 0 respectively. We evaluate
-% this using the primitive "\tex_number:D" operation. First we
-% issue a "\group_align_safe_begin:" as we are using "&&" as syntax
-% shorthand for the And operation and we need to hide it for \TeX.
-% We also need to finish this special group before finally
-% returning a "\c_true_bool" or "\c_false_bool" as there might
-% otherwise be something left in front in the input stream. For
-% this we call the Stop operation, denoted simply by a "S"
-% following the last Close operation.
-% \begin{macrocode}
-\cs_new:Npn \bool_if_p:n #1{
- \group_align_safe_begin:
- \bool_get_next:N ( #1 )S
-}
-% \end{macrocode}
-% The GetNext operation. We make it a switch: If not a "!" or "(", we
-% assume it is a predicate.
-% \begin{macrocode}
-\cs_new:Npn \bool_get_next:N #1{
- \use:c {
- bool_
- \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi:
- :w
- } #1
-}
-% \end{macrocode}
-% This variant gets called when a \textsc{not} has just been entered.
-% It (eventually) results in a reveral of the logic of the directly following
-% material.
-% \begin{macrocode}
-\cs_new:Npn \bool_get_not_next:N #1{
- \use:c {
- bool_not_
- \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi:
- :w
- } #1
-}
-% \end{macrocode}
-% We need these later on to nullify the unity operation |!!|.
-% \begin{macrocode}
-\cs_new:Npn \bool_get_next:NN #1#2{
- \bool_get_next:N #2
-}
-\cs_new:Npn \bool_get_not_next:NN #1#2{
- \bool_get_not_next:N #2
-}
-% \end{macrocode}
-% The Not operation. Discard the token read and reverse the truth
-% value of the next expression if there
-% are brackets; otherwise
-% if we're coming up to a |!| then we don't need to reverse anything
-% (but we then want to continue scanning ahead in case some fool has written
-% |!!(...)|);
-% otherwise we have a boolean that we can reverse here and now.
-% \begin{macrocode}
-\cs_new:cpn { bool_!:w } #1#2 {
- \if_meaning:w ( #2
- \exp_after:wN \bool_Not:w
- \else:
- \if_meaning:w ! #2
- \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_next:NN
- \else:
- \exp_after:wN \exp_after:wN \exp_after:wN \bool_Not:N
- \fi:
- \fi:
- #2
-}
-% \end{macrocode}
-% Variant called when already inside a \textsc{not}.
-% Essentially the opposite of the above.
-% \begin{macrocode}
-\cs_new:cpn { bool_not_!:w } #1#2 {
- \if_meaning:w ( #2
- \exp_after:wN \bool_not_Not:w
- \else:
- \if_meaning:w ! #2
- \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_not_next:NN
- \else:
- \exp_after:wN \exp_after:wN \exp_after:wN \bool_not_Not:N
- \fi:
- \fi:
- #2
-}
-% \end{macrocode}
-% These occur when processing |!(...)|. The idea is to use a variant
-% of |\bool_get_next:N| that finishes its parsing with a logic reveral.
-% Of course, the double logic reversal gets us back to where we started.
-% \begin{macrocode}
-\cs_new:Npn \bool_Not:w {
- \exp_after:wN \tex_number:D \bool_get_not_next:N
-}
-\cs_new:Npn \bool_not_Not:w {
- \exp_after:wN \tex_number:D \bool_get_next:N
-}
-% \end{macrocode}
-% These occur when processing |!<bool>| and can be evaluated directly.
-% \begin{macrocode}
-\cs_new:Npn \bool_Not:N #1 {
- \exp_after:wN \bool_p:w
- \if_meaning:w #1 \c_true_bool
- \c_false_bool
- \else:
- \c_true_bool
- \fi:
-}
-\cs_new:Npn \bool_not_Not:N #1 {
- \exp_after:wN \bool_p:w
- \if_meaning:w #1 \c_true_bool
- \c_true_bool
- \else:
- \c_false_bool
- \fi:
-}
-% \end{macrocode}
-% The Open operation. Discard the token read and start a
-% sub-expression.
-% |\bool_get_next:N| continues building up the logical expressions as usual;
-% |\bool_not_cleanup:N| is what reverses the logic if we're inside |!(...)|.
-% \begin{macrocode}
-\cs_new:cpn {bool_(:w}#1{
- \exp_after:wN \bool_cleanup:N \tex_number:D \bool_get_next:N
-}
-\cs_new:cpn {bool_not_(:w}#1{
- \exp_after:wN \bool_not_cleanup:N \tex_number:D \bool_get_next:N
-}
-% \end{macrocode}
-% Otherwise just evaluate the predicate and look for And, Or or Close
-% afterward.
-% \begin{macrocode}
-\cs_new:cpn {bool_p:w}{\exp_after:wN \bool_cleanup:N \tex_number:D }
-\cs_new:cpn {bool_not_p:w}{\exp_after:wN \bool_not_cleanup:N \tex_number:D }
-% \end{macrocode}
-% This cleanup function can be omitted once predicates return their
-% true/false booleans outside the conditionals.
-% \begin{macrocode}
-\cs_new_nopar:Npn \bool_cleanup:N #1{
- \exp_after:wN \bool_choose:NN \exp_after:wN #1
- \int_to_roman:w-`\q
-}
-\cs_new_nopar:Npn \bool_not_cleanup:N #1{
- \exp_after:wN \bool_not_choose:NN \exp_after:wN #1
- \int_to_roman:w-`\q
-}
-% \end{macrocode}
-% Branching the six way switch.
-% Reversals should be reasonably straightforward.
-% When programming this, however, I got things around the wrong way a few times.
-% (Will's hacks onto Morten's code, that is.)
-% \begin{macrocode}
-\cs_new_nopar:Npn \bool_choose:NN #1#2{ \use:c{bool_#2_#1:w} }
-\cs_new_nopar:Npn \bool_not_choose:NN #1#2{ \use:c{bool_not_#2_#1:w} }
-% \end{macrocode}
-% Continues scanning. Must remove the second "&" or "|".
-% \begin{macrocode}
-\cs_new_nopar:cpn{bool_&_1:w}&{\bool_get_next:N}
-\cs_new_nopar:cpn{bool_|_0:w}|{\bool_get_next:N}
-\cs_new_nopar:cpn{bool_not_&_0:w}&{\bool_get_next:N}
-\cs_new_nopar:cpn{bool_not_|_1:w}|{\bool_get_next:N}
-% \end{macrocode}
-% Closing a group is just about returning the result. The Stop
-% operation is similar except it closes the special alignment group
-% before returning the boolean.
-% \begin{macrocode}
-\cs_new_nopar:cpn{bool_)_0:w}{ \c_false_bool }
-\cs_new_nopar:cpn{bool_)_1:w}{ \c_true_bool }
-\cs_new_nopar:cpn{bool_not_)_0:w}{ \c_true_bool }
-\cs_new_nopar:cpn{bool_not_)_1:w}{ \c_false_bool }
-\cs_new_nopar:cpn{bool_S_0:w}{\group_align_safe_end: \c_false_bool }
-\cs_new_nopar:cpn{bool_S_1:w}{\group_align_safe_end: \c_true_bool }
-% \end{macrocode}
-% When the truth value has already been decided, we have to throw away
-% the remainder of the current group as we are doing minimal
-% evaluation. This is slightly tricky as there are no braces so we
-% have to play match the "()" manually.
-% \begin{macrocode}
-\cs_new:cpn{bool_&_0:w}&{\bool_eval_skip_to_end:Nw \c_false_bool}
-\cs_new:cpn{bool_|_1:w}|{\bool_eval_skip_to_end:Nw \c_true_bool}
-\cs_new:cpn{bool_not_&_1:w}&{\bool_eval_skip_to_end:Nw \c_false_bool}
-\cs_new:cpn{bool_not_|_0:w}|{\bool_eval_skip_to_end:Nw \c_true_bool}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\bool_eval_skip_to_end:Nw,
-% \bool_eval_skip_to_end_aux:Nw,\bool_eval_skip_to_end_auxii:Nw}
-% There is always at least one ")" waiting, namely the outer
-% one. However, we are facing the problem that there may be more than
-% one that need to be finished off and we have to detect the correct
-% number of them. Here is a complicated example showing how this is
-% done. After evaluating the following, we realize we must skip
-% everything after the first And. Note the extra Close at the end.
-% \begin{quote}
-% |\c_false_bool && ((abc) && xyz) && ((xyz) && (def)))|
-% \end{quote}
-% First read up to the first Close. This gives us the list we first
-% read up until the first right parenthesis so we are looking at the
-% token list
-% \begin{quote}
-% |((abc|
-% \end{quote}
-% This contains two Open markers so we must remove two groups. Since
-% no evaluation of the contents is to be carried out, it doesn't
-% matter how we remove the groups as long as we wind up with the
-% correct result. We therefore first remove a "()" pair and what
-% preceded the Open -- but leave the contents as it may contain Open
-% tokens itself -- leaving
-% \begin{quote}
-% |(abc && xyz) && ((xyz) && (def)))|
-% \end{quote}
-% Another round of this gives us
-% \begin{quote}
-% |(abc && xyz|
-% \end{quote}
-% which still contains an Open so we remove another "()" pair, giving us
-% \begin{quote}
-% |abc && xyz && ((xyz) && (def)))|
-% \end{quote}
-% Again we read up to a Close and again find Open tokens:
-% \begin{quote}
-% |abc && xyz && ((xyz|
-% \end{quote}
-% Further reduction gives us
-% \begin{quote}
-% |(xyz && (def)))|
-% \end{quote}
-% and then
-% \begin{quote}
-% |(xyz && (def|
-% \end{quote}
-% with reduction to
-% \begin{quote}
-% |xyz && (def))|
-% \end{quote}
-% and ultimately we arrive at no Open tokens being skipped and we can
-% finally close the group nicely.
-%
-% This whole operation could be made a lot simpler if we were allowed
-% to do simple pattern matching. With a new enough pdf\TeX\ one can do
-% that sort of thing to test for existence of particular tokens.
-% \begin{macrocode}
-\cs_new:Npn \bool_eval_skip_to_end:Nw #1#2){
- \bool_eval_skip_to_end_aux:Nw #1 #2(\q_no_value\q_stop{#2}
-}
-% \end{macrocode}
-% If no right parenthesis, then |#3| is no_value and we are done, return
-% the boolean |#1|. If there is, we need to grab a () pair and then
-% recurse
-% \begin{macrocode}
-\cs_new:Npn \bool_eval_skip_to_end_aux:Nw #1#2(#3#4\q_stop#5{
- \quark_if_no_value:NTF #3
- { #1 }
- { \bool_eval_skip_to_end_auxii:Nw #1 #5 }
-}
-% \end{macrocode}
-% keep the boolean, throw away anything up to the ( as it is
-% irrelevant, remove a () pair but remember to reinsert |#3| as it may
-% contain ( tokens!
-% \begin{macrocode}
-\cs_new:Npn \bool_eval_skip_to_end_auxii:Nw #1#2(#3){
- \bool_eval_skip_to_end:Nw #1#3 )
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\bool_set:Nn,\bool_set:cn,\bool_gset:Nn,\bool_gset:cn}
-% This function evaluates a boolean expression and assigns the first
-% argument the meaning "\c_true_bool" or "\c_false_bool".
-% \begin{macrocode}
-\cs_new:Npn \bool_set:Nn #1#2 {\tex_chardef:D #1 = \bool_if_p:n {#2}}
-\cs_new: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}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\bool_not_p:n}
-% \UnitTested
-% The "not" variant just reverses the outcome of |\bool_if_p:n|. Can
-% be optimized but this is nice and simple and according to the
-% implementation plan. Not even particularly useful to have it when
-% the infix notation is easier to use.
-% \begin{macrocode}
-\cs_new:Npn \bool_not_p:n #1{ \bool_if_p:n{!(#1)} }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\bool_xor_p:nn}
-% \UnitTested
-% Exclusive or. If the boolean expressions have same truth value,
-% return false, otherwise return true.
-% \begin{macrocode}
-\cs_new:Npn \bool_xor_p:nn #1#2 {
- \int_compare:nNnTF {\bool_if_p:n { #1 }} = {\bool_if_p:n { #2 }}
- {\c_false_bool}{\c_true_bool}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\prg_set_conditional:Npnn \bool_if:n #1 {TF,T,F}{
- \if_predicate:w \bool_if_p:n{#1}
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-%
-% \begin{macro}{\bool_while_do:nn,\bool_do_while:nn}
-% \UnitTested
-% \begin{macro}{\bool_until_do:nn,\bool_do_until:nn}
-% \begin{arguments}
-% \item Predicate test
-% \item Code to execute
-% \end{arguments}
-% \begin{macrocode}
-\cs_new:Npn \bool_while_do:nn #1#2 {
- \bool_if:nT {#1} { #2 \bool_while_do:nn {#1}{#2} }
-}
-\cs_new:Npn \bool_until_do:nn #1#2 {
- \bool_if:nF {#1} { #2 \bool_until_do:nn {#1}{#2} }
-}
-\cs_new:Npn \bool_do_while:nn #1#2 {
- #2 \bool_if:nT {#1} { \bool_do_while:nn {#1}{#2} }
-}
-\cs_new:Npn \bool_do_until:nn #1#2 {
- #2 \bool_if:nF {#1} { \bool_do_until:nn {#1}{#2} }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Case switch}
-%
-% \begin{macro}{\prg_case_int:nnn}
-% \UnitTested
-% \begin{macro}[aux]{\prg_case_int_aux:nnn}
-% This case switch is in reality quite simple. It takes three arguments:
-% \begin{enumerate}
-% \item An integer expression you wish to find.
-% \item A list of pairs of \Arg{integer expr} \Arg{code}.
-% The list can be as long as is desired
-% and \meta{integer expr} can be negative.
-% \item The code to be executed if the value wasn't found.
-% \end{enumerate}
-% We don't need the else case here yet, so leave it dangling in the
-% input stream.
-% \begin{macrocode}
-\cs_new:Npn \prg_case_int:nnn #1 #2 {
-% \end{macrocode}
-% We will be parsing on |#1| for each step so we might as well
-% evaluate it first in case it is complicated.
-% \begin{macrocode}
- \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n{#1}} #2
-% \end{macrocode}
-% The \texttt{?} below is just so there are enough arguments when we
-% reach the end. And it made you look.~\texttt{;-)}
-% \begin{macrocode}
- \q_recursion_tail ? \q_recursion_stop
-}
-\cs_new:Npn \prg_case_int_aux:nnn #1#2#3{
-% \end{macrocode}
-% If we reach the end, return the else case. We just remove braces.
-% \begin{macrocode}
- \quark_if_recursion_tail_stop_do:nn{#2}{\use:n}
-% \end{macrocode}
-% Otherwise we compare (which evaluates |#2| for us)
-% \begin{macrocode}
- \int_compare:nNnTF{#1}={#2}
-% \end{macrocode}
-% If true, we want to remove the remainder of the list, the else case
-% and then execute the code specified. |\prg_end_case:nw {#3}| does
-% just that in one go. This means |f| style expansion works the way
-% one wants it to work.
-% \begin{macrocode}
- { \prg_end_case:nw {#3} }
- { \prg_case_int_aux:nnn {#1}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prg_case_dim:nnn}
-% \UnitTested
-% \begin{macro}[aux]{\prg_case_dim_aux:nnn}
-% Same as |\prg_case_dim:nnn| except it is for \meta{dim} registers.
-% \begin{macrocode}
-\cs_new:Npn \prg_case_dim:nnn #1 #2 {
- \exp_args:No \prg_case_dim_aux:nnn {\dim_eval:n{#1}} #2
- \q_recursion_tail ? \q_recursion_stop
-}
-\cs_new:Npn \prg_case_dim_aux:nnn #1#2#3{
- \quark_if_recursion_tail_stop_do:nn{#2}{\use:n}
- \dim_compare:nNnTF{#1}={#2}
- { \prg_end_case:nw {#3} }
- { \prg_case_dim_aux:nnn {#1}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prg_case_str:nnn}
-% \UnitTested
-% \begin{macro}[aux]{\prg_case_str_aux:nnn}
-% Same as |\prg_case_dim:nnn| except it is for strings.
-% \begin{macrocode}
-\cs_new:Npn \prg_case_str:nnn #1 #2 {
- \prg_case_str_aux:nnn {#1} #2
- \q_recursion_tail ? \q_recursion_stop
-}
-\cs_new:Npn \prg_case_str_aux:nnn #1#2#3{
- \quark_if_recursion_tail_stop_do:nn{#2}{\use:n}
- \str_if_eq:xxTF{#1}{#2}
- { \prg_end_case:nw {#3} }
- { \prg_case_str_aux:nnn {#1}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prg_case_tl:Nnn}
-% \UnitTested
-% \begin{macro}[aux]{\prg_case_tl_aux:NNn}
-% Same as |\prg_case_dim:nnn| except it is for token list variables.
-% \begin{macrocode}
-\cs_new:Npn \prg_case_tl:Nnn #1 #2 {
- \prg_case_tl_aux:NNn #1 #2
- \q_recursion_tail ? \q_recursion_stop
-}
-\cs_new:Npn \prg_case_tl_aux:NNn #1#2#3{
- \quark_if_recursion_tail_stop_do:Nn #2{\use:n}
- \tl_if_eq:NNTF #1 #2
- { \prg_end_case:nw {#3} }
- { \prg_case_tl_aux:NNn #1}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}[aux]{\prg_end_case:nw}
-% Ending a case switch is always performed the same way so we
-% optimize for this. |#1| is the code to execute, |#2| the
-% remainder, and |#3| the dangling else case.
-% \begin{macrocode}
-\cs_new:Npn \prg_end_case:nw #1#2\q_recursion_stop#3{#1}
-% \end{macrocode}
-% \end{macro}
-
-%
-% \subsection{Sorting}
-%
-%
-% \begin{macro}[aux]{\prg_define_quicksort:nnn}
-% |#1| is the name, |#2| and |#3| are the tokens enclosing the
-% argument. For the somewhat strange \meta{clist} type which doesn't
-% enclose the items but uses a separator we define it by hand
-% afterwards. When doing the first pass, the algorithm wraps all
-% elements in braces and then uses a generic quicksort which works
-% on token lists.
-%
-% As an example
-% \begin{quote}
-% |\prg_define_quicksort:nnn{seq}{\seq_elt:w}{\seq_elt_end:w}|
-% \end{quote}
-% defines the user function |\seq_quicksort:n| and furthermore
-% expects to use the two functions |\seq_quicksort_compare:nnTF|
-% which compares the items and |\seq_quicksort_function:n| which is
-% placed before each sorted item. It is up to the programmer to
-% define these functions when needed. For the |seq| type a sequence
-% is a token list variable, so one additionally has to define
-% \begin{quote}
-% |\cs_set_nopar:Npn \seq_quicksort:N{\exp_args:No\seq_quicksort:n}|
-% \end{quote}
-%
-%
-% For details on the implementation see ``Sorting in \TeX's Mouth''
-% by Bernd Raichle. Firstly we define the function for parsing the
-% initial list and then the braced list afterwards.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \prg_define_quicksort:nnn #1#2#3 {
- \cs_set:cpx{#1_quicksort:n}##1{
- \exp_not:c{#1_quicksort_start_partition:w} ##1
- \exp_not:n{#2\q_nil#3\q_stop}
- }
- \cs_set:cpx{#1_quicksort_braced:n}##1{
- \exp_not:c{#1_quicksort_start_partition_braced:n} ##1
- \exp_not:N\q_nil\exp_not:N\q_stop
- }
- \cs_set:cpx {#1_quicksort_start_partition:w} #2 ##1 #3{
- \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w
- \exp_not:c{#1_quicksort_do_partition_i:nnnw} {##1}{}{}
- }
- \cs_set:cpx {#1_quicksort_start_partition_braced:n} ##1 {
- \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w
- \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn} {##1}{}{}
- }
-% \end{macrocode}
-% Now for doing the partitions.
-% \begin{macrocode}
- \cs_set:cpx {#1_quicksort_do_partition_i:nnnw} ##1##2##3 #2 ##4 #3 {
- \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw}
- {
- \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4}
- \exp_not:c{#1_quicksort_partition_greater_ii:nnnn}
- \exp_not:c{#1_quicksort_partition_less_ii:nnnn}
- }
- {##1}{##2}{##3}{##4}
- }
- \cs_set:cpx {#1_quicksort_do_partition_i_braced:nnnn} ##1##2##3##4 {
- \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw}
- {
- \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4}
- \exp_not:c{#1_quicksort_partition_greater_ii_braced:nnnn}
- \exp_not:c{#1_quicksort_partition_less_ii_braced:nnnn}
- }
- {##1}{##2}{##3}{##4}
- }
- \cs_set:cpx {#1_quicksort_do_partition_ii:nnnw} ##1##2##3 #2 ##4 #3 {
- \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw}
- {
- \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1}
- \exp_not:c{#1_quicksort_partition_less_i:nnnn}
- \exp_not:c{#1_quicksort_partition_greater_i:nnnn}
- }
- {##1}{##2}{##3}{##4}
- }
- \cs_set:cpx {#1_quicksort_do_partition_ii_braced:nnnn} ##1##2##3##4 {
- \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw}
- {
- \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1}
- \exp_not:c{#1_quicksort_partition_less_i_braced:nnnn}
- \exp_not:c{#1_quicksort_partition_greater_i_braced:nnnn}
- }
- {##1}{##2}{##3}{##4}
- }
-% \end{macrocode}
-% This part of the code handles the two branches in each
-% sorting. Again we will also have to do it braced.
-% \begin{macrocode}
- \cs_set:cpx {#1_quicksort_partition_less_i:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{##2}{{##4}##3}}
- \cs_set:cpx {#1_quicksort_partition_less_ii:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2}{##3{##4}}}
- \cs_set:cpx {#1_quicksort_partition_greater_i:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{{##4}##2}{##3}}
- \cs_set:cpx {#1_quicksort_partition_greater_ii:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2{##4}}{##3}}
- \cs_set:cpx {#1_quicksort_partition_less_i_braced:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{##2}{{##4}##3}}
- \cs_set:cpx {#1_quicksort_partition_less_ii_braced:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2}{##3{##4}}}
- \cs_set:cpx {#1_quicksort_partition_greater_i_braced:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{{##4}##2}{##3}}
- \cs_set:cpx {#1_quicksort_partition_greater_ii_braced:nnnn} ##1##2##3##4{
- \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2{##4}}{##3}}
-% \end{macrocode}
-% Finally, the big kahuna! This is where the sub-lists are sorted.
-% \begin{macrocode}
- \cs_set:cpx {#1_do_quicksort_braced:nnnnw} ##1##2##3##4\q_stop {
- \exp_not:c{#1_quicksort_braced:n}{##2}
- \exp_not:c{#1_quicksort_function:n}{##1}
- \exp_not:c{#1_quicksort_braced:n}{##3}
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\prg_quicksort:n}
-% \UnitTested
-% A simple version. Sorts a list of tokens, uses the function
-% |\prg_quicksort_compare:nnTF| to compare items, and places the
-% function |\prg_quicksort_function:n| in front of each of them.
-% \begin{macrocode}
-\prg_define_quicksort:nnn {prg}{}{}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\prg_quicksort_function:n}
-% \UnitTested
-% \begin{macro}{\prg_quicksort_compare:nnTF}
-% \UnitTested
-% \begin{macrocode}
-\cs_set:Npn \prg_quicksort_function:n {\ERROR}
-\cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%\subsection{Variable type and scope}
-%
-%
-%\begin{macro}{\prg_variable_get_scope:N}
-%\begin{macro}[aux]{\prg_variable_get_scope_aux:w}
-%\begin{macro}{\prg_variable_get_type:N}
-%\begin{macro}[aux]{\prg_variable_get_type:w}
-% Expandable functions to find the type of a variable, and to
-% return \texttt{g} if the variable is global. The trick for
-% \cs{prg_variable_get_scope:N} is the same as that in
-% \cs{cs_split_function:NN}, but it can be simplified as the
-% requirements here are less complex.
-% \begin{macrocode}
-\group_begin:
- \tex_lccode:D `\& = `\g \tex_relax:D
- \tex_catcode:D `\& = \c_twelve \tex_relax:D
-\tl_to_lowercase:n {
- \group_end:
- \cs_new_nopar:Npn \prg_variable_get_scope:N #1 {
- \exp_last_unbraced:Nf \prg_variable_get_scope_aux:w
- { \cs_to_str:N #1 \exp_stop_f: \q_stop }
- }
- \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop {
- \token_if_eq_meaning:NNT & #1 {g}
- }
-}
-\group_begin:
- \tex_lccode:D `\& = `\_ \tex_relax:D
- \tex_catcode:D `\& = \c_twelve \tex_relax:D
-\tl_to_lowercase:n {
- \group_end:
- \cs_new_nopar:Npn \prg_variable_get_type:N #1 {
- \exp_after:wN \p;rg_variable_get_type_aux:w
- \token_to_str:N #1 & a \q_stop
- }
- \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop {
- \token_if_eq_meaning:NNTF a #2 {
- #1
- }{
- \prg_variable_get_type_aux:w #2#3 \q_stop
- }
- }
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Mapping to variables}
-%
-%\begin{macro}{\prg_new_map_functions:Nn}
-%\begin{macro}{\prg_set_map_functions:Nn}
-% The idea here is to generate all of the various mapping functions
-% in one go. Everything is done with expansion so that the performance
-% hit is taken at definition time and not at point of use. The inline
-% version uses a counter as this keeps things nestable, and global to
-% avoid problems with, for example, table cells.
-% \begin{macrocode}
-\cs_new_protected:Npn \prg_new_map_functions:Nn #1#2 {
- \cs_if_free:cTF { #2 _map_function:NN }
- { \prg_set_map_functions:Nn #1 {#2} }
- {
- \msg_kernel_error:nnx { code } { csname-already-defined }
- { \token_to_str:c { #2 _map_function:NN } }
- }
-}
-\cs_new_protected:Npn \prg_set_map_functions:Nn #1#2 {
- \cs_gset_nopar:cpx { #2 _map_function:NN } ##1##2
- {
- \exp_not:N \tl_if_empty:NF ##1
- {
- \exp_not:N \exp_after:wN
- \exp_not:c { #2 _map_function_aux:Nw }
- \exp_not:N \exp_after:wN ##2 ##1
- \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop }
- }
- }
- \cs_gset:cpx { #2 _map_function:nN } ##1##2
- {
- \exp_not:N \tl_if_blank:nF {##1}
- {
- \exp_not:c { #2 _map_function_aux:Nw } ##2 ##1
- \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop }
- }
- }
- \cs_gset:cpx { #2 _map_function_aux:Nw } ##1##2 #1
- {
- \exp_not:N \quark_if_recursion_tail_stop:n {##2}
- ##1 {##2}
- \exp_not:c { #2 _map_function_aux:Nw } ##1
- }
- \cs_if_free:cT { g_ #2 _map_inline_int }
- { \int_new:c { g_ #2 _map_inline_int } }
- \cs_gset_protected_nopar:cpx { #2 _map_inline:Nn } ##1##2
- {
- \exp_not:N \tl_if_empty:NF ##1
- {
- \exp_not:N \int_gincr:N \exp_not:c { g_ #2 _map_inline_int }
- \cs_gset:cpn
- {
- #2 _map_inline_
- \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int }
- :n
- }
- ####1 {##2}
- \exp_not:N \exp_last_unbraced:NcV
- \exp_not:c { #2 _map_function_aux:Nw }
- {
- #2 _map_inline_
- \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int }
- :n
- }
- ##1 \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop }
- \exp_not:N \int_gdecr:N \exp_not:c { g_ #2 _map_inline_int }
- }
- }
- \cs_gset_protected:cpx { #2 _map_inline:nn } ##1##2
- {
- \exp_not:N \tl_if_empty:nF {##1}
- {
- \exp_not:N \int_gincr:N \exp_not:c { g_ #2 _map_inline_int }
- \cs_gset:cpn
- {
- #2 _map_inline_
- \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int }
- :n
- }
- ####1 {##2}
- \exp_not:N \exp_args:Nc
- \exp_not:c { #2 _map_function_aux:Nw }
- {
- #2 _map_inline_
- \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int }
- :n
- }
- ##1 \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop }
- \exp_not:N \int_gdecr:N \exp_not:c { g_ #2 _map_inline_int }
- }
- }
- \cs_gset_eq:cN { #2 _map_break: }
- \use_none_delimit_by_q_recursion_stop:w
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-% That's it (for now).
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3prop.dtx b/Master/texmf-dist/source/latex/expl3/l3prop.dtx
deleted file mode 100644
index bd287f2e569..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3prop.dtx
+++ /dev/null
@@ -1,865 +0,0 @@
-% \iffalse
-%% File: l3prop.dtx Copyright (C) 1990-2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3prop.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental Property Lists}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3prop} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Property Lists}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \def\propkey{key}
-% \def\propval{info}
-% \def\proplist{prop}
-%
-% \begin{documentation}
-%
-% \LaTeX3 implements a data structure called a `property list' which allows
-% arbitrary information to be stored and accessed using keywords rather than
-% numerical indexing.
-%
-% A property list might contain a set of keys such as "name", "age", and "ID",
-% which each have individual values that can be saved and retrieved.
-%
-% \section{Functions}
-%
-% \begin{function}{%
-% \prop_new:N |
-% \prop_new:c |
-% }
-% \begin{syntax}
-% "\prop_new:N" <\proplist>
-% \end{syntax}
-% Defines <\proplist> to be a variable of type \meta{\proplist}.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_clear:N |
-% \prop_clear:c |
-% \prop_gclear:N |
-% \prop_gclear:c |
-% }
-% \begin{syntax}
-% "\prop_clear:N" <\proplist>
-% \end{syntax}
-% These functions locally or globally clear <\proplist>.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_put:Nnn |
-% \prop_put:Nno |
-% \prop_put:NnV |
-% \prop_put:NVn |
-% \prop_put:NVV |
-% \prop_put:Nnx |
-% \prop_put:cnn |
-% \prop_put:cnx |
-% \prop_gput:Nnn |
-% \prop_gput:NVn |
-% \prop_gput:Nno |
-% \prop_gput:NnV |
-% \prop_gput:Nnx |
-% \prop_gput:cnn |
-% \prop_gput:ccx |
-% }
-% \begin{syntax}
-% "\prop_put:Nnn" <\proplist> \Arg{\propkey} \Arg{token list}
-% \end{syntax}
-% Locally or globally associates <token list> with <\propkey> in the <\proplist>
-% <\proplist>. If <\propkey> has already a meaning within <\proplist> this value is
-% overwritten.
-%
-% The <\propkey> must not contain unescaped "#" tokens but the <token list> may.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_gput_if_new:Nnn |
-% }
-% \begin{syntax}
-% "\prop_gput_if_new:Nnn" <\proplist> \Arg{\propkey} \Arg{token list}
-% \end{syntax}
-% Globally associates <token list> with <\propkey> in the <\proplist>
-% <\proplist> but only if <\propkey> has so far no meaning within <\proplist>.
-% Silently ignored if <\propkey> is already set in the <\proplist>.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_get:NnN |
-% \prop_get:NVN |
-% \prop_get:cnN |
-% \prop_get:cVN |
-% \prop_gget:NnN |
-% \prop_gget:NVN |
-% \prop_gget:cnN |
-% \prop_gget:cVN |
-% }
-% \begin{syntax}
-% "\prop_get:NnN" <\proplist> \Arg{\propkey} <tl var.>
-% \end{syntax}
-% If <\propval> is the information associated with <\propkey> in the <\proplist>
-% <\proplist> then the token list variable <tl var.> gets <\propval> assigned.
-% Otherwise its value is the special quark "\q_no_value".
-%^^A See section \ref{sec:quarks} to test this.
-% The assignment is done either locally or globally.
-% \end{function}
-%
-% \begin{function}{ \prop_set_eq:NN |
-% \prop_set_eq:cN |
-% \prop_set_eq:Nc |
-% \prop_set_eq:cc |
-% \prop_gset_eq:NN |
-% \prop_gset_eq:cN |
-% \prop_gset_eq:Nc |
-% \prop_gset_eq:cc }
-% \begin{syntax}
-% "\prop_set_eq:NN" <\proplist 1> <\proplist 2>
-% \end{syntax}
-% A fast assignment of <\proplist>s.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_get_gdel:NnN |
-% }
-% \begin{syntax}
-% "\prop_get_gdel:NnN" <\proplist> \Arg{\propkey} <tl var.>
-% \end{syntax}
-% Like "\prop_get:NnN" but additionally removes <\propkey> (and its <\propval>)
-% from <\proplist>.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_del:Nn |
-% \prop_del:NV |
-% \prop_gdel:Nn |
-% \prop_gdel:NV |
-% }
-% \begin{syntax}
-% "\prop_del:Nn" <\proplist> \Arg{\propkey}
-% \end{syntax}
-% Locally or globally deletes <\propkey> and its <\propval> from <\proplist> if
-% found. Otherwise does nothing.
-% \end{function}
-%
-%
-% \begin{function}{ \prop_map_function:NN / (EXP) |
-% \prop_map_function:cN / (EXP) |
-% \prop_map_function:Nc / (EXP) |
-% \prop_map_function:cc / (EXP) }
-% \begin{syntax}
-% "\prop_map_function:NN" <\proplist> <function>
-% \end{syntax}
-% Maps <function> which should be a function with two arguments (<\propkey>
-% and <\propval>) over every <\propkey> <\propval> pair of <\proplist>.
-% Property lists do not have any intrinsic ``order'' when stored. As a
-% result, you should not expect any particular order to apply when using
-% these mapping functions, even with newly-created properly lists.
-% \end{function}
-%
-% \begin{function}{\prop_map_inline:Nn |
-% \prop_map_inline:cn
-% }
-% \begin{syntax}
-% "\prop_map_inline:Nn" <\proplist> \Arg{inline function}
-% \end{syntax}
-% Just like "\prop_map_function:NN" but with the function of two arguments
-% supplied as inline code. Within <inline function> refer to the
-% arguments via "#1" (<\propkey>) and "#2" (<\propval>). Nestable.
-% Property lists do not have any intrinsic ``order'' when stored. As a
-% result, you should not expect any particular order to apply when using
-% these mapping functions, even with newly-created properly lists.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \prop_map_break: |
-% }
-% \begin{syntax}
-% "\prop_map_inline:Nn" \meta{\proplist} "{"\\
-% " ... \"\meta{break test}":T {\prop_map_break:} }"
-% \end{syntax}
-% For breaking out of a loop. To be used inside "TF"-type functions as shown
-% in the example above.
-% \end{function}
-%
-% \begin{function}{ \prop_show:N |
-% \prop_show:c }
-% \begin{syntax}
-% "\prop_show:N" <\proplist>
-% \end{syntax}
-% Pauses the compilation and shows <\proplist> on the terminal output and
-% in the log file.
-% \end{function}
-%
-% \begin{function}{ \prop_display:N |
-% \prop_display:c }
-% \begin{syntax}
-% "\prop_display:N" <prop>
-% \end{syntax}
-% As with "\prop_show:N" but pretty prints the output one line per property pair.
-% \end{function}
-%
-%
-% \section{Predicates and conditionals}
-%
-% \begin{function}{ \prop_if_empty_p:N |
-% \prop_if_empty_p:c }
-% \begin{syntax}
-% "\prop_if_empty_p:N" <\proplist> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Predicates to test whether or not a particular <\proplist> is empty.
-% \end{function}
-%
-% \begin{function}{ \prop_if_empty:N / (TF)(EXP) |
-% \prop_if_empty:c / (TF)(EXP) }
-% \begin{syntax}
-% "\prop_if_empty:NTF" <\proplist> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Set of conditionals that test whether or not a particular <\proplist>
-% is empty.
-% \end{function}
-%
-% \begin{function}{
-% \prop_if_eq_p:NN / (EXP) |
-% \prop_if_eq_p:cN / (EXP) |
-% \prop_if_eq_p:Nc / (EXP) |
-% \prop_if_eq_p:cc / (EXP) |
-% \prop_if_eq:NN / (EXP)(TF) |
-% \prop_if_eq:cN / (EXP)(TF) |
-% \prop_if_eq:Nc / (EXP)(TF) |
-% \prop_if_eq:cc / (EXP)(TF) |
-% }
-% \begin{syntax}
-% "\prop_if_eq:NNF" <\proplist 1> <\proplist 2> \Arg{false code}
-% \end{syntax}
-% Execute <false code> if <\proplist 1> doesn't hold the same token list as
-% <\proplist 2>. Only expandable for new versions of pdf\TeX.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \prop_if_in:Nn / (TF) |
-% \prop_if_in:NV / (TF) |
-% \prop_if_in:No / (TF) |
-% \prop_if_in:cn / (TF) |
-% \prop_if_in:cc / (TF) |
-% }
-% \begin{syntax}
-% "\prop_if_in:NnTF" <\proplist> \Arg{\propkey} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if <\propkey> is used in <\proplist> and then either executes <true code>
-% or <false code>.
-% \end{function}
-%
-% \section{Internal functions}
-%
-% \begin{function}{\q_prop}
-% Quark used to delimit property lists internally.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_put_aux:w |
-% \prop_put_if_new_aux:w |
-% }
-% Internal functions implementing the put operations.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_get_aux:w |
-% \prop_gget_aux:w |
-% \prop_get_del_aux:w |
-% \prop_del_aux:w |
-% }
-% Internal functions implementing the get and delete operations.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_if_in_aux:w |
-% }
-% Internal function implementing the key test operation.
-% \end{function}
-%
-% \begin{function}{%
-% \prop_map_function_aux:w |
-% }
-% Internal function implementing the map operations.
-% \end{function}
-%
-% \begin{function}{%
-% \g_prop_inline_level_int |
-% }
-% Integer used in internal name for function used inside
-% "\prop_map_inline:NN".
-% \end{function}
-%
-% \begin{function}{\prop_split_aux:Nnn}
-% \begin{syntax}
-% "\prop_split_aux:Nnn" <\proplist> <\propkey> <cmd>
-% \end{syntax}
-% Internal function that invokes <cmd> with 3 arguments: 1st is the
-% beginning of <\proplist> before <\propkey>, 2nd is the value associated with
-% <\propkey>, 3rd is the rest of <\proplist> after <\propkey>. If there is no key
-% <\propkey> in <\proplist>, then the 2 arg is "\q_no_value" and the 3rd arg is
-% empty; otherwise the 3rd argument has the two extra tokens <\propkey>
-% "\q_no_value" at the end.
-%
-% This function is used to implement various get operations.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3prop} implementation}
-%
-% A property list is a token register whose contents is
-% of the form\par
-% {\centering|\q_prop| \meta{\propkey$\sb1$} |\q_prop| \marg{\propval$\sb1$} \ldots{}
-% |\q_prop| \meta{\propkey$\sb n$} |\q_prop| \marg{\propval$\sb n$}\par}
-%
-% The property \m{\propkey}s and \m{\propval}s might be arbitrary token lists; each
-% \m{\propval} is surrounded by braces.
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macro}{\q_prop}
-% The separator between \m{\propkey}s and \m{\propval}s and \m{\propkey}s.
-% \begin{macrocode}
-\quark_new:N\q_prop
-% \end{macrocode}
-% \end{macro}
-%
-% To get values from property-lists, token lists should be passed to
-% the appropriate functions.
-%
-% \subsection{Functions}
-%
-% \begin{macro}{\prop_new:N}
-% \begin{macro}{\prop_new:c}
-% Property lists are implemented as token registers.
-% \begin{macrocode}
-\cs_new_eq:NN \prop_new:N \toks_new:N
-\cs_new_eq:NN \prop_new:c \toks_new:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_clear:N}
-% \begin{macro}{\prop_clear:c}
-% \begin{macro}{\prop_gclear:N}
-% \begin{macro}{\prop_gclear:c}
-% The same goes for clearing a property list, either
-% locally or globally.
-% \begin{macrocode}
-\cs_new_eq:NN \prop_clear:N \toks_clear:N
-\cs_new_eq:NN \prop_clear:c \toks_clear:c
-\cs_new_eq:NN \prop_gclear:N \toks_gclear:N
-\cs_new_eq:NN \prop_gclear:c \toks_gclear:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_set_eq:NN}
-% \begin{macro}{\prop_set_eq:Nc}
-% \begin{macro}{\prop_set_eq:cN}
-% \begin{macro}{\prop_set_eq:cc}
-% \begin{macro}{\prop_gset_eq:NN}
-% \begin{macro}{\prop_gset_eq:Nc}
-% \begin{macro}{\prop_gset_eq:cN}
-% \begin{macro}{\prop_gset_eq:cc}
-% This makes two \m{\proplist}s have the same contents.
-% \begin{macrocode}
-\cs_new_eq:NN \prop_set_eq:NN \toks_set_eq:NN
-\cs_new_eq:NN \prop_set_eq:Nc \toks_set_eq:Nc
-\cs_new_eq:NN \prop_set_eq:cN \toks_set_eq:cN
-\cs_new_eq:NN \prop_set_eq:cc \toks_set_eq:cc
-\cs_new_eq:NN \prop_gset_eq:NN \toks_gset_eq:NN
-\cs_new_eq:NN \prop_gset_eq:Nc \toks_gset_eq:Nc
-\cs_new_eq:NN \prop_gset_eq:cN \toks_gset_eq:cN
-\cs_new_eq:NN \prop_gset_eq:cc \toks_gset_eq:cc
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_show:N}
-% \begin{macro}{\prop_show:c}
-% Show on the console the raw contents of a property list's token register.
-% \begin{macrocode}
-\cs_new_eq:NN \prop_show:N \toks_show:N
-\cs_new_eq:NN \prop_show:c \toks_show:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_display:N}
-% \begin{macro}{\prop_display:c}
-% Pretty print the contents of a property list on the console.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \prop_display:N #1 {
- \iow_term:x { Property-list~\token_to_str:N #1~contains~
- the~pairs~(without~outer~braces): }
- \toks_clear:N \l_tmpa_toks
- \prop_map_inline:Nn #1 {
- \toks_if_empty:NF \l_tmpa_toks {
- \toks_put_right:Nx \l_tmpa_toks {^^J>~}
- }
- \toks_put_right:Nx \l_tmpa_toks {
- \c_space_tl \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} \c_space_tl
- \c_space_tl => \c_space_tl
- \c_space_tl \iow_char:N \{ \exp_not:n {##2} \iow_char:N \}
- }
- }
- \toks_show:N \l_tmpa_toks
-}
-\cs_generate_variant:Nn \prop_display:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\prop_split_aux:Nnn}
-% |\prop_split_aux:Nnn|\meta{\proplist}\meta{\propkey}\meta{cmd} invokes \meta{cmd}
-% with 3 arguments: 1st is the beginning of \meta{\proplist} before
-% \meta{\propkey}, 2nd is the value associated with \meta{\propkey}, 3rd is the
-% rest of \meta{\proplist} after \meta{\propkey}. If there is no property
-% \meta{\propkey} in \meta{\proplist}, then the 2nd argument will be |\q_no_value|
-% and the 3rd argument is empty; otherwise the 3rd argument has the
-% extra tokens |\q_prop| \meta{\propkey} |\q_prop| |\q_no_value| at the end.
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_split_aux:Nnn #1#2#3{
- \cs_set:Npn \prop_tmp:w ##1 \q_prop #2 \q_prop ##2##3 \q_stop {
- #3 {##1}{##2}{##3}
- }
- \exp_after:wN \prop_tmp:w \toks_use:N #1 \q_prop #2 \q_prop \q_no_value \q_stop
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\prop_get:NnN}
-% \begin{macro}{\prop_get:NVN}
-% \begin{macro}{\prop_get:cnN}
-% \begin{macro}{\prop_get:cVN}
-% \begin{macro}{\prop_get_aux:w}
-% |\prop_get:NnN |\meta{\proplist}\meta{\propkey}\meta{tl var.}~defines
-% \meta{tl var.}~to be the value associated with \meta{\propkey} in \meta{\proplist},
-% |\q_no_value| if not found.
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_get:NnN #1#2 {
- \prop_split_aux:Nnn #1{#2}\prop_get_aux:w
-}
-\cs_new_protected:Npn \prop_get_aux:w #1#2#3#4 { \tl_set:Nn #4 {#2} }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_get:NnN { NVN, cnN, cVN }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_gget:NnN}
-% \begin{macro}{\prop_gget:NVN}
-% \begin{macro}{\prop_gget:NnN}
-% \begin{macro}{\prop_gget:NVN}
-% \begin{macro}{\prop_gget_aux:w}
-% The global version of the previous function.
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_gget:NnN #1#2{
- \prop_split_aux:Nnn #1{#2}\prop_gget_aux:w}
-\cs_new_protected:Npn \prop_gget_aux:w #1#2#3#4{\tl_gset:Nx#4{\exp_not:n{#2}}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_gget:NnN { NVN, cnN, cVN }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_get_gdel:NnN}
-% \begin{macro}{\prop_get_del_aux:w}
-% |\prop_get_gdel:NnN| is the same as |\prop_get:NnN| but the
-% \m{\propkey} and its value are afterwards globally removed
-% from \m{property_list}. One probably also needs the local
-% variants or only the local one, or\ldots\ We decide this later.
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_get_gdel:NnN #1#2#3{
- \prop_split_aux:Nnn #1{#2}{\prop_get_del_aux:w #3{\toks_gset:Nn #1}{#2}}}
-\cs_new_protected:Npn \prop_get_del_aux:w #1#2#3#4#5#6{
- \tl_set:Nn #1 {#5}
- \quark_if_no_value:NF #1 {
- \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#3\q_prop\q_no_value {#2{#4##1}}
- \prop_tmp:w #6}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_put:Nnn}
-% \begin{macro}{\prop_put:Nno}
-% \begin{macro}{\prop_put:NnV}
-% \begin{macro}{\prop_put:Nnx}
-% \begin{macro}{\prop_put:NVn}
-% \begin{macro}{\prop_put:NVV}
-% \begin{macro}{\prop_put:cnn}
-% \begin{macro}{\prop_put:cnx}
-% \begin{macro}{\prop_gput:Nnn}
-% \begin{macro}{\prop_gput:NVn}
-% \begin{macro}{\prop_gput:NnV}
-% \begin{macro}{\prop_gput:Nno}
-% \begin{macro}{\prop_gput:Nnx}
-% \begin{macro}{\prop_gput:cnn}
-% \begin{macro}{\prop_gput:ccx}
-% \begin{macro}{\prop_put_aux:w}
-% |\prop_put:Nnn| \marg{\proplist} \marg{\propkey} \marg{\propval} adds/changes the
-% value associated with \meta{\propkey} in \meta{\proplist} to \meta{\propval}.
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_put:Nnn #1#2{
- \prop_split_aux:Nnn #1{#2}{
- \prop_clear:N #1
- \prop_put_aux:w {\toks_put_right:Nn #1}{#2}
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_gput:Nnn #1#2{
- \prop_split_aux:Nnn #1{#2}{
- \prop_gclear:N #1
- \prop_put_aux:w {\toks_gput_right:Nn #1}{#2}
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_put_aux:w #1#2#3#4#5#6{
- #1{\q_prop#2\q_prop{#6}#3}
- \tl_if_empty:nF{#5}
- {
- \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{##1}}
- \prop_tmp:w #5
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_put:Nnn { Nno , NnV, Nnx, NVn, NVV, cnn , cnx }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_gput:Nnn {NVn,NnV,Nno,Nnx,Nox,cnn,ccx}
-% \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}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_del:Nn}
-% \begin{macro}{\prop_del:NV}
-% \begin{macro}{\prop_gdel:NV}
-% \begin{macro}{\prop_gdel:Nn}
-% \begin{macro}{\prop_del_aux:w}
-% |\prop_del:Nn |\meta{\proplist}\meta{\propkey} deletes the entry for
-% \meta{\propkey} in \meta{\proplist}, if any.
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_del:Nn #1#2{
- \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_set:Nn #1}{#2}}}
-\cs_new_protected:Npn \prop_gdel:Nn #1#2{
- \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_gset:Nn #1}{#2}}}
-\cs_new_protected:Npn \prop_del_aux:w #1#2#3#4#5{
- \cs_set_nopar:Npn \prop_tmp:w {#4}
- \quark_if_no_value:NF \prop_tmp:w {
- \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{#3##1}}
- \prop_tmp:w #5
- }
-}
-\cs_generate_variant:Nn \prop_del:Nn { NV }
-\cs_generate_variant:Nn \prop_gdel:Nn { NV }
-%
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\prop_gput_if_new:Nnn}
-% \begin{macro}{\prop_put_if_new_aux:w}
-% |\prop_gput_if_new:Nnn| \m{\proplist} \m{\propkey}
-% \m{\propval} is equivalent to
-% \begin{tabbing}
-% xxxxx\=xxxxx\= \kill
-% |\prop_if_in:NnTF |\m{\proplist}\m{\propkey} \\
-% \> |{}%| \\
-% \> |{\prop_gput:Nnn| \\
-% \>\> \m{property_list} \\
-% \>\> \m{\propkey} \\
-% \>\> \m{\propval}|}|
-% \end{tabbing}
-% Here we go (listening to Porgy \& Bess in a recording with Ella
-% F. and Louis A. which makes writing macros sometimes difficult; I
-% find myself humming instead of working):
-% \begin{macrocode}
-\cs_new_protected:Npn \prop_gput_if_new:Nnn #1#2{
- \prop_split_aux:Nnn #1{#2}{\prop_put_if_new_aux:w #1{#2}}}
-\cs_new_protected:Npn \prop_put_if_new_aux:w #1#2#3#4#5#6{
- \tl_if_empty:nT {#5}{#1{\q_prop#2\q_prop{#6}#3}}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Predicates and conditionals}
-%
-% \begin{macro}{\prop_if_empty_p:N,\prop_if_empty_p:c}
-% \begin{macro}[TF]{\prop_if_empty:N,\prop_if_empty:c}
-% This conditional takes a \m{\proplist} as its argument and evaluates
-% either the true or the false case, depending on whether or not
-% \m{\proplist} contains any properties.
-% \begin{macrocode}
-\prg_new_eq_conditional:NNn \prop_if_empty:N \toks_if_empty:N {p,TF,T,F}
-\prg_new_eq_conditional:NNn \prop_if_empty:c \toks_if_empty:c {p,TF,T,F}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\prop_if_eq_p:NN,\prop_if_eq_p:cN,
-% \prop_if_eq_p:Nc,\prop_if_eq_p:cc}
-% \begin{macro}[TF]{\prop_if_eq:NN,\prop_if_eq:Nc,
-% \prop_if_eq:cN,\prop_if_eq:cc}
-% These functions test whether two property lists are equal.
-% \begin{macrocode}
-\prg_new_eq_conditional:NNn \prop_if_eq:NN \toks_if_eq:NN {p,TF,T,F}
-\prg_new_eq_conditional:NNn \prop_if_eq:cN \toks_if_eq:cN {p,TF,T,F}
-\prg_new_eq_conditional:NNn \prop_if_eq:Nc \toks_if_eq:Nc {p,TF,T,F}
-\prg_new_eq_conditional:NNn \prop_if_eq:cc \toks_if_eq:cc {p,TF,T,F}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[TF]{\prop_if_in:Nn}
-% \begin{macro}[TF]{\prop_if_in:NV}
-% \begin{macro}[TF]{\prop_if_in:No}
-% \begin{macro}[TF]{\prop_if_in:cn}
-% \begin{macro}[TF]{\prop_if_in:cc}
-% \begin{macro}{\prop_if_in_aux:w}
-% |\prop_if_in:NnTF| \m{property_list} \m{\propkey}
-% \m{true_case} \m{false_case} will check whether or not
-% \m{\propkey} is on the \m{property_list} and then select
-% either the true or false case.
-% \begin{macrocode}
-\prg_new_protected_conditional:Nnn \prop_if_in:Nn {TF,T,F} {
- \prop_split_aux:Nnn #1 {#2} {\prop_if_in_aux:w}
-}
-\cs_new_nopar:Npn \prop_if_in_aux:w #1#2#3 {
- \quark_if_no_value:nTF {#2} {\prg_return_false:} {\prg_return_true:}
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_if_in:NnTF {NV,No,cn,cc}
-\cs_generate_variant:Nn \prop_if_in:NnT {NV,No,cn,cc}
-\cs_generate_variant:Nn \prop_if_in:NnF {NV,No,cn,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Mapping functions}
-%
-% \begin{macro}{\prop_map_function:NN}
-% \begin{macro}{\prop_map_function:cN}
-% \begin{macro}{\prop_map_function:Nc}
-% \begin{macro}{\prop_map_function:cc}
-% \begin{macro}{\prop_map_function_aux:w}
-% Maps a function on every entry in the property list. The
-% function must take 2 arguments: a key and a value.
-%
-% First, some failed attempts:
-% \begin{verbatim}
-% \cs_new_nopar:Npn \prop_map_function:NN #1#2{
-% \exp_after:wN \prop_map_function_aux:w
-% \exp_after:wN #2 \toks_use:N #1 \q_prop{}\q_prop \q_no_value \q_stop
-% }
-% \cs_new_nopar:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{
-% \if_predicate:w \tl_if_empty_p:n{#2}
-% \exp_after:wN \prop_map_break:
-% \fi:
-% #1{#2}{#3}
-% \prop_map_function_aux:w #1
-% }
-% \end{verbatim}
-% problem with the above implementation is that an empty key stops the mapping but all
-% other functions in the module allow the use of empty keys (as one value)
-% \begin{verbatim}
-% \cs_set_nopar:Npn \prop_map_function:NN #1#2{
-% \exp_after:wN \prop_map_function_aux:w
-% \exp_after:wN #2 \toks_use:N #1 \q_prop \q_no_value \q_prop \q_no_value
-% }
-% \cs_set_nopar:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{
-% \quark_if_no_value:nF{#2}
-% {
-% #1{#2}{#3}
-% \prop_map_function_aux:w #1
-% }
-% }
-% \end{verbatim}
-% problem with the above implementation is that |\quark_if_no_value:nF| is fairly slow and
-% if |\quark_if_no_value:NF| is used instead we have to do an assignment thus
-% making the mapping not expandable (is that important?)
-%
-% Here's the current version of the code:
-% \begin{macrocode}
-\cs_set_nopar:Npn \prop_map_function:NN #1#2 {
- \exp_after:wN \prop_map_function_aux:w
- \exp_after:wN #2 \toks_use:N #1 \q_prop \q_nil \q_prop \q_no_value \q_stop
-}
-\cs_set:Npn \prop_map_function_aux:w #1 \q_prop #2 \q_prop #3 {
- \if_meaning:w \q_nil #2
- \exp_after:wN \prop_map_break:
- \fi:
- #1{#2}{#3}
- \prop_map_function_aux:w #1
-}
-% \end{macrocode}
-% (potential) problem with the above implementation is that it will
-% return true if |#2| contains more than just |\q_nil| thus executing
-% whatever follows. Claim: this can't happen |:-)| so we should be ok
-% \begin{macrocode}
-\cs_generate_variant:Nn \prop_map_function:NN {c,Nc,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_map_inline:Nn}
-% \begin{macro}{\prop_map_inline:cn}
-% \begin{macro}{\g_prop_inline_level_int}
-% The inline functions are straight forward. It takes longer
-% to test if the list is empty than to run it on an empty list so
-% we don't waste time doing that.
-% \begin{macrocode}
-\int_new:N \g_prop_inline_level_int
-\cs_new_protected_nopar:Npn \prop_map_inline:Nn #1#2 {
- \int_gincr:N \g_prop_inline_level_int
- \cs_gset:cpn {prop_map_inline_ \int_use:N \g_prop_inline_level_int :n}
- ##1##2{#2}
- \prop_map_function:Nc #1
- {prop_map_inline_ \int_use:N \g_prop_inline_level_int :n}
- \int_gdecr:N \g_prop_inline_level_int
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn\prop_map_inline:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prop_map_break:}
-% The break statement.
-% \begin{macrocode}
-\cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_stop:w
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3quark.dtx b/Master/texmf-dist/source/latex/expl3/l3quark.dtx
deleted file mode 100644
index 26372d5209e..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3quark.dtx
+++ /dev/null
@@ -1,441 +0,0 @@
-% \iffalse
-%% File: l3quark.dtx Copyright (C) 1990-2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3quark.dtx 2234 2011-04-14 19:58:43Z joseph $
- {L3 Experimental Quark Commands}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full,checktest]{l3doc}
-\begin{document}
-\DocInput{l3quark.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3quark} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% ``Quarks''}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% A special type of constants in \LaTeX3 are `quarks'. These are control
-% sequences that expand to themselves and should therefore NEVER be
-% executed directly in the code. This would result in an endless loop!
-%
-% They are meant to be used as delimiter is weird functions (for
-% example as the stop token (i.e., "\q_stop"). They also permit the
-% following ingenious trick: when you pick up a token in a temporary,
-% and you want to know whether you have picked up a particular quark,
-% all you have to do is compare the temporary to the quark using
-% "\if_meaning:w". A set of special quark testing functions is set up
-% below. All the quark testing functions are expandable although the
-% ones testing only single tokens are much faster.
-%
-% By convention all constants of type quark start out with "\q_".
-%
-% The documentation needs some updating.
-%
-% \section{Functions}
-%
-% \begin{function}{ \quark_new:N }
-% \begin{syntax}
-% "\quark_new:N" <quark>
-% \end{syntax}
-% Defines <quark> to be a new constant of type "quark".
-% \end{function}
-%
-% \begin{function}{%
-% \quark_if_no_value:n / (pTF) ,
-% \quark_if_no_value:N / (pTF) ,
-% }
-% \begin{syntax}
-% "\quark_if_no_value:nTF" \Arg{token list} \Arg{true code} \Arg{false code}
-% "\quark_if_no_value:NTF" <tl var.> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% This tests whether or not <token list> contains only the quark
-% "\q_no_value".
-%
-% If <token list> to be tested is stored in a token list variable use
-% "\quark_if_no_value:NTF", or "\quark_if_no_value:NF" or check the
-% value directly with "\if_meaning:w". All those cases are faster then
-% "\quark_if_no_value:nTF" so should be preferred.\footnote{Clarify
-% semantic of the ``n'' case \ldots{} i think it is not implement
-% according to what we originally intended /FMi}
-%
-% \begin{texnote}
-% But be aware of the fact that "\if_meaning:w" can result in an
-% overflow of \TeX{}'s parameter stack since it leaves the corresponding
-% "\fi:" on the input until the whole replacement text is processed. It
-% is therefore better in recursions to use "\quark_if_no_value:NTF" as
-% it will remove the conditional prior to processing the "T" or "F" case
-% and so allows tail-recursion.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \quark_if_nil:N / (pTF) ,
-% }
-% \begin{syntax}
-% "\quark_if_nil:NTF" <token> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% This tests whether or not <token> is equal to the quark
-% "\q_nil".
-%
-% This is a useful test for recursive loops which typically has
-% "\q_nil" as an end marker.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \quark_if_nil:n / (pTF) ,
-% \quark_if_nil:V / (pTF) ,
-% \quark_if_nil:o / (pTF) ,
-% }
-% \begin{syntax}
-% "\quark_if_nil:nTF" \Arg{tokens} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% This tests whether or not <tokens> is equal to the quark
-% "\q_nil".
-%
-% This is a useful test for recursive loops which typically has
-% "\q_nil" as an end marker.
-% \end{function}
-%
-% \section{Recursion}
-%
-% This module provides a uniform interface to intercepting and
-% terminating loops as when one is doing tail recursion. The building
-% blocks follow below.
-%
-% \begin{variable}{\q_recursion_tail}
-% This quark is appended to the data structure in question and
-% appears as a real element there. This means it gets any list
-% separators around it.
-% \end{variable}
-%
-% \begin{variable}{\q_recursion_stop}
-% This quark is added \emph{after} the data structure. Its purpose
-% is to make it possible to terminate the recursion at any point
-% easily.
-% \end{variable}
-%
-% \begin{function}{%
-% \quark_if_recursion_tail_stop:N / (EXP) ,
-% \quark_if_recursion_tail_stop:n / (EXP) ,
-% \quark_if_recursion_tail_stop:o / (EXP) ,
-% }
-% \begin{syntax}
-% "\quark_if_recursion_tail_stop:n" \Arg{list element} \\
-% "\quark_if_recursion_tail_stop:N" <list element>
-% \end{syntax}
-% This tests whether or not <list element> is equal to
-% "\q_recursion_tail" and then exits, i.e., it gobbles the remainder of
-% the list up to and including "\q_recursion_stop" which \emph{must}
-% be present.
-%
-% If <list element> is not under your complete control it is advisable
-% to use the "n". If you wish to use the "N" form you \emph{must}
-% ensure it is really a single token such as if you have
-% \begin{quote}
-% "\tl_set:Nn \l_tmpa_tl {" <list element> "}"
-% \end{quote}
-% \end{function}
-%
-% \begin{function}{%
-% \quark_if_recursion_tail_stop_do:Nn / (EXP) ,
-% \quark_if_recursion_tail_stop_do:nn / (EXP) ,
-% \quark_if_recursion_tail_stop_do:on / (EXP) ,
-% }
-% \begin{syntax}
-% "\quark_if_recursion_tail_stop_do:nn"
-% ~~~~\Arg{list element} \Arg{post action}
-% "\quark_if_recursion_tail_stop_do:Nn"
-% ~~~~<list element> \Arg{post action}
-% \end{syntax}
-% Same as "\quark_if_recursion_tail_stop:N" except here the second
-% argument is executed after the recursion has been terminated.
-% \end{function}
-%
-% \section{Constants}
-%
-% \begin{variable}{\q_no_value} The canonical `missing value quark'
-% that is returned by certain functions to denote that a requested value
-% is not found in the data structure.
-% \end{variable}
-%
-% \begin{variable}{\q_stop}
-% This constant is used as a a marker in parameter text. This allows a
-% scanning function to find the end of some input string.
-% \end{variable}
-%
-% \begin{variable}{\q_nil}
-% This constant represent the nil pointer in pointer structures.
-% \end{variable}
-%
-% \begin{variable}{\q_error}
-% Delimits the end of
-% the computation for purposes of error recovery.
-% \end{variable}
-%
-% \begin{variable}{\q_mark}
-% Used in parameter text when we need a scanning boundary that is
-% distinct from |\q_stop|.
-% \end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3quark} implementation}
-%
-% \TestFiles{m3quark001.lvt}
-%
-% We start by ensuring that the required packages are loaded.
-% We check for \texttt{l3expan} since this a basic package that is
-% essential for use of any higher-level package.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macro}{\quark_new:N}
-% Allocate a new quark.
-% \UnitTested
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \quark_new:N #1 { \tl_const:Nn #1 {#1} }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{variable}{\q_stop,\q_no_value,\q_nil}
-% |\q_stop| is often used as a marker in parameter text,
-% |\q_no_value| is the canonical missing value, and |\q_nil|
-% represents a nil pointer in some data structures.
-% \begin{macrocode}
-\quark_new:N \q_stop
-\quark_new:N \q_no_value
-\quark_new:N \q_nil
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{variable}{\q_error,\q_mark}
-% We need two additional quarks. |\q_error| delimits the end of
-% the computation for purposes of error recovery. |\q_mark| is
-% used in parameter text when we need a scanning boundary that is
-% distinct from |\q_stop|.
-% \begin{macrocode}
-\quark_new:N\q_error
-\quark_new:N\q_mark
-% \end{macrocode}
-% \end{variable}
-%
-%
-% \begin{variable}{\q_recursion_tail,\q_recursion_stop}
-% Quarks for ending recursions. Only ever used there!
-% |\q_recursion_tail| is appended to whatever list structure we are
-% doing recursion on, meaning it is added as a proper list item with
-% whatever list separator is in use. |\q_recursion_stop| is placed
-% directly after the list.
-% \begin{macrocode}
-\quark_new:N\q_recursion_tail
-\quark_new:N\q_recursion_stop
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}{\quark_if_recursion_tail_stop:N}
-% \UnitTested
-% \begin{macro}{\quark_if_recursion_tail_stop_do:Nn}
-% \UnitTested
-% When doing recursions, it is easy to spend a lot of time testing if the
-% end marker has been found. To avoid this, a dedicated end marker is used
-% each time a recursion is set up. Thus if the marker is found everything
-% can be wrapper up and finished off. The simple case is when the test
-% can guarantee that only a single token is being tested. In this case,
-% there is just a dedicated copy of the standard quark test. Both a gobbling
-% version and one inserting end code are provided.
-% \begin{macrocode}
-\cs_new:Npn \quark_if_recursion_tail_stop:N #1
- {
- \tex_ifx:D #1 \q_recursion_tail
- \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
- \tex_fi:D
- }
-\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2
- {
- \tex_ifx:D #1 \q_recursion_tail
- \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw
- \tex_else:D
- \exp_after:wN \use_none:n
- \tex_fi:D
- {#2}
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}
-% {\quark_if_recursion_tail_stop:n,\quark_if_recursion_tail_stop:o}
-% \UnitTested
-% \begin{macro}
-% {\quark_if_recursion_tail_stop_do:nn,\quark_if_recursion_tail_stop_do:on}
-% \UnitTested
-% \begin{macro}[aux]{\quark_if_recursion_tail_aux:w}
-% The same idea applies when testing multiple tokens, but here a little more
-% care is needed. It is possible that |#1| might be something like
-% |{{{a}}}| or |{ab\iffalse}\fi|, which will therefore need to be tested
-% in a detokenized manner. The way that this is done is using
-% \cs{tex_ifcat:D}, with the idea being that this test will be \texttt{true}
-% provided the auxiliary function returns nothing at all. If the auxiliary
-% returns anything, it will be detokenized and so the test will be both
-% \texttt{false} and safe.
-% \begin{macrocode}
-\cs_new:Npn \quark_if_recursion_tail_stop:n #1
- {
- \tex_ifcat:D
- A
- \etex_detokenize:D \exp_after:wN
- {
- \quark_if_recursion_tail_aux:w #1 \q_recursion_stop
- \q_recursion_tail \q_recursion_stop \q_stop
- }
- A
- \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
- \tex_fi:D
- }
-\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2
- {
- \tex_ifcat:D
- A
- \etex_detokenize:D \exp_after:wN
- {
- \quark_if_recursion_tail_aux:w #1 \q_recursion_stop
- \q_recursion_tail \q_recursion_stop \q_stop
- }
- A
- \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw
- \tex_else:D
- \exp_after:wN \use_none:n
- \tex_fi:D
- {#2}
- }
-\cs_new:Npn \quark_if_recursion_tail_aux:w
- #1 \q_recursion_tail #2 \q_recursion_stop #3 \q_stop
- { #1 #2 }
-\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o }
-\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\quark_if_no_value:N,\quark_if_no_value:n}
-% \UnitTested
-% Here we test if we found a special quark as the first argument.
-% We better start with |\q_no_value| as the first argument since
-% the whole thing may otherwise loop if |#1| is wrongly given
-% a string like |aabc| instead of a single token.\footnote{It may
-% still loop in special circumstances however!}
-% \begin{macrocode}
-\prg_new_conditional:Nnn \quark_if_no_value:N {p,TF,T,F} {
- \if_meaning:w \q_no_value #1
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% These tests are easy with \cs{pdf_strcmp:D} available.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \quark_if_no_value:n {p,TF,T,F} {
- \if_num:w \pdf_strcmp:D
- {\exp_not:N \q_no_value}
- {\exp_not:n{#1}} = \c_zero
- \prg_return_true: \else: \prg_return_false:
- \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\quark_if_nil:N}
-% \UnitTested
-% A function to check for the presence of |\q_nil|.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \quark_if_nil:N {p,TF,T,F} {
- \if_meaning:w \q_nil #1 \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\quark_if_nil:n,\quark_if_nil:V,\quark_if_nil:o}
-% \UnitTested
-% A function to check for the presence of |\q_nil|.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \quark_if_nil:n {p,TF,T,F} {
- \if_num:w \pdf_strcmp:D
- {\exp_not:N \q_nil}
- {\exp_not:n{#1}} = \c_zero
- \prg_return_true: \else: \prg_return_false:
- \fi:
-}
-\cs_generate_variant:Nn \quark_if_nil_p:n {V}
-\cs_generate_variant:Nn \quark_if_nil:nTF {V}
-\cs_generate_variant:Nn \quark_if_nil:nT {V}
-\cs_generate_variant:Nn \quark_if_nil:nF {V}
-\cs_generate_variant:Nn \quark_if_nil_p:n {o}
-\cs_generate_variant:Nn \quark_if_nil:nTF {o}
-\cs_generate_variant:Nn \quark_if_nil:nT {o}
-\cs_generate_variant:Nn \quark_if_nil:nF {o}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3seq.dtx b/Master/texmf-dist/source/latex/expl3/l3seq.dtx
deleted file mode 100644
index 6e5c536616d..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3seq.dtx
+++ /dev/null
@@ -1,1391 +0,0 @@
-% \iffalse meta-comment
-%
-%% File: l3seq.dtx Copyright (C) 1990-2011 by
-%% The LaTeX3 Project <latex-team@latex-project.org>
-%%
-%% 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 "expl3 bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX3 Project.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-\GetIdInfo$Id: l3seq.dtx 2245 2011-04-21 19:45:31Z joseph $
- {The LaTeX3 kernel: sequences and stacks}
-%</driver|package>
-%<*driver>
-\documentclass[full]{l3doc}
-\usepackage{csquotes}
-\begin{document}
- \DocInput{\jobname.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \GetFileInfo{\jobname.sty}
-%
-% \title{^^A
-% \fileinfo
-% \thanks{This file describes v\fileversion, last revised \filedate.}^^A
-% }
-%
-% \author{^^A
-% The \LaTeX3 Project\thanks
-% {^^A
-% E-mail:
-% \href{mailto:latex-team@latex-project.org}
-% {latex-team@latex-project.org}^^A
-% }^^A
-% }
-%
-% \date{Released \filedate}
-%
-% \maketitle
-%
-% \begin{documentation}
-%
-% \LaTeX3 implements a \enquote{sequence} data type, which contain
-% an ordered list of entries which may contain any \meta{balanced text}.
-% It is possible to map functions to sequences such that the function
-% is applied to every item in the sequence.
-%
-% Sequences are also used to implement stack functions in \LaTeX3. This
-% is achieved using a number of dedicated stack functions.
-%
-% \section{Creating and initialising sequences}
-%
-% \begin{function}{\seq_new:N, \seq_new:c}
-% \begin{syntax}
-% \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.
-% \end{function}
-%
-% \begin{function}{\seq_clear:N, \seq_clear:c}
-% \begin{syntax}
-% \cs{seq_clear:N} \meta{sequence}
-% \end{syntax}
-% Clears all items from the \meta{sequence} within the scope of
-% the current \TeX{} group.
-% \end{function}
-%
-% \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}
-%
-% \begin{function}{\seq_clear_new:N, \seq_clear_new:c}
-% \begin{syntax}
-% \cs{seq_clear_new:N} \meta{sequence}
-% \end{syntax}
-% If the \meta{sequence} already exists, clears it within the scope
-% of the current \TeX{} group. If the \meta{sequence} is not defined,
-% it will be created (using \cs{seq_new:N}). Thus the sequence is
-% guaranteed to be available and clear within the current \TeX{}
-% group. The \meta{sequence} will exist globally, but the content
-% outside of the current \TeX{} group is not specified.
-% \end{function}
-%
-% \begin{function}{\seq_gclear_new:N, \seq_gclear_new:c}
-% \begin{syntax}
-% \cs{seq_gclear_new:N} \meta{sequence}
-% \end{syntax}
-% If the \meta{sequence} already exists, clears it globally. If the
-% \meta{sequence} is not defined, it will be created (using
-% \cs{seq_new:N}). Thus the sequence is guaranteed to be available
-% and globally clear.
-% \end{function}
-%
-% \begin{function}
-% {\seq_set_eq:NN, \seq_set_eq:cN, \seq_set_eq:Nc, \seq_set_eq:cc}
-% \begin{syntax}
-% \cs{seq_set_eq:NN} \meta{sequence1} \meta{sequence2}
-% \end{syntax}
-% Sets the content of \meta{sequence1} equal to that of
-% \meta{sequence2}. This assignment is restricted to the current
-% \TeX{} group level.
-% \end{function}
-%
-% \begin{function}
-% {\seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc}
-% \begin{syntax}
-% \cs{seq_gset_eq:NN} \meta{sequence1} \meta{sequence2}
-% \end{syntax}
-% Sets the content of \meta{sequence1} equal to that of
-% \meta{sequence2}. This assignment is global and so is not
-% limited by the current \TeX{} group level.
-% \end{function}
-%
-% \begin{function}{\seq_concat:NNN, \seq_concat:ccc}
-% \begin{syntax}
-% \cs{seq_concat:NNN} \meta{sequence1} \meta{sequence2} \meta{sequence3}
-% \end{syntax}
-% Concatenates the content of \meta{sequence2} and \meta{sequence3}
-% together and saves the result in \meta{sequence1}. The items in
-% \meta{sequence2} will be placed at the left side of the new sequence.
-% This operation is local to the current \TeX{} group and will
-% remove any existing content in \meta{sequence1}.
-% \end{function}
-%
-% \begin{function}{\seq_gconcat:NNN, \seq_gconcat:ccc}
-% \begin{syntax}
-% \cs{seq_gconcat:NNN} \meta{sequence1} \meta{sequence2} \meta{sequence3}
-% \end{syntax}
-% Concatenates the content of \meta{sequence2} and \meta{sequence3}
-% together and saves the result in \meta{sequence1}. The items in
-% \meta{sequence2} will be placed at the left side of the new sequence.
-% This operation is global and will remove any existing content in
-% \meta{sequence1}.
-% \end{function}
-%
-% \section{Appending data to sequences}
-%
-% \begin{function}{
-% \seq_put_left:Nn, \seq_put_left:NV, \seq_put_left:Nv,
-% \seq_put_left:No, \seq_put_left:Nx,
-% \seq_put_left:cn, \seq_put_left:cV, \seq_put_left:cv,
-% \seq_put_left:co, \seq_put_left:cx
-% }
-% \begin{syntax}
-% \cs{seq_put_left:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Appends the \meta{item} to the left of the \meta{sequence}.
-% The assignment is restricted to the current \TeX{} group.
-% \end{function}
-%
-% \begin{function}{
-% \seq_gput_left:Nn, \seq_gput_left:NV, \seq_gput_left:Nv,
-% \seq_gput_left:No, \seq_gput_left:Nx,
-% \seq_gput_left:cn, \seq_gput_left:cV, \seq_gput_left:cv,
-% \seq_gput_left:co, \seq_gput_left:cx
-% }
-% \begin{syntax}
-% \cs{seq_gput_left:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Appends the \meta{item} to the left of the \meta{sequence}.
-% The assignment is global.
-% \end{function}
-%
-% \begin{function}{
-% \seq_put_right:Nn, \seq_put_right:NV, \seq_put_right:Nv,
-% \seq_put_right:No, \seq_put_right:Nx,
-% \seq_put_right:cn, \seq_put_right:cV, \seq_put_right:cv,
-% \seq_put_right:co, \seq_put_right:cx
-% }
-% \begin{syntax}
-% \cs{seq_put_right:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Appends the \meta{item} to the right of the \meta{sequence}.
-% The assignment is restricted to the current \TeX{} group.
-% \end{function}
-%
-% \begin{function}{
-% \seq_gput_right:Nn, \seq_gput_right:NV, \seq_gput_right:Nv,
-% \seq_gput_right:No, \seq_gput_right:Nx,
-% \seq_gput_right:cn, \seq_gput_right:cV, \seq_gput_right:cv,
-% \seq_gput_right:co, \seq_gput_right:cx
-% }
-% \begin{syntax}
-% \cs{seq_gput_right:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Appends the \meta{item} to the right of the \meta{sequence}.
-% The assignment is global.
-% \end{function}
-%
-% \section{Recovering items from sequences}
-%
-% Items can be recovered from either the left or the right of sequences.
-% For implementation reasons, the actions at the left of the sequence are
-% faster than those acting on the right. These functions all assign the
-% recovered material locally, \emph{i.e.}~setting the
-% \meta{token list variable} used with \cs{tl_set:Nn} and \emph{never}
-% \cs{tl_gset:Nn}.
-%
-% \begin{function}{\seq_get_left:NN, \seq_get_left:cN}
-% \begin{syntax}
-% \cs{seq_get_left:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% 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 an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_get_right:NN, \seq_get_right:cN}
-% \begin{syntax}
-% \cs{seq_get_right:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% 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 an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_pop_left:NN, \seq_pop_left:cN}
-% \begin{syntax}
-% \cs{seq_pop_left:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% Pops the left-most item from a \meta{sequence} into the
-% \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 an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_gpop_left:NN, \seq_gpop_left:cN}
-% \begin{syntax}
-% \cs{seq_gpop_left:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% Pops the left-most item from a \meta{sequence} into the
-% \meta{token list variable}, \emph{i.e}.~removes the item from the
-% 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 an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_pop_right:NN, \seq_pop_right:cN}
-% \begin{syntax}
-% \cs{seq_pop_right:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% Pops the right-most item from a \meta{sequence} into the
-% \meta{token list variable}, \emph{i.e}.~removes the item from the
-% sequence and storesitin in the \meta{token list variable}.
-% Both of the variables are assigned locally. If \meta{sequence} is
-% empty an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_gpop_right:NN, \seq_gpop_right:cN}
-% \begin{syntax}
-% \cs{seq_gpop_right:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% Pops the right-most item from a \meta{sequence} into the
-% \meta{token list variable}, \emph{i.e}.~removes the item from the
-% 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 an error will be raised.
-% \end{function}
-%
-% \section{Modifying sequences}
-%
-% While sequences are normally used as ordered lists, it may be
-% necessary to modify the content. The functions here may be used
-% to update sequences, while retaining the order of the unaffected
-% entries.
-%
-% \begin{function}{\seq_remove_duplicates:N, \seq_remove_duplicates:c}
-% \begin{syntax}
-% \cs{seq_remove_duplicates:N} \meta{sequence}
-% \end{syntax}
-% Removes duplicate items from the \meta{sequence}, leaving
-% left most copy of each item in the \meta{sequence}. The \meta{item}
-% comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}.
-% The removal is local to the current \TeX{} group.
-% \begin{texnote}
-% This function iterates through every item in the \meta{sequence} and
-% does a comparison with the \meta{items} already checked. It is therefore
-% relatively slow with large sequences.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\seq_gremove_duplicates:N, \seq_gremove_duplicates:c}
-% \begin{syntax}
-% \cs{seq_gremove_duplicates:N} \meta{sequence}
-% \end{syntax}
-% Removes duplicate items from the \meta{sequence}, leaving
-% left most copy of each item in the \meta{sequence}. The \meta{item}
-% comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}.
-% The removal is applied globally.
-% \begin{texnote}
-% This function iterates through every item in the \meta{sequence} and
-% does a comparison with the \meta{items} already checked. It is therefore
-% relatively slow with large sequences.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\seq_remove_all:Nn, \seq_remove_all:cn}
-% \begin{syntax}
-% \cs{seq_remove_all:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Removes every occurrence of \meta{item} from the \meta{sequence}.
-% The \meta{item} comparison takes place on a token basis, as for
-% \cs{tl_if_eq:nn(TF)}. The removal is local to the current \TeX{} group.
-% \end{function}
-%
-% \begin{function}{\seq_gremove_all:Nn, \seq_gremove_all:cn}
-% \begin{syntax}
-% \cs{seq_gremove_all:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Removes each occurrence of \meta{item} from the \meta{sequence}.
-% The \meta{item} comparison takes place on a token basis, as for
-% \cs{tl_if_eq:nn(TF)}. The removal is applied globally.
-% \end{function}
-%
-% \subsection{Sequence conditionals}
-%
-% \begin{function}[EXP,pTF]{\seq_if_empty:N, \seq_if_empty:c}
-% \begin{syntax}
-% \cs{seq_if_empty_p:N} \meta{sequence}
-% \cs{seq_if_empty:NTF} \meta{sequence} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if the \meta{sequence} is empty (containing no items). The
-% branching versions then leave either \meta{true code} or
-% \meta{false code} in the input stream, as appropriate to the truth of
-% the test and the variant of the function chosen. The logical truth of
-% the test is left in the input stream by the predicate version.
-% \end{function}
-%
-% \begin{function}[TF]{
-% \seq_if_in:Nn, \seq_if_in:NV, \seq_if_in:Nv, \seq_if_in:No, \seq_if_in:Nx,
-% \seq_if_in:cn, \seq_if_in:cV, \seq_if_in:cv, \seq_if_in:co, \seq_if_in:cx
-% }
-% \begin{syntax}
-% \cs{seq_if_in:NnTF} \meta{sequence} \Arg{item}
-% ~~\Arg{true code} \Arg{false code}
-% \end{syntax}
-% Tests if the \meta{item} is present in the \meta{sequence}.
-% Either the \meta{true code} or \meta{false code} is left in the input
-% stream, as appropriate to the truth of the test and the variant of the
-% function
-% chosen.
-% \end{function}
-%
-% \section{Mapping to sequences}
-%
-% \begin{function}[EXP]{\seq_map_function:NN, \seq_map_function:cN}
-% \begin{syntax}
-% \cs{seq_map_function:NN} \meta{sequence} \meta{function}
-% \end{syntax}
-% Applies \meta{function} to every \meta{item} stored in the
-% \meta{sequence}. The \meta{function} will receive one argument for
-% each iteration. The \meta{items} are returned from left to right.
-% The function \cs{seq_map_inline:Nn} is in general more efficient
-% than \cs{seq_map_function:NN}.
-% One mapping may be nested inside another.
-% \end{function}
-%
-% \begin{function}{\seq_map_inline:Nn, \seq_map_inline:cn}
-% \begin{syntax}
-% \cs{seq_map_inline:Nn} \meta{sequence} \Arg{inline function}
-% \end{syntax}
-% Applies \meta{inline function} to every \meta{item} stored
-% within the \meta{sequence}. The \meta{inline function} should
-% consist of code which will receive 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}
-%
-% \begin{function}{
-% \seq_map_variable:NNn, \seq_map_variable:Ncn,
-% \seq_map_variable:cNn, \seq_map_variable:ccn
-% }
-% \begin{syntax}
-% \cs{seq_map_variable:Nn} \meta{sequence}
-% ~~\meta{tl~var.} \Arg{function using tl~var.}
-% \end{syntax}
-% Stores each entry in the \meta{sequence} 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{tl~var.}, but this is not enforced. One variable
-% mapping can be nested inside another. The \meta{items}
-% are returned from left to right. One variable mapping may be
-% nested inside another.
-% \end{function}
-%
-% \begin{function}[EXP]{\seq_map_break:}
-% \begin{syntax}
-% \cs{seq_map_break:}
-% \end{syntax}
-% Used to terminate a \cs{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
-% \begin{verbatim}
-% \seq_map_inline:Nn \l_my_seq
-% {
-% \str_if_eq:nnTF { #1 } { bingo }
-% { \seq_map_break: }
-% {
-% % Do something useful
-% }
-% }
-% \end{verbatim}
-% Use outside of a \cs{seq_map_\ldots} scenario will lead low
-% level \TeX{} errors.
-% \begin{texnote}
-% When the mapping is broken, additional tokens may be inserted by the
-% internal macro \cs{seq_break_point:n} before further items are taken
-% from the input stream. This will depend on the design of the mapping
-% function.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}[EXP]{\seq_map_break:n}
-% \begin{syntax}
-% \cs{seq_map_break:n} \Arg{tokens}
-% \end{syntax}
-% Used to terminate a \cs{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
-% \begin{verbatim}
-% \seq_map_inline:Nn \l_my_seq
-% {
-% \str_if_eq:nnTF { #1 } { bingo }
-% { \seq_map_break:n { <tokens> } }
-% {
-% % Do something useful
-% }
-% }
-% \end{verbatim}
-% Use outside of a \cs{seq_map_\ldots} scenario will lead low
-% level \TeX{} errors.
-% \begin{texnote}
-% When the mapping is broken, additional tokens may be inserted by the
-% internal macro \cs{seq_break_point:n} before the \meta{tokens} are
-% inserted into the input stream.
-% This will depend on the design of the mapping function.
-% \end{texnote}
-% \end{function}
-%
-% \subsection{Sequences as stacks}
-%
-% Sequences can be used as stacks, where data is pushed to and popped
-% from the top of the sequence. (The left of a sequence is the top, for
-% performance reasons.) The stack functions for sequences are not
-% intended to be mixed with the general ordered data functions detailed
-% in the previous section: a sequence should either be used as an
-% ordered data type or as a stack, but not in both ways.
-%
-% \begin{function}{\seq_get:NN, \seq_get:cN}
-% \begin{syntax}
-% \cs{seq_get:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% 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 an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_pop:NN, \seq_pop:cN}
-% \begin{syntax}
-% \cs{seq_pop:NN} \meta{sequence} \meta{token list variable}
-% \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 an error will be raised.
-% \end{function}
-%
-% \begin{function}{\seq_gpop:NN, \seq_gpop:cN}
-% \begin{syntax}
-% \cs{seq_gpop:NN} \meta{sequence} \meta{token list variable}
-% \end{syntax}
-% 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 marker an error will be raised.
-% \end{function}
-%
-% \begin{function}{
-% \seq_push:Nn, \seq_push:NV, \seq_push:Nv, \seq_push:No, \seq_push:Nx,
-% \seq_push:cn, \seq_push:cV, \seq_push:cv, \seq_push:co, \seq_push:cx
-% }
-% \begin{syntax}
-% \cs{seq_push:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Adds the \Arg{item} to the top of the \meta{sequence}.
-% The assignment is restricted to the current \TeX{} group.
-% \end{function}
-%
-% \begin{function}{
-% \seq_gpush:Nn, \seq_gpush:NV, \seq_gpush:Nv, \seq_gpush:No, \seq_gpush:Nx,
-% \seq_gpush:cn, \seq_gpush:cV, \seq_gpush:cv, \seq_gpush:co, \seq_gpush:cx
-% }
-% \begin{syntax}
-% \cs{seq_gpush:Nn} \meta{sequence} \Arg{item}
-% \end{syntax}
-% Pushes the \meta{item} onto the end of the top of the
-% \meta{sequence}. The assignment is global.
-% \end{function}
-%
-% \section{Viewing sequences}
-%
-% \begin{function}{\seq_show:N, \seq_show:c}
-% \begin{syntax}
-% \cs{seq_show:N} \meta{sequence}
-% \end{syntax}
-% Displays the entries in the \meta{sequence} in the terminal.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{Internal sequence functions}
-%
-% \begin{function}{\seq_if_empty_err_break:N}
-% \begin{syntax}
-% \cs{seq_if_empty_err_break:N} \meta{sequence}
-% \end{syntax}
-% Tests if the \meta{sequence} is empty, and if so issues an error
-% message before skipping over any tokens up to \cs{seq_break_point:n}.
-% This function is used to avoid more serious errors which would
-% otherwise occur if some internal functions were applied to an
-% empty \meta{sequence}.
-% \end{function}
-%
-% \begin{function}[EXP]{\seq_item:n}
-% \begin{syntax}
-% \cs{seq_item:n} \meta{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
-% raised. The definition should always be set globally.
-% \end{function}
-%
-% \begin{function}{\seq_push_item_def:n, \seq_push_item_def:x}
-% \begin{syntax}
-% \cs{seq_push_item_def:n} \Arg{code}
-% \end{syntax}
-% Saves the definition of \cs{seq_item:n} and redefines it to
-% accept one parameter and expand to \meta{code}. This function
-% should always be balanced by use of \cs{seq_pop_item_def:}.
-% \end{function}
-%
-% \begin{function}{\seq_pop_item_def:}
-% \begin{syntax}
-% \cs{seq_pop_item_def:}
-% \end{syntax}
-% Restores the definition of \cs{seq_item:n} most recently saved by
-% \cs{seq_push_item_def:n}. This function should always be used in
-% a balanced pair with \cs{seq_push_item_def:n}.
-% \end{function}
-%
-% \begin{function}[EXP]{\seq_break:}
-% \begin{syntax}
-% \cs{seq_break:}
-% \end{syntax}
-% Used to terminate sequence functions by gobbling all tokens
-% up to \cs{seq_break_point:n}. This function is a copy of
-% \cs{seq_map_break:}, but is used in situations which are
-% not mappings.
-% \end{function}
-%
-% \begin{function}[EXP]{\seq_break:n}
-% \begin{syntax}
-% \cs{seq_break:n} \Arg{tokens}
-% \end{syntax}
-% Used to terminate sequence functions by gobbling all tokens
-% up to \cs{seq_break_point:n}, then inserting the \meta{tokens}
-% before continuing reading the input stream. This function is a copy
-% of \cs{seq_map_break:n}, but is used in situations which are
-% not mappings.
-% \end{function}
-%
-% \begin{function}[EXP]{\seq_break_point:n}
-% \begin{syntax}
-% \cs{seq_break_point:n} \meta{tokens}
-% \end{syntax}
-% Used to mark the end of a recursion or mapping: the functions
-% \cs{seq_map_break:} and \cs{seq_map_break:n} use this to break out
-% of the loop. After the loop ends the \meta{tokens} are inserted into
-% the input stream. This occurs even if the the break functions are
-% \emph{not} applied: \cs{seq_break_point:n} is functionally-equivalent
-% in these cases to \cs{use:n}.
-% \end{function}
-%
-% \section{Sequence implementation}
-%
-% \TestFiles{m3seq002,m3seq003}
-%
-% \begin{macrocode}
-%<*initex|package>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-% \end{macrocode}
-%
-% A sequence is a control sequence whose top-level expansion is of
-% the form \enquote{\cs{seq_item:n} \marg{item$_1$}
-% \ldots \cs{seq_item:n} \marg{item$_n$}}. An earlier implementation
-% used the structure \enquote{\cs{seq_elt:w} \meta{item$_1$}
-% \cs{seq_elt_end:} \ldots \cs{seq_elt:w} \meta{item$_n$}
-% \cs{seq_elt_end:}}. This allows rapid searching using a delimited
-% function, but is not suitable for items containing |{|, |}| and |#|
-% tokens, and which also leads to the loss of surrounding braces
-% around items.
-%
-% \begin{macro}[int]{\seq_item:n}
-% The delimiter is always defined, but when used incorrectly simply
-% removes its argument and hits an undefined control sequence to
-% raise an error.
-% \begin{macrocode}
-\cs_new:Npn \seq_item:n
- {
- \seq_use_error:
- \use_none:n
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[aux]{\l_seq_tmpa_tl, \l_seq_tmpb_tl}
-% Scratch space for various internal uses.
-% \begin{macrocode}
-\tl_new:N \l_seq_tmpa_tl
-\tl_new:N \l_seq_tmpb_tl
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Allocation and initialisation}
-%
-% \begin{macro}{\seq_new:N,\seq_new:c}
-% \UnitTested
-% Internally, sequences are just token lists.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_new:N \tl_new:N
-\cs_new_eq:NN \seq_new:c \tl_new:c
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\seq_clear:N, \seq_clear:c}
-% \UnitTested
-% \begin{macro}{\seq_gclear:N, \seq_gclear:c}
-% \UnitTested
-% Clearing sequences is just the same as clearing token lists.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_clear:N \tl_clear:N
-\cs_new_eq:NN \seq_clear:c \tl_clear:c
-\cs_new_eq:NN \seq_gclear:N \tl_gclear:N
-\cs_new_eq:NN \seq_gclear:c \tl_gclear:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_clear_new:N, \seq_clear_new:c}
-% \UnitTested
-% \begin{macro}{\seq_gclear_new:N, \seq_gclear_new:c}
-% \UnitTested
-% Once again a simply copy from the token list functions.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_clear_new:N \tl_clear_new:N
-\cs_new_eq:NN \seq_clear_new:c \tl_clear_new:c
-\cs_new_eq:NN \seq_gclear_new:N \tl_gclear_new:N
-\cs_new_eq:NN \seq_gclear_new:c \tl_gclear_new:c
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_set_eq:NN, \seq_set_eq:cN, \seq_set_eq:Nc, \seq_set_eq:cc}
-% \UnitTested
-% \begin{macro}
-% {\seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc}
-% \UnitTested
-% Once again, these are simply copies from the token list functions.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_set_eq:NN \tl_set_eq:NN
-\cs_new_eq:NN \seq_set_eq:Nc \tl_set_eq:Nc
-\cs_new_eq:NN \seq_set_eq:cN \tl_set_eq:cN
-\cs_new_eq:NN \seq_set_eq:cc \tl_set_eq:cc
-\cs_new_eq:NN \seq_gset_eq:NN \tl_gset_eq:NN
-\cs_new_eq:NN \seq_gset_eq:Nc \tl_gset_eq:Nc
-\cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN
-\cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_concat:NNN, \seq_concat:ccc}
-% \UnitTested
-% \begin{macro}{\seq_gconcat:NNN, \seq_gconcat:ccc}
-% \UnitTested
-% Concatenating sequences is easy.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3
- { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } }
-\cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3
- { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } }
-\cs_generate_variant:Nn \seq_concat:NNN { ccc }
-\cs_generate_variant:Nn \seq_gconcat:NNN { ccc }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Appending data to either end}
-%
-% \begin{macro}{
-% \seq_put_left:Nn, \seq_put_left:NV, \seq_put_left:Nv,
-% \seq_put_left:No, \seq_put_left:Nx,
-% \seq_put_left:cn, \seq_put_left:cV, \seq_put_left:cv,
-% \seq_put_left:co, \seq_put_left:cx
-% }
-% \UnitTested
-% \begin{macro}{
-% \seq_put_right:Nn, \seq_put_right:NV, \seq_put_right:Nv,
-% \seq_put_right:No, \seq_put_right:Nx,
-% \seq_put_right:cn, \seq_put_right:cV, \seq_put_right:cv,
-% \seq_put_right:co, \seq_put_right:cx
-% }
-% \UnitTested
-% The code here is just a wrapper for adding to token lists.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_put_left:Nn #1#2
- { \tl_put_left:Nn #1 { \seq_item:n {#2} } }
-\cs_new_protected:Npn \seq_put_right:Nn #1#2
- { \tl_put_right:Nn #1 { \seq_item:n {#2} } }
-\cs_generate_variant:Nn \seq_put_left:Nn { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_put_left:Nn { c , cV , cv , co , cx }
-\cs_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{
-% \seq_gput_left:Nn, \seq_gput_left:NV, \seq_gput_left:Nv,
-% \seq_gput_left:No, \seq_gput_left:Nx,
-% \seq_gput_left:cn, \seq_gput_left:cV, \seq_gput_left:cv,
-% \seq_gput_left:co, \seq_gput_left:cx
-% }
-% \begin{macro}{
-% \seq_gput_right:Nn, \seq_gput_right:NV, \seq_gput_right:Nv,
-% \seq_gput_right:No, \seq_gput_right:Nx,
-% \seq_gput_right:cn, \seq_gput_right:cV,\seq_gput_right:cv,
-% \seq_gput_right:co, \seq_gput_right:cx
-% }
-% The same for global addition.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_gput_left:Nn #1#2
- { \tl_gput_left:Nn #1 { \seq_item:n {#2} } }
-\cs_new_protected:Npn \seq_gput_right:Nn #1#2
- { \tl_gput_right:Nn #1 { \seq_item:n {#2} } }
-\cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx }
-\cs_generate_variant:Nn \seq_gput_right:Nn { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Breaking sequence functions}
-%
-% \begin{macro}[int]{\seq_break:}
-% \begin{macro}[int]{\seq_break:n}
-% To break a function, the special token \cs{seq_break_point:n} is
-% used to find the end of the code. Any ending code is then inserted
-% before the return value of \cs{seq_map_break:n} is inserted.
-% \begin{macrocode}
-\cs_new:Npn \seq_break: #1 \seq_break_point:n #2 {#2}
-\cs_new:Npn \seq_break:n #1#2 \seq_break_point:n #3 { #3 #1 }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_map_break:}
-% \UnitTested
-% \begin{macro}{\seq_map_break:n}
-% \UnitTested
-% Semantically-logical copies of the break functions for use inside
-% mappings.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_map_break: \seq_break:
-\cs_new_eq:NN \seq_map_break:n \seq_break:n
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[int]{\seq_break_point:n}
-% Normally, the marker token will not be executed, but if it is then
-% the end code is simply inserted.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_break_point:n \use:n
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\seq_if_empty_err_break:N}
-% A function to check that sequences really have some content. This
-% is optimised for speed, hence the direct primitive use.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_if_empty_err_break:N #1
- {
- \tex_ifx:D #1 \c_empty_tl
- \msg_kernel_bug:x { Empty~sequence~\token_to_str:N #1 }
- \exp_after:wN \seq_break:
- \tex_fi:D
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Mapping to sequences}
-%
-% \begin{macro}{\seq_map_function:NN, \seq_map_function:cN}
-% \UnitTested
-% \begin{macro}[aux]{\seq_map_function_aux:NNn}
-% The idea here is to apply the code of |#2| to each item in the
-% sequence without altering the definition of \cs{seq_item:n}. This
-% is done as by noting that every odd token in the sequence must be
-% \cs{seq_item:n}, which can be gobbled by \cs{use_none:n}. At the end of
-% the loop, |#2| is instead |? \seq_map_break:|, which therefore breaks the
-% loop without needing to do a (relatively-expensive) quark test.
-% \begin{macrocode}
-\cs_new:Npn \seq_map_function:NN #1#2
- {
- \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1
- { ? \seq_map_break: } { }
- \seq_break_point:n { }
- }
-\cs_new:Npn \seq_map_function_aux:NNn #1#2#3
- {
- \use_none:n #2
- #1 {#3}
- \seq_map_function_aux:NNn #1
- }
-\cs_generate_variant:Nn \seq_map_function:NN { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\g_seq_nesting_depth_int}
-% A counter to keep track of nested functions.
-% \begin{macrocode}
-\int_new:N \g_seq_nesting_depth_int
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\seq_push_item_def:n, \seq_push_item_def:x}
-% \begin{macro}[aux]{\seq_push_item_def_aux:}
-% \begin{macro}[int]{\seq_pop_item_def:}
-% The definition of \cs{seq_item:n} needs to be saved and restored at
-% various points within the mapping and manipulation code. That is handled
-% here: as always, this approach uses global assignments.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_push_item_def:n
- {
- \seq_push_item_def_aux:
- \cs_gset:Npn \seq_item:n ##1
- }
-\cs_new_protected:Npn \seq_push_item_def:x
- {
- \seq_push_item_def_aux:
- \cs_gset:Npx \seq_item:n ##1
- }
-\cs_new_protected:Npn \seq_push_item_def_aux:
- {
- \cs_gset_eq:cN { seq_item_ \int_use:N \g_seq_nesting_depth_int :n }
- \seq_item:n
- \int_gincr:N \g_seq_nesting_depth_int
- }
-\cs_new_protected_nopar:Npn \seq_pop_item_def:
- {
- \int_gdecr:N \g_seq_nesting_depth_int
- \cs_gset_eq:Nc \seq_item:n
- { seq_item_ \int_use:N \g_seq_nesting_depth_int :n }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_map_inline:Nn, \seq_map_inline:cn}
-% \UnitTested
-% The idea here is that \cs{seq_item:n} is already \enquote{applied} to
-% each item in a sequence, and so an in-line mapping is just a case of
-% redefining \cs{seq_item:n}.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_map_inline:Nn #1#2
- {
- \seq_push_item_def:n {#2}
- #1
- \seq_break_point:n { \seq_pop_item_def: }
- }
-\cs_generate_variant:Nn \seq_map_inline:Nn { c }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{
-% \seq_map_variable:NNn,\seq_map_variable:Ncn,
-% \seq_map_variable:cNn,\seq_map_variable:ccn
-% }
-% \UnitTested
-% This is just a specialised version of the in-line mapping function,
-% using an \texttt{x}-type expansion for the code set up so that the
-% number of |#| tokens required is as expected.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3
- {
- \seq_push_item_def:x
- {
- \tl_set:Nn \exp_not:N #2 {##1}
- \exp_not:n {#3}
- }
- #1
- \seq_break_point:n { \seq_pop_item_def: }
- }
-\cs_generate_variant:Nn \seq_map_variable:NNn { Nc }
-\cs_generate_variant:Nn \seq_map_variable:NNn { c , cc }
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Sequence stacks}
-%
-% The same functions as for sequences, but with the correct naming.
-%
-% \begin{macro}{
-% \seq_push:Nn, \seq_push:NV, \seq_push:Nv, \seq_push:No, \seq_push:Nx,
-% \seq_push:cn, \seq_push:cV, \seq_push:cV, \seq_push:co, \seq_push:cx
-% }
-% \UnitTested
-% \begin{macro}{
-% \seq_gpush:Nn, \seq_gpush:NV, \seq_gpush:Nv, \seq_gpush:No, \seq_gpush:Nx,
-% \seq_gpush:cn, \seq_gpush:cV, \seq_gpush:cv, \seq_gpush:co, \seq_gpush:cx
-% }
-% \UnitTested
-% Pushing to a sequence is the same as adding on the left.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn
-\cs_new_eq:NN \seq_push:NV \seq_put_left:NV
-\cs_new_eq:NN \seq_push:Nv \seq_put_left:Nv
-\cs_new_eq:NN \seq_push:No \seq_put_left:No
-\cs_new_eq:NN \seq_push:Nx \seq_put_left:Nx
-\cs_new_eq:NN \seq_push:cn \seq_put_left:cn
-\cs_new_eq:NN \seq_push:cV \seq_put_left:cV
-\cs_new_eq:NN \seq_push:cv \seq_put_left:cv
-\cs_new_eq:NN \seq_push:co \seq_put_left:co
-\cs_new_eq:NN \seq_push:cx \seq_put_left:cx
-\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn
-\cs_new_eq:NN \seq_gpush:NV \seq_gput_left:NV
-\cs_new_eq:NN \seq_gpush:Nv \seq_gput_left:Nv
-\cs_new_eq:NN \seq_gpush:No \seq_gput_left:No
-\cs_new_eq:NN \seq_gpush:Nx \seq_gput_left:Nx
-\cs_new_eq:NN \seq_gpush:cn \seq_gput_left:cn
-\cs_new_eq:NN \seq_gpush:cV \seq_gput_left:cV
-\cs_new_eq:NN \seq_gpush:cv \seq_gput_left:cv
-\cs_new_eq:NN \seq_gpush:co \seq_gput_left:co
-\cs_new_eq:NN \seq_gpush:cx \seq_gput_left:cx
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_get_left:NN, \seq_get_left:cN}
-% \UnitTested
-% \begin{macro}[aux]{\seq_get_left_aux:Nw}
-% Getting an item from the left of a sequence is pretty easy: just
-% trim off the first item after removing the \cs{seq_item:n} at
-% the start.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_get_left:NN #1#2
- {
- \seq_if_empty_err_break:N #1
- \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2
- \seq_break_point:n { }
- }
-\cs_new_protected:Npn \seq_get_left_aux:Nw \seq_item:n #1#2 \q_stop #3
- { \tl_set:Nn #3 {#1} }
-\cs_generate_variant:Nn \seq_get_left:NN { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_pop_left:NN, \seq_pop_left:cN}
-% \UnitTested
-% \begin{macro}{\seq_gpop_left:NN, \seq_gpop_left:cN}
-% \UnitTested
-% \begin{macro}[aux]{\seq_pop_left_aux:NNN}
-% \begin{macro}[aux]{\seq_pop_left_aux:Nw}
-% The approach to popping an item is pretty similar to that to get
-% an item, with the only difference being that the sequence itself has
-% to be redefined. This makes it more sensible to use an auxiliary
-% function for the local and global cases.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_pop_left:NN
- { \seq_pop_left_aux:NNN \tl_set:Nn }
-\cs_new_protected_nopar:Npn \seq_gpop_left:NN
- { \seq_pop_left_aux:NNN \tl_gset:Nn }
-\cs_new_protected_nopar:Npn \seq_pop_left_aux:NNN #1#2#3
- {
- \seq_if_empty_err_break:N #2
- \exp_after:wN \seq_pop_left_aux:Nw #2 \q_stop #1#2#3
- \seq_break_point:n { }
- }
-\cs_new_protected:Npn \seq_pop_left_aux:Nw \seq_item:n #1#2 \q_stop #3#4#5
- {
- #3 #4 {#2}
- \tl_set:Nn #5 {#1}
- }
-\cs_generate_variant:Nn \seq_pop_left:NN { c }
-\cs_generate_variant:Nn \seq_gpop_left:NN { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_get_right:NN, \seq_get_right:cN}
-% \UnitTested
-% \begin{macro}[aux]{\seq_get_right_aux:NN}
-% \begin{macro}[aux]{\seq_get_right_loop:nn}
-% The idea here is to remove the very first \cs{seq_item:n} from the
-% sequence, leaving a token list starting with the first braced entry.
-% Two arguments at a time are then grabbed: apart from the right-hand end of
-% the sequence, this will be a brace group followed by \cs{seq_item:n}. The
-% set up code means that these all disappear. At the end of the sequence,
-% the assignment is placed in front of the very last entry in the sequence,
-% before a tidying-up step takes place to remove the loop and reset the
-% meaning of \cs{seq_item:n}.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_get_right:NN #1#2
- {
- \seq_if_empty_err_break:N #1
- \seq_get_right_aux:NN #1#2
- \seq_break_point:n { }
- }
-\cs_new_protected_nopar:Npn \seq_get_right_aux:NN #1#2
- {
- \seq_push_item_def:n { }
- \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn
- \exp_after:wN \use_none:n #1
- { \tl_set:Nn #2 }
- { }
- {
- \seq_pop_item_def:
- \seq_break:
- }
-}
-\cs_new:Npn \seq_get_right_loop:nn #1#2
- {
- #2 {#1}
- \seq_get_right_loop:nn
- }
-\cs_generate_variant:Nn \seq_get_right:NN { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_pop_right:NN, \seq_pop_right:cN}
-% \UnitTested
-% \begin{macro}{\seq_gpop_right:NN, \seq_gpop_right:cN}
-% \UnitTested
-% \begin{macro}[aux]{\seq_get_right_aux:NNN, \seq_get_right_aux_ii:NNN}
-% The approach to popping from the right is a bit more involved, but does
-% use some of the same ideas as getting from the right. What is needed is a
-% \enquote{flexible length} way to set a token list variable. This is supplied
-% by the |{ \tex_iffalse:D } \tex_fi:D| \ldots |\tex_iffalse:D { \tex_fi:D }|
-% construct. Using an \texttt{x}-type expansion and a \enquote{non-expanding}
-% definition for \cs{seq_item:n}, the left-most $n - 1$ entries in a
-% sequence of $n$ items will be stored back in the sequence. That needs
-% a loop of unknown length, hence using the strange \cs{tex_iffalse:D}
-% way of including brackets. When the last item of the sequence is reached,
-% the closing bracket for the assignment is inserted, and |\tl_set:Nn #3|
-% is inserted in front of the final entry. This therefore does the pop
-% assignment, then a final loop clears up the code.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_pop_right:NN
- { \seq_pop_right_aux:NNN \tl_set:Nx }
-\cs_new_protected_nopar:Npn \seq_gpop_right:NN
- { \seq_pop_right_aux:NNN \tl_gset:Nx }
-\cs_new_protected_nopar:Npn \seq_pop_right_aux:NNN #1#2#3
- {
- \seq_if_empty_err_break:N #2
- \seq_pop_right_aux_ii:NNN #1 #2 #3
- \seq_break_point:n { }
- }
-\cs_new_protected_nopar:Npn \seq_pop_right_aux_ii:NNN #1#2#3
- {
- \seq_push_item_def:n { \exp_not:n { \seq_item:n {##1} } }
- #1 #2 { \tex_iffalse:D } \tex_fi:D
- \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn
- \exp_after:wN \use_none:n #2
- {
- \tex_iffalse:D { \tex_fi:D }
- \tl_set:Nn #3
- }
- { }
- {
- \seq_pop_item_def:
- \seq_break:
- }
- }
-\cs_generate_variant:Nn \seq_pop_right:NN { c }
-\cs_generate_variant:Nn \seq_gpop_right:NN { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_get:NN, \seq_get:cN}
-% \UnitTested
-% \begin{macro}{\seq_pop:NN, \seq_pop:cN}
-% \UnitTested
-% \begin{macro}{\seq_gpop:NN, \seq_gpop:cN}
-% \UnitTested
-% In most cases, getting items from the stack does not need to specify
-% that this is from the left. So alias are provided.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_get:NN \seq_get_left:NN
-\cs_new_eq:NN \seq_get:cN \seq_get_left:cN
-\cs_new_eq:NN \seq_pop:NN \seq_pop_left:NN
-\cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN
-\cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN
-\cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Sequence conditionals}
-%
-% \begin{macro}[pTF]{\seq_if_empty:N, \seq_if_empty:c}
-% \UnitTested
-% Simple copies from the token list variable material.
-% \begin{macrocode}
-\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N
- { p , T , F , TF }
-\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c
- { p , T , F , TF }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{
-% \seq_if_in:Nn, \seq_if_in:NV, \seq_if_in:Nv, \seq_if_in:No, \seq_if_in:Nx,
-% \seq_if_in:cn, \seq_if_in:cV, \seq_if_in:cv, \seq_if_in:co, \seq_if_in:cx
-% }
-% \UnitTested
-% \begin{macro}[aux]{\seq_if_in_aux:}
-% The approach here is to define \cs{seq_item:n} to compare its
-% argument with the test sequence. If the two items are equal, the
-% mapping is terminated and \cs{prg_return_true:} is inserted. On the
-% other hand, if there is no match then the loop will break returning
-% \cs{prg_return_false:}. In either case, \cs{seq_break_point:n}
-% ensures that the group ends before the logical value is returned.
-% Everything is inside a group so that \cs{seq_item:n} is preserved
-% in nested situations.
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \seq_if_in:Nn #1#2
- { T , F , TF }
- {
- \group_begin:
- \tl_set:Nn \l_seq_tmpa_tl {#2}
- \cs_set_protected:Npn \seq_item:n ##1
- {
- \tl_set:Nn \l_seq_tmpb_tl {##1}
- \tex_ifx:D \l_seq_tmpa_tl \l_seq_tmpb_tl
- \exp_after:wN \seq_if_in_aux:
- \tex_fi:D
- }
- #1
- \seq_break:n { \prg_return_false: }
- \seq_break_point:n { \group_end: }
- }
-\cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } }
-\cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_if_in:NnT { c , cV , cv , co , cx }
-\cs_generate_variant:Nn \seq_if_in:NnF { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_if_in:NnF { c , cV , cv , co , cx }
-\cs_generate_variant:Nn \seq_if_in:NnTF { NV , Nv , No , Nx }
-\cs_generate_variant:Nn \seq_if_in:NnTF { c , cV , cv , co , cx }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Modifying sequences}
-%
-% \begin{macro}[aux]{\l_seq_remove_seq}
-% An internal sequence for the removal routines.
-% \begin{macrocode}
-\seq_new:N \l_seq_remove_seq
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\seq_remove_duplicates:N, \seq_remove_duplicates:c}
-% \UnitTested
-% \begin{macro}{\seq_gremove_duplicates:N, \seq_gremove_duplicates:c}
-% \UnitTested
-% \begin{macro}[aux]{\seq_remove_duplicates_aux:NN}
-% Removing duplicates means making a new list then copying it.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_remove_duplicates:N
- { \seq_remove_duplicates_aux:NN \seq_set_eq:NN }
-\cs_new_protected:Npn \seq_gremove_duplicates:N
- { \seq_remove_duplicates_aux:NN \seq_gset_eq:NN }
-\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2
- {
- \seq_clear:N \l_seq_remove_seq
- \seq_map_inline:Nn #2
- {
- \seq_if_in:NnF \l_seq_remove_seq {##1}
- { \seq_put_right:Nn \l_seq_remove_seq {##1} }
- }
- #1 #2 \l_seq_remove_seq
- }
-\cs_generate_variant:Nn \seq_remove_duplicates:N { c }
-\cs_generate_variant:Nn \seq_gremove_duplicates:N { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\seq_remove_all:Nn, \seq_remove_all:cn}
-% \UnitTested
-% \begin{macro}{\seq_gremove_all:Nn, \seq_gremove_all:cn}
-% \UnitTested
-% \begin{macro}[aux]{\seq_remove_all_aux:NNn}
-% The idea of the code here is to avoid a relatively expensive addition of
-% items one at a time to an intermediate sequence.
-% The approach taken is therefore similar to
-% that in \cs{seq_pop_right_aux_ii:NNN}, using a \enquote{flexible}
-% \texttt{x}-type expansion to do most of the work. As \cs{tl_if_eq:nnT}
-% is not expandable, a two-part strategy is needed. First, the
-% \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 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.
-% \begin{macrocode}
-\cs_new_protected:Npn \seq_remove_all:Nn
- { \seq_remove_all_aux:NNn \tl_set:Nx }
-\cs_new_protected:Npn \seq_gremove_all:Nn
- { \seq_remove_all_aux:NNn \tl_gset:Nx }
-\cs_new_protected:Npn \seq_remove_all_aux:NNn #1#2#3
- {
- \seq_push_item_def:n
- {
- \str_if_eq:nnT {##1} {#3}
- {
- \tex_iffalse:D { \tex_fi:D }
- \tl_set:Nn \l_seq_tmpb_tl {##1}
- #1 #2
- { \tex_iffalse:D } \tex_fi:D
- \exp_not:o {#2}
- \tl_if_eq:NNT \l_seq_tmpa_tl \l_seq_tmpb_tl
- { \use_none:nn }
- }
- \exp_not:n { \seq_item:n {##1} }
- }
- \tl_set:Nn \l_seq_tmpa_tl {#3}
- #1 #2 {#2}
- \seq_pop_item_def:
- }
-\cs_generate_variant:Nn \seq_remove_all:Nn { c }
-\cs_generate_variant:Nn \seq_gremove_all:Nn { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \section{Viewing sequences}
-%
-% \begin{macro}[aux]{\l_seq_show_tl}
-% Used to store the material for display.
-% \begin{macrocode}
-\tl_new:N \l_seq_show_tl
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\seq_show:N, \seq_show:c}
-% \UnitTested
-% \begin{macro}[aux]{\seq_show_aux:n}
-% \begin{macro}[aux]{\seq_show_aux:w}
-% The aim of the mapping here is to create a token list containing the
-% formatted sequence. The very first item needs the new line and \verb*|> |
-% removing, which is achieved using a \texttt{w}-type auxiliary. To avoid
-% a low-level \TeX{} error if there is an empty sequence, a simple test is
-% used to keep the output \enquote{clean}.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \seq_show:N #1
- {
- \seq_if_empty:NTF #1
- {
- \iow_term:x { Sequence~\token_to_str:N #1 \c_space_tl is~empty }
- \tl_show:n { }
- }
- {
- \iow_term:x
- {
- Sequence~\token_to_str:N #1 \c_space_tl
- contains~the~items~(without~outer~braces):
- }
- \tl_set:Nx \l_seq_show_tl
- { \seq_map_function:NN #1 \seq_show_aux:n }
- \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \seq_show_aux:w \l_seq_show_tl }
- }
- }
-\cs_new:Npn \seq_show_aux:n #1
- {
- \iow_newline: > \c_space_tl \c_space_tl
- \iow_char:N \{ \exp_not:n {#1} \iow_char:N \}
- }
-\cs_new:Npn \seq_show_aux:w #1 > ~ { }
-\cs_generate_variant:Nn \seq_show:N { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Depreciated interfaces}
-%
-% A few functions which are no longer documented: these were moved
-% here on or before 2011-04-20, and will be removed entirely by
-% 2011-07-20.
-%
-% \begin{macro}{\seq_top:NN, \seq_top:cN}
-% These are old stack functions.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_top:NN \seq_get_left:NN
-\cs_new_eq:NN \seq_top:cN \seq_get_left:cN
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\seq_display:N, \seq_display:c}
-% An older name for \cs{seq_show:N}.
-% \begin{macrocode}
-\cs_new_eq:NN \seq_display:N \seq_show:N
-\cs_new_eq:NN \seq_display:c \seq_show:c
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-% \end{implementation}
-%
-% \PrintIndex \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/expl3/l3skip.dtx b/Master/texmf-dist/source/latex/expl3/l3skip.dtx
deleted file mode 100644
index 02961cc188f..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3skip.dtx
+++ /dev/null
@@ -1,1347 +0,0 @@
-% \iffalse
-%% File: l3skip.dtx Copyright (C) 2005-2011 Frank Mittelbach, LaTeX3 project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3c of this
-%% 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3skip.dtx 2149 2011-02-15 20:50:02Z mittelba $
- {L3 Experimental skip registers}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3skip.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3skip} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Dimension and skip registers}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \LaTeX3 knows about two types of length registers for internal use:
-% rubber lengths ("skip"s) and rigid lengths ("dim"s).
-%
-% \section{Skip registers}
-%
-%
-%
-% \subsection{Functions}
-%
-% \begin{function}{ \skip_new:N |
-% \skip_new:c }
-% \begin{syntax}
-% "\skip_new:N" <skip>
-% \end{syntax}
-% Defines <skip> to be a new variable of type "skip".
-% \begin{texnote}
-% "\skip_new:N" is the equivalent to plain \TeX{}'s \tn{newskip}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \skip_zero:N |
-% \skip_zero:c |
-% \skip_gzero:N |
-% \skip_gzero:c |
-% }
-% \begin{syntax}
-% "\skip_zero:N" <skip>
-% \end{syntax}
-% Locally or globally reset <skip> to zero.
-% For global variables the global versions
-% should be used.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \skip_set:Nn |
-% \skip_set:cn |
-% \skip_gset:Nn |
-% \skip_gset:cn |
-% }
-% \begin{syntax}
-% "\skip_set:Nn" <skip> \Arg{skip value}
-% \end{syntax}
-% These functions will set the <skip> register to the <length> value.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \skip_add:Nn |
-% \skip_add:cn |
-% \skip_gadd:Nn |
-% \skip_gadd:cn |
-% }
-% \begin{syntax}
-% "\skip_add:Nn" <skip> \Arg{length}
-% \end{syntax}
-% These functions will add to the <skip> register the value <length>. If
-% the second argument is a <skip> register too, the surrounding braces
-% can be left out.
-% \end{function}
-%
-% \begin{function}{%
-% \skip_sub:Nn |
-% \skip_gsub:Nn |
-% }
-% \begin{syntax}
-% "\skip_gsub:Nn" <skip> \Arg{length}
-% \end{syntax}
-% These functions will subtract from the <skip> register the value
-% <length>. If the second argument is a <skip> register too, the
-% surrounding braces can be left out.
-% \end{function}
-%
-% \begin{function}{%
-% \skip_use:N |
-% \skip_use:c |
-% }
-% \begin{syntax}
-% "\skip_use:N" <skip>
-% \end{syntax}
-% This function returns the length value kept in <skip> in a way
-% suitable for further processing.
-% \begin{texnote}
-% The function "\skip_use:N" could be implemented directly as the \TeX{}
-% primitive "\tex_the:D" which is also responsible to produce the values for
-% other internal quantities. We have chosen to use individual functions
-% for counters, dimensions etc.\ to allow checks and to make the code
-% more self-explanatory.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \skip_show:N |
-% \skip_show:c }
-% \begin{syntax}
-% "\skip_show:N" <skip>
-% \end{syntax}
-% This function pauses the compilation and displays the length value kept
-% in <skip> in the console output and log file.
-% \begin{texnote}
-% The function "\skip_show:N" could be implemented directly as the \TeX{}
-% primitive "\tex_showthe:D" which is also responsible to produce the values for
-% other internal quantities. We have chosen to use individual functions
-% for counters, dimensions etc.\ to allow checks and to make the code
-% more self-explanatory.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \skip_horizontal:N |
-% \skip_horizontal:c |
-% \skip_horizontal:n |
-% \skip_vertical:N |
-% \skip_vertical:c |
-% \skip_vertical:n |
-% }
-% \begin{syntax}
-% "\skip_horizontal:N" <skip> \\
-% "\skip_horizontal:n" \Arg{length}
-% \end{syntax}
-% The "hor" functions insert <skip> or <length> with the \TeX\
-% primitive \tn{hskip}. The "vertical" variants do the same with
-% \tn{vskip}. The "n" versions evaluate <length> with "\skip_eval:n".
-% \end{function}
-%
-%
-% \begin{function}{ \skip_if_infinite_glue_p:n |
-% \skip_if_infinite_glue:n / (TF) }
-% \begin{syntax}
-% "\skip_if_infinite_glue:nTF" \Arg{skip} \Arg{true} \Arg{false}
-% \end{syntax}
-% Checks if <skip> contains infinite stretch or shrink components
-% and executes either <true> or <false>. Also works on input like
-% "3pt plus .5in".
-% \end{function}
-%
-%
-%
-% \begin{function}{%
-% \skip_split_finite_else_action:nnNN |
-% }
-% \begin{syntax}
-% "\skip_split_finite_else_action:nnNN" \Arg{skip} \Arg{action}
-% <dimen1> <dimen2>
-% \end{syntax}
-% Checks if <skip> contains finite glue. If it does then it assigns
-% <dimen1> the stretch component and <dimen2> the shrink component. If
-% it contains infinite glue set <dimen1> and <dimen2> to zero and execute
-% "#2" which is usually an error or warning message of some sort.
-% \end{function}
-%
-%
-%
-%\begin{function}{
-% \skip_eval:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{skip_eval:n} \Arg{skip expression}
-% \end{syntax}
-% Evaluates the \meta{skip expression}, expanding any skips
-% and token list variables within the \meta{expression}
-% 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
-% assignment as it is \emph{not} an \meta{internal glue}.
-%\end{function}
-%
-%
-% \subsection{Formatting a skip register value}
-%
-%
-% \subsection{Variable and constants}
-%
-% \begin{variable}{%
-% \c_max_skip |
-% }
-% Constant that denotes the maximum value which can be stored in a <skip>
-% register.
-% \end{variable}
-%
-% \begin{variable}{%
-% \c_zero_skip |
-% }
-% Constants denoting a zero skip.
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_tmpa_skip |
-% \l_tmpb_skip |
-% \l_tmpc_skip |
-% \g_tmpa_skip |
-% \g_tmpb_skip |
-% }
-% Scratch register for immediate use.
-% \end{variable}
-%
-%
-%
-%
-%
-% \section{Dim registers}
-%
-%
-% \subsection{Functions}
-%
-%
-%
-%
-% \begin{function}{ \dim_new:N |
-% \dim_new:c }
-% \begin{syntax}
-% "\dim_new:N" <dim>
-% \end{syntax}
-% Defines <dim> to be a new variable of type "dim".
-% \begin{texnote}
-% "\dim_new:N" is the equivalent to plain \TeX{}'s \tn{newdimen}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \dim_zero:N |
-% \dim_zero:c |
-% \dim_gzero:N |
-% \dim_gzero:c |
-% }
-% \begin{syntax}
-% "\dim_zero:N" <dim>
-% \end{syntax}
-% Locally or globally reset <dim> to zero.
-% For global variables the global versions
-% should be used.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \dim_set:Nn |
-% \dim_set:Nc |
-% \dim_set:cn |
-% \dim_gset:Nn |
-% \dim_gset:Nc |
-% \dim_gset:cn |
-% \dim_gset:cc |
-% }
-% \begin{syntax}
-% "\dim_set:Nn" <dim> \Arg{dim value}
-% \end{syntax}
-% These functions will set the <dim> register to the <dim value> value.
-% \end{function}
-%
-%\begin{function}{
-% \dim_set_max:Nn |
-% \dim_set_max:cn |
-%}
-% \begin{syntax}
-% \cs{dim_set_max:Nn} \meta{dimension} \Arg{dimension expression}
-% \end{syntax}
-% Compares the current value of the \meta{dimension} with that of the
-% \meta{dimension expression}, and sets the \meta{dimension} to the
-% larger of these two value. This assignment is local to the current
-% \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \dim_gset_max:Nn |
-% \dim_gset_max:cn |
-%}
-% \begin{syntax}
-% \cs{dim_gset_max:Nn} \meta{dimension} \Arg{dimension expression}
-% \end{syntax}
-% Compares the current value of the \meta{dimension} with that of the
-% \meta{dimension expression}, and sets the \meta{dimension} to the
-% larger of these two value. This assignment is global.
-%\end{function}
-%
-%\begin{function}{
-% \dim_set_min:Nn |
-% \dim_set_min:cn |
-%}
-% \begin{syntax}
-% \cs{dim_set_min:Nn} \meta{dimension} \Arg{dimension expression}
-% \end{syntax}
-% Compares the current value of the \meta{dimension} with that of the
-% \meta{dimension expression}, and sets the \meta{dimension} to the
-% smaller of these two value. This assignment is local to the current
-% \TeX\ group.
-%\end{function}
-%
-%\begin{function}{
-% \dim_gset_min:Nn |
-% \dim_gset_min:cn |
-%}
-% \begin{syntax}
-% \cs{dim_gset_min:Nn} \meta{dimension} \Arg{dimension expression}
-% \end{syntax}
-% Compares the current value of the \meta{dimension} with that of the
-% \meta{dimension expression}, and sets the \meta{dimension} to the
-% smaller of these two value. This assignment is global.
-%\end{function}
-%
-%
-% \begin{function}{%
-% \dim_add:Nn |
-% \dim_add:Nc |
-% \dim_add:cn |
-% \dim_gadd:Nn |
-% \dim_gadd:cn |
-% }
-% \begin{syntax}
-% "\dim_add:Nn" <dim> \Arg{length}
-% \end{syntax}
-% These functions will add to the <dim> register the value <length>. If
-% the second argument is a <dim> register too, the surrounding braces
-% can be left out.
-% \end{function}
-%
-% \begin{function}{%
-% \dim_sub:Nn |
-% \dim_sub:Nc |
-% \dim_sub:cn |
-% \dim_gsub:Nn |
-% \dim_gsub:cn |
-% }
-% \begin{syntax}
-% "\dim_gsub:Nn" <dim> \Arg{length}
-% \end{syntax}
-% These functions will subtract from the <dim> register the value
-% <length>. If the second argument is a <dim> register too, the
-% surrounding braces can be left out.
-% \end{function}
-%
-% \begin{function}{%
-% \dim_use:N |
-% \dim_use:c |
-% }
-% \begin{syntax}
-% "\dim_use:N" <dim>
-% \end{syntax}
-% This function returns the length value kept in <dim> in a way
-% suitable for further processing.
-% \begin{texnote}
-% The function "\dim_use:N" could be implemented directly as the \TeX{}
-% primitive "\tex_the:D" which is also responsible to produce the values for
-% other internal quantities. We have chosen to use individual functions
-% for counters, dimensions etc.\ to allow checks and to make the code
-% more self-explanatory.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \dim_show:N |
-% \dim_show:c }
-% \begin{syntax}
-% "\dim_show:N" <dim>
-% \end{syntax}
-% This function pauses the compilation and displays the length value kept
-% in <skip> in the console output and log file.
-% \begin{texnote}
-% The function "\dim_show:N" could be implemented directly as the \TeX{}
-% primitive "\tex_showthe:D" which is also responsible to produce the values for
-% other internal quantities. We have chosen to use individual functions
-% for counters, dimensions etc.\ to allow checks and to make the code
-% more self-explanatory.
-% \end{texnote}
-% \end{function}
-%
-%
-%\begin{function}{
-% \dim_eval:n / (EXP) |
-%}
-% \begin{syntax}
-% \cs{dim_eval:n} \Arg{dimension expression}
-% \end{syntax}
-% Evaluates the \meta{dimension expression}, expanding any
-% dimensions and token list variables within the \meta{expression}
-% 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
-% termination if used in a \TeX-style assignment as it is \emph{not}
-% an \meta{internal dimension}.
-%\end{function}
-%
-% \begin{function}{%
-% \if_dim:w |
-% }
-% \begin{syntax}
-% "\if_dim:w" <dimen1> <rel> <dimen2> <true> "\else:" <false> "\fi:"
-% \end{syntax}
-% Compare two dimensions. It is recommended to use "\dim_eval:w" to
-% correctly evaluate and terminate these numbers. <rel> is one of
-% "<", "=" or ">" with catcode 12.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{ifdim}.
-% \end{texnote}
-% \end{function}
-%
-%\begin{function}{
-% \dim_compare_p:n / (EXP) |
-% \dim_compare:n / (TF) (EXP)
-%}
-% \begin{syntax}
-% "\dim_compare_p:n" \Arg{<dim expr.\ 1> <rel> <dim expr.\ 2>}
-% "\dim_compare:nTF" \Arg{<dim expr.\ 1> <rel> <dim expr.\ 2>}
-% ~~~~<true code> <false code>
-% \end{syntax}
-% Evaluates <dim expr.\ 1> and <dim expr.\ 2> and then carries out a
-% comparison of the resulting lengths using C-like operators:
-% \begin{center}
-% \begin{tabular}{ll@{\hspace{2cm}}ll}
-% Less than & "<" & Less than or equal & "<=" \\
-% Greater than & ">" & Greater than or equal & ">=" \\
-% Equal & "==" or "=" & Not equal & "!="
-% \end{tabular}
-% \end{center}
-% Based on the result of the comparison either the <true code>
-% or <false code> is executed. Both dimension expressions are evaluated
-% fully in the process. Note the syntax, which allows natural input in
-% the style of
-% \begin{quote}
-% |\dim_compare_p:n {2.54cm != \l_tmpb_int}|
-% \end{quote}
-% A single equals sign is available as comparator (in addition to those
-% familiar to C users) as standard \TeX\ practice is to compare
-% values using \texttt{=}.
-% \end{function}
-%
-% \begin{function}{ \dim_compare:nNn / (TF)(EXP) | \dim_compare_p:nNn / (EXP)}
-% \begin{syntax}
-% "\dim_compare:nNnTF" \Arg{dim~expr} <rel> \Arg{dim~expr}
-% \Arg{true} \Arg{false}
-% \end{syntax}
-% These functions test two dimension expressions against each other. They
-% are both evaluated by "\dim_eval:n". Note that if both expressions
-% are normal dimension variables as in
-% \begin{verbatim}
-% \dim_compare:nNnTF \l_temp_dim < \c_zero_skip {negative}{non-negative}
-% \end{verbatim}
-% you can safely omit the braces.
-%
-% These functions are faster than the \texttt{n}
-% variants described above but do not support an extended set
-% of relational operators.
-% \begin{texnote}
-% This is the \TeX{} primitive \tn{ifdim} turned into a function.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{%
-% \dim_while_do:nNnn |
-% \dim_until_do:nNnn |
-% \dim_do_while:nNnn |
-% \dim_do_until:nNnn |
-% }
-% \begin{syntax}
-% "\dim_while_do:nNnn" <dim expr> <rel> <dim~expr> <code>
-% \end{syntax}
-% "\dim_while_do:nNnn" tests the dimension expressions and if true performs
-% <code> repeatedly while the test remains true. "\dim_do_while:nNnn" is similar
-% but executes the body first and then performs the check, thus
-% ensuring that the body is executed at least once. The `until' versions
-% are similar but continue the loop as long as the test is false.
-% \end{function}
-%
-%
-%
-% \subsection{Variable and constants}
-%
-% \begin{variable}{%
-% \c_max_dim |
-% }
-% Constant that denotes the maximum value which can be stored in a <dim>
-% register.
-% \end{variable}
-%
-% \begin{variable}{%
-% \c_zero_dim |
-% }
-% Set of constants denoting useful values.
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_tmpa_dim |
-% \l_tmpb_dim |
-% \l_tmpc_dim |
-% \l_tmpd_dim |
-% \g_tmpa_dim |
-% \g_tmpb_dim |
-% }
-% Scratch register for immediate use.
-% \end{variable}
-%
-% \section{Muskips}
-%
-% \begin{function}{ \muskip_new:N }
-% \begin{syntax}
-% "\muskip_new:N" <muskip>
-% \end{syntax}
-% \begin{texnote}
-% Defines <muskip> to be a new variable of type "muskip".
-% "\muskip_new:N" is the equivalent to plain \TeX{}'s \tn{newmuskip}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \muskip_set:Nn |
-% \muskip_gset:Nn |
-% }
-% \begin{syntax}
-% "\muskip_set:Nn" <muskip> \Arg{muskip value}
-% \end{syntax}
-% These functions will set the <muskip> register to the <length>
-% value.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \muskip_add:Nn |
-% \muskip_gadd:Nn |
-% }
-% \begin{syntax}
-% "\muskip_add:Nn" <muskip> \Arg{length}
-% \end{syntax}
-% These functions will add to the <muskip> register the value
-% <length>. If the second argument is a <muskip> register too, the
-% surrounding braces can be left out.
-% \end{function}
-%
-% \begin{function}{%
-% \muskip_sub:Nn |
-% \muskip_gsub:Nn |
-% }
-% \begin{syntax}
-% "\muskip_gsub:Nn" <muskip> \Arg{length}
-% \end{syntax}
-% These functions will subtract from the <muskip> register the value
-% <length>. If the second argument is a <muskip> register too, the
-% surrounding braces can be left out.
-% \end{function}
-%
-% \begin{function}{ \muskip_use:N }
-% \begin{syntax}
-% "\muskip_use:N" <muskip>
-% \end{syntax}
-% This function returns the length value kept in <muskip> in a way
-% suitable for further processing.
-% \begin{texnote}
-% See note for "\dim_use:N".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \muskip_show:N }
-% \begin{syntax}
-% "\muskip_show:N" <muskip>
-% \end{syntax}
-% This function pauses the compilation and displays the length value kept
-% in <muskip> in the console output and log file.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3skip} implementation}
-%
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \subsection{Skip registers}
-%
-% \begin{macro}{\skip_new:N,\skip_new:c}
-% Allocation of a new internal registers.
-% \begin{macrocode}
-%<*initex>
-\alloc_new:nnnN {skip} \c_zero \c_max_register_int \tex_skipdef:D
-%</initex>
-%<*package>
-\cs_new_protected_nopar:Npn \skip_new:N #1 {
- \chk_if_free_cs:N #1
- \newskip #1
-}
-%</package>
-\cs_generate_variant:Nn \skip_new:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\skip_set:Nn}
-% \begin{macro}{\skip_set:cn}
-% \begin{macro}{\skip_gset:Nn}
-% \begin{macro}{\skip_gset:cn}
-% Setting skips is again something that I would like to make
-% uniform at the moment to get a better overview.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \skip_set:Nn #1#2 {
- #1 \etex_glueexpr:D #2 \scan_stop:
-%<*check>
-\chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_protected_nopar:Npn \skip_gset:Nn {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \skip_set:Nn
-}
-\cs_generate_variant:Nn \skip_set:Nn {cn}
-\cs_generate_variant:Nn \skip_gset:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\skip_zero:N}
-% \begin{macro}{\skip_gzero:N}
-% \begin{macro}{\skip_zero:c}
-% \begin{macro}{\skip_gzero:c}
-% Reset the register to zero.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \skip_zero:N #1{
- #1\c_zero_skip \scan_stop:
-%<*check>
- \chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_new_protected_nopar:Npn \skip_gzero:N {
-% \end{macrocode}
-% We make sure that a local variable is not updated globally by
-% changing the internal test (i.e.\ |\chk_local_or_pref_global:N|) before
-% making the assignment. This is done by |\pref_global_chk:| which also
-% issues the necessary |\pref_global:D|. This is not very efficient, but
-% this code will be only included for debugging purposes. Using
-% |\pref_global:D| in front of the local function is better in the
-% production versions.
-% \begin{macrocode}
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \skip_zero:N
-}
-\cs_generate_variant:Nn \skip_zero:N {c}
-\cs_generate_variant:Nn \skip_gzero:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\skip_add:Nn}
-% \begin{macro}{\skip_add:cn}
-% \begin{macro}{\skip_gadd:Nn}
-% \begin{macro}{\skip_gadd:cn}
-% \begin{macro}{\skip_sub:Nn}
-% \begin{macro}{\skip_gsub:Nn}
-% Adding and subtracting to and from <skip>s
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \skip_add:Nn #1#2 {
-% \end{macrocode}
-% We need to say |by| in case the first argment is a register
-% accessed by its number, e.g., |\skip23|.
-% \begin{macrocode}
- \tex_advance:D#1 by \etex_glueexpr:D #2 \scan_stop:
-%<*check>
- \chk_local_or_pref_global:N #1
-%</check>
-}
-\cs_generate_variant:Nn \skip_add:Nn {cn}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \skip_sub:Nn #1#2{
- \tex_advance:D #1 -\etex_glueexpr:D #2 \scan_stop:
-%<*check>
- \chk_local_or_pref_global:N #1
-%</check>
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \skip_gadd:Nn {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \skip_add:Nn
-}
-\cs_generate_variant:Nn \skip_gadd:Nn {cn}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_nopar:Npn \skip_gsub:Nn {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \skip_sub:Nn
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\skip_horizontal:N}
-% \begin{macro}{\skip_horizontal:c}
-% \begin{macro}{\skip_horizontal:n}
-% \begin{macro}{\skip_vertical:N}
-% \begin{macro}{\skip_vertical:c}
-% \begin{macro}{\skip_vertical:n}
-% Inserting skips.
-% \begin{macrocode}
-\cs_new_eq:NN \skip_horizontal:N \tex_hskip:D
-\cs_generate_variant:Nn \skip_horizontal:N {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_nopar:Npn \skip_horizontal:n #1 {
- \skip_horizontal:N \etex_glueexpr:D #1 \scan_stop:
-}
-\cs_new_eq:NN \skip_vertical:N \tex_vskip:D
-\cs_generate_variant:Nn \skip_vertical:N {c}
-\cs_new_nopar:Npn \skip_vertical:n #1 {
- \skip_vertical:N \etex_glueexpr:D #1 \scan_stop:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\skip_use:N}
-% \begin{macro}{\skip_use:c}
-% Here is how skip registers are accessed:
-% \begin{macrocode}
-\cs_new_eq:NN \skip_use:N \tex_the:D
-\cs_generate_variant:Nn \skip_use:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\skip_show:N}
-% \begin{macro}{\skip_show:c}
-% Diagnostics.
-% \begin{macrocode}
-\cs_new_eq:NN \skip_show:N \kernel_register_show:N
-\cs_generate_variant:Nn \skip_show:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\skip_eval:n}
-% Evaluating a calc expression. This is expandable and works inside an ``x''
-% type of argument.
-% \begin{macrocode}
-\cs_new_nopar:Npn \skip_eval:n #1 {
- \tex_the:D \etex_glueexpr:D #1 \scan_stop:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\l_tmpa_skip}
-% \begin{macro}{\l_tmpb_skip}
-% \begin{macro}{\l_tmpc_skip}
-% \begin{macro}{\g_tmpa_skip}
-% \begin{macro}{\g_tmpb_skip}
-% We provide three local and two global scratch registers, maybe we
-% need more or less.
-% \begin{macrocode}
-%%\chk_if_free_cs:N \l_tmpa_skip
-%%\tex_skipdef:D\l_tmpa_skip 255 %currently taken up by \skip@
-\skip_new:N \l_tmpa_skip
-\skip_new:N \l_tmpb_skip
-\skip_new:N \l_tmpc_skip
-\skip_new:N \g_tmpa_skip
-\skip_new:N \g_tmpb_skip
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\c_zero_skip}
-% \begin{macro}{\c_max_skip}
-% \begin{macrocode}
-%<*!package>
-\skip_new:N \c_zero_skip
-\skip_set:Nn \c_zero_skip {0pt}
-\skip_new:N \c_max_skip
-\skip_set:Nn \c_max_skip {16383.99999pt}
-%</!package>
-%<*!initex>
-\cs_set_eq:NN \c_zero_skip \z@
-\cs_set_eq:NN \c_max_skip \maxdimen
-%</!initex>
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\skip_if_infinite_glue_p:n}
-% \begin{macro}[TF]{\skip_if_infinite_glue:n}
-% With \eTeX{} we all of a sudden get access to a lot information we
-% should otherwise consider ourselves lucky to get. One is
-% the stretch and shrink components of a skip register and the order
-% or those components. "\skip_if_infinite_glue:nTF" tests it directly by
-% looking at the stretch and shrink order. If either of the predicate
-% functions return \m{true} "\bool_if:nTF" will return \m{true}
-% and the logic test will take the true branch.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \skip_if_infinite_glue:n {p,TF,T,F} {
- \bool_if:nTF {
- \int_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero ||
- \int_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero
- } {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\skip_split_finite_else_action:nnNN}
-% This macro is useful when performing error checking in certain
-% circumstances. If the \m{skip} register holds finite glue it sets
-% "#3" and "#4" to the stretch and shrink component resp. If it holds
-% infinite glue set "#3" and "#4" to zero and issue the special action
-% "#2" which is probably an error message.
-% Assignments are global.
-% \begin{macrocode}
-\cs_new_nopar:Npn \skip_split_finite_else_action:nnNN #1#2#3#4{
- \skip_if_infinite_glue:nTF {#1}
- {
- #3 = \c_zero_skip
- #4 = \c_zero_skip
- #2
- }
- {
- #3 = \etex_gluestretch:D #1 \scan_stop:
- #4 = \etex_glueshrink:D #1 \scan_stop:
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \subsection{Dimen registers}
-%
-% \begin{macro}{\dim_new:N,\dim_new:c}
-% Allocating \meta{dim} registers...
-% \begin{macrocode}
-%<*initex>
-\alloc_new:nnnN {dim} \c_zero \c_max_register_int \tex_dimendef:D
-%</initex>
-%<*package>
-\cs_new_protected_nopar:Npn \dim_new:N #1 {
- \chk_if_free_cs:N #1
- \newdimen #1
-}
-%</package>
-\cs_generate_variant:Nn \dim_new:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\dim_set:Nn}
-% \begin{macro}{\dim_set:cn}
-% \begin{macro}{\dim_set:Nc}
-% \begin{macro}{\dim_gset:Nn}
-% \begin{macro}{\dim_gset:cn}
-% \begin{macro}{\dim_gset:Nc}
-% \begin{macro}{\dim_gset:cc}
-% We add |\dim_eval:n| in order to allow simple arithmetic
-% and a space just for those using |\dimen1| or alike. See OR!
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_set:Nn #1#2 {
- #1~ \etex_dimexpr:D #2 \scan_stop:
-}
-\cs_generate_variant:Nn \dim_set:Nn {cn,Nc}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_gset:Nn { \pref_global:D \dim_set:Nn }
-\cs_generate_variant:Nn \dim_gset:Nn {cn,Nc,cc}
-% \end{macrocode}
-% \end{macro}\end{macro}\end{macro}\end{macro}
-% \end{macro}\end{macro}\end{macro}
-%
-%\begin{macro}{\dim_set_max:Nn}
-%\begin{macro}{\dim_set_max:cn}
-%\begin{macro}{\dim_set_min:Nn}
-%\begin{macro}{\dim_set_min:cn}
-%\begin{macro}{\dim_gset_max:Nn}
-%\begin{macro}{\dim_gset_max:cn}
-%\begin{macro}{\dim_gset_min:Nn}
-%\begin{macro}{\dim_gset_min:cn}
-% Setting maximum and minimum values is simply a case of so build-in
-% comparison. This only applies to dimensions as skips are not ordered.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_set_max:Nn #1#2 {
- \dim_compare:nNnT {#1} < {#2} { \dim_set:Nn #1 {#2} }
-}
-\cs_generate_variant:Nn \dim_set_max:Nn { c }
-\cs_new_protected_nopar:Npn \dim_set_min:Nn #1#2 {
- \dim_compare:nNnT {#1} > {#2} { \dim_set:Nn #1 {#2} }
-}
-\cs_generate_variant:Nn \dim_set_min:Nn { c }
-\cs_new_protected_nopar:Npn \dim_gset_max:Nn #1#2 {
- \dim_compare:nNnT {#1} < {#2} { \dim_gset:Nn #1 {#2} }
-}
-\cs_generate_variant:Nn \dim_gset_max:Nn { c }
-\cs_new_protected_nopar:Npn \dim_gset_min:Nn #1#2 {
- \dim_compare:nNnT {#1} > {#2} { \dim_gset:Nn #1 {#2} }
-}
-\cs_generate_variant:Nn \dim_gset_min:Nn { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macro}{\dim_zero:N}
-% \begin{macro}{\dim_gzero:N}
-% \begin{macro}{\dim_zero:c}
-% \begin{macro}{\dim_gzero:c}
-% Resetting.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_zero:N #1 { #1\c_zero_skip }
-\cs_generate_variant:Nn \dim_zero:N {c}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_gzero:N { \pref_global:D \dim_zero:N }
-\cs_generate_variant:Nn \dim_gzero:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\dim_add:Nn}
-% \begin{macro}{\dim_add:cn}
-% \begin{macro}{\dim_add:Nc}
-% \begin{macro}{\dim_gadd:Nn}
-% \begin{macro}{\dim_gadd:cn}
-% Addition.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_add:Nn #1#2{
-% \end{macrocode}
-% We need to say |by| in case the first argment is a register
-% accessed by its number, e.g., |\dimen23|.
-% \begin{macrocode}
- \tex_advance:D#1 by \etex_dimexpr:D #2 \scan_stop:
-}
-\cs_generate_variant:Nn \dim_add:Nn {cn,Nc}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_gadd:Nn { \pref_global:D \dim_add:Nn }
-\cs_generate_variant:Nn \dim_gadd:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\dim_sub:Nn}
-% \begin{macro}{\dim_sub:cn}
-% \begin{macro}{\dim_sub:Nc}
-% \begin{macro}{\dim_gsub:Nn}
-% \begin{macro}{\dim_gsub:cn}
-% Subtracting.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_sub:Nn #1#2 { \tex_advance:D#1-#2\scan_stop: }
-\cs_generate_variant:Nn \dim_sub:Nn {cn,Nc}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dim_gsub:Nn { \pref_global:D \dim_sub:Nn }
-\cs_generate_variant:Nn \dim_gsub:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\dim_use:N}
-% \begin{macro}{\dim_use:c}
-% Accessing a \meta{dim}.
-% \begin{macrocode}
-\cs_new_eq:NN \dim_use:N \tex_the:D
-\cs_generate_variant:Nn \dim_use:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\dim_show:N}
-% \begin{macro}{\dim_show:c}
-% Diagnostics.
-% \begin{macrocode}
-\cs_new_eq:NN \dim_show:N \kernel_register_show:N
-\cs_generate_variant:Nn \dim_show:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\l_tmpa_dim}
-% \begin{macro}{\l_tmpb_dim}
-% \begin{macro}{\l_tmpc_dim}
-% \begin{macro}{\l_tmpd_dim}
-% \begin{macro}{\g_tmpa_dim}
-% \begin{macro}{\g_tmpb_dim}
-% Some scratch registers.
-% \begin{macrocode}
-\dim_new:N \l_tmpa_dim
-\dim_new:N \l_tmpb_dim
-\dim_new:N \l_tmpc_dim
-\dim_new:N \l_tmpd_dim
-\dim_new:N \g_tmpa_dim
-\dim_new:N \g_tmpb_dim
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\c_zero_dim}
-% \begin{macro}{\c_max_dim}
-% Just aliases.
-% \begin{macrocode}
-\cs_new_eq:NN \c_zero_dim \c_zero_skip
-\cs_new_eq:NN \c_max_dim \c_max_skip
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\dim_eval:n}
-% Evaluating a calc expression. This is expandable and works inside an ``x''
-% type of argument.
-% \begin{macrocode}
-\cs_new_nopar:Npn \dim_eval:n #1 {
- \tex_the:D \etex_dimexpr:D #1 \scan_stop:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\if_dim:w,\dim_value:w,\dim_eval:w,\dim_eval_end:}
-% Primitives.
-% \begin{macrocode}
-\cs_new_eq:NN \if_dim:w \tex_ifdim:D
-\cs_set_eq:NN \dim_value:w \tex_number:D
-\cs_set_eq:NN \dim_eval:w \etex_dimexpr:D
-\cs_set_protected:Npn \dim_eval_end: {\tex_relax:D}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\dim_compare_p:nNn}
-% \begin{macro}[TF]{\dim_compare:nNn}
-% \begin{macrocode}
-\prg_new_conditional:Nnn \dim_compare:nNn {p,TF,T,F} {
- \if_dim:w \etex_dimexpr:D #1 #2 \etex_dimexpr:D #3 \scan_stop:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\dim_compare_p:n}
-% \begin{macro}[TF]{\dim_compare:n}
-% [This code plus comments lifted directly from the |\int_compare:nTF| function.]
-% Comparison tests using a simple syntax where only one set of braces
-% is required and additional operators such as "!=" and ">=" are
-% supported. First some notes on the idea behind this. We wish to
-% support writing code like
-% \begin{verbatim}
-% \dim_compare_p:n { 5 + \l_tmpa_dim != 4 - \l_tmpb_dim }
-% \end{verbatim}
-% In other words, we want to somehow add the missing "\dim_eval:w"
-% where required. We can start evaluating from the left using
-% "\dim:w", and we know that since the relation symbols "<", ">",
-% "=" and "!" are not allowed in such expressions, they will terminate
-% the expression. Therefore, we first let \TeX\ evaluate this left
-% hand side of the (in)equality.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \dim_compare:n #1 {p,TF,T,F} {
- \exp_after:wN \dim_compare_auxi:w \dim_value:w
- \dim_eval:w #1 \q_stop
-}
-% \end{macrocode}
-% Then the next step is to figure out which relation we should use, so
-% we have to somehow get rid of the first evaluation so that we can
-% see what stopped it. "\tex_romannumeral:D" is handy here since its
-% expansion given a non-positive number is \m{null}. We therefore
-% simply check if the first token of the left hand side evaluation is
-% a minus. If not, we insert it and issue "\tex_romannumeral:D",
-% thereby ridding us of the left hand side evaluation. We do however
-% save it for later.
-% \begin{macrocode}
-\cs_new:Npn \dim_compare_auxi:w #1#2 \q_stop {
- \exp_after:wN \dim_compare_auxii:w \tex_romannumeral:D
- \if:w #1- \else: -\fi: #1#2 \q_mark #1#2 \q_stop
-}
-% \end{macrocode}
-% This leaves the first relation symbol in front and assuming the
-% right hand side has been input, at least one other token as well. We
-% support the following forms: |=|, |<|, |>| and the extended |!=|,
-% |==|, |<=| and |>=|. All the extended forms have an extra |=| so we
-% check if that is present as well. Then use specific function to
-% perform the test.
-% \begin{macrocode}
-\cs_new:Npn \dim_compare_auxii:w #1#2#3\q_mark{
- \use:c{
- dim_compare_ #1 \if_meaning:w =#2 = \fi:
- :w}
-}
-% \end{macrocode}
-% The actual comparisons are then simple function calls, using the
-% relation as delimiter for a delimited argument.
-% Equality is easy:
-% \begin{macrocode}
-\cs_new:cpn {dim_compare_=:w} #1 = #2 \q_stop {
- \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% So is the one using |==| -- we just have to use |==| in the
-% parameter text.
-% \begin{macrocode}
-\cs_new:cpn {dim_compare_==:w} #1 == #2 \q_stop {
- \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% Not equal is just about reversing the truth value.
-% \begin{macrocode}
-\cs_new:cpn {dim_compare_!=:w} #1 != #2 \q_stop {
- \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-% \end{macrocode}
-% Less than and greater than are also straight forward.
-% \begin{macrocode}
-\cs_new:cpn {dim_compare_<:w} #1 < #2 \q_stop {
- \if_dim:w #1 sp < \dim_eval:w #2 \dim_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_new:cpn {dim_compare_>:w} #1 > #2 \q_stop {
- \if_dim:w #1 sp > \dim_eval:w #2 \dim_eval_end:
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% The less than or equal operation is just the opposite of the greater
-% than operation. Vice versa for less than or equal.
-% \begin{macrocode}
-\cs_new:cpn {dim_compare_<=:w} #1 <= #2 \q_stop {
- \if_dim:w #1 sp > \dim_eval:w #2 \dim_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-\cs_new:cpn {dim_compare_>=:w} #1 >= #2 \q_stop {
- \if_dim:w #1 sp < \dim_eval:w #2 \dim_eval_end:
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\dim_while_do:nNnn}
-% \begin{macro}{\dim_until_do:nNnn}
-% \begin{macro}{\dim_do_while:nNnn}
-% \begin{macro}{\dim_do_until:nNnn}
-% "while_do" and "do_while" functions for dimensions. Same as for the
-% "int" type only the names have changed.
-% \begin{macrocode}
-\cs_new_nopar:Npn \dim_while_do:nNnn #1#2#3#4{
- \dim_compare:nNnT {#1}#2{#3}{#4 \dim_while_do:nNnn {#1}#2{#3}{#4}}
-}
-\cs_new_nopar:Npn \dim_until_do:nNnn #1#2#3#4{
- \dim_compare:nNnF {#1}#2{#3}{#4 \dim_until_do:nNnn {#1}#2{#3}{#4}}
-}
-\cs_new_nopar:Npn \dim_do_while:nNnn #1#2#3#4{
- #4 \dim_compare:nNnT {#1}#2{#3}{\dim_do_while:nNnn {#1}#2{#3}{#4}}
-}
-\cs_new_nopar:Npn \dim_do_until:nNnn #1#2#3#4{
- #4 \dim_compare:nNnF {#1}#2{#3}{\dim_do_until:nNnn {#1}#2{#3}{#4}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Muskips}
-%
-% \begin{macro}{\muskip_new:N}
-% And then we add muskips.
-% \begin{macrocode}
-%<*initex>
-\alloc_new:nnnN {muskip} \c_zero \c_max_register_int \tex_muskipdef:D
-%</initex>
-%<*package>
-\cs_new_protected_nopar:Npn \muskip_new:N #1 {
- \chk_if_free_cs:N #1
- \newmuskip #1
-}
-%</package>
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\muskip_set:Nn}
-% \begin{macro}{\muskip_gset:Nn}
-% \begin{macro}{\muskip_add:Nn}
-% \begin{macro}{\muskip_gadd:Nn}
-% \begin{macro}{\muskip_sub:Nn}
-% \begin{macro}{\muskip_gsub:Nn}
-% Simple functions for muskips.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \muskip_set:Nn#1#2{#1\etex_muexpr:D#2\scan_stop:}
-\cs_new_protected_nopar:Npn \muskip_gset:Nn{\pref_global:D\muskip_set:Nn}
-\cs_new_protected_nopar:Npn \muskip_add:Nn#1#2{\tex_advance:D#1\etex_muexpr:D#2\scan_stop:}
-\cs_new_protected_nopar:Npn \muskip_gadd:Nn{\pref_global:D\muskip_add:Nn}
-\cs_new_protected_nopar:Npn \muskip_sub:Nn#1#2{\tex_advance:D#1-\etex_muexpr:D#2\scan_stop:}
-\cs_new_protected_nopar:Npn \muskip_gsub:Nn{\pref_global:D\muskip_sub:Nn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\muskip_use:N}
-% Accessing a \meta{muskip}.
-% \begin{macrocode}
-\cs_new_eq:NN \muskip_use:N \tex_the:D
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\muskip_show:N}
-% \begin{macrocode}
-\cs_new_eq:NN \muskip_show:N \kernel_register_show:N
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3tl.dtx b/Master/texmf-dist/source/latex/expl3/l3tl.dtx
deleted file mode 100644
index 487578939f1..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3tl.dtx
+++ /dev/null
@@ -1,2142 +0,0 @@
-% \iffalse
-%% File: l3tl.dtx Copyright (C) 1990-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3tl.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental Token Lists}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3tl.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3tl} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Token Lists}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \def\tlvar{tl var.}
-% \def\tlist{token list}
-%
-% \begin{documentation}
-%
-% \LaTeX3 stores token lists in variables also called `token lists'.
-% Variables of this type get the suffix "tl" and functions of this type
-% have the prefix "tl". To use a token list variable you simply call
-% the corresponding variable.
-%
-% Often you find yourself with not a token list variable but an
-% arbitrary token list which has to undergo certain tests. We will \emph{also}
-% prefix these functions with "tl". While token list variables are
-% always single tokens, token lists are always surrounded by
-% braces.
-%
-% \section{Functions}
-%
-% \begin{function}{\tl_new:N |
-% \tl_new:c |
-% \tl_new:Nn |
-% \tl_new:cn |
-% \tl_new:Nx }
-% \begin{syntax}
-% "\tl_new:Nn" <\tlvar> \Arg{initial token list}
-% \end{syntax}
-% Defines <\tlvar> globally to be a new variable to store a token list.
-% <initial token list> is the initial value of <\tlvar>. This
-% makes it possible to assign values to a constant token list variable.
-%
-% The form "\tl_new:N" initializes the token list variable with an empty value.
-% \end{function}
-%
-%
-% \begin{function}{\tl_const:Nn}
-% \begin{syntax}
-% "\tl_const:Nn" \meta{\tlvar} \Arg{token list}
-% \end{syntax}
-% Defines \meta{\tlvar} as a global constant expanding to \meta{token list}.
-% The name of the constant must be free when the constant is created.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_use:N |
-% \tl_use:c
-% }
-% \begin{syntax}
-% "\tl_use:N" <\tlvar>
-% \end{syntax}
-% Function that inserts the <\tlvar> into the processing stream. Instead of
-% |\tl_use:N| simply placing the <\tlvar> into the input stream is also
-% supported. |\tl_use:c| will complain if the <\tlvar> hasn't been declared
-% previously!
-% \end{function}
-%
-% \begin{function}{\tl_show:N |
-% \tl_show:c |
-% \tl_show:n }
-% \begin{syntax}
-% "\tl_show:N" <\tlvar>
-% "\tl_show:n" \Arg{\tlist}
-% \end{syntax}
-% Function that pauses the compilation and displays the <\tlvar>
-% or <\tlist> on the console output and in the log file.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_set:Nn |
-% \tl_set:Nc |
-% \tl_set:NV |
-% \tl_set:No |
-% \tl_set:Nv |
-% \tl_set:Nf |
-% \tl_set:Nx |
-% \tl_set:cn |
-% \tl_set:co |
-% \tl_set:cV |
-% \tl_set:cx |
-% \tl_gset:Nn |
-% \tl_gset:Nc |
-% \tl_gset:No |
-% \tl_gset:NV |
-% \tl_gset:Nv |
-% \tl_gset:Nx |
-% \tl_gset:cn |
-% \tl_gset:cx }
-% \begin{syntax}
-% "\tl_set:Nn" <\tlvar> \Arg{\tlist}
-% \end{syntax}
-% Defines <\tlvar> to hold the token list <\tlist>. Global
-% variants of this command assign the value globally the other variants
-% expand the <\tlist> up to a certain level before the assignment
-% or interpret the <\tlist> as a character list and form a control
-% sequence out of it.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_clear:N |
-% \tl_clear:c |
-% \tl_gclear:N |
-% \tl_gclear:c
-% }
-% \begin{syntax}
-% "\tl_clear:N" <\tlvar>
-% \end{syntax}
-% The <\tlvar> is locally or globally cleared. The "c" variants will
-% generate a control sequence name which is then interpreted as
-% <\tlvar> before clearing.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_clear_new:N |
-% \tl_clear_new:c |
-% \tl_gclear_new:N |
-% \tl_gclear_new:c |
-% }
-% \begin{syntax}
-% "\tl_clear_new:N" <\tlvar>
-% \end{syntax}
-% These functions check if <\tlvar> exists. If it does it will be cleared;
-% if it doesn't it will be allocated.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_put_left:Nn |
-% \tl_put_left:NV |
-% \tl_put_left:No |
-% \tl_put_left:Nx |
-% \tl_put_left:cn |
-% \tl_put_left:cV |
-% \tl_put_left:co |
-% }
-% \begin{syntax}
-% "\tl_put_left:Nn" <\tlvar> \Arg{\tlist}
-% \end{syntax}
-% These functions will append <\tlist> to the left of
-% <\tlvar>. <\tlist> might be subject to expansion before assignment.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_put_right:Nn |
-% \tl_put_right:NV |
-% \tl_put_right:No |
-% \tl_put_right:Nx |
-% \tl_put_right:cn |
-% \tl_put_right:cV |
-% \tl_put_right:co |
-% }
-% \begin{syntax}
-% "\tl_put_right:Nn" <\tlvar> \Arg{\tlist}
-% \end{syntax}
-% These functions append <\tlist> to the right of
-% <\tlvar>.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_gput_left:Nn |
-% \tl_gput_left:No |
-% \tl_gput_left:NV |
-% \tl_gput_left:Nx |
-% \tl_gput_left:cn |
-% \tl_gput_left:co |
-% \tl_gput_left:cV |
-% }
-% \begin{syntax}
-% "\tl_gput_left:Nn" <\tlvar> \Arg{\tlist}
-% \end{syntax}
-% These functions will append <\tlist> globally to the left of
-% <\tlvar>.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_gput_right:Nn|
-% \tl_gput_right:No|
-% \tl_gput_right:NV|
-% \tl_gput_right:Nx|
-% \tl_gput_right:cn|
-% \tl_gput_right:co|
-% \tl_gput_right:cV|
-% }
-% \begin{syntax}
-% "\tl_gput_right:Nn" <\tlvar> \Arg{\tlist}
-% \end{syntax}
-% These functions will globally append <\tlist> to the right of
-% <\tlvar>.
-% \end{function}
-%
-% A word of warning is appropriate here: Token list variables are
-% implemented as macros and as such currently inherit some of the
-% peculiarities of how \TeX\ handles "#"s in the argument of
-% macros. In particular, the following actions are legal
-% \begin{verbatim}
-% \tl_set:Nn \l_tmpa_tl{##1}
-% \tl_put_right:Nn \l_tmpa_tl{##2}
-% \tl_set:No \l_tmpb_tl{\l_tmpa_tl ##3}
-% \end{verbatim}
-% |x| type expansions where macros being expanded contain |#|s do not
-% work and will not work until there is an |\expanded| primitive in
-% the engine. If you want them to work you must double |#|s another
-% level.
-%
-%
-% \begin{function}{%
-% \tl_set_eq:NN |
-% \tl_set_eq:Nc |
-% \tl_set_eq:cN |
-% \tl_set_eq:cc |
-% \tl_gset_eq:NN |
-% \tl_gset_eq:Nc |
-% \tl_gset_eq:cN |
-% \tl_gset_eq:cc |
-% }
-% \begin{syntax}
-% "\tl_set_eq:NN" <\tlvar1> <\tlvar2>
-% \end{syntax}
-% Fast form for
-% \begin{syntax}
-% "\tl_set:No" <\tlvar1> \Arg{\tlvar2}
-% \end{syntax}
-% when <\tlvar2> is known to be a variable of type "tl".
-% \end{function}
-%
-% \begin{function}{\tl_to_str:N |
-% \tl_to_str:c
-% }
-% \begin{syntax}
-% "\tl_to_str:N" <\tlvar>
-% \end{syntax}
-% This function returns the token list kept in <\tlvar> as a string list
-% with all characters catcoded to `other'.
-% \end{function}
-%
-% \begin{function}{ \tl_to_str:n }
-% \begin{syntax}
-% "\tl_to_str:n" \Arg{\tlist}
-% \end{syntax}
-% This function turns its argument into a string where all characters
-% have catcode `other'.
-% \begin{texnote}
-% This is the \eTeX\ primitive \tn{detokenize}.
-% \end{texnote}
-% \end{function}
-%
-%
-% \begin{function}{ \tl_rescan:nn }
-% \begin{syntax}
-% "\tl_rescan:nn" \Arg{catcode setup} \Arg{\tlist}
-% \end{syntax}
-% Returns the result of re-tokenising <\tlist> with the catcode setup
-% (and whatever other redefinitions) specified. This is useful because
-% the catcodes of characters are `frozen' when first tokenised; this allows
-% their meaning to be changed even after they've been read as an argument.
-% Also see "\tl_set_rescan:Nnn" below.
-% \begin{texnote}
-% This is a wrapper around \eTeX's "\scantokens".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \tl_set_rescan:Nnn | \tl_set_rescan:Nno | \tl_set_rescan:Nnx |
-% \tl_gset_rescan:Nnn | \tl_gset_rescan:Nno | \tl_gset_rescan:Nnx }
-% \begin{syntax}
-% "\tl_set_rescan:Nnn" <\tlvar> \Arg{catcode setup} \Arg{\tlist}
-% \end{syntax}
-% Sets <\tlvar> to the result of re-tokenising <\tlist> with the catcode setup
-% (and whatever other redefinitions) specified.
-% \begin{texnote}
-% This is a wrapper around \eTeX's "\scantokens".
-% \end{texnote}
-% \end{function}
-%
-%
-%
-% \section{Predicates and conditionals}
-%
-% \begin{function}{\tl_if_empty_p:N / (EXP) |
-% \tl_if_empty_p:c / (EXP)
-% }
-% \begin{syntax}
-% "\tl_if_empty_p:N" <\tlvar>
-% \end{syntax}
-% This predicate returns `true' if <\tlvar> is `empty' i.e., doesn't
-% contain any tokens.
-% \end{function}
-%
-% \begin{function}{\tl_if_empty:N / (TF)(EXP) |
-% \tl_if_empty:c / (TF)(EXP) |
-% }
-% \begin{syntax}
-% "\tl_if_empty:NTF" <\tlvar> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Execute <true code> if <\tlvar> is empty and <false code> if it
-% contains any tokens.
-% \end{function}
-%
-% \begin{function}{\tl_if_eq_p:NN / (EXP) |
-% \tl_if_eq_p:cN / (EXP) |
-% \tl_if_eq_p:Nc / (EXP) |
-% \tl_if_eq_p:cc / (EXP) |
-% }
-% \begin{syntax}
-% "\tl_if_eq_p:NN" <\tlvar1> <\tlvar2>
-% \end{syntax}
-% Predicate function which returns `true' if the two token list
-% variables are identical and `false' otherwise.
-% \end{function}
-%
-% \begin{function}{
-% \tl_if_eq:NN / (TF)(EXP) |
-% \tl_if_eq:cN / (TF)(EXP) |
-% \tl_if_eq:Nc / (TF)(EXP) |
-% \tl_if_eq:cc / (TF)(EXP) |
-% }
-% \begin{syntax}
-% "\tl_if_eq:NNTF" <\tlvar1> <\tlvar2> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Execute <true code> if <\tlvar1> holds the same token list as <\tlvar2>
-% and <false code> otherwise.
-% \end{function}
-%
-%
-% \begin{function}{\tl_if_empty_p:n / (EXP) |
-% \tl_if_empty_p:V / (EXP) |
-% \tl_if_empty_p:o / (EXP) |
-% \tl_if_empty:n / (TF) |
-% \tl_if_empty:V / (TF) |
-% \tl_if_empty:o / (TF) |
-% }
-% \begin{syntax}
-% "\tl_if_empty:nTF" \Arg{\tlist} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Execute <true code> if <\tlist> doesn't contain any tokens and <false
-% code> otherwise.
-% \end{function}
-%
-%\begin{function}{ \tl_if_eq:nn / (TF) }
-% \begin{syntax}
-% \cs{tl_if_eq:nnTF} \meta{token list1} \Arg{token list2} \Arg{true code}
-% ~~\Arg{false code}
-% \end{syntax}
-% Tests if \meta{token list1} and \meta{token list2} both in
-% respect of character codes and category codes. Either the
-% \meta{true code} or \meta{false code} in the input stream, as
-% appropriate to the truth of the test and the variant of the function
-% chosen.
-%\end{function}
-%
-% \begin{function}{\tl_if_blank_p:n / (EXP)|
-% \tl_if_blank:n / (TF)(EXP)|
-% \tl_if_blank_p:V / (EXP)|
-% \tl_if_blank_p:o / (EXP)|
-% \tl_if_blank:V / (TF)(EXP)|
-% \tl_if_blank:o / (TF)(EXP)|
-% }
-% \begin{syntax}
-% "\tl_if_blank:nTF" \Arg{\tlist} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Execute <true code> if <\tlist> is blank meaning that it is either
-% empty or contains only blank spaces.
-% \end{function}
-%
-%
-%
-% \begin{function}{ \tl_if_single_p:n / (EXP) | \tl_if_single:n / (TF)(EXP) |
-% \tl_if_single_p:N / (EXP) | \tl_if_single:N / (TF)(EXP) }
-% \begin{syntax}
-% "\tl_if_single:NTF" \Arg{\tlvar} \Arg{true code} \Arg{false code}
-% "\tl_if_single:nTF" \Arg{\tlist} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Conditional returning true if the token list or the contents of the \tlvar\
-% consists of a single token only.
-%
-% Note that an input of `space'\footnote{But remember any number of
-% consequtive spaces are read as a single space by \TeX.} returns <true>
-% from this function.
-% \end{function}
-%
-%
-% \begin{function}{\tl_to_lowercase:n |
-% \tl_to_uppercase:n
-% }
-% \begin{syntax}
-% "\tl_to_lowercase:n" \Arg{\tlist}
-% \end{syntax}
-% "\tl_to_lowercase:n" converts all tokens in <\tlist> to their
-% lower case representation. Similar for "\tl_to_uppercase:n".
-% \begin{texnote}
-% These are the \TeX\ primitives \tn{lowercase} and \tn{uppercase}
-% renamed.
-% \end{texnote}
-% \end{function}
-%
-% \section{Working with the contents of token lists}
-%
-% \begin{function}{%
-% \tl_map_function:nN / (EXP) |
-% \tl_map_function:NN |
-% \tl_map_function:cN |
-% }
-% \begin{syntax}
-% "\tl_map_function:nN" \Arg{\tlist} <function> \\
-% "\tl_map_function:NN" <\tlvar> <function>
-% \end{syntax}
-% Runs through all elements in a <\tlist> from left to right and places
-% <function> in front of each element. As this function will also pick
-% up elements in brace groups, the element is returned with braces and
-% hence <function> should be a function with a |:n| suffix even though
-% it may very well only deal with a single token.
-%
-% This function uses a
-% purely expandable loop function and will stay so as long as
-% <function> is expandable too.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_map_inline:nn |
-% \tl_map_inline:Nn |
-% \tl_map_inline:cn |
-% }
-% \begin{syntax}
-% "\tl_map_inline:nn" \Arg{\tlist} \Arg{inline~function} \\
-% "\tl_map_inline:Nn" <\tlvar> \Arg{inline~function}
-% \end{syntax}
-% Allows a syntax like "\tl_map_inline:nn" \Arg{\tlist}
-% "{\token_to_str:N ##1}". This renders it non-expandable though.
-% Remember to double the "#"s for each level.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \tl_map_variable:nNn |
-% \tl_map_variable:NNn |
-% \tl_map_variable:cNn |
-% }
-% \begin{syntax}
-% "\tl_map_variable:nNn" \Arg{\tlist} <temp> \Arg{action} \\
-% "\tl_map_variable:NNn" <\tlvar> <temp> \Arg{action}
-% \end{syntax}
-% Assigns <temp> to each element on <\tlist> and executes <action>.
-% As there is an assignment in this process it is not expandable.
-% \begin{texnote}
-% This is the \LaTeX2{} function \tn{@tfor} but with a more sane syntax.
-% Also it works by tail recursion and so is faster as lists grow longer.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \tl_map_break: |
-% }
-% \begin{syntax}
-% "\tl_map_break:"
-% \end{syntax}
-% For breaking out of a loop. Must not be nested inside a primitive
-% "\if" structure.
-% \end{function}
-%
-%
-% \begin{function}{ \tl_reverse:n |
-% \tl_reverse:V |
-% \tl_reverse:o |
-% \tl_reverse:N }
-% \begin{syntax}
-% "\tl_reverse:n" "{"<token1><token2>...<token$\sb n$>"}"\\
-% "\tl_reverse:N" <\tlvar>
-% \end{syntax}
-% Reverse the token list (or the token list in the <\tlvar>) to result in
-% <token$\sb n$>\dots<token2><token1>.
-% Note that spaces in this
-% token list are gobbled in the process.
-%
-% Note also that braces are lost in the process of reversing a <\tlvar>.
-% That is,\\
-% "\tl_set:Nn \l_tmpa_tl {a{bcd}e} \tl_reverse:N \l_tmpa_tl"\\
-% will result in "ebcda". This behaviour is probably more of a bug than
-% a feature.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_elt_count:n / (EXP) |
-% \tl_elt_count:V / (EXP) |
-% \tl_elt_count:o / (EXP) |
-% \tl_elt_count:N / (EXP) |
-% }
-% \begin{syntax}
-% "\tl_elt_count:n" \Arg{\tlist} \\
-% "\tl_elt_count:N" <\tlvar>
-% \end{syntax}
-% Returns the number of elements in the token list. Brace groups
-% encountered count as one element. Note that spaces in this
-% token list are gobbled in the process.
-% \end{function}
-%
-%
-% \section{Variables and constants}
-%
-% \begin{variable}{\c_job_name_tl}
-% Constant that gets the `job name' assigned when \TeX{} starts.
-% \begin{texnote}
-% This is the new name for the primitive \tn{jobname}. It is a constant
-% that is set by \TeX{} and should not be overwritten by the package.
-% \end{texnote}
-% \end{variable}
-%
-% \begin{variable}{\c_empty_tl}
-% Constant that is always empty.
-% \begin{texnote}
-% This was named \tn{@empty} in \LaTeX2 and \tn{empty} in plain \TeX{}.
-% \end{texnote}
-% \end{variable}
-%
-% \begin{variable}{\c_space_tl}
-% A space token contained in a token list (compare this with
-% \cs{char_space_token}). For use where an explicit space is required.
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_tmpa_tl |
-% \l_tmpb_tl |
-% \g_tmpa_tl |
-% \g_tmpb_tl
-% }
-% Scratch register for immediate use. They are not used by conditionals
-% or predicate functions. However, it is important to note that you should
-% never rely on such scratch variables unless you fully control the code used
-% between setting them and retrieving their value. Calling code from other
-% modules, or worse allowing arbitrary user input to interfere might result in
-% them not containing what you expect. In that is the case you better define
-% your own scratch variables that are tight to your code by giving them
-% suitable names.
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_tl_replace_tl |
-% }
-% Internal register used in the replace functions.
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_kernel_testa_tl |
-% \l_kernel_testb_tl |
-% }
-% Registers used for conditional processing if the engine doesn't
-% support arbitrary string comparison. Not for use outside the kernel code!
-% \end{variable}
-%
-% \begin{variable}{%
-% \l_kernel_tmpa_tl |
-% \l_kernel_tmpb_tl
-% }
-% Scratch registers reserved for other places in kernel code. Not for use
-% outside the kernel code!
-% \end{variable}
-%
-% \begin{variable}{%
-% \g_tl_inline_level_int |
-% }
-% Internal register used in the inline map functions.
-% \end{variable}%
-%
-% \section{Searching for and replacing tokens}
-%
-% \begin{function}{
-% \tl_if_in:Nn / (TF) |
-% \tl_if_in:cn / (TF) |
-% \tl_if_in:nn / (TF) |
-% \tl_if_in:Vn / (TF) |
-% \tl_if_in:on / (TF) |
-% }
-% \begin{syntax}
-% "\tl_if_in:NnTF" <\tlvar> \Arg{item} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Function that tests if <item> is in <\tlvar>. Depending on the result
-% either <true code> or <false code> is executed. Note that <item>
-% cannot contain brace groups nor "#"$_6$ tokens.
-% \end{function}
-%
-% \begin{function}{
-% \tl_replace_in:Nnn |
-% \tl_replace_in:cnn |
-% \tl_greplace_in:Nnn |
-% \tl_greplace_in:cnn |
-% }
-% \begin{syntax}
-% "\tl_replace_in:Nnn" <\tlvar> \Arg{item1} \Arg{item2}
-% \end{syntax}
-% Replaces the leftmost occurrence of <item1> in <\tlvar> with
-% <item2> if present, otherwise the <\tlvar> is left untouched.
-% Note that <item1>
-% cannot contain brace groups nor "#"$_6$ tokens, and <item2>
-% cannot contain "#"$_6$ tokens.
-% \end{function}
-%
-% \begin{function}{
-% \tl_replace_all_in:Nnn |
-% \tl_replace_all_in:cnn |
-% \tl_greplace_all_in:Nnn |
-% \tl_greplace_all_in:cnn |
-% }
-% \begin{syntax}
-% "\tl_replace_all_in:Nnn" <\tlvar> \Arg{item1} \Arg{item2}
-% \end{syntax}
-% Replaces \emph{all} occurrences of <item1> in <\tlvar> with
-% <item2>.
-% Note that <item1>
-% cannot contain brace groups nor "#"$_6$ tokens, and <item2>
-% cannot contain "#"$_6$ tokens.
-% \end{function}
-%
-%
-% \begin{function}{
-% \tl_remove_in:Nn |
-% \tl_remove_in:cn |
-% \tl_gremove_in:Nn |
-% \tl_gremove_in:cn |
-% }
-% \begin{syntax}
-% "\tl_remove_in:Nn" <\tlvar> \Arg{item}
-% \end{syntax}
-% Removes the leftmost occurrence of <item> from <\tlvar> if present.
-% Note that <item>
-% cannot contain brace groups nor "#"$_6$ tokens.
-% \end{function}
-%
-%
-% \begin{function}{
-% \tl_remove_all_in:Nn |
-% \tl_remove_all_in:cn |
-% \tl_gremove_all_in:Nn |
-% \tl_gremove_all_in:cn |
-% }
-% \begin{syntax}
-% "\tl_remove_all_in:Nn" <\tlvar> \Arg{item}
-% \end{syntax}
-% Removes \emph{all} occurrences of <item> from <\tlvar>. Note that <item>
-% cannot contain brace groups nor "#"$_6$ tokens.
-% \end{function}
-%
-%
-% \section{Heads or tails?}
-%
-% Here are some functions for grabbing either the head or tail of a
-% list and perform some tests on it.
-%
-% \begin{function}{%
-% \tl_head:n / (EXP) |
-% \tl_head:V / (EXP) |
-% \tl_head:v / (EXP) |
-% \tl_tail:n / (EXP) |
-% \tl_tail:V / (EXP) |
-% \tl_tail:v / (EXP) |
-% \tl_tail:f / (EXP) |
-% \tl_head_i:n / (EXP) |
-% \tl_head_iii:n / (EXP) |
-% \tl_head_iii:f / (EXP) |
-% \tl_head:w / (EXP) |
-% \tl_tail:w / (EXP) |
-% \tl_head_i:w / (EXP) |
-% \tl_head_iii:w / (EXP)
-% }
-% \begin{syntax}
-% "\tl_head:n" "{" <token1><token2>...<token\,$\sb k$> "}" \\
-% "\tl_tail:n" "{" <token1><token2>...<token\,$\sb k$> "}" \\
-% "\tl_head:w" <token1><token2>...<token\,$\sb k$> "\q_stop"
-% \end{syntax}
-% These functions return either the head or the tail from a list of tokens, thus in
-% the above example "\tl_head:n" would return <token1> and "\tl_tail:n"
-% would return <token2>\dots<token\,$\sb k$>. "\tl_head_iii:n" returns the first
-% three tokens. The ":w" versions require some care as they expect the token
-% list to be delimited by "\q_stop".
-% \begin{texnote}
-% These are the Lisp functions "car" and "cdr" but with \LaTeX3 names.
-% \end{texnote}
-% \end{function}
-%
-%
-%
-%
-% \begin{function}{%
-% \tl_if_head_eq_meaning_p:nN / (EXP) |
-% \tl_if_head_eq_meaning:nN / (TF)(EXP) |
-% }
-% \begin{syntax}
-% "\tl_if_head_eq_meaning:nNTF" \Arg{\tlist} <token>
-% \Arg{true} \Arg{false}
-% \end{syntax}
-% Returns <true> if the first token in <\tlist> is equal to
-% <token> and <false> otherwise. The |meaning| version compares the
-% two tokens with |\if_meaning:w|.
-% \end{function}
-%
-% \begin{function}{%
-% \tl_if_head_eq_charcode_p:nN / (EXP) |
-% \tl_if_head_eq_charcode_p:fN / (EXP) |
-% \tl_if_head_eq_charcode:nN / (TF)(EXP) |
-% \tl_if_head_eq_charcode:fN / (TF)(EXP) |
-% }
-% \begin{syntax}
-% "\tl_if_head_eq_charcode:nNTF" \Arg{\tlist} <token>
-% \Arg{true} \Arg{false}
-% \end{syntax}
-% Returns <true> if the first token in <\tlist> is equal to
-% <token> and <false> otherwise. The |meaning| version compares the
-% two tokens with |\if_charcode:w| but it prevents expansion of
-% them. If you want them to expand, you can use an |f| type expansion
-% first (define |\tl_if_head_eq_charcode:fNTF| or similar).
-% \end{function}
-%
-% \begin{function}{%
-% \tl_if_head_eq_catcode_p:nN / (EXP) |
-% \tl_if_head_eq_catcode:nN / (TF)(EXP) |
-% }
-% \begin{syntax}
-% "\tl_if_head_eq_catcode:nNTF" \Arg{\tlist} <token>
-% \Arg{true} \Arg{false}
-% \end{syntax}
-% Returns <true> if the first token in <\tlist> is equal to
-% <token> and <false> otherwise. This version uses |\if_catcode:w| for
-% the test but is otherwise identical to the |charcode| version.
-% \end{function}
-%
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3tl} implementation}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-% \end{macrocode}
-% \begin{macrocode}
-%<*initex|package>
-% \end{macrocode}
-%
-% A token list variable is a control sequence that holds tokens. The
-% interface is similar to that for token registers, but beware that
-% the behavior vis \'a vis |\cs_set_nopar:Npx| etc. \ldots{} is different. (You
-% see this comes from Denys' implementation.)
-%
-%
-% \subsection{Functions}
-%
-% \begin{macro}{\tl_new:N}
-% \begin{macro}{\tl_new:c}
-% \begin{macro}{\tl_new:Nn}
-% \begin{macro}{\tl_new:cn}
-% \begin{macro}{\tl_new:Nx}
-% We provide one allocation function (which checks that the name is
-% not used) and two clear functions that locally or globally clear
-% the token list. The allocation function has two arguments to
-% specify an initial value. This is the only way to give values to
-% constants.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_new:Nn #1#2{
- \chk_if_free_cs:N #1
-% \end{macrocode}
-% If checking we don't allow constants to be defined.
-% \begin{macrocode}
-%<*check>
- \chk_var_or_const:N #1
-%</check>
-% \end{macrocode}
-% Otherwise any variable type is allowed.
-% \begin{macrocode}
- \tl_gset:Nn #1 {#2}
-}
-\cs_generate_variant:Nn \tl_new:Nn {cn}
-\cs_new_protected:Npn \tl_new:Nx #1#2{
- \chk_if_free_cs:N #1
-%<check> \chk_var_or_const:N #1
- \tl_gset:Nx #1 {#2}
-}
-\cs_new_protected_nopar:Npn \tl_new:N #1{\tl_new:Nn #1{}}
-\cs_new_protected_nopar:Npn \tl_new:c #1{\tl_new:cn {#1}{}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-%\begin{macro}{\tl_const:Nn}
-% For creating constant token lists: there is not actually anything here
-% that cannot be achieved using \cs{tl_new:N} and \cs{tl_set:Nn}
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_const:Nn #1#2 {
- \tl_new:N #1
- \tl_gset:Nn #1 {#2}
-}
-% \end{macrocode}
-%\end{macro}
-%
-% \begin{macro}{\tl_use:N}
-% \begin{macro}{\tl_use:c}
-% Perhaps this should just be enabled when checking?
-% \begin{macrocode}
-\cs_new_nopar:Npn \tl_use:N #1 {
- \if_meaning:w #1 \tex_relax:D
-% \end{macrocode}
-% If \m{\tlvar} equals |\tex_relax:D| it is probably stemming from a
-% |\cs:w|\dots|\cs_end:| that was created by mistake somewhere.
-% \begin{macrocode}
- \msg_kernel_bug:x {Token~list~variable~ `\token_to_str:N #1'~
- has~ an~ erroneous~ structure!}
- \else:
- \exp_after:wN #1
- \fi:
-}
-\cs_generate_variant:Nn \tl_use:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_show:N,\tl_show:c,\tl_show:n}
-% Showing a \meta{\tlvar} is just "\show"ing it and I don't really care
-% about checking that it's malformed at this stage.
-% \begin{macrocode}
-\cs_new_nopar:Npn \tl_show:N #1 { \cs_show:N #1 }
-\cs_generate_variant:Nn \tl_show:N {c}
-\cs_set_eq:NN \tl_show:n \etex_showtokens:D
-% \end{macrocode}
-% \end{macro}
-%
-%\begin{macro}{\tl_set:Nn}
-%\begin{macro}{\tl_set:NV}
-%\begin{macro}{\tl_set:Nv}
-%\begin{macro}{\tl_set:No}
-%\begin{macro}{\tl_set:Nf}
-%\begin{macro}{\tl_set:Nx}
-%\begin{macro}{\tl_set:cn}
-%\begin{macro}{\tl_set:cV}
-%\begin{macro}{\tl_set:cv}
-%\begin{macro}{\tl_set:co}
-%\begin{macro}{\tl_set:cx}
-%\begin{macro}{\tl_gset:Nn}
-%\begin{macro}{\tl_gset:NV}
-%\begin{macro}{\tl_gset:Nv}
-%\begin{macro}{\tl_gset:No}
-%\begin{macro}{\tl_gset:Nf}
-%\begin{macro}{\tl_gset:Nx}
-%\begin{macro}{\tl_gset:cn}
-%\begin{macro}{\tl_gset:cV}
-%\begin{macro}{\tl_gset:cv}
-%\begin{macro}{\tl_gset:cx}
-% By using \cs{exp_not:n} token list variables can contain "#" tokens.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set:Nn #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:n {#2} }
-}
-\cs_new_protected:Npn \tl_set:Nx #1#2 {
- \cs_set_nopar:Npx #1 {#2}
-}
-\cs_new_protected:Npn \tl_gset:Nn #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:n {#2} }
-}
-\cs_new_protected:Npn \tl_gset:Nx #1#2 {
- \cs_gset_nopar:Npx #1 {#2}
-}
-\cs_generate_variant:Nn \tl_set:Nn { NV }
-\cs_generate_variant:Nn \tl_set:Nn { Nv }
-\cs_generate_variant:Nn \tl_set:Nn { No }
-\cs_generate_variant:Nn \tl_set:Nn { Nf }
-\cs_generate_variant:Nn \tl_set:Nn { cV }
-\cs_generate_variant:Nn \tl_set:Nn { c }
-\cs_generate_variant:Nn \tl_set:Nn { cv }
-\cs_generate_variant:Nn \tl_set:Nn { co }
-\cs_generate_variant:Nn \tl_set:Nx { c }
-\cs_generate_variant:Nn \tl_gset:Nn { NV }
-\cs_generate_variant:Nn \tl_gset:Nn { Nv }
-\cs_generate_variant:Nn \tl_gset:Nn { No }
-\cs_generate_variant:Nn \tl_gset:Nn { Nf }
-\cs_generate_variant:Nn \tl_gset:Nn { c }
-\cs_generate_variant:Nn \tl_gset:Nn { cV }
-\cs_generate_variant:Nn \tl_gset:Nn { cv }
-\cs_generate_variant:Nn \tl_gset:Nx { c }
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macro}{\tl_set_eq:NN}
-% \begin{macro}{\tl_set_eq:Nc}
-% \begin{macro}{\tl_set_eq:cN}
-% \begin{macro}{\tl_set_eq:cc}
-% \begin{macro}{\tl_gset_eq:NN}
-% \begin{macro}{\tl_gset_eq:Nc}
-% \begin{macro}{\tl_gset_eq:cN}
-% \begin{macro}{\tl_gset_eq:cc}
-% For setting token list variables equal to each other. First checking:
-% \begin{macrocode}
-%<*check>
-\cs_new_protected_nopar:Npn \tl_set_eq:NN #1#2{
- \chk_exist_cs:N #1 \cs_set_eq:NN #1#2
- \chk_local_or_pref_global:N #1 \chk_var_or_const:N #2
-}
-\cs_new_protected_nopar:Npn \tl_gset_eq:NN #1#2{
- \chk_exist_cs:N #1 \cs_gset_eq:NN #1#2
- \chk_global:N #1 \chk_var_or_const:N #2
-}
-%</check>
-% \end{macrocode}
-% Non-checking versions are easy.
-% \begin{macrocode}
-%<*!check>
-\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN
-\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN
-%</!check>
-% \end{macrocode}
-% The rest again with the expansion module.
-% \begin{macrocode}
-\cs_generate_variant:Nn \tl_set_eq:NN {Nc,c,cc}
-\cs_generate_variant:Nn \tl_gset_eq:NN {Nc,c,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\tl_clear:N}
-% \begin{macro}{\tl_clear:c}
-% \begin{macro}{\tl_gclear:N}
-% \begin{macro}{\tl_gclear:c}
-% Clearing a token list variable.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_clear:N #1{\tl_set_eq:NN #1\c_empty_tl}
-\cs_generate_variant:Nn \tl_clear:N {c}
-\cs_new_protected_nopar:Npn \tl_gclear:N #1{\tl_gset_eq:NN #1\c_empty_tl}
-\cs_generate_variant:Nn \tl_gclear:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_clear_new:N}
-% \begin{macro}{\tl_clear_new:c}
-% These macros check whether a token list exists. If it does it
-% is cleared, if it doesn't it is allocated.
-% \begin{macrocode}
-%<*check>
-\cs_new_protected_nopar:Npn \tl_clear_new:N #1{
- \chk_var_or_const:N #1
- \if_predicate:w \cs_if_exist_p:N #1
- \tl_clear:N #1
- \else:
- \tl_new:N #1
- \fi:
-}
-%</check>
-%<-check>\cs_new_eq:NN \tl_clear_new:N \tl_clear:N
-\cs_generate_variant:Nn \tl_clear_new:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_gclear_new:N}
-% \begin{macro}{\tl_gclear_new:c}
-% These are the global versions of the above.
-% \begin{macrocode}
-%<*check>
-\cs_new_protected_nopar:Npn \tl_gclear_new:N #1{
- \chk_var_or_const:N #1
- \if_predicate:w \cs_if_exist_p:N #1
- \tl_gclear:N #1
- \else:
- \tl_new:N #1
- \fi:}
-%</check>
-%<-check>\cs_new_eq:NN \tl_gclear_new:N \tl_gclear:N
-\cs_generate_variant:Nn \tl_gclear_new:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}{\tl_put_right:Nn}
-%\begin{macro}{\tl_put_right:NV}
-%\begin{macro}{\tl_put_right:Nv}
-%\begin{macro}{\tl_put_right:No}
-%\begin{macro}{\tl_put_right:Nx}
-%\begin{macro}{\tl_put_right:cn}
-%\begin{macro}{\tl_put_right:cV}
-%\begin{macro}{\tl_put_right:cv}
-%\begin{macro}{\tl_put_right:cx}
-%\begin{macro}{\tl_gput_right:Nn}
-%\begin{macro}{\tl_gput_right:NV}
-%\begin{macro}{\tl_gput_right:Nv}
-%\begin{macro}{\tl_gput_right:No}
-%\begin{macro}{\tl_gput_right:Nx}
-%\begin{macro}{\tl_gput_right:cn}
-%\begin{macro}{\tl_gput_right:cV}
-%\begin{macro}{\tl_gput_right:cv}
-%\begin{macro}{\tl_gput_right:co}
-%\begin{macro}{\tl_gput_right:cx}
-% Adding to one end of a token list is done partially using
-% hand tuned functions for performance reasons.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_put_right:Nn #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} }
-}
-\cs_new_protected:Npn \tl_put_right:NV #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 }
-}
-\cs_new_protected:Npn \tl_put_right:Nv #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:v {#2} }
-}
-\cs_new_protected:Npn \tl_put_right:Nx #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 }
-}
-\cs_new_protected:Npn \tl_put_right:No #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} }
-}
-\cs_new_protected:Npn \tl_gput_right:Nn #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} }
-}
-\cs_new_protected:Npn \tl_gput_right:NV #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 }
-}
-\cs_new_protected:Npn \tl_gput_right:Nv #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:v {#2} }
-}
-\cs_new_protected:Npn \tl_gput_right:No #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} }
-}
-\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 }
-\cs_generate_variant:Nn \tl_put_right:NV { c }
-\cs_generate_variant:Nn \tl_put_right:Nv { c }
-\cs_generate_variant:Nn \tl_put_right:Nx { c }
-\cs_generate_variant:Nn \tl_gput_right:Nn { c }
-\cs_generate_variant:Nn \tl_gput_right:NV { c }
-\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 }
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\tl_put_left:Nn}
-%\begin{macro}{\tl_put_left:NV}
-%\begin{macro}{\tl_put_left:Nv}
-%\begin{macro}{\tl_put_left:No}
-%\begin{macro}{\tl_put_left:Nx}
-%\begin{macro}{\tl_put_left:cn}
-%\begin{macro}{\tl_put_left:cV}
-%\begin{macro}{\tl_put_left:cv}
-%\begin{macro}{\tl_put_left:cx}
-%\begin{macro}{\tl_gput_left:Nn}
-%\begin{macro}{\tl_gput_left:NV}
-%\begin{macro}{\tl_gput_left:Nv}
-%\begin{macro}{\tl_gput_left:No}
-%\begin{macro}{\tl_gput_left:Nx}
-%\begin{macro}{\tl_gput_left:cn}
-%\begin{macro}{\tl_gput_left:cV}
-%\begin{macro}{\tl_gput_left:cv}
-%\begin{macro}{\tl_gput_left:cx}
-% Adding to the left is basically the same as putting on the right.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_put_left:Nn #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_put_left:NV #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_put_left:Nv #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:v {#2} \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_put_left:Nx #1#2 {
- \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_put_left:No #1#2 {
- \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_gput_left:Nn #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_gput_left:NV #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_gput_left:Nv #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:v {#2} \exp_not:o #1 }
-}
-\cs_new_protected:Npn \tl_gput_left:No #1#2 {
- \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #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 }
-\cs_generate_variant:Nn \tl_put_left:NV { c }
-\cs_generate_variant:Nn \tl_put_left:Nv { c }
-\cs_generate_variant:Nn \tl_put_left:Nx { c }
-\cs_generate_variant:Nn \tl_gput_left:Nn { c }
-\cs_generate_variant:Nn \tl_gput_left:NV { c }
-\cs_generate_variant:Nn \tl_gput_left:Nv { c }
-\cs_generate_variant:Nn \tl_gput_left:Nx { c }
-% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% \begin{macro}{\tl_gset:Nc}
-% \begin{macro}{\tl_set:Nc}
-% These two functions are included because they are necessary in
-% Denys' implementations. The |:Nc| convention (see the expansion
-% module) is very unusual at first sight, but it works nicely
-% over all modules, so we would like to keep it.
-%
-% Construct a control sequence on the fly from |#2| and save it in
-% |#1|.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_gset:Nc {
-%<*check>
- \pref_global_chk:
-%</check>
-%<-check> \pref_global:D
- \tl_set:Nc}
-% \end{macrocode}
-% |\pref_global_chk:| will turn the variable check in |\tl_set:No|
-% into a global check.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_set:Nc #1#2{\tl_set:No #1{\cs:w#2\cs_end:}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Variables and constants}
-%
-% \begin{macro}{\c_job_name_tl}
-% Inherited from the expl3 name for the primitive: this needs to
-% actually contain the text of the jobname rather than the name of
-% the primitive, of course.
-% \begin{macrocode}
-\tl_new:N \c_job_name_tl
-\tl_set:Nx \c_job_name_tl { \tex_jobname:D }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\c_empty_tl}
-% Two constants which are often used.
-% \begin{macrocode}
-\tl_const:Nn \c_empty_tl { }
-% \end{macrocode}
-% \end{macro}
-%
-%
-%\begin{macro}{\c_space_tl}
-% A space as a token list (as opposed to as a character).
-% \begin{macrocode}
-\tl_const:Nn \c_space_tl { ~ }
-% \end{macrocode}
-%\end{macro}
-%
-% \begin{macro}{\g_tmpa_tl}
-% \begin{macro}{\g_tmpb_tl}
-% Global temporary token list variables.
-% They are supposed to be set and used immediately,
-% with no delay between the definition and the use because you
-% can't count on other macros not to redefine them from under you.
-%
-% \begin{macrocode}
-\tl_new:N \g_tmpa_tl
-\tl_new:N \g_tmpb_tl
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\l_kernel_testa_tl}
-% \begin{macro}{\l_kernel_testb_tl}
-% Local temporaries. These are the ones for test
-% routines. This means that one can safely use other temporaries
-% when calling test routines.
-% \begin{macrocode}
-\tl_new:N \l_kernel_testa_tl
-\tl_new:N \l_kernel_testb_tl
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\l_tmpa_tl}
-% \begin{macro}{\l_tmpb_tl}
-% These are local temporary token list variables. Be sure not to assume
-% that the value you put into them will survive for long---see discussion above.
-% \begin{macrocode}
-\tl_new:N \l_tmpa_tl
-\tl_new:N \l_tmpb_tl
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\l_kernel_tmpa_tl}
-% \begin{macro}{\l_kernel_tmpb_tl}
-% These are local temporary token list variables reserved for use by the
-% kernel. They should not be used by other modules.
-% \begin{macrocode}
-\tl_new:N \l_kernel_tmpa_tl
-\tl_new:N \l_kernel_tmpb_tl
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Predicates and conditionals}
-%
-% We also provide a few conditionals, both in expandable form (with
-% |\c_true_bool|) and in `brace-form', the latter are denoted by |TF| at the
-% end, as explained elsewhere.
-%
-%
-% \begin{macro}{\tl_if_empty_p:N,\tl_if_empty_p:c}
-% \begin{macro}[TF]{\tl_if_empty:N,\tl_if_empty:c}
-% These functions check whether the token list in the argument is
-% empty and execute the proper code from their argument(s).
-% \begin{macrocode}
-\prg_set_conditional:Npnn \tl_if_empty:N #1 {p,TF,T,F} {
- \if_meaning:w #1 \c_empty_tl
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \tl_if_empty_p:N {c}
-\cs_generate_variant:Nn \tl_if_empty:NTF {c}
-\cs_generate_variant:Nn \tl_if_empty:NT {c}
-\cs_generate_variant:Nn \tl_if_empty:NF {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_if_eq_p:NN,\tl_if_eq_p:Nc,\tl_if_eq_p:cN,\tl_if_eq_p:cc}
-% \begin{macro}[TF]{\tl_if_eq:NN,\tl_if_eq:Nc,\tl_if_eq:cN,\tl_if_eq:cc}
-% Returns |\c_true_bool| iff the two token list variables are equal.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \tl_if_eq:NN #1#2 {p,TF,T,F} {
- \if_meaning:w #1 #2 \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \tl_if_eq_p:NN {Nc,c,cc}
-\cs_generate_variant:Nn \tl_if_eq:NNTF {Nc,c,cc}
-\cs_generate_variant:Nn \tl_if_eq:NNT {Nc,c,cc}
-\cs_generate_variant:Nn \tl_if_eq:NNF {Nc,c,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%\begin{macro}[TF]{\tl_if_eq:nn}
-%\begin{macro}[aux]{\l_tl_tmpa_tl}
-%\begin{macro}[aux]{\l_tl_tmpb_tl}
-% A simple store and compare routine.
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F , TF } {
- \group_begin:
- \tl_set:Nn \l_tl_tmpa_tl {#1}
- \tl_set:Nn \l_tl_tmpb_tl {#2}
- \tex_ifx:D \l_tl_tmpa_tl \l_tl_tmpb_tl
- \group_end:
- \prg_return_true:
- \tex_else:D
- \group_end:
- \prg_return_false:
- \tex_fi:D
-}
-\tl_new:N \l_tl_tmpa_tl
-\tl_new:N \l_tl_tmpb_tl
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-% \begin{macro}{\tl_if_empty_p:n,\tl_if_empty_p:V,\tl_if_empty_p:o}
-% \begin{macro}[TF]{\tl_if_empty:n,\tl_if_empty:V,\tl_if_empty:o}
-% It would be tempting to just use "\if_meaning:w\q_nil#1\q_nil" as
-% a test since this works really well. However it fails on a token
-% list starting with "\q_nil" of course but more troubling is the
-% case where argument is a complete conditional such as "\if_true:"
-% a "\else:" b "\fi:" because then "\if_true:" is used by
-% "\if_meaning:w", the test turns out false, the "\else:" executes
-% the false branch, the "\fi:" ends it and the "\q_nil" at the end
-% starts executing\dots{} A safer route is to convert the entire
-% token list into harmless characters first and then compare
-% that. This way the test will even accept "\q_nil" as the first
-% token.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \tl_if_empty:n #1 {p,TF,T,F} {
- \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n {#1} \q_nil
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \tl_if_empty_p:n {V}
-\cs_generate_variant:Nn \tl_if_empty:nTF {V}
-\cs_generate_variant:Nn \tl_if_empty:nT {V}
-\cs_generate_variant:Nn \tl_if_empty:nF {V}
-\cs_generate_variant:Nn \tl_if_empty_p:n {o}
-\cs_generate_variant:Nn \tl_if_empty:nTF {o}
-\cs_generate_variant:Nn \tl_if_empty:nT {o}
-\cs_generate_variant:Nn \tl_if_empty:nF {o}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_if_blank_p:n,\tl_if_blank_p:V,\tl_if_blank_p:o}
-% \begin{macro}[TF]{\tl_if_blank:n,\tl_if_blank:V,\tl_if_blank:o}
-% \begin{macro}[aux]{\tl_if_blank_p_aux:w}
-% This is based on the answers in ``Around the Bend No~2'' but is
-% safer as the tests listed there all have one small flaw: If the
-% input in the test is two tokens with the same meaning as the
-% internal delimiter, they will fail since one of them is mistaken
-% for the actual delimiter. In our version below we make sure to
-% pass the input through |\tl_to_str:n| which ensures that all
-% the tokens are converted to catcode 12. However we use an |a| with
-% catcode 11 as delimiter so we can \emph{never} get into the same
-% problem as the solutions in ``Around the Bend No~2''.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \tl_if_blank:n #1 {p,TF,T,F} {
- \exp_after:wN \tl_if_blank_p_aux:w \tl_to_str:n {#1} aa..\q_stop
-}
-\cs_new:Npn \tl_if_blank_p_aux:w #1#2 a #3#4 \q_stop {
- \if_meaning:w #3 #4 \prg_return_true: \else: \prg_return_false: \fi:
-}
-\cs_generate_variant:Nn \tl_if_blank_p:n {V}
-\cs_generate_variant:Nn \tl_if_blank:nTF {V}
-\cs_generate_variant:Nn \tl_if_blank:nT {V}
-\cs_generate_variant:Nn \tl_if_blank:nF {V}
-\cs_generate_variant:Nn \tl_if_blank_p:n {o}
-\cs_generate_variant:Nn \tl_if_blank:nTF {o}
-\cs_generate_variant:Nn \tl_if_blank:nT {o}
-\cs_generate_variant:Nn \tl_if_blank:nF {o}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}[TF]{\tl_if_single:n}
-% \begin{macro}{\tl_if_single_p:n}
-% If the argument is a single token. `Space' is considered `true'.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \tl_if_single:n {p,TF,T,F} {
- \tl_if_empty:nTF {#1}
- {\prg_return_false:}
- {
- \tl_if_blank:nTF {#1}
- {\prg_return_true:}
- {
- \_tl_if_single_aux:w #1 \q_stop
- }
- }
-}
-% \end{macrocode}
-% Use "\exp_after:wN" below I know what I'm doing.
-% Use "\exp_args:NV" or "\exp_args_unbraced:NV"
-% for more flexibility in your own code.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \tl_if_single:N {p,TF,T,F} {
- \tl_if_empty:NTF #1
- { \prg_return_false: }
- {
- \tl_if_blank:oTF {#1}
- { \prg_return_true: }
- { \exp_after:wN \_tl_if_single_aux:w #1 \q_stop }
- }
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new:Npn \_tl_if_single_aux:w #1#2 \q_stop {
- \tl_if_empty:nTF {#2} \prg_return_true: \prg_return_false:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Working with the contents of token lists}
-%
-%
-% \begin{macro}{\tl_to_lowercase:n}
-% \begin{macro}{\tl_to_uppercase:n}
-% Just some names for a few primitives.
-% \begin{macrocode}
-\cs_new_eq:NN \tl_to_lowercase:n \tex_lowercase:D
-\cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_to_str:n}
-% Another name for a primitive.
-% \begin{macrocode}
-\cs_new_eq:NN \tl_to_str:n \etex_detokenize:D
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tl_to_str:N}
-% \begin{macro}{\tl_to_str:c}
-% \begin{macro}[aux]{\tl_to_str_aux:w}
-% These functions return the replacement text of a token list as a
-% string list with all characters catcoded to `other'.
-% \begin{macrocode}
-\cs_new_nopar:Npn \tl_to_str:N {\exp_after:wN\tl_to_str_aux:w
- \token_to_meaning:N}
-\cs_new_nopar:Npn \tl_to_str_aux:w #1>{}
-\cs_generate_variant:Nn \tl_to_str:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_map_function:nN}
-% \begin{macro}{\tl_map_function:NN}
-% \begin{macro}{\tl_map_function:cN}
-% \begin{macro}[aux]{\tl_map_function_aux: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.
-% \begin{macrocode}
-\cs_new:Npn \tl_map_function:nN #1#2{
- \tl_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop
-}
-\cs_new_nopar:Npn \tl_map_function:NN #1#2{
- \exp_after:wN \tl_map_function_aux:Nn
- \exp_after:wN #2 #1 \q_recursion_tail \q_recursion_stop
-}
-\cs_new:Npn \tl_map_function_aux:Nn #1#2{
- \quark_if_recursion_tail_stop:n{#2}
- #1{#2} \tl_map_function_aux:Nn #1
-}
-\cs_generate_variant:Nn \tl_map_function:NN {cN}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\tl_map_inline:nn}
-% \begin{macro}{\tl_map_inline:Nn}
-% \begin{macro}{\tl_map_inline:cn}
-% \begin{macro}[aux]{\tl_map_inline_aux:n}
-% \begin{macro}{\g_tl_inline_level_int}
-% The inline functions are straight forward by now. We use a little
-% trick with the counter |\g_tl_inline_level_int| to make
-% them nestable. We can
-% also make use of |\tl_map_function:Nn| from before.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_map_inline:nn #1#2{
- \int_gincr:N \g_tl_inline_level_int
- \cs_gset:cpn {tl_map_inline_ \int_use:N \g_tl_inline_level_int :n}
- ##1{#2}
- \exp_args:Nc \tl_map_function_aux:Nn
- {tl_map_inline_ \int_use:N \g_tl_inline_level_int :n}
- #1 \q_recursion_tail\q_recursion_stop
- \int_gdecr:N \g_tl_inline_level_int
-}
-\cs_new_protected:Npn \tl_map_inline:Nn #1#2{
- \int_gincr:N \g_tl_inline_level_int
- \cs_gset:cpn {tl_map_inline_ \int_use:N \g_tl_inline_level_int :n}
- ##1{#2}
- \exp_last_unbraced:NcV \tl_map_function_aux:Nn
- {tl_map_inline_ \int_use:N \g_tl_inline_level_int :n}
- #1 \q_recursion_tail\q_recursion_stop
- \int_gdecr:N \g_tl_inline_level_int
-}
-\cs_generate_variant:Nn \tl_map_inline:Nn {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\tl_map_variable:nNn}
-% \begin{macro}{\tl_map_variable:NNn}
-% \begin{macro}{\tl_map_variable:cNn}
-% |\tl_map_variable:nNn| \meta{\tlist} \meta{temp} \meta{action} assigns
-% \meta{temp} to each element and executes \meta{action}.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_map_variable:nNn #1#2#3{
- \tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop
-}
-% \end{macrocode}
-% Next really has to be v/V args
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_map_variable:NNn {\exp_args:No \tl_map_variable:nNn}
-\cs_generate_variant:Nn \tl_map_variable:NNn {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\tl_map_variable_aux:NnN}
-% The general loop. Assign the temp variable |#1| to the current item
-% |#3| and then check if that's the stop marker. If it is, break the
-% loop. If not, execute the action |#2| and continue.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3{
- \tl_set:Nn #1{#3}
- \quark_if_recursion_tail_stop:N #1
- #2 \tl_map_variable_aux:Nnn #1{#2}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tl_map_break:}
-% The break statement.
-% \begin{macrocode}
-\cs_new_eq:NN \tl_map_break: \use_none_delimit_by_q_recursion_stop:w
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tl_reverse:n}
-% \begin{macro}{\tl_reverse:V}
-% \begin{macro}{\tl_reverse:o}
-% \begin{macro}[aux]{\tl_reverse_aux:nN}
-% Reversal of a token list is done by taking one token at a time
-% and putting it in front of the ones before it.
-% \begin{macrocode}
-\cs_new:Npn \tl_reverse:n #1{
- \tl_reverse_aux:nN {} #1 \q_recursion_tail\q_recursion_stop
-}
-\cs_new:Npn \tl_reverse_aux:nN #1#2{
- \quark_if_recursion_tail_stop_do:nn {#2}{ #1 }
- \tl_reverse_aux:nN {#2#1}
-}
-\cs_generate_variant:Nn \tl_reverse:n {V,o}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_reverse:N}
-% This reverses the list, leaving "\exp_stop_f:" in front, which in turn
-% is removed by the "f" expansion which comes to a halt.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_reverse:N #1 {
- \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tl_elt_count:n}
-% \begin{macro}{\tl_elt_count:V}
-% \begin{macro}{\tl_elt_count:o}
-% \begin{macro}{\tl_elt_count:N}
-% Count number of elements within a token list or token list
-% variable. Brace groups within the list are read as a single
-% element.
-% \cs{tl_elt_count_aux:n} grabs the element and replaces it by "+1".
-% The "0" to ensure it works on an empty list.
-% \begin{macrocode}
-\cs_new:Npn \tl_elt_count:n #1{
- \int_eval:n {
- 0 \tl_map_function:nN {#1} \tl_elt_count_aux:n
- }
-}
-\cs_generate_variant:Nn \tl_elt_count:n {V,o}
-\cs_new_nopar:Npn \tl_elt_count:N #1{
- \int_eval:n {
- 0 \tl_map_function:NN #1 \tl_elt_count_aux:n
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}[aux]{\tl_num_elt_count_aux:n}
-% Helper function for counting elements in a token list.
-% \begin{macrocode}
-\cs_new:Npn \tl_elt_count_aux:n #1 { + 1 }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tl_set_rescan:Nnn, \tl_gset_rescan:Nnn}
-% \begin{macro}{\tl_set_rescan:Nno, \tl_gset_rescan:Nno}
-% These functions store the \marg{\tlist} in \meta{\tlvar} after
-% redefining catcodes, etc., in argument "#2".
-% \begin{arguments}
-% \item \meta{\tlvar}
-% \item \marg{catcode setup, etc.}
-% \item \marg{\tlist}
-% \end{arguments}
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_set:Nn }
-\cs_new_protected:Npn \tl_gset_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_gset:Nn }
-\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno }
-\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno }
-% \end{macrocode}
-%
-% \begin{macro}[aux]{\tl_set_rescan_aux:NNnn}
-% This macro uses a trick to extract an unexpanded token list after it's
-% rescanned with "\etex_scantokens:D". This technique was first used (as far as I
-% know) by Heiko Oberdiek in his \pkg{catchfile} package, albeit for real
-% files rather than the `fake' "\scantokens" one.
-%
-% The basic problem arises because "\etex_scantokens:D" emulates a file read, which
-% inserts an EOF marker into the expansion; the simplistic\\
-% "\exp_args:NNo \cs_set:Npn \tmp:w { \etex_scantokens:D {some text} }"\\
-% unfortunately doesn't work, calling the error:\\
-% "! File ended while scanning definition of \tmp:w."\\
-% (Lua\TeX\ works around this
-% problem with its "\scantextokens" primitive.)
-%
-% Usually, we'd define "\etex_everyeof:D" to be "\exp_not:N" to gobble the EOF
-% marker, but since we're not expanding the token list, it gets left in there
-% and we have the same basic problem.
-%
-% Instead, we define "\etex_everyeof:D" to contain a marker that's impossible
-% to occur within the scanned text; that is, the same char twice with
-% different catcodes. (For some reason, we \emph{don't} need to insert
-% a "\exp_not:N" token after it to prevent the EOF marker to expand. Anyone
-% know why?)
-%
-% A helper function is can be used to save the token list delimited by the
-% special marker, keeping the catcode redefinitions hidden away in a group.
-%
-% \begin{macro}[aux]{\c_two_ats_with_two_catcodes_tl}
-% A tl with two "@" characters with two different catcodes.
-% Used as a special marker for delimited text.
-% \begin{macrocode}
-\group_begin:
- \tex_lccode:D `\A = `\@ \scan_stop:
- \tex_lccode:D `\B = `\@ \scan_stop:
- \tex_catcode:D `\A = 8 \scan_stop:
- \tex_catcode:D `\B = 3 \scan_stop:
-\tl_to_lowercase:n {
- \group_end:
- \tl_const:Nn \c_two_ats_with_two_catcodes_tl { A B }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{arguments}
-% \item "\tl_set" function
-% \item \meta{\tlvar}
-% \item \marg{catcode setup, etc.}
-% \item \marg{\tlist}
-% \end{arguments}
-% Note that if you change "\etex_everyeof:D" in "#3"
-% then you'd better do it correctly!
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 {
- \group_begin:
- \toks_set:NV \etex_everyeof:D \c_two_ats_with_two_catcodes_tl
- \tex_endlinechar:D = \c_minus_one
- #3
- \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#4}
- \exp_args:NNNV
- \group_end:
- #1 #2 \l_tmpa_tl
-}
-% \end{macrocode}
-%
-% \begin{macro}[aux]{\tl_rescan_aux:w}
-% \begin{macrocode}
-\exp_after:wN \cs_set:Npn
-\exp_after:wN \tl_rescan_aux:w
-\exp_after:wN #
-\exp_after:wN 1 \c_two_ats_with_two_catcodes_tl {
- \tl_set:Nn \l_tmpa_tl {#1}
-}
-% \end{macrocode}
-%
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tl_set_rescan:Nnx,\tl_gset_rescan:Nnx}
-% These functions store the full expansion of \marg{\tlist} in
-% \meta{\tlvar} after redefining catcodes, etc., in argument "#2".
-% \begin{arguments}
-% \item \meta{\tlvar}
-% \item \marg{catcode setup, etc.}
-% \item \marg{\tlist}
-% \end{arguments}
-% The expanded versions are much simpler because the "\etex_scantokens:D"
-% can occur within the expansion.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_set_rescan:Nnx #1#2#3 {
- \group_begin:
- \etex_everyeof:D { \exp_not:N }
- \tex_endlinechar:D = \c_minus_one
- #2
- \tl_set:Nx \l_kernel_tmpa_tl { \etex_scantokens:D {#3} }
- \exp_args:NNNV
- \group_end:
- \tl_set:Nn #1 \l_kernel_tmpa_tl
-}
-% \end{macrocode}
-% Globally is easier again:
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_gset_rescan:Nnx #1#2#3 {
- \group_begin:
- \etex_everyeof:D { \exp_not:N }
- \tex_endlinechar:D = \c_minus_one
- #2
- \tl_gset:Nx #1 { \etex_scantokens:D {#3} }
- \group_end:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tl_rescan:nn}
-% The inline wrapper for "\etex_scantokens:D".
-% \begin{arguments}
-% \item Catcode changes (etc.)
-% \item Token list to re-tokenise
-% \end{arguments}
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_rescan:nn #1#2 {
- \group_begin:
- \toks_set:NV \etex_everyeof:D \c_two_ats_with_two_catcodes_tl
- \tex_endlinechar:D = \c_minus_one
- #1
- \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#2}
- \exp_args:NV \group_end:
- \l_tmpa_tl
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Checking for and replacing tokens}
-%
-% \begin{macro}[TF]{\tl_if_in:Nn,\tl_if_in:cn}
-% See the replace functions for further comments. In this part we
-% don't care too much about brace stripping since we are not
-% interested in passing on the tokens which are split off in the
-% process.
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \tl_if_in:Nn #1#2 {TF,T,F} {
- \cs_set:Npn \tl_tmp:w ##1 #2 ##2 \q_stop {
- \quark_if_no_value:nTF {##2} {\prg_return_false:} {\prg_return_true:}
- }
- \exp_after:wN \tl_tmp:w #1 #2 \q_no_value \q_stop
-}
-\cs_generate_variant:Nn \tl_if_in:NnTF {c}
-\cs_generate_variant:Nn \tl_if_in:NnT {c}
-\cs_generate_variant:Nn \tl_if_in:NnF {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\tl_if_in:nn,\tl_if_in:Vn,\tl_if_in:on}
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \tl_if_in:nn #1#2 {TF,T,F} {
- \cs_set:Npn \tl_tmp:w ##1 #2 ##2 \q_stop {
- \quark_if_no_value:nTF {##2} {\prg_return_false:} {\prg_return_true:}
- }
- \tl_tmp:w #1 #2 \q_no_value \q_stop
-}
-\cs_generate_variant:Nn \tl_if_in:nnTF {V}
-\cs_generate_variant:Nn \tl_if_in:nnT {V}
-\cs_generate_variant:Nn \tl_if_in:nnF {V}
-\cs_generate_variant:Nn \tl_if_in:nnTF {o}
-\cs_generate_variant:Nn \tl_if_in:nnT {o}
-\cs_generate_variant:Nn \tl_if_in:nnF {o}
-% \end{macrocode}
-% \end{macro}
-%
-%\begin{macro}{\_l_tl_replace_tl}
-%\begin{macro}{\tl_replace_in:Nnn}
-%\begin{macro}{\tl_replace_in:cnn}
-%\begin{macro}{\tl_greplace_in:Nnn}
-%\begin{macro}{\tl_greplace_in:cnn}
-%\begin{macro}[aux]{\_tl_replace_in_aux:NNnn}
-% The concept here is that only the first occurrence should be
-% replaced. The first step is to define an auxiliary which will
-% match the appropriate item, with a trailing marker. If the last token
-% is the marker there is nothing to do, otherwise replace the token
-% and clean up (hence the second use of \cs{_tl_tmp:w}). To prevent
-% loosing braces or spaces there are a couple of empty groups and
-% the strange-looking \cs{use:n}.
-% \begin{macrocode}
-\tl_new:N \_l_tl_replace_tl
-\cs_new_protected_nopar:Npn \tl_replace_in:Nnn {
- \_tl_replace_in_aux:NNnn \tl_set_eq:NN
-}
-\cs_new_protected:Npn \_tl_replace_in_aux:NNnn #1#2#3#4 {
- \cs_set_protected:Npn \_tl_tmp:w ##1 #3 ##2 \q_stop
- {
- \quark_if_no_value:nF {##2}
- {
- \tl_set:No \_l_tl_replace_tl { ##1 #4 }
- \cs_set_protected:Npn \_tl_tmp:w ####1 \q_nil #3 \q_no_value
- { \tl_put_right:No \_l_tl_replace_tl {####1} }
- \_tl_tmp:w \prg_do_nothing: ##2
- #1 #2 \_l_tl_replace_tl
- }
- }
- \use:n
- {
- \exp_after:wN \_tl_tmp:w \exp_after:wN
- \prg_do_nothing:
- }
- #2 \q_nil #3 \q_no_value \q_stop
-}
-\cs_new_protected_nopar:Npn \tl_greplace_in:Nnn {
- \_tl_replace_in_aux:NNnn \tl_gset_eq:NN
-}
-\cs_generate_variant:Nn \tl_replace_in:Nnn { c }
-\cs_generate_variant:Nn \tl_greplace_in:Nnn { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\tl_replace_all_in:Nnn}
-%\begin{macro}{\tl_replace_all_in:Nnn}
-%\begin{macro}{\tl_greplace_all_in:cnn}
-%\begin{macro}{\tl_greplace_all_in:cnn}
-%\begin{macro}[aux]{\_tl_replace_all_in_aux:NNnn}
-% A similar approach here but with a loop built in.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_replace_all_in:Nnn {
- \_tl_replace_all_in_aux:NNnn \tl_set_eq:NN
-}
-\cs_new_protected_nopar:Npn \tl_greplace_all_in:Nnn {
- \_tl_replace_all_in_aux:NNnn \tl_gset_eq:NN
-}
-\cs_new_protected:Npn \_tl_replace_all_in_aux:NNnn #1#2#3#4 {
- \tl_clear:N \_l_tl_replace_tl
- \cs_set_protected:Npn \_tl_tmp:w ##1 #3 ##2 \q_stop
- {
- \quark_if_no_value:nTF {##2}
- {
- \cs_set_protected:Npn \_tl_tmp:w ####1 \q_nil ####2 \q_stop
- { \tl_put_right:No \_l_tl_replace_tl {####1} }
- \_tl_tmp:w ##1 \q_stop
- }
- {
- \tl_put_right:No \_l_tl_replace_tl { ##1 #4 }
- \_tl_tmp:w \prg_do_nothing: ##2 \q_stop
- }
- }
- \use:n
- {
- \exp_after:wN \_tl_tmp:w \exp_after:wN
- \prg_do_nothing:
- }
- #2 \q_nil #3 \q_no_value \q_stop
- #1 #2 \_l_tl_replace_tl
-}
-\cs_generate_variant:Nn \tl_replace_all_in:Nnn { c }
-\cs_generate_variant:Nn \tl_greplace_all_in:Nnn { c }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%
-%
-% \begin{macro}{\tl_remove_in:Nn}
-% \begin{macro}{\tl_remove_in:cn}
-% \begin{macro}{\tl_gremove_in:Nn}
-% \begin{macro}{\tl_gremove_in:cn}
-% Next comes a series of removal functions. I have just implemented
-% them as subcases of the replace functions for now (I'm lazy).
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_remove_in:Nn #1#2{\tl_replace_in:Nnn #1{#2}{}}
-\cs_new_protected:Npn \tl_gremove_in:Nn #1#2{\tl_greplace_in:Nnn #1{#2}{}}
-\cs_generate_variant:Nn \tl_remove_in:Nn {cn}
-\cs_generate_variant:Nn \tl_gremove_in:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\tl_remove_all_in:Nn}
-% \begin{macro}{\tl_remove_all_in:cn}
-% \begin{macro}{\tl_gremove_all_in:Nn}
-% \begin{macro}{\tl_gremove_all_in:cn}
-% Same old, same old.
-% \begin{macrocode}
-\cs_new_protected:Npn \tl_remove_all_in:Nn #1#2{
- \tl_replace_all_in:Nnn #1{#2}{}
-}
-\cs_new_protected:Npn \tl_gremove_all_in:Nn #1#2{
- \tl_greplace_all_in:Nnn #1{#2}{}
-}
-\cs_generate_variant:Nn \tl_remove_all_in:Nn {cn}
-\cs_generate_variant:Nn \tl_gremove_all_in:Nn {cn}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Heads or tails?}
-%
-% \begin{macro}{\tl_head:n}
-% \begin{macro}{\tl_head:V}
-% \begin{macro}{\tl_head:v}
-% \begin{macro}{\tl_head_i:n}
-% \begin{macro}{\tl_tail:n}
-% \begin{macro}{\tl_tail:V}
-% \begin{macro}{\tl_tail:v}
-% \begin{macro}{\tl_tail:f}
-% \begin{macro}{\tl_head_iii:n}
-% \begin{macro}{\tl_head_iii:f}
-% \begin{macro}{\tl_head:w}
-% \begin{macro}{\tl_head_i:w}
-% \begin{macro}{\tl_tail:w}
-% \begin{macro}{\tl_head_iii:w}
-% These functions pick up either the head or the tail of a list.
-% "\tl_head_iii:n" returns the first three items on a list.
-% \begin{macrocode}
-\cs_new:Npn \tl_head:n #1{\tl_head:w #1\q_stop}
-\cs_new_eq:NN \tl_head_i:n \tl_head:n
-\cs_new:Npn \tl_tail:n #1{\tl_tail:w #1\q_stop}
-\cs_generate_variant:Nn \tl_tail:n {f}
-\cs_new:Npn \tl_head_iii:n #1{\tl_head_iii:w #1\q_stop}
-\cs_generate_variant:Nn \tl_head_iii:n {f}
-\cs_new:Npn \tl_head:w #1#2\q_stop{#1}
-\cs_new_eq:NN \tl_head_i:w \tl_head:w
-\cs_new:Npn \tl_tail:w #1#2\q_stop{#2}
-\cs_new:Npn \tl_head_iii:w #1#2#3#4\q_stop{#1#2#3}
-\cs_generate_variant:Nn \tl_head:n { V }
-\cs_generate_variant:Nn \tl_head:n { v }
-\cs_generate_variant:Nn \tl_tail:n { V }
-\cs_generate_variant:Nn \tl_tail:n { v }
-% \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}{\tl_if_head_eq_meaning_p:nN}
-% \begin{macro}[TF]{\tl_if_head_eq_meaning:nN}
-% \begin{macro}{\tl_if_head_eq_charcode_p:nN}
-% \begin{macro}{\tl_if_head_eq_charcode_p:fN}
-% \begin{macro}[TF]{\tl_if_head_eq_charcode:nN}
-% \begin{macro}[TF]{\tl_if_head_eq_charcode:fN}
-% \begin{macro}{\tl_if_head_eq_catcode_p:nN}
-% \begin{macro}[TF]{\tl_if_head_eq_catcode:nN}
-% When we want to check if the first token of a list equals something
-% specific it is usually either to see if it is a control sequence or
-% a character. Hence we make two different functions as the internal
-% test is different.
-% |\tl_if_head_meaning_eq:nNTF| uses |\if_meaning:w| and will
-% consider the tokens |b|$\sb{11}$ and |b|$\sb{12}$ different.
-% |\tl_if_head_char_eq:nNTF| on the other hand only compares
-% character codes so would regard |b|$\sb{11}$ and |b|$\sb{12}$ as
-% equal but would also regard two primitives as equal.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 {p,TF,T,F} {
- \exp_after:wN \if_meaning:w \tl_head:w #1 \q_stop #2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% For the charcode and catcode versions we insert |\exp_not:N| in
-% front of both tokens. If you need them to expand fully as \TeX{}
-% does itself with these you can use an |f| type expansion.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 {p,TF,T,F} {
- \exp_after:wN \if:w \exp_after:wN \exp_not:N
- \tl_head:w #1 \q_stop \exp_not:N #2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% Actually the default is already an |f| type expansion.
-% \begin{macrocode}
-%% \cs_new:Npn \tl_if_head_eq_charcode_p:fN #1#2{
-%% \exp_after:wN\if_charcode:w \tl_head:w #1\q_stop\exp_not:N#2
-%% \c_true_bool
-%% \else:
-%% \c_false_bool
-%% \fi:
-%% }
-%% \def_long_test_function_new:npn {tl_if_head_eq_charcode:fN}#1#2{
-%% \if_predicate:w \tl_if_head_eq_charcode_p:fN {#1}#2}
-% \end{macrocode}
-% These ":fN" variants are broken; temporary patch:
-% \begin{macrocode}
-\cs_generate_variant:Nn \tl_if_head_eq_charcode_p:nN {f}
-\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF {f}
-\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNT {f}
-\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNF {f}
-% \end{macrocode}
-% And now catcodes:
-% \begin{macrocode}
-\prg_new_conditional:Npnn \tl_if_head_eq_catcode:nN #1#2 {p,TF,T,F} {
- \exp_after:wN \if_catcode:w \exp_after:wN \exp_not:N
- \tl_head:w #1 \q_stop \exp_not:N #2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3token.dtx b/Master/texmf-dist/source/latex/expl3/l3token.dtx
deleted file mode 100644
index b214b84b771..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3token.dtx
+++ /dev/null
@@ -1,1884 +0,0 @@
-% \iffalse
-%% File: l3token.dtx Copyright (C) 2005-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3token.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental token investigation and manipulation}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{The \textsf{l3token} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% A token of my appreciation\dots}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% This module deals with tokens. Now this is perhaps not the most
-% precise description so let's try with a better description: When
-% programming in \TeX, it is often desirable to know just what a
-% certain token is: is it a control sequence or something
-% else. Similarly one often needs to know if a control sequence is
-% expandable or not, a macro or a primitive, how many arguments it
-% takes etc. Another thing of great importance (especially when it
-% 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
-% categories: |\token| for anything that deals with tokens and
-% |\peek| for looking ahead in the token stream.
-%
-% Most of the time we will be using the term `token' but most of the
-% time the function we're describing can equally well by used on a
-% control sequence as such one is one token as well.
-%
-% We shall refer to list of tokens as |tlist|s and such lists
-% represented by a single control sequence is a `token list variable'
-% |tl var|. Functions for these two types are found in the \textsf{l3tl}
-% module.
-%
-% \section{Character tokens}
-%
-% \begin{function}{
-% \char_set_catcode:nn |
-% \char_set_catcode:w |
-% \char_value_catcode:n |
-% \char_value_catcode:w |
-% \char_show_value_catcode:n |
-% \char_show_value_catcode:w
-% }
-% \begin{syntax}
-% "\char_set_catcode:nn" \Arg{char number} \Arg{number}\\
-% "\char_set_catcode:w" <char> = <number> \\
-% "\char_value_catcode:n" \Arg{char number} \\
-% "\char_show_value_catcode:n" \Arg{char number}
-% \end{syntax}
-% "\char_set_catcode:nn" sets the category code of a character,
-% "\char_value_catcode:n" returns its value for use in integer tests
-% and "\char_show_value_catcode:n" pausing the typesetting and prints
-% the value on the terminal and in the log file.
-% The ":w" form should be avoided.
-% (Will: should we then just not mention it?)
-%
-% "\char_set_catcode" is more usefully abstracted below.
-% \begin{texnote}
-% "\char_set_catcode:w" is the \TeX\ primitive \tn{catcode} renamed.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{
-% \char_make_escape:n |
-% \char_make_begin_group:n |
-% \char_make_end_group:n |
-% \char_make_math_shift:n |
-% \char_make_alignment:n |
-% \char_make_end_line:n |
-% \char_make_parameter:n |
-% \char_make_math_superscript:n |
-% \char_make_math_subscript:n |
-% \char_make_ignore:n |
-% \char_make_space:n |
-% \char_make_letter:n |
-% \char_make_other:n |
-% \char_make_active:n |
-% \char_make_comment:n |
-% \char_make_invalid:n }
-% \begin{syntax}
-% "\char_make_letter:n" \Arg{character number}
-% "\char_make_letter:n {64}"
-% "\char_make_letter:n {`\@}"
-% \end{syntax}
-% Sets the catcode of the character referred to by its <character number>.
-% \end{function}
-%
-% \begin{function}{
-% \char_make_escape:N |
-% \char_make_begin_group:N |
-% \char_make_end_group:N |
-% \char_make_math_shift:N |
-% \char_make_alignment:N |
-% \char_make_end_line:N |
-% \char_make_parameter:N |
-% \char_make_math_superscript:N |
-% \char_make_math_subscript:N |
-% \char_make_ignore:N |
-% \char_make_space:N |
-% \char_make_letter:N |
-% \char_make_other:N |
-% \char_make_active:N |
-% \char_make_comment:N |
-% \char_make_invalid:N }
-% \begin{syntax}
-% "\char_make_letter:N" \Arg{character}
-% "\char_make_letter:N" "@"
-% "\char_make_letter:N" "\%"
-% \end{syntax}
-% Sets the catcode of the <character>, which may have to be escaped.
-% \begin{texnote}
-% "\char_make_other:N" is \LaTeXe's "\@makeother".
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{
-% \char_set_lccode:nn |
-% \char_set_lccode:w |
-% \char_value_lccode:n |
-% \char_value_lccode:w |
-% \char_show_value_lccode:n |
-% \char_show_value_lccode:w
-% }
-% \begin{syntax}
-% "\char_set_lccode:nn" \Arg{char} \Arg{number} \\
-% "\char_set_lccode:w" <char> = <number> \\
-% "\char_value_lccode:n" \Arg{char}\\
-% "\char_show_value_lccode:n" \Arg{char}
-% \end{syntax}
-% Set the lower caser representation of <char> for when <char> is
-% being converted in "\tl_to_lowercase:n". As above, the
-% ":w" form is only for people who really, really know what they are
-% doing.
-% \begin{texnote}
-% "\char_set_lccode:w" is the \TeX\ primitive \tn{lccode} renamed.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{
-% \char_set_uccode:nn |
-% \char_set_uccode:w |
-% \char_value_uccode:n |
-% \char_value_uccode:w |
-% \char_show_value_uccode:n |
-% \char_show_value_uccode:w
-% }
-% \begin{syntax}
-% "\char_set_uccode:nn" \Arg{char} \Arg{number}\\
-% "\char_set_uccode:w" <char> = <number> \\
-% "\char_value_uccode:n" \Arg{char}\\
-% "\char_show_value_uccode:n" \Arg{char}
-% \end{syntax}
-% Set the uppercase representation of <char> for when <char> is being
-% converted in "\tl_to_uppercase:n". As above, the ":w"
-% form is only for people who really, really know what they are
-% doing.
-% \begin{texnote}
-% "\char_set_uccode:w" is the \TeX\ primitive \tn{uccode} renamed.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{
-% \char_set_sfcode:nn |
-% \char_set_sfcode:w |
-% \char_value_sfcode:n |
-% \char_value_sfcode:w |
-% \char_show_value_sfcode:n |
-% \char_show_value_sfcode:w
-% }
-% \begin{syntax}
-% "\char_set_sfcode:nn" \Arg{char} \Arg{number}\\
-% "\char_set_sfcode:w" <char> = <number> \\
-% "\char_value_sfcode:n" \Arg{char}\\
-% "\char_show_value_sfcode:n" \Arg{char}
-% \end{syntax}
-% Set the space factor for <char>.
-% \begin{texnote}
-% "\char_set_sfcode:w" is the \TeX\ primitive \tn{sfcode} renamed.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{
-% \char_set_mathcode:nn |
-% \char_set_mathcode:w |
-% \char_gset_mathcode:nn |
-% \char_gset_mathcode:w |
-% \char_value_mathcode:n |
-% \char_value_mathcode:w |
-% \char_show_value_mathcode:n |
-% \char_show_value_mathcode:w
-% }
-% \begin{syntax}
-% "\char_set_mathcode:nn" \Arg{char} \Arg{number}\\
-% "\char_set_mathcode:w" <char> = <number> \\
-% "\char_value_mathcode:n" \Arg{char}\\
-% "\char_show_value_mathcode:n" \Arg{char}
-% \end{syntax}
-% Set the math code for <char>.
-% \begin{texnote}
-% "\char_set_mathcode:w" is the \TeX\ primitive \tn{mathcode} renamed.
-% \end{texnote}
-% \end{function}
-%
-%
-% \section{Generic tokens}
-%
-% \begin{function}{%
-% \token_new:Nn |
-% }
-% \begin{syntax}
-% "\token_new:Nn" <token 1> \Arg{token 2}
-% \end{syntax}
-% Defines <token 1> to globally be a snapshot of <token 2>. This will
-% be an implicit representation of <token 2>.
-% \end{function}
-%
-% \begin{variable}{%
-% \c_group_begin_token |
-% \c_group_end_token |
-% \c_math_shift_token |
-% \c_alignment_tab_token |
-% \c_parameter_token |
-% \c_math_superscript_token |
-% \c_math_subscript_token |
-% \c_space_token |
-% \c_letter_token |
-% \c_other_char_token |
-% \c_active_char_token |
-% }
-% \begin{syntax}
-% \end{syntax}
-% Some useful constants. They have category codes~1, 2, 3, 4, 6, 7,
-% 8, 10, 11, 12, and 13 respectively. They are all implicit tokens.
-% \end{variable}
-%
-% \begin{function}{
-% \token_if_group_begin_p:N / (EXP) |
-% \token_if_group_begin:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_group_begin:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a begin group token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_group_end_p:N / (EXP) |
-% \token_if_group_end:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_group_end:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is an end group token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_math_shift_p:N / (EXP) |
-% \token_if_math_shift:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_math_shift:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a math shift token.
-% \end{function}
-%
-%
-% \begin{function}{
-% \token_if_alignment_tab_p:N / (EXP) |
-% \token_if_alignment_tab:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_aligment_tab:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is an aligment tab token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_parameter_p:N / (EXP) |
-% \token_if_parameter:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_parameter:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a parameter token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_math_superscript_p:N / (EXP) |
-% \token_if_math_superscript:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_math_superscript:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a math superscript token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_math_subscript_p:N / (EXP) |
-% \token_if_math_subscript:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_math_subscript:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a math subscript token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_space_p:N / (EXP) |
-% \token_if_space:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_space:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a space token.
-% \end{function}
-%
-%
-% \begin{function}{
-% \token_if_letter_p:N / (EXP) |
-% \token_if_letter:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_letter:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a letter token.
-% \end{function}
-%
-%
-% \begin{function}{
-% \token_if_other_char_p:N / (EXP) |
-% \token_if_other_char:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_other_char:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is an other char token.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_active_char_p:N / (EXP) |
-% \token_if_active_char:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_active_char:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is an active char token.
-% \end{function}
-%
-% \begin{function}{%
-% \token_if_eq_meaning_p:NN / (EXP) |
-% \token_if_eq_meaning:NN / (TF) (EXP)
-% }
-% \begin{syntax}
-% "\token_if_eq_meaning:NNTF" <token1> <token2>\Arg{true} \Arg{false}
-% \end{syntax}
-% Check if the meaning of two tokens are identical.
-% \end{function}
-%
-% \begin{function}{%
-% \token_if_eq_catcode_p:NN / (EXP) |
-% \token_if_eq_catcode:NN / (TF) (EXP)
-% }
-% \begin{syntax}
-% "\token_if_eq_catcode:NNTF" <token1> <token2>\Arg{true} \Arg{false}
-% \end{syntax}
-% Check if the category codes of two tokens are equal. If both tokens
-% are control sequences the test will be true.
-% \end{function}
-%
-% \begin{function}{%
-% \token_if_eq_charcode_p:NN / (EXP) |
-% \token_if_eq_charcode:NN / (TF) (EXP)
-% }
-% \begin{syntax}
-% "\token_if_eq_catcode:NNTF" <token1> <token2>\Arg{true} \Arg{false}
-% \end{syntax}
-% Check if the character codes of two tokens are equal. If both tokens
-% are control sequences the test will be true.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_macro_p:N / (EXP) |
-% \token_if_macro:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_macro:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a macro.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_cs_p:N / (EXP) |
-% \token_if_cs:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_cs:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a control sequence or not. This can be useful
-% for situations where the next token in the input stream is being
-% looked at and you want to determine what should be done to it.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_expandable_p:N / (EXP) |
-% \token_if_expandable:N / (TF) (EXP)
-% }
-% \begin{syntax}
-% "\token_if_expandable:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is expandable or not. Note that <token> can very
-% well be an active character.
-% \end{function}
-%
-% The next set of functions here are for picking apart control
-% sequences. Sometimes it is useful to know if a control sequence has
-% arguments and if so, how many. Similarly its status with respect to
-% "\long" or "\protected" is good to have. Finally it can be very
-% useful to know if a control sequence is of a certain type: Is this
-% \m{toks} register we're trying to to something with really a
-% \m{toks} register at all?
-%
-% \begin{function}{
-% \token_if_long_macro_p:N / (EXP) |
-% \token_if_long_macro:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_long_macro:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a ``long'' macro.
-% \end{function}
-%
-%
-% \begin{function}{
-% \token_if_protected_macro_p:N / (EXP) |
-% \token_if_protected_macro:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_long_macro:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a ``protected'' macro. This test does \emph{not}
-% return <true> if the macro is also ``long'', see below.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_protected_long_macro_p:N / (EXP) |
-% \token_if_protected_long_macro:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_protected_long_macro:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a ``protected long'' macro.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_chardef_p:N / (EXP) |
-% \token_if_chardef:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_chardef:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is defined to be a chardef.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_mathchardef_p:N / (EXP) |
-% \token_if_mathchardef:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_mathchardef:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is defined to be a mathchardef.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_int_register_p:N / (EXP) |
-% \token_if_int_register:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_int_register:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is defined to be an integer register.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_dim_register_p:N / (EXP) |
-% \token_if_dim_register:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_dim_register:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is defined to be a dimension register.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_skip_register_p:N / (EXP) |
-% \token_if_skip_register:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_skip_register:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is defined to be a skip register.
-% \end{function}
-%
-% \begin{function}{
-% \token_if_toks_register_p:N / (EXP) |
-% \token_if_toks_register:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_toks_register:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is defined to be a toks register.
-% \end{function}
-%
-%
-% \begin{function}{
-% \token_get_prefix_spec:N / (EXP) |
-% \token_get_arg_spec:N / (EXP) |
-% \token_get_replacement_spec:N / (EXP)
-% }
-% \begin{syntax}
-% "\token_get_arg_spec:N" <token>
-% \end{syntax}
-% If token is a macro with definition |\cs_set:Npn||\next|
-% |#1#2{x`#1--#2'y}|, the |prefix| function will return the string
-% |\long|, the |arg| function returns the string |#1#2| and the
-% |replacement| function returns the string |x`#1--#2'y|. If <token>
-% isn't a macro, these functions return the |\scan_stop:| token.
-%
-% If the |arg_spec| contains the string |->|, then the |spec| function
-% will produce incorrect results.
-% \end{function}
-%
-% \subsection{Useless code: because we can!}
-%
-% \begin{function}{
-% \token_if_primitive_p:N / (EXP) |
-% \token_if_primitive:N / (TF) (EXP) |
-% }
-% \begin{syntax}
-% "\token_if_primitive:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Check if <token> is a primitive. Probably not a very useful function.
-% \end{function}
-%
-%
-% \section{Peeking ahead at the next token}
-%
-% \begin{variable}{%
-% \l_peek_token |
-% \g_peek_token |
-% \l_peek_search_token |
-% }
-% \begin{syntax}
-% \end{syntax}
-% Some useful variables. Initially they are set to "?".
-% \end{variable}
-%
-%
-% \begin{function}{%
-% \peek_after:NN |
-% \peek_gafter:NN |
-% }
-% \begin{syntax}
-% "\peek_after:NN" <function><token>
-% \end{syntax}
-% Assign <token> to "\l_peek_token" and then run <function> which
-% should perform some sort of test on this token. Leaves <token> in
-% the input stream. "\peek_gafter:NN" does this globally to the token
-% "\g_peek_token".
-% \begin{texnote}
-% This is the primitive \tn{futurelet} turned into a function.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \peek_meaning:N / (TF) |
-% \peek_meaning_ignore_spaces:N / (TF) |
-% \peek_meaning_remove:N / (TF) |
-% \peek_meaning_remove_ignore_spaces:N / (TF)
-% }
-% \begin{syntax}
-% "\peek_meaning:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% "\peek_meaning:NTF" checks (by using "\if_meaning:w") if <token>
-% equals the next token in the input stream and executes either <true
-% code> or <false code> accordingly. "\peek_meaning_remove:NTF" does
-% the same but additionally removes the token if found. The
-% "ignore_spaces" versions skips blank spaces before making the
-% decision.
-% \begin{texnote}
-% This is equivalent to \LaTeXe's \tn{@ifnextchar}.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{%
-% \peek_charcode:N / (TF) |
-% \peek_charcode_ignore_spaces:N / (TF) |
-% \peek_charcode_remove:N / (TF) |
-% \peek_charcode_remove_ignore_spaces:N / (TF)
-% }
-% \begin{syntax}
-% "\peek_charcode:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Same as for the "\peek_meaning:NTF" functions above but these use
-% "\if_charcode:w" to compare the tokens.
-% \end{function}
-%
-% \begin{function}{%
-% \peek_catcode:N / (TF) |
-% \peek_catcode_ignore_spaces:N / (TF) |
-% \peek_catcode_remove:N / (TF) |
-% \peek_catcode_remove_ignore_spaces:N / (TF)
-% }
-% \begin{syntax}
-% "\peek_catcode:NTF" <token> \Arg{true} \Arg{false}
-% \end{syntax}
-% Same as for the "\peek_meaning:NTF" functions above but these use
-% "\if_catcode:w" to compare the tokens.
-% \end{function}
-%
-%
-% \begin{function}{%
-% \peek_token_generic:NN / (TF) |
-% \peek_token_remove_generic:NN / (TF)
-% }
-% \begin{syntax}
-% "\peek_token_generic:NNTF" <token><function> \Arg{true} \Arg{false}
-% \end{syntax}
-% "\peek_token_generic:NNTF" looks ahead and checks if the next token
-% in the input stream is equal to <token>. It uses <function> to make
-% that decision. "\peek_token_remove_generic:NNTF" does the same
-% thing but additionally removes <token> from the input stream if it
-% is found. This also works if <token> is either
-% "\c_group_begin_token" or "\c_group_end_token".
-% \end{function}
-%
-% \begin{function}{%
-% \peek_execute_branches_meaning: |
-% \peek_execute_branches_charcode: |
-% \peek_execute_branches_catcode: |
-% }
-% \begin{syntax}
-% "\peek_execute_branches_meaning:"
-% \end{syntax}
-% These functions compare the token we are searching for with the
-% token found (after optional ignoring of specific tokens). They come
-% in the usual three versions when \TeX{} is comparing tokens:
-% meaning, character code, and category code.
-% \end{function}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3token} implementation}
-%
-% \subsection{Documentation of internal functions}
-%
-% \begin{variabledoc}{%
-% \l_peek_true_tl |
-% \l_peek_false_tl |
-% }
-% \begin{syntax}
-% \end{syntax}
-% These token list variables are used internally when choosing either
-% the true or false branches of a test.
-% \end{variabledoc}
-%
-% \begin{variabledoc}{ \l_peek_search_tl }
-% \begin{syntax}
-% \end{syntax}
-% Used to store "\l_peek_search_token".
-% \end{variabledoc}
-%
-% \begin{function}{%
-% \peek_tmp:w |
-% }
-% \begin{syntax}
-% \end{syntax}
-% Scratch function used to gobble tokens from the input stream.
-% \end{function}
-%
-% \begin{variabledoc}{%
-% \l_peek_true_aux_tl |
-% \c_peek_true_remove_next_tl |
-% }
-% \begin{syntax}
-% \end{syntax}
-% These token list variables are used internally when choosing either
-% the true or false branches of a test.
-% \end{variabledoc}
-%
-% \begin{function}{%
-% \peek_ignore_spaces_execute_branches: |
-% \peek_ignore_spaces_aux: |
-% }
-% \begin{syntax}
-% \end{syntax}
-% Functions used to ignore space tokens in the input stream.
-% \end{function}
-%
-% \subsection{Module code}
-%
-% First a few required packages to get this going.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \subsection{Character tokens}
-%
-% \begin{macro}{ \char_set_catcode:w ,
-% \char_set_catcode:nn ,
-% \char_value_catcode:w ,
-% \char_value_catcode:n ,
-% \char_show_value_catcode:w ,
-% \char_show_value_catcode:n }
-% \begin{macrocode}
-\cs_new_eq:NN \char_set_catcode:w \tex_catcode:D
-\cs_new_protected_nopar:Npn \char_set_catcode:nn #1#2 {
- \char_set_catcode:w #1 = \int_eval:w #2\int_eval_end:
-}
-\cs_new_nopar:Npn \char_value_catcode:w { \int_use:N \tex_catcode:D }
-\cs_new_nopar:Npn \char_value_catcode:n #1 {
- \char_value_catcode:w \int_eval:w #1\int_eval_end:
-}
-\cs_new_nopar:Npn \char_show_value_catcode:w {
- \tex_showthe:D \tex_catcode:D
-}
-\cs_new_nopar:Npn \char_show_value_catcode:n #1 {
- \char_show_value_catcode:w \int_eval:w #1\int_eval_end:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{ \char_make_escape:N , \char_make_begin_group:N ,
-% \char_make_end_group:N , \char_make_math_shift:N ,
-% \char_make_alignment:N , \char_make_end_line:N ,
-% \char_make_parameter:N , \char_make_math_superscript:N ,
-% \char_make_math_subscript:N , \char_make_ignore:N ,
-% \char_make_space:N , \char_make_letter:N ,
-% \char_make_other:N , \char_make_active:N ,
-% \char_make_comment:N , \char_make_invalid:N }
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \char_make_escape:N #1 { \char_set_catcode:nn {`#1} {\c_zero} }
-\cs_new_protected_nopar:Npn \char_make_begin_group:N #1 { \char_set_catcode:nn {`#1} {\c_one} }
-\cs_new_protected_nopar:Npn \char_make_end_group:N #1 { \char_set_catcode:nn {`#1} {\c_two} }
-\cs_new_protected_nopar:Npn \char_make_math_shift:N #1 { \char_set_catcode:nn {`#1} {\c_three} }
-\cs_new_protected_nopar:Npn \char_make_alignment:N #1 { \char_set_catcode:nn {`#1} {\c_four} }
-\cs_new_protected_nopar:Npn \char_make_end_line:N #1 { \char_set_catcode:nn {`#1} {\c_five} }
-\cs_new_protected_nopar:Npn \char_make_parameter:N #1 { \char_set_catcode:nn {`#1} {\c_six} }
-\cs_new_protected_nopar:Npn \char_make_math_superscript:N #1 { \char_set_catcode:nn {`#1} {\c_seven} }
-\cs_new_protected_nopar:Npn \char_make_math_subscript:N #1 { \char_set_catcode:nn {`#1} {\c_eight} }
-\cs_new_protected_nopar:Npn \char_make_ignore:N #1 { \char_set_catcode:nn {`#1} {\c_nine} }
-\cs_new_protected_nopar:Npn \char_make_space:N #1 { \char_set_catcode:nn {`#1} {\c_ten} }
-\cs_new_protected_nopar:Npn \char_make_letter:N #1 { \char_set_catcode:nn {`#1} {\c_eleven} }
-\cs_new_protected_nopar:Npn \char_make_other:N #1 { \char_set_catcode:nn {`#1} {\c_twelve} }
-\cs_new_protected_nopar:Npn \char_make_active:N #1 { \char_set_catcode:nn {`#1} {\c_thirteen} }
-\cs_new_protected_nopar:Npn \char_make_comment:N #1 { \char_set_catcode:nn {`#1} {\c_fourteen} }
-\cs_new_protected_nopar:Npn \char_make_invalid:N #1 { \char_set_catcode:nn {`#1} {\c_fifteen} }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{ \char_make_escape:n , \char_make_begin_group:n ,
-% \char_make_end_group:n , \char_make_math_shift:n ,
-% \char_make_alignment:n , \char_make_end_line:n ,
-% \char_make_parameter:n , \char_make_math_superscript:n ,
-% \char_make_math_subscript:n , \char_make_ignore:n ,
-% \char_make_space:n , \char_make_letter:n ,
-% \char_make_other:n , \char_make_active:n ,
-% \char_make_comment:n , \char_make_invalid:n }
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \char_make_escape:n #1 { \char_set_catcode:nn {#1} {\c_zero} }
-\cs_new_protected_nopar:Npn \char_make_begin_group:n #1 { \char_set_catcode:nn {#1} {\c_one} }
-\cs_new_protected_nopar:Npn \char_make_end_group:n #1 { \char_set_catcode:nn {#1} {\c_two} }
-\cs_new_protected_nopar:Npn \char_make_math_shift:n #1 { \char_set_catcode:nn {#1} {\c_three} }
-\cs_new_protected_nopar:Npn \char_make_alignment:n #1 { \char_set_catcode:nn {#1} {\c_four} }
-\cs_new_protected_nopar:Npn \char_make_end_line:n #1 { \char_set_catcode:nn {#1} {\c_five} }
-\cs_new_protected_nopar:Npn \char_make_parameter:n #1 { \char_set_catcode:nn {#1} {\c_six} }
-\cs_new_protected_nopar:Npn \char_make_math_superscript:n #1 { \char_set_catcode:nn {#1} {\c_seven} }
-\cs_new_protected_nopar:Npn \char_make_math_subscript:n #1 { \char_set_catcode:nn {#1} {\c_eight} }
-\cs_new_protected_nopar:Npn \char_make_ignore:n #1 { \char_set_catcode:nn {#1} {\c_nine} }
-\cs_new_protected_nopar:Npn \char_make_space:n #1 { \char_set_catcode:nn {#1} {\c_ten} }
-\cs_new_protected_nopar:Npn \char_make_letter:n #1 { \char_set_catcode:nn {#1} {\c_eleven} }
-\cs_new_protected_nopar:Npn \char_make_other:n #1 { \char_set_catcode:nn {#1} {\c_twelve} }
-\cs_new_protected_nopar:Npn \char_make_active:n #1 { \char_set_catcode:nn {#1} {\c_thirteen} }
-\cs_new_protected_nopar:Npn \char_make_comment:n #1 { \char_set_catcode:nn {#1} {\c_fourteen} }
-\cs_new_protected_nopar:Npn \char_make_invalid:n #1 { \char_set_catcode:nn {#1} {\c_fifteen} }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\char_set_mathcode:w,
-% \char_set_mathcode:nn,
-% \char_gset_mathcode:w,
-% \char_gset_mathcode:nn,
-% \char_value_mathcode:w,
-% \char_value_mathcode:n,
-% \char_show_value_mathcode:w,
-% \char_show_value_mathcode:n}
-% Math codes.
-% \begin{macrocode}
-\cs_new_eq:NN \char_set_mathcode:w \tex_mathcode:D
-\cs_new_protected_nopar:Npn \char_set_mathcode:nn #1#2 {
- \char_set_mathcode:w #1 = \int_eval:w #2\int_eval_end:
-}
-\cs_new_protected_nopar:Npn \char_gset_mathcode:w { \pref_global:D \tex_mathcode:D }
-\cs_new_protected_nopar:Npn \char_gset_mathcode:nn #1#2 {
- \char_gset_mathcode:w #1 = \int_eval:w #2\int_eval_end:
-}
-\cs_new_nopar:Npn \char_value_mathcode:w { \int_use:N \tex_mathcode:D }
-\cs_new_nopar:Npn \char_value_mathcode:n #1 {
- \char_value_mathcode:w \int_eval:w #1\int_eval_end:
-}
-\cs_new_nopar:Npn \char_show_value_mathcode:w { \tex_showthe:D \tex_mathcode:D }
-\cs_new_nopar:Npn \char_show_value_mathcode:n #1 {
- \char_show_value_mathcode:w \int_eval:w #1\int_eval_end:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\char_set_lccode:w, \char_set_lccode:nn,
-% \char_value_lccode:w, \char_value_lccode:n,
-% \char_show_value_lccode:w, \char_show_value_lccode:n}
-% \begin{macrocode}
-\cs_new_eq:NN \char_set_lccode:w \tex_lccode:D
-\cs_new_protected_nopar:Npn \char_set_lccode:nn #1#2{
- \char_set_lccode:w #1 = \int_eval:w #2\int_eval_end:
-}
-\cs_new_nopar:Npn \char_value_lccode:w {\int_use:N\tex_lccode:D}
-\cs_new_nopar:Npn \char_value_lccode:n #1{\char_value_lccode:w
- \int_eval:w #1\int_eval_end:}
-\cs_new_nopar:Npn \char_show_value_lccode:w {\tex_showthe:D\tex_lccode:D}
-\cs_new_nopar:Npn \char_show_value_lccode:n #1{
- \char_show_value_lccode:w \int_eval:w #1\int_eval_end:}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\char_set_uccode:w, \char_set_uccode:nn,
-% \char_value_uccode:w, \char_value_uccode:n,
-% \char_show_value_uccode:w, \char_show_value_uccode:n }
-% \begin{macrocode}
-\cs_new_eq:NN \char_set_uccode:w \tex_uccode:D
-\cs_new_protected_nopar:Npn \char_set_uccode:nn #1#2{
- \char_set_uccode:w #1 = \int_eval:w #2\int_eval_end:
-}
-\cs_new_nopar:Npn \char_value_uccode:w {\int_use:N\tex_uccode:D}
-\cs_new_nopar:Npn \char_value_uccode:n #1{\char_value_uccode:w
- \int_eval:w #1\int_eval_end:}
-\cs_new_nopar:Npn \char_show_value_uccode:w {\tex_showthe:D\tex_uccode:D}
-\cs_new_nopar:Npn \char_show_value_uccode:n #1{
- \char_show_value_uccode:w \int_eval:w #1\int_eval_end:}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\char_set_sfcode:w, \char_set_sfcode:nn,
-% \char_value_sfcode:w, \char_value_sfcode:n,
-% \char_show_value_sfcode:w, \char_show_value_sfcode:n}
-% \begin{macrocode}
-\cs_new_eq:NN \char_set_sfcode:w \tex_sfcode:D
-\cs_new_protected_nopar:Npn \char_set_sfcode:nn #1#2 {
- \char_set_sfcode:w #1 = \int_eval:w #2\int_eval_end:
-}
-\cs_new_nopar:Npn \char_value_sfcode:w { \int_use:N \tex_sfcode:D }
-\cs_new_nopar:Npn \char_value_sfcode:n #1 {
- \char_value_sfcode:w \int_eval:w #1\int_eval_end:
-}
-\cs_new_nopar:Npn \char_show_value_sfcode:w { \tex_showthe:D \tex_sfcode:D }
-\cs_new_nopar:Npn \char_show_value_sfcode:n #1 {
- \char_show_value_sfcode:w \int_eval:w #1\int_eval_end:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Generic tokens}
-%
-% \begin{macro}{\token_new:Nn}
-% Creates a new token.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \token_new:Nn #1#2 {\cs_new_eq:NN #1#2}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\c_group_begin_token,
-% \c_group_end_token,
-% \c_math_shift_token,
-% \c_alignment_tab_token,
-% \c_parameter_token,
-% \c_math_superscript_token,
-% \c_math_subscript_token,
-% \c_space_token,
-% \c_letter_token,
-% \c_other_char_token,
-% \c_active_char_token }
-% We define these useful tokens. We have to do it by hand with the
-% brace tokens for obvious reasons.
-% \begin{macrocode}
-\cs_new_eq:NN \c_group_begin_token {
-\cs_new_eq:NN \c_group_end_token }
-\group_begin:
-\char_set_catcode:nn{`\*}{3}
-\token_new:Nn \c_math_shift_token {*}
-\char_set_catcode:nn{`\*}{4}
-\token_new:Nn \c_alignment_tab_token {*}
-\token_new:Nn \c_parameter_token {#}
-\token_new:Nn \c_math_superscript_token {^}
-\char_set_catcode:nn{`\*}{8}
-\token_new:Nn \c_math_subscript_token {*}
-\token_new:Nn \c_space_token {~}
-\token_new:Nn \c_letter_token {a}
-\token_new:Nn \c_other_char_token {1}
-\char_set_catcode:nn{`\*}{13}
-\cs_gset_nopar:Npn \c_active_char_token {\exp_not:N*}
-\group_end:
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\token_if_group_begin_p:N}
-% \begin{macro}[TF]{\token_if_group_begin:N}
-% Check if token is a begin group token. We use the constant
-% "\c_group_begin_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_group_begin:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_group_begin_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{ \token_if_group_end_p:N }
-% \begin{macro}[TF]{ \token_if_group_end:N }
-% Check if token is a end group token. We use the constant
-% "\c_group_end_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_group_end:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_group_end_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_math_shift_p:N}
-% \begin{macro}[TF]{\token_if_math_shift:N}
-% Check if token is a math shift token. We use the constant
-% "\c_math_shift_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_math_shift:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_math_shift_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_alignment_tab_p:N}
-% \begin{macro}[TF]{\token_if_alignment_tab:N}
-% Check if token is an alignment tab token. We use the constant
-% "\c_alignment_tab_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_alignment_tab:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_alignment_tab_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_parameter_p:N}
-% \begin{macro}[TF]{\token_if_parameter:N}
-% Check if token is a parameter token. We use the constant
-% "\c_parameter_token" for this. We have to trick \TeX{} a bit to
-% avoid an error message.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_parameter:N {p,TF,T,F} {
- \exp_after:wN\if_catcode:w \cs:w c_parameter_token\cs_end:\exp_not:N #1
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_math_superscript_p:N}
-% \begin{macro}[TF]{\token_if_math_superscript:N}
-% Check if token is a math superscript token. We use the constant
-% "\c_math_superscript_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_math_superscript:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_math_superscript_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_math_subscript_p:N}
-% \begin{macro}[TF]{\token_if_math_subscript:N}
-% Check if token is a math subscript token. We use the constant
-% "\c_math_subscript_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_math_subscript:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_math_subscript_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_space_p:N}
-% \begin{macro}[TF]{\token_if_space:N}
-% Check if token is a space token. We use the constant
-% "\c_space_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_space:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_space_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_letter_p:N}
-% \begin{macro}[TF]{\token_if_letter:N}
-% Check if token is a letter token. We use the constant
-% "\c_letter_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_letter:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_letter_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_other_char_p:N}
-% \begin{macro}[TF]{\token_if_other_char:N}
-% Check if token is an other char token. We use the constant
-% "\c_other_char_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_other_char:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_other_char_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_active_char_p:N}
-% \begin{macro}[TF]{\token_if_active_char:N}
-% Check if token is an active char token. We use the constant
-% "\c_active_char_token" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_active_char:N {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1\c_active_char_token
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_eq_meaning_p:NN}
-% \begin{macro}[TF]{\token_if_eq_meaning:NN}
-% Check if the tokens |#1| and |#2| have same meaning.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_eq_meaning:NN {p,TF,T,F} {
- \if_meaning:w #1 #2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_eq_catcode_p:NN}
-% \begin{macro}[TF]{\token_if_eq_catcode:NN}
-% Check if the tokens |#1| and |#2| have same category code.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_eq_catcode:NN {p,TF,T,F} {
- \if_catcode:w \exp_not:N #1 \exp_not:N #2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\token_if_eq_charcode_p:NN}
-% \begin{macro}[TF]{\token_if_eq_charcode:NN}
-% Check if the tokens |#1| and |#2| have same character code.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_eq_charcode:NN {p,TF,T,F} {
- \if_charcode:w \exp_not:N #1 \exp_not:N #2
- \prg_return_true: \else: \prg_return_false: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_macro_p:N}
-% \begin{macro}[TF]{\token_if_macro:N}
-% \begin{macro}[aux]{\token_if_macro_p_aux:w}
-% When a token is a macro, "\token_to_meaning:N" will always output
-% something like "\long macro:#1->#1" so we simply check to see if
-% the meaning contains "->". Argument "#2" in the code below will be
-% empty if the string "->" isn't present, proof that the token was
-% not a macro (which is why we reverse the emptiness test). However
-% this function will fail on its own auxiliary function (and a few
-% other private functions as well) but that should certainly never
-% be a problem!
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_macro:N {p,TF,T,F} {
- \exp_after:wN \token_if_macro_p_aux:w \token_to_meaning:N #1 -> \q_stop
-}
-\cs_new_nopar:Npn \token_if_macro_p_aux:w #1 -> #2 \q_stop{
- \if_predicate:w \tl_if_empty_p:n{#2}
- \prg_return_false: \else: \prg_return_true: \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_cs_p:N}
-% \begin{macro}[TF]{\token_if_cs:N}
-% Check if token has same catcode as a control sequence. We use
-% "\scan_stop:" for this.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_cs:N {p,TF,T,F} {
- \if_predicate:w \token_if_eq_catcode_p:NN \scan_stop: #1
- \prg_return_true: \else: \prg_return_false: \fi:}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\token_if_expandable_p:N}
-% \begin{macro}[TF]{\token_if_expandable:N}
-% Check if token is expandable. We use the fact that \TeX\ will
-% temporarily convert "\exp_not:N" \m{token} into "\scan_stop:" if
-% \m{token} is expandable.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_expandable:N {p,TF,T,F} {
- \cs_if_exist:NTF #1 {
- \exp_after:wN \if_meaning:w \exp_not:N #1 #1
- \prg_return_false: \else: \prg_return_true: \fi:
- } {
- \prg_return_false:
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\token_if_chardef_p:N,
-% \token_if_mathchardef_p:N,
-% \token_if_int_register_p:N,
-% \token_if_skip_register_p:N,
-% \token_if_dim_register_p:N,
-% \token_if_toks_register_p:N,
-% \token_if_protected_macro_p:N,
-% \token_if_long_macro_p:N,
-% \token_if_protected_long_macro_p:N}
-% \begin{macro}[TF]{\token_if_chardef:N,\token_if_mathchardef:N,
-% \token_if_long_macro:N, \token_if_protected_macro:N,
-% \token_if_protected_long_macro:N, \token_if_dim_register:N,
-% \token_if_skip_register:N, \token_if_int_register:N,
-% \token_if_toks_register:N}
-% \begin{macro}[aux]{
-% \token_if_chardef_p_aux:w,
-% \token_if_mathchardef_p_aux:w,
-% \token_if_int_register_p_aux:w,
-% \token_if_skip_register_p_aux:w,
-% \token_if_dim_register_p_aux:w,
-% \token_if_toks_register_p_aux:w,
-% \token_if_protected_macro_p_aux:w,
-% \token_if_long_macro_p_aux:w,
-% \token_if_protected_long_macro_p_aux:w}
-% Most of these functions have to check the meaning of the token in
-% question so we need to do some checkups on which characters are
-% output by |\token_to_meaning:N|. As usual, these characters have
-% catcode 12 so we must do some serious substitutions in the code
-% below\dots
-% \begin{macrocode}
-\group_begin:
- \char_set_lccode:nn {`\T}{`\T}
- \char_set_lccode:nn {`\F}{`\F}
- \char_set_lccode:nn {`\X}{`\n}
- \char_set_lccode:nn {`\Y}{`\t}
- \char_set_lccode:nn {`\Z}{`\d}
- \char_set_lccode:nn {`\?}{`\\}
- \tl_map_inline:nn{\X\Y\Z\M\C\H\A\R\O\U\S\K\I\P\L\G\P\E}
- {\char_set_catcode:nn {`#1}{12}}
-% \end{macrocode}
-% We convert the token list to lowercase and restore the catcode and
-% lowercase code changes.
-% \begin{macrocode}
-\tl_to_lowercase:n{
- \group_end:
-% \end{macrocode}
-% First up is checking if something has been defined with
-% |\tex_chardef:D| or |\tex_mathchardef:D|. This is easy since \TeX\
-% thinks of such tokens as hexadecimal so it stores them as
-% |\char"|\meta{hex~number} or |\mathchar"|\meta{hex~number}.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_chardef:N {p,TF,T,F} {
- \exp_after:wN \token_if_chardef_aux:w
- \token_to_meaning:N #1?CHAR"\q_stop
-}
-\cs_new_nopar:Npn \token_if_chardef_aux:w #1?CHAR"#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_mathchardef:N {p,TF,T,F} {
- \exp_after:wN \token_if_mathchardef_aux:w
- \token_to_meaning:N #1?MAYHCHAR"\q_stop
-}
-\cs_new_nopar:Npn \token_if_mathchardef_aux:w #1?MAYHCHAR"#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Integer registers are a little more difficult since they expand to
-% |\count|\meta{number} and there is also a primitive |\countdef|. So
-% we have to check for that primitive as well.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_int_register:N {p,TF,T,F} {
- \if_meaning:w \tex_countdef:D #1
- \prg_return_false:
- \else:
- \exp_after:wN \token_if_int_register_aux:w
- \token_to_meaning:N #1?COUXY\q_stop
- \fi:
-}
-\cs_new_nopar:Npn \token_if_int_register_aux:w #1?COUXY#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Skip registers are done the same way as the integer registers.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_skip_register:N {p,TF,T,F} {
- \if_meaning:w \tex_skipdef:D #1
- \prg_return_false:
- \else:
- \exp_after:wN \token_if_skip_register_aux:w
- \token_to_meaning:N #1?SKIP\q_stop
- \fi:
-}
-\cs_new_nopar:Npn \token_if_skip_register_aux:w #1?SKIP#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Dim registers. No news here
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_dim_register:N {p,TF,T,F} {
- \if_meaning:w \tex_dimendef:D #1
- \c_false_bool
- \else:
- \exp_after:wN \token_if_dim_register_aux:w
- \token_to_meaning:N #1?ZIMEX\q_stop
- \fi:
-}
-\cs_new_nopar:Npn \token_if_dim_register_aux:w #1?ZIMEX#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Toks registers.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_toks_register:N {p,TF,T,F} {
- \if_meaning:w \tex_toksdef:D #1
- \prg_return_false:
- \else:
- \exp_after:wN \token_if_toks_register_aux:w
- \token_to_meaning:N #1?YOKS\q_stop
- \fi:
-}
-\cs_new_nopar:Npn \token_if_toks_register_aux:w #1?YOKS#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Protected macros.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_protected_macro:N {p,TF,T,F} {
- \exp_after:wN \token_if_protected_macro_aux:w
- \token_to_meaning:N #1?PROYECYEZ~MACRO\q_stop
-}
-\cs_new_nopar:Npn \token_if_protected_macro_aux:w #1?PROYECYEZ~MACRO#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Long macros.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_long_macro:N {p,TF,T,F} {
- \exp_after:wN \token_if_long_macro_aux:w
- \token_to_meaning:N #1?LOXG~MACRO\q_stop
-}
-\cs_new_nopar:Npn \token_if_long_macro_aux:w #1?LOXG~MACRO#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Finally protected long macros where we for once don't have to add an
-% extra test since there is no primitive for the combined prefixes.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_protected_long_macro:N {p,TF,T,F} {
- \exp_after:wN \token_if_protected_long_macro_aux:w
- \token_to_meaning:N #1?PROYECYEZ?LOXG~MACRO\q_stop
-}
-\cs_new_nopar:Npn \token_if_protected_long_macro_aux:w #1
- ?PROYECYEZ?LOXG~MACRO#2\q_stop{
- \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% Finally the |\tl_to_lowercase:n| ends!
-% \begin{macrocode}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% We do not provide a function for testing if a control sequence is
-% ``outer'' since we don't use that in \LaTeX3.
-%
-% \begin{macro}[aux]{\token_get_prefix_arg_replacement_aux:w}
-% \begin{macro}{\token_get_prefix_spec:N}
-% \begin{macro}{\token_get_arg_spec:N}
-% \begin{macro}{\token_get_replacement_spec:N}
-% In the \textsf{xparse} package we sometimes want to test if a
-% control sequence can be expanded to reveal a hidden
-% value. However, we cannot just expand the macro blindly as it may
-% have arguments and none might be present. Therefore we define
-% these functions to pick either the prefix(es), the argument
-% specification, or the replacement text from a macro. All of this
-% information is returned as characters with catcode~12. If the
-% token in question isn't a macro, the token |\scan_stop:| is
-% returned instead.
-% \begin{macrocode}
-\group_begin:
-\char_set_lccode:nn {`\?}{`\:}
-\char_set_catcode:nn{`\M}{12}
-\char_set_catcode:nn{`\A}{12}
-\char_set_catcode:nn{`\C}{12}
-\char_set_catcode:nn{`\R}{12}
-\char_set_catcode:nn{`\O}{12}
-\tl_to_lowercase:n{
- \group_end:
- \cs_new_nopar:Npn \token_get_prefix_arg_replacement_aux:w #1MACRO?#2->#3\q_stop#4{
- #4{#1}{#2}{#3}
- }
- \cs_new_nopar:Npn\token_get_prefix_spec:N #1{
- \token_if_macro:NTF #1{
- \exp_after:wN \token_get_prefix_arg_replacement_aux:w
- \token_to_meaning:N #1\q_stop\use_i:nnn
- }{\scan_stop:}
- }
- \cs_new_nopar:Npn\token_get_arg_spec:N #1{
- \token_if_macro:NTF #1{
- \exp_after:wN \token_get_prefix_arg_replacement_aux:w
- \token_to_meaning:N #1\q_stop\use_ii:nnn
- }{\scan_stop:}
- }
- \cs_new_nopar:Npn\token_get_replacement_spec:N #1{
- \token_if_macro:NTF #1{
- \exp_after:wN \token_get_prefix_arg_replacement_aux:w
- \token_to_meaning:N #1\q_stop\use_iii:nnn
- }{\scan_stop:}
- }
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \paragraph{Useless code: because we can!}
-%
-% \begin{macro}{\token_if_primitive_p:N}
-% \begin{macro}[aux]{\token_if_primitive_p_aux:N}
-% \begin{macro}[TF]{\token_if_primitive:N}
-% It is rather hard to determine if a token is a primitive. First we
-% can check if it is a control sequence or active character. If
-% either, we check if it is a macro. Then we can go through a
-% tedious process of testing for different register types\dots{} I
-% don't actually think this function is useful but you never know.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \token_if_primitive:N {p,TF,T,F} {
- \if_predicate:w \token_if_cs_p:N #1
- \if_predicate:w \token_if_macro_p:N #1
- \prg_return_false:
- \else:
- \token_if_primitive_p_aux:N #1
- \fi:
- \else:
- \if_predicate:w \token_if_active_char_p:N #1
- \if_predicate:w \token_if_macro_p:N #1
- \prg_return_false:
- \else:
- \token_if_primitive_p_aux:N #1
- \fi:
- \else:
- \prg_return_false:
- \fi:
- \fi:
-}
-\cs_new_nopar:Npn \token_if_primitive_p_aux:N #1{
- \if_predicate:w \token_if_chardef_p:N #1 \c_false_bool
- \else:
- \if_predicate:w \token_if_mathchardef_p:N #1 \prg_return_false:
- \else:
- \if_predicate:w \token_if_int_register_p:N #1 \prg_return_false:
- \else:
- \if_predicate:w \token_if_skip_register_p:N #1 \prg_return_false:
- \else:
- \if_predicate:w \token_if_dim_register_p:N #1 \prg_return_false:
- \else:
- \if_predicate:w \token_if_toks_register_p:N #1 \prg_return_false:
- \else:
-% \end{macrocode}
-% We made it!
-% \begin{macrocode}
- \prg_return_true:
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Peeking ahead at the next token}
-%
-% \begin{macro}{\l_peek_token}
-% \begin{macro}{\g_peek_token}
-% \begin{macro}{\l_peek_search_token}
-% We define some other tokens which will initially be the character
-% |?|.
-% \begin{macrocode}
-\token_new:Nn \l_peek_token {?}
-\token_new:Nn \g_peek_token {?}
-\token_new:Nn \l_peek_search_token {?}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\peek_after:NN}
-% \begin{macro}{\peek_gafter:NN}
-% |\peek_after:NN| takes two argument where the first is a function
-% acting on |\l_peek_token| and the second is the next token in the
-% input stream which |\l_peek_token| is set equal to.
-% |\peek_gafter:NN| does the same globally to |\g_peek_token|.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \peek_after:NN {\tex_futurelet:D \l_peek_token }
-\cs_new_protected_nopar:Npn \peek_gafter:NN {
- \pref_global:D \tex_futurelet:D \g_peek_token
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% For normal purposes there are four main cases:
-% \begin{enumerate}
-% \item peek at the next token.
-% \item peek at the next non-space token.
-% \item peek at the next token and remove it.
-% \item peek at the next non-space token and remove it.
-% \end{enumerate}
-%
-%
-% The generic functions will take four arguments: The token to search
-% for, the test function to run on it and the true/false cases.
-% The general algorithm is this:
-% \begin{enumerate}
-% \item
-% Store the token to search for in |\l_peek_search_token|.
-% \item
-% In order to avoid doubling of hash marks where it seems unnatural
-% we put the \meta{true} and \meta{false} cases through an |x| type
-% expansion but using |\exp_not:n| to avoid any expansion. This has
-% the same effect as putting it through a \meta{toks} register but
-% is faster. Also put in a special alignment safe group end.
-% \item
-% Put in an alignment safe group begin.
-% \item
-% Peek ahead and call the function which will act on the next token
-% in the input stream.
-% \end{enumerate}
-%
-% \begin{macro}{\l_peek_true_tl}
-% \begin{macro}{\l_peek_false_tl}
-% Two dedicated token list variables that store the true and false
-% cases.
-% \begin{macrocode}
-\tl_new:N \l_peek_true_tl
-\tl_new:N \l_peek_false_tl
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\peek_tmp:w}
-% Scratch function used for storing the token to be removed if
-% found.
-% \begin{macrocode}
-\cs_new_nopar:Npn \peek_tmp:w {}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\l_peek_search_tl}
-% We also use this token list variable for storing the token we want
-% to compare. This turns out to be useful.
-% \begin{macrocode}
-\tl_new:N \l_peek_search_tl
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_token_generic:NN}
-% \begin{arguments}
-% \item the function to execute (obey or ignore spaces, etc.),
-% \item the special token we're looking for.
-% \end{arguments}
-% \begin{macrocode}
-\cs_new_protected:Npn \peek_token_generic:NNTF #1#2#3#4 {
- \cs_set_eq:NN \l_peek_search_token #2
- \tl_set:Nn \l_peek_search_tl {#2}
- \tl_set:Nn \l_peek_true_tl { \group_align_safe_end: #3 }
- \tl_set:Nn \l_peek_false_tl { \group_align_safe_end: #4 }
- \group_align_safe_begin:
- \peek_after:NN #1
-}
-\cs_new_protected:Npn \peek_token_generic:NNT #1#2#3 {
- \peek_token_generic:NNTF #1#2 {#3} {}
-}
-\cs_new_protected:Npn \peek_token_generic:NNF #1#2#3 {
- \peek_token_generic:NNTF #1#2 {} {#3}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_token_remove_generic:NN}
-% If we want to be able to remove any character from the input
-% stream we might as well do it the same way for all characters so
-% we define this as little differently from above.
-% \begin{macrocode}
-\cs_new_protected:Npn \peek_token_remove_generic:NNTF #1#2#3#4 {
- \cs_set_eq:NN \l_peek_search_token #2
- \tl_set:Nn \l_peek_search_tl {#2}
- \tl_set:Nn \l_peek_true_aux_tl {#3}
- \tl_set_eq:NN \l_peek_true_tl \c_peek_true_remove_next_tl
- \tl_set:Nn \l_peek_false_tl {\group_align_safe_end: #4}
- \group_align_safe_begin:
- \peek_after:NN #1
-}
-\cs_new:Npn \peek_token_remove_generic:NNT #1#2#3 {
- \peek_token_remove_generic:NNTF #1#2 {#3} {}
-}
-\cs_new:Npn \peek_token_remove_generic:NNF #1#2#3 {
- \peek_token_remove_generic:NNTF #1#2 {} {#3}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\l_peek_true_aux_tl}
-% \begin{macro}{\c_peek_true_remove_next_tl}
-% Two token list variables to help with removing the character from
-% the input stream.
-% \begin{macrocode}
-\tl_new:N \l_peek_true_aux_tl
-\tl_const:Nn \c_peek_true_remove_next_tl {\group_align_safe_end:
- \tex_afterassignment:D \l_peek_true_aux_tl \cs_set_eq:NN \peek_tmp:w
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\peek_execute_branches_meaning:}
-% \begin{macro}{\peek_execute_branches_catcode:}
-% \begin{macro}{\peek_execute_branches_charcode:}
-% \begin{macro}[aux]{\peek_execute_branches_charcode_aux:NN}
-% There are three major tests between tokens in \TeX: meaning,
-% catcode and charcode. Hence we define three basic test functions
-% that set in after the ignoring phase is over and done with.
-% \begin{macrocode}
-\cs_new_nopar:Npn \peek_execute_branches_meaning: {
- \if_meaning:w \l_peek_token \l_peek_search_token
- \exp_after:wN \l_peek_true_tl
- \else:
- \exp_after:wN \l_peek_false_tl
- \fi:
-}
-\cs_new_nopar:Npn \peek_execute_branches_catcode: {
- \if_catcode:w \exp_not:N\l_peek_token \exp_not:N\l_peek_search_token
- \exp_after:wN \l_peek_true_tl
- \else:
- \exp_after:wN \l_peek_false_tl
- \fi:
-}
-% \end{macrocode}
-% For the charcode version we do things a little differently. We want
-% to check the token directly but if we do this we face problems if
-% the next thing in the input stream is a braced group or a space
-% token. The braced group would be read as a complete argument and the
-% space would be gobbled by \TeX's argument reading routines. Hence we
-% test for both of these and if one of them is found we just execute
-% the false result directly since no one should ever try to use the
-% |charcode| function for searching for |\c_group_begin_token| or
-% |\c_space_token|. The same is true for |\c_group_end_token|, as this
-% can only occur if the function is at the end of a group.
-% \begin{macrocode}
-\cs_new_nopar:Npn \peek_execute_branches_charcode: {
- \bool_if:nTF {
- \token_if_eq_catcode_p:NN \l_peek_token \c_group_begin_token ||
- \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token ||
- \token_if_eq_meaning_p:NN \l_peek_token \c_space_token
- }
- { \l_peek_false_tl }
-% \end{macrocode}
-% Otherwise we call a small auxiliary function that just grabs the
-% next token. We can do that because it really is a single token; we
-% just have insert it again afterwards. Also we stored the token we
-% were looking for in the token list variable |\l_peek_search_tl| so
-% we unpack it again for this function.
-% \begin{macrocode}
- { \exp_after:wN \peek_execute_branches_charcode_aux:NN \l_peek_search_tl }
-}
-% \end{macrocode}
-% Then we just do the usual |\if_charcode:w| comparison. We also
-% remember to insert |#2| again after executing the true or false
-% branches.
-% \begin{macrocode}
-\cs_new:Npn \peek_execute_branches_charcode_aux:NN #1#2{
- \if_charcode:w \exp_not:N #1\exp_not:N#2
- \exp_after:wN \l_peek_true_tl
- \else:
- \exp_after:wN \l_peek_false_tl
- \fi:
- #2
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux]{\peek_def_aux:nnnn,\peek_def_aux_ii:nnnnn}
-% This function aids defining conditional variants without too much
-% repeated code. I hope that it doesn't detract too much from the readability.
-% \begin{macrocode}
-\cs_new_nopar:Npn \peek_def_aux:nnnn #1#2#3#4 {
- \peek_def_aux_ii:nnnnn {#1} {#2} {#3} {#4} { TF }
- \peek_def_aux_ii:nnnnn {#1} {#2} {#3} {#4} { T }
- \peek_def_aux_ii:nnnnn {#1} {#2} {#3} {#4} { F }
-}
-\cs_new_protected_nopar:Npn \peek_def_aux_ii:nnnnn #1#2#3#4#5 {
- \cs_new_nopar:cpx { #1 #5 } {
- \tl_if_empty:nF {#2} {
- \exp_not:n { \cs_set_eq:NN \peek_execute_branches: #2 }
- }
- \exp_not:c { #3 #5 }
- \exp_not:n { #4 }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_meaning:N}
-% Here we use meaning comparison with |\if_meaning:w|.
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_meaning:N }
- {}
- { peek_token_generic:NN }
- { \peek_execute_branches_meaning: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_meaning_ignore_spaces:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_meaning_ignore_spaces:N }
- { \peek_execute_branches_meaning: }
- { peek_token_generic:NN }
- { \peek_ignore_spaces_execute_branches: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_meaning_remove:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_meaning_remove:N }
- {}
- { peek_token_remove_generic:NN }
- { \peek_execute_branches_meaning: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_meaning_remove_ignore_spaces:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_meaning_remove_ignore_spaces:N }
- { \peek_execute_branches_meaning: }
- { peek_token_remove_generic:NN }
- { \peek_ignore_spaces_execute_branches: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_catcode:N}
-% Here we use catcode comparison with |\if_catcode:w|.
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_catcode:N }
- {}
- { peek_token_generic:NN }
- { \peek_execute_branches_catcode: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_catcode_ignore_spaces:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_catcode_ignore_spaces:N }
- { \peek_execute_branches_catcode: }
- { peek_token_generic:NN }
- { \peek_ignore_spaces_execute_branches: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_catcode_remove:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_catcode_remove:N }
- {}
- { peek_token_remove_generic:NN }
- { \peek_execute_branches_catcode: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_catcode_remove_ignore_spaces:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_catcode_remove_ignore_spaces:N }
- { \peek_execute_branches_catcode: }
- { peek_token_remove_generic:NN }
- { \peek_ignore_spaces_execute_branches: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_charcode:N}
-% Here we use charcode comparison with |\if_charcode:w|.
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_charcode:N }
- {}
- { peek_token_generic:NN }
- { \peek_execute_branches_charcode: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_charcode_ignore_spaces:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_charcode_ignore_spaces:N }
- { \peek_execute_branches_charcode: }
- { peek_token_generic:NN }
- { \peek_ignore_spaces_execute_branches: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_charcode_remove:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_charcode_remove:N }
- {}
- { peek_token_remove_generic:NN }
- { \peek_execute_branches_charcode: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[TF]{\peek_charcode_remove_ignore_spaces:N}
-% \begin{macrocode}
-\peek_def_aux:nnnn
- { peek_charcode_remove_ignore_spaces:N }
- { \peek_execute_branches_charcode: }
- { peek_token_remove_generic:NN }
- { \peek_ignore_spaces_execute_branches:}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\peek_ignore_spaces_aux:,
-% \peek_ignore_spaces_execute_branches:}
-% Throw away a space token and search again. We could define this in
-% a more devious way where the auxiliary function gobbles the space
-% token but then what do we do if we decide that a certain function
-% should ignore more than one specific token? For example someone
-% might find it interesting to define a |\peek_| function that
-% ignores |a|'s and |b|'s! Or maybe different kinds of ``funny
-% spaces''\dots{} Therefore I have decided to use this version which
-% uses |\tex_afterassignment:D| to call the auxiliary function after
-% the next token has been removed by |\cs_set_eq:NN|. That way it is
-% easily extensible.
-% \begin{macrocode}
-\cs_new_nopar:Npn \peek_ignore_spaces_aux: {
- \peek_after:NN \peek_ignore_spaces_execute_branches:
-}
-\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches: {
- \token_if_eq_meaning:NNTF \l_peek_token \c_space_token
- { \tex_afterassignment:D \peek_ignore_spaces_aux:
- \cs_set_eq:NN \peek_tmp:w
- }
- \peek_execute_branches:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
diff --git a/Master/texmf-dist/source/latex/expl3/l3toks.dtx b/Master/texmf-dist/source/latex/expl3/l3toks.dtx
deleted file mode 100644
index 1937da4752f..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3toks.dtx
+++ /dev/null
@@ -1,807 +0,0 @@
-% \iffalse
-%% File: l3toks.dtx Copyright (C) 1990-2010 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3toks.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental Token Registers}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{l3toks.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3toks} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Token Registers}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% There is a second form beside token list variables in which \LaTeX3
-% stores token lists, namely the internal \TeX{} token registers.
-% Functions dealing with these registers got the prefix "\toks_". Unlike
-% token list variables we have an accessing function as one can see
-% below.
-%
-% The main difference between \m{toks} (token registers) and \m{tl var.}~(token
-% list variable) is their behavior regarding expansion. While \m{tl vars}
-% expand fully (i.e., until only unexpandable tokens are left) inside
-% an argument that is subject to expansion (i.e., denoted by |x|)
-% \m{toks}'s expand always only up to one level, i.e., passing their
-% contents without further expansion.
-%
-% There are fewer restrictions on the contents of a token register over
-% a token list variable. So while \meta{token list} is used to describe
-% the contents of both of these, bear in mind that slightly different lists
-% of tokens are allowed in each case. The best (only?) example is that a
-% \meta{toks} can contain the "#" character (i.e., characters of catcode 6),
-% whereas a \meta{tl var.}~will require its input to be sanitised before that is
-% possible.
-%
-% If you're not sure which to use between a \meta{tl var.}~or a \meta{toks},
-% consider what data you're trying to hold. If you're dealing with function
-% parameters involving "#", or building some sort of data structure
-% then you probably want a \meta{toks} (e.g., \file{l3prop} uses \meta{toks}
-% to store its property lists).
-%
-% If you're storing ad-hoc data for later use (possibly from direct user
-% input) then usually a \meta{tl var.}~will be what you want.
-%
-% \section{Allocation and use}
-%
-% \begin{function}{ \toks_new:N |
-% \toks_new:c }
-% \begin{syntax}
-% "\toks_new:N" <toks>
-% \end{syntax}
-% Defines <toks> to be a new token list register.
-% \begin{texnote}
-% This is the \LaTeX3 allocation for what was called \tn{newtoks} in
-% plain \TeX.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \toks_use:N | \toks_use:c }
-% \begin{syntax}
-% "\toks_use:N" <toks>
-% \end{syntax}
-% Accesses the contents of <toks>. Contrary to token list variables
-% <toks> can't be access simply by calling them directly.
-% \begin{texnote}
-% Something like "\the" <toks>.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \toks_set:Nn |
-% \toks_set:NV |
-% \toks_set:Nv |
-% \toks_set:No |
-% \toks_set:Nx |
-% \toks_set:Nf |
-% \toks_set:cn |
-% \toks_set:co |
-% \toks_set:cV |
-% \toks_set:cv |
-% \toks_set:cx |
-% \toks_set:cf }
-% \begin{syntax}
-% "\toks_set:Nn" <toks> \Arg{token list}
-% \end{syntax}
-% Defines <toks> to hold the token list <token list>.
-% \begin{texnote}
-% "\toks_set:Nn" could have been specified in plain \TeX{} by <toks> "="
-% \Arg{token list} but all other functions have no counterpart in
-% plain \TeX.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{ \toks_gset:Nn |
-% \toks_gset:NV |
-% \toks_gset:No |
-% \toks_gset:Nx |
-% \toks_gset:cn |
-% \toks_gset:cV |
-% \toks_gset:co |
-% \toks_gset:cx }
-% \begin{syntax}
-% "\toks_gset:Nn" <toks> \Arg{token list}
-% \end{syntax}
-% Defines <toks> to globally hold the token list <token list>.
-% \end{function}
-%
-% \begin{function}{ \toks_set_eq:NN |
-% \toks_set_eq:cN |
-% \toks_set_eq:Nc |
-% \toks_set_eq:cc }
-% \begin{syntax}
-% "\toks_set_eq:NN" <toks1> <toks2>
-% \end{syntax}
-% Set <toks1> to the value of <toks2>. Don't try to use
-% "\toks_set:Nn" for this purpose if the second argument is also a
-% token register.
-% \end{function}
-%
-% \begin{function}{ \toks_gset_eq:NN |
-% \toks_gset_eq:cN |
-% \toks_gset_eq:Nc |
-% \toks_gset_eq:cc }
-% \begin{syntax}
-% "\toks_gset_eq:NN" <toks1> <toks2>
-% \end{syntax}
-% The <toks1> globally set to the value of <toks2>. Don't try to use
-% "\toks_gset:Nn" for this purpose if the second argument is also a
-% token register.
-% \end{function}
-%
-% \begin{function}{ \toks_clear:N |
-% \toks_clear:c |
-% \toks_gclear:N |
-% \toks_gclear:c }
-% \begin{syntax}
-% "\toks_clear:N" <toks>
-% \end{syntax}
-% The <toks> is locally or globally cleared.
-% \end{function}
-%
-% \begin{function}{ \toks_use_clear:N |
-% \toks_use_clear:c |
-% \toks_use_gclear:N |
-% \toks_use_gclear:c }
-% \begin{syntax}
-% "\toks_use_clear:N" <toks>
-% \end{syntax}
-% Accesses the contents of <toks> and clears (locally or globally) it
-% afterwards. Actually the clearing operation is done in a way that does
-% not prohibit the access of the following tokens in the input stream
-% with functions stored in the token register. In other words this
-% function is not exactly the same as calling "\toks_use:N" <toks>
-% "\toks_clear:N" <toks> in sequence.
-% \end{function}
-%
-% \begin{function}{ \toks_show:N | \toks_show:c}
-% \begin{syntax}
-% "\toks_show:N" <toks>
-% \end{syntax}
-% Displays the contents of <toks> in the terminal output and log file.
-% "#" signs in the <toks> will be shown doubled.
-% \begin{texnote}
-% Something like "\showthe" <toks>.
-% \end{texnote}
-% \end{function}
-%
-% \section{Adding to the contents of token registers}
-%
-% \begin{function}{ \toks_put_left:Nn |
-% \toks_put_left:NV |
-% \toks_put_left:No |
-% \toks_put_left:Nx |
-% \toks_put_left:cn |
-% \toks_put_left:cV |
-% \toks_put_left:co }
-% \begin{syntax}
-% "\toks_put_left:Nn" <toks> \Arg{token list}
-% \end{syntax}
-% These functions will append <token list> to the left of
-% <toks>. Assignment is done locally. If possible
-% append to the right since this operation is faster.
-% \end{function}
-%
-% \begin{function}{ \toks_gput_left:Nn |
-% \toks_gput_left:NV |
-% \toks_gput_left:No |
-% \toks_gput_left:Nx |
-% \toks_gput_left:cn |
-% \toks_gput_left:cV |
-% \toks_gput_left:co }
-% \begin{syntax}
-% "\toks_gput_left:Nn" <toks> \Arg{token list}
-% \end{syntax}
-% These functions will append <token list> to the left of
-% <toks>. Assignment is done globally. If possible
-% append to the right since this operation is faster.
-% \end{function}
-%
-% \begin{function}{ \toks_put_right:Nn |
-% \toks_put_right:NV |
-% \toks_put_right:No |
-% \toks_put_right:Nx |
-% \toks_put_right:cV |
-% \toks_put_right:cn |
-% \toks_put_right:co }
-% \begin{syntax}
-% "\toks_put_right:Nn" <toks> \Arg{token list}
-% \end{syntax}
-% These functions will append <token list> to the right of
-% <toks>. Assignment is done locally.
-% \end{function}
-%
-% \begin{function}{ \toks_put_right:Nf }
-% \begin{syntax}
-% "\toks_put_right:Nf" <toks> \Arg{token list}
-% \end{syntax}
-% Variant of the above. |:Nf| is used by |template.dtx| and will
-% perhaps be moved to that package.
-% \end{function}
-%
-% \begin{function}{ \toks_gput_right:Nn |
-% \toks_gput_right:NV |
-% \toks_gput_right:No |
-% \toks_gput_right:Nx |
-% \toks_gput_right:cn |
-% \toks_gput_right:cV |
-% \toks_gput_right:co }
-% \begin{syntax}
-% "\toks_gput_right:Nn" <toks> \Arg{token list}
-% \end{syntax}
-% These functions will append <token list> to the right of
-% <toks>. Assignment is done globally.
-% \end{function}
-%
-%
-% \section{Predicates and conditionals}
-%
-% \begin{function}{ \toks_if_empty_p:N / (EXP) |
-% \toks_if_empty:N / (EXP)(TF) |
-% \toks_if_empty_p:c / (EXP) |
-% \toks_if_empty:c / (EXP)(TF) }
-% \begin{syntax}
-% "\toks_if_empty:NTF" <toks> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Expandable test for whether <toks> is empty.
-% \end{function}
-%
-% \begin{function}{ \toks_if_eq:NN / (TF)(EXP) |
-% \toks_if_eq:Nc / (TF)(EXP) |
-% \toks_if_eq:cN / (TF)(EXP) |
-% \toks_if_eq:cc / (TF)(EXP) |
-% \toks_if_eq_p:NN / (EXP) |
-% \toks_if_eq_p:cN / (EXP) |
-% \toks_if_eq_p:Nc / (EXP) |
-% \toks_if_eq_p:cc / (EXP) }
-% \begin{syntax}
-% "\toks_if_eq:NNTF" <toks1> <toks2> \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Expandably tests if <toks1> and <toks2> are equal.
-% \end{function}
-%
-% \section{Variable and constants}
-%
-% \begin{variable}{\c_empty_toks}
-% Constant that is always empty.
-% \end{variable}
-%
-% \begin{variable}{ \l_tmpa_toks |
-% \l_tmpb_toks |
-% \l_tmpc_toks |
-% \g_tmpa_toks |
-% \g_tmpb_toks |
-% \g_tmpc_toks }
-% Scratch register for immediate use. They are not used by conditionals
-% or predicate functions.
-% \end{variable}
-%
-% \begin{variable}{ \l_tl_replace_toks }
-% A placeholder for contents of functions replacing contents of strings.
-% \end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3toks} implementation}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% \subsection{Allocation and use}
-%
-% \begin{macro}{\toks_new:N,\toks_new:c}
-% Allocates a new token register.
-% \begin{macrocode}
-%<*initex>
-\alloc_new:nnnN {toks} \c_zero \c_max_register_int \tex_toksdef:D
-%</initex>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%<*package>
-\cs_new_protected_nopar:Npn \toks_new:N #1 {
- \chk_if_free_cs:N #1
- \newtoks #1
-}
-%</package>
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_new:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\toks_use:N}
-% \begin{macro}{\toks_use:c}
-% This function returns the contents of a token register.
-% \begin{macrocode}
-\cs_new_eq:NN \toks_use:N \tex_the:D
-\cs_generate_variant:Nn \toks_use:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\toks_set:Nn}
-% \begin{macro}{\toks_set:NV}
-% \begin{macro}{\toks_set:Nv}
-% \begin{macro}{\toks_set:No}
-% \begin{macro}{\toks_set:Nx}
-% \begin{macro}{\toks_set:Nf}
-% \begin{macro}{\toks_set:cn}
-% \begin{macro}{\toks_set:co}
-% \begin{macro}{\toks_set:cV}
-% \begin{macro}{\toks_set:cv}
-% \begin{macro}{\toks_set:cx}
-% \begin{macro}{\toks_set:cf}
-% |\toks_set:Nn|\m{toks}\m{stuff} stores \m{stuff} without expansion
-% in \m{toks}. |\toks_set:No| and |\toks_set:Nx| expand \m{stuff} once
-% and fully.
-% \begin{macrocode}
-%<*check>
-\cs_new_protected_nopar:Npn \toks_set:Nn #1 { \chk_local:N #1 #1 }
-\cs_generate_variant:Nn \toks_set:Nn {No,Nf}
-%</check>
-% \end{macrocode}
-% If we don't check if \m{toks} is a local register then the
-% |\toks_set:Nn| function has nothing to do.
-% We implement |\toks_set:No|/|d|/|f| by hand when not checking because this
-% is going to be used \emph{extensively} in keyval processing!
-% TODO: (Will) Can we get some numbers published on how necessary this is?
-% On the other hand I'm happy to believe Morten |:)|
-% \begin{macrocode}
-%<*!check>
-\cs_new_eq:NN \toks_set:Nn \prg_do_nothing:
-\cs_new_protected:Npn \toks_set:NV #1#2 {
- #1 \exp_after:wN { \int_to_roman:w -`0 \exp_eval_register:N #2 }
-}
-\cs_new_protected:Npn \toks_set:Nv #1#2 {
- #1 \exp_after:wN { \int_to_roman:w -`0 \exp_eval_register:c {#2} }
-}
-\cs_new_protected:Npn \toks_set:No #1#2 { #1 \exp_after:wN {#2} }
-\cs_new_protected:Npn \toks_set:Nf #1#2 {
- #1 \exp_after:wN { \int_to_roman:w -`0#2 }
-}
-%</!check>
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_set:Nn {Nx,cn,cV,cv,co,cx,cf}
-% \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}
-%
-% \begin{macro}{\toks_gset:Nn}
-% \begin{macro}{\toks_gset:NV}
-% \begin{macro}{\toks_gset:No}
-% \begin{macro}{\toks_gset:Nx}
-% \begin{macro}{\toks_gset:cn}
-% \begin{macro}{\toks_gset:cV}
-% \begin{macro}{\toks_gset:co}
-% \begin{macro}{\toks_gset:cx}
-% These functions are the global variants of the above.
-% \begin{macrocode}
-%<check>\cs_new_protected_nopar:Npn \toks_gset:Nn #1 { \chk_global:N #1 \pref_global:D #1 }
-%<!check>\cs_new_eq:NN \toks_gset:Nn \pref_global:D
-\cs_generate_variant:Nn \toks_gset:Nn {NV,No,Nx,cn,cV,co,cx}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\toks_set_eq:NN}
-% \begin{macro}{\toks_set_eq:Nc}
-% \begin{macro}{\toks_set_eq:cN}
-% \begin{macro}{\toks_set_eq:cc}
-% \begin{macro}{\toks_gset_eq:NN}
-% \begin{macro}{\toks_gset_eq:Nc}
-% \begin{macro}{\toks_gset_eq:cN}
-% \begin{macro}{\toks_gset_eq:cc}
-% |\toks_set_eq:NN|\m{toks1}\m{toks2} copies the contents of \m{toks2}
-% in \m{toks1}.
-% \begin{macrocode}
-%<*check>
-\cs_new_protected_nopar:Npn\toks_set_eq:NN #1#2 {
- \chk_local:N #1
- \chk_var_or_const:N #2
- #1 #2
-}
-\cs_new_protected_nopar:Npn\toks_gset_eq:NN #1#2 {
- \chk_global:N #1
- \chk_var_or_const:N #2
- \pref_global:D #1 #2
-}
-%</check>
-%<*!check>
-\cs_new_eq:NN \toks_set_eq:NN \prg_do_nothing:
-\cs_new_eq:NN \toks_gset_eq:NN \pref_global:D
-%</!check>
-\cs_generate_variant:Nn \toks_set_eq:NN {Nc,cN,cc}
-\cs_generate_variant:Nn \toks_gset_eq:NN {Nc,cN,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\toks_clear:N,\toks_gclear:N,\toks_clear:c,\toks_gclear:c}
-% These functions clear a token register, either locally or globally.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_clear:N #1 {
- #1\c_empty_toks
-%<check>\chk_local_or_pref_global:N #1
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_gclear:N {
-%<check> \pref_global_chk:
-%<!check> \pref_global:D
- \toks_clear:N
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_clear:N {c}
-\cs_generate_variant:Nn \toks_gclear:N {c}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\toks_use_clear:N}
-% \begin{macro}{\toks_use_clear:c}
-% \begin{macro}{\toks_use_gclear:N}
-% \begin{macro}{\toks_use_gclear:c}
-% These functions clear a token register (locally or globally) after
-% returning the contents.
-%
-% They make sure that clearing the register does not
-% interfere with following tokens. In other words, the contents of
-% the register might operate on what follows in the input stream.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_use_clear:N #1 {
- \exp_last_unbraced:NNV \toks_clear:N #1 #1
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_use_gclear:N {
-%<check> \pref_global_chk:
-%<!check> \pref_global:D
- \toks_use_clear:N
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_use_clear:N {c}
-\cs_generate_variant:Nn \toks_use_gclear:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\toks_show:N}
-% \begin{macro}{\toks_show:c}
-% This function shows the contents of a token register on the terminal.
-% \begin{macrocode}
-\cs_new_eq:NN \toks_show:N \kernel_register_show:N
-\cs_generate_variant:Nn \toks_show:N {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Adding to token registers' contents}
-%
-% \begin{macro}{\toks_put_left:Nn}
-% \begin{macro}{\toks_put_left:NV}
-% \begin{macro}{\toks_put_left:No}
-% \begin{macro}{\toks_put_left:Nx}
-% \begin{macro}{\toks_put_left:cn}
-% \begin{macro}{\toks_put_left:cV}
-% \begin{macro}{\toks_put_left:co}
-% \begin{macro}{\toks_gput_left:Nn}
-% \begin{macro}{\toks_gput_left:NV}
-% \begin{macro}{\toks_gput_left:No}
-% \begin{macro}{\toks_gput_left:Nx}
-% \begin{macro}{\toks_gput_left:cn}
-% \begin{macro}{\toks_gput_left:cV}
-% \begin{macro}{\toks_gput_left:co}
-% \begin{macro}[aux]{\toks_put_left_aux:w}
-% |\toks_put_left:Nn |\meta{toks}\meta{stuff\/} adds the tokens of
-% \textsl{stuff} on the `left-side' of the token register
-% \m{toks}. |\toks_put_left:No| does the same, but expands the
-% tokens once. We need to look out for brace stripping so we add a
-% token, which is then later removed.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_put_left:Nn #1 {
- \exp_after:wN \toks_put_left_aux:w \exp_after:wN \q_nil
- \toks_use:N #1 \q_stop #1
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_put_left:Nn {NV,No,Nx,cn,co,cV}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_gput_left:Nn {
-%<check> \pref_global_chk:
-%<!check> \pref_global:D
- \toks_put_left:Nn
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_gput_left:Nn {NV,No,Nx,cn,cV,co}
-% \end{macrocode}
-% A helper function for |\toks_put_left:Nn|. Its arguments are
-% subsequently the tokens of \meta{stuff\/}, the token register
-% \meta{toks} and the current contents of \meta{toks}. We make sure to
-% remove the token we inserted earlier.
-% \begin{macrocode}
-\cs_new:Npn \toks_put_left_aux:w #1\q_stop #2#3 {
- #2 \exp_after:wN { \use_i:nn {#3} #1 }
-%<check> \chk_local_or_pref_global:N #2
-}
-% \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}
-% \end{macro}
-%
-% \begin{macro}{\toks_put_right:Nn}
-% \begin{macro}{\toks_put_right:NV}
-% \begin{macro}{\toks_put_right:No}
-% \begin{macro}{\toks_put_right:Nx}
-% \begin{macro}{\toks_put_right:cn}
-% \begin{macro}{\toks_put_right:cV}
-% \begin{macro}{\toks_put_right:co}
-% \begin{macro}{\toks_gput_right:Nn}
-% \begin{macro}{\toks_gput_right:NV}
-% \begin{macro}{\toks_gput_right:No}
-% \begin{macro}{\toks_gput_right:Nx}
-% \begin{macro}{\toks_gput_right:cn}
-% \begin{macro}{\toks_gput_right:cV}
-% \begin{macro}{\toks_gput_right:co}
-% These macros add a list of tokens to the right of a token register.
-% \begin{macrocode}
-\cs_new_protected:Npn \toks_put_right:Nn #1#2 {
- #1 \exp_after:wN { \toks_use:N #1 #2 }
-%<check> \chk_local_or_pref_global:N #1
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \toks_gput_right:Nn {
-%<check> \pref_global_chk:
-%<!check> \pref_global:D
- \toks_put_right:Nn
-}
-% \end{macrocode}
-% A couple done by hand for speed.
-% \begin{macrocode}
-%<check>\cs_generate_variant:Nn \toks_put_right:Nn {No}
-%<*!check>
-\cs_new_protected:Npn \toks_put_right:NV #1#2 {
- #1 \exp_after:wN \exp_after:wN \exp_after:wN {
- \exp_after:wN \toks_use:N \exp_after:wN #1
- \int_to_roman:w -`0 \exp_eval_register:N #2
- }
-}
-\cs_new_protected:Npn \toks_put_right:No #1#2 {
- #1 \exp_after:wN \exp_after:wN \exp_after:wN {
- \exp_after:wN \toks_use:N \exp_after:wN #1 #2
- }
-}
-%</!check>
-\cs_generate_variant:Nn \toks_put_right:Nn {Nx,cn,cV,co}
-\cs_generate_variant:Nn \toks_gput_right:Nn {NV,No,Nx,cn,cV,co}
-% \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}{\toks_put_right:Nf}
-% We implement |\toks_put_right:Nf| by hand because I think I might
-% use it in the \textsf{l3keyval} module in which case it is going to
-% be used a lot.
-% \begin{macrocode}
-%<check>\cs_generate_variant:Nn \toks_put_right:Nn {Nf}
-%<*!check>
-\cs_new_protected:Npn \toks_put_right:Nf #1#2 {
- #1 \exp_after:wN \exp_after:wN \exp_after:wN {
- \exp_after:wN \toks_use:N \exp_after:wN #1 \int_to_roman:w -`0#2
- }
-}
-%</!check>
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Predicates and conditionals}
-%
-% \begin{macro}{\toks_if_empty_p:N,\toks_if_empty_p:c}
-% \begin{macro}[TF]{\toks_if_empty:N,\toks_if_empty:c}
-% |\toks_if_empty:NTF|\m{toks}\m{true code}\m{false code} tests if a
-% token register is empty and executes either \m{true code} or
-% \m{false code}. This test had the advantage of being
-% expandable. Otherwise one has to do an |x| type expansion in order
-% to prevent problems with parameter tokens.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \toks_if_empty:N {p,TF,T,F} {
- \tl_if_empty:VTF #1 {\prg_return_true:} {\prg_return_false:}
-}
-% \end{macrocode}
-% \begin{macrocode}
-\cs_generate_variant:Nn \toks_if_empty_p:N {c}
-\cs_generate_variant:Nn \toks_if_empty:NTF {c}
-\cs_generate_variant:Nn \toks_if_empty:NT {c}
-\cs_generate_variant:Nn \toks_if_empty:NF {c}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\toks_if_eq_p:NN,\toks_if_eq_p:cN,\toks_if_eq_p:Nc,\toks_if_eq_p:cc}
-% \begin{macro}[TF]{\toks_if_eq:NN,\toks_if_eq:Nc,\toks_if_eq:cN,\toks_if_eq:cc}
-% This function test whether two token registers have the same contents.
-% \begin{macrocode}
-\prg_new_conditional:Nnn \toks_if_eq:NN {p,TF,T,F} {
- \str_if_eq:xxTF {\toks_use:N #1} {\toks_use:N #2}
- {\prg_return_true:} {\prg_return_false:}
-}
-\cs_generate_variant:Nn \toks_if_eq_p:NN {Nc,c,cc}
-\cs_generate_variant:Nn \toks_if_eq:NNTF {Nc,c,cc}
-\cs_generate_variant:Nn \toks_if_eq:NNT {Nc,c,cc}
-\cs_generate_variant:Nn \toks_if_eq:NNF {Nc,c,cc}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Variables and constants}
-%
-% \begin{macro}{\l_tmpa_toks}
-% \begin{macro}{\l_tmpb_toks}
-% \begin{macro}{\l_tmpc_toks}
-% \begin{macro}{\g_tmpa_toks}
-% \begin{macro}{\g_tmpb_toks}
-% \begin{macro}{\g_tmpc_toks}
-% Some scratch registers \ldots
-% \begin{macrocode}
-\tex_toksdef:D \l_tmpa_toks = 255\scan_stop:
-%<initex>\seq_put_right:Nn \g_toks_allocation_seq {255}
-\toks_new:N \l_tmpb_toks
-\toks_new:N \l_tmpc_toks
-\toks_new:N \g_tmpa_toks
-\toks_new:N \g_tmpb_toks
-\toks_new:N \g_tmpc_toks
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\c_empty_toks}
-% And here is a constant, which is a (permanently) empty token register.
-% \begin{macrocode}
-\toks_new:N \c_empty_toks
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\l_tl_replace_toks}
-% And here is one for tl vars. Can't define it there as the allocation
-% isn't set up at that point.
-% \begin{macrocode}
-\toks_new:N \l_tl_replace_toks
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput
-
diff --git a/Master/texmf-dist/source/latex/expl3/l3vers.dtx b/Master/texmf-dist/source/latex/expl3/l3vers.dtx
deleted file mode 100644
index 0fd96493361..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3vers.dtx
+++ /dev/null
@@ -1,96 +0,0 @@
-% \iffalse
-%% File: l3vers.dtx Copyright (C) 1990-2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%<*driver|package>
-\RequirePackage{l3names}
-%</driver|package>
-%\fi
-\GetIdInfo$Id: l3vers.dtx 1776 2010-02-07 21:51:23Z joseph $
- {L3 Experimental LaTeX format version}
-%\iffalse
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
- \DocInput{l3vers.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \begin{documentation}
-%
-% \section{Version Identification}
-%
-% This is a very simple file: it simply identifies the version of
-% \LaTeX3 in use and sets \cs{tex_everyjob:D}.
-%
-% \begin{variable}{
-% \c_format_name|
-% \c_format_date
-%}
-% Name and date of the format.
-% \end{variable}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-%\begin{macro}{\c_format_name}
-%\begin{macro}{\c_format_date}
-% Just the information required: remember to update it.
-% \begin{macrocode}
-%<*initex>
-\tl_const:Nn \c_format_name { Experimental~LaTeX3 }
-\tl_const:Nn \c_format_date { 2009/12/23 }
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-% This startup banner.
-% \begin{macrocode}
-\tex_everyjob:D {
- \iow_term:x { \c_format_name , ~ < \c_format_date > }
-}
-\iow_term:x { \c_format_name , ~ < \c_format_date > }
-%</initex>
-% \end{macrocode}
-%
-% \end{implementation}
-%
-%\PrintIndex
-%
-%\endinput
-
diff --git a/Master/texmf-dist/source/latex/expl3/l3xref.dtx b/Master/texmf-dist/source/latex/expl3/l3xref.dtx
deleted file mode 100644
index 00245b085bb..00000000000
--- a/Master/texmf-dist/source/latex/expl3/l3xref.dtx
+++ /dev/null
@@ -1,377 +0,0 @@
-% \iffalse
-%% File: l3xref.dtx Copyright (C) 2006,2009 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 ``expl3 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 LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%
-%<*driver|package|testfile>
-\RequirePackage{l3names}
-%</driver|package|testfile>
-%\fi
-\GetIdInfo$Id: l3xref.dtx 2223 2011-04-09 12:57:14Z will $
- {L3 Experimental cross referencing}
-%\iffalse
-%<*testfile>
-\ProvidesFile{\jobname.tex}
- [\filedate\space v\fileversion\space\filedescription]
-%</testfile>
-%<*driver>
-%\fi
-\ProvidesFile{\filename.\filenameext}
- [\filedate\space v\fileversion\space\filedescription]
-%\iffalse
-\documentclass[full]{l3doc}
-\begin{document}
-\DocInput{\filename.\filenameext}
-\end{document}
-%</driver>
-% \fi
-%
-%
-% \title{The \textsf{l3xref} package\thanks{This file
-% has version number \fileversion, last
-% revised \filedate.}\\
-% Cross references}
-% \author{\Team}
-% \date{\filedate}
-% \maketitle
-%
-% \begin{documentation}
-%
-% \begin{function}{\xref_set_label:n}
-% \begin{syntax}
-% "\xref_set_label:n" \Arg{name}
-% \end{syntax}
-% Sets a label in the text. Note that this function does not do
-% anything else than setting the correct labels. In particular, it
-% does not try to fix any spacing around the write node; this is a
-% task for the \textsf{galley2} module.
-% \end{function}
-%
-% \begin{function}{\xref_new:nn}
-% \begin{syntax}
-% "\xref_new:nn" \Arg{type} \Arg{value}
-% \end{syntax}
-% Defines a new cross reference type <type>. This defines the token
-% list variable |\l_xref_curr_|<type>|_tl| with default value
-% <value> which gets written fully expanded when |\xref_set_label:n|
-% is called.
-% \end{function}
-%
-%
-% \begin{function}{\xref_deferred_new:nn}
-% \begin{syntax}
-% "\xref_deferred_new:nn" \Arg{type} \Arg{value}
-% \end{syntax}
-% Same as |\xref_new:n| except for this one, the value written
-% happens when \TeX\ ships out the page. Page numbers use this one
-% obviously.
-% \end{function}
-%
-% \begin{function}{\xref_get_value:nn / (EXP)}
-% \begin{syntax}
-% "\xref_get_value:nn" \Arg{type} \Arg{name}
-% \end{syntax}
-% Extracts the cross reference information of type <type> for the
-% label <name>. This operation is expandable.
-% \end{function}
-%
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3xref} implementation}
-%
-% \subsection{Internal functions and variables}
-%
-% \begin{variabledoc}{ \g_xref_all_curr_immediate_fields_prop |
-% \g_xref_all_curr_deferred_fields_prop }
-% What they say they are ":)"
-% \end{variabledoc}
-%
-% \begin{variabledoc}{ \xref_write }
-% A stream for writing cross references, although they are not required
-% to be in a separate file.
-% \end{variabledoc}
-%
-% \begin{function}{\xref_define_label:nn}
-% \begin{syntax}
-% "\xref_define_label:nn" \Arg{name} \Arg{plist contents}
-% \end{syntax}
-% Define the property list for each label; used internally by
-% "\xref_set_label:n".
-% \end{function}
-%
-% \subsection{Module code}
-%
-% We start by ensuring that the required packages are loaded.
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\filename}{\filedate}{\fileversion}{\filedescription}
-\package_check_loaded_expl:
-%</package>
-%<*initex|package>
-% \end{macrocode}
-%
-% There are two kinds of information, namely information which is
-% \emph{immediate} like a section title and then there's \emph{deferred}
-% information like page numbers. Each reference type belong to one of
-% these categories, which we save internally as the property lists
-% |\g_xref_all_curr_immediate_fields_prop| and
-% |\g_xref_all_curr_deferred_fields_prop| and the reference type
-% \meta{xyz} exists as the key-info pair |\xref_|\meta{xyz}|_key|
-% |{\l_xref_curr_|\meta{xyz}|_tl}| on one of these lists. This way each
-% new entry type is just added as another key-info pair.
-%
-% When the cross references are generated at the beginning of the
-% document each will turn into a control sequence. Thus |\label{mylab}|
-% will internally refer to the property list |\g_xref_mylab_prop|.
-%
-% The extraction of values from this property list can be done in
-% several different ways but we want to keep the operation
-% expandable. Therefore we use a dedicated function for each type of
-% cross reference, which looks like this:
-% \begin{verbatim}
-% \xref_get_value_xyz_aux:w -> #1 \xref_xyz_key #2#3\q_nil{#2}
-% \end{verbatim}
-% This will throw away all the bits we don't need. In case |xyz| is
-% the first on the |mylab| property list |#1| is empty, if it's the
-% last key-info pair |#3| is empty. The value of the field can be
-% extracted with the function |\xref_get_value:nn| where the first
-% argument is the type and the second the label name so here it would
-% be |\xref_get_value:nn| |{xyz}| |{mylab}|.
-%
-% \begin{macro}{\g_xref_all_curr_immediate_fields_prop}
-% \begin{macro}{\g_xref_all_curr_deferred_fields_prop}
-% The two main property lists for storing information. They contain
-% key-info pairs for all known types.
-% \begin{macrocode}
-\prop_new:N \g_xref_all_curr_immediate_fields_prop
-\prop_new:N \g_xref_all_curr_deferred_fields_prop
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\xref_new:nn}
-% \begin{macro}{\xref_deferred_new:nn}
-% \begin{macro}[aux]{\xref_new_aux:nnn}
-% Setting up a new cross reference type is fairly straight forward
-% when we follow the game plan mentioned earlier.
-% \begin{macrocode}
-\cs_new_nopar:Npn \xref_new:nn {\xref_new_aux:nnn{immediate}}
-\cs_new_nopar:Npn \xref_deferred_new:nn {\xref_new_aux:nnn{deferred}}
-\cs_new_nopar:Npn \xref_new_aux:nnn #1#2#3{
-% \end{macrocode}
-% First put the new type in the relevant property list.
-% \begin{macrocode}
- \prop_gput:ccx {g_xref_all_curr_ #1 _fields_prop}
- { xref_ #2 _key }
- { \exp_not:c {l_xref_curr_#2_tl }}
-% \end{macrocode}
-% Then define the key to be a protected macro.\footnote{We could also
-% set it equal to \cs{scan_stop:} but this just feels ``cleaner''.}
-% \begin{macrocode}
- \cs_set_protected_nopar:cpn { xref_#2_key }{}
- \tl_new:cn{l_xref_curr_#2_tl}{#3}
-% \end{macrocode}
-% Now for the function extracting the value of a reference. We could
-% do this with a simple |\prop_if_in| thing put since we want to do
-% things in an expandable way we make a separate grabber for each
-% type---this is also faster. The grabber function can be defined by
-% using an intricate construction of |\exp_after:wN| and other goodies
-% but I prefer readable code. The end result for the input |xyz| is
-% \begin{verbatim}
-% \cs_set_nopar:Npn\xref_get_value_xyz_aux:w #1\xref_xyz_key #2#3\q_nil{#2}
-% \end{verbatim}
-% \begin{macrocode}
- \toks_set:Nx \l_tmpa_toks {
- \exp_not:n { \cs_set_nopar:cpn {xref_get_value_#2_aux:w} ##1 }
- \exp_not:N \q_prop
- \exp_not:c { xref_#2_key }
- \exp_not:N \q_prop
- }
- \toks_use:N \l_tmpa_toks ##2 ##3\q_nil {##2}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\xref_get_value:nn}
-% Getting the correct value for a given label-type pair is a matter
-% of connecting the correct grabber functions and property list.
-% \begin{macrocode}
-\cs_new_nopar:Npn \xref_get_value:nn #1#2 {
- \cs_if_exist:cTF{g_xref_#2_prop}
- {
-% \end{macrocode}
-% This next expansion may look a little weird but it isn't if you
-% think about it!
-% \begin{macrocode}
- \exp_args:NcNc \exp_after:wN {xref_get_value_#1_aux:w}
- \toks_use:N {g_xref_#2_prop}
-% \end{macrocode}
-% Better put in the stop marker.
-% \begin{macrocode}
- \q_nil
- }
- {??}
-}
-% \end{macrocode}
-% Temporary! We expand the property list and so we can't have the
-% |\q_prop| marker just expand!
-% \begin{macrocode}
-\cs_set_nopar:Npn \exp_after:cc #1#2 {
- \exp_after:wN \exp_after:wN
- \cs:w #1\exp_after:wN\cs_end: \cs:w #2\cs_end:
-}
-\cs_set_protected:Npn \q_prop {\q_prop}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\xref_define_label:nn}
-% \begin{macro}[aux]{\xref_define_label_aux:nn}
-% Define the property list for each label. We better do this in two
-% steps because the special catcode regime is in effect and since
-% some of the info fields are very likely to contain actual text,
-% we better make sure spaces aren't ignored! As for the meaning of
-% other characters then it is a possibility to also have a field
-% containing catcode instructions which can then be activated with
-% |\etex_scantokens:D|.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \xref_define_label:nn {
- \group_begin:
- \char_set_catcode:nn {`\ }\c_ten
- \xref_define_label_aux:nn
-}
-% \end{macrocode}
-% If the label is already taken we have a multiply defined label and
-% we should do something about it. For now we don't do anything
-% spectacular.
-% \begin{macrocode}
-\cs_new_nopar:Npn \xref_define_label_aux:nn #1#2 {
- \cs_if_free:cTF{g_xref_#1_prop}
- {\prop_new:c{g_xref_#1_prop}}{\WARNING}
- \toks_gset:cn{g_xref_#1_prop}{#2}
- \group_end:
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\xref_set_label:n}
-% Then the generic command for setting a label. We expand the
-% immediate labels fully before calling the write function but make
-% sure the deferred fields aren't expanded just yet. Due to property
-% lists being implemented as token list registers we must expand the
-% `immediate' fields twice.
-% \begin{macrocode}
-\cs_set_nopar:Npn \xref_set_label:n #1{
- \cs_set_nopar:Npx \xref_tmp:w{\toks_use:N\g_xref_all_curr_immediate_fields_prop}
- \exp_args:NNx\iow_shipout_x:Nn \xref_write{
- \xref_define_label:nn {#1} {
- \xref_tmp:w
- \toks_use:N \g_xref_all_curr_deferred_fields_prop
- }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% That's it (for now).
-% \begin{macrocode}
-%</initex|package>
-% \end{macrocode}
-%
-%
-% \section{\pkg{l3xref} test file}
-%
-% \begin{macrocode}
-%<*testfile>
-\documentclass{article}
-\usepackage{l3xref}
-\ExplSyntaxOn
-\cs_set_nopar:Npn \startrecording {\iow_open:Nn \xref_write {\jobname.xref}}
-\cs_set_nopar:Npn \DefineCrossReferences {
- \group_begin:
- \ExplSyntaxNamesOn
- \InputIfFileExists{\jobname.xref}{}{}
- \group_end:
-}
-\AtBeginDocument{\DefineCrossReferences\startrecording}
-
-\xref_new:nn {name}{}
-\cs_set_nopar:Npn \setname{\tl_set:Nn\l_xref_curr_name_tl}
-\cs_set_nopar:Npn \getname{\xref_get_value:nn{name}}
-
-\xref_deferred_new:nn {page}{\thepage}
-\cs_set_nopar:Npn \getpage{\xref_get_value:nn{page}}
-
-\xref_deferred_new:nn {valuepage}{\number\value{page}}
-\cs_set_nopar:Npn \getvaluepage{\xref_get_value:nn{valuepage}}
-
-\cs_set_eq:NN \setlabel \xref_set_label:n
-
-\ExplSyntaxOff
-\begin{document}
-\pagenumbering{roman}
-
-Text\setname{This is a name}\setlabel{testlabel1}. More
-text\setname{This is another name}\setlabel{testlabel2}. \clearpage
-
-Text\setname{This is a third name}\setlabel{testlabel3}. More
-text\setname{Hello World!}\setlabel{testlabel4}. \clearpage
-
-\pagenumbering{arabic}
-
-Text\setname{Name 5}\setlabel{testlabel5}. More text\setname{Name
- 6}\setlabel{testlabel6}. \clearpage
-
-Text\setname{Name 7}\setlabel{testlabel 7}. More text\setname{Name
- 8}\setlabel{testlabel8}. \clearpage
-
-Now let's extract some values. \getname{testlabel1} on page
-\getpage{testlabel1} with value \getvaluepage{testlabel1}.
-
-Now let's extract some values. \getname{testlabel 7} on page
-\getpage{testlabel 7} with value \getvaluepage{testlabel 7}.
-\end{document}
-%</testfile>
-% \end{macrocode}
-%
-% \end{implementation}
-% \PrintIndex
-%
-% \endinput