%\filename{LocalDecl.tex}
%\edited{last by stolfi on Thu Dec 26 13:09:57 1985}

% Macros that declare registers local to specific groups

% IGNORE LINE BREAKS FOR NOW

  \endlinechar=-1

% THE MACROS

\message{\ counter\ allocation...}

  % The \localcount macro is roughly like plain's \newcount, but it can be
  %   used to allocate counters local to specific groups, in a stack-like
  %   fashion. If you say
  %   
  %     \begingroup
  %        \localcount\foo
  %        \global\foo=1
  %        \begingroup
  %           \global\foo=2
  %           \begingroup
  %               \localcount\foo
  %               \global\foo=3
  %               \the\foo
  %           \endgroup
  %           \the\foo
  %        \endgroup
  %        \the\foo
  %     \endgroup
  %
  %   this will print 322 --- not 333 or 321 --- since the counter \foo
  %   was declared local to the innermost and outermost groups only.
  %   Note that you always have to use \global to change the value of 
  %   \foo; an assignment without \global will be undone at the end
  %   of the current group, independently of whether \foo was declared
  %   in it or not.
  
  \newcount\LocalCountCount \LocalCountCount=100
  \def\localcount#1{\countdef#1=\LocalCountCount
    \advance\LocalCountCount by 1
    \ifnum \LocalCountCount>200 \relax \TooManyLevels \fi}

  % The \localdimen macro is like \localcount for dimensions:
  
  \newcount\LocalDimenCount \LocalDimenCount=100
  \def\localdimen#1{\dimendef#1=\LocalDimenCount 
    \advance\LocalDimenCount by 1
    \ifnum \LocalDimenCount>200 \relax \TooManyLevels \fi}

% CLOSING OFF:

  \endlinechar=`\^^M
  
% END OF FILE

