diff options
| author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-03-29 18:16:22 +0200 | 
|---|---|---|
| committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-03-29 18:16:22 +0200 | 
| commit | e4a0575aa7854548b4f881925f7477f12f3bc696 (patch) | |
| tree | 4a407e8260859a72a8dab4ac3431a68210038202 | |
| parent | 0fcd4965ecb2902d4fd6cb58c29b0b6c8d616ce4 (diff) | |
| download | luatexbase-e4a0575aa7854548b4f881925f7477f12f3bc696.tar.gz | |
compat: support for version testing
| -rw-r--r-- | luatexbase-compat.dtx | 27 | 
1 files changed, 24 insertions, 3 deletions
diff --git a/luatexbase-compat.dtx b/luatexbase-compat.dtx index c413bab..4d7f987 100644 --- a/luatexbase-compat.dtx +++ b/luatexbase-compat.dtx @@ -121,9 +121,9 @@ See source file '\inFileName' for details.  %  % \section{Documentation}  % -% Two problems are currently addressed by this package: changes in the syntax -% of |\directlua|, and variable policies for primitives activation and naming -% (in \luatex itself as well as in \texlive). +% Three problems are currently addressed by this package: changes in the +% syntax of |\directlua|, version information, and variable policies for +% primitives activation and naming (in \luatex itself as well as in \texlive).  %  % \medskip  % @@ -141,6 +141,14 @@ See source file '\inFileName' for details.  %  % \medskip  % +% Current versions of \luatex make the version available directly from Lua as +% |tex.luatexversion| and |tex.luatexrevision|. However, older versions (such +% as 0.25.4) didn't, which makes it particularly uneasy to test the version +% from within Lua. The present package makes this information available as +% |luatexbase.luatexversion| and |luatexbase.luatexrevision|. +% +% \medskip +%  % Starting with \luatex 0.39.0, the only primitives available in Ini\tex mode  % are the basic primitives from \tex{}82 and |\directlua|. All other  % primitives are hidden by default and have to be activated using a Lua @@ -298,6 +306,17 @@ See source file '\inFileName' for details.  \the\toks0  %    \end{macrocode}  % +%    \subsection{Version information} +% +%    Make |\luatexversion| and |\luatexrevision| available from Lua. +% +%    \begin{macrocode} +\luatexbase@directlua{% +  luatexbase = luatexbase or {} +  luatexbase.luatexversion = \number\luatexversion\space +  luatexbase.luatexrevision = \number\luatexrevision\space} +%    \end{macrocode} +%  %    \subsection{Primitives}  %  %    Try reasonably hard to activate a primitive. First, check if it is @@ -379,6 +398,8 @@ See source file '\inFileName' for details.  \luatexbase@directlua{local answer = 42}  \luatexbase@ensure@primitive{primitive}  \luatexprimitive\relax +\luatexbase@directlua{assert(type(luatexbase.luatexversion) == 'number')} +\luatexbase@directlua{assert(type(luatexbase.luatexrevision) == 'number')}  %</testplain,testlatex>  %<testplain>\bye  %<testlatex>\stop  | 
