diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-01-13 21:46:57 +0100 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-01-14 00:06:21 +0100 |
commit | 5371f0f66156ed89d27bf69246f60ee8b83b4172 (patch) | |
tree | ee65b1a6f5ea64821fe38c2bed19220d37c2af1e | |
parent | f63af9a552cf853b4fa622750ffbf749cd333533 (diff) | |
download | luatexbase-5371f0f66156ed89d27bf69246f60ee8b83b4172.tar.gz |
Make registers extension work with Plain.
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | luatexbase-regs.dtx | 78 |
3 files changed, 45 insertions, 40 deletions
@@ -6,7 +6,7 @@ DOC = $(patsubst %.dtx, %.pdf, $(DTX)) # Files grouped by generation mode UNPACKED_MCB = luamcallbacks-test.tex luamcallbacks.lua -UNPACKED_REGS = luatexbase-regs.sty luatexbase-regs-latex.tex \ +UNPACKED_REGS = luatexbase-regs.sty \ test-regs-plain.tex test-regs-latex.tex UNPACKED = $(UNPACKED_MCB) $(UNPACKED_REGS) COMPILED = $(DOC) @@ -59,7 +59,7 @@ $(UNPACKED_REGS): luatexbase-regs.dtx $(DO_TEX) check-regs: $(UNPACKED_REGS) - #luatex --interaction=batchmode test-regs-latex.tex >/dev/null + luatex --interaction=batchmode test-regs-plain.tex >/dev/null lualatex --interaction=batchmode test-regs-latex.tex >/dev/null $(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP) @@ -7,12 +7,13 @@ general - reload check, declaration, luatex test - import/update doc - fix Makefile: test files are doc, not runfiles +- make tests cleaner: \begingroup\expandafter\ETC. regs ---- - fix box & mark allocation (mathcherdef -> chardef) - check why only 100 or so \inserts can be allocated -- make it work with Plain! +- issue a warning if etex not loaded diff --git a/luatexbase-regs.dtx b/luatexbase-regs.dtx index 74d56a5..b6caacb 100644 --- a/luatexbase-regs.dtx +++ b/luatexbase-regs.dtx @@ -56,7 +56,6 @@ and the derived files \generate{% \usedir{tex/luatex/luatexbase}% \file{luatexbase-regs.sty}{\from{luatexbase-regs.dtx}{texpackage}}% - \file{luatexbase-regs-latex.tex}{\from{luatexbase-regs.dtx}{latexfile}}% } \generate{% @@ -140,61 +139,66 @@ and the derived files %<*texpackage> % \end{macrocode} % +% If running \LaTeX, load \texttt{etex.sty}. If not, either +% \texttt{etex.src} was loaded at format generation time, or we cannot do +% anything. +% % \begin{macrocode} -\expandafter\ifx\csname ProvidesPackage\endcsname\relax \else +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax \else \RequirePackage{etex}[1998/03/26] +\fi +% \end{macrocode} % -% The \texttt{\string\input} is a hack that modifies some values in the -% register attribution scheme of $\varepsilon$-\TeX\ and remaps -% \texttt{\string\newcount} to \textsf{etex}'s \texttt{\string\globcount}. -% We have to do such a remapping in a separate file that Plain doesn't see, -% otherwise it outputs an error if we try to change -% \texttt{\string\newcount} (because it is an \texttt{\string\outer} -% macro). See below for file contents. +% 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 +% loaded. % % \begin{macrocode} - \input luatexbase-regs-latex.tex -\fi -% \begin{macrocode} -%</texpackage> +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname et@xins\endcsname\relax + %%TODO: issue a warning here +\else % \end{macrocode} % -% \subsection{Specific \LaTeX\ part} +% First, increase the upper bound for all kinds of registers. Copy code to +% avoid defining a macro. % % \begin{macrocode} -%<*latexfile> + \ifnum\count270=32768 \count270=65536 \fi + \ifnum\count271=32768 \count271=65536 \fi + \ifnum\count272=32768 \count272=65536 \fi + \ifnum\count273=32768 \count272=65536 \fi + \ifnum\count273=32768 \count273=65536 \fi + \ifnum\count274=32768 \count274=65536 \fi + \ifnum\count275=32768 \count275=65536 \fi + \ifnum\count276=32768 \count276=65536 \fi % \end{macrocode} % -% This file is very small, it just changes the maximum values of allowed -% registers from 32768 to 65536, and remaps \texttt{\string\newcount} (and -% friends) to \textsf{etex}'s \texttt{\string\globcount}. +% Finally, make allocation of \verb|\count|, \verb|\dimen|, \verb|skip| and +% \verb|\box| start with numbers $>255$, in order to free the lower numbers +% for insertions. Be careful with \verb|\new...| macros which are +% \verb|\outer| in Plain, since we're in the middle of an \verb|\if| test. % % \begin{macrocode} -\def\ltxtra@temp#1{% -\ifnum\count27#1=32768 % - \count27#1=65536 % -\fi -}% -\ltxtra@temp0% -\ltxtra@temp1% -\ltxtra@temp2% -\ltxtra@temp3% -\ltxtra@temp4% -\ltxtra@temp5% -\ltxtra@temp6% -\let\newcount\globcount -\let\newdimen\globdimen -\let\newskip\globskip -\let\newbox\globbox + \expandafter\let\csname newcount\endcsname\globcount + \expandafter\let\csname newdimen\endcsname\globdimen + \expandafter\let\csname newskip\endcsname\globskip + \expandafter\let\csname newbox\endcsname\globbox % \end{macrocode} % +% That's all folks! +% % \begin{macrocode} -%</latexfile> +\fi +%</texpackage> % \end{macrocode} % % \section{Test files} % -% Here we test only the two main formatis: Plain~\TeX\ (with etex.src +% Here we test only the two main formats: Plain~\TeX\ (with +% \texttt{etex.src} % loaded) and \LaTeX, both with the \LuaTeX\ engine. Those correspond to % the \texttt{luatex} and \texttt{lualatex} commands in \TeX\,Live. % @@ -227,7 +231,7 @@ and the derived files \count0 1 \loop \ifnum\count0<100 - \newinsert\dummy + \csname newinsert\endcsname\dummy \advance\count0 1 \repeat %</testplain,testlatex> |