summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-12-20 23:00:54 +0000
committerKarl Berry <karl@freefriends.org>2015-12-20 23:00:54 +0000
commitf4e67bebe6f832d21491cfa7ae1dfa9388899117 (patch)
tree3ecab4ba208e0c7ef72957758d26a48d8fc008b8 /Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx
parent01185308aa1c1a77c8926a0432aeda02d7a240d9 (diff)
l3 (20dec15)
git-svn-id: svn://tug.org/texlive/trunk@39152 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx305
1 files changed, 163 insertions, 142 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx
index b510b1036ce..2fddc7e68e3 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx
@@ -57,7 +57,7 @@
\begingroup
\catcode 32 = 10 %
\GetIdInfoAuxI
- }
+ }%
% \end{macrocode}
% A first check for a completely empty \textsc{svn} field. If that is
% not the case, there is a second case when a file created using
@@ -90,7 +90,7 @@
\fi
\tempa
\GetIdInfoLog
- }
+ }%
% \end{macrocode}
% Here, |#1| is |Id|, |#2| is the file name, |#3| is the extension,
% |#4| is the version, |#5| is the check in date and |#6| is the check in
@@ -119,14 +119,14 @@
}%
\fi
\tempa
- }
+ }%
% \end{macrocode}
% Convert an \textsc{svn}-style date into a \LaTeX{}-style one.
% \begin{macrocode}
\csname protected\endcsname\gdef\GetIdInfoAuxIII$#1-#2-#3$%
{%
\def\ExplFileDate{#1/#2/#3}%
- }
+ }%
% \end{macrocode}
% During loading of \pkg{expl3}, module information is added to the log.
% This function gets redefined once loading is complete.
@@ -138,15 +138,15 @@
L3 Module:
\ExplFileName\space
\ExplFileDate\space v\ExplFileVersion\space \ExplFileDescription
- }
- }
+ }%
+ }%
\endgroup
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
-\GetIdInfo$Id: l3bootstrap.dtx 6213 2015-10-18 09:48:17Z joseph $
- {L3 Bootstrap code}
+\GetIdInfo$Id: l3bootstrap.dtx 6320 2015-12-15 09:49:47Z joseph $
+ {L3 Bootstrap code}%
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -267,10 +267,10 @@
% some pretty basic character codes set up.
% \begin{macrocode}
%<*initex>
-\catcode `\{ = 1 \relax
-\catcode `\} = 2 \relax
-\catcode `\# = 6 \relax
-\catcode `\^ = 7 \relax
+\catcode `\{ = 1\relax
+\catcode `\} = 2\relax
+\catcode `\# = 6\relax
+\catcode `\^ = 7\relax
%</initex>
% \end{macrocode}
%
@@ -278,7 +278,7 @@
% safe side.
% \begin{macrocode}
%<*initex>
-\catcode `\^^I = 10 \relax
+\catcode `\^^I = 10\relax
%</initex>
% \end{macrocode}
%
@@ -291,7 +291,7 @@
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
\else
- \directlua{tex.enableprimitives("", tex.extraprimitives())}
+ \directlua{tex.enableprimitives("", tex.extraprimitives())}%
\fi
%</initex>
% \end{macrocode}
@@ -325,7 +325,7 @@
%</package>
% \end{macrocode}
%
-% \subsection{The \tn{pdfstrcmp} primitive with \XeTeX{} and \LuaTeX{}}
+% \subsection{The \tn{pdfstrcmp} primitive in \XeTeX{}}
%
% Only \pdfTeX{} has a primitive called \tn{pdfstrcmp}. The \XeTeX{}
% version is just \tn{strcmp}, so there is some shuffling to do. As
@@ -337,149 +337,74 @@
\fi
% \end{macrocode}
%
-% If \LuaTeX{} is in use then no primitive \tn{pdfstrcmp} is available.
-% However, it can be emulated using some Lua code. In earlier versions of
-% the code, the \pkg{pdftexcmds} package was loaded to do this task. However,
-% that raises some issues in \enquote{generic} (it fails with Con\TeX{}t
-% MkIV), and also adds a hardly-needed dependency. Note that \LuaTeX{}
-% prior to version $0.36$ is not supported by \pkg{expl3}: here that means
-% simply skipping the definition, which will then be picked up later. This
-% definition may need to be done twice: one \enquote{now} and once at the
-% start of every job. The latter can occur in package mode if for example a
-% custom format is being constructed. To achieve this while not requiring a
-% separate file, the Lua code is saved into a macro then used twice.
-% (In the long term, the Lua code here may be best moved to a separate
-% file.)
-%
-% No macro definition is given just yet: that is left until \pkg{l3basics}.
+% \subsection{Loading support \Lua{} code}
+%
+% When \LuaTeX{} is used there are various pieces of \Lua{} code which need to
+% be loaded. The code itself is defined in \pkg{l3luatex} and is extracted into
+% a separate file. Thus here the task is to load the \Lua{} code both now and
+% (if required) at the start of each job.
% \begin{macrocode}
-\begingroup
- \expandafter\ifx\csname directlua\endcsname\relax
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname directlua\endcsname\relax
+\else
+ \ifnum\luatexversion<70 %
\else
- \ifnum\luatexversion<36 %
- \else
- \catcode`\_=11 %
- \catcode`\:=11 %
- \def\tempa
- {%
- l3kernel = l3kernel or { }
- function l3kernel.strcmp(A, B)
- if A == B then
- tex.write("0")
- elseif A < B then
- tex.write("-1")
- else
- tex.write("1")
- end
- end
- }
- \directlua{\tempa}
% \end{macrocode}
-% A test for \LuaTeX{} in Ini\TeX{} mode.
+% In package mode a category code table is needed: either use a pre-loaded
+% allocator or provide one using the \LaTeXe{}-based generic code. In format
+% mode the table used here can be hard-coded into the \Lua{}.
% \begin{macrocode}
- \ifnum 0%
- \directlua
- {%
- if status.ini_version then
- tex.write("1")
- end
- }>0 %
- \global\everyjob\expandafter
- {%
- \the\expandafter\everyjob
- \expandafter\lua_now_x:n\expandafter{\tempa}%
- }
- \fi
+%<*package>
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname newcatcodetable\endcsname\relax
+ \input{ltluatex}%
\fi
- \fi
-\endgroup
+ \newcatcodetable\ucharcat@table
+ \directlua{
+ l3kernel = l3kernel or { }
+ local charcat_table = \number\ucharcat@table
+ l3kernel.charcat_table = charcat_table
+ }%
+%</package>
+ \directlua{require("expl3")}%
% \end{macrocode}
-%
-% \subsection{Emulating \tn{Ucharchar} in \LuaTeX{}}
-%
-% Expandably creating character tokens can be done in macros but for the
-% full Unicode range requires engine support in practical terms. That is
-% available in \XeTeX{} as \tn{Ucharcat} but in \LuaTeX{} some Lua code
-% is required. That is set up here, following the model above. Note that
-% we do not try to emulate the syntax of the primitive (doable with \LuaTeX{}
-% 0.80 or later, but not required by our use case).
-%
-% One minor wrinkle is that a catcode table is needed to return values.
-% For format mode, long-term we can simply take an arbitrary one and make
-% sure this is never allocated. In package mode use the same approach
-% (and table) as \pkg{ucharcat}: look for an allocator and use it if available,
-% or use a table unlikely to clash with any other use. We use the same table
-% as \pkg{ucharcat} but as this is \enquote{disposable} we are safe.
+% As the user might be making a custom format, no assumption is made about
+% matching package mode with only loading the \Lua{} code once. Instead, a
+% query to \Lua{} will reveal what mode is in operation.
% \begin{macrocode}
-\begingroup
- \expandafter\ifx\csname directlua\endcsname\relax
- \else
- \ifnum\luatexversion<70 %
- \else
-%<*initex>
- % TEMP
- \catcode`\@=11 %
- \chardef\ucharcat@table="8000 %
-%</initex>
-%<*package>
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname newcatcodetable\endcsname\relax
- \directlua{tex.enableprimitives("",{"initcatcodetable"})}
- \chardef\ucharcat@table"7000 %
- \initcatcodetable\ucharcat@table
- \else
- \newcatcodetable\ucharcat@table
- \fi
-%</package>
- \catcode`\_=11 %
- \catcode`\:=11 %
- \def\tempa
- {%
- l3kernel = l3kernel or { }
- local utf8_char = unicode.utf8.char
- function l3kernel.charcat(charcode, catcode)
- tex.setcatcode(\number\ucharcat@table, charcode, catcode)
- tex.sprint(\number\ucharcat@table, utf8_char(charcode))
- end
- }
- \directlua{\tempa}
- \ifnum 0%
- \directlua
- {%
- if status.ini_version then
- tex.write("1")
- end
- }>0 %
- \global\everyjob\expandafter
- {%
- \the\expandafter\everyjob
- \expandafter\lua_now_x:n\expandafter{\tempa}%
- }
- \fi
+ \ifnum 0%
+ \directlua{
+ if status.ini_version then
+ tex.write("1")
+ end
+ }>0 %
+ \everyjob\expandafter{%
+ \the\expandafter\everyjob
+ \csname\detokenize{lua_now_x:n}\endcsname{require("expl3")}%
+ }%
\fi
\fi
-\endgroup
+\fi
% \end{macrocode}
%
% \subsection{Engine requirements}
%
-% The code currently requires functionality equivalent to \tn{pdfstrcmp}
-% in addition to \eTeX{}. This is picked up by testing for the \tn{pdfstrcmp}
-% primitive or a version of \LuaTeX{} capable of emulating it.
+% The code currently requires \eTeX{} and functionality equivalent to
+% \tn{pdfstrcmp}, and also driver and Unicode character support. This is
+% available in a reasonably-wide range of engines.
% \begin{macrocode}
\begingroup
\def\next{\endgroup}%
\def\ShortText{Required primitives not found}%
\def\LongText%
{%
- LaTeX3 requires the e-TeX primitives and \string\pdfstrcmp.\LineBreak
- Direct PDF production also requires additional primitives listed in the
- README.\LineBreak
+ LaTeX3 requires the e-TeX primitives and additional functionality as
+ described in the README file.
\LineBreak
These are available in the engines\LineBreak
- pdfTeX v1.40\LineBreak
- XeTeX v0.9994\LineBreak
- - LuaTeX v0.40\LineBreak
+ - LuaTeX v0.70\LineBreak
- e-(u)pTeX mid-2012\LineBreak
or later.\LineBreak
\LineBreak
@@ -523,7 +448,7 @@
\def\PackageError#1#2#3%
{%
\errhelp{#3}%
- \errmessage{#1 Error: #2}
+ \errmessage{#1 Error: #2}%
}%
\fi
\edef\next
@@ -565,15 +490,15 @@
% \begin{macrocode}
%<*package>
\begingroup
- \def\@tempa{LaTeX2e}
- \def\next{}
+ \def\@tempa{LaTeX2e}%
+ \def\next{}%
\ifx\fmtname\@tempa
\expandafter\ifx\csname extrafloats\endcsname\relax
\def\next
{%
\RequirePackage{etex}%
\csname reserveinserts\endcsname{32}%
- }
+ }%
\fi
\fi
\expandafter\endgroup
@@ -581,6 +506,102 @@
%</package>
% \end{macrocode}
%
+% \subsection{Character data}
+%
+% \TeX{} needs various pieces of data to be set about characters, in particular
+% which ones to treat as letters and which \tn{lccode} values apply as these
+% affect hyphenation. It makes most sense to set this and related information
+% up in one place. Whilst for \LuaTeX{} hyphenation patterns can be read
+% anywhere, other engines have to build them into the format and so we
+% \emph{must} do this set up before reading the patterns. For the Unicode
+% engines, there are shared loaders available to obtain the relevant
+% information irectly from the Unicode Consortium data files. These need
+% standard (Ini)\TeX{} category codes and primitive availablity and must
+% therefore loaded \emph{very} early. This has a knock-on effect on the
+% $8$-bit set up: it makes sense to do the defintions for those here as
+% well so it is all in one place.
+%
+% For \XeTeX{} and \LuaTeX{}, which are natively Unicode engines, simply
+% load the Unicode data.
+% \begin{macrocode}
+%<*initex>
+\ifdefined\Umathcode
+ \input load-unicode-data %
+\else
+% \end{macrocode}
+% For the $8$-bit engines an encoding scheme must be chosen. At present,
+% this is the EC (|T1|) scheme, with the assumption that languages for which
+% this is not appropriate will be used with one of the Unicode engines.
+% \begin{macrocode}
+ \begingroup
+% \end{macrocode}
+% Lower case chars: map to themselves when lower casing and down by |"20| when
+% upper casing. (The characters |a|--|z| are set up correctly by Ini\TeX{}.)
+% \begin{macrocode}
+ \def\temp{%
+ \ifnum\count0>\count2 %
+ \else
+ \global\lccode\count0 = \count0 %
+ \global\uccode\count0 = \numexpr\count0 - "20\relax
+ \advance\count0 by 1 %
+ \expandafter\temp
+ \fi
+ }
+ \count0="A0 %
+ \count2="BC %
+ \temp
+ \count0="E0 %
+ \count2="FF %
+ \temp
+% \end{macrocode}
+% Upper case chars: map up by |"20| when lower casing, to themselves when upper
+% casing and require an \tn{sfcode} of $999$. (The characters |A|--|Z| are set
+% up correctly by Ini\TeX{}.)
+% \begin{macrocode}
+ \def\temp{%
+ \ifnum\count0>\count2 %
+ \else
+ \global\lccode\count0 = \numexpr\count0 + "20\relax
+ \global\uccode\count0 = \count0 %
+ \global\sfcode\count0 = 999 %
+ \advance\count0 by 1 %
+ \expandafter\temp
+ \fi
+ }
+ \count0="80 %
+ \count2="9C %
+ \temp
+ \count0="C0 %
+ \count2="DF %
+ \temp
+% \end{macrocode}
+% A few special cases where things are not as one might expect using the above
+% pattern: dotless-I, dotless-J, dotted-I and d-bar.
+% \begin{macrocode}
+ \global\lccode`\^^Y = `\^^Y %
+ \global\uccode`\^^Y = `\I %
+ \global\lccode`\^^Z = `\^^Z %
+ \global\uccode`\^^Y = `\J %
+ \global\lccode"9D = `\i %
+ \global\uccode"9D = "9D %
+ \global\lccode"9E = "9E %
+ \global\uccode"9E = "D0 %
+% \end{macrocode}
+% Allow hyphenation at a zero-width glyph (used to break up ligatures or
+% to place accents between characters).
+% \begin{macrocode}
+ \global\lccode23 = 23 %
+ \endgroup
+\fi
+% \end{macrocode}
+% In all cases it makes sense to set up |-| to map to itself: this allows
+% hyphenation of the rest of a word following it (suggested by
+% Lars Helstr\"om).
+% \begin{macrocode}
+\global\lccode`\-=`\- %
+%</initex>
+% \end{macrocode}
+%
% \subsection{The \LaTeX3 code environment}
%
% The code environment is now set up.
@@ -592,7 +613,7 @@
% \cs{ExplSyntaxOn} is used. For format mode, there is no need to save
% category codes so that step is skipped.
% \begin{macrocode}
-\protected\def\ExplSyntaxOff{}
+\protected\def\ExplSyntaxOff{}%
%<*package>
\protected\edef\ExplSyntaxOff
{%
@@ -608,7 +629,7 @@
\catcode 126 = \the\catcode 126\relax
\endlinechar = \the\endlinechar\relax
\chardef\csname\detokenize{l__kernel_expl_bool}\endcsname = 0\relax
- }
+ }%
%</package>
% \end{macrocode}
% \end{macro}
@@ -630,7 +651,7 @@
% \begin{variable}{\l__kernel_expl_bool}
% The status for experimental code syntax: this is on at present.
% \begin{macrocode}
-\chardef\l__kernel_expl_bool = 1 ~
+\chardef\l__kernel_expl_bool = 1\relax
% \end{macrocode}
%\end{variable}
%