diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-06 01:22:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-06 01:22:10 +0000 |
commit | 88ad42f78998b5210fa58a05e2e7750f897b2550 (patch) | |
tree | 6faffeb117d275760dd935be86714b25013bcec3 | |
parent | 6406190e2336a4aa3036d7d8943c14c02a4ccadf (diff) |
l3kernel 3287
git-svn-id: svn://tug.org/texlive/trunk@25306 c570f23f-e606-0410-a88d-b1316a301751
31 files changed, 1703 insertions, 939 deletions
diff --git a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf Binary files differindex b035b7dda5a..c55f7095749 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf Binary files differindex daacfdf41d7..56506b03746 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.tex b/Master/texmf-dist/doc/latex/l3kernel/interface3.tex new file mode 100644 index 00000000000..4c0a2761e92 --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.tex @@ -0,0 +1,89 @@ +% \iffalse meta-comment +% +%% File: interfaces3.tex Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +% +% \fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This document will typeset the LaTeX3 interface descriptions a single +% document. This will produce quite a large file (more than 170 pages +% currently). +% +% There is also a full version of the sources (source3.tex) which additionally +% also typesets the command implementations. +% +% Do not forget to generate the index (as explained on the terminal output +% near the end of the run)! +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\documentclass{l3doc} +\listfiles + +\begin{document} + +\title{The \LaTeX3 Interfaces} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org} + {latex-team@latex-project.org}% + }% +} + +\pagenumbering{roman} +\maketitle + +% +% First load all modules and typeset the documentation parts +% + +\input{source3body} % all the individual modules + +\clearpage + +\begingroup + \def\endash{--} + \catcode`\-\active + \def-{\futurelet\temp\indexdash} + \def\indexdash{\ifx\temp-\endash\fi} + \DelayPrintIndex +\endgroup + +\end{document} + + diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf Binary files differindex 0596bde09a5..203b3896df8 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex new file mode 100644 index 00000000000..c14d7d8eefd --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex @@ -0,0 +1,174 @@ +\iffalse meta-comment + +File l3styleguide.tex Copyright (C) 2011 The LaTeX3 Project + +It may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\documentclass{l3doc} +\usepackage{svn-multi} + +\svnid{$Id: l3styleguide.tex 2772 2011-09-07 15:07:41Z joseph $} +\def\filedate{\svnfileyear/\svnfilemonth/\svnfileday} + +\title{% + The \LaTeX3 kernel: style guide for code authors% + \thanks + {% + This file describes v\svnfilerev, + last revised \filedate. + }% +} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org}% + {latex-team@latex-project.org}% + }% +} +\date{Released \filedate} + +\begin{document} + +\maketitle + +\tableofcontents + +\section{Introduction} + +This document is intended as a style guide for authors of code and +documentation for the \LaTeX3 kernel. It covers both aspects of coding +style and the formatting of the sources. The aim of providing these +guidelines is help ensure consistency of the code and sources from +different authors. Experience suggests that in the long-term this helps +with maintenance. There will of course be places where there are +exceptions to these guidelines: common sense should always be +applied! + +\section{Documentation style} + +\LaTeX3 source and documentation should be written using the document +class \cls{l3doc} in \file{dtx} format. This class provides a number +of logical mark up elements, which should be used where possible. +In the main, this is standard \LaTeX{} practice, but there are a +few points to highlight: +\begin{itemize} + \item + Where possible, use \cs{cs} to mark up control sequences + rather than using a verbatim environment. + \item + Arguments which are given in braces should be marked using + \cs{Arg} when code-level functions are discussed, but using + \cs{marg} for document functions. + \item + The names \TeX{}, \LaTeX{}, \emph{etc}.\ use the normal logical mark + up followed by an empty group (|{}|), with the exception of |\LaTeX3|, + where the number should follow directly. + \item + Where in line verbatim text is used, it should be marked up + using the \verb=|...|= construct (\emph{i.e.}~vertical bars delimit + the verbatim text). + \item In line quotes should be marked up using the \cs{enquote} + function. + \item + Where numbers in the source have a mathematical meaning, + they should be included in math mode. Such in-line math mode + material should be marked up using |$...$| and \emph{not} + |\(...\)|. +\end{itemize} + +Line length in the source files should to be under $80$ +characters where possible, as this helps keep everything on the screen +when editing files. In the \file{dtx} format, documentation lines start +with a \texttt{\%}, which is usually followed by a space to leave a +\enquote{comment margin} at the start of each line. + +As with code indenting (see later), nested environments and arguments +should be indented by (at least) two spaces to make the nature of the nesting +clear. Thus for example a typical arrangement for the \env{function} +environment might be +\begin{verbatim*} +\begin{function}{\seq_gclear:N, \seq_gclear:c} + \begin{syntax} + \cs{seq_gclear:N} \meta{sequence} + \end{syntax} + Clears all entries from the \meta{sequence} globally. +\end{function} +\end{verbatim*} +The \enquote{outer} \verb*|% \begin{function}| should have the customary +space after the |%| character at the start of the line. + +In general, a single \env{function} or \env{macro} environment should be +used for a group of closely-related functions, for example argument +specification variants. In such cases, a comma-separated list should be +used, as shown in the preceding example. + +\section{Format of the code itself} + +The requirement for less than $80$ characters per line applies to the code +itself as well as the surrounding documentation. A number of the general +style principals for \LaTeX3 code apply: these are described in the following +paragraph and an example is then given. + +With the exception of simple runs of parameter (|{#1}|, |#1#2|, +\emph{etc.}), everything should divided up using spaces to make the code +more readable. In general, these will be single spaces, but in some +places it makes more sense to align parts of the code to emphasise +similarity. (Tabs should not be used for introducing white space.) + +Each conceptually-separate step in a function should be on a separate +line, to make the meaning clearer. Hence the \texttt{false} branch +in the example uses two lines for the two auxiliary function uses. + +Within the definition, a two-space indent should be used to show each +\enquote{level} of code. Thus in the example \cs{tl_if_empty:nTF} is +indented by two spaces, but the two branches are indented by four +spaces. Within the \texttt{false} branch, the need for multiple lines +means that an additional two-space indent should be used to show that +these lines are all part of the brace group. + +The result of these lay-out conventions is code which will in general +look like the example: +\begin{verbatim*} +\cs_new:Npn \module_foo:nn #1#2 + { + \tl_if_empty:nTF {#1} + { \module_foo_aux:n { X #2 } } + { + \module_foo_aux:nn {#1} {#2} + \module_foo_aux:n {#1#2} + } + } +\end{verbatim*} + +\section{Code conventions} + +When using \cs{cs_generate_variant:Nn}, group related variants together +to make the pattern clearer. A common example is variants of a function +which has an \texttt{N}-type first argument: +\begin{verbatim*} +\cs_generate_variant:Nn \foo:Nn { NV , No } +\cs_generate_variant:Nn \foo:Nn { c , cV , co } +\end{verbatim*} + +There are cases where omitting braces from \texttt{o}-type arguments +is desirable for performance reasons. This should only be done if the +argument is a single token, thus for example +\begin{verbatim} +\tl_set:No \l_some_tl \l_some_other_tl +\end{verbatim} +remains clear and can be used where appropriate. + +\end{document} diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf Binary files differindex 76a69eaba14..d19a6e07d19 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex new file mode 100644 index 00000000000..31b07550060 --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex @@ -0,0 +1,80 @@ +\iffalse meta-comment + +File l3syntax-changes.tex Copyright (C) 2011 The LaTeX3 Project + +It may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\documentclass{l3doc} + +\usepackage{svn-multi} + +\svnid{$Id: l3syntax-changes.tex 2772 2011-09-07 15:07:41Z joseph $} +\def\filedate{\svnfileyear/\svnfilemonth/\svnfileday} + +\title{% + Syntax changes in \LaTeX3 functions + \thanks + {% + This file describes v\svnfilerev, + last revised \filedate. + }% +} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org}% + {latex-team@latex-project.org}% + }% +} +\date{Released \filedate} + +\newcommand{\TF}{\textit{(TF)}} + +\begin{document} + +\maketitle + +This file lists functions whose syntax has changed after August 2011, +with an approximate date. + +\section{August 2011} + +\begin{itemize} + \item \cs{tl_if_single:n\TF} recognized any non-zero number of + explicit spaces as \meta{true}, and did not ignore trailing spaces. + Now it is \meta{true} for + \[ + \meta{optional spaces} + \meta{normal token or brace group} + \meta{optional spaces}. + \] + \item \cs{tl_reverse:n} stripped outer braces and lost unprotected spaces. + Now it keeps spaces, leaves unbraced single tokens unbraced, and + braced groups braced. + \item \cs{tl_trim_spaces:n} only removed one leading and trailing space. + Now removes recursively. Also, on the left it used to strip implicit + and explicit spaces with any character code. Now it strips only explicit + space characters $(32,10)$. +\end{itemize} + +\section{September 2011} + +\begin{itemize} +\item clist functions which receive an \texttt{n}-type comma list argument + now trim spaces from each item in the argument. +\end{itemize} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf Binary files differindex 5cbda1eb6e7..156c4baaf35 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.tex b/Master/texmf-dist/doc/latex/l3kernel/source3.tex new file mode 100644 index 00000000000..e8b76f8701e --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/source3.tex @@ -0,0 +1,106 @@ +% \iffalse meta-comment +% +%% File: source3.tex Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +% +% \fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This document will typeset the LaTeX3 sources as a single document. +% This will produce quite a large file (more than 400 pages). +% +% There is also a shorter version (interface3.tex) that only typesets the +% command % interface descriptions. +% +% Do not forget to generate the index (as explained on the terminal output +% near the end of the run)! +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass{l3doc} +\listfiles + +\begin{document} + +\title{The \LaTeX3 Sources} +\author{% + The \LaTeX3 Project\thanks + {% + E-mail: + \href{mailto:latex-team@latex-project.org} + {latex-team@latex-project.org}% + }% +} + +\pagenumbering{roman} +\maketitle + +% +% First load all modules and typeset the documentation parts +% + +\input{source3body} % all the individual modules + +% +% Now reload all modules and typeset the implementation parts +% + +\part{Implementation} + +\def\maketitle{} +\EnableImplementation +\DisableDocumentation +\DocInputAgain + +\clearpage +\pagestyle{headings} + +% Make TeX shut up. +\hbadness=10000 +\newcount\hbadness +\hfuzz=\maxdimen + +\PrintChanges +\clearpage + +\begingroup + \def\endash{--} + \catcode`\-\active + \def-{\futurelet\temp\indexdash} + \def\indexdash{\ifx\temp-\endash\fi} + + \DelayPrintIndex +\endgroup + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex new file mode 100644 index 00000000000..119886c86cb --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex @@ -0,0 +1,421 @@ +% \iffalse meta-comment +% +%% File: source3body.tex Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +% +% \fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This file is used by +% +% source3.tex % documentation including implementation +% +% interface3.tex % only interface documentation +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\begin{abstract} + +\setlength\parindent{0pt} +\setlength\parskip{\baselineskip} + +\noindent +This is the reference documentation for the \pkg{expl3} +programming environment. The \pkg{expl3} modules set up an experimental +naming scheme for \LaTeX{} commands, which allow the \LaTeX{} programmer +to systematically name functions and variables, and specify the argument +types of functions. + +The \TeX{} and \eTeX{} primitives are all given a new name according to +these conventions. However, in the main direct use of the primitives is +not required or encouraged: the \pkg{expl3} modules define an +independent low-level \LaTeX3 programming language. + +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}. + + New modules will be added to the distributed version of \pkg{expl3} as + they reach maturity. +\end{bfseries} + +\end{abstract} + +\clearpage + +{% + \def\\{:}% fix "newlines" in the ToC + \tableofcontents +} + +\clearpage +\pagenumbering{arabic} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Each of the following \DocInput lines includes a file with extension +% .dtx. Each of these files may be typeset separately. For instance +% pdflatex l3box.dtx +% will typeset the source of the LaTeX3 box commands. If you use the +% Makefile, the index will be generated automatically; e.g., +% make doc F=l3box +% +% If this file is processed, each of these separate dtx files will be +% contained as a part of a single document. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makeatletter +\def\partname{Part} +\def\maketitle{\clearpage\part{\@title}} +\let\thanks\@gobble +\let\DelayPrintIndex\PrintIndex +\let\PrintIndex\@empty +\makeatother + +\part{Introduction to \pkg{expl3} and this document} + +This document is intended to act as a comprehensive reference manual +for the \pkg{expl3} language. A general guide to the \LaTeX3 +programming language is found in \href{expl3.pdf}{expl3.pdf}. + +\section{Naming functions and variables} + +\LaTeX3 does not use \texttt{@} as a \enquote{letter} for defining +internal macros. Instead, the symbols |_| and \texttt{:} +are used in internal macro names to provide structure. The name of +each \emph{function} is divided into logical units using \texttt{_}, +while \texttt{:} separates the \emph{name} of the function from the +\emph{argument specifier} (\enquote{arg-spec}). This describes the arguments +expected by the function. In most cases, each argument is represented +by a single letter. The complete list of arg-spec letters for a function +is referred to as the \emph{signature} of the function. + +Each function name starts with the \emph{module} to which it belongs. +Thus apart from a small number of very basic functions, all \pkg{expl3} +function names contain at least one underscore to divide the module +name from the descriptive name of the function. For example, all +functions concerned with comma lists are in module \texttt{clist} and +begin \cs{clist_}. + +Every function must include an argument specifier. For functions which +take no arguments, this will be blank and the function name will end +\texttt{:}. Most functions take one or more arguments, and use the +following argument specifiers: +\begin{description} + \item[\texttt{D}] The \texttt{D} specifier means \emph{do not use}. + All of the \TeX{} primitives are initially \cs{let} to a \texttt{D} + name, and some are then given a second name. Only the kernel + team should use anything with a \texttt{D} specifier! + \item[\texttt{N} and \texttt{n}] These mean \emph{no manipulation}, + of a single token for \texttt{N} and of a set of tokens given in + braces for \texttt{n}. Both pass the argument through exactly as + given. Usually, if you use a single token for an \texttt{n} argument, + all will be well. + \item[\texttt{c}] This means \emph{csname}, and indicates that the + argument will be turned into a csname before being used. So + So \cs{foo:c} |{ArgumentOne}| will act in the same way as \cs{foo:N} + \cs{ArgumentOne}. + \item[\texttt{V} and \texttt{v}] These mean \emph{value + of variable}. The \texttt{V} and \texttt{v} specifiers are used to + get the content of a variable without needing to worry about the + underlying \TeX{} structure containing the data. A \texttt{V} + argument will be a single token (similar to \texttt{N}), for example + \cs{foo:V} \cs{MyVariable}; on the other hand, using \texttt{v} a + csname is constructed first, and then the value is recovered, for + example \cs{foo:v} |{MyVariable}|. + \item[\texttt{o}] This means \emph{expansion once}. In general, the + \texttt{V} and \texttt{v} specifiers are favoured over \texttt{o} + for recovering stored information. However, \texttt{o} is useful + for correctly processing information with delimited arguments. + \item[\texttt{x}] The \texttt{x} specifier stands for \emph{exhaustive + expansion}: every token in the argument is fully expanded until only + unexpandable ones remain. The \TeX{} \tn{edef} primitive carries out + this type of expansion. Functions which feature an \texttt{x}-type + argument are in general \emph{not} expandable, unless specifically + noted. + \item[\texttt{f}] The \texttt{f} specifier stands for \emph{full + expansion}, and in contrast to \texttt{x} stops at the first + non-expandable item (reading the argument from left to right) without + trying to expand it. For example, when setting a token list + variable (a macro used for storage), the sequence + \begin{verbatim} + \tl_set:Nn \l_mya_tl { A } + \tl_set:Nn \l_myb_tl { B } + \tl_set:Nf \l_mya_tl { \l_mya_tl \l_myb_tl } + \end{verbatim} + will leave |\l_mya_tl| with the content |A\l_myb_tl|, as |A| cannot + be expanded and so terminates expansion before |\l_myb_tl| is considered. + \item[\texttt{T} and \texttt{F}] For logic tests, there are the branch + specifiers \texttt{T} (\emph{true}) and \texttt{F} (\emph{false}). + Both specifiers treat the input in the same way as \texttt{n} (no + change), but make the logic much easier to see. + \item[\texttt{p}] The letter \texttt{p} indicates \TeX{} + \emph{parameters}. Normally this will be used for delimited + functions as \pkg{expl3} provides better methods for creating simple + sequential arguments. + \item[\texttt{w}] Finally, there is the \texttt{w} specifier for + \emph{weird} arguments. This covers everything else, but mainly + applies to delimited values (where the argument must be terminated + by some arbitrary string). +\end{description} +Notice that the argument specifier describes how the argument is +processed prior to being passed to the underlying function. For example, +\cs{foo:c} will take its argument, convert it to a control sequence and +pass it to \cs{foo:N}. + +Variables are named in a similar manner to functions, but begin with +a single letter to define the type of variable: +\begin{description} + \item[\texttt{c}] Constant: global parameters whose value should not + be changed. + \item[\texttt{g}] Parameters whose value should only be set globally. + \item[\texttt{l}] Parameters whose value should only be set locally. +\end{description} +Each variable name is then build up in a similar way to that of a +function, typically starting with the module\footnote{The module names are + not used in case of generic scratch registers defined in the data + type modules, e.g., the + \texttt{int} module contains some scratch variables called \cs{l_tmpa_int}, + \cs{l_tmpb_int}, and so on. In such a case adding the module name up front + to denote the module + and in the back to indicate the type, as in + \cs{l_int_tmpa_int} would be very unreadable.} name +and then a descriptive part. +Variables end with a short identifier to show the variable type: +\begin{description} + \item[\texttt{bool}] Either true or false. + \item[\texttt{box}] Box register. + \item[\texttt{clist}] Comma separated list. + \item[\texttt{coffin}] a \enquote{box with handles} --- a higher-level data + type for carrying out |box| alignment operations. + \item[\texttt{dim}] \enquote{Rigid} lengths. + \item[\texttt{fp}] floating-point values; + \item[\texttt{int}] Integer-valued count register. + \item[\texttt{prop}] Property list. + \item[\texttt{seq}] \enquote{Sequence}: a data-type used to implement lists + (with access at both ends) and stacks. + \item[\texttt{skip}] \enquote{Rubber} lengths. + \item[\texttt{stream}] An input or output stream (for reading from or + writing to, respectively). + \item[\texttt{tl}] Token list variables: placeholder for a token list. +\end{description} + +\subsection{Terminological inexactitude} + +A word of warning. In this document, and others referring to the \pkg{expl3} +programming modules, we often refer to \enquote{variables} and +\enquote{functions} as if they +were actual constructs from a real programming language. In truth, \TeX{} +is a macro processor, and functions are simply macros that may or may not take +arguments and expand to their replacement text. Many of the common variables +are \emph{also} macros, and if placed into the input stream will simply expand +to their definition as well~--- a \enquote{function} with no arguments and a +\enquote{token list variable} are in truth one and the same. On the other +hand, some \enquote{variables} are actually registers that must be +initialised and their values set and retrieved with specific functions. + +The conventions of the \pkg{expl3} code are designed to clearly separate the +ideas of \enquote{macros that contain data} and +\enquote{macros that contain code}, and a +consistent wrapper is applied to all forms of \enquote{data} whether they be +macros or +actually registers. This means that sometimes we will use phrases like +\enquote{the function returns a value}, when actually we just mean +\enquote{the macro expands to something}. Similarly, the term +\enquote{execute} might be used in place of \enquote{expand} +or it might refer to the more specific case of +\enquote{processing in \TeX's stomach} +(if you are familiar with the \TeX{}book parlance). + +If in doubt, please ask; chances are we've been hasty in writing certain +definitions and need to be told to tighten up our terminology. + +\section{Documentation conventions} + +This document is typeset with the experimental \pkg{l3doc} class; +several conventions are used to help describe the features of the code. +A number of conventions are used here to make the documentation clearer. + +Each group of related functions is given in a box. For a function with +a \enquote{user} name, this might read: +\begin{function}{\ExplSyntaxOn, \ExplSyntaxOff} + \begin{syntax} + \cs{ExplSyntaxOn} \dots{} \cs{ExplSyntaxOff} + \end{syntax} + The textual description of how the function works would appear here. The + syntax of the function is shown in mono-spaced text to the right of + the box. In this example, the function takes no arguments and so the + name of the function is simply reprinted. +\end{function} + +For programming functions, which use \texttt{_} and \texttt{:} in their name +there are a few additional conventions: If two related functions are given +with identical names but different argument specifiers, these are termed +\emph{variants} of each other, and the latter functions are printed in grey to +show this more clearly. They will carry out the same function but will take +different types of argument: +\begin{function}{\seq_new:N, \seq_new:c} + \begin{syntax} + \cs{seq_new:N} \meta{sequence} + \end{syntax} + When a number of variants are described, the arguments are usually + illustrated only for the base function. Here, \meta{sequence} indicates + that \cs{seq_new:N} expects the name of a sequence. From the argument + specifier, \cs{seq_new:c} also expects a sequence name, but as a + name rather than as a control sequence. Each argument given in the + illustration should be described in the following text. +\end{function} + +\paragraph{Fully expandable functions} +\hypertarget{expstar}{Some functions are fully expandable}, +which allows it to be used within +an \texttt{x}-type argument (in plain \TeX{} terms, inside an \cs{edef}), +as well as within an \texttt{f}-type argument. +These fully expandable functions are indicated in the documentation by +a star: +\begin{function}[EXP]{\cs_to_str:N} + \begin{syntax} + \cs{cs_to_str:N} \meta{cs} + \end{syntax} + As with other functions, some text should follow which explains how + the function works. Usually, only the star will indicate that the + function is expandable. In this case, the function expects a \meta{cs}, + shorthand for a \meta{control sequence}. +\end{function} + +\paragraph{Restricted expandable functions} +\hypertarget{rexpstar}{A few functions are fully expandable} but cannot be fully expanded within +an \texttt{f}-type argument. In this case a hollow star is used to indicate +this: +\begin{function}[rEXP]{\seq_map_function:NN} + \begin{syntax} + \cs{seq_map_function:NN} \meta{seq} \meta{function} + \end{syntax} +\end{function} + +\paragraph{Conditional functions} +\hypertarget{explTF}{Conditional (\texttt{if}) functions} +are normally defined in three variants, with +\texttt{T}, \texttt{F} and \texttt{TF} argument specifiers. This allows +them to be used for different \enquote{true}/\enquote{false} branches, +depending on +which outcome the conditional is being used to test. To indicate this +without repetition, this information is given in a shortened form: +\begin{function}[EXP,TF]{\xetex_if_engine:} + \begin{syntax} + \cs{xetex_if_engine:TF} \Arg{true code} \Arg{false code} + \end{syntax} + The underlining and italic of \texttt{TF} indicates that + \cs{xetex_if_engine:T}, \cs{xetex_if_engine:F} and + \cs{xetex_if_engine:TF} are all available. Usually, the illustration + will use the \texttt{TF} variant, and so both \meta{true code} + and \meta{false code} will be shown. The two variant forms \texttt{T} and + \texttt{F} take only \meta{true code} and \meta{false code}, respectively. + Here, the star also shows that this function is expandable. + With some minor exceptions, \emph{all} conditional functions in the + \pkg{expl3} modules should be defined in this way. +\end{function} + +Variables, constants and so on are described in a similar manner: +\begin{variable}{\l_tmpa_tl} + A short piece of text will describe the variable: there is no + syntax illustration in this case. +\end{variable} + +In some cases, the function is similar to one in \LaTeXe{} or plain \TeX{}. +In these cases, the text will include an extra \enquote{\textbf{\TeX{}hackers +note}} section: +\begin{function}[EXP]{\token_to_str:N} + \begin{syntax} + \cs{token_to_str:N} \meta{token} + \end{syntax} + The normal description text. + \begin{texnote} + Detail for the experienced \TeX{} or \LaTeXe\ programmer. In this + case, it would point out that this function is the \TeX{} primitive + \cs{string}. + \end{texnote} +\end{function} + +\section{Formal language conventions which apply generally} + +As this is a formal reference guide for \LaTeX3 programming, the descriptions +of functions are intended to be reasonably \enquote{complete}. However, there +is also a need to avoid repetition. Formal ideas which apply to general +classes of function are therefore summarised here. + +For tests which have a \texttt{TF} argument specification, the test if +evaluated to give a logically \texttt{TRUE} or \texttt{FALSE} result. +Depending on this result, either the \meta{true code} or the \meta{false code} +will be left in the input stream. In the case where the test is expandable, +and a predicate (|_p|) variant is available, the logical value determined by +the test is left in the input stream: this will typically be part of a larger +logical construct. + +\DisableImplementation + +\DocInput{l3bootstrap.dtx} +\DocInput{l3names.dtx} +\DocInput{l3basics.dtx} +\DocInput{l3expan.dtx} +\DocInput{l3prg.dtx} +\DocInput{l3quark.dtx} +\DocInput{l3token.dtx} +\DocInput{l3int.dtx} +\DocInput{l3skip.dtx} +\DocInput{l3tl.dtx} +\DocInput{l3seq.dtx} +\DocInput{l3clist.dtx} +\DocInput{l3prop.dtx} +\DocInput{l3box.dtx} +\DocInput{l3coffins.dtx} +\DocInput{l3color.dtx} +\DocInput{l3io.dtx} +\DocInput{l3msg.dtx} +\DocInput{l3keys.dtx} +\DocInput{l3file.dtx} +\DocInput{l3fp.dtx} +\DocInput{l3luatex.dtx} + +\endinput diff --git a/Master/texmf-dist/makeindex/l3kernel/l3doc.ist b/Master/texmf-dist/makeindex/l3kernel/l3doc.ist new file mode 100644 index 00000000000..464dc931e12 --- /dev/null +++ b/Master/texmf-dist/makeindex/l3kernel/l3doc.ist @@ -0,0 +1,72 @@ +%% +%% This is file `l3doc.ist', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3doc.dtx (with options: `docist') +%% +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% +%% File: l3doc.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +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 " +lethead_prefix "{\\bfseries\\hfil " +lethead_suffix "\\hfil}\\nopagebreak\n" +lethead_flag 1 +heading_prefix "{\\bfseries\\hfil " +heading_suffix "\\hfil}\\nopagebreak\n" +headings_flag 1 + +page_precedence "rnaA" +%% +%% +%% End of file `l3doc.ist'. diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 0e0e24dbb60..c8f4fedeb38 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -48,8 +48,8 @@ %<package> } \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2012/01/19} -\def\ExplFileVersion{3209} +\def\ExplFileDate{2012/01/31} +\def\ExplFileVersion{3287} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -107,8 +107,8 @@ % % 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. +% layer provided by the \LaTeX3 Project, see the accompanying +% \texttt{interface3} document. % % \end{abstract} % @@ -124,8 +124,8 @@ % 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, +% \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. % @@ -182,8 +182,8 @@ % 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{} +% different in form to the document mark-up language. For \LaTeX{}, +% this level was almost completely missing from \LaTeX{}2.09; \LaTeXe{} % made some improvements in this area but it is still the case that % implementing a design specification in \LaTeX{} requires far more % \enquote{low-level} coding than is acceptable. @@ -451,7 +451,7 @@ % 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. +% primitive |\if|\ldots{} commands. % \end{arg-description} % % In case of |n| arguments that consist of a single token the @@ -703,7 +703,7 @@ % \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 +% 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. % @@ -821,8 +821,7 @@ % \item Where possible, declare all variables and functions (using % \cs{cs_new:Npn}, \cs{tl_new:N}, etc.) before use. % \item Prefer \enquote{higher-level} functions over \enquote{lower-level}, -% where -% possible. So for example use \cs{cs_if_exist:N(TF)} in preference +% where possible. So for example use \cs{cs_if_exist:N(TF)} in preference % \cs{if_cs_exist:N}. % \item Use space to make code readable. In general, we recommend % a layout such as: @@ -835,7 +834,7 @@ % } % \end{verbatim} % where spaces are used around |{| and |}| except for isolated -% |#1|, |#2|, etc. +% |#1|, |#2|, \emph{etc.} % \item Put different code items on separate lines: readability is % much more useful than compactness. % \item Use long, descriptive names for functions and variables, @@ -844,6 +843,34 @@ % \item If in doubt, ask the team via the LaTeX-L list: someone will % soon get back to you! % \end{itemize} +% +% \section{Load-time options for \pkg{expl3}} +% +% To support code authors, the \pkg{expl3} package for \LaTeXe{} includes +% a small number of load-time options. These all work in a key--value +% sense, recognising the \texttt{true} and \texttt{false} values. Giving +% the option name alone is equivalent to using the option with the +% \texttt{true} value. +% +% \DescribeOption{check-declarations} +% All variables used in \LaTeX3 code should be declared. This is enforced +% by \TeX{} for variable types based on \TeX{} registers, but not for those +% which are constructed using macros as the underlying storage system. The +% \texttt{check-declarations} option enables checking for all variable +% assignments, issuing an error if any variables are assigned without being +% initialised. +% +% \DescribeOption{log-functions} +% The \texttt{log-functions} option is used to enable recording of every new +% function name in the \texttt{.log} file. This is useful for debugging +% purposes, as it means that there is a complete list of all functions +% created by each module loaded (with the exceptions of a very small number +% required by he bootstrap code for \LaTeX3). +% +% \DescribeOption{native-drivers} +% The \texttt{native-drivers} option instructs \LaTeX3 not to use the \LaTeXe{} +% graphics and colour driver code. Setting this option \texttt{true} uses the +% driver code intended for a \LaTeX3 format. % % \section{The \LaTeX3 Project} % @@ -914,40 +941,38 @@ \reserveinserts{32} % \end{macrocode} % -% We want \pkg{calc} to allow \LaTeXe{} to do \eTeX{}-like setting (which will -% be native in \LaTeX3). -% \begin{macrocode} -\RequirePackage{calc} -% \end{macrocode} -% % Do the package identification: this will turn on code syntax. % \begin{macrocode} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % \end{macrocode} % +% \begin{macro}[aux]{\expl@create@bool@option} % \begin{variable} % { -% \l@expl@check@declarations@bool, -% \l@expl@log@functions@bool, +% \l@expl@check@declarations@bool , +% \l@expl@log@functions@bool , % \l@expl@native@drivers@bool % } -% A couple of package options to be provided. +% Options to be set up. % These have to be done by hand as there is no \pkg{expl3} yet: the logging % option is needed before loading \pkg{l3basics}! % \begin{macrocode} -\newcommand* \l@expl@check@declarations@bool { 0 } -\newcommand* \l@expl@log@functions@bool { 0 } -\newcommand* \l@expl@native@drivers@bool { 0 } -\DeclareOption { check-declarations } - { \def \l@expl@check@declarations@bool { 1 } } -\DeclareOption { log-functions } - { \def \l@expl@log@functions@bool { 1 } } -\DeclareOption { native-drivers } - { \def \l@expl@native@drivers@bool { 1 } } +\newcommand \expl@create@bool@option [ 2 ] + { + \DeclareOption {#1} { \renewcommand* #2 { 1 } } + \DeclareOption { #1 = true } { \renewcommand* #2 { 1 } } + \DeclareOption { #1 = false } { \renewcommand* #2 { 0 } } + \newcommand* #2 { 0 } + } +\expl@create@bool@option { check-declarations } \l@expl@check@declarations@bool +\expl@create@bool@option { log-functions } \l@expl@log@functions@bool +\expl@create@bool@option { native-drivers } \l@expl@native@drivers@bool \ProcessOptions \relax +\let \expl@create@bool@option \@undefined % \end{macrocode} % \end{variable} +% \end{macro} % % \begin{macrocode} \ifodd \l@expl@native@drivers@bool \relax @@ -1199,6 +1224,7 @@ \char_set_catcode:nn { 9 } { \char_value_catcode:n { 9 } } \char_set_catcode:nn { 32 } { \char_value_catcode:n { 32 } } \char_set_catcode:nn { 34 } { \char_value_catcode:n { 34 } } + \char_set_catcode:nn { 36 } { \char_value_catcode:n { 36 } } \char_set_catcode:nn { 38 } { \char_value_catcode:n { 38 } } \char_set_catcode:nn { 58 } { \char_value_catcode:n { 58 } } \char_set_catcode:nn { 94 } { \char_value_catcode:n { 94 } } @@ -1213,6 +1239,7 @@ \char_set_catcode_ignore:n { 9 } % tab \char_set_catcode_ignore:n { 32 } % space \char_set_catcode_other:n { 34 } % double quote + \char_set_catcode_math_toggle:n { 36 } % dollar \char_set_catcode_alignment:n { 38 } % ampersand \char_set_catcode_letter:n { 58 } % colon \char_set_catcode_math_superscript:n { 94 } % circumflex diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins deleted file mode 100644 index b4048d009e5..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3.ins +++ /dev/null @@ -1,71 +0,0 @@ -\iffalse meta-comment - -File l3.ins Copyright (C) 2011 The LaTeX3 Project - -It may be distributed and/or modified under the conditions of the -LaTeX Project Public License (LPPL), either version 1.3c of this -license or (at your option) any later version. The latest version -of this license is in the file - - http://www.latex-project.org/lppl.txt - -This file is part of the "l3kernel bundle" (The Work in LPPL) -and all files in that bundle must be distributed together. - -The released version of this bundle is available from CTAN. - -\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 - -\keepsilent - -% ===== PACKAGE ONLY ====== -\generate{\file{expl3.sty} {\from{expl3.dtx} {package}}} -% ======================== -\generate{\file{l3bootstrap.sty}{\from{l3bootstrap.dtx}{package}}} -\generate{\file{l3names.sty} {\from{l3names.dtx} {package}}} -\generate{\file{l3basics.sty} {\from{l3basics.dtx} {package}}} -\generate{\file{l3expan.sty} {\from{l3expan.dtx} {package}}} -\generate{\file{l3tl.sty} {\from{l3tl.dtx} {package}}} -\generate{\file{l3seq.sty} {\from{l3seq.dtx} {package}}} -\generate{\file{l3int.sty} {\from{l3int.dtx} {package}}} -\generate{\file{l3quark.sty} {\from{l3quark.dtx} {package}}} -\generate{\file{l3prg.sty} {\from{l3prg.dtx} {package}}} -\generate{\file{l3clist.sty} {\from{l3clist.dtx} {package}}} -\generate{\file{l3token.sty} {\from{l3token.dtx} {package}}} -\generate{\file{l3prop.sty} {\from{l3prop.dtx} {package}}} -\generate{\file{l3msg.sty} {\from{l3msg.dtx} {package}}} -\generate{\file{l3io.sty} {\from{l3io.dtx} {package}}} -\generate{\file{l3file.sty} {\from{l3file.dtx} {package}}} -\generate{\file{l3skip.sty} {\from{l3skip.dtx} {package}}} -\generate{\file{l3keys.sty} {\from{l3keys.dtx} {package}}} -\generate{\file{l3fp.sty} {\from{l3fp.dtx} {package}}} -\generate{\file{l3box.sty} {\from{l3box.dtx} {package}}} -\generate{\file{l3coffins.sty} {\from{l3coffins.dtx} {package}}} -\generate{\file{l3color.sty} {\from{l3color.dtx} {package}}} -\generate{\file{l3luatex.sty} {\from{l3luatex.dtx} {package}}} - -\generate{\file{l3doc.cls} {\from{l3doc.dtx} {class}}} -\generate{\file{l3doc.ist} {\from{l3doc.dtx} {docist}}} - -\generate{\file{l3dvips.def} {\from{l3drivers.dtx}{package,dvips} }} -\generate{\file{l3pdfmode.def} {\from{l3drivers.dtx}{package,pdfmode} }} -\generate{\file{l3xdvipdfmx.def}{\from{l3drivers.dtx}{package,xdvipdfmx}}} - -\endbatchfile diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index d45b8147384..f6aac3cc544 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -65,7 +65,7 @@ Do not distribute a modified version of this file. %</driver> % %<*driver|class> -\RequirePackage{expl3,xparse} +\RequirePackage{expl3,xparse,calc} %</driver|class> % % Need to protect the file metadata for any modules that load l3doc. @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2990 2011-11-23 02:32:59Z bruno $ +\GetIdInfo$Id: l3doc.dtx 3255 2012-01-28 20:31:12Z joseph $ {L3 Experimental documentation class} %</driver|class> % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index b60d534c225..12ce5b17b17 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 3158 2012-01-09 00:47:42Z bruno $ +\GetIdInfo$Id: l3file.dtx 3287 2012-01-31 22:08:14Z joseph $ {L3 Experimental file operations} %</driver|package> %<*driver> @@ -88,7 +88,7 @@ % \cs{file_input:n}. % \end{variable} % -% \begin{function}[TF]{\file_if_exist:n} +% \begin{function}[TF, updated = 2012-01-25]{\file_if_exist:n} % \begin{syntax} % \cs{file_if_exist:nTF} \Arg{file name} \Arg{true code} \Arg{false code} % \end{syntax} @@ -102,7 +102,7 @@ % \end{texnote} % \end{function} % -% \begin{function}{\file_add_path:nN} +% \begin{function}[updated = 2012-01-25]{\file_add_path:nN} % \begin{syntax} % \cs{file_add_path:nN} \Arg{file name} \meta{tl var} % \end{syntax} @@ -113,11 +113,13 @@ % \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. +% Any active characters (as declared in \cs{l_char_active_seq}) will +% \emph{not} be expanded, allowing the direct use of these in +% file names. % \end{texnote} % \end{function} % -% \begin{function}{\file_input:n} +% \begin{function}[updated = 2012-01-25]{\file_input:n} % \begin{syntax} % \cs{file_input:n} \Arg{file name} % \end{syntax} @@ -129,7 +131,34 @@ % \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. +% Any active characters (as declared in \cs{l_char_active_seq}) will +% \emph{not} be expanded, allowing the direct use of these in +% file names. +% \end{texnote} +% \end{function} +% +% \begin{function}[added = 2012-01-25]{\file_split_path_name_ext:nNNN} +% \begin{syntax} +% \cs{file_split_path_name_ext:nNNN} \Arg{name} \meta{path} \meta{filename} \meta{ext} +% \end{syntax} +% Splits the file \meta{name} into any \meta{path} (up to the last |/|), +% any \meta{ext} (from the last |.| to the end of the \meta{name}), +% and the the \meta{filename} (the rest of the \meta{name}). Thus for +% example +% \begin{verbatim} +% \file_split_path_name_ext:nNNN { figures / example.foo.eps } +% \end{verbatim} +% will result in \meta{path} \texttt{figures/}, \meta{filename} +% \texttt{example.foo} and \meta{ext} \texttt{eps}. +% The three parts of the \meta{name} will be stored in the +% token list variables given as the \meta{name}, \meta{path} and +% \meta{filename} arguments. +% \begin{texnote} +% The \meta{name} may contain both literal items and expandable +% content, which should on full expansion be the desired file name. +% Any active characters (as declared in \cs{l_char_active_seq}) will +% \emph{not} be expanded, allowing the direct use of these in +% file names. % \end{texnote} % \end{function} % @@ -291,7 +320,7 @@ % % \begin{macro}{\file_add_path:nN} % \begin{variable}{\g_file_internal_ior} -% \begin{macro}[aux]{\file_add_path_search:nN} +% \begin{macro}[aux]{\file_add_path_aux:nN, \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 @@ -300,14 +329,26 @@ % |#2| is returned empty. % \begin{macrocode} \ior_new:N \g_file_internal_ior -\cs_new_protected:Npn \file_add_path:nN #1#2 +\cs_new_protected:Npn \file_add_path:nN #1 { - \ior_open:Nn \g_file_internal_ior {#1} + \group_begin: + \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} + \tl_if_in:NnT \l_file_internal_name_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_file_internal_name_tl } + } + \exp_args:NNo \group_end: + \file_add_path_aux:nN \l_file_internal_name_tl + } +\cs_new_protected:Npn \file_add_path_aux:nN #1#2 + { + \ior_open_unsafe:Nn \g_file_internal_ior {#1} \ior_if_eof:NTF \g_file_internal_ior { \file_add_path_search:nN {#1} #2 } { \ior_close:N \g_file_internal_ior - \tl_set:Nx #2 {#1} + \tl_set:Nn #2 {#1} } } \cs_new_protected:Npn \file_add_path_search:nN #1#2 @@ -324,7 +365,7 @@ %</package> \seq_map_inline:Nn \l_file_search_path_seq { - \ior_open:Nn \g_file_internal_ior { ##1 #1 } + \ior_open_unsafe:Nn \g_file_internal_ior { ##1 #1 } \ior_if_eof:NF \g_file_internal_ior { \tl_set:Nx #2 { ##1 #1 } @@ -382,6 +423,64 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\file_split_path_name_ext:nNNN} +% \begin{macro}[aux]{\file_split_path_name_ext_aux:nNNN} +% \begin{macro}[aux]{\file_split_path:wNNN, \file_split_name_ext:wNN} +% Splits a file name into any path part, the file name and the extension, +% which is considered as the part after the last |.|. +% \begin{macrocode} +\cs_new_protected:Npn \file_split_path_name_ext:nNNN #1 + { + \group_begin: + \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} + \tl_if_in:NnT \l_file_internal_name_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_file_internal_name_tl } + } + \exp_args:NNo \group_end: + \file_split_path_name_ext_aux:nNNN \l_file_internal_name_tl + } +\cs_new_protected:Npn \file_split_path_name_ext_aux:nNNN #1#2#3#4 + { + \tl_clear:N #2 + \tl_clear:N #3 + \file_split_path:wNNN #1 / \q_nil / \q_stop #2#3#4 + } +\cs_new_protected:Npn \file_split_path:wNNN #1 / #2 / #3 \q_stop #4 + { + \quark_if_nil:nTF {#2} + { \file_split_name_ext:wNN #1 . \q_nil . \q_stop } + { + \tl_put_right:Nn #4 { #1 / } + \file_split_path:wNNN #2 / #3 \q_stop #4 + } + } +\cs_new_protected:Npn \file_split_name_ext:wNN #1 . #2 . #3 \q_stop #4#5 + { + \quark_if_nil:nTF {#2} + { + \tl_if_empty:NTF #4 + { + \tl_set:Nn #4 {#1} + \tl_clear:N #5 + } + { \tl_set:Nn #5 {#1} } + } + { + \tl_put_right:Nx #4 + { + \tl_if_empty:NF #4 { . } + #1 + } + \file_split_name_ext:wNN #2 . #3 \q_stop #4#5 + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\file_path_include:n} % \begin{macro}{\file_path_remove:n} % Wrapper functions to manage the search path. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index 48747513a4b..c86e9f269db 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3final.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% File: l3final.dtx Copyright (C) 1990-2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3final.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3final.dtx 3213 2012-01-20 11:03:46Z joseph $ {L3 Experimental format finalisation} %</driver|package> %<*driver> @@ -93,11 +93,15 @@ % \begin{macrocode} \use:n { - \char_set_catcode_space:n { 9 } - \char_set_catcode_space:n { 32 } - \char_set_catcode_math_subscript:n { 95 } - \char_set_catcode_other:n { 58 } - \char_set_catcode_active:n { 126 } + \char_set_catcode_space:n { 9 } % tab + \char_set_catcode_space:n { 32 } % space + \char_set_catcode_active:n { 34 } % double quote + \char_set_catcode_active:n { 36 } % dollar + \char_set_catcode_active:n { 38 } % ampersand + \char_set_catcode_active:n { 94 } % circumflex + \char_set_catcode_active:n { 95 } % underscore + \char_set_catcode_other:n { 58 } % colon + \char_set_catcode_active:n { 126 } % tilde \tex_endlinechar:D = 13 \scan_stop: \tex_dump:D } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins deleted file mode 100644 index ef01ceff9c7..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3format.ins +++ /dev/null @@ -1,77 +0,0 @@ -\iffalse meta-comment - -File l3format.ins Copyright (C) 2011 The LaTeX3 Project - -It may be distributed and/or modified under the conditions of the -LaTeX Project Public License (LPPL), either version 1.3c of this -license or (at your option) any later version. The latest version -of this license is in the file - - http://www.latex-project.org/lppl.txt - -This file is part of the "l3kernel bundle" (The Work in LPPL) -and all files in that bundle must be distributed together. - -The released version of this bundle is available from CTAN. - -\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 - -\keepsilent - -\generate - { - \file{l3format.ltx} - { - \from{l3bootstrap.dtx}{initex} - \from{l3names.dtx} {initex} - \from{l3basics.dtx} {initex} - \from{l3expan.dtx} {initex} - \from{l3tl.dtx} {initex} - \from{l3seq.dtx} {initex} - % ===== FORMAT ONLY ====== - \from{l3alloc.dtx} {initex} - % ======================== - \from{l3int.dtx} {initex} - \from{l3quark.dtx} {initex} - \from{l3prg.dtx} {initex} - \from{l3clist.dtx} {initex} - \from{l3token.dtx} {initex} - \from{l3prop.dtx} {initex} - \from{l3msg.dtx} {initex} - \from{l3io.dtx} {initex} - \from{l3file.dtx} {initex} - \from{l3skip.dtx} {initex} - \from{l3keys.dtx} {initex} - \from{l3fp.dtx} {initex} - \from{l3box.dtx} {initex} - \from{l3coffins.dtx} {initex} - \from{l3color.dtx} {initex} - \from{l3luatex.dtx} {initex} - % ===== FORMAT ONLY ====== - \from{l3final.dtx} {initex} - % ======================== - } - } - -\generate{\file{l3dvips.ltx} {\from{l3drivers.dtx}{initex,dvips} }} -\generate{\file{l3pdfmode.ltx} {\from{l3drivers.dtx}{initex,pdfmode} }} -\generate{\file{l3xdvipdfmx.ltx}{\from{l3drivers.dtx}{initex,xdvipdfmx}}} - -\endbatchfile
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index db82e1993a1..5b94e7ccef7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 3139 2012-01-07 19:53:09Z bruno $ +\GetIdInfo$Id: l3int.dtx 3216 2012-01-21 04:03:53Z bruno $ {L3 Experimental integers} %</driver|package> %<*driver> @@ -121,7 +121,8 @@ % \end{syntax} % Evaluates the two \meta{integer expressions} as described earlier, % then calculates the result of dividing the first value by the -% second, round any remainder. Note that this is identical to using +% second, rounding any remainder. Ties are rounded away from zero. +% Note that this is identical to using % |/| directly in an \meta{integer expression}. The result is left in % the input stream as a \meta{integer denotation} after two expansions. % \end{function} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx index da17b8f5efb..206d2daed09 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 3160 2012-01-09 02:33:23Z bruno $ +\GetIdInfo$Id: l3io.dtx 3245 2012-01-28 02:58:37Z bruno $ {L3 Experimental input-output operations} %</driver|package> %<*driver> @@ -100,7 +100,7 @@ % error. % \end{function} % -% \begin{function}[updated = 2011-12-27]{\ior_open:Nn, \ior_open:cn} +% \begin{function}[updated = 2012-01-25]{\ior_open:Nn, \ior_open:cn} % \begin{syntax} % \cs{ior_open:Nn} \meta{stream} \Arg{file name} % \end{syntax} @@ -110,9 +110,16 @@ % \meta{stream} is available for access immediately and will remain % allocated to \meta{file name} until a \cs{ior_close:N} instruction % is given or the file ends. +% \begin{texnote} +% The \meta{file name} may contain both literal items and expandable +% content, which should on full expansion be the desired file name. +% Any active characters (as declared in \cs{l_char_active_seq}) will +% \emph{not} be expanded, allowing the direct use of these in +% file names. +% \end{texnote} % \end{function} % -% \begin{function}[updated = 2011-12-27]{\iow_open:Nn, \iow_open:cn} +% \begin{function}[updated = 2012-01-25]{\iow_open:Nn, \iow_open:cn} % \begin{syntax} % \cs{iow_open:Nn} \meta{stream} \Arg{file name} % \end{syntax} @@ -124,6 +131,13 @@ % is given or the file ends. Opening a file for writing will clear % any existing content in the file (\emph{i.e.}~writing is \emph{not} % additive). +% \begin{texnote} +% The \meta{file name} may contain both literal items and expandable +% content, which should on full expansion be the desired file name. +% Any active characters (as declared in \cs{l_char_active_seq}) will +% \emph{not} be expanded, allowing the direct use of these in +% file names. +% \end{texnote} % \end{function} % % \begin{function}[updated = 2011-12-27]{\ior_close:N, \ior_close:c} @@ -410,6 +424,20 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2012-01-23] +% {\ior_open_unsafe:Nn, \iow_open_unsafe:Nn} +% \begin{syntax} +% \cs{ior_open_unsafe:Nn} \meta{stream} \Arg{file name} +% \end{syntax} +% These functions have identical syntax to the generally-available +% versions without the |_unsafe| suffix. However, these functions do not +% take precautions against active characters in the \meta{file name}: they +% are therefore intended to be used by higher-level functions which +% have already fully expanded the \meta{file name} and which need to +% perform multiple open or close operations. See for example the +% implementation of \cs{file_add_path:Nn}, +% \end{function} +% % \begin{function}{\ior_raw_new:N, \ior_raw_new:c} % \begin{syntax} % \cs{ior_raw_new:N} \meta{stream} @@ -519,6 +547,14 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_ior_internal_tl, \l_iow_internal_tl} +% For expanding file names. +% \begin{macrocode} +\tl_new:N \l_ior_internal_tl +\tl_new:N \l_iow_internal_tl +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_iow_stream_int, \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. @@ -565,16 +601,44 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\ior_open:Nn, \ior_open:cn} -% \begin{macro}{\iow_open:Nn, \iow_open:cn} +% \begin{macro}{\ior_open:Nn, \ior_open:cn, \iow_open:Nn, \iow_open:cn} +% \begin{macro}[int]{\ior_open_unsafe:Nn, \iow_open_unsafe:Nn} % 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. +% can be stored and finally the file can actually be opened. Before +% any actual file operations there is a precaution against special +% characters in file names. % \begin{macrocode} \cs_new_protected:Npn \ior_open:Nn #1#2 { + \group_begin: + \tl_to_str_active_safe:Nx \l_ior_internal_tl {#2} + \tl_if_in:NnT \l_ior_internal_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_ior_internal_tl } + } + \exp_args:NNNo \group_end: + \ior_open_unsafe:Nn #1 \l_ior_internal_tl + } +\cs_generate_variant:Nn \ior_open:Nn { c } +\cs_new_protected:Npn \iow_open:Nn #1#2 + { + \group_begin: + \tl_to_str_active_safe:Nx \l_iow_internal_tl {#2} + \tl_if_in:NnT \l_iow_internal_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_iow_internal_tl } + } + \exp_args:NNNo \group_end: + \iow_open_unsafe:Nn #1 \l_iow_internal_tl + } +\cs_generate_variant:Nn \iow_open:Nn { c } +\cs_new_protected:Npn \ior_open_unsafe: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 @@ -586,7 +650,7 @@ \tex_openin:D #1#2 \scan_stop: } } -\cs_new_protected:Npn \iow_open:Nn #1#2 +\cs_new_protected:Npn \iow_open_unsafe:Nn #1#2 { \iow_close:N #1 \int_set:Nn \l_iow_stream_int \c_sixteen @@ -599,8 +663,6 @@ \tex_immediate:D \tex_openout:D #1#2 \scan_stop: } } -\cs_generate_variant:Nn \ior_open:Nn { c } -\cs_generate_variant:Nn \iow_open:Nn { c } % \end{macrocode} % \end{macro} % \end{macro} @@ -1316,7 +1378,6 @@ % test. Then the end-of-file test must be done after reading % each line. % \begin{macrocode} -\tl_new:N \l_ior_internal_tl \cs_new_protected_nopar:Npn \ior_map_inline:nn { \ior_map_inline_aux:Nnn \ior_to:NN } \cs_new_protected_nopar:Npn \ior_str_map_inline:nn @@ -1357,6 +1418,17 @@ % \end{macro} % \end{macro} % +% \subsection{Messages} +% +% \begin{macrocode} +\msg_kernel_new:nnnn { io } { space-in-file-name } + { Space~in~file~name~'#1'. } + { + Spaces~are~not~permitted~in~files~loaded~by~LaTeX: \\ + Further~errors~may~follow! + } +% \end{macrocode} +% % \subsection{Deprecated functions} % % Deprecated on 2011-05-27, for removal by 2011-08-31. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index ccd95eb2d6f..6aa802d3ba4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 3122 2011-12-31 20:57:36Z joseph $ +\GetIdInfo$Id: l3prg.dtx 3250 2012-01-28 04:54:49Z bruno $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -555,8 +555,13 @@ % \cs{str_if_eq:nnTF} then the % associated \meta{code} is left in the input stream. If none of % the tests are \texttt{true} then the \texttt{else code} will be -% left in the input stream. The |xx| variant is fully expandable, -% in the same way as the underlying \cs{str_if_eq:xxTF} test. +% left in the input stream. The |xx| variant fully expands +% \meta{strings} before comparing them, but does not expand the +% corresponding \meta{code}. It is fully expandable, in the same way +% as the underlying \cs{str_if_eq:xxTF} test. +%^^A The \meta{test string} is expanded in each comparison, and must +%^^A always yield the same result: in particular, random numbers should +%^^A not be used within this string. % \end{function} % % \begin{function}[updated = 2011-09-17, EXP] diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 42e16e29c9e..8fd54e3388a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 3158 2012-01-09 00:47:42Z bruno $ +\GetIdInfo$Id: l3tl.dtx 3286 2012-01-31 21:57:22Z joseph $ {L3 Experimental token lists} %</driver|package> %<*driver> @@ -1016,6 +1016,17 @@ % \cs{tl_act_...} functions. % \end{variable} % +% \begin{function}[added = 2012-01-25]{\tl_to_str_active_safe:Nx} +% \begin{syntax} +% \cs{tl_to_str_active_safe:Nx} \meta{tl var} \Arg{tokens} +% \end{syntax} +% Exhaustively-expands the \meta{tokens} with the exception of any +% category \meta{active} (catcode~$12$) tokens, which are not expanded. The +% resulting \meta{expanded tokens} are then converted to a string as +% described for \cs{tl_to_str:n}. The list of \meta{active} tokens is taken +% from \cs{l_char_active_seq}. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -2182,6 +2193,27 @@ % \end{macro} % \end{macro} % +% \subsection{Specialist functions for kernel use} +% +% \begin{macro}[int]{\tl_to_str_active_safe:Nx} +% For converting a token list to a string where active characters are treated +% as strings from the start. This is needed by the file-loading modules. +% \begin{macrocode} +\cs_new_protected:Npn \tl_to_str_active_safe:Nx #1#2 + { + \group_begin: + \seq_map_inline:Nn \l_char_active_seq + { \cs_set_nopar:Npx ##1 { \token_to_str:N ##1 } } + \use:x + { + \group_end: + \tl_set:Nn \exp_not:N #1 {#2} + } + \tl_set:Nx #1 { \tl_to_str:N #1 } + } +% \end{macrocode} +%\end{macro} +% % \subsection{Viewing token lists} % % \begin{macro}{\tl_show:N, \tl_show:c} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 0c145dd47ea..107abc826ee 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3token.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% File: l3token.dtx Copyright (C) 2005-2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 3123 2011-12-31 21:51:51Z joseph $ +\GetIdInfo$Id: l3token.dtx 3234 2012-01-25 12:55:06Z joseph $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -332,6 +332,23 @@ % character code given by the \meta{integer expression} on the % terminal. % \end{function} +% +% \begin{variable}[added = 2012-01-23]{\l_char_active_seq} +% Used to track which tokens will require special handling at the document +% level as they are of category \meta{active} (catcode~$13$). Each entry in +% the sequence consists of a single active character. Active tokens should be +% added to the sequence when they are defined for general document use. +% \end{variable} +% +% \begin{variable}[added = 2012-01-23]{\l_char_special_seq} +% Used to track which tokens will require special handling when working with +% verbatim-like material at the document level as they are not of categories +% \meta{letter} (catcode~$11$) or \meta{other} (catcode~$12$). Each entry in +% the sequence consists of a single escaped token, for example |\\| for the +% backslash or |\{| for an opening brace.^^A \} +% Escaped tokens should be added to the sequence when they are defined for +% general document use. +% \end{variable} % % \section{Generic tokens} % @@ -545,7 +562,7 @@ % Tests if the two \meta{tokens} have the same meaning when expanded. % \end{function} % -% \begin{function}[updated = 2001-05-23, EXP,pTF]{\token_if_macro:N} +% \begin{function}[updated = 2011-05-23, EXP,pTF]{\token_if_macro:N} % \begin{syntax} % \cs{token_if_macro_p:N} \meta{token} \\ % \cs{token_if_macro:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -570,7 +587,7 @@ % for an undefined token. % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_long_macro:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_long_macro:N} % \begin{syntax} % \cs{token_if_long_macro_p:N} \meta{token} \\ % \cs{token_if_long_macro:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -578,7 +595,7 @@ % Tests if the \meta{token} is a long macro. % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_protected_macro:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_protected_macro:N} % \begin{syntax} % \cs{token_if_protected_macro_p:N} \meta{token} \\ % \cs{token_if_protected_macro:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -587,7 +604,7 @@ % is both protected and long will return logical \texttt{false}. % \end{function} % -%% \begin{function}[EXP,pTF]{\token_if_protected_long_macro:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_protected_long_macro:N} % \begin{syntax} % \cs{token_if_protected_long_macro_p:N} \meta{token} \\ % \cs{token_if_protected_long_macro:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -595,15 +612,19 @@ % Tests if the \meta{token} is a protected long macro. % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_chardef:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_chardef:N} % \begin{syntax} % \cs{token_if_chardef_p:N} \meta{token} \\ % \cs{token_if_chardef:NTF} \meta{token} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the \meta{token} is defined to be a chardef. +% \begin{texnote} +% Booleans, boxes and small integer constants are implemented as +% chardefs. +% \end{texnote} % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_mathchardef:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_mathchardef:N} % \begin{syntax} % \cs{token_if_mathchardef_p:N} \meta{token} \\ % \cs{token_if_mathchardef:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -611,7 +632,7 @@ % Tests if the \meta{token} is defined to be a mathchardef. % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_dim_register:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_dim_register:N} % \begin{syntax} % \cs{token_if_dim_register_p:N} \meta{token} \\ % \cs{token_if_dim_register:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -619,15 +640,19 @@ % Tests if the \meta{token} is defined to be a dimension register. % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_int_register:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_int_register:N} % \begin{syntax} % \cs{token_if_int_register_p:N} \meta{token} \\ % \cs{token_if_int_register:NTF} \meta{token} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the \meta{token} is defined to be a integer register. +% \begin{texnote} +% Constant integers may be implemented as integer registers, +% chardefs, or mathchardefs depending on their value. +% \end{texnote} % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_skip_register:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_skip_register:N} % \begin{syntax} % \cs{token_if_skip_register_p:N} \meta{token} \\ % \cs{token_if_skip_register:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -635,7 +660,7 @@ % Tests if the \meta{token} is defined to be a skip register. % \end{function} % -% \begin{function}[EXP,pTF]{\token_if_toks_register:N} +% \begin{function}[EXP,pTF, updated=2012-01-20]{\token_if_toks_register:N} % \begin{syntax} % \cs{token_if_toks_register_p:N} \meta{token} \\ % \cs{token_if_toks_register:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -644,7 +669,7 @@ % (not used by\LaTeX3). % \end{function} % -% \begin{function}[updated = 2001-05-23, EXP,pTF]{\token_if_primitive:N} +% \begin{function}[updated = 2011-05-23, EXP,pTF]{\token_if_primitive:N} % \begin{syntax} % \cs{token_if_primitive_p:N} \meta{token} \\ % \cs{token_if_primitive:NTF} \meta{token} \Arg{true code} \Arg{false code} @@ -1231,6 +1256,39 @@ \group_end: % \end{macrocode} % \end{variable} +% +% \begin{variable}{\l_char_active_seq, \l_char_special_seq} +% Two sequences for dealing with special characters. The first is characters +% which may be active, and contains the active characters themselves to +% allow easy redefinition. The second longer list is for \enquote{special} +% characters more generally, and these are escaped so that for example +% bulk code assignments can be carried out. In both cases, the order is +% by \textsc{ascii} character code (as is done in for example +% \cs{ExplSyntaxOn}). The only complication is dealing with |_|, which has to +% be done using \cs{tl_to_lowercase:n} +% \begin{macrocode} +\seq_new:N \l_char_active_seq +\use:n + { + \group_begin: + \char_set_catcode_active:N \" + \char_set_catcode_active:N \$ + \char_set_catcode_active:N \& + \char_set_catcode_active:N \^ + \char_set_catcode_active:N \_ + \char_set_catcode_active:N \~ + \use:nn + { + \group_end: + \seq_set_from_clist:Nn \l_char_active_seq + } + } + { { " , $ , & , ^ , _ , ~ } } +\seq_new:N \l_char_special_seq +\seq_set_from_clist:Nn \l_char_special_seq + { \ , \" , \# , \$ , \% , \& , \\ , \^ , \_ , \{ , \} , \~ } +% \end{macrocode} +% \end{variable} % % \subsection{Token conditionals} % @@ -1266,7 +1324,7 @@ { \if_catcode:w \exp_not:N #1 \c_math_toggle_token \prg_return_true: \else: \prg_return_false: \fi: - } + } % \end{macrocode} % \end{macro} % @@ -1493,21 +1551,24 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF]{\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} +% \begin{macro}[pTF] +% { +% \token_if_chardef:N, \token_if_mathchardef:N, +% \token_if_dim_register:N, \token_if_int_register:N, +% \token_if_skip_register:N, \token_if_toks_register:N, +% \token_if_long_macro:N, +% \token_if_protected_macro:N, \token_if_protected_long_macro:N, +% } +% \begin{macro}[aux] +% { +% \token_if_chardef_aux:w, +% \token_if_dim_register_aux:w, +% \token_if_int_register_aux:w, +% \token_if_skip_register_aux:w, +% \token_if_toks_register_aux:w, +% \token_if_protected_macro_aux:w, +% \token_if_long_macro_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 @@ -1515,13 +1576,12 @@ % 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_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 } + \tl_map_inline:nn { A C E G H I K L M O P R S U X Y Z R " } { \char_set_catcode:nn { `#1 } \c_twelve } % \end{macrocode} % We convert the token list to lower case and restore the catcode and @@ -1535,117 +1595,164 @@ % \tn{chardef} or \tn{mathchardef}. 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}. +% Grab until the first occurrence of |char"|, and compare what +% preceeds with |\| or |\math|. In fact, the escape character +% may not be a backslash, so we compare with the result of +% converting some other control sequence to a string, namely +% |\char| or |\mathchar| (the auxiliary adds the |char| back). % \begin{macrocode} \prg_new_conditional:Npnn \token_if_chardef:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_chardef_aux:w - \token_to_meaning:N #1 ?CHAR" \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_chardef_aux:w + \token_to_meaning:N #1 CHAR" \q_stop + } + { \token_to_str:N \char } } - \cs_new: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:Npnn \token_if_mathchardef:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_mathchardef_aux:w - \token_to_meaning:N #1 ?MAYHCHAR" \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_chardef_aux:w + \token_to_meaning:N #1 CHAR" \q_stop + } + { \token_to_str:N \mathchar } } - \cs_new:Npn \token_if_mathchardef_aux:w #1 ?MAYHCHAR" #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_chardef_aux:w #1 CHAR" #2 \q_stop { #1 CHAR } % \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. +% +% Dim registers are a little more difficult since their \tn{meaning} +% has the form |\dimen|\meta{number}, and we must take care of the +% two primitives \tn{dimen} and \tn{dimendef}. % \begin{macrocode} - \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF } + \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_countdef:D #1 + \if_meaning:w \tex_dimen:D #1 \prg_return_false: \else: - \exp_after:wN \token_if_int_register_aux:w - \token_to_meaning:N #1 ?COUXY \q_stop + \if_meaning:w \tex_dimendef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_dim_register_aux:w + \token_to_meaning:N #1 ZIMEX \q_stop + } + { \token_to_str:N \ } + \fi: \fi: } - \cs_new:Npn \token_if_int_register_aux:w #1 ?COUXY #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_dim_register_aux:w #1 ZIMEX #2 \q_stop { #1 ~ } % \end{macrocode} -% Skip registers are done the same way as the integer registers. +% Integer registers are one step harder since constants are implemented +% differently from variables, and we also have to take care of the +% primitives \tn{count} and \tn{countdef}. % \begin{macrocode} - \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF } + \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_skipdef:D #1 + % \token_if_chardef:NTF #1 { \prg_return_true: } + % { + % \token_if_mathchardef:NTF #1 { \prg_return_true: } + % { + \if_meaning:w \tex_count:D #1 \prg_return_false: \else: - \exp_after:wN \token_if_skip_register_aux:w - \token_to_meaning:N #1?SKIP\q_stop + \if_meaning:w \tex_countdef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_int_register_aux:w + \token_to_meaning:N #1 COUXY \q_stop + } + { \token_to_str:N \ } + \fi: \fi: + % } + % } } - \cs_new:Npn \token_if_skip_register_aux:w #1 ?SKIP #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_int_register_aux:w #1 COUXY #2 \q_stop { #1 ~ } % \end{macrocode} -% Dim registers. No news here +% Skip registers are done the same way as the dimension registers. % \begin{macrocode} - \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF } + \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_dimendef:D #1 - \c_false_bool + \if_meaning:w \tex_skip:D #1 + \prg_return_false: \else: - \exp_after:wN \token_if_dim_register_aux:w - \token_to_meaning:N #1 ?ZIMEX \q_stop + \if_meaning:w \tex_skipdef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_skip_register_aux:w + \token_to_meaning:N #1 SKIP \q_stop + } + { \token_to_str:N \ } + \fi: \fi: } - \cs_new:Npn \token_if_dim_register_aux:w #1 ?ZIMEX #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_skip_register_aux:w #1 SKIP #2 \q_stop { #1 ~ } % \end{macrocode} % Toks registers. % \begin{macrocode} \prg_new_conditional:Npnn \token_if_toks_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_toksdef:D #1 + \if_meaning:w \tex_toks:D #1 \prg_return_false: \else: - \exp_after:wN \token_if_toks_register_aux:w - \token_to_meaning:N #1 ?YOKS \q_stop + \if_meaning:w \tex_toksdef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_toks_register_aux:w + \token_to_meaning:N #1 YOKS \q_stop + } + { \token_to_str:N \ } + \fi: \fi: } - \cs_new:Npn \token_if_toks_register_aux:w #1 ?YOKS #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_toks_register_aux:w #1 YOKS #2 \q_stop { #1 ~ } % \end{macrocode} % Protected macros. % \begin{macrocode} \prg_new_conditional:Npnn \token_if_protected_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_protected_macro_aux:w - \token_to_meaning:N #1 ?PROYECYEZ~MACRO \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_protected_macro_aux:w + \token_to_meaning:N #1 PROYECYEZ~MACRO \q_stop + } + { \token_to_str:N \ } } \cs_new:Npn \token_if_protected_macro_aux:w - #1 ?PROYECYEZ~MACRO #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + #1 PROYECYEZ~MACRO #2 \q_stop { #1 ~ } % \end{macrocode} -% Long macros. +% Long macros and protected long macros share an auxiliary. % \begin{macrocode} \prg_new_conditional:Npnn \token_if_long_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_long_macro_aux:w - \token_to_meaning:N #1 ?LOXG~MACRO \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_long_macro_aux:w + \token_to_meaning:N #1 LOXG~MACRO \q_stop + } + { \token_to_str:N \ } } - \cs_new: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:Npnn \token_if_protected_long_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_protected_long_macro_aux:w - \token_to_meaning:N #1 ?PROYECYEZ?LOXG~MACRO \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_long_macro_aux:w + \token_to_meaning:N #1 LOXG~MACRO \q_stop + } + { \token_to_str:N \protected \token_to_str:N \ } } - \cs_new: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: } } + \cs_new:Npn \token_if_long_macro_aux:w #1 LOXG~MACRO #2 \q_stop { #1 ~ } % \end{macrocode} % Finally the |\tl_to_lowercase:n| ends! % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx b/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx deleted file mode 100644 index 3943db6ac1d..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3toks.dtx +++ /dev/null @@ -1,548 +0,0 @@ -% \iffalse meta-comment -% -%% File: l3toks.dtx Copyright (C) 1990-2011 The LaTeX3 project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3c of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the "l3kernel bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX3 Project. -%% -%% ----------------------------------------------------------------------- -% -%<*driver|package> -\RequirePackage{l3names} -\GetIdInfo$Id: l3toks.dtx 3086 2011-12-22 17:55:46Z bruno $ - {L3 Experimental token registers} -%</driver|package> -%<*driver> -\documentclass[full]{l3doc} -\begin{document} - \DocInput{\jobname.dtx} -\end{document} -%</driver> -% \fi -% -% \title{^^A -% The \pkg{l3toks} package\\ Token registers^^A -% \thanks{This file describes v\ExplFileVersion, -% last revised \ExplFileDate.}^^A -% } -% -% \author{^^A -% The \LaTeX3 Project\thanks -% {^^A -% E-mail: -% \href{mailto:latex-team@latex-project.org} -% {latex-team@latex-project.org}^^A -% }^^A -% } -% -% \date{Released \ExplFileDate} -% -% \maketitle -% -% \begin{documentation} -% -% \textbf{THIS ENTIRE MODULE IS DEPRECATED: DO NOT USE \cs{TOKS_\ldots} -% FUNCTIONS} -% -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3toks} implementation} -% -% We start by ensuring that the required packages are loaded. -% \begin{macrocode} -%<*package> -\ProvidesExplPackage - {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\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: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|\meta{toks}\meta{stuff} stores \meta{stuff} without expansion -% in \meta{toks}. |\toks_set:No| and |\toks_set:Nx| expand \meta{stuff} once -% and fully. -% \begin{macrocode} -%<*check> -\cs_new_protected: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 \meta{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:Npn \toks_gset:Nn #1 { \chk_global:N #1 \tex_global:D #1 } -%<!check>\cs_new_eq:NN \toks_gset:Nn \tex_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|\meta{toks1}\meta{toks2} copies the contents of \meta{toks2} -% in \meta{toks1}. -% \begin{macrocode} -%<*check> -\cs_new_protected:Npn\toks_set_eq:NN #1#2 { - \chk_local:N #1 - \chk_var_or_const:N #2 - #1 #2 -} -\cs_new_protected:Npn\toks_gset_eq:NN #1#2 { - \chk_global:N #1 - \chk_var_or_const:N #2 - \tex_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 \tex_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:Npn \toks_clear:N #1 { - #1\c_empty_toks -%<check>\chk_local_or_tex_global:N #1 -} -% \end{macrocode} -% -% \begin{macrocode} -\cs_new_protected_nopar:Npn \toks_gclear:N { -%<check> \tex_global_chk: -%<!check> \tex_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: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> \tex_global_chk: -%<!check> \tex_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 -% \meta{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: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> \tex_global_chk: -%<!check> \tex_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_tex_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_tex_global:N #1 -} -% \end{macrocode} -% -% \begin{macrocode} -\cs_new_protected_nopar:Npn \toks_gput_right:Nn { -%<check> \tex_global_chk: -%<!check> \tex_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{l3keys} 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|\meta{toks}\meta{true code}\meta{false code} tests if a -% token register is empty and executes either \meta{true code} or -% \meta{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/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 4c96696adb5..fd93024f965 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -59,23 +59,24 @@ } \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2012/01/19} -\def\ExplFileVersion{3209} +\def\ExplFileDate{2012/01/31} +\def\ExplFileVersion{3287} \RequirePackage{etex} \reserveinserts{32} -\RequirePackage{calc} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\newcommand* \l@expl@check@declarations@bool { 0 } -\newcommand* \l@expl@log@functions@bool { 0 } -\newcommand* \l@expl@native@drivers@bool { 0 } -\DeclareOption { check-declarations } - { \def \l@expl@check@declarations@bool { 1 } } -\DeclareOption { log-functions } - { \def \l@expl@log@functions@bool { 1 } } -\DeclareOption { native-drivers } - { \def \l@expl@native@drivers@bool { 1 } } +\newcommand \expl@create@bool@option [ 2 ] + { + \DeclareOption {#1} { \renewcommand* #2 { 1 } } + \DeclareOption { #1 = true } { \renewcommand* #2 { 1 } } + \DeclareOption { #1 = false } { \renewcommand* #2 { 0 } } + \newcommand* #2 { 0 } + } +\expl@create@bool@option { check-declarations } \l@expl@check@declarations@bool +\expl@create@bool@option { log-functions } \l@expl@log@functions@bool +\expl@create@bool@option { native-drivers } \l@expl@native@drivers@bool \ProcessOptions \relax +\let \expl@create@bool@option \@undefined \ifodd \l@expl@native@drivers@bool \relax \else \RequirePackage { color , graphics } @@ -265,6 +266,7 @@ \char_set_catcode:nn { 9 } { \char_value_catcode:n { 9 } } \char_set_catcode:nn { 32 } { \char_value_catcode:n { 32 } } \char_set_catcode:nn { 34 } { \char_value_catcode:n { 34 } } + \char_set_catcode:nn { 36 } { \char_value_catcode:n { 36 } } \char_set_catcode:nn { 38 } { \char_value_catcode:n { 38 } } \char_set_catcode:nn { 58 } { \char_value_catcode:n { 58 } } \char_set_catcode:nn { 94 } { \char_value_catcode:n { 94 } } @@ -279,6 +281,7 @@ \char_set_catcode_ignore:n { 9 } % tab \char_set_catcode_ignore:n { 32 } % space \char_set_catcode_other:n { 34 } % double quote + \char_set_catcode_math_toggle:n { 36 } % dollar \char_set_catcode_alignment:n { 38 } % ampersand \char_set_catcode_letter:n { 58 } % colon \char_set_catcode_math_superscript:n { 94 } % circumflex diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index d27ec84831e..33821fa37f4 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -6,6 +6,7 @@ %% %% l3doc.dtx (with options: `class') %% +%% %% EXPERIMENTAL CODE %% %% Do not distribute this file without also distributing the @@ -13,6 +14,7 @@ %% %% Do not distribute a modified version of this file. %% +%% %% File: l3doc.dtx Copyright (C) 1990-2011 The LaTeX3 project %% %% It may be distributed and/or modified under the conditions of the @@ -45,12 +47,12 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{expl3,xparse} +\RequirePackage{expl3,xparse,calc} \let \filenameOld \ExplFileName \let \filedateOld \ExplFileDate \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription -\GetIdInfo$Id: l3doc.dtx 2990 2011-11-23 02:32:59Z bruno $ +\GetIdInfo$Id: l3doc.dtx 3255 2012-01-28 20:31:12Z joseph $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty index 2ae16bd987d..f79666e640a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 3158 2012-01-09 00:47:42Z bruno $ +\GetIdInfo$Id: l3file.dtx 3287 2012-01-31 22:08:14Z joseph $ {L3 Experimental file operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -60,14 +60,26 @@ \seq_new:N \l_file_internal_saved_path_seq \seq_new:N \l_file_internal_seq \ior_new:N \g_file_internal_ior -\cs_new_protected:Npn \file_add_path:nN #1#2 +\cs_new_protected:Npn \file_add_path:nN #1 { - \ior_open:Nn \g_file_internal_ior {#1} + \group_begin: + \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} + \tl_if_in:NnT \l_file_internal_name_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_file_internal_name_tl } + } + \exp_args:NNo \group_end: + \file_add_path_aux:nN \l_file_internal_name_tl + } +\cs_new_protected:Npn \file_add_path_aux:nN #1#2 + { + \ior_open_unsafe:Nn \g_file_internal_ior {#1} \ior_if_eof:NTF \g_file_internal_ior { \file_add_path_search:nN {#1} #2 } { \ior_close:N \g_file_internal_ior - \tl_set:Nx #2 {#1} + \tl_set:Nn #2 {#1} } } \cs_new_protected:Npn \file_add_path_search:nN #1#2 @@ -82,7 +94,7 @@ } \seq_map_inline:Nn \l_file_search_path_seq { - \ior_open:Nn \g_file_internal_ior { ##1 #1 } + \ior_open_unsafe:Nn \g_file_internal_ior { ##1 #1 } \ior_if_eof:NF \g_file_internal_ior { \tl_set:Nx #2 { ##1 #1 } @@ -112,6 +124,53 @@ \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl } } +\cs_new_protected:Npn \file_split_path_name_ext:nNNN #1 + { + \group_begin: + \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} + \tl_if_in:NnT \l_file_internal_name_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_file_internal_name_tl } + } + \exp_args:NNo \group_end: + \file_split_path_name_ext_aux:nNNN \l_file_internal_name_tl + } +\cs_new_protected:Npn \file_split_path_name_ext_aux:nNNN #1#2#3#4 + { + \tl_clear:N #2 + \tl_clear:N #3 + \file_split_path:wNNN #1 / \q_nil / \q_stop #2#3#4 + } +\cs_new_protected:Npn \file_split_path:wNNN #1 / #2 / #3 \q_stop #4 + { + \quark_if_nil:nTF {#2} + { \file_split_name_ext:wNN #1 . \q_nil . \q_stop } + { + \tl_put_right:Nn #4 { #1 / } + \file_split_path:wNNN #2 / #3 \q_stop #4 + } + } +\cs_new_protected:Npn \file_split_name_ext:wNN #1 . #2 . #3 \q_stop #4#5 + { + \quark_if_nil:nTF {#2} + { + \tl_if_empty:NTF #4 + { + \tl_set:Nn #4 {#1} + \tl_clear:N #5 + } + { \tl_set:Nn #5 {#1} } + } + { + \tl_put_right:Nx #4 + { + \tl_if_empty:NF #4 { . } + #1 + } + \file_split_name_ext:wNN #2 . #3 \q_stop #4#5 + } + } \cs_new_protected:Npn \file_path_include:n #1 { \seq_if_in:NnF \l_file_search_path_seq {#1} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index 9f85bb04e58..492cc028025 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 3139 2012-01-07 19:53:09Z bruno $ +\GetIdInfo$Id: l3int.dtx 3216 2012-01-21 04:03:53Z bruno $ {L3 Experimental integers} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty index 16312914578..47f29f44e8a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 3160 2012-01-09 02:33:23Z bruno $ +\GetIdInfo$Id: l3io.dtx 3245 2012-01-28 02:58:37Z bruno $ {L3 Experimental input-output operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -81,6 +81,8 @@ \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 } +\tl_new:N \l_ior_internal_tl +\tl_new:N \l_iow_internal_tl \int_new:N \l_iow_stream_int \cs_new_eq:NN \l_ior_stream_int \l_iow_stream_int \cs_set_eq:NN \iow_raw_new:N \newwrite @@ -93,6 +95,32 @@ \cs_generate_variant:Nn \iow_new:N { c } \cs_new_protected:Npn \ior_open:Nn #1#2 { + \group_begin: + \tl_to_str_active_safe:Nx \l_ior_internal_tl {#2} + \tl_if_in:NnT \l_ior_internal_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_ior_internal_tl } + } + \exp_args:NNNo \group_end: + \ior_open_unsafe:Nn #1 \l_ior_internal_tl + } +\cs_generate_variant:Nn \ior_open:Nn { c } +\cs_new_protected:Npn \iow_open:Nn #1#2 + { + \group_begin: + \tl_to_str_active_safe:Nx \l_iow_internal_tl {#2} + \tl_if_in:NnT \l_iow_internal_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_iow_internal_tl } + } + \exp_args:NNNo \group_end: + \iow_open_unsafe:Nn #1 \l_iow_internal_tl + } +\cs_generate_variant:Nn \iow_open:Nn { c } +\cs_new_protected:Npn \ior_open_unsafe: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 @@ -104,7 +132,7 @@ \tex_openin:D #1#2 \scan_stop: } } -\cs_new_protected:Npn \iow_open:Nn #1#2 +\cs_new_protected:Npn \iow_open_unsafe:Nn #1#2 { \iow_close:N #1 \int_set:Nn \l_iow_stream_int \c_sixteen @@ -117,8 +145,6 @@ \tex_immediate:D \tex_openout:D #1#2 \scan_stop: } } -\cs_generate_variant:Nn \ior_open:Nn { c } -\cs_generate_variant:Nn \iow_open:Nn { c } \cs_new_protected:Npn \iow_alloc_write:n #1 { \prop_if_in:NnF \g_iow_streams_prop {#1} @@ -464,7 +490,6 @@ { \etex_readline:D #1 to #2 } \cs_new_protected:Npn \ior_str_gto:NN #1#2 { \tex_global:D \etex_readline:D #1 to #2 } -\tl_new:N \l_ior_internal_tl \cs_new_protected_nopar:Npn \ior_map_inline:nn { \ior_map_inline_aux:Nnn \ior_to:NN } \cs_new_protected_nopar:Npn \ior_str_map_inline:nn @@ -497,6 +522,12 @@ \ior_map_inline_loop:NNN #1#2#3 } } +\msg_kernel_new:nnnn { io } { space-in-file-name } + { Space~in~file~name~'#1'. } + { + Spaces~are~not~permitted~in~files~loaded~by~LaTeX: \\ + Further~errors~may~follow! + } %% %% %% End of file `l3io.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index c0dc6c71502..8689a2970f1 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 3122 2011-12-31 20:57:36Z joseph $ +\GetIdInfo$Id: l3prg.dtx 3250 2012-01-28 04:54:49Z bruno $ {L3 Experimental control structures} %% \ProvidesExplPackage diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty index 4dc5ec2b65a..a3c773c37b4 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 3158 2012-01-09 00:47:42Z bruno $ +\GetIdInfo$Id: l3tl.dtx 3286 2012-01-31 21:57:22Z joseph $ {L3 Experimental token lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -602,6 +602,18 @@ { \exp_after:wN \c_zero \exp_after:wN \prg_return_false: } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } +\cs_new_protected:Npn \tl_to_str_active_safe:Nx #1#2 + { + \group_begin: + \seq_map_inline:Nn \l_char_active_seq + { \cs_set_nopar:Npx ##1 { \token_to_str:N ##1 } } + \use:x + { + \group_end: + \tl_set:Nn \exp_not:N #1 {#2} + } + \tl_set:Nx #1 { \tl_to_str:N #1 } + } \cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } \cs_generate_variant:Nn \tl_show:N { c } \cs_new_eq:NN \tl_show:n \etex_showtokens:D diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty index e634c9d27c8..3a615eaef75 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3token.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% File: l3token.dtx Copyright (C) 2005-2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -46,9 +46,8 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 3123 2011-12-31 21:51:51Z joseph $ +\GetIdInfo$Id: l3token.dtx 3234 2012-01-25 12:55:06Z joseph $ {L3 Experimental token manipulation} -%% \begin{function}[EXP,pTF]{\token_if_protected_long_macro:N} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: @@ -166,6 +165,26 @@ \char_set_catcode_active:N \* \tl_const:Nn \c_catcode_active_tl { \exp_not:N * } \group_end: +\seq_new:N \l_char_active_seq +\use:n + { + \group_begin: + \char_set_catcode_active:N \" + \char_set_catcode_active:N \$ + \char_set_catcode_active:N \& + \char_set_catcode_active:N \^ + \char_set_catcode_active:N \_ + \char_set_catcode_active:N \~ + \use:nn + { + \group_end: + \seq_set_from_clist:Nn \l_char_active_seq + } + } + { { " , $ , & , ^ , _ , ~ } } +\seq_new:N \l_char_special_seq +\seq_set_from_clist:Nn \l_char_special_seq + { \ , \" , \# , \$ , \% , \& , \\ , \^ , \_ , \{ , \} , \~ } \prg_new_conditional:Npnn \token_if_group_begin:N #1 { p , T , F , TF } { \if_catcode:w \exp_not:N #1 \c_group_begin_token @@ -277,100 +296,145 @@ { \prg_return_false: } } \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_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 } + \tl_map_inline:nn { A C E G H I K L M O P R S U X Y Z R " } { \char_set_catcode:nn { `#1 } \c_twelve } \tl_to_lowercase:n { \group_end: \prg_new_conditional:Npnn \token_if_chardef:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_chardef_aux:w - \token_to_meaning:N #1 ?CHAR" \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_chardef_aux:w + \token_to_meaning:N #1 CHAR" \q_stop + } + { \token_to_str:N \char } } - \cs_new:Npn \token_if_chardef_aux:w #1 ?CHAR" #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Npnn \token_if_mathchardef:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_mathchardef_aux:w - \token_to_meaning:N #1 ?MAYHCHAR" \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_chardef_aux:w + \token_to_meaning:N #1 CHAR" \q_stop + } + { \token_to_str:N \mathchar } } - \cs_new:Npn \token_if_mathchardef_aux:w #1 ?MAYHCHAR" #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } - \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF } + \cs_new:Npn \token_if_chardef_aux:w #1 CHAR" #2 \q_stop { #1 CHAR } + \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_countdef:D #1 + \if_meaning:w \tex_dimen:D #1 \prg_return_false: \else: - \exp_after:wN \token_if_int_register_aux:w - \token_to_meaning:N #1 ?COUXY \q_stop + \if_meaning:w \tex_dimendef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_dim_register_aux:w + \token_to_meaning:N #1 ZIMEX \q_stop + } + { \token_to_str:N \ } + \fi: \fi: } - \cs_new:Npn \token_if_int_register_aux:w #1 ?COUXY #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } - \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF } + \cs_new:Npn \token_if_dim_register_aux:w #1 ZIMEX #2 \q_stop { #1 ~ } + \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_skipdef:D #1 + % \token_if_chardef:NTF #1 { \prg_return_true: } + % { + % \token_if_mathchardef:NTF #1 { \prg_return_true: } + % { + \if_meaning:w \tex_count:D #1 \prg_return_false: \else: - \exp_after:wN \token_if_skip_register_aux:w - \token_to_meaning:N #1?SKIP\q_stop + \if_meaning:w \tex_countdef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_int_register_aux:w + \token_to_meaning:N #1 COUXY \q_stop + } + { \token_to_str:N \ } + \fi: \fi: + % } + % } } - \cs_new:Npn \token_if_skip_register_aux:w #1 ?SKIP #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } - \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF } + \cs_new:Npn \token_if_int_register_aux:w #1 COUXY #2 \q_stop { #1 ~ } + \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_dimendef:D #1 - \c_false_bool + \if_meaning:w \tex_skip:D #1 + \prg_return_false: \else: - \exp_after:wN \token_if_dim_register_aux:w - \token_to_meaning:N #1 ?ZIMEX \q_stop + \if_meaning:w \tex_skipdef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_skip_register_aux:w + \token_to_meaning:N #1 SKIP \q_stop + } + { \token_to_str:N \ } + \fi: \fi: } - \cs_new:Npn \token_if_dim_register_aux:w #1 ?ZIMEX #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_skip_register_aux:w #1 SKIP #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_toks_register:N #1 { p , T , F , TF } { - \if_meaning:w \tex_toksdef:D #1 + \if_meaning:w \tex_toks:D #1 \prg_return_false: \else: - \exp_after:wN \token_if_toks_register_aux:w - \token_to_meaning:N #1 ?YOKS \q_stop + \if_meaning:w \tex_toksdef:D #1 + \prg_return_false: + \else: + \str_if_eq_return:xx + { + \exp_after:wN \token_if_toks_register_aux:w + \token_to_meaning:N #1 YOKS \q_stop + } + { \token_to_str:N \ } + \fi: \fi: } - \cs_new:Npn \token_if_toks_register_aux:w #1 ?YOKS #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \cs_new:Npn \token_if_toks_register_aux:w #1 YOKS #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_protected_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_protected_macro_aux:w - \token_to_meaning:N #1 ?PROYECYEZ~MACRO \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_protected_macro_aux:w + \token_to_meaning:N #1 PROYECYEZ~MACRO \q_stop + } + { \token_to_str:N \ } } \cs_new:Npn \token_if_protected_macro_aux:w - #1 ?PROYECYEZ~MACRO #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + #1 PROYECYEZ~MACRO #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_long_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_long_macro_aux:w - \token_to_meaning:N #1 ?LOXG~MACRO \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_long_macro_aux:w + \token_to_meaning:N #1 LOXG~MACRO \q_stop + } + { \token_to_str:N \ } } - \cs_new:Npn \token_if_long_macro_aux:w #1 ?LOXG~MACRO #2 \q_stop - { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Npnn \token_if_protected_long_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_protected_long_macro_aux:w - \token_to_meaning:N #1 ?PROYECYEZ?LOXG~MACRO \q_stop + \str_if_eq_return:xx + { + \exp_after:wN \token_if_long_macro_aux:w + \token_to_meaning:N #1 LOXG~MACRO \q_stop + } + { \token_to_str:N \protected \token_to_str:N \ } } - \cs_new: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: } } + \cs_new:Npn \token_if_long_macro_aux:w #1 LOXG~MACRO #2 \q_stop { #1 ~ } } \tex_chardef:D \c_token_A_int = `A ~ % \group_begin: |