summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-lua.mkiv
blob: 40cd9f75685be6dd1e77bfb51c1858bf851b6f32 (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
%D \module
%D   [       file=syst-lua,
%D        version=2008.01.25,
%D          title=\CONTEXT\ System Macros,
%D       subtitle=Helper macros based on \LUA,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\registerctxluafile{syst-lua}{1.001}

\unprotect

\def\expdoifelse#1#2{\ctxlua{commands.doifelse(\!!bs#1\!!es==\!!bs#2\!!es)}}
\def\expdoif    #1#2{\ctxlua{commands.doif    (\!!bs#1\!!es==\!!bs#2\!!es)}}
\def\expdoifnot #1#2{\ctxlua{commands.doifnot (\!!bs#1\!!es==\!!bs#2\!!es)}}

% \testfeatureonce{100000}{\doifelse{hello world}{here i am}{}}         % 0.3
% \testfeatureonce{100000}{\expandabledoifelse{hello world}{here i am}{}} % 1.5

\def\expdoifcommonelse#1#2{\ctxlua{commands.doifcommonelse("#1","#2")}}
\def\expdoifinsetelse #1#2{\ctxlua{commands.doifinsetelse("#1","#2")}}

% we define these here, just in case ...

\def\luastringsep{===} % this permits \typefile{self} otherwise nested b/e sep problems

\edef\!!bs{[\luastringsep[}
\edef\!!es{]\luastringsep]}

\def\writestatus#1#2{\ctxlua{commands.writestatus(\!!bs#1\!!es,\!!bs#2\!!es)}}

\protect \endinput