% dbp-globals.sty

\makeatletter
\newtoks\tok@Chap	%prefix for global references
\tok@Chap={} % added 10 aug 2014 
\newtoks\tok@Sect
\tok@Sect={S:}
\newtoks\tok@Prob
\tok@Prob={P:}
\def\E@{}% to keep equation labels shorter

%\newtoks\tok@App	\tok@App={} % added 1 July 2015

\global\let\oldnewlabel\newlabel% in case hyperref not loaded
%\let\LABEL=\label	% default
%\let\REF=\ref
\def\LABEL#1{\label{#1}}
\def\REF#1{\ref{#1}}

\newif\if@GLOBAL	% to switch on global sections 
\@GLOBALfalse
\def\makeGLOBALS{%  create file for global section crossrefs
	\@GLOBALtrue%
	\expandafter\newwrite\csname tf@gbl\endcsname%
	\immediate\openout \csname tf@gbl\endcsname \jobname.gbl\relax%
}
%%\def\getGLOBALS{\relax}% reset in MiniEmpirical.tex
\def\getGLOBALS{\relax}% reset in mini-latex.sty

%\let\LABEL\label
%\tok@Chap={fred}
%\def\LABEL#1{\label{\the\tok@Chap#1}}

\def\LOCALlabels{%
	\def\E@{\the\tok@Chap}
	% the next two lines need to follow reading of aux file
	\def\LABEL##1{\label{\E@##1}}
	\def\REF##1{\ref{\E@##1}}
%	\let\@@@newlabel\newlabel
%	\def\newlabel##1##2{\@@@newlabel{##1}{\the\tok@Chap##2}}%
%	\let\OLDLABEL\label
% 	\edef\LABEL##1{\label{\the\tok@Chap##1}}
%	\gdef\label##1{\OLDLABEL{\the\tok@Chap##1}}
}


\makeatother

\newif\ifDRAFT
\DRAFTfalse

\newif\ifEDIT
\EDITfalse

\newif\ifFINAL
\FINALtrue

