/* starting values for typesetting parameters: */
#define PS 10 /* default point size */
#define FT 1 /* default font position */
#define ULFONT 2 /* default underline font */
#define BDFONT 3 /* default emboldening font */
#define BIFONT 4 /* default bold italic font */
#define LL (unsigned) 65*INCH/10 /* line length; 39picas=6.5in */
#define VS ((12*INCH)/72) /* initial vert space */
# define INCH 240 /* increments per inch */
# define SPS INCH/10 /* space size */
# define SS INCH/10 /* " */
# define PO 0 /* page offset */
# define DTAB 0 /* set at 8 Ems at init time */
#ifndef NROFF /* TROFF */
/* Inch is set by ptinit() when troff started.
/* all derived values set then too
# define INCH Inch /* troff resolution -- number of goobies/inch */
# define POINT (INCH/72) /* goobies per point (1/72 inch) */
# define HOR Hor /* horizontal resolution in goobies */
# define VERT Vert /* vertical resolution in goobies */
# define SPS (EM/3) /* space size */
# define SS 12 /* space size in 36ths of an em */
# define PO (INCH) /* page offset 1 inch */
/* # define EM (POINT * pts) */
#define EM (((long) INCH * pts + 36) / 72) /* don't lose significance */
#define EMPTS(pts) (((long) INCH * (pts) + 36) / 72)
/* These "characters" are used to encode various internal functions
/* Some make use of the fact that most ascii characters between
/* 0 and 040 don't have any graphic or other function.
/* The few that do have a purpose (e.g., \n, \b, \t, ...
/* are avoided by the ad hoc choices here.
/* See ifilt[] in n1.c for others -- 1, 2, 3, 5, 6, 7, 010, 011, 012
#define IMP 004 /* impossible char; glues things together */
#define RPT 014 /* next character is to be repeated many times */
#define CHARHT 015 /* size field sets character height */
#define SLANT 016 /* size field sets amount of slant */
#define DRAWFCN 017 /* next several chars describe arb drawing fcn */
/* line: 'l' dx dy char */
/* wiggly line '~' x y x y ... */
#define DRAWCIRCLE 'c' /* circle */
#define DRAWARC 'a' /* arbitrary arc */
#define DRAWSPLINE '~' /* quadratic B spline */
#define LEFT 020 /* \{ */
#define RIGHT 021 /* \} */
#define FILLER 022 /* \& and similar purposes */
#define XON 023 /* \X'...' starts here */
#define OHC 024 /* optional hyphenation character \% */
#define CONT 025 /* \c character */
#define PRESC 026 /* printable escape */
#define UNPAD 027 /* unpaddable blank */
#define XPAR 030 /* transparent mode indicator */
#define WORDSP 032 /* paddable word space */
#define XOFF 034 /* \X'...' ends here */
#define iscontrol(n) (n==035 || n==036) /* used to test the next two */
#define HX 035 /* next character is value of \x'...' */
#define MAXFONTS 99 /* Maximum number of fonts (in fontab) */
#define EMDASH c_emdash /* \(em */
#define RULE c_rule /* \(ru */
#define MINUS c_minus /* minus sign on current font */
#define LIG_FI c_fi /* \(ff */
#define LIG_FL c_fl /* \(fl */
#define LIG_FF c_ff /* \(ff */
#define LIG_FFI c_ffi /* \(Fi */
#define LIG_FFL c_ffl /* \(Fl */
#define ACUTE c_acute /* acute accent \(aa */
#define GRAVE c_grave /* grave accent \(ga */
#define UNDERLINE c_under /* \(ul */
#define ROOTEN c_rooten /* root en \(rn */
#define BOXRULE c_boxrule /* box rule \(br */
#define LEFTHAND c_lefthand /* left hand for word overflow */
#define DAGGER c_dagger /* dagger for footnotes */
/* array sizes, and similar limits: */
#define NFONT 10 /* maximum number of fonts (including specials) */
#define NN 400 /* number registers */
#define NNAMES 15 /* predefined reg names */
#define NIF 15 /* if-else nesting */
#define NS 128 /* name buffer */
#define NTM 256 /* tm buffer */
#define NEV 3 /* environments */
#define EVLSZ 10 /* size of ev stack */
#define DSIZE 512 /* disk sector size in chars */
#define NM 500 /* requests + macros */
#define DELTA 1024 /* delta core bytes */
#define NHYP 10 /* max hyphens per word */
#define NHEX 128 /* byte size of exception word list */
#define NTAB 40 /* tab stops */
#define NSO 5 /* "so" depth */
#define WDSIZE 270 /* word buffer size */
#define LNSIZE 1024 /* line buffer size */
#define NDI 5 /* number of diversions */
#define NTRTAB 512 /* number of items in trtab[] */
#define NWIDCACHE 512 /* number of items in widcache[] */
#define NTRAP 20 /* number of traps */
#define NPN 20 /* numbers in "-o" */
#define FBUFSZ 256 /* field buf size words */
#define OBUFSZ 4096 /* bytes */
#define IBUFSZ 4096 /* bytes */
#define NC 1024 /* cbuf size words */
#define NOV 10 /* number of overstrike chars */
#define NPP 10 /* pads per field */
Internal character representation:
Internally, every character is carried around as
a 32 bit cookie, called a "tchar" (typedef long).
Bits are numbered 31..0 from left to right.
If bit 15 is 1, the character is motion, with
if bit 16 it's vertical motion
if bit 17 it's negative motion
If bit 15 is 0, the character is a real character.
bit 8 absolute char number in 7..0
This implies at most 256-32 characters in a single font,
which is going to be a problem somewhere
/* in the following, "L" should really be a tchar, but ... */
#define MOT (01L<<15) /* motion character indicator */
#define MOTV (07L<<15) /* clear for motion part */
#define VMOT (01L<<16) /* vert motion bit */
#define NMOT (01L<<17) /* negative motion indicator*/
#define MAXMOT 32767 /* bad way to write this!!! */
#define ismot(n) ((n) & MOT)
#define isvmot(n) ((n) & VMOT) /* must have tested MOT previously */
#define isnmot(n) ((n) & NMOT) /* ditto */
#define absmot(n) (unsigned)(0177777 & (n) & ~MOT) /* (short) is cheap mask */
#define ZBIT (01L << 31) /* zero width char */
#define iszbit(n) ((n) & ZBIT)
#define ABSCHAR 0400 /* absolute char number in this font */
#define SMASK (0177L << 24)
#define FMASK (0377L << 16)
#define SFMASK (SMASK|FMASK) /* size and font in a tchar */
#define sbits(n) (((n) >> 24) & 0177)
#define fbits(n) (((n) >> 16) & 0377)
#define sfbits(n) (unsigned)(0177777 & (((n) & SFMASK) >> 16))
#define cbits(n) (unsigned)(0177777 & (n)) /* isolate bottom 16 bits */
#define absbits(n) (cbits(n) & ~ABSCHAR)
#define setsbits(n,s) n = (n & ~SMASK) | (tchar)(s) << 24
#define setfbits(n,f) n = (n & ~FMASK) | (tchar)(f) << 16
#define setsfbits(n,sf) n = (n & ~SFMASK) | (tchar)(sf) << 16
#define setcbits(n,c) n = (n & ~077777L | (c)) /* set character bits */
#define ZONE 5 /* 5 hrs for EST */
#define RTAB (unsigned) 0100000
#define TABBIT 02 /* bits in gchtab */
#define PAIR(A,B) (A|(B<<BYTE))
#define oput(c) if ((*obufp++ = (c)), obufp >= &obuf[OBUFSZ]) flusho(); else
* "temp file" parameters. macros and strings
* are stored in an array of linked blocks,
* which may be in memory if INCORE is set during
* compilation, or otherwise in a file.
* The numerology is delicate if filep is 16 bits:
* i.e., the product is 16 bits long.
* If filep is an unsigned long (and if your
* compiler will let you say that) then NBLIST
* can be a lot bigger. Of course that makes
* the file or core image a lot bigger too,
* and means you don't detect missing diversion
* terminations as quickly... .
* It also means that you may have trouble running
* on non-swapping systems, since the core image
* In any case, both must be powers of 2.
typedef unsigned int filep
; /* this is good for 32 bit machines */
#define BLK 128 /* alloc block in tchars */
#define NBLIST 2048 /* allocation list. smallish machines use 1024, bigger use 2048 */
typedef long tchar
; /* as an experiment */
extern tchar
getch(), getch0();
extern tchar
rbf(), rbf0();
extern tchar
mot(), hmot(), vmot();
extern tchar
makem(), sethl();
extern tchar
setht(), setslant();
#define atoi(i) ((int) atoi0(i))
extern int Inch
, Hor
, Vert
, Unitwidth
;
/* these characters are used as various signals or values
/* in miscellaneous places.
/* values are set in specnames in t10.c
extern int stderr
; /* this is NOT the stdio value! */
extern struct d
{ /* diversion */
extern struct s
{ /* stack frame */
/* the infamous environment block */
#define spacesz env._spacesz
#define chbits env._chbits
#define spbits env._spbits
#define nmbits env._nmbits
#define tdelim env._tdelim
#define hyalg1 env._hyalg1
#define thresh env._thresh
#define wdstart env._wdstart
#define pendnf env._pendnf
#define spread env._spread
#define lnsize env._lnsize
#define tabtab env._tabtab
* If this structure changes in ni.c, you should change
* All changes will come after this comment (jaap)
* hyphenation dependent stuff (jaap)
#define THRESH 160 /*digram goodness threshold (from n8.c, (jaap))*/
#define DUTCH_THRESH 3 /* for recursive bestesplits (jaap) */
#define ORIGINAL 0 /* original (American) English) algorithm */
#define DUTCH 1 /* second hyphenation routine (bestesplits) */
#define MAXDIALECTS 1 /* number of hyphenation algorithms */
* define enough space for the fontcache. EXTRAFONT is maximum space
* currently to be used by a font. The space for the fonttab is
* for the "logical to physical font table mapping addition (jaap).
#define MAXCHARS 255 /* current maximum of characters in a font */
#define EXTRAFONT (3*MAXCHARS * sizeof(char) + dev.nchtab + (128-32) \
* sizeof(char) + sizeof(struct Font) + 255 * sizeof(short))