%D \module
%D   [       file=core-nav,
%D        version=1995.1.1,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=New ones,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. Non||commercial use is 
%C granted. 

%D To be placed elsewhere.

\writestatus{loading}{Context Core Macros / New Ones}

\unprotect

% Some kind of new feature, for the moment a private one.
%
% \enablemode[screen,paper,bound]
%
% \doifmodeelse {paper}        {this} {that}
% \doifmode     {paper,screen} {this}
% \doifnotmode  {paper,bound}  {that} 
%
% \startmode [list]
% \stopmode
%
% \startnotmode [list]
% \stopnotmode

\let\currentmode=\empty

\def\enablemode[#1]%
  {\expandafter\addtocommalist\expandafter{#1}\currentmode}

\def\disablemode[#1]%
  {\expandafter\removefromcommalist\expandafter{#1}\currentmode}

\def\doifmodeelse%
  {\unprotect\dodoifmodeelse}

\long\def\dodoifmodeelse#1#2#3%
  {\protect\ExpandBothAfter\doifcommonelse{\currentmode}{#1}{#2}{#3}}

\def\doifmode%
  {\unprotect\dodoifmode}

\long\def\dodoifmode#1#2%
  {\protect\ExpandBothAfter\doifcommonelse{\currentmode}{#1}{#2}{}}

\def\doifnotmode%
  {\unprotect\dodoifnotmode}

\long\def\dodoifnotmode#1#2%
  {\protect\ExpandBothAfter\doifcommonelse{\currentmode}{#1}{}{#2}}

\def\startmode%
  {\unprotect\dostartmode}

\long\def\dostartmode[#1]#2\stopmode%
  {\dodoifmode{#1}{#2}}

\def\startnotmode%
  {\unprotect\dostartnotmode}

\long\def\dostartnotmode[#1]#2\stopnotmode%
  {\dodoifnotmode{#1}{#2}}

\protect 

\endinput
