]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/troff/tdef.h
merge
[plan9front.git] / sys / src / cmd / troff / tdef.h
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <limits.h>
4 #include <ctype.h>
5 #include <string.h>
6
7 #define NROFF   (!TROFF)
8
9
10 /* Site dependent definitions */
11
12 #ifndef TMACDIR
13 #define TMACDIR         "lib/tmac/tmac."
14 #endif
15 #ifndef FONTDIR
16 #define FONTDIR         "lib/font"
17 #endif
18 #ifndef NTERMDIR
19 #define NTERMDIR        "lib/term/tab."
20 #endif
21 #ifndef TDEVNAME
22 #define TDEVNAME        "post"
23 #endif
24 #ifndef NDEVNAME
25 #define NDEVNAME        "37"
26 #endif
27 #ifndef TEXHYPHENS
28 #define TEXHYPHENS      "/usr/lib/tex/macros/hyphen.tex"
29 #endif
30 #ifndef ALTHYPHENS
31 #define ALTHYPHENS      "lib/tmac/hyphen.tex"   /* another place to look */
32 #endif
33
34 typedef unsigned char   Uchar;
35 typedef unsigned short  Ushort;
36
37 typedef /*unsigned*/ long       Tchar;
38
39 typedef struct  Blockp  Blockp;
40 typedef struct  Diver   Diver;
41 typedef struct  Stack   Stack;
42 typedef struct  Divsiz  Divsiz;
43 typedef struct  Contab  Contab;
44 typedef struct  Numtab  Numtab;
45 typedef struct  Numerr  Numerr;
46 typedef struct  Env     Env;
47 typedef struct  Term    Term;
48 typedef struct  Chwid   Chwid;
49 typedef struct  Font    Font;
50 typedef struct  Spnames Spnames;
51 typedef struct  Wcache  Wcache;
52 typedef struct  Tbuf    Tbuf;
53
54 /* this simulates printf into a buffer that gets flushed sporadically */
55 /* the BSD goo is because SunOS sprintf doesn't return anything useful */
56
57 #ifdef BSD4_2
58 #define OUT             (obufp += strlen(sprintf(obufp,
59 #define PUT             ))) > obuf+BUFSIZ ? flusho() : 1
60 #else
61 #define OUT             (obufp += sprintf(obufp,
62 #define PUT             )) > obuf+BUFSIZ ? flusho() : 1
63 #endif
64
65 #define oputs(a)        OUT "%s", a PUT
66 #define oput(c)         ( *obufp++ = (c), obufp > obuf+BUFSIZ ? flusho() : 1 )
67
68 extern  char    errbuf[];
69 #define ERROR   sprintf(errbuf,
70 #define WARN    ), errprint()
71 #define FATAL   ), errprint(), exit(1)
72
73 /* starting values for typesetting parameters: */
74
75 #define PS      10      /* default point size */
76 #define FT      1       /* default font position */
77 #define ULFONT  2       /* default underline font */
78 #define BDFONT  3       /* default emboldening font */
79 #define BIFONT  4       /* default bold italic font */
80 #define LL      (unsigned) 65*INCH/10   /* line length; 39picas=6.5in */
81 #define VS      ((12*INCH)/72)  /* initial vert space */
82
83
84 #define EMPTS(pts)      (((long)Inch*(pts) + 36) / 72)
85 #define EM      (TROFF? EMPTS(pts): t.Em)
86 #define INCH    (TROFF? Inch: 240)
87 #define HOR     (TROFF? Hor: t.Adj)
88 #define VERT    (TROFF? Vert: t.Vert)
89 #define PO      (TROFF? Inch: 0)
90 #define SPS     (TROFF? EMPTS(pts)/3: INCH/10)
91 #define SS      (TROFF? 12: INCH/10)
92 #define ICS     (TROFF? EMPTS(pts): 2*INCH/10)
93 #define DTAB    (TROFF? (INCH/2): 0)
94
95 /* These "characters" are used to encode various internal functions
96 /* Some make use of the fact that most ascii characters between
97 /* 0 and 040 don't have any graphic or other function.
98 /* The few that do have a purpose (e.g., \n, \b, \t, ...
99 /* are avoided by the ad hoc choices here.
100 /* See ifilt[] in n1.c for others -- 1, 2, 3, 5, 6, 7, 010, 011, 012 
101 */
102
103 #define LEADER  001
104 #define IMP     004     /* impossible char; glues things together */
105 #define TAB     011
106 #define RPT     014     /* next character is to be repeated many times */
107 #define CHARHT  015     /* size field sets character height */
108 #define SLANT   016     /* size field sets amount of slant */
109 #define DRAWFCN 017     /* next several chars describe arb drawing fcns */
110 #       define  DRAWLINE        'l'     /* line: 'l' dx dy char */
111 #       define  DRAWCIRCLE      'c'     /* circle: 'c' r */
112 #       define  DRAWELLIPSE     'e'     /* ellipse: 'e' rx ry */
113 #       define  DRAWARC         'a'     /* arc: 'a' dx dy dx dy */
114 #       define  DRAWSPLINE      '~'     /* quadratic B spline: '~' dx dy dx dy ... */
115                                         /* other splines go thru too */
116 /* NOTE:  the use of ~ is a botch since it's often used in .tr commands */
117 /* better to use a letter like s, but change it in the postprocessors too */
118 /* for now, this is taken care of in n9.c and t10.c */
119 #       define  DRAWBUILD       'b'     /* built-up character (e.g., { */
120
121 #define LEFT    020     /* \{ */
122 #define RIGHT   021     /* \} */
123 #define FILLER  022     /* \& and similar purposes */
124 #define XON     023     /* \X'...' starts here */
125 #define OHC     024     /* optional hyphenation character \% */
126 #define CONT    025     /* \c character */
127 #define PRESC   026     /* printable escape */
128 #define UNPAD   027     /* unpaddable blank */
129 #define XPAR    030     /* transparent mode indicator */
130 #define FLSS    031     /* next Tchar contains vertical space */
131                         /* used when recalling diverted text */
132 #define WORDSP  032     /* paddable word space */
133 #define ESC     033     /* current escape character */
134 #define XOFF    034     /* \X'...' ends here */
135                         /* matches XON, but they will probably never nest */
136                         /* so could drop this when another control is needed */
137 #define HX      035     /* next character is value of \x'...' */
138 #define MOTCH   036     /* this "character" is really motion; used by cbits() */
139
140 #define HYPHEN  c_hyphen
141 #define EMDASH  c_emdash        /* \(em */
142 #define RULE    c_rule          /* \(ru */
143 #define MINUS   c_minus         /* minus sign on current font */
144 #define LIG_FI  c_fi            /* \(ff */
145 #define LIG_FL  c_fl            /* \(fl */
146 #define LIG_FF  c_ff            /* \(ff */
147 #define LIG_FFI c_ffi           /* \(Fi */
148 #define LIG_FFL c_ffl           /* \(Fl */
149 #define ACUTE   c_acute         /* acute accent \(aa */
150 #define GRAVE   c_grave         /* grave accent \(ga */
151 #define UNDERLINE c_under       /* \(ul */
152 #define ROOTEN  c_rooten        /* root en \(rn */
153 #define BOXRULE c_boxrule       /* box rule \(br */
154 #define LEFTHAND c_lefthand     /* left hand for word overflow */
155 #define DAGGER   c_dagger       /* dagger for end of sentence/footnote */
156
157 #define HYPHALG 1       /* hyphenation algorithm: 0=>good old troff, 1=>tex */
158
159
160 /* array sizes, and similar limits: */
161
162 #define MAXFONTS 99     /* Maximum number of fonts in fontab */
163 #define NM      90      /* requests + macros */
164 #define NN      NNAMES  /* number registers */
165 #define NNAMES  15      /* predefined reg names */
166 #define NIF     15      /* if-else nesting */
167 #define NS      128     /* name buffer */
168 #define NTM     1024    /* tm buffer */
169 #define NEV     3       /* environments */
170 #define EVLSZ   10      /* size of ev stack */
171
172 #define STACKSIZE (12*1024)     /* stack for macros and strings in progress */
173 #define NHYP    10      /* max hyphens per word */
174 #define NHEX    512     /* byte size of exception word list */
175 #define NTAB    100     /* tab stops */
176 #define NSO     5       /* "so" depth */
177 #define NMF     5       /* number of -m flags */
178 #define WDSIZE  500     /* word buffer click size */
179 #define LNSIZE  4000    /* line buffer click size */
180 #define OLNSIZE 5000    /* output line buffer click; bigger for 'w', etc. */
181 #define NDI     5       /* number of diversions */
182
183 #define ALPHABET alphabet       /* number of characters in basic alphabet. */
184                         /* 128 for parochial USA 7-bit ascii, */
185                         /* 256 for "European" mode with e.g., Latin-1 */
186
187         /* NCHARS must be greater than 
188                 ALPHABET (ascii stuff) + total number of distinct char names
189                 from all fonts that will be run in this job (including
190                 unnamed ones and \N's)
191         */
192
193 #define NCHARS  (8*1024)        /* maximum size of troff character set*/
194
195
196         /* However for nroff you want only :
197         1. number of special codes in charset of DESC, which ends up being the
198                 value of nchtab and which must be less than 512.
199         2. ALPHABET, which apparently is the size of the portion of the tables reserved
200                 for special control symbols
201         Apparently the max N of \N is irrelevant; */
202         /* to allow \N of up to 254 with up to 338 special characters
203                 you need NCHARS of 338 + ALPHABET = 466 */
204
205 #define NROFFCHARS      1024    /* maximum size of nroff character set */
206
207 #define NTRTAB          NCHARS  /* number of items in trtab[] */
208 #define NWIDCACHE       NCHARS  /* number of items in widcache[] */
209
210 #define NTRAP   20      /* number of traps */
211 #define NPN     20      /* numbers in "-o" */
212 #define FBUFSZ  512     /* field buf size words */
213 #define IBUFSZ  4096    /* bytes */
214 #define NC      1024    /* cbuf size words */
215 #define NOV     10      /* number of overstrike chars */
216 #define NPP     10      /* pads per field */
217
218 /*
219         Internal character representation:
220         Internally, every character is carried around as
221         a 32 bit cookie, called a "Tchar" (typedef long).
222         Bits are numbered 31..0 from left to right.
223         If bit 15 is 1, the character is motion, with
224                 if bit 16 it's vertical motion
225                 if bit 17 it's negative motion
226         If bit 15 is 0, the character is a real character.
227                 if bit 31       zero motion
228                 bits 30..24     size
229                 bits 23..16     font
230 */
231
232 /* in the following, "L" should really be a Tchar, but ... */
233 /* numerology leaves room for 16 bit chars */
234
235 #define MOT     (01uL << 16)    /* motion character indicator */
236 #define VMOT    (01uL << 30)    /* vertical motion bit */
237 #define NMOT    (01uL << 29)    /* negative motion indicator */
238 /* #define      MOTV    (MOT|VMOT|NMOT) /* motion flags */
239 /* #define      MAXMOT  (~MOTV)         /* maximum motion permitted */
240 #define MAXMOT  0xFFFF
241
242 #define ismot(n)        ((n) & MOT)
243 #define isvmot(n)       (((n) & (MOT|VMOT)) == (MOT|VMOT))      /* must have tested MOT previously */
244 #define isnmot(n)       (((n) & (MOT|NMOT)) == (MOT|NMOT))      /* ditto */
245 #define absmot(n)       ((n) & 0xFFFF)
246
247 #define ZBIT    (01uL << 31)    /* zero width char */
248 #define iszbit(n)       ((n) &  ZBIT)
249
250 #define FSHIFT  17
251 #define SSHIFT  (FSHIFT+7)
252 #define SMASK           (0177uL << SSHIFT)      /* 128 distinct sizes */
253 #define FMASK           (0177uL << FSHIFT)      /* 128 distinct fonts */
254 #define SFMASK          (SMASK|FMASK)   /* size and font in a Tchar */
255 #define sbits(n)        (((n) >> SSHIFT) & 0177)
256 #define fbits(n)        (((n) >> FSHIFT) & 0177)
257 #define sfbits(n)       (((n) & SFMASK) >> FSHIFT)
258 #define cbits(n)        ((n) & 0x1FFFF)         /* isolate character bits,  */
259                                                 /* but don't include motions */
260 extern  int     realcbits(Tchar);
261
262 #define setsbits(n,s)   n = (n & ~SMASK) | (Tchar)(s) << SSHIFT
263 #define setfbits(n,f)   n = (n & ~FMASK) | (Tchar)(f) << FSHIFT
264 #define setsfbits(n,sf) n = (n & ~SFMASK) | (Tchar)(sf) << FSHIFT
265 #define setcbits(n,c)   n = (n & ~0xFFFFuL | (c))       /* set character bits */
266
267 #define BYTEMASK 0377
268 #define BYTE     8
269
270 #define SHORTMASK 0XFFFF
271 #define SHORT    16
272
273 #define TABMASK  ((unsigned) INT_MAX >> 1)
274 #define RTAB    ((TABMASK << 1) & ~TABMASK)
275 #define CTAB    (RTAB << 1)
276
277 #define TABBIT  02              /* bits in gchtab */
278 #define LDRBIT  04
279 #define FCBIT   010
280
281 #define PAIR(A,B)       (A|(B<<SHORT))
282
283
284 extern  int     Inch, Hor, Vert, Unitwidth;
285
286 struct  Spnames
287 {
288         int     *n;
289         char    *v;
290 };
291
292 extern  Spnames spnames[];
293
294 /*
295         String and macro definitions are stored conceptually in a giant array
296         indexed by type Offset.  In olden times, this array was real, and thus
297         both huge and limited in size, leading to the "Out of temp file space"
298         error.  In this version, the array is represented by a list of blocks,
299         pointed to by blist[].bp.  Each block is of size BLK Tchars, and BLK
300         MUST be a power of 2 for the macros below to work.
301         
302         The blocks associated with a particular string or macro are chained
303         together in the array blist[].  Each blist[i].nextoff contains the
304         Offset associated with the next block in the giant array, or -1 if
305         this is the last block in the chain.  If .nextoff is 0, the block is
306         free.
307         
308         To find the right index in blist for an Offset, divide by BLK.
309 */
310
311 #define NBLIST  2048    /* starting number of blocks in all definitions */
312
313 #define BLK     128     /* number of Tchars in a block; must be 2^N with defns below */
314
315 #define rbf0(o)         (blist[bindex(o)].bp[boffset(o)])
316 #define bindex(o)       ((o) / BLK)
317 #define boffset(o)      ((o) & (BLK-1))
318 #define pastend(o)      (((o) & (BLK-1)) == 0)
319 /* #define      incoff(o)       ( (++o & (BLK-1)) ? o : blist[bindex(o-1)].nextoff ) */
320 #define incoff(o)       ( (((o)+1) & (BLK-1)) ? o+1 : blist[bindex(o)].nextoff )
321
322 #define skipline(f)     while (getc(f) != '\n')
323 #define is(s)           (strcmp(cmd, s) == 0)
324 #define eq(s1, s2)      (strcmp(s1, s2) == 0)
325
326
327 typedef unsigned long   Offset;         /* an offset in macro/string storage */
328
329 struct Blockp {         /* info about a block: */
330         Tchar   *bp;            /* the data */
331         Offset  nextoff;        /* offset of next block in a chain */
332 };
333
334 extern  Blockp  *blist;
335
336 #define RD_OFFSET       (1 * BLK)       /* .rd command uses block 1 */
337
338 struct Diver {          /* diversion */
339         Offset  op;
340         int     dnl;
341         int     dimac;
342         int     ditrap;
343         int     ditf;
344         int     alss;
345         int     blss;
346         int     nls;
347         int     mkline;
348         int     maxl;
349         int     hnl;
350         int     curd;
351 };
352
353 struct Stack {          /* stack frame */
354         int     nargs;
355         Stack   *pframe;
356         Offset  pip;
357         int     pnchar;
358         Tchar   prchar;
359         int     ppendt;
360         Tchar   pch;
361         Tchar   *lastpbp;
362         int     mname;
363 };
364
365 extern  Stack   s;
366
367 struct Divsiz {
368         int dix;
369         int diy;
370 };
371
372 struct Contab {         /* command or macro */
373         unsigned int    rq;
374         Contab  *link;
375         void    (*f)(void);
376         Offset  mx;
377         Offset  emx;
378         Divsiz  *divsiz;
379 };
380
381 #define C(a,b)  {a, 0, b, 0, 0}         /* how to initialize a contab entry */
382
383 extern  Contab  contab[NM];
384
385 struct Numtab { /* number registers */
386         unsigned int    r;              /* name */
387         int     val;
388         short   fmt;
389         short   inc;
390         Numtab  *link;
391 };
392
393 extern  Numtab  numtab[NN];
394
395 #define PN      0
396 #define NL      1
397 #define YR      2
398 #define HP      3
399 #define CT      4
400 #define DN      5
401 #define MO      6
402 #define DY      7
403 #define DW      8
404 #define LN      9
405 #define DL      10
406 #define ST      11
407 #define SB      12
408 #define CD      13
409 #define PID     14
410
411 struct  Wcache {        /* width cache, indexed by character */
412         short   fontpts;
413         short   width;
414 };
415
416 struct  Tbuf {          /* growable Tchar buffer */
417         Tchar *_bufp;
418         unsigned int _size;
419 };
420
421 /* the infamous environment block */
422
423 #define ics     envp->_ics
424 #define sps     envp->_sps
425 #define spacesz envp->_spacesz
426 #define lss     envp->_lss
427 #define lss1    envp->_lss1
428 #define ll      envp->_ll
429 #define ll1     envp->_ll1
430 #define lt      envp->_lt
431 #define lt1     envp->_lt1
432 #define ic      envp->_ic
433 #define icf     envp->_icf
434 #define chbits  envp->_chbits
435 #define spbits  envp->_spbits
436 #define nmbits  envp->_nmbits
437 #define apts    envp->_apts
438 #define apts1   envp->_apts1
439 #define pts     envp->_pts
440 #define pts1    envp->_pts1
441 #define font    envp->_font
442 #define font1   envp->_font1
443 #define ls      envp->_ls
444 #define ls1     envp->_ls1
445 #define ad      envp->_ad
446 #define nms     envp->_nms
447 #define ndf     envp->_ndf
448 #define nmwid   envp->_nmwid
449 #define fi      envp->_fi
450 #define cc      envp->_cc
451 #define c2      envp->_c2
452 #define ohc     envp->_ohc
453 #define tdelim  envp->_tdelim
454 #define hyf     envp->_hyf
455 #define hyoff   envp->_hyoff
456 #define hyphalg envp->_hyphalg
457 #define un1     envp->_un1
458 #define tabc    envp->_tabc
459 #define dotc    envp->_dotc
460 #define adsp    envp->_adsp
461 #define adrem   envp->_adrem
462 #define lastl   envp->_lastl
463 #define nel     envp->_nel
464 #define admod   envp->_admod
465 #define wordp   envp->_wordp
466 #define spflg   envp->_spflg
467 #define linep   envp->_linep
468 #define wdend   envp->_wdend
469 #define wdstart envp->_wdstart
470 #define wne     envp->_wne
471 #define ne      envp->_ne
472 #define nc      envp->_nc
473 #define nb      envp->_nb
474 #define lnmod   envp->_lnmod
475 #define nwd     envp->_nwd
476 #define nn      envp->_nn
477 #define ni      envp->_ni
478 #define ul      envp->_ul
479 #define cu      envp->_cu
480 #define ce      envp->_ce
481 #define in      envp->_in
482 #define in1     envp->_in1
483 #define un      envp->_un
484 #define wch     envp->_wch
485 #define pendt   envp->_pendt
486 #define pendw   envp->_pendw
487 #define pendnf  envp->_pendnf
488 #define spread  envp->_spread
489 #define it      envp->_it
490 #define itmac   envp->_itmac
491 #define hyptr   envp->_hyptr
492 #define tabtab  envp->_tabtab
493 #define line    envp->_line._bufp
494 #define lnsize  envp->_line._size
495 #define word    envp->_word._bufp
496 #define wdsize  envp->_word._size
497
498 #define oline   _oline._bufp
499 #define olnsize _oline._size
500
501 /*
502  * Note:
503  * If this structure changes in ni.c, you must change
504  * this as well, and vice versa.
505  */
506
507 struct Env {
508         int     _ics;
509         int     _sps;
510         int     _spacesz;
511         int     _lss;
512         int     _lss1;
513         int     _ll;
514         int     _ll1;
515         int     _lt;
516         int     _lt1;
517         Tchar   _ic;
518         int     _icf;
519         Tchar   _chbits;
520         Tchar   _spbits;
521         Tchar   _nmbits;
522         int     _apts;
523         int     _apts1;
524         int     _pts;
525         int     _pts1;
526         int     _font;
527         int     _font1;
528         int     _ls;
529         int     _ls1;
530         int     _ad;
531         int     _nms;
532         int     _ndf;
533         int     _nmwid;
534         int     _fi;
535         int     _cc;
536         int     _c2;
537         int     _ohc;
538         int     _tdelim;
539         int     _hyf;
540         int     _hyoff;
541         int     _hyphalg;
542         int     _un1;
543         int     _tabc;
544         int     _dotc;
545         int     _adsp;
546         int     _adrem;
547         int     _lastl;
548         int     _nel;
549         int     _admod;
550         Tchar   *_wordp;
551         int     _spflg;
552         Tchar   *_linep;
553         Tchar   *_wdend;
554         Tchar   *_wdstart;
555         int     _wne;
556         int     _ne;
557         int     _nc;
558         int     _nb;
559         int     _lnmod;
560         int     _nwd;
561         int     _nn;
562         int     _ni;
563         int     _ul;
564         int     _cu;
565         int     _ce;
566         int     _in;
567         int     _in1;
568         int     _un;
569         int     _wch;
570         int     _pendt;
571         Tchar   *_pendw;
572         int     _pendnf;
573         int     _spread;
574         int     _it;
575         int     _itmac;
576         Tchar   *_hyptr[NHYP];
577         long    _tabtab[NTAB];
578         Tbuf    _line;
579         Tbuf    _word;
580 };
581
582 extern  Env     env[];
583 extern  Env     *envp;
584
585 enum {  MBchar = 'U', Troffchar = 'C', Number = 'N', Install = 'i', Lookup = 'l' };
586         /* U => utf, for instance;  C => \(xx, N => \N'...' */
587
588
589
590 struct Chwid {  /* data on one character */
591         Ushort  num;            /* character number:
592                                         0 -> not on this font
593                                         >= ALPHABET -> its number among all Cxy's */
594         Ushort  code;           /* char code for actual device.  used for \N */
595         char    *str;           /* code string for nroff */
596         Uchar   wid;            /* width */
597         Uchar   kern;           /* ascender/descender */
598 };
599
600 struct Font {   /* characteristics of a font */
601         int     name;           /* int name, e.g., BI (2 chars) */
602         char    longname[64];   /* long name of this font (e.g., "Bembo" */
603         char    *truename;      /* path name of table if not in standard place */
604         int     nchars;         /* number of width entries for this font */
605         char    specfont;       /* 1 == special font */
606         int     spacewidth;     /* width of space on this font */
607         int     defaultwidth;   /* default width of characters on this font */
608         Chwid   *wp;            /* widths, etc., of the real characters */
609         char    ligfont;        /* 1 == ligatures exist on this font */
610 };
611
612 /* ligatures, ORed into ligfont */
613
614 #define LFF     01
615 #define LFI     02
616 #define LFL     04
617 #define LFFI    010
618 #define LFFL    020
619
620 /* tracing modes */
621 #define TRNARGS 01              /* trace legality of numeric arguments */
622 #define TRREQ   02              /* trace requests */
623 #define TRMAC   04              /* trace macros */
624 #define RQERR   01              /* processing request/macro */
625
626 /* typewriter driving table structure */
627
628
629 extern  Term    t;
630 struct Term {
631         int     bset;           /* these bits have to be on */
632         int     breset;         /* these bits have to be off */
633         int     Hor;            /* #units in minimum horiz motion */
634         int     Vert;           /* #units in minimum vert motion */
635         int     Newline;        /* #units in single line space */
636         int     Char;           /* #units in character width */
637         int     Em;             /* ditto */
638         int     Halfline;       /* half line units */
639         int     Adj;            /* minimum units for horizontal adjustment */
640         char    *twinit;        /* initialize terminal */
641         char    *twrest;        /* reinitialize terminal */
642         char    *twnl;          /* terminal sequence for newline */
643         char    *hlr;           /* half-line reverse */
644         char    *hlf;           /* half-line forward */
645         char    *flr;           /* full-line reverse */
646         char    *bdon;          /* turn bold mode on */
647         char    *bdoff;         /* turn bold mode off */
648         char    *iton;          /* turn italic mode on */
649         char    *itoff;         /* turn italic mode off */
650         char    *ploton;        /* turn plot mode on */
651         char    *plotoff;       /* turn plot mode off */
652         char    *up;            /* sequence to move up in plot mode */
653         char    *down;          /* ditto */
654         char    *right;         /* ditto */
655         char    *left;          /* ditto */
656
657         Font    tfont;          /* widths and other info, as in a troff font */
658 };
659
660 extern  Term    t;
661
662 /*
663  * for error reporting; keep track of escapes/requests with numeric arguments
664  */
665 struct Numerr {
666         char    type;   /* request or escape? */
667         char    esc;    /* was escape sequence named esc */
668         char    escarg; /* argument of esc's like \D'l' */
669         unsigned int    req;    /* was request or macro named req */
670 };