I just learned how to inline PDF code using the \pdfliteral command and that purified Encapsulated PostScript generated by METAPOST or purifyeps can be converted to PDF code by pdfLaTeX.
However, I have been unable to find the actual conversion code I need for embedding the transformed EPS via \pdfliteral.
I would like to have something like this:
\documentclass{minimal}
\begin{document}
\begin{purifiedeps}
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 33 31
%%HiResBoundingBox: 0 0 32.0781 30.9844
%%Creator: MetaPost 1.803
%%CreationDate: 2014.04.30:1514
%%Pages: 1
%%BeginProlog
%%EndProlog
%%Page: 1 1
0 0 0 setrgbcolor
newpath 28.9375 30.1875 moveto
16.0312 7.76563 lineto
3.14063 30.1875 lineto
2.82813 30.6406 2.23438 30.9844 1.64063 30.9844 curveto
0.84375 30.9844 0 30.3906 0 29.5312 curveto
0 1.5 lineto
0 0.64063 0.73438 0 1.64063 0 curveto
2.57813 0 3.28125 0.64063 3.28125 1.5 curveto
3.28125 23.3594 lineto
7.0625 16.8281 10.7969 10.3125 14.5469 3.78125 curveto
14.7969 3.28125 15.3906 2.98438 16.0312 2.98438 curveto
16.7344 2.98438 17.125 3.39063 17.5312 3.78125 curveto
21.2656 10.3125 25 16.8281 28.7812 23.3594 curveto
28.7812 1.5 lineto
28.7812 0.64063 29.4844 0 30.4375 0 curveto
31.3281 0 32.0781 0.64063 32.0781 1.5 curveto
32.0781 29.4844 lineto
32.0781 30.3281 31.2344 30.9844 30.4375 30.9844 curveto
29.8281 30.9844 29.2344 30.7344 28.9375 30.1875 curveto
closepath fill
showpage
%%EOF
\end{purifiedeps}
\end{document}
where the purifiedeps environment still has to be defined.
The EPS code yields the METAPOST-M:

NOTE: I know that it's possible to \includegraphics{somepurifiedeps.mps} but I am searching for an inline solution not requiring an external file.
EDIT: I think I gathered the relavant pieces from the ConTeXt package supp-pdf:
\def\convertMPtoPDF % #1#2#3%
{\bgroup
\defineMPtoPDFfallbacks
\ifx\pdfdecimaldigits\undefined\else \pdfdecimaldigits=5 \fi % new
\setbox\scratchbox\vbox\bgroup
\xdef\MPheight{0pt}%
\xdef\MPwidth {0pt}%
\forgetall
\offinterlineskip
\startMPresources
\doprocessMPtoPDFfile} %
\def\doprocessMPtoPDFfile#1#2#3% file xscale yscale
{\setMPspecials
\setMPextensions
\the\everyMPtoPDFconversion
\catcode`\^^M=\@@endofline
\startMPscanning
\let\do\empty
\xdef\MPxscale{#2}%
\xdef\MPyscale{#3}%
\xdef\MPxoffset{0}%
\xdef\MPyoffset{0}%
\xdef\MPyshift{0pt}%
\donefalse
\let\handleMPsequence\dohandleMPsequence
\message{[MP to PDF]}% was: [MP to PDF #1] but there is a (#1) anyway
\input#1\relax}
\convertMPtoPDF{test.mps}{0.5}{0.5} will include the purified EPS file test.mps scaled by a factor of 0.5. To build an inline version of this command, I would need to replace \input#1 in \doprocessMPtoPDFfile with a macro containing the definition of the EPS code.
Unfortunatly, I don't know how to define such a macro since I need to preserve EPS comments (%) as well as line breaks. Hence, the macro definition needs to contain the verbatim (unprocessed) EPS code. How could I do that?

\InputIfFileExists{supp-pdf.mkii}{}{% \InputIfFileExists{supp-pdf}{}{}% }%– David Carlisle Apr 30 '14 at 13:38filecontentsan option? – Heiko Oberdiek Apr 30 '14 at 15:06