summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/attr-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/attr-ini.mkiv')
-rw-r--r--tex/context/base/mkiv/attr-ini.mkiv36
1 files changed, 30 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/attr-ini.mkiv b/tex/context/base/mkiv/attr-ini.mkiv
index d537cebfa..3792b1c63 100644
--- a/tex/context/base/mkiv/attr-ini.mkiv
+++ b/tex/context/base/mkiv/attr-ini.mkiv
@@ -24,6 +24,7 @@
\installcorenamespace{attributecount} % the counter representing the attribute (attrdef'd)
\installcorenamespace{attributeid} % the internal number
\installcorenamespace{attributestack} % the attribute specific stack
+\installcorenamespace{attributepickup}
\unexpanded\def\pushattribute#1%
{\global\advance\csname\??attributestack\string#1\endcsname\plusone
@@ -40,12 +41,15 @@
\newtoks \t_attr_list_global
\newtoks \t_attr_list_local
+\newtoks \t_attr_list_pickup
\newtoks \t_attr_list_nomath
\ifdefined \s!global \else \def\s!global {global} \fi % for metatex % or hard check later
\ifdefined \s!public \else \def\s!public {public} \fi % for metatex % or hard check later
\ifdefined \s!private \else \def\s!private {private} \fi % for metatex % or hard check later
\ifdefined \s!attribute \else \def\s!attribute{attribute} \fi % for metatex % or hard check later
+\ifdefined \s!pickup \else \def\s!pickup {pickup} \fi % for metatex % or hard check later
+\ifdefined \s!forget \else \def\s!forget {forget} \fi % for metatex % or hard check later
\unexpanded\def\defineattribute {\dodoubleempty\attr_basics_define}
\unexpanded\def\definesystemattribute{\dodoubleempty\attr_basics_define_system}
@@ -53,6 +57,8 @@
\def\attr_basics_define {\attr_basics_define_indeed\s!public}
\def\attr_basics_define_system{\attr_basics_define_indeed\s!private}
+ % here public means 'visible' so it's not to be confused with 'public' at the lua end
+
\def\attr_basics_define_indeed#1[#2][#3]%
{\ifcsname\??attributecount#2\endcsname\else
\scratchcounter\clf_defineattribute{#2}{#1}\relax
@@ -62,15 +68,33 @@
\csname\??attributeid#2\endcsname\scratchcounter
% some attributes are always global
\doifelseinset\s!global{#3}%
- {\appendetoks\csname\??attributecount#2\endcsname\attributeunsetvalue\to\t_attr_list_global}%
- {\appendetoks\csname\??attributecount#2\endcsname\attributeunsetvalue\to\t_attr_list_local }%
+ {\etoksapp\t_attr_list_global{\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
+ {\etoksapp\t_attr_list_local {\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
\doifinset\s!nomath{#3}%
- {\appendetoks\csname\??attributecount#2\endcsname\attributeunsetvalue\to\t_attr_list_nomath}%
- % here public means 'visible' so it's not to be confused with 'public' at the lua end
+ {\etoksapp\t_attr_list_nomath{\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
\doifinset\s!public{#3}%
{\expandafter\let\csname#2\s!attribute\expandafter\endcsname\csname\??attributeid#2\endcsname}%
+ \doifinset\s!pickup{#3}%
+ {\expandafter\newconstant\csname\??attributepickup#2\endcsname
+ \csname\??attributepickup#2\endcsname\attributeunsetvalue
+ \etoksapp\t_attr_list_pickup{\csname\??attributecount#2\endcsname\csname\??attributepickup#2\endcsname}%
+ \ifcsname#2\s!attribute\endcsname
+ \expandafter\edef\csname\s!pickup#2\s!attribute\endcsname
+ {\csname\??attributepickup#2\endcsname\csname\??attributecount#2\endcsname}%
+ \expandafter\edef\csname\s!forget#2\s!attribute\endcsname
+ {\csname\??attributepickup#2\endcsname\attributeunsetvalue}%
+ \fi}%
\fi}
+\unexpanded\def\pickupattributes
+ {\the\t_attr_list_pickup\relax}
+
+% \unexpanded\def\pickupattribute#1%
+% {\csname\??attributecount#1\endcsname\csname\??attributepickup#1\endcsname}
+
+% \unexpanded\def\pickupattributelater#1%
+% {\csname\??attributepickup#1\endcsname\csname\??attributecount#1\endcsname}
+
\unexpanded\def\newattribute#1%
{\attr_basics_define_indeed\s!public[\csstring#1][]%
\expandafter\let\expandafter#1\csname\??attributeid\csstring#1\endcsname}
@@ -84,8 +108,8 @@
\let\dompattribute\gobbletwoarguments
-\unexpanded\def\resetglobalattributes{\the\t_attr_list_global}
-\unexpanded\def\resetlocalattributes {\the\t_attr_list_local }
+\unexpanded\def\resetglobalattributes{\the\t_attr_list_global\attribute\zerocount\zerocount}
+\unexpanded\def\resetlocalattributes {\the\t_attr_list_local \attribute\zerocount\zerocount}
\let\resetallattributes\resetlocalattributes