term(F) 19 June 1992 term(F) Name term - terminal driving tables for nroff Description nroff(CT) uses driving tables to customize its output for various types of output devices, such as printing terminals, special word-processing printers (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 /usr/lib/term/tabname, where name is the name for that terminal type, as shown in term(CT). The structure of the tables is as follows. Sizes are in 240ths of an inch. #define INCH 240 #include /usr/lib/term/terms.h struct termtable tlp ; { \* lp is the name of the term, *\ int bset; \* modify with new name, such as tnew *\ 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; char *iton; char *itoff; char *ploton; char *plotoff; char *up; char *down; char *right; char *left; char *codetab[256-32]; char *zzz; } ; The meanings of the various fields are as follows: bset bits to set in termio.coflag (see tty(M) and termio(M)) after output breset bits to reset in termio.coflag before output Hor horizontal resolution in fractions of an inch Vert vertical resolution in fractions of an inch Newline space moved by a newline (linefeed) character in fractions of an inch. Char quantum of character sizes, in fractions of an inch. (that is, characters are multiples of Char units wide. See codetab below.) Em size of an em in fractions of an inch Halfline space moved by a half-linefeed (or half-reverse-linefeed) char- acter in fractions of an inch Adj quantum of white space for margin adjustment in the absence of the -e option, in fractions of an inch. (that is, white spaces are a multiple of Adj units wide) 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), nroff will output fractional spaces using plot mode. Also, if the -e switch to nroff is used, Adj is set equal to Hor by nroff twinit set of characters used to initialize the terminal in a mode suitable for nroff twrest set of characters used to restore the terminal to normal mode twnl set of characters used to move down one line hlr set of characters used to move up one-half line hlf set of characters used to move down one-half line flr set of characters used to move up one line bdon set of characters used to turn on hardware boldface mode, if any. nroff assumes that boldface mode is reset automatically by the twnl string, because many letter-quality printers reset the boldface mode when they receive a carriage return; the twnl string should include whatever characters are necessary to reset the boldface mode bdoff set of characters used to turn off hardware boldface mode, if any iton set of characters used to turn on hardware italics mode, if any itoff set of characters used to turn off hardware italics mode, if any ploton set of characters used to turn on hardware plot mode (for Diablo-type mechanisms), if any plotoff set of characters used to turn off hardware plot mode (for Diablo-type mechanisms), if any up set of characters used to move up one resolution unit (Vert) in plot mode, if any down set of characters used to move down one resolution unit (Vert) in plot mode, if any right set of characters used to move right one resolution unit (Hor) in plot mode, if any left set of characters used to move left one resolution unit (Hor) in plot mode, if any codetab Array of sequences to print individual characters. Order is nroff's internal ordering. See the file /usr/lib/term/tabuser.c for the exact order. zzz a zero terminator at the end. Each codetab sequences begins with a flag byte. The top bit indicates whether the sequence should be underlined in the .ul font. The rest of the byte is the width of the sequence in units of Char. The remainder of each codetab 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, nroff shifts into plot mode, emitting ploton, and skips to the next character if the escape character was ``\200''. 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 indi- cates coordinate, with 1 as vertical and 0 as horizontal. The next bit indicates direction, with 1 meaning up or left. The remaining five bits give the amount of the motion. An amount of zero causes exit from plot mode. When plot mode is exited, either at the end of the string or via the amount-zero exit, plotoff is emitted, followed by a blank. All quantities that are in units of fractions of an inch should be expressed as INCH*num/denom, where num and denom are respectively the numerator and denominator of the fraction; that is, 1/48 of an inch would be written as ``INCH/48''. If any sequence of characters does not pertain to the output device, that sequence should be given as a null string. The Development System must be installed on the computer to create a new driving table. The source code for a generic output device is in the file /usr/lib/term/tabuser.c. Copy this file and make the necessary modifications, including the name of the termtable struct. Refer to the hardware manual for the codes needed for the output device (terminal, printer, etc.). Name the file according to the convention explained in term(CT). The makefile, /usr/lib/term/makefile, should be updated to include the source file to the new driving table. To perform the modifi- cation, enter the command: cc -M3e -O -c tabuser.c maketerm.o -o maketerm When the files are prepared, enter the command : make See make(CP). The source to the new driving table is linked with the object file mkterm.o, and the new driving table is created and installed in the proper directory. Files /usr/lib/term/tabname driving tables /usr/lib/term/tabuser.c generic source for driving tables /usr/lib/term/makefile makefile for creating driving tables /usr/lib/term/mkterm.o linkable object file for creating driving tables /usr/lib/term/terms.h used to create nroff driving tables See also nroff(CT,) term(CT) Notes The Development System and text processing software must be installed on the computer to create new driving tables. Not all UNIX facilities support all of these options.