Re: [NTG-context] staticMPfigures can overrun output streams
In another thread, Hans mentioned the 2006.09.25 beta. I tested it against this test file and it works great: \starttext \dorecurse{20}{\startreusableMPgraphic{\recurselevel} draw fullcircle scaled 3mm; \stopreusableMPgraphic \placefigure[here,none]{}{\reuseMPgraphic{\recurselevel}}} \stoptext I just added this test to the contexttest svn repo. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1. ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] staticMPfigures can overrun output streams
Hi, > it is because we open files without closing them; somehow i > think that this is a bug (taco may know) No, that is not a bug. The error is equivalent to \setbox234567=\hbox{} It is the macro program's duty to keep the numbers in check. Taco ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] staticMPfigures can overrun output streams
> \MPstaticgraphictrue\MPstaticgraphictrue Just one setting needed? > > 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) It may be two separate issues: (1) When the \newwrite is executed, plain TeX should complain before anyone even tries to open the stream; and (2) not closing files. I checked quickly for the second one, but couldn't be sure that each open matched a close. It'll be nice when the awful string, filename, and file manipulations can be done in lua... -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1. ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] staticMPfigures can overrun output streams
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