summaryrefslogtreecommitdiff
path: root/tex/context/base/luat-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/luat-ini.mkiv')
-rw-r--r--tex/context/base/luat-ini.mkiv82
1 files changed, 2 insertions, 80 deletions
diff --git a/tex/context/base/luat-ini.mkiv b/tex/context/base/luat-ini.mkiv
index f2355da2a..37d84ccce 100644
--- a/tex/context/base/luat-ini.mkiv
+++ b/tex/context/base/luat-ini.mkiv
@@ -101,78 +101,6 @@
\edef\luamajorversion{\ctxwrite{_MINORVERSION}}
\edef\luaminorversion{\ctxwrite{_MAJORVERSION}}
-%D \macros
-%D {definenamedlua}
-%D
-%D We provide an interface for defining instances:
-
-\def\s!lua {lua}
-\def\s!code {code}
-\def\s!data {data}
-\def\s!start{start}
-\def\s!stop {stop}
-
-%D Beware: because \type {\expanded} is een convert command, the error
-%D message will show \type{<inserted text>} as part of the message.
-
-\installsystemnamespace{luacode}
-
-\normalprotected\def\luat_start_named_lua_code#1%
- {\begingroup
- \obeylualines
- \obeyluatokens
- \csname\??luacode#1\endcsname}
-
-\normalprotected\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet / we could use numbers instead (more efficient)
- {\ifcsname\??luacode#1\endcsname \else
- \expandafter\chardef\csname\??luacode:#1\endcsname\ctxlua{lua.registername("#1","#3")}%
- \normalexpanded{\xdef\csname\??luacode#1\endcsname##1\csname\s!stop#1\s!code\endcsname}%
- {\noexpand\normalexpanded{\endgroup\noexpand\directlua\csname\??luacode:#1\endcsname{_G=protect("#1\s!data")##1}}}%
- \expandafter\edef\csname\s!start#1\s!code\endcsname {\luat_start_named_lua_code{#1}}%
- \expandafter\edef\csname #1\s!code\endcsname##1{\noexpand\directlua\csname\??luacode:#1\endcsname{_G=protect("#1\s!data")##1}}%
- \fi}
-
-%D We predefine a few.
-
-% \definenamedlua[module][module instance] % not needed
-
-\definenamedlua[user] [private user]
-\definenamedlua[third] [third party module]
-\definenamedlua[isolated][isolated]
-
-%D In practice this works out as follows:
-%D
-%D \startbuffer
-%D \startluacode
-%D context("LUA")
-%D \stopluacode
-%D
-%D \startusercode
-%D global.context("USER 1")
-%D context.par()
-%D context("USER 2")
-%D context.par()
-%D if characters then
-%D context("ACCESS directly")
-%D elseif global.characters then
-%D context("ACCESS via global")
-%D else
-%D context("NO ACCESS at all")
-%D end
-%D context.par()
-%D if bogus then
-%D context("ACCESS directly")
-%D elseif global.bogus then
-%D context("ACCESS via global")
-%D else
-%D context("NO ACCESS at all")
-%D end
-%D context.par()
-%D \stopusercode
-%D \stopbuffer
-%D
-%D \typebuffer
-
%D We need a way to pass strings safely to \LUA\ without the
%D need for tricky escaping. Compare:
%D
@@ -291,9 +219,6 @@
\normalprotected\def\startctxfunctiondefinition #1 %
{\begingroup \obeylualines \obeyluatokens \luat_start_lua_function_definition_indeed{#1}}
-% \def\luat_start_lua_function_definition_indeed#1#2\stopctxfunctiondefinition
-% {\endgroup\expandafter\edef\csname#1\endcsname{\noexpand\luafunction\ctxcommand{ctxfunction(\!!bs#2\!!es)}\relax}}
-
\installsystemnamespace{luafunction}
\def\luat_start_lua_function_definition_indeed#1#2\stopctxfunctiondefinition
@@ -301,9 +226,6 @@
\expandafter\chardef\csname\??luafunction#1\endcsname\ctxcommand{ctxfunction(\!!bs#2\!!es)}\relax
\expandafter\edef\csname#1\endcsname{\noexpand\luafunction\csname\??luafunction#1\endcsname}}
-% \normalprotected\def\setctxluafunction#1#2% experiment
-% {\expandafter\chardef\csname#1\endcsname#2\relax}
-
\normalprotected\def\setctxluafunction#1#2% experiment
{\expandafter\chardef\csname\??luafunction#1\endcsname#2\relax
\expandafter\edef\csname#1\endcsname{\noexpand\luafunction\csname\??luafunction#1\endcsname}}
@@ -343,7 +265,7 @@
{\if\noexpand#1\letterbackslash\else#1\fi}
\normalprotected\def\installctxfunction#1#2%
- {\expandafter\chardef\csname\??luafunction\checkedstrippedcsname#1\endcsname\ctxcommand{ctxfunction("#2",true)}\relax
- \expandafter\edef\csname\checkedstrippedcsname#1\endcsname{\noexpand\luafunction\csname\??luafunction\checkedstrippedcsname#1\endcsname}}
+ {\global\expandafter\chardef\csname\??luafunction\checkedstrippedcsname#1\endcsname\ctxcommand{ctxfunction("#2",true)}\relax
+ \expandafter\xdef\csname\checkedstrippedcsname#1\endcsname{\noexpand\luafunction\csname\??luafunction\checkedstrippedcsname#1\endcsname}}
\protect \endinput