summaryrefslogtreecommitdiff
path: root/tex/context/base/mult-ini.mkiv
blob: e785624f51317faf35ae6f5ba2623f0f1525221d (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
%D \module
%D   [       file=mult-ini,
%D        version=2008.02.15,
%D          title=\CONTEXT\ Multilingual Macros,
%D       subtitle=Initialization,
%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.

\unprotect

\registerctxluafile{mult-ini}{1.001}

\def\startmessages #1 library: #2 %
  {\bgroup
   \doifundefined{\m!prefix!#2}{\setgvalue{\m!prefix!#2}{#2}}%
   \catcode13=\active
   \doifinsetelse{#1}{\currentresponses,all}\dostartmessages\nostartmessages{#2}}

\def\dostartmessages#1#2\stopmessages
  {\ctxlua{interfaces.setmessage("#1",[[#2]])}%
   \egroup}

\def\nostartmessages#1#2\stopmessages
  {\egroup}

\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}}
\unexpanded\def\getmessage     #1#2{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}
\unexpanded\def\makemessage  #1#2#3{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.makemessage("#1","#2","#3"))}}
\unexpanded\def\showmessage  #1#2#3{\ctxlua{interfaces.showmessage("#1","#2","#3")}}

%D This way we also have the keywords at the lua end:

\def\dowithinterfaceconstant#1#2{\ctxlua{interfaces.setconstant("#1","#2")}}
\def\dowithinterfacevariable#1#2{\ctxlua{interfaces.setvariable("#1","#2")}}

\protect \endinput