> \def\uppercase#1{\protect\tmpe@uppercase{#1}}
> \def\tmpe@uppercase#1{\edef\tmpd@uppercase{#1}%

Please don't redefine the \uppercase primitive!!!

\uppercase is fairly useless for making text uppercase. What it's real
purpose is, is as the low level TeX primitive to change the character
code of a character token without changing its catcode.

Hence you find

      \uppercase{%
   \egroup
      \def~%
   }%

in inputenc.sty and the rather similar

  \uppercase{\def~}

in dcolumn.sty

Such uses really rely that \uppercase works the way it works.
Any redefinition is likely to break these packages.

Secondly you have applied \edef to a random user-supplied argument.
This is the canoncal `moving argument' and so you should set \protect
so as to give the user some way of preventing commands dying in the
\edef. So the second line above should use \protected@edef rather than
\edef. As \protected@edef ... \uppercase .... is essentially the
definition of \MakeUppercase, you should probably just redefine that
LaTeX command rather than the TeX primitive.

David