Annotation of researchv9/cmd/troff/n7.c, revision 1.1

1.1     ! root        1: #include "tdef.h"
        !             2: #ifdef NROFF
        !             3: #include "tw.h"
        !             4: #endif
        !             5: #ifdef NROFF
        !             6: #define GETCH gettch
        !             7: tchar  gettch();
        !             8: #endif
        !             9: #ifndef NROFF
        !            10: #define GETCH getch
        !            11: #endif
        !            12: 
        !            13: /*
        !            14:  * troff7.c
        !            15:  * 
        !            16:  * text
        !            17:  */
        !            18: 
        !            19: #include <ctype.h>
        !            20: #include "ext.h"
        !            21: int    brflg;
        !            22: 
        !            23: tbreak()
        !            24: {
        !            25:        register pad, k;
        !            26:        register tchar  *i, j;
        !            27:        register int resol;
        !            28:        int un0 = un;
        !            29: 
        !            30:        trap = 0;
        !            31:        if (nb)
        !            32:                return;
        !            33:        if (dip == d && numtab[NL].val == -1) {
        !            34:                newline(1);
        !            35:                return;
        !            36:        }
        !            37:        if (!nc) {
        !            38:                setnel();
        !            39:                if (!wch)
        !            40:                        return;
        !            41:                if (pendw)
        !            42:                        getword(1);
        !            43:                movword();
        !            44:        } else if (pendw && !brflg) {
        !            45:                getword(1);
        !            46:                movword();
        !            47:        }
        !            48:        *linep = dip->nls = 0;
        !            49: #ifdef NROFF
        !            50:        if (dip == d)
        !            51:                horiz(po);
        !            52: #endif
        !            53:        if (lnmod)
        !            54:                donum();
        !            55:        lastl = ne;
        !            56:        if (brflg != 1) {
        !            57:                totout = 0;
        !            58:        } else if (ad) {
        !            59:                if ((lastl = ll - un) < ne)
        !            60:                        lastl = ne;
        !            61:        }
        !            62:        if (admod && ad && (brflg != 2)) {
        !            63:                lastl = ne;
        !            64:                adsp = adrem = 0;
        !            65:                if (admod == 1)
        !            66:                        un +=  quant(nel / 2, HOR);
        !            67:                else if (admod == 2)
        !            68:                        un += nel;
        !            69:        }
        !            70:        totout++;
        !            71:        brflg = 0;
        !            72:        if (lastl + un > dip->maxl)
        !            73:                dip->maxl = lastl + un;
        !            74:        horiz(un);
        !            75: #ifdef NROFF
        !            76:        if (adrem % t.Adj)
        !            77:                resol = t.Hor; 
        !            78:        else 
        !            79:                resol = t.Adj;
        !            80: #else
        !            81:        resol = HOR;
        !            82: #endif
        !            83:        lastl = ne + (nwd-1) * adsp + adrem;
        !            84:        for (i = line; nc > 0; ) {
        !            85:                if ((cbits(j = *i++)) == ' ') {
        !            86:                        pad = 0;
        !            87:                        do {
        !            88:                                pad += width(j);
        !            89:                                nc--;
        !            90:                        } while ((cbits(j = *i++)) == ' ');
        !            91:                        i--;
        !            92:                        pad += adsp;
        !            93:                        --nwd;
        !            94:                        if (adrem) {
        !            95:                                if (adrem < 0) {
        !            96:                                        pad -= resol;
        !            97:                                        adrem += resol;
        !            98:                                } else if ((totout & 01) || adrem / resol >= nwd) {
        !            99:                                        pad += resol;
        !           100:                                        adrem -= resol;
        !           101:                                }
        !           102:                        }
        !           103:                        pchar((tchar) WORDSP);
        !           104:                        horiz(pad);
        !           105:                } else {
        !           106:                        pchar(j);
        !           107:                        nc--;
        !           108:                }
        !           109:        }
        !           110:        if (ic) {
        !           111:                if ((k = ll - un0 - lastl + ics) > 0)
        !           112:                        horiz(k);
        !           113:                pchar(ic);
        !           114:        }
        !           115:        if (icf)
        !           116:                icf++;
        !           117:        else 
        !           118:                ic = 0;
        !           119:        ne = nwd = 0;
        !           120:        un = in;
        !           121:        setnel();
        !           122:        newline(0);
        !           123:        if (dip != d) {
        !           124:                if (dip->dnl > dip->hnl)
        !           125:                        dip->hnl = dip->dnl;
        !           126:        } else {
        !           127:                if (numtab[NL].val > dip->hnl)
        !           128:                        dip->hnl = numtab[NL].val;
        !           129:        }
        !           130:        for (k = ls - 1; k > 0 && !trap; k--)
        !           131:                newline(0);
        !           132:        spread = 0;
        !           133: }
        !           134: 
        !           135: donum()
        !           136: {
        !           137:        register i, nw;
        !           138:        extern pchar();
        !           139: 
        !           140:        nrbits = nmbits;
        !           141:        nw = width('1' | nrbits);
        !           142:        if (nn) {
        !           143:                nn--;
        !           144:                goto d1;
        !           145:        }
        !           146:        if (numtab[LN].val % ndf) {
        !           147:                numtab[LN].val++;
        !           148: d1:
        !           149:                un += nw * (3 + nms + ni);
        !           150:                return;
        !           151:        }
        !           152:        i = 0;
        !           153:        if (numtab[LN].val < 100)
        !           154:                i++;
        !           155:        if (numtab[LN].val < 10)
        !           156:                i++;
        !           157:        horiz(nw * (ni + i));
        !           158:        nform = 0;
        !           159:        fnumb(numtab[LN].val, pchar);
        !           160:        un += nw * nms;
        !           161:        numtab[LN].val++;
        !           162: }
        !           163: 
        !           164: 
        !           165: text()
        !           166: {
        !           167:        register tchar i;
        !           168:        static int      spcnt;
        !           169: 
        !           170:        nflush++;
        !           171:        numtab[HP].val = 0;
        !           172:        if ((dip == d) && (numtab[NL].val == -1)) {
        !           173:                newline(1)        !           174:                return;
        !           175:        }
        !           176:        setnel();
        !           177:        if (ce || !fi) {
        !           178:                nofill();
        !           179:                return;
        !           180:        }
        !           181:        if (pendw)
        !           182:                goto t4;
        !           183:        if (pendt)
        !           184:                if (spcnt)
        !           185:                        goto t2; 
        !           186:                else 
        !           187:                        goto t3;
        !           188:        pendt++;
        !           189:        if (spcnt)
        !           190:                goto t2;
        !           191:        while ((cbits(i = GETCH())) == ' ') {
        !           192:                spcnt++;
        !           193:                numtab[HP].val += sps;
        !           194:                widthp = sps;
        !           195:        }
        !           196:        if (nlflg) {
        !           197: t1:
        !           198:                nflush = pendt = ch = spcnt = 0;
        !           199:                callsp();
        !           200:                return;
        !           201:        }
        !           202:        ch = i;
        !           203:        if (spcnt) {
        !           204: t2:
        !           205:                tbreak();
        !           206:                if (nc || wch)
        !           207:                        goto rtn;
        !           208:                un += spcnt * sps;
        !           209:                spcnt = 0;
        !           210:                setnel();
        !           211:                if (trap)
        !           212:                        goto rtn;
        !           213:                if (nlflg)
        !           214:                        goto t1;
        !           215:        }
        !           216: t3:
        !           217:        if (spread)
        !           218:                goto t5;
        !           219:        if (pendw || !wch)
        !           220: t4:
        !           221:                if (getword(0))
        !           222:                        goto t6;
        !           223:        if (!movword())
        !           224:                goto t3;
        !           225: t5:
        !           226:        if (nlflg)
        !           227:                pendt = 0;
        !           228:        adsp = adrem = 0;
        !           229:        if (ad) {
        !           230:                if (nwd == 1)
        !           231:                        adsp = nel; 
        !           232:                else 
        !           233:                        adsp = nel / (nwd - 1);
        !           234:                adsp = (adsp / HOR) * HOR;
        !           235:                adrem = nel - adsp*(nwd-1);
        !           236:        }
        !           237:        brflg = 1;
        !           238:        tbreak();
        !           239:        spread = 0;
        !           240:        if (!trap)
        !           241:                goto t3;
        !           242:        if (!nlflg)
        !           243:                goto rtn;
        !           244: t6:
        !           245:        pendt = 0;
        !           246:        ckul();
        !           247: rtn:
        !           248:        nflush = 0;
        !           249: }
        !           250: 
        !           251: 
        !           252: nofill()
        !           253: {
        !           254:        register j;
        !           255:        register tchar i;
        !           256: 
        !           257:        if (!pendnf) {
        !           258:                over = 0;
        !           259:                tbreak();
        !           260:                if (trap)
        !           261:                        goto rtn;
        !           262:                if (nlflg) {
        !           263:                        ch = nflush = 0;
        !           264:                        callsp();
        !           265:                        return;
        !           266:                }
        !           267:                adsp = adrem = 0;
        !           268:                nwd = 10000;
        !           269:        }
        !           270:        while ((j = (cbits(i = GETCH()))) != '\n') {
        !           271:                if (j == ohc)
        !           272:                        continue;
        !           273:                if (j == CONT) {
        !           274:                        pendnf++;
        !           275:                        nflush = 0;
        !           276:                        flushi();
        !           277:                        ckul();
        !           278:                        return;
        !           279:                }
        !           280:                j = width(i);
        !           281:                widthp = j;
        !           282:                numtab[HP].val += j;
        !           283:                storeline(i, j);
        !           284:        }
        !           285:        if (ce) {
        !           286:                ce--;
        !           287:                if ((i = quant(nel / 2, HOR)) > 0)
        !           288:                        un += i;
        !           289:        }
        !           290:        if (!nc)
        !           291:                storeline((tchar)FILLER, 0);
        !           292:        brflg = 2;
        !           293:        tbreak();
        !           294:        ckul();
        !           295: rtn:
        !           296:        pendnf = nflush = 0;
        !           297: }
        !           298: 
        !           299: 
        !           300: callsp()
        !           301: {
        !           302:        register i;
        !           303: 
        !           304:        if (flss)
        !           305:                i = flss; 
        !           306:        else 
        !           307:                i = lss;
        !           308:        flss = 0;
        !           309:        casesp(i);
        !           310: }
        !           311: 
        !           312: 
        !           313: ckul()
        !           314: {
        !           315:        if (ul && (--ul == 0)) {
        !           316:                cu = 0;
        !           317:                font = sfont;
        !           318:                mchbits();
        !           319:        }
        !           320:        if (it && (--it == 0) && itmac)
        !           321:                control(itmac, 0);
        !           322: }
        !           323: 
        !           324: 
        !           325: storeline(c, w)
        !           326: register tchar c;
        !           327: {
        !           328:        if (linep >= line + lnsize - 2) {
        !           329:                if (!over) {
        !           330:                        flusho();
        !           331:                        errprint("Line overflow.");
        !           332:                        over++;
        !           333:                        c = LEFTHAND;
        !           334:                        w = -1;
        !           335:                        *linep++ = c;
        !           336:                        *linep++ = '\n'; nc++;  /* other one comes later */
        !           337:                        goto s1;
        !           338:                }
        !           339:                return;
        !           340:        }
        !           341:        *linep++ = c;
        !           342: s1:
        !           343:        if (w == -1)
        !           344:                w = width(c);
        !           345:        ne += w;
        !           346:        nel -= w;
        !           347:        nc++;
        !           348: }
        !           349: 
        !           350: 
        !           351: newline(a)
        !           352: int    a;
        !           353: {
        !           354:        register i, j, nlss;
        !           355:        int     opn;
        !           356: 
        !           357:        if (a)
        !           358:                goto nl1;
        !           359:        if (dip != d) {
        !           360:                j = lss;
        !           361:                pchar1((tchar)FLSS);
        !           362:                if (flss)
        !           363:                        lss = flss;
        !           364:                i = lss + dip->blss;
        !           365:                dip->dnl += i;
        !           366:                pchar1((tchar)i);
        !           367:                pchar1((tchar)'\n');
        !           368:                lss = j;
        !           369:                dip->blss = flss = 0;
        !           370:                if (dip->alss) {
        !           371:                        pchar1((tchar)FLSS);
        !           372:                        pchar1((tchar)dip->alss);
        !           373:                        pchar1((tchar)'\n');
        !           374:                        dip->dnl += dip->alss;
        !           375:                        dip->alss = 0;
        !           376:                }
        !           377:                if (dip->ditrap && !dip->ditf && dip->dnl >= dip->ditrap && dip->dimac)
        !           378:                        if (control(dip->dimac, 0)) {
        !           379:                                trap++; 
        !           380:                                dip->ditf++;
        !           381:                        }
        !           382:                return;
        !           383:        }
        !           384:        j = lss;
        !           385:        if (flss)
        !           386:                lss = flss;
        !           387:        nlss = dip->alss + dip->blss + lss;
        !           388:        numtab[NL].val += nlss;
        !           389: #ifndef NROFF
        !           390:        if (ascii) {
        !           391:                dip->alss = dip->blss = 0;
        !           392:        }
        !           393: #endif
        !           394:        pchar1((tchar)'\n');
        !           395:        flss = 0;
        !           396:        lss = j;
        !           397:        if (numtab[NL].val < pl)
        !           398:                goto nl2;
        !           399: nl1:
        !           400:        ejf = dip->hnl = numtab[NL].val = 0;
        !           401:        ejl = frame;
        !           402:        if (donef) {
        !           403:                if ((!nc && !wch) || ndone)
        !           404:                        done1(0);
        !           405:                ndone++;
        !           406:                donef = 0;
        !           407:                if (frame == stk)
        !           408:                        nflush++;
        !           409:        }
        !           410:        opn = numtab[PN].val;
        !           411:        numtab[PN].val++;
        !           412:        if (npnflg) {
        !           413:                numtab[PN].val = npn;
        !           414:                npn = npnflg = 0;
        !           415:        }
        !           416: nlpn:
        !           417:        if (numtab[PN].val == pfrom) {
        !           418:                print++;
        !           419:                pfrom = -1;
        !           420:        } else if (opn == pto) {
        !           421:                print = 0;
        !           422:                opn = -1;
        !           423:                chkpn();
        !           424:                goto nlpn;
        !           425:        }
        !           426:        if (print)
        !           427:                newpage(numtab[PN].val);        /* supposedly in a clean state so can pause */
        !           428:        if (stop && print) {
        !           429:                dpn++;
        !           430:                if (dpn >= stop) {
        !           431:                        dpn = 0;
        !           432:                        dostop();
        !           433:                }
        !           434:        }
        !           435: nl2:
        !           436:        trap = 0;
        !           437:        if (numtab[NL].val == 0) {
        !           438:                if ((j = findn(0)) != NTRAP)
        !           439:                        trap = control(mlist[j], 0);
        !           440:        } else if ((i = findt(numtab[NL].val - nlss)) <= nlss) {
        !           441:                if ((j = findn1(numtab[NL].val - nlss + i)) == NTRAP) {
        !           442:                        flusho();
        !           443:                        errprint("Trap botch.");
        !           444:                        done2(-5);
        !           445:                }
        !           446:                trap = control(mlist[j], 0);
        !           447:        }
        !           448: }
        !           449: 
        !           450: 
        !           451: findn1(a)
        !           452: int    a;
        !           453: {
        !           454:        register i, j;
        !           455: 
        !           456:        for (i = 0; i < NTRAP; i++) {
        !           457:                if (mlist[i]) {
        !           458:                        if ((j = nlist[i]) < 0)
        !           459:                                j += pl;
        !           460:                        if (j == a)
        !           461:                                break;
        !           462:                }
        !           463:        }
        !           464:        return(i);
        !           465: }
        !           466: 
        !           467: 
        !           468: chkpn()
        !           469: {
        !           470:        pto = *(pnp++);
        !           471:        pfrom = pto>=0 ? pto : -pto;
        !           472:        if (pto == -32767) {
        !           473:                flusho();
        !           474:                done1(0);
        !           475:        }
        !           476:        if (pto < 0) {
        !           477:                pto = -pto;
        !           478:                print++;
        !           479:                pfrom = 0;
        !           480:        }
        !           481: }
        !           482: 
        !           483: 
        !           484: findt(a)
        !           485: int    a;
        !           486: {
        !           487:        register i, j, k;
        !           488: 
        !           489:        k = 32767;
        !           490:        if (dip != d) {
        !           491:                if (dip->dimac && (i = dip->ditrap - a) > 0)
        !           492:                        k = i;
        !           493:                return(k);
        !           494:        }
        !           495:        for (i = 0; i < NTRAP; i++) {
        !           496:                if (mlist[i]) {
        !           497:                        if ((j = nlist[i]) < 0)
        !           498:                                j += pl;
        !           499:                        if ((j -= a) <= 0)
        !           500:                                continue;
        !           501:                        if (j < k)
        !           502:                                k = j;
        !           503:                }
        !           504:        }
        !           505:        i = pl - a;
        !           506:        if (k > i)
        !           507:                k = i;
        !           508:        return(k);
        !           509: }
        !           510: 
        !           511: 
        !           512: findt1()
        !           513: {
        !           514:        register i;
        !           515: 
        !           516:        if (dip != d)
        !           517:                i = dip->dnl;
        !           518:        else 
        !           519:                i = numtab[NL].val;
        !           520:        return(findt(i));
        !           521: }
        !           522: 
        !           523: 
        !           524: eject(a)
        !           525: struct s *a;
        !           526: {
        !           527:        register savlss;
        !           528: 
        !           529:        if (dip != d)
        !           530:                return;
        !           531:        ejf++;
        !           532:        if (a)
        !           533:                ejl = a;
        !           534:        else 
        !           535:                ejl = frame;
        !           536:        if (trap)
        !           537:                return;
        !           538: e1:
        !           539:        savlss = lss;
        !           540:        lss = findt(numtab[NL].val);
        !           541:        newline(0);
        !           542:        lss = savlss;
        !           543:        if (numtab[NL].val && !trap)
        !           544:                goto e1;
        !           545: }
        !           546: 
        !           547: 
        !           548: movword()
        !           549: {
        !           550:        register w;
        !           551:        register tchar i, *wp;
        !           552:        int     savwch, hys;
        !           553: 
        !           554:        over = 0;
        !           555:        wp = wordp;
        !           556:        if (!nwd) {
        !           557:                while (cbits(*wp++) == ' ') {
        !           558:                        wch--;
        !           559:                        wne -= sps;
        !           560:                }
        !           561:                wp--;
        !           562:        }
        !           563:        if (wne > nel && !hyoff && hyf && (!nwd || nel > 3 * sps) &&
        !           564:           (!(hyf & 02) || (findt1() > lss)))
        !           565:                hyphen(wp);
        !           566:        savwch = wch;
        !           567:        hyp = hyptr;
        !           568:        nhyp = 0;
        !           569:        while (*hyp && *hyp <= wp)
        !           570:                hyp++;
        !           571:        while (wch) {
        !           572:                if (hyoff != 1 && *hyp == wp) {
        !           573:                        hyp++;
        !           574:                        if (!wdstart || (wp > wdstart + 1 && wp < wdend &&
        !           575:                           (!(hyf & 04) || wp < wdend - 1) &&           /* 04 => last 2 */
        !           576:                           (!(hyf & 010) || wp > wdstart + 2))) {       /* 010 => 1st 2 */
        !           577:                                nhyp++;
        !           578:                                storeline((tchar)IMP, 0);
        !           579:                        }
        !           580:                }
        !           581:                i = *wp++;
        !           582:                w = width(i);
        !           583:                wne -= w;
        !           584:                wch--;
        !           585:                storeline(i, w);
        !           586:        }
        !           587:        if (nel >= 0) {
        !           588:                nwd++;
        !           589:                return(0);      /* line didn't fill up */
        !           590:        }
        !           591: #ifndef NROFF
        !           592:        xbits((tchar)HYPHEN, 1);
        !           593: #endif
        !           594:        hys = width((tchar)HYPHEN);
        !           595: m1:
        !           596:        if (!nhyp) {
        !           597:                if (!nwd)
        !           598:                        goto m3;
        !           599:                if (wch == savwch)
        !           600:                        goto m4;
        !           601:        }
        !           602:        if (*--linep != IMP)
        !           603:                goto m5;
        !           604:        if (!(--nhyp))
        !           605:                if (!nwd)
        !           606:                        goto m2;
        !           607:        if (nel < hys) {
        !           608:                nc--;
        !           609:                goto m1;
        !           610:        }
        !           611: m2:
        !           612:        if ((i = cbits(*(linep - 1))) != '-' && i != EMDASH) {
        !           613:                *linep = (*(linep - 1) & SFMASK) | HYPHEN;
        !           614:                w = width(*linep);
        !           615:                nel -= w;
        !           616:                ne += w;
        !           617:                linep++;
        !           618:        }
        !           619: m3:
        !           620:        nwd++;
        !           621: m4:
        !           622:        wordp = wp;
        !           623:        return(1);      /* line filled up */
        !           624: m5:
        !           625:        nc--;
        !           626:        w = width(*linep);
        !           627:        ne -= w;
        !           628:        nel += w;
        !           629:        wne += w;
        !           630:        wch++;
        !           631:        wp--;
        !           632:        goto m1;
        !           633: }
        !           634: 
        !           635: 
        !           636: horiz(i)
        !           637: int    i;
        !           638: {
        !           639:        vflag = 0;
        !           640:        if (i)
        !           641:                pchar(makem(i));
        !           642: }
        !           643: 
        !           644: 
        !           645: setnel()
        !           646: {
        !           647:        if (!nc) {
        !           648:                linep = line;
        !           649:                if (un1 >= 0) {
        !           650:                        un = un1;
        !           651:                        un1 = -1;
        !           652:                }
        !           653:                nel = ll - un;
        !           654:                ne = adsp = adrem = 0;
        !           655:        }
        !           656: }
        !           657: 
        !           658: 
        !           659: getword(x)
        !           660: int    x;
        !           661: {
        !           662:        register int j, k;
        !           663:        register tchar i, *wp;
        !           664:        int noword;
        !           665: 
        !           666:        noword = 0;
        !           667:        if (x)
        !           668:                if (pendw) {
        !           669:                        *pendw = 0;
        !           670:                        goto rtn;
        !           671:                }
        !           672:        if (wordp = pendw)
        !           673:                goto g1;
        !           674:        hyp = hyptr;
        !           675:        wordp = word;
        !           676:        over = wne = wch = 0;
        !           677:        hyoff = 0;
        !           678:        while (1) {     /* picks up 1st char of word */
        !           679:                j = cbits(i = GETCH());
        !           680:                if (j == '\n') {
        !           681:                        wne = wch = 0;
        !           682:                        noword = 1;
        !           683:                        goto rtn;
        !           684:                }
        !           685:                if (j == ohc) {
        !           686:                        hyoff = 1;      /* 1 => don't hyphenate */
        !           687:                        continue;
        !           688:                }
        !           689:                if (j == ' ') {
        !           690:                        numtab[HP].val += sps;
        !           691:                        widthp = sps;
        !           692:                        storeword(i, sps);
        !           693:                        continue;
        !           694:                }
        !           695:                break;
        !           696:        }
        !           697:        storeword(' ' | chbits, sps);
        !           698:        if (spflg) {
        !           699:                storeword(' ' | chbits, sps);
        !           700:                spflg = 0;
        !           701:        }
        !           702: g0:
        !           703:        if (j == CONT) {
        !           704:                pendw = wordp;
        !           705:                nflush = 0;
        !           706:                flushi();
        !           707:                return(1);
        !           708:        }
        !           709:        if (hyoff != 1) {
        !           710:                if (j == ohc) {
        !           711:                        hyoff = 2;
        !           712:                        *hyp++ = wordp;
        !           713:                        if (hyp > (hyptr + NHYP - 1))
        !           714:                                hyp = hyptr + NHYP - 1;
        !           715:                        goto g1;
        !           716:                }
        !           717:                if (j == '-' || j == EMDASH)
        !           718:                        if (wordp > word + 1) {
        !           719:                                hyoff = 2;
        !           720:                                *hyp++ = wordp + 1;
        !           721:                                if (hyp > (hyptr + NHYP - 1))
        !           722:                                        hyp = hyptr + NHYP - 1;
        !           723:                        }
        !           724:        }
        !           725:        j = width(i);
        !           726:        numtab[HP].val += j;
        !           727:        storeword(i, j);
        !           728: g1:
        !           729:        j = cbits(i = GETCH());
        !           730:        if (j != ' ') {
        !           731:                static char *sentchar = ".?!";  /* sentence terminators */
        !           732:                if (j != '\n')
        !           733:                        goto g0;
        !           734:                wp = wordp-1;   /* handle extra space at end of sentence */
        !           735:                while (wp >= word) {
        !           736:                        j = cbits(*wp--);
        !           737:                        if (j=='"' || j=='\'' || j==')' || j==']' || j=='*' || j==DAGGER)
        !           738:                                continue;
        !           739:                        for (k = 0; sentchar[k]; k++)
        !           740:                                if (j == sentchar[k]) {
        !           741:                                        spflg++;
        !           742:                                        break;
        !           743:                                }
        !           744:                        break;
        !           745:                }
        !           746:        }
        !           747:        *wordp = 0;
        !           748:        numtab[HP].val += sps;
        !           749: rtn:
        !           750:        for (wp = word; *wp; wp++) {
        !           751:                j = cbits(*wp);
        !           752:                if (j == ' ')
        !           753:                        continue;
        !           754:                if (!isdigit(j) && j != '-')
        !           755:                        break;
        !           756:        }
        !           757:        if (*wp == 0)   /* all numbers, so don't hyphenate */
        !           758:                hyoff = 1;
        !           759:        wdstart = 0;
        !           760:        wordp = word;
        !           761:        pendw = 0;
        !           762:        *hyp++ = 0;
        !           763:        setnel();
        !           764:        return(noword);
        !           765: }
        !           766: 
        !           767: 
        !           768: storeword(c, w)
        !           769: register tchar c;
        !           770: register int   w;
        !           771: {
        !           772: 
        !           773:        if (wordp >= &word[WDSIZE - 3]) {
        !           774:                if (!over) {
        !           775:                        flusho();
        !           776:                        errprint("Word overflow.");
        !           777:                        over++;
        !           778:                        c = LEFTHAND;
        !           779:                        w = -1;
        !           780:                        goto s1;
        !           781:                }
        !           782:                return;
        !           783:        }
        !           784: s1:
        !           785:        if (w == -1)
        !           786:                w = width(c);
        !           787:        widthp = w;
        !           788:        wne += w;
        !           789:        *wordp++ = c;
        !           790:        wch++;
        !           791: }
        !           792: 
        !           793: 
        !           794: #ifdef NROFF
        !           795: tchar
        !           796: gettch()
        !           797: {
        !           798:        extern int c_isalnum;
        !           799:        tchar i;
        !           800:        int j;
        !           801: 
        !           802:        i = getch();
        !           803:        j = cbits(i);
        !           804:        if (ismot(i) || fbits(i) != ulfont)
        !           805:                return(i);
        !           806:        if (cu) {
        !           807:                if (trtab[j] == ' ') {
        !           808:                        setcbits(i, '_');
        !           809:                        setfbits(i, FT);        /* default */
        !           810:                }
        !           811:                return(i);
        !           812:        }
        !           813:        /* should test here for characters that ought to be underlined */
        !           814:        /* in the old nroff, that was the 200 bit on the width! */
        !           815:        /* for now, just do letters, digits and certain special chars */
        !           816:        if (j <= 127) {
        !           817:                if (!isalnum(j))
        !           818:                        setfbits(i, FT);
        !           819:        } else {
        !           820:                if (j < c_isalnum)
        !           821:                        setfbits(i, FT);
        !           822:        }
        !           823:        return(i);
        !           824: }
        !           825: 
        !           826: 
        !           827: #endif

unix.superglobalmegacorp.com

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