|
|
1.1 ! root 1: ! 2: /* starting values for typesetting parameters: */ ! 3: ! 4: #define PS 10 /* default point size */ ! 5: #define FT 1 /* default font position */ ! 6: #define ULFONT 2 /* default underline font */ ! 7: #define BDFONT 3 /* default emboldening font */ ! 8: #define BIFONT 4 /* default bold italic font */ ! 9: #define LL (unsigned) 65*INCH/10 /* line length; 39picas=6.5in */ ! 10: #define VS ((12*INCH)/72) /* initial vert space */ ! 11: ! 12: #ifdef NROFF ! 13: # define EM t.Em ! 14: # define HOR t.Adj ! 15: # define VERT t.Vert ! 16: # define INCH 240 /* increments per inch */ ! 17: # define SPS INCH/10 /* space size */ ! 18: # define SS INCH/10 /* " */ ! 19: # define TRAILER 0 ! 20: # define PO 0 /* page offset */ ! 21: # define ASCII 1 ! 22: # define PTID 1 ! 23: # define LG 0 ! 24: # define DTAB 0 /* set at 8 Ems at init time */ ! 25: # define ICS 2*SPS ! 26: #endif ! 27: #ifndef NROFF /* TROFF */ ! 28: /* Inch is set by ptinit() when troff started. ! 29: /* all derived values set then too ! 30: */ ! 31: # define INCH Inch /* troff resolution -- number of goobies/inch */ ! 32: # define POINT (INCH/72) /* goobies per point (1/72 inch) */ ! 33: # define HOR Hor /* horizontal resolution in goobies */ ! 34: # define VERT Vert /* vertical resolution in goobies */ ! 35: # define SPS (EM/3) /* space size */ ! 36: # define SS 12 /* space size in 36ths of an em */ ! 37: # define PO (INCH) /* page offset 1 inch */ ! 38: # define EM (((long) INCH * pts + 36) / 72) /* don't lose significance */ ! 39: # define EMPTS(pts) (((long) INCH * (pts) + 36) / 72) ! 40: # define ASCII 0 ! 41: # define PTID 1 ! 42: # define LG 1 ! 43: # define DTAB (INCH/2) ! 44: # define ICS (3*SPS) ! 45: #endif ! 46: ! 47: /* These "characters" are used to encode various internal functions ! 48: /* Some make use of the fact that most ascii characters between ! 49: /* 0 and 040 don't have any graphic or other function. ! 50: /* The few that do have a purpose (e.g., \n, \b, \t, ... ! 51: /* are avoided by the ad hoc choices here. ! 52: /* See ifilt[] in n1.c for others -- 1, 2, 3, 5, 6, 7, 010, 011, 012 ! 53: */ ! 54: ! 55: #define LEADER 001 ! 56: #define IMP 004 /* impossible char; glues things together */ ! 57: #define TAB 011 ! 58: #define RPT 014 /* next character is to be repeated many times */ ! 59: #define CHARHT 015 /* size field sets character height */ ! 60: #define SLANT 016 /* size field sets amount of slant */ ! 61: #define DRAWFCN 017 /* next several chars describe arb drawing fcns */ ! 62: # define DRAWLINE 'l' /* line: 'l' dx dy char */ ! 63: # define DRAWCIRCLE 'c' /* circle: 'c' r */ ! 64: # define DRAWELLIPSE 'e' /* ellipse: 'e' rx ry */ ! 65: # define DRAWARC 'a' /* arc: 'a' dx dy dx dy */ ! 66: # define DRAWSPLINE '~' /* quadratic B spline: '~' dx dy dx dy ... */ ! 67: /* other splines go thru too */ ! 68: ! 69: #define LEFT 020 /* \{ */ ! 70: #define RIGHT 021 /* \} */ ! 71: #define FILLER 022 /* \& and similar purposes */ ! 72: #define XON 023 /* \X'...' starts here */ ! 73: #define OHC 024 /* optional hyphenation character \% */ ! 74: #define CONT 025 /* \c character */ ! 75: #define PRESC 026 /* printable escape */ ! 76: #define UNPAD 027 /* unpaddable blank */ ! 77: #define XPAR 030 /* transparent mode indicator */ ! 78: #define FLSS 031 /* next tchar contains vertical space */ ! 79: /* used when recalling diverted text */ ! 80: #define WORDSP 032 /* paddable word space */ ! 81: #define ESC 033 /* current escape character */ ! 82: #define XOFF 034 /* \X'...' ends here */ ! 83: /* matches XON, but they will probably never nest */ ! 84: /* so could drop this when another control is needed */ ! 85: ! 86: #define iscontrol(n) (n==035 || n==036) /* used to test the next two */ ! 87: #define HX 035 /* next character is value of \x'...' */ ! 88: #define FONTPOS 036 /* position of font \f(XX encoded in top */ ! 89: ! 90: #define HYPHEN c_hyphen ! 91: #define EMDASH c_emdash /* \(em */ ! 92: #define RULE c_rule /* \(ru */ ! 93: #define MINUS c_minus /* minus sign on current font */ ! 94: #define LIG_FI c_fi /* \(ff */ ! 95: #define LIG_FL c_fl /* \(fl */ ! 96: #define LIG_FF c_ff /* \(ff */ ! 97: #define LIG_FFI c_ffi /* \(Fi */ ! 98: #define LIG_FFL c_ffl /* \(Fl */ ! 99: #define ACUTE c_acute /* acute accent \(aa */ ! 100: #define GRAVE c_grave /* grave accent \(ga */ ! 101: #define UNDERLINE c_under /* \(ul */ ! 102: #define ROOTEN c_rooten /* root en \(rn */ ! 103: #define BOXRULE c_boxrule /* box rule \(br */ ! 104: #define LEFTHAND c_lefthand /* left hand for word overflow */ ! 105: #define DAGGER c_dagger /* dagger for footnotes */ ! 106: ! 107: /* array sizes, and similar limits: */ ! 108: ! 109: #define NFONT 10 /* maximum number of fonts (including specials) */ ! 110: #define EXTRAFONT 500 /* extra space for swapping a font */ ! 111: #define NN 400 /* number registers */ ! 112: #define NNAMES 15 /* predefined reg names */ ! 113: #define NIF 15 /* if-else nesting */ ! 114: #define NS 128 /* name buffer */ ! 115: #define NTM 256 /* tm buffer */ ! 116: #define NEV 3 /* environments */ ! 117: #define EVLSZ 10 /* size of ev stack */ ! 118: #define DSIZE 512 /* disk sector size in chars */ ! 119: ! 120: #define NM 500 /* requests + macros */ ! 121: #define DELTA 1024 /* delta core bytes */ ! 122: #define NHYP 10 /* max hyphens per word */ ! 123: #define NHEX 128 /* byte size of exception word list */ ! 124: #define NTAB 40 /* tab stops */ ! 125: #define NSO 5 /* "so" depth */ ! 126: #define NMF 5 /* number of -m flags */ ! 127: #define WDSIZE 270 /* word buffer size */ ! 128: #define LNSIZE 680 /* line buffer size */ ! 129: #define NDI 5 /* number of diversions */ ! 130: #define NTRTAB 512 /* number of items in trtab[] */ ! 131: #define NWIDCACHE 512 /* number of items in widcache[] */ ! 132: #define NTRAP 20 /* number of traps */ ! 133: #define NPN 20 /* numbers in "-o" */ ! 134: #define FBUFSZ 256 /* field buf size words */ ! 135: #define OBUFSZ 4096 /* bytes */ ! 136: #define IBUFSZ 4096 /* bytes */ ! 137: #define NC 1024 /* cbuf size words */ ! 138: #define NOV 10 /* number of overstrike chars */ ! 139: #define NPP 10 /* pads per field */ ! 140: ! 141: /* ! 142: Internal character representation: ! 143: Internally, every character is carried around as ! 144: a 32 bit cookie, called a "tchar" (typedef long). ! 145: Bits are numbered 31..0 from left to right. ! 146: If bit 15 is 1, the character is motion, with ! 147: if bit 16 it's vertical motion ! 148: if bit 17 it's negative motion ! 149: If bit 15 is 0, the character is a real character. ! 150: if bit 31 zero motion ! 151: bits 30..24 size ! 152: bits 23..16 font ! 153: */ ! 154: ! 155: /* in the following, "L" should really be a tchar, but ... */ ! 156: ! 157: #define MOT (01L<<15) /* motion character indicator */ ! 158: #define MOTV (07L<<15) /* clear for motion part */ ! 159: #define VMOT (01L<<16) /* vert motion bit */ ! 160: #define NMOT (01L<<17) /* negative motion indicator*/ ! 161: #define MAXMOT 32767 /* bad way to write this!!! */ ! 162: #define ismot(n) ((n) & MOT) ! 163: #define isvmot(n) ((n) & VMOT) /* must have tested MOT previously */ ! 164: #define isnmot(n) ((n) & NMOT) /* ditto */ ! 165: #define absmot(n) (unsigned)(0177777 & (n) & ~MOT) /* (short) is cheap mask */ ! 166: ! 167: #define ZBIT (01L << 31) /* zero width char */ ! 168: #define iszbit(n) ((n) & ZBIT) ! 169: ! 170: #define SMASK (0177L << 24) ! 171: #define FMASK (0377L << 16) ! 172: #define SFMASK (SMASK|FMASK) /* size and font in a tchar */ ! 173: #define sbits(n) (((n) >> 24) & 0177) ! 174: #define fbits(n) (((n) >> 16) & 0377) ! 175: #define sfbits(n) (unsigned)(0177777 & (((n) & SFMASK) >> 16)) ! 176: #define cbits(n) (unsigned)(0177777 & (n)) /* isolate bottom 16 bits */ ! 177: ! 178: #define setsbits(n,s) n = (n & ~SMASK) | (tchar)(s) << 24 ! 179: #define setfbits(n,f) n = (n & ~FMASK) | (tchar)(f) << 16 ! 180: #define setsfbits(n,sf) n = (n & ~SFMASK) | (tchar)(sf) << 16 ! 181: #define setcbits(n,c) n = (n & ~077777L | (c)) /* set character bits */ ! 182: ! 183: #define BYTEMASK 0377 ! 184: #define BYTE 8 ! 185: ! 186: #define ZONE 5 /* 5 hrs for EST */ ! 187: #define TABMASK 037777 ! 188: #define RTAB (unsigned) 0100000 ! 189: #define CTAB 040000 ! 190: ! 191: #define TABBIT 02 /* bits in gchtab */ ! 192: #define LDRBIT 04 ! 193: #define FCBIT 010 ! 194: ! 195: #define PAIR(A,B) (A|(B<<BYTE)) ! 196: ! 197: #define oput(c) if ((*obufp++ = (c)), obufp >= &obuf[OBUFSZ]) flusho(); else ! 198: ! 199: /* ! 200: * "temp file" parameters. macros and strings ! 201: * are stored in an array of linked blocks, ! 202: * which may be in memory and an array called ! 203: * corebuf[], if INCORE is set during ! 204: * compilation, or otherwise in a file called trtmp$$. ! 205: ! 206: * The numerology is delicate if filep is 16 bits: ! 207: #define BLK 128 ! 208: #define NBLIST 512 ! 209: * i.e., the product is 16 bits long. ! 210: ! 211: * If filep is an unsigned long (and if your ! 212: * compiler will let you say that) then NBLIST ! 213: * can be a lot bigger. Of course that makes ! 214: * the file or core image a lot bigger too, ! 215: * and means you don't detect missing diversion ! 216: * terminations as quickly... . ! 217: * It also means that you may have trouble running ! 218: * on non-swapping systems, since the core image ! 219: * will be over 1Mb. ! 220: ! 221: * BLK must be a power of 2 ! 222: */ ! 223: ! 224: typedef unsigned int filep; /* this is good for 32 bit machines */ ! 225: ! 226: #define BLK 128 /* alloc block in tchars */ ! 227: ! 228: #ifdef SMALLER ! 229: # define NBLIST 1024 ! 230: #else ! 231: # define NBLIST 2048 /* allocation list. smallish machines use 1024 */ ! 232: #endif ! 233: ! 234: /* Other things are stored in the temp file or corebuf: ! 235: * a single block for .rd input, at offset RD_OFFSET ! 236: * NEV copies of the environment block, at offset ENV_OFFSET ! 237: ! 238: * The existing implementation assumes very strongly that ! 239: * these are respectively NBLIST*BLK and 0. ! 240: ! 241: */ ! 242: ! 243: #define RD_OFFSET (NBLIST * BLK) ! 244: #define ENV_OFFSET 0 ! 245: #define ENV_BLK ((NEV * sizeof(env) / sizeof(tchar) + BLK-1) / BLK) ! 246: /* rounded up to even BLK */ ! 247: ! 248: typedef long tchar; ! 249: ! 250: extern tchar getch(), getch0(); ! 251: extern tchar rbf(), rbf0(); ! 252: extern tchar mot(), hmot(), vmot(); ! 253: extern tchar makem(), sethl(); ! 254: extern tchar popi(); ! 255: extern tchar getlg(); ! 256: extern tchar xlss(); ! 257: extern tchar setfield(); ! 258: extern tchar setz(); ! 259: extern tchar setch(); ! 260: extern tchar setht(), setslant(); ! 261: ! 262: #define atoi(i) ((int) atoi0(i)) ! 263: extern long atoi0(); ! 264: ! 265: extern int Inch, Hor, Vert, Unitwidth; ! 266: ! 267: /* these characters are used as various signals or values ! 268: /* in miscellaneous places. ! 269: /* values are set in specnames in t10.c ! 270: */ ! 271: ! 272: extern int c_hyphen; ! 273: extern int c_emdash; ! 274: extern int c_rule; ! 275: extern int c_minus; ! 276: extern int c_fi; ! 277: extern int c_fl; ! 278: extern int c_ff; ! 279: extern int c_ffi; ! 280: extern int c_ffl; ! 281: extern int c_acute; ! 282: extern int c_grave; ! 283: extern int c_under; ! 284: extern int c_rooten; ! 285: extern int c_boxrule; ! 286: extern int c_lefthand; ! 287: extern int c_dagger; ! 288: ! 289: extern int stderr; /* this is NOT the stdio value! */ ! 290: ! 291: extern struct d { /* diversion */ ! 292: filep op; ! 293: int dnl; ! 294: int dimac; ! 295: int ditrap; ! 296: int ditf; ! 297: int alss; ! 298: int blss; ! 299: int nls; ! 300: int mkline; ! 301: int maxl; ! 302: int hnl; ! 303: int curd; ! 304: }; ! 305: ! 306: extern struct s { /* stack frame */ ! 307: int nargs; ! 308: struct s *pframe; ! 309: filep pip; ! 310: int pnchar; ! 311: tchar prchar; ! 312: int ppendt; ! 313: tchar pch; ! 314: tchar *lastpbp; ! 315: int mname; ! 316: }; ! 317: ! 318: extern struct contab { ! 319: unsigned short rq; ! 320: struct contab *link; ! 321: int (*f)(); ! 322: unsigned mx; ! 323: } contab[NM]; ! 324: ! 325: extern struct numtab { ! 326: short r; /* name */ ! 327: short fmt; ! 328: short inc; ! 329: int val; ! 330: struct numtab *link; ! 331: } numtab[NN]; ! 332: ! 333: #define PN 0 ! 334: #define NL 1 ! 335: #define YR 2 ! 336: #define HP 3 ! 337: #define CT 4 ! 338: #define DN 5 ! 339: #define MO 6 ! 340: #define DY 7 ! 341: #define DW 8 ! 342: #define LN 9 ! 343: #define DL 10 ! 344: #define ST 11 ! 345: #define SB 12 ! 346: #define CD 13 ! 347: #define PID 14 ! 348: ! 349: /* the infamous environment block */ ! 350: ! 351: #define ics env._ics ! 352: #define sps env._sps ! 353: #define spacesz env._spacesz ! 354: #define lss env._lss ! 355: #define lss1 env._lss1 ! 356: #define ll env._ll ! 357: #define ll1 env._ll1 ! 358: #define lt env._lt ! 359: #define lt1 env._lt1 ! 360: #define ic env._ic ! 361: #define icf env._icf ! 362: #define chbits env._chbits ! 363: #define spbits env._spbits ! 364: #define nmbits env._nmbits ! 365: #define apts env._apts ! 366: #define apts1 env._apts1 ! 367: #define pts env._pts ! 368: #define pts1 env._pts1 ! 369: #define font env._font ! 370: #define font1 env._font1 ! 371: #define ls env._ls ! 372: #define ls1 env._ls1 ! 373: #define ad env._ad ! 374: #define nms env._nms ! 375: #define ndf env._ndf ! 376: #define fi env._fi ! 377: #define cc env._cc ! 378: #define c2 env._c2 ! 379: #define ohc env._ohc ! 380: #define tdelim env._tdelim ! 381: #define hyf env._hyf ! 382: #define hyoff env._hyoff ! 383: #define un1 env._un1 ! 384: #define tabc env._tabc ! 385: #define dotc env._dotc ! 386: #define adsp env._adsp ! 387: #define adrem env._adrem ! 388: #define lastl env._lastl ! 389: #define nel env._nel ! 390: #define admod env._admod ! 391: #define wordp env._wordp ! 392: #define spflg env._spflg ! 393: #define linep env._linep ! 394: #define wdend env._wdend ! 395: #define wdstart env._wdstart ! 396: #define wne env._wne ! 397: #define ne env._ne ! 398: #define nc env._nc ! 399: #define nb env._nb ! 400: #define lnmod env._lnmod ! 401: #define nwd env._nwd ! 402: #define nn env._nn ! 403: #define ni env._ni ! 404: #define ul env._ul ! 405: #define cu env._cu ! 406: #define ce env._ce ! 407: #define in env._in ! 408: #define in1 env._in1 ! 409: #define un env._un ! 410: #define wch env._wch ! 411: #define pendt env._pendt ! 412: #define pendw env._pendw ! 413: #define pendnf env._pendnf ! 414: #define spread env._spread ! 415: #define it env._it ! 416: #define itmac env._itmac ! 417: #define lnsize env._lnsize ! 418: #define hyptr env._hyptr ! 419: #define tabtab env._tabtab ! 420: #define line env._line ! 421: #define word env._word ! 422: ! 423: extern struct env { ! 424: int _ics; ! 425: int _sps; ! 426: int _spacesz; ! 427: int _lss; ! 428: int _lss1; ! 429: int _ll; ! 430: int _ll1; ! 431: int _lt; ! 432: int _lt1; ! 433: tchar _ic; ! 434: int _icf; ! 435: tchar _chbits; ! 436: tchar _spbits; ! 437: tchar _nmbits; ! 438: int _apts; ! 439: int _apts1; ! 440: int _pts; ! 441: int _pts1; ! 442: int _font; ! 443: int _font1; ! 444: int _ls; ! 445: int _ls1; ! 446: int _ad; ! 447: int _nms; ! 448: int _ndf; ! 449: int _fi; ! 450: int _cc; ! 451: int _c2; ! 452: int _ohc; ! 453: int _tdelim; ! 454: int _hyf; ! 455: int _hyoff; ! 456: int _un1; ! 457: int _tabc; ! 458: int _dotc; ! 459: int _adsp; ! 460: int _adrem; ! 461: int _lastl; ! 462: int _nel; ! 463: int _admod; ! 464: tchar *_wordp; ! 465: int _spflg; ! 466: tchar *_linep; ! 467: tchar *_wdend; ! 468: tchar *_wdstart; ! 469: int _wne; ! 470: int _ne; ! 471: int _nc; ! 472: int _nb; ! 473: int _lnmod; ! 474: int _nwd; ! 475: int _nn; ! 476: int _ni; ! 477: int _ul; ! 478: int _cu; ! 479: int _ce; ! 480: int _in; ! 481: int _in1; ! 482: int _un; ! 483: int _wch; ! 484: int _pendt; ! 485: tchar *_pendw; ! 486: int _pendnf; ! 487: int _spread; ! 488: int _it; ! 489: int _itmac; ! 490: int _lnsize; ! 491: tchar *_hyptr[NHYP]; ! 492: int _tabtab[NTAB]; ! 493: tchar _line[LNSIZE]; ! 494: tchar _word[WDSIZE]; ! 495: } env;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.