Access to the parts of glue registry
if you have etex extensions enabled you can do
\newskip\myskip
\myskip = 10pt plus 4pt minus 2pt
\edef\z{\the\gluestretch\myskip}
\show\z
\edef\z{\the\glueshrink\myskip}
\show\z
\bye
which produces
> \z=macro:
->4.0pt.
l.5 \show\z
?
> \z=macro:
->2.0pt.
l.7 \show\z
?
You have to take care of infinite glue:
\documentclass{article}
\makeatletter
\newcommand{\extractnatural}[1]{%
\the\dimexpr#1\relax
}
\newcommand{\extractstretch}[1]{%
\strip@pt\dimexpr\gluestretch#1\relax
\ifcase\gluestretchorder#1pt\or fil\or fill\or filll\fi
}
\newcommand{\extractshrink}[1]{%
\strip@pt\dimexpr\glueshrink#1\relax
\ifcase\glueshrinkorder#1pt\or fil\or fill\or filll\fi
}
\makeatother
\newlength{\test}
\begin{document}
\setlength{\test}{10pt plus 4pt minus 2pt}
\texttt{\the\test}: (\extractnatural{\test}) (\extractstretch{\test}) (\extractshrink{\test})
\setlength{\test}{10pt plus 4fil minus 2pt}
\texttt{\the\test}: (\extractnatural{\test}) (\extractstretch{\test}) (\extractshrink{\test})
\setlength{\test}{10pt plus 4filll minus 2fill}
\texttt{\the\test}: (\extractnatural{\test}) (\extractstretch{\test}) (\extractshrink{\test})
\edef\macro{(\extractnatural{\test}) (\extractstretch{\test}) (\extractshrink{\test})}
\texttt{\meaning\macro}
\end{document}