summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--TODO27
-rw-r--r--luatexbase-mcb.dtx136
3 files changed, 151 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 31a6841..263875f 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ LINKS = luatexbase.attr.lua luatexbase.cctb.lua \
luatexbase.mcb.lua luatexbase.modutils.lua
# Files grouped by generation mode
-UNPACKED_MCB = mcb.lua \
+UNPACKED_MCB = luatexbase-mcb.sty mcb.lua \
test-mcb-latex.tex test-mcb-plain.tex
UNPACKED_REGS = luatexbase-regs.sty \
test-regs-plain.tex test-regs-latex.tex
diff --git a/TODO b/TODO
index b81d103..6c43e1a 100644
--- a/TODO
+++ b/TODO
@@ -1,18 +1,37 @@
modutils
--------
-Review extensively.
- Renaming:
\luatexUseModule
\luatexRequireModule
\luatexModuleError
- stop using module() inside functions
+- Make more Lua objects local.
- logic (see what LaTeX2e does)
+- syntax of public TeX macros and Lua functions
+- General review of code and comments.
+- Update user documentation.
mcallbacks
----------
-Review extensively.
-Compatibility : tex.luaversion not available in 0.25.4 :'(
-Incorporate remaining bits from luatextra?
+- Compatibility : tex.luaversion not available in 0.25.4 :'(
+- Incorporate remaining bits from luatextra?
+- Make more Lua objects local.
+- Stop creating functions in the callback table ?!
+- Make a decision about names of public functions.
+- General review of code and comments.
+- Update user documentation.
+luatexbase
+----------
+
+- create it, make it load the others (except maybe mcb for now)
+- create general documentation
+
+afterwards
+----------
+
+- check/adapt luatextra
+- Bump version number, make zip, announce.
+- engage discussion with Heiko
diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index d711ff1..4abe6db 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -1,6 +1,8 @@
% \iffalse meta-comment
%
-% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>
+% Written in 2009, 2010 by Manuel Pégourié-Gonnard and Élie Roux.
+% <mpg@elzevir.fr>
+% <elie.roux@telecom-bretagne.eu>
%
% This work is under the CC0 license.
%
@@ -43,6 +45,11 @@ See source file '\inFileName' for details.
\let\MetaPrefix\DoubleperCent
\generate{%
+ \usedir{tex/luatex/luatexbase}%
+ \file{luatexbase-mcb.sty}{\from{luatexbase-mcb.dtx}{texpackage}}%
+}
+
+\generate{%
\usedir{doc/luatex/luatexbase}%
\file{test-mcb-plain.tex}{\from{luatexbase-mcb.dtx}{testplain}}%
\file{test-mcb-latex.tex}{\from{luatexbase-mcb.dtx}{testlatex}}%
@@ -108,7 +115,9 @@ See source file '\inFileName' for details.
%
% \title{The \textsf{luatexbase-mcb} package}
% \date{2009/09/18 v0.93}
-% \author{Elie Roux \\ \texttt{elie.roux@telecom-bretagne.eu}}
+% \author{%
+% Manuel P\'egouri\'e-Gonnard \\ \email{mpg@elzevir.fr} \and
+% \'Elie Roux \\ \email{elie.roux@telecom-bretagne.eu}}
%
% \maketitle
%
@@ -122,6 +131,8 @@ See source file '\inFileName' for details.
% has been previously loaded. (This is a temporary limitation.)
% \end{abstract}
%
+% \tableofcontents
+%
% \section{Documentation}
%
% Lua\TeX\ provides an extremely interesting feature, named callbacks. It
@@ -149,10 +160,7 @@ See source file '\inFileName' for details.
% This package also privides a way to create and call new callbacks, in
% addition to the default Lua\TeX\ callbacks.
%
-% This package contains only a \texttt{.lua} file, that can be called by
-% another lua script.
-%
-%\subsubsection*{Limitations}
+% \subsubsection*{Limitations}
%
% This package only works for callbacks where it's safe to add multiple
% functions without changing the functions' signatures. There are callbacks,
@@ -171,6 +179,117 @@ See source file '\inFileName' for details.
%
% \section{Implementation}
%
+% \subsection{\tex package}
+%
+% \begin{macrocode}
+%<*texpackage>
+% \end{macrocode}
+%
+% \subsubsection{Preliminaries}
+%
+% Reload protection, especially for \plaintex.
+%
+% \begin{macrocode}
+ \csname lltxb@mcb@loaded\endcsname
+\expandafter\let\csname lltxb@mcb@loaded\endcsname\endinput
+% \end{macrocode}
+%
+% Catcode defenses.
+%
+% \begin{macrocode}
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@mcb@AtEnd\endcsname
+% \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-mcb}[2010/09/11 v0.93 Callbacks hanndling 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-mcb}{LuaTeX is required for this package. Aborting.}
+ \lltxb@mcb@AtEnd
+ \expandafter\endinput
+\fi
+% \end{macrocode}
+%
+% \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
+ \input luatexbase-modutils.sty
+\else
+ \RequirePackage{luatexbase-modutils}
+\fi
+\luatexbase@directlua{require('luatexbase.mcb')}
+% \end{macrocode}
+%
+% That's all folks!
+%
+% \begin{macrocode}
+\lltxb@mcb@AtEnd
+%</texpackage>
+% \end{macrocode}
+%
% \subsection{Lua module}
%
% Module identification.
@@ -681,12 +800,11 @@ end
% A few basic tests for Plain and LaTeX.
%
% \begin{macrocode}
-%<testplain>\input luatexbase-modutils.sty
-%<testlatex>\RequirePackage{luatexbase-modutils}
+%<testplain>\input luatexbase-mcb.sty
+%<testlatex>\RequirePackage{luatexbase-mcb}
%<*testplain,testlatex>
\catcode 64 11
\luatexbase@directlua{
- require "luatexbase.mcb"
local function one(head,...)
texio.write_nl("I'm number 1")
return head, true