

\label{name}{text}  write something like \def\csname ref.name\endcsname{text}
to the file.

\def\ref{name}   \csname ref.name\endcsname


Things like section would def \s@creftext and \s@crefnum and you get two
commands:  \secreftext and \secrefnum which would reference the section text
and section number respectively.


