Sanjoy Mahajan wrote:
> Here's a possible solution that works here but is a hack and may make
> unwarranted assumptions about control-sequence names.  It require a new
> if to say whether we are processing a static MP figure, and then using a
> dedicated output stream for those writes.
>
> ======================== cut here ========================
> \unprotect
>
> \newif\ifinstaticMPfigure
>   
interesting is that we already had a boolean but somehow it was not used 
(only at one place)

\newwrite\MPstaticwrite

\long\def\startstaticMPgraphic#1#2\stopstaticMPgraphic
  {\bgroup
   \MPstaticgraphictrue\MPstaticgraphictrue
   \setMPrandomseedfalse
   \def\MPgraphicfile{#1}% no \jobname here
   \let\allocateMPslot  \gobbleoneargument
   \let\deallocateMPslot\gobbleoneargument
   \let\runMPgraphic    \gobbleoneargument
   \runMPgraphicstrue
   \enableincludeMPgraphics
   \currentMPgraphic\plusone  % hack, else no close
   \startMPgraphic#2\stopMPgraphic
   \executeMPgraphicfile
   \egroup}

\def\openMPgraphicfile#1#2% #1=alwaysopen #2=message
  {\ifMPstaticgraphic
     \donetrue
     \let\MPwrite\MPstaticwrite
   \else
     [EMAIL PROTECTED]@@MPG\@@MPG\MPgraphicfile\endcsname\relax
       \donetrue
       % [EMAIL PROTECTED]@@MPG\@@MPG\MPgraphicfile\endcsname
       % for the sake of plain usage
       [EMAIL PROTECTED]@EA\csname 
newwrite\endcsname\csname\@@MPG\@@MPG\MPgraphicfile\endcsname
       \doglobal\addtocommalist\MPgraphicfile\MPgraphicfiles
     \else
       \ifcase#1\relax\donefalse\else\donetrue\fi
     \fi
     [EMAIL PROTECTED]@EA\MPwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname
   \fi
   \ifdone
     \immediate\openout\MPwrite\MPgraphicfile.mp\relax
     \ifx\MPinputtranslation\empty\else
       \immediate\write\MPwrite{\MPinputtranslation}%
       \immediate\write\MPwrite{verbatimtex \MPinputtranslation etex ;}%
     \fi
     \immediate\write\MPwrite{\letterpercent\space #2 graphics of job 
"\jobname"}%
     \writeMPgraph
     \setMPrandomseed
   \fi}

i'll add this


> ! No room for (\write) \H.
>
> e.g. try this file:
>
> \starttext
> \dorecurse{17}{\newwrite\H}
> \stoptext
>
> But with the staticMPfigure test file, the "No room for (\write)"
> message didn't appear, and instead the TeX complained only when \openout
> was tried on the resulting stream.
>   
it is because we open files without closing them; somehow i think that this is 
a bug (taco may know)

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to