diff options
Diffstat (limited to 'tex/context/base/attr-ini.mkiv')
-rw-r--r-- | tex/context/base/attr-ini.mkiv | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/tex/context/base/attr-ini.mkiv b/tex/context/base/attr-ini.mkiv index 9dfa7baae..c6b798d18 100644 --- a/tex/context/base/attr-ini.mkiv +++ b/tex/context/base/attr-ini.mkiv @@ -40,31 +40,31 @@ \newtoks \attributesresetlist -\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 - -\unexpanded\def\defineattribute - {\dodoubleempty\attr_basics_define} - -\def\attr_basics_define[#1][#2]% alternatively we can let lua do the housekeeping - {\expandafter\newattribute\csname\??attributecount#1\endcsname - \expandafter\newconstant \csname\??attributeid#1\endcsname - \csname\??attributeid#1\endcsname\c_syst_last_allocated_attribute - \ctxcommand{defineattribute("#1",\number\c_syst_last_allocated_attribute)}% - \doifnotinset\s!global{#2}{\appendetoks\csname\??attributecount#1\endcsname\attributeunsetvalue\to\attributesresetlist}% - \doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname\??attributeid#1\endcsname}} - -\unexpanded\def\definesystemattribute - {\dodoubleempty\attr_basics_define_system} - -\def\attr_basics_define_system[#1][#2]% alternatively we can let lua do the housekeeping - {\scratchcounter\ctxcommand{getprivateattribute("#1")}\relax - \expandafter\attributedef\csname\??attributecount#1\endcsname\scratchcounter - \expandafter\newconstant \csname\??attributeid#1\endcsname - \csname\??attributeid#1\endcsname\scratchcounter - %\writestatus\m!system{defining system attribute #1 with number \number\scratchcounter}% - \doifnotinset\s!global{#2}{\appendetoks\csname\??attributecount#1\endcsname\attributeunsetvalue\to\attributesresetlist}% - \doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname\??attributeid#1\endcsname}} +\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 + +\unexpanded\def\defineattribute {\dodoubleempty\attr_basics_define} +\unexpanded\def\definesystemattribute{\dodoubleempty\attr_basics_define_system} + +\def\attr_basics_define {\attr_basics_define_indeed\s!public} +\def\attr_basics_define_system{\attr_basics_define_indeed\s!private} + +\def\attr_basics_define_indeed#1[#2][#3]% + {\scratchcounter\clf_defineattribute{#2}{#1}\relax + %\writestatus\m!system{defining #1 attribute #2 with number \number\scratchcounter}% + \expandafter\attributedef\csname\??attributecount#2\endcsname\scratchcounter + \expandafter\newconstant \csname\??attributeid#2\endcsname + \csname\??attributeid#2\endcsname\scratchcounter + % some attributes are always global + \doifnotinset\s!global{#3}{\appendetoks\csname\??attributecount#2\endcsname\attributeunsetvalue\to\attributesresetlist}% + % here public means 'visible' so it's not to be confused with 'public' at the lua end + \doifinset \s!public{#3}{\expandafter\let\csname#2\s!attribute\expandafter\endcsname\csname\??attributeid#2\endcsname}} + +\unexpanded\def\newattribute#1% + {\attr_basics_define_indeed\s!public[\strippedcsname#1][]% + \expandafter\let\expandafter#1\csname\??attributeid\strippedcsname#1\endcsname} % expandable so we can \edef them for speed @@ -79,13 +79,13 @@ %D Rather special. -\unexpanded\def\savecurrentattributes #1{\ctxcommand{savecurrentattributes ("#1")}} -\unexpanded\def\restorecurrentattributes#1{\ctxcommand{restorecurrentattributes("#1")}} +\unexpanded\def\savecurrentattributes #1{\clf_savecurrentattributes {#1}} +\unexpanded\def\restorecurrentattributes#1{\clf_restorecurrentattributes{#1}} %D For the moment we put this here (later it will move to where it's used): \definesystemattribute [state] -\definesystemattribute [color] [public] +\definesystemattribute [color] [public] % global \definesystemattribute [colormodel] [public,global] \definesystemattribute [skip] \definesystemattribute [penalty] @@ -105,6 +105,6 @@ \definesystemattribute [checkedbreak] [public] \definesystemattribute [vboxtohboxseparator] [public] -\unexpanded\def\showattributes{\ctxcommand{showattributes()}} +\unexpanded\def\showattributes{\clf_showattributes} \protect \endinput |