Troff (finally) working on DECstations

Steve D. Miller steve at vorga.umiacs.umd.edu
Wed Jul 19 03:30:24 AEST 1989


   I have (finally) gotten troff working on the DECstation 3100.  I was
unable to get the new (ASCII) format font width tables from anyone at DEC,
so I decided to port the 4.3BSD troff and to punt the Ultrix troff.  Easier
said than done.  Warning:  description of gross code follows.  Don't read
this if you've eaten in the last hour or so...

   The 4.3BSD troff (and many other troffs, including the Berkeley-style
ditroff I've seen) does something almost criminally gross.  First, it
declares about 6K worth of variables together, assuming that they will be
placed together by the compiler.  There's a total of 71 variables declared
in this section.  Then, when it hits a .ev directive, it changes
environments by:

	1) Take the address of the first variable declared in the list.

	2) Multiply the current environment number (0, 1, or 2) by 6144,
	and lseek() out that far in some file in /tmp.

	3) Write 6K from memory (starting at the address from (1) above)
	into the temp file.

	4) Do another lseek() and read another 6K in from somewhere else
	in the file.

   Although gross, this works fine if your compiler allocates variables in
declaration order.  However, the DECstation C compiler does not do this.
Can you say, "trash lots of random variables?"  I knew you could...

   Also, once the 4.3BSD troff is working, you need font width tables in a
format you can use.  Any font width table produced in the normal way (i.e.,
'cc -o ftR ftR.c'; TranScript does this, by the way) will not be in the
proper format, as the binary produced will be in COFF format.  You will need
to run a converter across your COFF-style tables to turn them into a.out
files, which the BSD troff will then be able to read.

   I have fixes for the 4.3BSD troff to clean up the environment handling to
the point that it works.  I also have a COFF->a.out converter that does
what's needed in this situation.  They're available for anonymous FTP from
fnord.umiacs.umd.edu (128.8.120.3), as pub/trofffix.shar and
pub/psfixfont.c.  If you want them and can't FTP them, let me know, and I'll
try to find time to send them to you.  Please grab these only during the off
hours; I still read my mail on fnord, and it's only a Sun-3/60...  Also note
that the 4.3BSD nroff won't work on DECstations, as DEC not only changed the
terminal description tables, they actually shipped the new-style tables.

   With all these changes applied, we can actually troff to our Imagens
and our PostScript printers from our DECstations.  Whoopee.

   If you get these fixes, please let me know; I'm curious as to how many
people still use troff, and how many really need this to work.  Are we really
that unusual?

	-Steve


Spoken: Steve Miller    Domain: steve at mimsy.umd.edu    UUCP: uunet!mimsy!steve
Phone: +1-301-454-1808  USPS: UMIACS, Univ. of Maryland, College Park, MD 20742



More information about the Comp.unix.ultrix mailing list