TABLE

Section: File Formats (5)
Index Return to Main Contents
 

NAME

table, elbat - compile/de-compile terminal driver tables for nroff  

SYNOPSIS

elbat [ -d ] tabname > tabname.c
make [ all ] [ install ]
 

DESCRIPTION

Nroff(1) uses driver tables to customize its output for various types of output devices, such as terminals, special printers (such as Diablo), or special output filter programs. Driving tables are normally supplied for a small number of devices, but no utility is normally supplied to create or modify additional driver tables, at least for USG systems. (Berkeley systems apparently have this capability supplied.) The table utility allows a user to compile and de-compile nroff driver tables.

The nroff -Tname option tells nroff to use the driver table /usr/lib/term/tabname to format the output for a particular printer. The driver table is specified by a structure t which is given by a source file tabname.c. The structure of t is as follows:

#define   INCH 240

struct t {
     int bset;
     int breset;
     int Hor;
     int Vert;
     int Newline;
     int Char;
#ifdef KANJI
     int Kchar;
#endif KANJI
     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;
     } t;

The meanings of the various fields are as follows:

bset
bits to set in the c_oflag field of the termio structure (see tty(4)) before output.
breset
bits to reset in the c_oflag field of the termio structure 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. (i.e., a character is a multiple of Char units wide)
Kchar
quantum of Kanji character sizes, in fractions of an inch. (i.e., a Kanji character is a multiple of Kchar units wide) Many systems do not have this element included in the structure.
Em
size of an em in fractions of an inch.
Halfline
space moved by a half-linefeed (or half-reverse-linefeed) character in fractions of an inch.
Adj
quantum of white space, in fractions of an inch. (i.e., 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
definition of characters needed to print an nroff character on the terminal. The first byte is the number of character units (Char) needed to hold the character; i.e., ``\001'' is one unit wide, ``\002'' is two units wide, etc. The high-order bit (0200) is on if the character is to be underlined in underline mode (.ul). This byte can be zero, indicating zero-length characters (accents, etc), with the remaining string being non-null. This means that a null character must be expressed as "\000\0", not merely "". The latter will cause serious problems for nroff! The rest of the bytes are the characters used to produce the character in question. If the character has the sign (0200) bit on, it is a code to move the terminal in plot mode. It is encoded as:
0100 bit on
vertical motion.
0100 bit off
horizontal motion.
040 bit on
negative (up or left) motion.
040 bit off
positive (down or right) motion.
037 bits
number of such motions to make.
zzz
a zero terminator at the end.

All quantities which 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; i.e., 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 (""), except for null codetab strings, which must be given as "\000\0".

 

USAGE

Source files are prepared for the drivers by using an editor to create a tabname.c file which contains an initialized t structure, or by first using elbat to de-compile an existing system driver table into source, and modifying that source to suit. The tabname.c file is placed in the table utility source directory, and the Makefile is edited to include tabname.c in the SOURCES definition. Typing make makes all the driver tables. Typing make install installs them in the /usr/lib/term directory. Elbat /usr/lib/term/tabname decompiles that driver table, and puts the source code to standard output. The -d option includes as comments extensive debug information.  

FORMAT

The structure of the driver tables is a single integer c_size, followed by a structure t_stor, followed by an array of character data c_data of c_size bytes. The size of the driver table in bytes is therefore:
     sizeof (int) + sizeof (struct t_stor) + c_size.
The structure t_stor is identical to the structure t except that all character pointers are replaced by integer values which index into the c_data character array to indicate the start of each string:

struct t_stor {
     int bset;
     int breset;
     int Hor;
     int Vert;
     int Newline;
     int Char;
#ifdef KANJI
     int Kchar;
#endif KANJI
     int Em;
     int Halfline;
     int Adj;
     int twinit;
     int twrest;
     int twnl;
     int hlr;
     int hlf;
     int flr;
     int bdon;
     int bdoff;
     int iton;
     int itoff;
     int ploton;
     int plotoff;
     int up;
     int down;
     int right;
     int left;
     int codetab[256-32];
     int zzz;
};
 

BUGS

Because the binary format of the nroff driver tables has been inferred from a small number of samples of supplied tables on only one system, the portability of the table utility is not assured.

 

FILES

/usr/lib/term/tabname  driver tables accessible to nroff

tabname.c                              source for driver tables

tabname.tab                    compiled driver tables
 

AUTHOR

Bruce Townsend (bnr-vpa!bruce)  

SEE ALSO

nroff(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
USAGE
FORMAT
BUGS
FILES
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 06:41:08 GMT, December 12, 2024