matt@oddjob.UChicago.UUCP (Matt Crawford) (05/11/84)
>< Many thanks to the 8 or 10 people who responded to my plea. The manual pages I received were not all consistent. I attribute the differences to system III vs. V7/4.n and mark them in the composite included below. I am posting to net.sources a nifty little program I wrote which takes an nroff drive table and decompiles it into C so one can look at it or change it. I have tried it a few times and when I recompile its output and strip it I get exactly the same bytes I started with. Does anyone know what the last 13 characters in the nroff character set are? The drive table for the itoh defines 10 of them which the 300 and 450 don't. ___________________________________________________ Matt Arpa: Crawford@ANL-MCS.ARPA Crawford UUCP: ihnp4!oddjob!matt -----------------------Tear your screen here--------------------------- .TH TERM 5 .SH NAME term \- terminal driving tables for nroff .SH DESCRIPTION .IR Nroff (1) uses driving tables to customize its output for various types of output devices, such as printing terminals, special word-processing terminals (such as Diablo, Qume, or NEC Spinwriter mechanisms), or special output filter programs. These driving tables are written as C programs, compiled, and installed in \f3/usr/lib/term/tab\f2name\fP , where .I name\^ is the name for that terminal type as given in .IR term (7). The structure of the tables is as follows. Sizes are in 240ths of an inch. .PP .nf .ta 5m 10m 15m 20m 25m 30m 35m 40m 45m 50m 55m 60m #define INCH 240 struct { int bset; int breset; int Hor; int Vert; int Newline; int Char; int Em; int Halfline; int Adj; char *twinit; char *twrest; char *twnl; char *hlr; char *hlf; char *flr; char *bdon; char *bdoff; #ifdef SYSIII char *iton; char *itoff; #endif char *ploton; char *plotoff; char *up; char *down; char *right; char *left; char *codetab[256\-32]; char *zzz; } t; .fi .DT .PP The meanings of the various fields are as follows: .TP 10 .I bset\^ bits to set in .I sgttyb.sg_flags\^ or in .I termio.c_oflag\^ (depending on the version of UNIX being used, see .IR tty (4).) before output. .TP 10 .I breset\^ bits to reset in .I sgttyb.sg_flags\^ or .I termio.c_oflag\^ before output. .TP 10 .I Hor\^ horizontal resolution in fractions of an inch. .TP 10 .I Vert\^ vertical resolution in fractions of an inch. .TP 10 .I Newline\^ space moved by a newline (linefeed) character in fractions of an inch. .TP 10 .I Char\^ quantum of character sizes, in fractions of an inch. (I.e., characters are multiples of Char units wide. See .I codetab below.) .TP 10 .I Em\^ size of an em in fractions of an inch. .TP 10 .I Halfline\^ space moved by a half-linefeed (or half-reverse-linefeed) character in fractions of an inch. .TP 10 .I Adj\^ quantum of white space for margin adjustment in the abscence of the .B \-e option, in fractions of an inch. (i.e., white spaces are a multiple of Adj units wide) .IP Note: if this is less than the size of the space character (in units of Char; see below for how the sizes of characters are defined), .I nroff\^ will output fractional spaces using plot mode. Also, if the .B \-e switch to .I nroff\^ is used, Adj is set equal to Hor by .IR nroff . .TP 10 .I twinit\^ set of characters used to initialize the terminal in a mode suitable for .IR nroff . .TP 10 .I twrest\^ set of characters used to restore the terminal to normal mode. .TP 10 .I twnl\^ set of characters used to move down one line. .TP 10 .I hlr\^ set of characters used to move up one-half line. .TP 10 .I hlf\^ set of characters used to move down one-half line. .TP 10 .I flr\^ set of characters used to move up one line. .TP 10 .I bdon\^ set of characters used to turn on hardware boldface mode, if any. .I Nroff\^ assumes that boldface mode is reset automatically by the .I twnl\^ string, because many letter-quality printers reset the boldface mode when they receive a carriage return; the .I twnl\^ string should include whatever characters are necessary to reset the boldface mode. .TP 10 .I bdoff\^ set of characters used to turn off hardware boldface mode, if any. .TP 10 .I iton\^ set of characters used to turn on hardware italics mode, if any. (System III only (?)) .TP 10 .I itoff\^ set of characters used to turn off hardware italics mode, if any. (System III only (?)) .TP 10 .I ploton\^ set of characters used to turn on hardware plot mode (for Diablo type mechanisms), if any. .TP 10 .I plotoff\^ set of characters used to turn off hardware plot mode (for Diablo type mechanisms), if any. .TP 10 .I up\^ set of characters used to move up one resolution unit (Vert) in plot mode, if any. .TP 10 .I down\^ set of characters used to move down one resolution unit (Vert) in plot mode, if any. .TP 10 .I right\^ set of characters used to move right one resolution unit (Hor) in plot mode, if any. .TP 10 .I left\^ set of characters used to move left one resolution unit (Hor) in plot mode, if any. .TP 10 .I codetab\^ Array of sequences to print individual characters. Order is \fInroff\fR's crazy internal ordering. See the appendix for the exact order. .TP 10 .I zzz\^ a zero terminator at the end. .PP The \fIcodetab\fR sequences each begin with a flag byte. The top bit indicates whether the sequence should be underlined in the \fB\&.ul\fR font. The rest of the byte is the width of the sequence in units of \fIChar\fR. .PP The remainder of each \fIcodetab\fR sequence is a sequence of characters to be output. Characters with the top bit off are output as given; characters with the top bit on indicate escape into plot mode. When such an escape character is encountered, \fInroff\fR shifts into plot mode, emitting \fIploton\fR, and skips to the next character if the escape character was '\\200'. .PP When in plot mode, characters with the top bit off are output as given. A character with the top bit on indicates a motion. The next bit indicates coordinate, with \fB1\fR being vertical and \fB0\fR being horizontal. The next bit indicates direction, with \fB1\fR meaning up or left. The remaining five bits give the amount of the motion. An amount of zero causes exit from plot mode. .PP When plot mode is exited, either at the end of the string or via the amount-zero exit, \fIplotoff\fR is emitted followed by a blank. .RE .PP All quantities which are in units of fractions of an inch should be expressed as .RI INCH* num / denom , where .I num\^ and .I denom\^ are respectively the numerator and denominator of the fraction; i.e., 1/48 of an inch would be written as ``INCH/48''. .PP If any sequence of characters does not pertain to the output device, that sequence should be given as a null string. .PP The source code for the terminal .I name\^ is in .BI /usr/src/usr.bin/nroff/term/tab name .c (4.2BSD) or .BI /usr/src/cmd/text/roff.d/terms.d/tab name .c (System III). In System III, when a new terminal type is added the file .I maketerms.c\^ should be updated to `#include' the source to that driving table; note that the various terminal types are grouped into ``parts'' labelled .BR PART1 , .BR PART2 , and .BR PART3 . If necessary, more parts can be added. Other changes necessary to .I maketerms.c\^ are left as an exercise to the reader. The makefile .I terms.mk\^ in that directory should then be updated. .SH FILES /usr/lib/term/tab\f2name\fP driving tables .br tab\f2name\fP.c source for driving tables .SH SEE ALSO troff(1), term(7) .SH BUGS All this should really be integrated (somehow) with .IR termcap (5). .PP The ever-growing diversity of terminals and the stupid inability of manufacturers to understand the need for standardization combine to produce an increasing number of terminals whose features cannot be effectively characterized by this simple (!) scheme.