[tex-live] No room for a new \write

Reinhard Kotucha reinhard.kotucha at web.de
Fri Mar 16 23:30:04 CET 2007


>>>>> "Philipp" == Philipp Fäh <pfaeh at mysunrise.ch> writes:

  > No room for a new \write. If you get such a message the only
  > recourse is to redesign your document.  Is there no possibility to
  > extend the amount of streams? One day...?

A limit of 32 files which can be open at the same time sounds
ridiculously nowadays.  Yes, TeX (the program) allows you to have 16
read and 16 write streams open at the same time.  But the plain TeX
macros (which are used by LaTeX too) are extremely inefficient.

Register allocation is currently stack based.  If you say
\newwrite\foo, then \foo is is associated with \write0.  If you then
say \newwrite\bar, \bar is is associated with \write1, and so on.

The stack pointer is increased whenever you say \newwrite but nothing
useful happens if you say \closeout.

The alternative would be to make file allocation list based.  

Suppose that initially there is a list for \openout which has 16
entries

{free,free,free,...}

and are associated with \write0, \write1, \write2, ...

Then re-define \openout and \closeout.  When you say
\openout\foo=some_file.tex, \openout will search for the first entry in
the list which has the value "free".  The list then becomes

{\foo,free,free,...}

If you say \openout\bar=some_other_file.tex

the list becomes

{\foo,\bar,free,...}

and if you say \closeout\foo the list becomes

{free,\bar,free,...}

This means that \write0 can be used again while in a stack based
allocation scheme it can't.

As I said above, the limit of 32 files which can be open at the same
time sounds ridiculously nowadays.  On the other hand, operating
systems limit the number of files which can be open at the same time.
There are usually a lot of other processes running which want to
access files too.  Hence I wonder whether it makes sense to change the
number of read/write registers in the program (significantly) before
the macros are improved.

As far as I can see it is even possible to write a macro package which
works with plain TeX as well as with LaTeX which replaces the stack
based approach by a list based system.  Old documents will not be
broken, people will not notice that /new{read,write} calls are
ignored.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------




More information about the tex-live mailing list