diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/supp-box.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/supp-box.mkiv | 141 |
1 files changed, 106 insertions, 35 deletions
diff --git a/Master/texmf-dist/tex/context/base/supp-box.mkiv b/Master/texmf-dist/tex/context/base/supp-box.mkiv index 66f373b72a7..54b0e2860a3 100644 --- a/Master/texmf-dist/tex/context/base/supp-box.mkiv +++ b/Master/texmf-dist/tex/context/base/supp-box.mkiv @@ -570,7 +570,7 @@ %D \doiftext {data} {then branch} %D \stoptyping -\unexpanded\def\doiftextelse#1% +\unexpanded\def\doifelsetext#1% {\begingroup \setbox\scratchbox\hbox {\settrialtypesetting @@ -581,6 +581,8 @@ \endgroup\expandafter\firstoftwoarguments \fi} +\let\doiftextelse\doifelsetext + \unexpanded\def\doiftext#1% {\begingroup \setbox\scratchbox\hbox @@ -658,8 +660,8 @@ %D A slower but more versatile implementation is: %D %D \starttyping -%D \long\def\dowithnextbox#1#2% -%D {\long\def\syst_boxes_with_next_box{#1}% +%D \unexpanded\def\dowithnextbox#1#2% +%D {\def\syst_boxes_with_next_box{#1}% %D \ifx#2\hbox %D \afterassignment\syst_boxes_with_next_box_indeed %D \else\ifx#2\vbox @@ -1063,10 +1065,11 @@ %D \showhyphens{dohyphenatedword} %D \stoptyping -\def\doshowhyphenatednextbox - {\ctxcommand{showhyphenatedinlist(tex.box[\number\nextbox].list)}} +\unexpanded\def\doshowhyphenatednextbox + {\clf_showhyphenatedinlist\nextbox} -\unexpanded\def\showhyphens{\dowithnextboxcs\doshowhyphenatednextbox\hbox} +\unexpanded\def\showhyphens + {\dowithnextboxcs\doshowhyphenatednextbox\hbox} %D The following macros are seldom used but handy for tracing. %D @@ -1076,14 +1079,20 @@ %D \hyphenatedfile{tufte} %D \stoptyping -\def\dohyphenatednextbox - {\ctxcommand{hyphenatedlist(tex.box[\number\nextbox].list)}% +\unexpanded\def\dohyphenatednextbox + {\clf_hyphenatedlist\nextbox false\relax \unhbox\nextbox} \unexpanded\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox\hbox} \unexpanded\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox\hbox} \unexpanded\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}} +\unexpanded\def\dohyphenatednextboxcolor + {\clf_hyphenatedlist\nextbox true\relax + \unhbox\nextbox} + +\unexpanded\def\hyphenatedcoloredword{\dowithnextboxcs\dohyphenatednextboxcolor\hbox} + %D \macros %D {processtokens} %D @@ -1363,7 +1372,12 @@ \begingroup \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}% \setbox\scratchbox\hbox{\restorecurrentattributes{pic}#1}% - \ctxcommand{applytochars(\number\scratchbox,"\strippedcsname#2",true)}% + \clf_applytobox + method {char}% + box \scratchbox + command {\checkedstrippedcsname#2}% + nested true% + \relax \endgroup} \unexpanded\def\processisolatedwords#1#2% @@ -1371,34 +1385,88 @@ \begingroup \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}% \setbox\scratchbox\hbox{\restorecurrentattributes{pic}#1}% - \ctxcommand{applytowords(\number\scratchbox,"\strippedcsname#2",true)}% + \clf_applytobox + method {word}% + box \scratchbox + command {\checkedstrippedcsname#2}% + nested true% + \relax \endgroup} -\unexpanded\def\processwords#1% - {\processisolatedwords{#1}\processword} - -\let\processword\relax - -\unexpanded\def\applytosplitstringchar#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","char")}} -\unexpanded\def\applytosplitstringword#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","word")}} -\unexpanded\def\applytosplitstringline#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","line")}} - -\unexpanded\def\applytosplitstringcharspaced#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","char",true)}} -\unexpanded\def\applytosplitstringwordspaced#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","word",true)}} -\unexpanded\def\applytosplitstringlinespaced#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","line",true)}} - %D A variant: \unexpanded\def\applytocharacters#1% {\dontleavehmode - \dowithnextbox{\ctxcommand{applytochars(\number\nextbox,"\strippedcsname#1",true)}}% + \dowithnextbox{\clf_applytobox + method {char}% + box \nextbox + command {\checkedstrippedcsname#1}% + nested true% + \relax}% \hbox} \unexpanded\def\applytowords#1% {\dontleavehmode - \dowithnextbox{\ctxcommand{applytowords(\number\nextbox,"\strippedcsname#1",true)}}% + \dowithnextbox{\clf_applytobox + method {word}% + box \nextbox + command {\checkedstrippedcsname#1}% + nested true% + \relax}% \hbox} +%D The old call: + +\unexpanded\def\processwords#1% + {\processisolatedwords{#1}\processword} + +\let\processword\relax + +\unexpanded\def\applytosplitstringchar#1#2% + {\dontleavehmode\clf_processsplit + data {#2}% + command {\checkedstrippedcsname#1}% + method {char}% + \relax} + +\unexpanded\def\applytosplitstringword#1#2% + {\dontleavehmode\clf_processsplit + data {#2}% + command {\checkedstrippedcsname#1}% + method {word}% + \relax} + +\unexpanded\def\applytosplitstringline#1#2% + {\dontleavehmode\clf_processsplit + data {#2}% + command {\checkedstrippedcsname#1}% + method {line}% + \relax} + +\unexpanded\def\applytosplitstringcharspaced#1#2% + {\dontleavehmode\clf_processsplit + data {#2}% + command {\checkedstrippedcsname#1}% + method {char}% + spaced true% + \relax} + +\unexpanded\def\applytosplitstringwordspaced#1#2% + {\dontleavehmode\clf_processsplit + data {#2}% + command {\checkedstrippedcsname#1}% + method {word}% + spaced true% + \relax} + +\unexpanded\def\applytosplitstringlinespaced#1#2% + {\dontleavehmode\clf_processsplit + data {#2}% + command {\checkedstrippedcsname#1}% + method {line}% + spaced true% + \relax} + %D \macros %D {sbox} %D @@ -1795,7 +1863,7 @@ \box\d_syst_boxes_separator \fi \egroup - \ctxcommand{hboxtovbox(\number\scratchbox)}% + \clf_hboxtovbox\scratchbox \box\scratchbox \endgroup} @@ -1849,7 +1917,7 @@ \unexpanded\def\stophboxestohbox {\egroup - \ctxcommand{vboxlisttohbox(\number\scratchbox,\number\nextbox,\number\dimexpr\hboxestohboxslack)}% + \clf_vboxlisttohbox\scratchbox\nextbox\dimexpr\hboxestohboxslack\relax \dontleavehmode \unhbox\nextbox \removeunwantedspaces @@ -2024,7 +2092,7 @@ {\bgroup \def\syst_boxes_process_indeed{#1}% #1 can be redefined halfway \setbox\processbox\emptybox - \doifnextbgroupelse\syst_boxes_process_yes\syst_boxes_process_nop} + \doifelsenextbgroup\syst_boxes_process_yes\syst_boxes_process_nop} \def\syst_boxes_process_yes {\dowithnextboxcs\syst_boxes_process_content\hbox} @@ -2032,7 +2100,7 @@ \def\syst_boxes_process_content {\removeunwantedspaces \syst_boxes_process_indeed % takes \nextbox makes \processbox - \doifnextbgroupelse\syst_boxes_process_yes\syst_boxes_process_nop} + \doifelsenextbgroup\syst_boxes_process_yes\syst_boxes_process_nop} \unexpanded\def\syst_boxes_process_nop {\removeunwantedspaces @@ -2489,13 +2557,15 @@ \copy\csname\??stackbox#1:#2\endcsname \fi}} -\unexpanded\def\doifboxelse#1#2#3#4% +\unexpanded\def\doifelsebox#1#2#3#4% {\ifcsname\??stackbox#1:#2\endcsname \ifvoid\csname\??stackbox#1:#2\endcsname#4\else#3\fi \else #4% \fi} +\let\doifboxelse\doifelsebox + %D This one is cheaper (the above is no longer used that much): \installcorenamespace {boxstack} @@ -2525,9 +2595,6 @@ \unexpanded\def\globalpushbox{\syst_boxes_push\global} \unexpanded\def\globalpopbox {\syst_boxes_pop \global} -% \unexpanded\def\pushbox#1{\ctxcommand{pushbox(\number#1)}} -% \unexpanded\def\popbox #1{\ctxcommand{popbox(\number#1)}} - %D \macros %D {removedepth, obeydepth} %D @@ -2776,12 +2843,16 @@ % {\dowithnextbox{\edef#1{\syst_boxes_nodestostring}}\hbox} % % \def\syst_boxes_nodestostring -% {\ctxcommand{boxtostring(\number\nextbox)}} +% {\clf_boxtostring\nextbox} \unexpanded\def\nodestostring#1#2% more tolerant for #2=\cs {\begingroup \setbox\nextbox\hbox{#2}% - \normalexpanded{\endgroup\edef\noexpand#1{\ctxcommand{boxtostring(\number\nextbox)}}}} + \normalexpanded{\endgroup\edef\noexpand#1{\clf_boxtostring\nextbox}}} + +%D Even more dirty: + +\let\hyphenatedhbox\hbox \protect \endinput |