blob: ed4a1398119f0e8c549de9183400f51627f420f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
%D \module
%D [ file=luat-cod,
%D version=2005.05.26,
%D title=\CONTEXT\ Lua Macros,
%D subtitle=Code,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
% \writestatus{loading}{ConTeXt Lua Macros / Code}
\unprotect
\newif\ifproductionrun
\permanent\let\ctxdirectlua \directlua
\permanent\def\ctxsprint #1{\directlua{tex.sprint(tex.ctxcatcodes,#1)}} % saves tokens
\permanent\def\ctxwrite #1{\directlua{tex.write(#1)}} % saves tokens
\permanent\def\ctxcommand #1{\directlua{commands.#1}} % saves tokens
\permanent\def\ctxdirectcommand#1{\directlua{commands.#1}} % saves tokens
\permanent\def\ctxreport #1{\directlua{logs.writer[[#1]]}}
%D Take your choice \unknown
\aliased\let\ctxlua \ctxdirectlua
\aliased\let\luacode \ctxdirectlua
\aliased\let\directluacode\ctxdirectlua
%D Reporting the version of \LUA\ that we use is done as follows:
\permanent\def\luaversion{\ctxwrite{LUAVERSION}}
\permanent\def\registerctxluafile#1#2{\ctxlua{lua.registercode("#1","#2")}}
\permanent\def\ctxloadluafile #1{\ctxlua{lua.registercode("#1")}}
\registerctxluafile{luat-cod.lmt}{autosuffix}
\toksapp \everydump {%
\permanent\let\ctxlatelua \latelua
\permanent\def\ctxlatecommand#1{\latelua{commands.#1}}%
\aliased\let\lateluacode \ctxlatelua
} % no \appendtoks yet
\protect \endinput
|