diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-27 00:38:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-27 00:38:35 +0000 |
commit | 6f75f25fe8d374ef4209118bd8849d742410ccd1 (patch) | |
tree | c485a2517a4fba54346c4492d4b34f0c8d815962 /Master/texmf-dist/source/latex/expl3/l3names.dtx | |
parent | 36e4bf755052bf5d5cef33cc2ffbad8f00b22163 (diff) |
expl3 2047 (26sep10)
git-svn-id: svn://tug.org/texlive/trunk@19904 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3names.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3names.dtx | 213 |
1 files changed, 137 insertions, 76 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3names.dtx b/Master/texmf-dist/source/latex/expl3/l3names.dtx index 659cf399330..22df0db9821 100644 --- a/Master/texmf-dist/source/latex/expl3/l3names.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3names.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3names.dtx Copyright (C) 1990-2006,2009 LaTeX3 project +%% File: l3names.dtx Copyright (C) 1990-2006,2009-2010 LaTeX3 project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -31,44 +31,19 @@ %% prior consultation with the LaTeX Project Team. %% %% ----------------------------------------------------------------------- -%^^A We need some basic initial character codes to be set up -%^^A immediately. +% +%^^A At least at the moment this code is needed as the code proper +%^^A starts with \GetInfoId %<*initex> \catcode`\{=1 % left brace is begin-group character \catcode`\}=2 % right brace is end-group character \catcode`\#=6 % hash mark is macro parameter character \catcode`\^=7 % circumflex is superscript character \catcode`\^^I=10 % ascii tab is a blank space -% Make \pdfstrcmp available in luatex -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname directlua\endcsname\relax -\else - \directlua - { - tex.enableprimitives('',tex.extraprimitives ()) - lua.bytecode[1]=function () - function pdfstrcmp (A, B) - if A == B then - tex.write("0") - elseif A < B then - tex.write("-1") - else - tex.write("1") - end - end - end - lua.bytecode[1]() - } - \everyjob{\directlua{lua.bytecode[1]()}} - \long\def\pdfstrcmp#1#2{% - \directlua - {pdfstrcmp("\luaescapestring{#1}","\luaescapestring{#2}")}% - } -\fi %</initex> %<package>\begingroup %<*initex|package> -\protected\def\GetIdInfo$#1${% +\def\GetIdInfo$#1${% \begingroup \def\GetIdInfoString{#1}% \def\IdInfoStringUnexp{Id}% @@ -79,10 +54,10 @@ \fi \next } -\protected\def\GetIdInfoFull$#1 #2.#3 #4 #5 #6 #7${% +\def\GetIdInfoFull$#1 #2.#3 #4 #5 #6 #7${% \GetIdInfoAux #5\relax{#2}#5\relax{#4}% } -\protected\def\GetIdInfoAux #1#2#3#4#5#6\relax{% +\def\GetIdInfoAux #1#2#3#4#5#6\relax{% \ifx#5/% \expandafter\GetIdInfoAuxCVS \else @@ -91,13 +66,13 @@ } %</initex|package> %<*initex> -\protected\def\GetIdInfoAuxCVS #1#2\relax#3#4{% +\def\GetIdInfoAuxCVS #1#2\relax#3#4{% \immediate\write-1{#1; v#2, #3; #4}% } -\protected\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% +\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% \immediate\write-1{#1; #2/#3/#4 v#5 #6}% } -\protected\def\GetIdInfoMissing#1{% +\def\GetIdInfoMissing#1{% \gdef\fileversion{000}% \gdef\filedate{0000/00/00}% \gdef\filedescription{#1}% @@ -105,19 +80,19 @@ } %</initex> %<*package> -\protected\def\GetIdInfoAuxCVS #1#2\relax#3#4{% +\def\GetIdInfoAuxCVS #1#2\relax#3#4{% \gdef\fileversion{#3}% \gdef\filedate{#2}% \gdef\filedescription{#4}% \ProvidesPackage{#1}[#2 v#3 #4]% } -\protected\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% +\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% \gdef\fileversion{#5}% \gdef\filedate{#2/#3/#4}% \gdef\filedescription{#6}% \ProvidesPackage{#1}[#2/#3/#4 v#5 #6] } -\protected\def\GetIdInfoMissing#1{% +\def\GetIdInfoMissing#1{% \gdef\fileversion{000}% \gdef\filedate{0000/00/00}% \gdef\filedescription{#1}% @@ -128,20 +103,17 @@ \RequirePackage{l3names} %</driver> %\fi -\GetIdInfo$Id: l3names.dtx 1987 2010-07-25 14:55:46Z joseph $ +\GetIdInfo$Id: l3names.dtx 2034 2010-09-20 20:17:43Z joseph $ {L3 Experimental Naming Scheme for TeX Primitives} -% -% -% \iffalse %<package>\endgroup %<*driver> %\fi -\ProvidesFile{l3names.dtx} +\ProvidesFile{\filename.\filenameext} [\filedate\space v\fileversion\space\filedescription] %\iffalse \documentclass[full]{l3doc} \begin{document} -\DocInput{l3names.dtx} + \DocInput{\filename.\filenameext} \end{document} %</driver> % \fi @@ -272,40 +244,76 @@ % \begin{function}{\@pushfilename | \@popfilename} % Re-definitions of \LaTeX's file-loading functions to support "\ExplSyntax". % \end{function} +% +%\subsection{Bootstrap code} % -% \subsection{Package loading} +% The very first thing to do is to bootstrap the \IniTeX\ system so +% that everything else will actually work. \TeX\ does not start with +% some pretty basic character codes set up. +% \begin{macrocode} +%<*!package> +\catcode `\{ = 1 \relax +\catcode `\} = 2 \relax +\catcode `\# = 6 \relax +\catcode `\^ = 7 \relax +%</!package> +% \end{macrocode} % -% Before anything else, check that we're using \eTeX; -% no point continuing otherwise. +% Tab characters should not show up in the code, but to be on the +% safe side. % \begin{macrocode} -%<*initex|package> -\begingroup -\def\firstoftwo#1#2{#1} -\def\secondoftwo#1#2{#2} -\def\etexmissingerror{Not running under e-TeX} -\def\etexmissinghelp{% - This package requires e-TeX.^^J% - Try compiling the document with `elatex' instead of `latex'.^^J% - When using pdfTeX, try `pdfelatex' instead of `pdflatex'% -}% -\expandafter\ifx\csname eTeXversion\endcsname\relax - \expandafter\secondoftwo\else\expandafter\firstoftwo\fi - {\endgroup}{% -%<initex> \expandafter\errhelp\expandafter{\etexmissinghelp}% -%<initex> \expandafter\errmessage\expandafter{\etexmissingerror}% -%<package> \PackageError{l3names}{\etexmissingerror}{\etexmissinghelp}% - \endgroup - \endinput +%<*!package> +\catcode `\^^I = 10 \relax +%</!package> +% \end{macrocode} +% +% For \LuaTeX\ the extra primitives need to be enabled before +% they can be use. No \cs{ifdefined} yet, so do it the old-fashioned +% way. The primitive \cs{strcmp} is simulated using some \Lua\ +% code, which currently has to be applied to every job as the \Lua\ +% code is not part of the format. Thanks to Taco Hoekwater for this +% code. The odd \cs{csname} business is needed so that the later +% deletion code will work. +% \begin{macrocode} +%<*!package> +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax +\else + \directlua + { + tex.enableprimitives('',tex.extraprimitives ()) + lua.bytecode[1] = function () + function strcmp (A, B) + if A == B then + tex.write("0") + elseif A < B then + tex.write("-1") + else + tex.write("1") + end + end + end + lua.bytecode[1]() } -%</initex|package> + \everyjob\expandafter + {\csname tex_directlua:D\endcsname{lua.bytecode[1]()}} + \long\edef\pdfstrcmp#1#2% + {% + \expandafter\noexpand\csname tex_directlua:D\endcsname + {% + strcmp(% + "\noexpand\luaescapestring{#1}",% + "\noexpand\luaescapestring{#2}"% + )% + }% + } +\fi +%</!package> % \end{macrocode} -% -%\subsection{Lua\TeX\ work} -% -% When being used as a package, managing some Lua\TeX\ primitives has to -% work correctly with other packages. This is done by loading the -% \pkg{luatex} package and making the appropriate adjustments. +% When loaded as a package this can all be handed off to other +% \LaTeXe\ code. % \begin{macrocode} +%<*package> \def\@tempa{% \def\@tempa{}% \RequirePackage{luatex}% @@ -317,8 +325,61 @@ \else \expandafter\@tempa \fi +%</package> +% \end{macrocode} +% +% \XeTeX\ calls the primitive \cs{strcmp}, so there needs to be a +% check for that too. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup + \ifx\csname pdfstrcmp\endcsname\relax + \let\pdfstrcmp\strcmp +\fi % \end{macrocode} % +%\subsection{Requirements} +% +% Currently, the code requires the \eTeX\ primitives and functionality +% equivalent to \cs{pdfstrcmp}. Any package which provides the later +% will provide the former, so the test can be done only for +% \cs{pdfstrcmp}. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\ifx\csname pdfstrcmp\endcsname\relax +%<*package> + \PackageError{l3names}{Required primitives not found} + {% + LaTeX3 requires the e-TeX primitives and + \string\pdfstrcmp.\MessageBreak + These are available in engine versions: \MessageBreak + - pdfTeX 1.30 \MessageBreak + - XeTeX 0.9994 \MessageBreak + - LuaTeX 0.60 \MessageBreak + or later. \MessageBreak + \MessageBreak + Loading of l3names will abort! + } +%</package> +%<*!package> + \newlinechar`\^^J\relax + \errhelp{% + LaTeX3 requires the e-TeX primitives and + \string\pdfstrcmp. ^^J + These are available in engine versions: ^^J + - pdfTeX 1.30 ^^J + - XeTeX 0.9994 ^^J + - LuaTeX 0.60 ^^J + or later. ^^J + For pdfTeX and XeTeX the '-etex' command-line switch is also + needed.^^J + ^^J + Format building will abort! + } +%</!package> + \expandafter\endinput +\fi +% \end{macrocode} +% % \subsection{Catcode assignments} % % Catcodes for begingroup, endgroup, macro parameter, superscript, and tab, @@ -1024,7 +1085,7 @@ \tex_endlinechar:D =32 \tex_relax:D % endline is space \tex_catcode:D 95=11 \tex_relax:D % underscore letter \tex_catcode:D 58=11 \tex_relax:D % colon letter - \tex_catcode:D 124=11 \tex_relax:D % vertical bar, other + \tex_catcode:D 124=12 \tex_relax:D % vertical bar, other \tex_catcode:D 38=4 \tex_relax:D % ampersand, alignment token \tex_catcode:D 94=7 \tex_relax:D % caret, math superscript \tex_catcode:D 34=12 \tex_relax:D % doublequote, other @@ -1176,7 +1237,7 @@ % as the packages in this distribution do like this: % \begin{verbatim} % \RequirePackage{l3names} -% \GetIdInfo$Id: l3names.dtx 1987 2010-07-25 14:55:46Z joseph $ +% \GetIdInfo$Id: l3names.dtx 2034 2010-09-20 20:17:43Z joseph $ % {L3 Experimental Box module} % \ProvidesExplPackage % {\filename}{\filedate}{\fileversion}{\filedescription} @@ -1279,7 +1340,7 @@ \tex_if:D 2\ExplSyntaxStack 2 \ExplSyntaxOff \tex_else:D - \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\q_nil + \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\q_stop \tex_fi:D } } @@ -1294,7 +1355,7 @@ % stack is initially empty set to 0 signalling that before % \pkg{l3names} was loaded, the ExplSyntax was off. % \begin{macrocode} -\etex_protected:D\tex_def:D\ExplSyntaxPopStack#1#2\q_nil{ +\etex_protected:D\tex_def:D\ExplSyntaxPopStack#1#2\q_stop{ \tex_def:D\ExplSyntaxStack{#2} \tex_ifodd:D#1\tex_relax:D \ExplSyntaxOn |