[texhax] \write17?

Hefferon, Jim S. jhefferon at smcvt.edu
Sun Oct 21 01:20:07 CEST 2018


Thank you, everyone for the very helpful comments.

> There is code in tex.web that refers to streams 16 and 17. Search for
write_stream. In essence, 16 = "out of bounds but positive", and 17 =
"out of bounds but negative".

Forgive my ignorance; why not \write-1?  Is it a four bit number?

>   dc> For example latex (for no good reason that I can see) uses an)
   allocated but unused stream \@unused (which is 0))
   for \typeout.

> Doesn't that waste one of the 16 precious usable streams?

Right, my system agrees with what David said.

ftpmaint at millstone:~$ latexdef \typeout

\typeout:
macro:#1->\begingroup \set at display@protect \immediate \write \@unused {#1}\endgroup

ftpmaint at millstone:~$ latexdef \@unused

\@unused:
\char"0


\the\@unused:
0

Jim

----------
https://en.wikipedia.org/wiki/Cluster_B_personality_disorders

________________________________________
From: Karl Berry <karl at freefriends.org>
Sent: Saturday, October 20, 2018 6:05:41 PM
To: Hefferon, Jim S.
Cc: texhax at tug.org
Subject: Re: [texhax] \write17?

    jh> \write16 was adopted early on as a convention to write to both.
    I see it in the TeXbook. Is that understanding right?

Any positive closed stream will do, afaik. I have not see many
references to \write16 outside of the TeXbook. But yes, I guess so.

    But \write17? Google gives me a references to it, but what is it for?
    How is it different than \write16? If it is no different then why was it
    skipped over in getting to \write18?

There is code in tex.web that refers to streams 16 and 17. Search for
write_stream. In essence, 16 = "out of bounds but positive", and 17 =
"out of bounds but negative". These are implementation magic numbers not
visible to the user, but it does sort of explain why 17 would be avoided
when choosing a new number.

(It was too long ago, but I think it was Tom Rokicki who who originally
implemented \write18 for his NeXT? Amiga? something distribution. Not sure.
web2c/ChangeLog says it was me, but I'm pretty sure I didn't write it
from scratch.)

   dc> For example latex (for no good reason that I can see) uses an)
   allocated but unused stream \@unused (which is 0))
   for \typeout.

Doesn't that waste one of the 16 precious usable streams?  --thanks, karl.



More information about the texhax mailing list