diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 89 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3.ins | 71 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3doc.dtx | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3file.dtx | 121 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3final.dtx | 18 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3format.ins | 77 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 5 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3io.dtx | 92 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 11 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 34 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3token.dtx | 295 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3toks.dtx | 548 |
12 files changed, 508 insertions, 857 deletions
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 - |