Annotation of researchv10no/cmd/troff/Old/tdef.h, revision 1.1.1.1

1.1       root        1: #include <signal.h>
                      2: 
                      3: #define        MAXPTR  (char *)-1      /* max value of any pointer variable */
                      4:                                /* likely to be machine-dependent */
                      5: 
                      6: /* starting values for typesetting parameters: */
                      7: 
                      8: #define        PS      10      /* default point size */
                      9: #define        FT      1       /* default font position */
                     10: #define        LL      (unsigned) 65*INCH/10   /* line length; 39picas=6.5in */
                     11: #define        VS      ((12*INCH)/72)  /* initial vert space */
                     12: 
                     13: #ifdef NROFF
                     14: #      define  EM      t.Em
                     15: #      define  HOR     t.Hor
                     16: #      define  VERT    t.Vert
                     17: #      define  INCH    240     /* increments per inch */
                     18: #      define  SPS     INCH/10 /* space size */
                     19: #      define  SS      INCH/10 /* " */
                     20: #      define  TRAILER 0
                     21: #      define  UNPAD   0227
                     22: #      define  PO      0 /* page offset */
                     23: #      define  ASCII   1
                     24: #      define  PTID    1
                     25: #      define  LG      0
                     26: #      define  DTAB    0       /* set at 8 Ems at init time */
                     27: #      define  ICS     2*SPS
                     28: #endif
                     29: #ifndef NROFF  /* TROFF */
                     30:        /* Inch is set by ptinit() when troff started.
                     31:        /* all derived values set then too
                     32:        */
                     33: #      define  INCH    Inch    /* troff resolution -- number of goobies/inch  */
                     34: #      define  POINT   (INCH/72)       /* goobies per point (1/72 inch) */
                     35: #      define  HOR     Hor     /* horizontal resolution in goobies */
                     36: #      define  VERT    Vert    /* vertical resolution in goobies */
                     37: #      define  SPS     (EM/3)  /* space size  */
                     38: #      define  SS      12      /* space size in 36ths of an em */
                     39: #      define  UNPAD   027
                     40: #      define  PO      (INCH - INCH/27) /* page offset 26/27ths inch */
                     41: /* #   define  EM      (POINT * pts) */
                     42: #define        EM      (((long) INCH * pts + 36) / 72) /* don't lose significance */
                     43: #define        EMPTS(pts)      (((long) INCH * (pts) + 36) / 72)
                     44: #      define  ASCII   0
                     45: #      define  PTID    1
                     46: #      define  LG      1
                     47: #      define  DTAB    (INCH/2)
                     48: #      define  ICS     3*SPS
                     49: #endif
                     50: 
                     51: /* These "characters" are used to encode various internal functions
                     52: /* Some make use of the fact that most ascii characters between
                     53: /* 0 and 040 don't have any graphic or other function.
                     54: /* The few that do have a purpose (e.g., \n, \b, \t, ...
                     55: /* are avoided by the ad hoc choices here.
                     56: /* See ifilt[] in n1.c for others -- 1, 2, 3, 5, 6, 7, 010, 011, 012 
                     57: */
                     58: 
                     59: #define        LEADER  001
                     60: #define        IMP     004     /* impossible char; glues things together */
                     61: #define        TAB     011
                     62: #define        RPT     014     /* next character is to be repeated many times */
                     63: #define        CHARHT  015     /* size field sets character height */
                     64: #define        SLANT   016     /* size field sets amount of slant */
                     65: #define        DRAWFCN 017     /* next several chars describe arb drawing fcn */
                     66:                        /* line: 'l' dx dy char */
                     67:                        /* circle: 'c' r */
                     68:                        /* ellipse: 'e' rx ry */
                     69:                        /* arc: 'a' dx dy r */
                     70:                        /* wiggly line '~' x y x y ... */
                     71: #define        DRAWLINE        'l'
                     72: #define        DRAWCIRCLE      'c'     /* circle */
                     73: #define        DRAWELLIPSE     'e'
                     74: #define        DRAWARC         'a'     /* arbitrary arc */
                     75: #define        DRAWWIG         '~'     /* wiggly line with spline */
                     76: 
                     77: #define        LEFT    020     /* \{ */
                     78: #define        RIGHT   021     /* \} */
                     79: #define        FILLER  022     /* \& and similar purposes */
                     80: #define        OHC     024     /* optional hyphenation character \% */
                     81: #define        CONT    025     /* \c character */
                     82: #define        PRESC   026     /* printable escape */
                     83: #define        XPAR    030     /* transparent mode indicator */
                     84: #define        FLSS    031
                     85: #define        WORDSP  032     /* paddable word space */
                     86: #define        ESC     033
                     87: 
                     88:        /* there are several tests (using iscontrol())
                     89:        /* that rely on these having 034 true.
                     90:        */
                     91: #define        iscontrol(n)    (n>=034 && n<=037)      /* used to test the next two */
                     92: #define        HX      035     /* next character is value of \x'...' */
                     93: #define        FONTPOS 036     /* position of font \f(XX encoded in top */
                     94: #define        FONTNAME 037    /* name of font in \f(XX in top */
                     95:                        /* have to appear in this order */
                     96: 
                     97: #define        HYPHEN  c_hyphen
                     98: #define        EMDASH  c_emdash        /* \(em */
                     99: #define        RULE    c_rule  /* \(ru */
                    100: #define        MINUS   c_minus /* minus sign on current font */
                    101: #define        NARSP   c_narsp /* narrow space \|: fake character */
                    102: #define        HNARSP  c_hnarsp        /* half narrow space \^: fake character */
                    103: #define        LIG_FI  c_fi    /* \(ff */
                    104: #define        LIG_FL  c_fl    /* \(fl */
                    105: #define        LIG_FF  c_ff    /* \(ff */
                    106: #define        LIG_FFI c_ffi   /* \(Fi */
                    107: #define        LIG_FFL c_ffl   /* \(Fl */
                    108: #define        ACUTE   c_acute /* acute accent \(aa */
                    109: #define        GRAVE   c_grave /* grave accent \(ga */
                    110: #define        UNDERLINE       c_under /* \(ul */
                    111: #define        ROOTEN  c_rooten        /* root en \(rn */
                    112: #define        BOXRULE c_boxrule       /* box rule \(br */
                    113: #define        LEFTHAND        c_lefthand
                    114: 
                    115: /* array sizes, and similar limits: */
                    116: 
                    117: #define        NFONT   10      /* maximum number of fonts (including specials) */
                    118: #define        EXTRAFONT       500     /* extra space for swapping a font */
                    119: #define        NN      300     /* number registers */
                    120: #define        NNAMES  15       /* predefined reg names */
                    121: #define        NIF     15      /* if-else nesting */
                    122: #define        NS      64      /* name buffer */
                    123: #define        NTM     256     /* tm buffer */
                    124: #define        NEV     3       /* environments */
                    125: #define        EVLSZ   10      /* size of ev stack */
                    126: #define        DSIZE   512     /* disk sector size in chars */
                    127: 
                    128: /* the following defines the size of the infamous environment block.
                    129:    this macro is guaranteed to blow older C preprocessors out of the
                    130:    water.
                    131:    Furthermore, it is wrong: the proper value is more accurately
                    132:    determined by using sizeof *tchar in several places.
                    133:    no harm is done as long as it's big enough.
                    134: */
                    135: 
                    136: #define        EVUSED  \
                    137:                (59 * sizeof(int)       /* integers in env block */     \
                    138:                + 9 * sizeof(tchar)     /* tchars in env block */       \
                    139:                + NHYP * sizeof(tchar)  /* hytab */     \
                    140:                + NTAB * sizeof(int)    /* tabtab */    \
                    141:                + (LNSIZE+WDSIZE) * sizeof(tchar))      /* line+word */
                    142: 
                    143: #define        EVSPARE DSIZE - EVUSED % DSIZE  /* number of leftover chars */
                    144: #define        EVS     (EVUSED + EVSPARE)      /* should be a multiple of DSIZE */
                    145: #define        NM      350     /* requests + macros */
                    146: #define        DELTA   1024    /* delta core bytes */
                    147: #define        NHYP    10      /* max hyphens per word */
                    148: #define        NHEX    128     /* byte size of exception word list */
                    149: #define        NTAB    35      /* tab stops */
                    150: #define        NSO     5       /* "so" depth */
                    151: #define        WDSIZE  270     /* word buffer size */
                    152: #define        LNSIZE  680     /* line buffer size */
                    153: #define        NDI     5       /* number of diversions */
                    154: #define        NTRTAB  350     /* number of items in trtab[] */
                    155: #define        NTRAP   20      /* number of traps */
                    156: #define        NPN     20      /* numbers in "-o" */
                    157: #define        FBUFSZ  256     /* field buf size words */
                    158: #define        OBUFSZ  512     /* bytes */
                    159: #define        IBUFSZ  512     /* bytes */
                    160: #define        NC      256     /* cbuf size words */
                    161: #define        NOV     10      /* number of overstrike chars */
                    162: #define        NPP     10      /* pads per field */
                    163: 
                    164: /*
                    165:        Internal character representation:
                    166:        Internally, every character is carried around as
                    167:        a 32 bit cookie, called a "tchar" (typedef long).
                    168:        Bits are numbered 31..0 from left to right.
                    169:        If bit 15 is 1, the character is motion, with
                    170:                if bit 16 it's vertical motion
                    171:                if bit 17 it's negative motion
                    172:        If bit 15 is 0, the character is a real character.
                    173:                if bit 31       zero motion
                    174:                bits 30..24     size
                    175:                bits 23..16     font
                    176: */
                    177: 
                    178: /* in the following, "L" should really be a tchar, but ... */
                    179: 
                    180: #define        MOT     (unsigned short)(01<<15)        /* motion character indicator */
                    181: #define        MOTV    (07L<<15)       /* clear for motion part */
                    182: #define        VMOT    (01L<<16)       /* vert motion bit */
                    183: #define        NMOT    (01L<<17)       /* negative motion indicator*/
                    184: #define        MAXMOT  32767   /* bad way to write this!!! */
                    185: #define        ismot(n)        ((unsigned short)(n) & MOT)     /* (short) is a cheap mask */
                    186: #define        isvmot(n)       ((n) & VMOT)    /* must have tested MOT previously */
                    187: #define        isnmot(n)       ((n) & NMOT)    /* ditto */
                    188: #define        absmot(n)       ((unsigned short)(n) & ~MOT)    /* (short) is cheap mask */
                    189: 
                    190: #define        ZBIT    (01L << 31)     /* zero width char */
                    191: #define        iszbit(n)       ((n) & ZBIT)
                    192: 
                    193: #define        SMASK           (0177L << 24)
                    194: #define        FMASK           (0377L << 16)
                    195: #define        SFMASK          (SMASK|FMASK)   /* size and font in a tchar */
                    196: #define        CMASK           ~MOT            /* clears MOT */
                    197: #define        CMASKL          077777L
                    198: #define        sbits(n)        ((unsigned short)((n) >> 24) & 0177)
                    199: #define        fbits(n)        ((unsigned short)((n) >> 16) & 0377)
                    200: #define        sfbits(n)       ((unsigned short)(((n) & SFMASK) >> 16))
                    201: #define        cbits(n)        (unsigned short)(n)     /* isolate bottom 16 bits  */
                    202: #define        setsbits(n,s)   n = (n & ~SMASK) | (tchar)(s) << 24
                    203: #define        setfbits(n,f)   n = (n & ~FMASK) | (tchar)(f) << 16
                    204: #define        setsfbits(n,sf) n = (n & ~SFMASK) | (tchar)(sf) << 16
                    205: #define        setcbits(n,c)   n = (n & ~CMASKL | (c)) /* set character bits */
                    206: 
                    207: #define        MMASK   0100000 /* macro mask indicator */
                    208: #define        BMASK   0377
                    209: #define        BYTE    8
                    210: 
                    211: #define        ZONE    5       /* 5 hrs for EST */
                    212: #define        TMASK    037777
                    213: #define        RTAB    (unsigned) 0100000
                    214: #define        CTAB    040000
                    215: 
                    216: #define        PAIR(A,B)       (A|(B<<BYTE))
                    217: 
                    218: typedef unsigned filep;
                    219: #define        BLK     128     /* alloc block tchars */
                    220: #define        NBLIST  1024    /* allocation list */
                    221: /* previous values were BLK 256 NBLIST 512 */
                    222: /* it seems good to keep the product constant */
                    223:                /* BLK*NBLIST<=65536 words, if filep=unsigned */
                    224: 
                    225: typedef        long    tchar;  /* as an experiment */
                    226: 
                    227: extern tchar   getch(), getch0();
                    228: extern tchar   rbf(), rbf0();
                    229: extern tchar   mot(), hmot(), vmot();
                    230: extern tchar   makem(), sethl();
                    231: extern tchar   popi();
                    232: extern tchar   getlg();
                    233: extern tchar   xlss();
                    234: extern tchar   setfield();
                    235: extern tchar   setz();
                    236: extern tchar   setch(), absch();
                    237: extern tchar   setht(), setslant();
                    238: 
                    239: #define        atoi(i)         ((int) atoi0(i))
                    240: extern long    atoi0();
                    241: 
                    242: extern int     Inch, Hor, Vert, Unitwidth;
                    243: 
                    244: /* these characters are used as various signals or values
                    245: /* in miscellaneous places.
                    246: /* values are set in specnames in t10.c
                    247: */
                    248: 
                    249: extern int     c_hyphen;
                    250: extern int     c_emdash;
                    251: extern int     c_rule;
                    252: extern int     c_minus;
                    253: extern int     c_narsp;
                    254: extern int     c_hnarsp;
                    255: extern int     c_fi;
                    256: extern int     c_fl;
                    257: extern int     c_ff;
                    258: extern int     c_ffi;
                    259: extern int     c_ffl;
                    260: extern int     c_acute;
                    261: extern int     c_grave;
                    262: extern int     c_under;
                    263: extern int     c_rooten;
                    264: extern int     c_boxrule;
                    265: extern int     c_lefthand;
                    266: 
                    267: extern int     stderr; /* this is NOT the stdio value! */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.