% Making those `Label(s) have changed\dots' messages more explicit
%
% The \LaTeX{} kernel produces the messages when something, while the
% |.aux| file is being scanned (after the \cs{AtEndDocument} tokens
% have been executed), sets the \cs{if@tempswa} switch with the
% command \cs{@tempswatrue}.
%
% (This fact can be used by packages, such as my |footmisc.sty|, to
% piggy-back on the message; but it's nice in that circumstance and
% others to be sure where the message is coming from.)
%
% This is a jiffy patch to the kernel so that it produces a
% (\cs{typeout}) message for each label \emph{it} thinks has changed.
%
% the package also ignores catcode differences between copies of the
% same label.  (there seem to be problems in this area, in certain
% cases where cjk and hyperref meet.)
%
% Robin Fairbairns (robin.fairbairns@cl.cam.ac.uk)
% Produced in this form 2005-04-12
%
\def\@testdef #1#2#3{%
  \def\reserved@a{#3}%
  \edef\reserved@a{\expandafter\strip@prefix\meaning\reserved@a}%
  \expandafter\let\expandafter\reserved@z\csname #1@#2\endcsname
  \ifx\reserved@z\relax
  \else
    \edef\reserved@z{\expandafter\strip@prefix\meaning\reserved@z}%
  \fi
  \ifx \reserved@z \reserved@a
  \else
    \@tempswatrue
    \typeout{label change: #1@#2 was
      \ifx \reserved@z \relax
        unset
      \else
        \reserved@z\space
      \fi
      now #3}%
  \fi
}
