diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-01-14 02:53:55 +0100 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-01-14 02:53:55 +0100 |
commit | 9a974ea1a02d68241ad878a560ef67e4a77858f2 (patch) | |
tree | 50ccb971c0fcf0c3b7dc59ff7f69ddb1828e2b85 | |
parent | 51e42c2d8f70ca336fbfdcf6d203a0b81e4b303d (diff) | |
download | luatexbase-9a974ea1a02d68241ad878a560ef67e4a77858f2.tar.gz |
Finalize package regs code.
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | luatexbase-regs.dtx | 76 |
2 files changed, 71 insertions, 11 deletions
@@ -11,12 +11,10 @@ general - fix Makefile: test files are source, not runfiles - make tests cleaner: \begingroup\expandafter\ETC. - handle catcodes for Plain +- import/write doc regs ---- -- reload check, declaration, luatex test -- issue a warning if etex not loaded -- handle catcodes for Plain - +- write doc diff --git a/luatexbase-regs.dtx b/luatexbase-regs.dtx index b5af110..e93d57f 100644 --- a/luatexbase-regs.dtx +++ b/luatexbase-regs.dtx @@ -135,12 +135,66 @@ and the derived files % % \section{Implementation} % -% \subsection{\TeX\ package} -% % \begin{macrocode} %<*texpackage> % \end{macrocode} % +% \subsection{Preliminaries} +% +% Reload protection, especially for Plain TeX. +% +% \begin{macrocode} + \csname lltxb@regs@loaded\endcsname +\expandafter\let\csname lltxb@regs@loaded\endcsname\endinput +% \end{macrocode} +% +% Package declaration. +% +% \begin{macrocode} +\begingroup + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \def\x#1[#2]{\immediate\write16{Package: #1 #2}} + \else + \let\x\ProvidesPackage + \fi +\expandafter\endgroup +\x{luatexbase-regs}[2010/01/14 Registers allocation for LuaTeX (mpg)] +% \end{macrocode} +% +% Make sure \LuaTeX\ is used. +% +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax + \input ifluatex.sty +\else + \RequirePackage{ifluatex} +\fi +\ifluatex\else + \begingroup + \expandafter\ifx\csname PackageWarningNoLine\endcsname\relax + \def\x#1#2{\begingroup\newlinechar10 + \immediate\write16{Package #1 warning: #2}\endgroup} + \else + \let\x\PackageWarningNoLine + \fi + \expandafter\endgroup + \x{luatexbase-regs}{LuaTeX is required for this package.^^J + Aborting package loading.} + \expandafter\endinput +\fi +% \end{macrocode} +% +% Make sure the catcode of @ is correct, especially for Plain~\TeX. +% +% \begin{macrocode} +\expandafter\edef\csname lltxb@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax} +\catcode64 11 +% \end{macrocode} +% +% \subsection{Main content} +% % If running \LaTeX, load \texttt{etex.sty}. If not, either % \texttt{etex.src} was loaded at format generation time, or we cannot do % anything. @@ -154,13 +208,22 @@ and the derived files % % To the best of my (mpg) knowledge, all Plain-based formats built with % \eTeX-enabled engines in \TeX\,Live load \texttt{etex.src}. However, -% let's be careful and check that \texttt{etex.sty} or \texttt{src} is +% let's be careful and check that \texttt{etex.sty} or \texttt{etex.src} is % loaded. % % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname et@xins\endcsname\relax - %%TODO: issue a warning here + \begingroup + \expandafter\ifx\csname PackageWarningNoLine\endcsname\relax + \def\x#1#2{\begingroup\newlinechar10 + \immediate\write16{Package #1 warning: #2}\endgroup} + \else + \let\x\PackageWarningNoLine + \fi + \expandafter\endgroup + \x{luatexbase-regs}{etex macros not loaded!^^J + Registers allocation scheme will not be extended.} \else % \end{macrocode} % @@ -226,12 +289,13 @@ and the derived files \expandafter\let\csname newdimen\endcsname\globdimen \expandafter\let\csname newskip\endcsname\globskip \expandafter\let\csname newbox\endcsname\globbox +\fi % \end{macrocode} % % That's all folks! % % \begin{macrocode} -\fi +\lltxb@AtEnd %</texpackage> % \end{macrocode} % @@ -248,9 +312,7 @@ and the derived files % enough for testing purposes.) % % \begin{macrocode} -%<testplain>\catcode 64 11 %<testplain>\input luatexbase-regs.sty -%<testplain>\catcode 64 12 %<testlatex>\RequirePackage{luatexbase-regs} %<*testplain,testlatex> \def\checkregister#1{% |