%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 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. \registerctxluafile{syst-lua}{1.001} \unprotect \def\expdoifelse#1#2{\ctxcommand{doifelse(\!!bs#1\!!es==\!!bs#2\!!es)}} \def\expdoif #1#2{\ctxcommand{doif (\!!bs#1\!!es==\!!bs#2\!!es)}} \def\expdoifnot #1#2{\ctxcommand{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{\ctxcommand{doifcommonelse("#1","#2")}} \def\expdoifinsetelse #1#2{\ctxcommand{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]} \unexpanded\def\writestatus#1#2{\ctxcommand{writestatus(\!!bs#1\!!es,\!!bs#2\!!es)}} % A handy helper: % \def\luaexpr#1{\ctxlua{context(tostring(#1))}} % more efficient: % We can omit the tex.ctxcatcodes here as nowadays we seldom % change the regime at the \TEX\ end: \def\luaexpr#1{\directlua{tex.print(tostring(#1))}} % helpers: \def\ui_fo #1{#1} \def\ui_go #1{} \def\ui_ft#1#2{#1} \def\ui_st#1#2{#2} \protect \endinput