summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/prop-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/prop-ini.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/prop-ini.mkiv140
1 files changed, 25 insertions, 115 deletions
diff --git a/Master/texmf-dist/tex/context/base/prop-ini.mkiv b/Master/texmf-dist/tex/context/base/prop-ini.mkiv
index 97d72582e3f..3cb5d2a6f5a 100644
--- a/Master/texmf-dist/tex/context/base/prop-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/prop-ini.mkiv
@@ -13,33 +13,32 @@
\writestatus{loading}{ConTeXt Property Macros / Initialization}
-%D Welcome to the third alternative of this yet undocumented module,
-%D which means that there is no public interface yet!
+%D This module is replaced by dedicated mechanisms. Originally properties were
+%D a sort of attributes in \MKII, but now we do things different anyway. We keep
+%D a surrogate mechanism around for compatibility reasons but even this will
+%D become obsolete some day.
\unprotect
-\newcount\propertylevel
+\def\propertyobsoletemessage
+ {\writestatus\m!system{properties are obsolete, use dedicated commands}%
+ \glet\propertyobsoletemessage\donothing}
-\def\currentpropertylevel {\csname\??py:l:\currentpropertytype\endcsname} % counter
-\def\previouspropertylevel{\csname\??py:p:\currentpropertytype\endcsname} % counter
+\setvalue{\??py:d:\v!layer }[#1][#2][#3]{\defineviewerlayer[#1][#3]}
+\setvalue{\??py:d:\s!effect }[#1][#2][#3]{\defineeffect [#1][#3]}
+\setvalue{\??py:d:\v!negative}[#1][#2][#3]{}
-\def\currentproperty {\csname\??py:c:\number\currentpropertylevel \endcsname} % string
-\def\previousproperty {\csname\??py:c:\number\previouspropertylevel\endcsname} % string
-
-% more efficient:
-
-\def\currentproperty {\csname\??py:c:\number\propertylevel\endcsname} % string
-\def\currentpropertytype {\csname\??py\currentproperty\c!type\endcsname}
+\unexpanded\def\defineproperty
+ {\dotripleempty\dodefineproperty}
-\def\docheckproperty % watch the s instead of e
- {\csname\s!check\currentpropertytype property\endcsname
- \global\expandafter\let\csname\??py\s!check\currentproperty\endcsname\empty}
+\def\dodefineproperty[#1][#2][#3]%
+ {\propertyobsoletemessage
+ \setevalue{\??py#1\c!type}{#2}%
+ \getvalue{\??py:d:#2}[#1][#2][#3]}
-\def\checkproperty[#1]%
- {\bgroup
- \def\currentproperty{#1}%
- \csname\??py\s!check\currentproperty\endcsname
- \egroup}
+\setvalue{\??py:s:\v!layer }#1{\let\dostopproperty\stopviewerlayer\startviewerlayer[#1]}
+\setvalue{\??py:s:\s!effect }#1{\let\dostopproperty\stopeffect \starteffect [#1]}
+\setvalue{\??py:s:\v!negative}#1{\let\dostopproperty\stopnegative \startnegative }
\unexpanded\def\property[#1]%
{\groupedcommand{\dostartproperty{#1}}\dostopproperty}
@@ -50,101 +49,12 @@
\unexpanded\def\stopproperty
{\dostopproperty}
-\def\dostartgproperty
- {\begingroup\dostartproperty}
-
-\def\dostopgproperty
- {\dostopproperty\endgroup}
-
-\def\dostartproperty#1% evt pack: {current}{level}{
- {\global\advance\propertylevel\plusone
- \@EAEAEA\xdef\currentproperty{#1}%
- \global\advance\previouspropertylevel\plusone
- \global\advance\currentpropertylevel\plusone
- \csname\??py\s!check\currentproperty\endcsname
- \csname\s!start\currentpropertytype\s!property\endcsname}
-
-\def\dostopproperty
- {\csname\s!stop\currentpropertytype\s!property\endcsname
- \global\advance\currentpropertylevel\minusone
- \global\advance\previouspropertylevel\minusone
- \global\advance\propertylevel\minusone}
-
-\unexpanded\def\defineproperty
- {\dotripleempty\dodefineproperty}
-
-\def\dodefineproperty[#1]%
- {\ifcsname\??py#1\c!global\endcsname
- \expandafter\nododefineproperty
- \else
- \expandafter\dododefineproperty
- \fi[#1]}
-
-% due to initializations/counters, definitions are always global
-%
-% global : yes : ungrouped
-% no : grouped
-% method : command : define commands
-% none : no commands
-
-\def\dododefineproperty[#1][#2][#3]% global ! ! !
- {\getgparameters[\??py#1][\c!global=\v!no,\c!type=#2,\c!method=\v!none,#3]% global ! ! ! !
- \ifcsname\??py:l:#2\endcsname \else
- \expandafter\newcount\csname\??py:l:#2\endcsname % current level
- \expandafter\newcount\csname\??py:p:#2\endcsname % previous level
- \global\csname\??py:p:#2\endcsname\minusone
- \global\expandafter\let\csname\??py:c:0\endcsname\empty
- \fi
- \letgvalue{\??py\s!check#1}\docheckproperty
- \doifelsevalue{\??py#1\c!method}\v!command
- {\doifelsevalue{\??py#1\c!global}\v!yes
- {\setugvalue{\e!start#1}{\dostartproperty{#1}}%
- \setugvalue{\e!stop #1}{\dostopproperty}}%
- {\setugvalue{\e!start#1}{\dostartgproperty{#1}}%
- \setugvalue{\e!stop #1}{\dostopgproperty}}}%
- {\doifelsevalue{\??py#1\c!global}\v!yes
- {\setugvalue{\e!start#2}[##1]{\dostartproperty{##1}}%
- \setugvalue{\e!stop #2}{\dostopproperty}}%
- {\setugvalue{\e!start#2}[##1]{\dostartgproperty{##1}}%
- \setugvalue{\e!stop #2}{\dostopgproperty}}}}
-
-\def\nododefineproperty[#1][#2][#3]%
- {}
-
-\def\doifelseproperty#1{\doifdefinedelse{\??py#1\c!global}}
-
-\unexpanded\def\setupproperty
- {\dodoubleempty\dosetupproperty}
-
-\def\dosetupproperty[#1][#2]% local
- {\ifsecondargument
- \getparameters[\??py#1][#2]%
- \else
- \getparameters[\??py][#1]%
- \fi}
-
-\letvalue{\??py\s!empty}\empty
-
-% beware, normally \*parameter concerns the current one
-
-\def\propertyparameter#1#2% expands to #1 when not defined (see \define...)
- {\csname\??py
- \ifcsname\??py#1#2\endcsname
- #1#2%
- \else\ifcsname\??py\csname\??py#1\c!type\endcsname#2\endcsname
- \csname\??py#1\c!type\endcsname#2%
- \else
- \s!empty
- \fi\fi
- \endcsname}
-
-\def\currentpropertyparameter % self and class
- {\propertyparameter\currentproperty}
-
-\def\checkedpropertyparameter#1% only self
- {\ifcsname\??py\currentproperty#1\endcsname\csname\??py\currentproperty#1\endcsname\fi}
+\unexpanded\def\dostartproperty#1%
+ {\pushmacro\dostopproperty
+ \getvalue{\??py:s:\getvalue{\??py#1\c!type}}{#1}}
-\unexpanded\def\definepropertyhandler#1{\setvalue{\??py*#1}}
-\def\propertyhandler #1{\getvalue{\??py*#1}}
+\unexpanded\def\dostopproperty
+ {\dostopproperty
+ \popmacro\dostopproperty}
\protect \endinput