From e9ccab5308d2b6fec79e36c355c03aad4e1e5dec Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 4 Jun 2023 19:46:50 +0200 Subject: 2023-06-04 16:40:00 --- tex/context/base/mkxl/mult-aux.mkxl | 154 ++++++++++++++++++++++++++---------- 1 file changed, 113 insertions(+), 41 deletions(-) (limited to 'tex/context/base/mkxl/mult-aux.mkxl') diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl index 4940aaa04..3df8c8309 100644 --- a/tex/context/base/mkxl/mult-aux.mkxl +++ b/tex/context/base/mkxl/mult-aux.mkxl @@ -284,7 +284,7 @@ \frozen\def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname#1#2:##2\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}} \permanent\protected\def\installparameterhandler#1#2% - {\mutable\letcsname current#2\endcsname\empty + {\mutable\constant\letcsname current#2\endcsname\empty \normalexpanded {\mult_interfaces_install_parameter_handler {\noexpand#1}% \??aa @@ -366,15 +366,15 @@ \protected\def\mult_interfaces_install_style_and_color_handler#1#2#3#4% {\frozen\protected\def#2##1##2% style color - {\edef\currentstyleparameter{#1{##1}}% this name is public (can also set color e.g. in underline) + {\cdef\currentstyleparameter{#1{##1}}% this name is public (can also set color e.g. in underline) \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi - \edef\currentcolorparameter{#1{##2}}% this name is public (so we do this after the style switch) + \cdef\currentcolorparameter{#1{##2}}% this name is public (so we do this after the style switch) \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}% \frozen\protected\def#3##1% style - {\edef\currentstyleparameter{#1{##1}}% this name is public + {\cdef\currentstyleparameter{#1{##1}}% this name is public \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi}% \frozen\protected\def#4##1% color - {\edef\currentcolorparameter{#1{##1}}% this name is public + {\cdef\currentcolorparameter{#1{##1}}% this name is public \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}} \permanent\protected\def\installstyleandcolorhandler#1#2% @@ -388,7 +388,7 @@ \def\mult_check_for_parent#1#2#3#4% {\ifcsname#1#4:\s!parent\endcsname\orelse\ifx#4\empty\else \writestatus\m!system{error: invalid parent #4 for #3, #4 defined too (best check it)}% - \edefcsname#1#4:\s!parent\endcsname{#2}% + \cdefcsname#1#4:\s!parent\endcsname{#2}% \fi} \def\mult_interfaces_chain#1#2{\ifcsname#1#2:\s!chain\endcsname\lastnamedcs\space\fi} @@ -412,13 +412,13 @@ \letcsname#1#4:\s!chain\endcsname\empty \cdefcsname#1#4:\s!parent\endcsname{#3}% \or - \edef#4{##1}% + \cdef#4{##1}% \the#5% predefine \lettonothing#7% \cdefcsname#1#4:\s!chain\endcsname{##1}% \cdefcsname#1#4:\s!parent\endcsname{#3}% \or - \edef#4{##1}% + \cdef#4{##1}% \the#5% predefine \relax \ifhastok={##2}% @@ -427,7 +427,7 @@ \cdefcsname#1#4:\s!parent\endcsname{#3}% \mult_interfaces_get_parameters{#1#4:}[##2]% \else - \edef#7{##2}% + \cdef#7{##2}% \ifempty#7% \cdefcsname#1#4:\s!chain\endcsname{##1}% \cdefcsname#1#4:\s!parent\endcsname{#3}% @@ -438,9 +438,9 @@ \fi \fi \or - \edef#4{##1}% + \cdef#4{##1}% \the#5% predefine - \edef#7{##2}% + \cdef#7{##2}% \mult_check_for_parent{#1}{#3}#4#7% \cdefcsname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% \cdefcsname#1#4:\s!parent\endcsname{#1##2}% @@ -471,7 +471,7 @@ {\let#6#3% \ifnum\lastarguments=\plustwo \def#8####1% we will have a simple one as well - {\edef#3{####1}% + {\cdef#3{####1}% \mult_interfaces_get_parameters{#1#3:}[##2]% \the#4}% \processcommalist[##1]#8% @@ -501,10 +501,83 @@ \aliased\let\doingrootsetnamed \plusthree % \setuplayout[name] \aliased\let\doingrootsetroot \plusfour % \setuplayout -\protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3% - {\frozen\protected\def#3{\mult_interfaces_get_parameters{#1#2:}}} - -\protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% +% \protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3% +% {\frozen\protected\def#3{\mult_interfaces_get_parameters{#1#2:}}} + +% \protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% +% {\newtoks#5% +% \newconstant#2% +% \newtoks#8% +% \newtoks#9% +% \frozen\tolerant\protected\def#4[##1]##*[##2]% maybe helper +% {\ifarguments +% % \setuplayout +% \let#6#3% % previous becomes current +% \lettonothing#3% % current becomes empty +% #2\doingrootsetroot +% \the#5% +% \the#8% switchsetups +% \or +% \ifhastok={##1}% +% % \setuplayout[key=value] +% \let#7#3% +% \let#6#3% +% \lettonothing#3% +% #2\doingrootsetuproot +% \mult_interfaces_get_parameters{#1:}[##1]% +% \the#5% +% \the#8% switchsetups +% \let#3#7% +% \else +% % \setuplayout[whatever] +% \let#6#3% % previous becomes current +% \cdef#3{##1}% this will catch reset so one needs to test for it +% \ifempty#3% +% \let#7#6% +% #2\doingrootsetuproot +% \the#5% +% \the#8% switchsetups +% \let#3#7% +% \else +% #2\doingrootsetnamed +% \the#5% % we can check for previous vs current +% \the#8% switchsetups +% \fi +% \fi +% \or +% % \setuplayout[whatever][key=value] +% \let#7#3% +% \let#6#3% +% \cdef#3{##1}% +% #2\doingrootsetupnamed +% \mult_interfaces_get_parameters{#1#3:}[##2]% +% \the#5% +% \ifx#3#6\the#8\fi % only switchsetups if previous == current +% \let#3#7% +% \fi +% #2\zerocount % mode is always zero at the end +% \the#9}} + +% \permanent\protected\def\installswitchsetuphandler#1#2% +% {\mutable\letcsname current#2\endcsname\empty +% \mutable\letcsname previous#2\endcsname\empty +% \normalexpanded +% {\mult_interfaces_install_switch_setup_handler_a +% {\noexpand#1}% \??aa +% \expandafter\noexpand\csname current#2\endcsname +% \expandafter\noexpand\csname setupcurrent#2\endcsname +% \mult_interfaces_install_switch_setup_handler_b +% {\noexpand#1}% \??aa +% \expandafter\noexpand\csname #2setupmode\endcsname +% \expandafter\noexpand\csname current#2\endcsname +% \expandafter\noexpand\csname setup#2\endcsname +% \expandafter\noexpand\csname everysetup#2\endcsname +% \expandafter\noexpand\csname previous#2\endcsname +% \expandafter\noexpand\csname saved_setup_current#2\endcsname +% \expandafter\noexpand\csname everyswitch#2\endcsname +% \expandafter\noexpand\csname everysetup#2root\endcsname}} + +\protected\def\mult_interfaces_install_switch_setup_handler#1#2#3#4#5#6#7#8#9#A% {\newtoks#5% \newconstant#2% \newtoks#8% @@ -531,7 +604,7 @@ \else % \setuplayout[whatever] \let#6#3% % previous becomes current - \edef#3{##1}% this will catch reset so one needs to test for it + \cdef#3{##1}% this will catch reset so one needs to test for it \ifempty#3% \let#7#6% #2\doingrootsetuproot @@ -548,7 +621,7 @@ % \setuplayout[whatever][key=value] \let#7#3% \let#6#3% - \edef#3{##1}% + \cdef#3{##1}% #2\doingrootsetupnamed \mult_interfaces_get_parameters{#1#3:}[##2]% \the#5% @@ -556,17 +629,14 @@ \let#3#7% \fi #2\zerocount % mode is always zero at the end - \the#9}} + \the#9}% + \frozen\protected\def#A{\mult_interfaces_get_parameters{#1#3:}}} \permanent\protected\def\installswitchsetuphandler#1#2% {\mutable\letcsname current#2\endcsname\empty \mutable\letcsname previous#2\endcsname\empty \normalexpanded - {\mult_interfaces_install_switch_setup_handler_a - {\noexpand#1}% \??aa - \expandafter\noexpand\csname current#2\endcsname - \expandafter\noexpand\csname setupcurrent#2\endcsname - \mult_interfaces_install_switch_setup_handler_b + {\mult_interfaces_install_switch_setup_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname #2setupmode\endcsname \expandafter\noexpand\csname current#2\endcsname @@ -575,7 +645,9 @@ \expandafter\noexpand\csname previous#2\endcsname \expandafter\noexpand\csname saved_setup_current#2\endcsname \expandafter\noexpand\csname everyswitch#2\endcsname - \expandafter\noexpand\csname everysetup#2root\endcsname}} + \expandafter\noexpand\csname everysetup#2root\endcsname + \expandafter\noexpand\csname setupcurrent#2\endcsname}} + \protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8% {\newtoks#4% @@ -591,15 +663,15 @@ \the#4% \or \def#8####1% - {\edef#3{####1}% + {\cdef#3{####1}% #6% checks parent and sets if needed \mult_interfaces_get_parameters{#1#3:}[##2]% \the#4}% \processcommalist[##1]#8% \or \def#8####1% - {\edef#3{####1}% - \defcsname#1#3:\s!parent\endcsname{#1##2}% + {\cdef#3{####1}% + \cdefcsname#1#3:\s!parent\endcsname{#1##2}% \mult_interfaces_get_parameters{#1#3:}[##3]% always sets parent \the#4}% \processcommalist[##1]#8% @@ -754,7 +826,7 @@ {\immutable\edefcsname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}} \permanent\protected\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance} - {\edefcsname#1#2:\s!parent\endcsname{#3#4}} + {\cdefcsname#1#2:\s!parent\endcsname{#3#4}} %D Here is another experiment: @@ -766,7 +838,7 @@ \or %\ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##1}=^^^^0003^^^^0003^^^^0004% % \ifcondition\mult_aux_no_assignment_indeed##1\ignorearguments - % \edef#2{##1}% + % \cdef#2{##1}% % \else % \lettonothing#2% % #3[##1]% @@ -775,10 +847,10 @@ \lettonothing#2% #3[##1]% \else - \edef#2{##1}% + \cdef#2{##1}% \fi \or - \edef#2{##1}% + \cdef#2{##1}% #3[##2]% \fi \directsetup{handler:action:#1}% @@ -1022,14 +1094,14 @@ \frozen\protected\def#4##1% {\pushmacro#6% \advanceby#3\plusone - \edef#6{##1}% + \cdef#6{##1}% \unprotect}% \frozen\protected\def#5% {\protect \advanceby#3\minusone \popmacro#6}% \frozen\protected\def#7##1% - {\edef#6{##1}% + {\cdef#6{##1}% #2% \the\c_mult_set\relax}} @@ -1072,7 +1144,7 @@ \protected\def\mult_interfaces_install_parent_injector#1#2#3#4% {\frozen\protected\def#4##1% {\ifempty#3% - \defcsname#1#2:\s!parent\endcsname{#1##1}% + \cdefcsname#1#2:\s!parent\endcsname{#1##1}% was def \fi}} \permanent\protected\def\installparentinjector#1#2% @@ -1087,8 +1159,8 @@ \permanent\protected\def\mult_interfaces_install_local_current_injector#1#2#3#4% {\protected\def#4##1% {\advanceby#2\plusone - \edef#3{##1:\the#2}% \currentXXX - \edefcsname#1#3:\s!parent\endcsname{#1##1}}} + \cdef#3{##1:\the#2}% \currentXXX + \cdefcsname#1#3:\s!parent\endcsname{#1##1}}} \permanent\protected\def\installlocalcurrenthandler#1#2% \??XXX {XXX} {\expandafter\newinteger\csname#1:\s!counter\endcsname @@ -1178,7 +1250,7 @@ \csname\??commalistprocessornext#1\endcsname}} \permanent\protected\def\installcommalistprocessorcommand#1#2% \processor \action - {\edef\p_name{\csstring#2}% + {\cdef\p_name{\csstring#2}% \installcommalistprocessor\p_name{#2}% \expandafter\let\expandafter#1\csname\??commalistprocessor\p_name\endcsname} @@ -1213,7 +1285,7 @@ \the#4% \or \def#8####1% - {\edef#3{####1}% + {\cdef#3{####1}% #6% checks parent and sets if needed \let\mult_interfaces_adef\mult_interfaces_adef_nop \mult_interfaces_get_parameters{#1#3:}[##2]% @@ -1222,8 +1294,8 @@ \processcommalist[##1]#8% \or \def#8####1% - {\edef#3{####1}% - \defcsname#1#3:\s!parent\endcsname{#1##2}% + {\cdef#3{####1}% + \cdefcsname#1#3:\s!parent\endcsname{#1##2}% \let\mult_interfaces_adef\mult_interfaces_adef_nop \mult_interfaces_get_parameters{#1#3:}[##3]% always sets parent \let\mult_interfaces_adef\mult_interfaces_adef_yes -- cgit v1.2.3