[comp.unix.questions] NROFF drivers

c.steinb@cooper.UUCP (03/23/87)

Can anyone tell me how to write a terminal driver for NROFF?

c.steinb@cooper.UUCP

mangler@cit-vax.UUCP (04/03/87)

In article <799@cooper.UUCP>, c.steinb@cooper.UUCP (Craig Steinberger ) writes:
> Can anyone tell me how to write a terminal driver for NROFF?

An nroff driver table is an a.out, which nroff links in at run time.
It contains one struct, defined in /usr/src/*/troff/tw.h, which has
a bunch of ints describing the resolution of the terminal, and
pointers to strings for all the necessary character sequences.

The ints are all measured in nroff units, 240 per inch.

"codetab" is an array of pointers to the sequences used to print each
of the 224 nroff characters.  The first 95 of these are the printable
ASCII characters.  The first byte of each string is the width of the
glyph, in Chars (see tw.h).  Setting the 0200 bit means it's ok to
underline.  The remaining characters are output literally if ASCII;
non-ASCII bytes (i.e. with 0200 bit set) represent fine-positioning:
	0200 + N    move right by N plot-mode units
	0240 + N    move left by N
	0300 + N    move down by N
	0340 + N    move up by N
This uses plot mode, to give more flexibility in overstriking than
is possible with just backspace, half-line-up, and half-line-down.
On a Diablo-style printer it is possible to build up readable glyphs
for nearly the entire troff character set.  (The Spinwriter was lotsa
fun to watch when printing fancy things like copyright symbols).  If
all else fails, you can do dot-matrix, though it tends to wear out
the period pretty fast.

I could send you a spiffy Spinwriter 5525 driver table which I wrote in
1981 (I assume it's still public domain), but you'll need an AT&T Unix
source license for tw.h.

Don Speck   speck@vlsi.caltech.edu  {seismo,rutgers,ames}!cit-vax!speck

patwood@unirot.UUCP (04/04/87)

Sorry, but an nroff driver table is not an "a.out".  In versions of nroff
before DWB 2.0, it is a binary file, but not in a.out format.  Nroff reads
this file (doesn't link or load it) into its internal data structures when
it starts up.  In DWB 2.0, there is a dinroff (device independent nroff)
that reads an ASCII file containing basically the same information that
was present in the old nroffs' binary file.  Note that the actual operation
of nroff wasn't changed in DWB 2.0; it's simply easier to write driver tables
for it now.

Pat Wood
bellcore!phw5!phw

mangler@cit-vax.UUCP (04/12/87)

In article <482@unirot.UUCP>, patwood@unirot.UUCP (Patrick Wood) writes:
> Sorry, but an nroff driver table is not an "a.out".

Sigh, another USG difference.  I should have identified the environment.
On 4.2 BSD and 4.3 BSD, the command "file /usr/lib/term/tab*" identifies
them all as "executable".  (IS/1 on VMS used PDP-11 a.out's)!

> Nroff reads this file (doesn't link or load it) into its internal data
> structures

and it adds the new base address to each string pointer, like a linker.

Don Speck   speck@vlsi.caltech.edu  {seismo,rutgers,ames}!cit-vax!speck