text(){ register i; static int spcnt; nflush++; if((dip == d) && (v.nl == -1)){newline(1); return;} setnel(); if(ce || !fi){ nofill(); return; } if(pendw)goto t4; if(pendt)if(spcnt)goto t2; else goto t3; pendt++; if(spcnt)goto t2; while(((i = GETCH()) & CMASK) == ' ')spcnt++; if(nlflg){ t1: nflush = pendt = ch = spcnt = 0; callsp(); return; } ch = i; if(spcnt){ t2: tbreak(); if(nc || wch)goto rtn; un += spcnt*sps; spcnt = 0; setnel(); if(trap)goto rtn; if(nlflg)goto t1; } t3: if(spread)goto t5; if(pendw || !wch) t4: if(getword(0))goto t6; if(!movword())goto t3; t5: if(nlflg)pendt = 0; adsp = adrem = 0; if(ad){ /* jfr */ if (nwd==1) adsp=nel; else adsp=nel/(nwd-1); #ifdef NROFF adsp = (adsp/t.Adj)*t.Adj; #endif adrem = nel - adsp*(nwd-1); } brflg = 1; tbreak(); spread = 0; if(!trap)goto t3; if(!nlflg)goto rtn; t6: pendt = 0; ckul(); rtn: nflush = 0; }
int nofill() { int j; tchar i; if (!pendnf) { over = 0; tbreak(); if (trap) goto rtn; if (nlflg) { ch = nflush = 0; callsp(); return (0); } adsp = adrem = 0; nwd = 10000; } while ((j = (cbits(i = GETCH()))) != '\n') { if (j == ohc) continue; if (j == CONT) { pendnf++; nflush = 0; flushi(); ckul(); return (0); } j = width(i); widthp = j; numtab[HP].val += j; storeline(i, j); } if (ce) { ce--; if ((i = quant(nel / 2, HOR)) > 0) un += i; } if (!nc) storeline((tchar)FILLER, 0); brflg = 2; tbreak(); ckul(); rtn: pendnf = nflush = 0; return (0); }
void casebrp(void) { if (nc || pgchars) { spread = 2; flushi(); if (pgchars) tbreak(); else { pendt++; text(); } } else tbreak(); }
void caseti(void) { register int i; if (skip(1)) return; if ((pa || padj) && pglines == 0 && pgchars) tbreak(); i = max(hnumb(&in), 0); tbreak(); un1 = i; chkin(i, ll, "temporary "); setnel(); }
void casesp(int a) { register int i, j, savlss; tbreak(); if (dip->nls || trap) return; i = findt1(); if (!a) { skip(0); j = vnumb((int *)0); if (nonumb) j = lss; } else j = a; if (j == 0) return; if (i < j) j = i; savlss = lss; if (dip != d) i = dip->dnl; else i = numtab[NL].val; if ((i + j) < 0) j = -i; lss = j; newline(0); lss = savlss; }
void casefi(void) { tbreak(); fi++; pendnf = 0; }
casefi() { tbreak(); fi++; pendnf = 0; lnsize = LNSIZE; }
void casebp(void) { register int i; register struct s *savframe; if (dip != d) return; savframe = frame; if (skip(0)) i = -1; else { if ((i = inumb(&numtab[PN].val)) < 0) i = 0; if (nonumb) i = -1; } tbreak(); if (i >= 0) { npn = i; npnflg++; } else if (dip->nls && donef < 1) return; eject(savframe); }
void casecf(void) { /* copy file without change */ FILE *fd; char *eof, *p; extern int hpos, esc, po; /* this may not make much sense in nroff... */ lgf++; nextf[0] = 0; if (!skip() && getname()) { if (strncmp("<<", nextf, 2) != 0) { if ((fd = fopen(nextf, "r")) == NULL) { ERROR "can't open file %s", nextf WARN; done(02); } eof = (char *) NULL; } else { /* current file */ if (pbp > lastpbp || ip) { ERROR "casecf: not reading from file" WARN; done(02); } eof = &nextf[2]; if (!*eof) { ERROR "casecf: missing end of input token" WARN; done(02); } p = eof; while(*++p) ; *p++ = '\n'; *p = 0; fd = ifile; } } else { ERROR "casecf: no argument" WARN; lgf--; return; } lgf--; /* make it into a clean state, be sure that everything is out */ tbreak(); hpos = po; esc = 0; ptesc(); /* to left margin */ esc = un; ptesc(); ptlead(); ptps(); ptfont(); flusho(); cpout(fd, eof); ptps(); ptfont(); }
void done(int x) { register int i; error |= x; dl = app = ds = lgf = 0; if (pgchars && !pglines) { donep = 1; tbreak(); donep = 0; } if ((i = em)) { donef = -1; em = 0; if (control(i, 0)) longjmp(sjbuf, 1); } if (!nfo) done3(0); mflg = 0; dip = &d[0]; if (woff) wbt((tchar)0); if (pendw) getword(1); pendnf = 0; if (donef == 1) done1(0); donef = 1; ip = 0; frame = stk; nxf = calloc(1, sizeof *nxf); if (!ejf) tbreak(); nflush++; eject((struct s *)0); longjmp(sjbuf, 1); }
void casein(void) { register int i; if ((pa || padj) && pglines == 0 && pgchars) tbreak(); if (skip(0)) i = in1; else i = max(hnumb(&in), 0); tbreak(); in1 = in; in = i; chkin(in, ll, ""); if (!nc && !pgwords) { un = in; setnel(); } else if (pgwords) { pgflags[pgwords] |= PG_NEWIN; pgwdin[pgwords] = in; } }
nofill(){ register i, j; if(!pendnf){ over = 0; tbreak(); if(trap)goto rtn; if(nlflg){ ch = nflush = 0; callsp(); return; } adsp = adrem = 0; nwd = 10000; } while((j = ((i = GETCH()) & CMASK)) != '\n'){ if(j == ohc)continue; if(j == CONT){ pendnf++; nflush = 0; flushi(); ckul(); return; } storeline(i,-1); } if(ce){ ce--; if((i=quant(nel/2,HOR)) > 0)un += i; } if(!nc)storeline(FILLER,0); brflg = 2; tbreak(); ckul(); rtn: pendnf = nflush = 0; }
static void cerj(int dorj) { register int i; noscale++; skip(0); i = max(atoi(), 0); if (nonumb) i = 1; tbreak(); if (dorj) { rj = i; ce = 0; } else { ce = i; rj = 0; } noscale = 0; }
static void _brnl(int p) { int n; noscale++; if (skip(0)) n = INT_MAX; else { n = atoi(); if (nonumb || n < 0) n = p ? brpnl : brpnl; } noscale--; tbreak(); if (p) { brpnl = n; brnl = 0; } else { brnl = n; brpnl = 0; } }
void text(void) { Tchar i; static int spcnt; nflush++; numtabp[HP].val = 0; if ((dip == d) && (numtabp[NL].val == -1)) { newline(1); return; } setnel(); if (ce || !fi) { nofill(); return; } if (pendw) goto t4; if (pendt) if (spcnt) goto t2; else goto t3; pendt++; if (spcnt) goto t2; while ((cbits(i = GETCH())) == ' ') { spcnt++; numtabp[HP].val += sps; widthp = sps; } if (nlflg) { t1: nflush = pendt = ch = spcnt = 0; callsp(); return; } ch = i; if (spcnt) { t2: tbreak(); if (nc || wch) goto rtn; un += spcnt * sps; spcnt = 0; setnel(); if (trap) goto rtn; if (nlflg) goto t1; } t3: if (spread) goto t5; if (pendw || !wch) t4: if (getword(0)) goto t6; if (!movword()) goto t3; t5: if (nlflg) pendt = 0; adsp = adrem = 0; if (ad) { if (nwd == 1) adsp = nel; else adsp = nel / (nwd - 1); adsp = (adsp / HOR) * HOR; adrem = nel - adsp*(nwd-1); } brflg = 1; tbreak(); spread = 0; if (!trap) goto t3; if (!nlflg) goto rtn; t6: pendt = 0; ckul(); rtn: nflush = 0; }
void casenf(void) { tbreak(); fi = 0; }
casenf() { tbreak(); fi = 0; }
void casefl(void) { tbreak(); flusho(); }