summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-03-29 06:03:16 +0200
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-03-29 06:03:16 +0200
commit46c64ac9b3bb3dab8bf4a1dc6039983171c73186 (patch)
treea5d8c3f6813848af9d25b898859e1426d377dae4
parentdb64070daee7f0f64183b45fea1de8ff993f8023 (diff)
downloadluatexbase-46c64ac9b3bb3dab8bf4a1dc6039983171c73186.tar.gz
First attempt at using compat.
-rw-r--r--Makefile15
-rw-r--r--luamcallbacks.dtx3
-rw-r--r--luatexbase-attr.dtx12
-rw-r--r--luatexbase-cctb.dtx16
-rw-r--r--luatexbase-loader.dtx13
-rw-r--r--luatexbase-modutils.dtx10
6 files changed, 46 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index b793fab..5d48d36 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,9 @@ NAME = luatexbase
DTX = $(wildcard *.dtx)
DOC = $(patsubst %.dtx, %.pdf, $(DTX))
DTXSTY = lltxb-dtxstyle.tex
+
+# used for check dependencies
+COMPAT_RUN = luatexbase-compat.sty
LOADER_RUN = luatexbase-loader.sty luatexbase.loader.lua
MOD_RUN = luatexbase-modutils.sty modutils.lua
LINKS = luatexbase.attr.lua luatexbase.cctb.lua luatexbase.modutils.lua
@@ -21,7 +24,7 @@ UNPACKED_LOADER = $(LOADER_RUN) \
test-loader-plain.tex test-loader-latex.tex
UNPACKED_MODUTILS = $(MOD_RUN) test-modutils.lua \
test-modutils-plain.tex test-modutils-latex.tex
-UNPACKED_COMPAT = luatexbase-compat.sty \
+UNPACKED_COMPAT = $(COMPAT_RUN) \
test-compat-plain.tex test-compat-latex.tex
UNPACKED = $(UNPACKED_MCB) $(UNPACKED_REGS) $(UNPACKED_ATTR) $(UNPACKED_CCTB) \
$(UNPACKED_LOADER) $(UNPACKED_MODUTILS) $(UNPACKED_COMPAT)
@@ -97,23 +100,23 @@ check-regs: $(UNPACKED_REGS)
luatex --interaction=batchmode test-regs-plain.tex >/dev/null
lualatex --interaction=batchmode test-regs-latex.tex >/dev/null
-check-attr: $(UNPACKED_ATTR) $(LOADER_RUN) $(LINKS)
+check-attr: $(UNPACKED_ATTR) $(LOADER_RUN) $(LINKS) $(COMPAT_RUN)
luatex --interaction=batchmode test-attr-plain.tex >/dev/null
lualatex --interaction=batchmode test-attr-latex.tex >/dev/null
-check-cctb: $(UNPACKED_CCTB) $(LOADER_RUN) $(LINKS)
+check-cctb: $(UNPACKED_CCTB) $(LOADER_RUN) $(LINKS) $(COMPAT_RUN)
luatex --interaction=batchmode test-cctb-plain.tex >/dev/null
lualatex --interaction=batchmode test-cctb-latex.tex >/dev/null
-check-loader: $(UNPACKED_LOADER)
+check-loader: $(UNPACKED_LOADER) $(COMPAT_RUN)
luatex --interaction=batchmode test-loader-plain.tex >/dev/null
lualatex --interaction=batchmode test-loader-latex.tex >/dev/null
-check-modutils: $(UNPACKED_MODUTILS) $(LOADER_RUN) $(LINKS)
+check-modutils: $(UNPACKED_MODUTILS) $(LOADER_RUN) $(LINKS) $(COMPAT_RUN)
luatex --interaction=batchmode test-modutils-plain.tex >/dev/null
lualatex --interaction=batchmode test-modutils-latex.tex >/dev/null
-check-mcb: $(UNPACKED_MCB) $(LOADER_RUN) $(MOD_RUN) $(LINKS)
+check-mcb: $(UNPACKED_MCB) $(LOADER_RUN) $(MOD_RUN) $(LINKS) $(COMPAT_RUN)
luatex --interaction=batchmode test-callbacks-plain.tex >/dev/null
lualatex --interaction=batchmode test-callbacks-latex.tex >/dev/null
diff --git a/luamcallbacks.dtx b/luamcallbacks.dtx
index 19f875d..4b3149b 100644
--- a/luamcallbacks.dtx
+++ b/luamcallbacks.dtx
@@ -782,7 +782,8 @@ end
%<testplain>\input luatexbase-modutils.sty
%<testlatex>\RequirePackage{luatexbase-modutils}
%<*testplain,testlatex>
-\directlua{
+\catcode 64 11
+\luatexbase@directlua{
require "luamcallbacks"
local function one(head,...)
texio.write_nl("I'm number 1")
diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx
index 41d7b88..1d66d5a 100644
--- a/luatexbase-attr.dtx
+++ b/luatexbase-attr.dtx
@@ -252,6 +252,9 @@ See source file '\inFileName' for details.
%
% \subsubsection{Load supporting Lua module}
%
+% First load \pk{luatexbase-loader} (hence \pk{luatexbase-compat}), then
+% the supporting Lua module.
+%
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
@@ -259,7 +262,7 @@ See source file '\inFileName' for details.
\else
\RequirePackage{luatexbase-loader}
\fi
-\directlua{require('luatexbase.attr')}
+\luatexbase@directlua{require('luatexbase.attr')}
% \end{macrocode}
%
% \subsection{User macros}
@@ -276,7 +279,7 @@ See source file '\inFileName' for details.
\global\luatexattributedef#1=\allocationnumber
\unsetluatexattribute#1%
\begingroup\escapechar\m@ne \expandafter\endgroup
- \directlua{luatexbase.attributedef_from_tex(
+ \luatexbase@directlua{luatexbase.attributedef_from_tex(
'\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
\wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
\else
@@ -343,13 +346,14 @@ end
\newluatexattribute\testattr
\setluatexattribute\testattr{1}
\unsetluatexattribute\testattr
-\directlua{assert(luatexbase.attributes.testattr)}
+\catcode64 11
+\luatexbase@directlua{assert(luatexbase.attributes.testattr)}
\begingroup
\escapechar64
\newluatexattribute\anotherattr
\endgroup
\setluatexattribute\anotherattr{1}
-\directlua{assert(luatexbase.attributes.anotherattr)}
+\luatexbase@directlua{assert(luatexbase.attributes.anotherattr)}
%</testplain,testlatex>
%<testplain>\bye
%<testlatex>\stop
diff --git a/luatexbase-cctb.dtx b/luatexbase-cctb.dtx
index 0777106..d551ade 100644
--- a/luatexbase-cctb.dtx
+++ b/luatexbase-cctb.dtx
@@ -275,6 +275,9 @@ See source file '\inFileName' for details.
%
% \subsubsection{Load supporting Lua module}
%
+% First load \pk{luatexbase-loader} (hence \pk{luatexbase-compat}), then
+% the supporting Lua module.
+%
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
@@ -282,7 +285,7 @@ See source file '\inFileName' for details.
\else
\RequirePackage{luatexbase-loader}
\fi
-\directlua{require('luatexbase.cctb')}
+\luatexbase@directlua{require('luatexbase.cctb')}
% \end{macrocode}
%
% \subsubsection{User macros}
@@ -300,7 +303,7 @@ See source file '\inFileName' for details.
\global\chardef#1\allocationnumber
\luatexinitcatcodetable\allocationnumber
\begingroup\escapechar\m@ne \expandafter\endgroup
- \directlua{luatexbase.catcodetabledef_from_tex(
+ \luatexbase@directlua{luatexbase.catcodetabledef_from_tex(
'\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
\wlog{\string#1=\string\luatexcatcodetable\the\allocationnumber}%
\else
@@ -423,7 +426,7 @@ See source file '\inFileName' for details.
% Finally do the shortcuts.
%
% \begin{macrocode}
-\directlua{luatexbase.catcodetable_do_shortcuts()}
+\luatexbase@directlua{luatexbase.catcodetable_do_shortcuts()}
% \end{macrocode}
%
% That's all, folks!
@@ -483,7 +486,7 @@ end
%<testlatex>\RequirePackage{luatexbase-cctb}
%<*testplain,testlatex>
\newluatexcatcodetable\testcctb
-\directlua{assert(luatexbase.catcodetables.testcctb)}
+\luatexbase@directlua{assert(luatexbase.catcodetables.testcctb)}
% \end{macrocode}
%
% Also check that the catcodetable's number is remembered well,
@@ -494,7 +497,7 @@ end
\escapechar64
\newluatexcatcodetable\anothercctb
\endgroup
-\directlua{assert(luatexbase.catcodetables.anothercctb)}
+\luatexbase@directlua{assert(luatexbase.catcodetables.anothercctb)}
% \end{macrocode}
%
% Now, play a little bit with predefined tables.
@@ -505,7 +508,8 @@ end
\luatexcatcodetable\CatcodeTableLaTeX
\ifnum\catcode64=12 \else \ERROR \fi
%<testlatex>\documentclass{minimal}
-\directlua{%
+\catcode64 11
+\luatexbase@directlua{%
tex.sprint('\string\\setbox0=\string\\hbox{')
tex.sprint(luatexbase.catcodetables.string, "\string\\undef # _^&")
tex.sprint('}')
diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx
index 8584aa9..057b2bf 100644
--- a/luatexbase-loader.dtx
+++ b/luatexbase-loader.dtx
@@ -242,12 +242,23 @@ See source file '\inFileName' for details.
%
% \subsubsection{Main content}
%
+% First load \pk{luatexbase-compat}.
+%
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-compat.sty
+\else
+ \RequirePackage{luatexbase-compat}
+\fi
+% \end{macrocode}
+%
% Load the supporting Lua module. This one doesn't follow the usual naming
% conventions, since it won't be loaded with the usual functions for
% obvious bootstraping reasons.
%
% \begin{macrocode}
-\directlua{%
+\luatexbase@directlua{%
local file = "luatexbase.loader.lua"
local path = assert(kpse.find_file(file, 'tex'),
"File '"..file.."' no found")
diff --git a/luatexbase-modutils.dtx b/luatexbase-modutils.dtx
index cc8032e..d8a411e 100644
--- a/luatexbase-modutils.dtx
+++ b/luatexbase-modutils.dtx
@@ -229,7 +229,7 @@ See source file '\inFileName' for details.
\fi
% \end{macrocode}
%
-% Load the package loader.
+% Load \pk{luatexbase-loader} (hence \pk{luatexbase-compat}).
%
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
@@ -264,10 +264,10 @@ See the module #1 documentation for explanation.^^J ...^^J}%
% \texttt{\string\luaRequireModule} with two mandatory arguments.
%
% \begin{macrocode}
-\def\luatexUseModule#1{\directlua{luatexbase.use_module([[#1]])}}
+\def\luatexUseModule#1{\luatexbase@directlua{luatexbase.use_module([[#1]])}}
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
- \def\luatexRequireModule#1#2{\directlua{%
+ \def\luatexRequireModule#1#2{\luatexbase@directlua{%
luatexbase.require_module([[#1]], [[#2]])}}
\else
% \end{macrocode}
@@ -278,12 +278,12 @@ See the module #1 documentation for explanation.^^J ...^^J}%
% date).
%
% \begin{macrocode}
- \newcommand\luatexRequireModule[2][0]{\directlua{luatexbase.require_module([[#2]], [[#1]])}}
+ \newcommand\luatexRequireModule[2][0]{\luatexbase@directlua{luatexbase.require_module([[#2]], [[#1]])}}
\fi
% \end{macrocode}
%
% \begin{macrocode}
-\directlua{require('luatexbase.modutils')}
+\luatexbase@directlua{require('luatexbase.modutils')}
% \end{macrocode}
%
% \begin{macrocode}