Annotation of researchv10dc/cmd/troff/ni.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include "tdef.h"
        !             3: #include "fns.h"
        !             4: #include "ext.h"
        !             5: 
        !             6: char   termtab[NS];    /* term type added in ptinit() */
        !             7: char   fontdir[NS];    /* added in casefp; not used by nroff */
        !             8: char   devname[20];    /* default output device */
        !             9: 
        !            10: Numtab numtab[NN] = {
        !            11:        { PAIR('%', 0) },
        !            12:        { PAIR('n', 'l') },
        !            13:        { PAIR('y', 'r') },
        !            14:        { PAIR('h', 'p') },
        !            15:        { PAIR('c', 't') },
        !            16:        { PAIR('d', 'n') },
        !            17:        { PAIR('m', 'o') },
        !            18:        { PAIR('d', 'y') },
        !            19:        { PAIR('d', 'w') },
        !            20:        { PAIR('l', 'n') },
        !            21:        { PAIR('d', 'l') },
        !            22:        { PAIR('s', 't') },
        !            23:        { PAIR('s', 'b') },
        !            24:        { PAIR('c', '.') },
        !            25:        { PAIR('$', '$') },
        !            26: };
        !            27: 
        !            28: 
        !            29: int    pto = 10000;
        !            30: int    pfrom = 1;
        !            31: int    print = 1;
        !            32: char   nextf[NS] = TMACDIR;
        !            33: char   mfiles[NMF][NS];
        !            34: int    nmfi = 0;
        !            35: int    oldbits = -1;
        !            36: int    init = 1;
        !            37: int    fc = IMP;       /* field character */
        !            38: int    eschar = '\\';
        !            39: int    pl;
        !            40: int    po;
        !            41: FILE   *ptid = stdout;
        !            42: 
        !            43: int    dfact = 1;
        !            44: int    dfactd = 1;
        !            45: int    res = 1;
        !            46: int    smnt = 0;       /* beginning of special fonts */
        !            47: int    ascii = 0;      /* ascii normally off for troff, on for nroff;  -a turns on */
        !            48: int    lg;
        !            49: int    pnlist[NPN] = { -1 };
        !            50: 
        !            51: 
        !            52: int    *pnp = pnlist;
        !            53: int    npn = 1;
        !            54: int    npnflg = 1;
        !            55: int    dpn = -1;
        !            56: int    totout = 1;
        !            57: int    ulfont = ULFONT;
        !            58: int    tabch = TAB;
        !            59: int    ldrch = LEADER;
        !            60: 
        !            61: 
        !            62: #define        C(a,b)  {a, 0, b, 0}
        !            63: Contab contab[NM] = {
        !            64:        C(PAIR('d', 's'), caseds),
        !            65:        C(PAIR('a', 's'), caseas),
        !            66:        C(PAIR('s', 'p'), casesp),
        !            67:        C(PAIR('f', 't'), caseft),
        !            68:        C(PAIR('p', 's'), caseps),
        !            69:        C(PAIR('v', 's'), casevs),
        !            70:        C(PAIR('n', 'r'), casenr),
        !            71:        C(PAIR('i', 'f'), caseif),
        !            72:        C(PAIR('i', 'e'), caseie),
        !            73:        C(PAIR('e', 'l'), caseel),
        !            74:        C(PAIR('p', 'o'), casepo),
        !            75:        C(PAIR('t', 'l'), casetl),
        !            76:        C(PAIR('t', 'm'), casetm),
        !            77:        C(PAIR('b', 'p'), casebp),
        !            78:        C(PAIR('c', 'h'), casech),
        !            79:        C(PAIR('p', 'n'), casepn),
        !            80:        C(PAIR('b', 'r'), tbreak),
        !            81:        C(PAIR('t', 'i'), caseti),
        !            82:        C(PAIR('n', 'e'), casene),
        !            83:        C(PAIR('n', 'f'), casenf),
        !            84:        C(PAIR('c', 'e'), casece),
        !            85:        C(PAIR('f', 'i'), casefi),
        !            86:        C(PAIR('i', 'n'), casein),
        !            87:        C(PAIR('l', 'l'), casell),
        !            88:        C(PAIR('n', 's'), casens),
        !            89:        C(PAIR('m', 'k'), casemk),
        !            90:        C(PAIR('r', 't'), casert),
        !            91:        C(PAIR('a', 'm'), caseam),
        !            92:        C(PAIR('d', 'e'), casede),
        !            93:        C(PAIR('d', 'i'), casedi),
        !            94:        C(PAIR('d', 'a'), caseda),
        !            95:        C(PAIR('w', 'h'), casewh),
        !            96:        C(PAIR('d', 't'), casedt),
        !            97:        C(PAIR('i', 't'), caseit),
        !            98:        C(PAIR('r', 'm'), caserm),
        !            99:        C(PAIR('r', 'r'), caserr),
        !           100:        C(PAIR('r', 'n'), casern),
        !           101:        C(PAIR('a', 'd'), casead),
        !           102:        C(PAIR('r', 's'), casers),
        !           103:        C(PAIR('n', 'a'), casena),
        !           104:        C(PAIR('p', 'l'), casepl),
        !           105:        C(PAIR('t', 'a'), caseta),
        !           106:        C(PAIR('t', 'r'), casetr),
        !           107:        C(PAIR('u', 'l'), caseul),
        !           108:        C(PAIR('c', 'u'), casecu),
        !           109:        C(PAIR('l', 't'), caselt),
        !           110:        C(PAIR('n', 'x'), casenx),
        !           111:        C(PAIR('s', 'o'), caseso),
        !           112:        C(PAIR('i', 'g'), caseig),
        !           113:        C(PAIR('t', 'c'), casetc),
        !           114:        C(PAIR('f', 'c'), casefc),
        !           115:        C(PAIR('e', 'c'), caseec),
        !           116:        C(PAIR('e', 'o'), caseeo),
        !           117:        C(PAIR('l', 'c'), caselc),
        !           118:        C(PAIR('e', 'v'), caseev),
        !           119:        C(PAIR('r', 'd'), caserd),
        !           120:        C(PAIR('a', 'b'), caseab),
        !           121:        C(PAIR('f', 'l'), casefl),
        !           122:        C(PAIR('e', 'x'), caseex),
        !           123:        C(PAIR('s', 's'), casess),
        !           124:        C(PAIR('f', 'p'), casefp),
        !           125:        C(PAIR('c', 's'), casecs),
        !           126:        C(PAIR('b', 'd'), casebd),
        !           127:        C(PAIR('l', 'g'), caselg),
        !           128:        C(PAIR('h', 'c'), casehc),
        !           129:        C(PAIR('h', 'y'), casehy),
        !           130:        C(PAIR('n', 'h'), casenh),
        !           131:        C(PAIR('n', 'm'), casenm),
        !           132:        C(PAIR('n', 'n'), casenn),
        !           133:        C(PAIR('s', 'v'), casesv),
        !           134:        C(PAIR('o', 's'), caseos),
        !           135:        C(PAIR('l', 's'), casels),
        !           136:        C(PAIR('c', 'c'), casecc),
        !           137:        C(PAIR('c', '2'), casec2),
        !           138:        C(PAIR('e', 'm'), caseem),
        !           139:        C(PAIR('a', 'f'), caseaf),
        !           140:        C(PAIR('h', 'a'), caseha),
        !           141:        C(PAIR('h', 'w'), casehw),
        !           142:        C(PAIR('m', 'c'), casemc),
        !           143:        C(PAIR('p', 'm'), casepm),
        !           144:        C(PAIR('p', 'i'), casepi),
        !           145:        C(PAIR('u', 'f'), caseuf),
        !           146:        C(PAIR('p', 'c'), casepc),
        !           147:        C(PAIR('h', 't'), caseht),
        !           148:        C(PAIR('c', 'f'), casecf),
        !           149:        C(PAIR('s', 'y'), casesy),
        !           150:        C(PAIR('l', 'f'), caself),
        !           151:        C(PAIR('p', 't'), casept),
        !           152: };
        !           153: 
        !           154: 
        !           155: Tchar oline[OLNSIZE];
        !           156: 
        !           157: /*
        !           158:  * troff environment block
        !           159:  */
        !           160: 
        !           161: Env env[NEV] = { {     /* this sets up env[0] */
        !           162: /* int ics      */     0,      /* insertion character space, set by .mc */
        !           163: /* int sps      */     0,
        !           164: /* int spacesz  */     0,
        !           165: /* int lss      */     0,
        !           166: /* int lss1     */     0,
        !           167: /* int ll       */     0,
        !           168: /* int ll1      */     0,
        !           169: /* int lt       */     0,
        !           170: /* int lt1      */     0,
        !           171: /* Tchar ic     */     0,      /* insertion character (= margin character) */
        !           172: /* int icf      */     0,      /* insertion character flag */
        !           173: /* Tchar chbits         */     0,      /* size+font bits for current character */
        !           174: /* Tchar spbits         */     0,
        !           175: /* Tchar nmbits         */     0,      /* size+font bits for number from .nm */
        !           176: /* int apts     */     PS,     /* actual point size -- as requested by user */
        !           177: /* int apts1    */     PS,     /* need not match an existent size */
        !           178: /* int pts      */     PS,     /* hence, this is the size that really exists */
        !           179: /* int pts1     */     PS,
        !           180: /* int font     */     FT,
        !           181: /* int font1    */     FT,
        !           182: /* int ls       */     1,
        !           183: /* int ls1      */     1,
        !           184: /* int ad       */     1,
        !           185: /* int nms      */     1,      /* .nm multiplier */
        !           186: /* int ndf      */     1,      /* .nm separator */
        !           187: /* int nmwid    */     3,      /* max width of .nm numbers */
        !           188: /* int fi       */     1,
        !           189: /* int cc       */     '.',
        !           190: /* int c2       */     '\'',
        !           191: /* int ohc      */     OHC,
        !           192: /* int tdelim   */     IMP,
        !           193: /* int hyf      */     1,
        !           194: /* int hyoff    */     0,
        !           195: /* int hyphalg  */     HYPHALG,
        !           196: /* int un1      */     -1,
        !           197: /* int tabc     */     0,
        !           198: /* int dotc     */     '.',
        !           199: /* int adsp     */     0,      /* add this much space to each padding point */
        !           200: /* int adrem    */     0,      /* excess space to add until it runs out */
        !           201: /* int lastl    */     0,      /* last text on current output line */
        !           202: /* int nel      */     0,      /* how much space left on current output line */
        !           203: /* int admod    */     0,      /* adjust mode */
        !           204: /* Tchar *wordp         */     0,
        !           205: /* int spflg    */     0,      /* probably to indicate space after punctuation needed */
        !           206: /* Tchar *linep         */     0,
        !           207: /* Tchar *wdend         */     0,
        !           208: /* Tchar *wdstart */   0,
        !           209: /* int wne      */     0,
        !           210: /* int ne       */     0,      /* how much space taken on current output line */
        !           211: /* int nc       */     0,      /* #characters (incl blank) on output line */
        !           212: /* int nb       */     0,
        !           213: /* int lnmod    */     0,      /* line number mode, set by .nm */
        !           214: /* int nwd      */     0,      /* number of words on current output line */
        !           215: /* int nn       */     0,      /* from .nn command */
        !           216: /* int ni       */     0,      /* indent of .nm numbers, probably */
        !           217: /* int ul       */     0,
        !           218: /* int cu       */     0,
        !           219: /* int ce       */     0,
        !           220: /* int in       */     0,      /* indent and previous value */
        !           221: /* int in1      */     0,
        !           222: /* int un       */     0,      /* unindent of left margin in some way */
        !           223: /* int wch      */     0,
        !           224: /* int pendt    */     0,
        !           225: /* Tchar *pendw         */     (Tchar *)0,
        !           226: /* int pendnf   */     0,
        !           227: /* int spread   */     0,
        !           228: /* int it       */     0,      /* input trap count */
        !           229: /* int itmac    */     0,
        !           230: /* int lnsize   */     LNSIZE,
        !           231: } };
        !           232: 
        !           233: Env    *envp   = env;  /* start off in env 0 */
        !           234: 
        !           235: 
        !           236: 
        !           237: Stack  *frame, *stk, *ejl;
        !           238: Stack  *nxf;
        !           239: 
        !           240: int    pipeflg;
        !           241: int    hflg;   /* used in nroff only */
        !           242: int    eqflg;  /* used in nroff only */
        !           243: 
        !           244: int    xpts;
        !           245: int    ppts;
        !           246: int    pfont;
        !           247: int    mpts;
        !           248: int    mfont;
        !           249: int    cs;
        !           250: int    ccs;
        !           251: int    bd;
        !           252: 
        !           253: int    stdi;
        !           254: int    quiet;
        !           255: int    stop;
        !           256: char   ibuf[IBUFSZ];
        !           257: char   xbuf[IBUFSZ];
        !           258: char   *ibufp;
        !           259: char   *xbufp;
        !           260: char   *eibuf;
        !           261: char   *xeibuf;
        !           262: Tchar  pbbuf[NC];              /* pushback buffer for arguments, \n, etc. */
        !           263: Tchar  *pbp = pbbuf;           /* next free slot in pbbuf */
        !           264: Tchar  *lastpbp = pbbuf;       /* pbp in previous stack frame */
        !           265: int    nx;
        !           266: int    mflg;
        !           267: Tchar  ch = 0;
        !           268: int    ibf;
        !           269: int    ifi;
        !           270: int    iflg;
        !           271: int    rargc;
        !           272: char   **argp;
        !           273: ushort trtab[NTRTAB];
        !           274: int    lgf;
        !           275: int    copyf;
        !           276: Offset ip;
        !           277: int    nlflg;
        !           278: int    donef;
        !           279: int    nflush;
        !           280: int    nfo;
        !           281: int    padc;
        !           282: int    raw;
        !           283: int    flss;
        !           284: int    nonumb;
        !           285: int    trap;
        !           286: int    tflg;
        !           287: int    ejf;
        !           288: int    dilev;
        !           289: Offset offset;
        !           290: int    em;
        !           291: int    ds;
        !           292: Offset woff;
        !           293: int    app;
        !           294: int    ndone;
        !           295: int    lead;
        !           296: int    ralss;
        !           297: Offset nextb;
        !           298: Tchar  nrbits;
        !           299: int    nform;
        !           300: int    oldmn;
        !           301: int    newmn;
        !           302: int    macerr;
        !           303: Offset apptr;
        !           304: int    diflg;
        !           305: int    evi;
        !           306: int    vflag;
        !           307: int    noscale;
        !           308: int    po1;
        !           309: int    nlist[NTRAP];
        !           310: int    mlist[NTRAP];
        !           311: int    evlist[EVLSZ];
        !           312: int    ev;
        !           313: int    tty;
        !           314: int    sfont   = FT;   /* appears to be "standard" font; used by .ul */
        !           315: int    sv;
        !           316: int    esc;
        !           317: int    widthp;
        !           318: int    xfont;
        !           319: int    setwdf;
        !           320: int    over;
        !           321: int    nhyp;
        !           322: Tchar  **hyp;
        !           323: Tchar  *olinep;
        !           324: int    dotT;
        !           325: char   *unlkp;
        !           326: Wcache widcache[NWIDCACHE];
        !           327: Diver  d[NDI];
        !           328: Diver  *dip;
        !           329: 
        !           330: 
        !           331: int    c_hyphen;
        !           332: int    c_emdash;
        !           333: int    c_rule;
        !           334: int    c_minus;
        !           335: int    c_fi;
        !           336: int    c_fl;
        !           337: int    c_ff;
        !           338: int    c_ffi;
        !           339: int    c_ffl;
        !           340: int    c_acute;
        !           341: int    c_grave;
        !           342: int    c_under;
        !           343: int    c_rooten;
        !           344: int    c_boxrule;
        !           345: int    c_lefthand;
        !           346: int    c_dagger;
        !           347: int    c_isalnum;
        !           348: 
        !           349: Spnames        spnames[] =
        !           350: {
        !           351:        &c_hyphen,      "hy",
        !           352:        &c_emdash,      "em",
        !           353:        &c_rule,        "ru",
        !           354:        &c_minus,       "\\-",
        !           355:        &c_fi,          "fi",
        !           356:        &c_fl,          "fl",
        !           357:        &c_ff,          "ff",
        !           358:        &c_ffi,         "Fi",
        !           359:        &c_ffl,         "Fl",
        !           360:        &c_acute,       "aa",
        !           361:        &c_grave,       "ga",
        !           362:        &c_under,       "ul",
        !           363:        &c_rooten,      "rn",
        !           364:        &c_boxrule,     "br",
        !           365:        &c_lefthand,    "lh",
        !           366:        &c_dagger,      "dg",   /* not in nroff?? */
        !           367:        &c_isalnum,     "__",
        !           368:        0, 0
        !           369: };
        !           370: 
        !           371: 
        !           372: Tchar  (*hmot)(void);
        !           373: Tchar  (*makem)(int i);
        !           374: Tchar  (*setabs)(void);
        !           375: Tchar  (*setch)(int c);
        !           376: Tchar  (*sethl)(int k);
        !           377: Tchar  (*setht)(void);
        !           378: Tchar  (*setslant)(void);
        !           379: Tchar  (*vmot)(void);
        !           380: Tchar  (*xlss)(void);
        !           381: int    (*findft)(int i);
        !           382: int    (*width)(Tchar j);
        !           383: void   (*mchbits)(void);
        !           384: void   (*ptlead)(void);
        !           385: void   (*ptout)(Tchar i);
        !           386: void   (*ptpause)(void);
        !           387: void   (*setfont)(int a);
        !           388: void   (*setps)(void);
        !           389: void   (*setwd)(void);

unix.superglobalmegacorp.com

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