\gdef\mpxshipout{\shipout\hbox\bgroup
  \setbox0=\hbox\bgroup}
\gdef\stopmpxshipout{\egroup  \dimen0=\ht0 \advance\dimen0\dp0
  \dimen1=\ht0 \dimen2=\dp0
  \setbox0=\hbox\bgroup
    \box0
    \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2 
    \else \vrule width1sp height1sp depth0sp\relax
    \fi\egroup
  \ht0=0pt \dp0=0pt \box0 \egroup}
\mpxshipout% line 10 doc_generation.mp
xxx.mp output from \strut$O_{2}$%
\stopmpxshipout
\mpxshipout% line 11 doc_generation.mp
mpost%
\stopmpxshipout
\mpxshipout% line 12 doc_generation.mp
$\sum$ xxx railroad diagrams%
\stopmpxshipout
\mpxshipout% line 13 doc_generation.mp
\strut$O_{2}xxx.w%
\stopmpxshipout
\mpxshipout% line 14 doc_generation.mp
cweave%
\stopmpxshipout
\mpxshipout% line 15 doc_generation.mp
\strut$O_{2}$xxx.tex%
\stopmpxshipout
\mpxshipout% line 16 doc_generation.mp
pdftex%
\stopmpxshipout
\mpxshipout% line 17 doc_generation.mp
\strut$O_{2}$xxx.pdf file%
\stopmpxshipout
\end{document}
