%%% Martin Shr\"oeder: Spot colors in pdfTeX

\newcommand*{\AC@addColor}[5]{%
    \immediate\pdfobj stream
        attr {
            /FunctionType 4
            /Domain [0.0 1.0]
            /Range [0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]
            }
        { { dup ?2 mul exch
            dup ?3 mul exch
            dup ?4 mul exch
            ?5 mul } }%
    \edef\AC@ColorFunctionObj{\the\pdflastobj}%
    \immediate\pdfobj {[ /Separation /?1
                         /DeviceCMYK
                         \AC@ColorFunctionObj\space 0 R ]}%
    \begingroup
        \toks@\expandafter{\AC@colorhook}%
        \edef\x{%
            \endgroup
            \gdef\noexpand\AC@colorhook{%
                \the\toks@
                /?1\space\the\pdflastobj\space 0 R %
                }%
            }%
        \x
    }

% later

   \edef\AC@expand{\global\pdfpageresources {%
        /ColorSpace << \AC@colorhook >>
        }%
    \AC@expand

% It uses
% - \token registers
% - \expandafter
% - \edef
% - \noexpand
% and does separation colours in pdftex.
