prop-ini.mkiv / last modification: 2020-01-30 14:16
%D \module
%D   [       file=prop-ini,
%D        version=2003.04.20,
%D          title=\CONTEXT\ Property Macros,
%D       subtitle=Initialization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Property Macros / Initialization}

%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

\installcorenamespace{propertytypes}
\installcorenamespace{propertydefiners}
\installcorenamespace{propertystarters}

\def\properties_obsolete_message
  {\writestatus\m!system{properties are obsolete, use dedicated commands}%
   \glet\properties_obsolete_message\donothing}

\setvalue{\??propertydefiners\v!layer   }[#1][#2][#3]{\defineviewerlayer[#1][#3]}
\setvalue{\??propertydefiners\s!effect  }[#1][#2][#3]{\defineeffect     [#1][#3]}
\setvalue{\??propertydefiners\v!negative}[#1][#2][#3]{}

\unexpanded\def\defineproperty
  {\dotripleempty\properties_define}

\def\properties_define[#1][#2][#3]%
  {\properties_obsolete_message
   \setevalue{\??propertytypes#1}{#2}%
   \getvalue{\??propertydefiners#2}[#1][#2][#3]}

\setvalue{\??propertystarters\v!layer   }#1{\let\properties_stop\stopviewerlayer\startviewerlayer[#1]}
\setvalue{\??propertystarters\s!effect  }#1{\let\properties_stop\stopeffect     \starteffect     [#1]}
\setvalue{\??propertystarters\v!negative}#1{\let\properties_stop\stopnegative   \startnegative       }

\unexpanded\def\property[#1]%
  {\groupedcommand{\properties_start{#1}}\properties_stop}

\unexpanded\def\startproperty[#1]%
  {\properties_start{#1}}

\unexpanded\def\stopproperty
  {\properties_stop}

\unexpanded\def\properties_start#1%
  {\pushmacro\properties_stop
   \getvalue{\??propertystarters\getvalue{\??propertytypes#1}}{#1}}

\unexpanded\def\properties_stop
  {\properties_stop
   \popmacro\properties_stop}

\protect \endinput