diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/tbl | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/tbl')
-rw-r--r-- | src/cmd/tbl/t1.c | 6 | ||||
-rw-r--r-- | src/cmd/tbl/t2.c | 2 | ||||
-rw-r--r-- | src/cmd/tbl/t3.c | 10 | ||||
-rw-r--r-- | src/cmd/tbl/t4.c | 136 | ||||
-rw-r--r-- | src/cmd/tbl/t5.c | 42 | ||||
-rw-r--r-- | src/cmd/tbl/t6.c | 38 | ||||
-rw-r--r-- | src/cmd/tbl/t7.c | 16 | ||||
-rw-r--r-- | src/cmd/tbl/t8.c | 52 | ||||
-rw-r--r-- | src/cmd/tbl/t9.c | 16 | ||||
-rw-r--r-- | src/cmd/tbl/tb.c | 12 | ||||
-rw-r--r-- | src/cmd/tbl/tc.c | 10 | ||||
-rw-r--r-- | src/cmd/tbl/te.c | 2 | ||||
-rw-r--r-- | src/cmd/tbl/tf.c | 2 | ||||
-rw-r--r-- | src/cmd/tbl/tg.c | 16 | ||||
-rw-r--r-- | src/cmd/tbl/ti.c | 22 | ||||
-rw-r--r-- | src/cmd/tbl/tm.c | 8 | ||||
-rw-r--r-- | src/cmd/tbl/tr.c | 2 | ||||
-rw-r--r-- | src/cmd/tbl/ts.c | 4 | ||||
-rw-r--r-- | src/cmd/tbl/tt.c | 22 | ||||
-rw-r--r-- | src/cmd/tbl/tu.c | 78 | ||||
-rw-r--r-- | src/cmd/tbl/tv.c | 70 |
21 files changed, 263 insertions, 303 deletions
diff --git a/src/cmd/tbl/t1.c b/src/cmd/tbl/t1.c index 1e6cbf11..6cb7ada1 100644 --- a/src/cmd/tbl/t1.c +++ b/src/cmd/tbl/t1.c @@ -41,7 +41,7 @@ setinp(int argc, char **argv) { sargc = argc; sargv = argv; - sargc--; + sargc--; sargv++; if (sargc > 0) swapin(); @@ -69,10 +69,10 @@ swapin(void) pr1403 = 1; if (match("-", *sargv)) break; - sargc--; + sargc--; sargv++; } - if (sargc <= 0) + if (sargc <= 0) return(0); /* file closing is done by GCOS troff preprocessor */ if(tabin) diff --git a/src/cmd/tbl/t2.c b/src/cmd/tbl/t2.c index 6d2d7414..c3ecce7d 100644 --- a/src/cmd/tbl/t2.c +++ b/src/cmd/tbl/t2.c @@ -21,5 +21,3 @@ tableput(void) freearr(); restline(); } - - diff --git a/src/cmd/tbl/t3.c b/src/cmd/tbl/t3.c index a4dc9f9f..f2f81309 100644 --- a/src/cmd/tbl/t3.c +++ b/src/cmd/tbl/t3.c @@ -1,7 +1,7 @@ /* t3.c: interpret commands affecting whole table */ # include "t.h" struct optstr { - char *optnam; + char *optnam; int *optadd; } options [] = { "expand", &expflg, @@ -46,7 +46,7 @@ getcomm(void) return; } for (cp = line; (c = *cp) != ';'; cp++) { - if (!letter(c)) + if (!letter(c)) continue; found = 0; for (lp = options; lp->optadd; lp++) { @@ -61,9 +61,9 @@ getcomm(void) if ( *cp == '(') while ((ci = *++cp) != ')') *t++ = ci; - else + else cp--; - *t++ = 0; + *t++ = 0; *t = 0; if (lp->optadd == &tab) { if (nb[0]) @@ -100,5 +100,3 @@ backrest(char *cp) un1getc(*--s); return; } - - diff --git a/src/cmd/tbl/t4.c b/src/cmd/tbl/t4.c index 558d3ba3..21fd82c6 100644 --- a/src/cmd/tbl/t4.c +++ b/src/cmd/tbl/t4.c @@ -53,13 +53,13 @@ readspec(void) case ' ': /* note this is also case tab */ continue; case '\n': - if (sawchar == 0) + if (sawchar == 0) continue; case ',': case '.': /* end of table specification */ ncol = max(ncol, icol); if (lefline[ncol][nclin] > 0) { - ncol++; + ncol++; rightl++; }; if (sawchar) @@ -85,24 +85,24 @@ readspec(void) } sawchar = 0; continue; - case 'C': - case 'S': - case 'R': - case 'N': - case 'L': + case 'C': + case 'S': + case 'R': + case 'N': + case 'L': case 'A': c += ('a' - 'A'); - case '_': - if (c == '_') + case '_': + if (c == '_') c = '-'; - case '=': + case '=': case '-': case '^': - case 'c': - case 's': - case 'n': - case 'r': - case 'l': + case 'c': + case 's': + case 'n': + case 'r': + case 'l': case 'a': style[icol][nclin] = c; if (c == 's' && icol <= 0) @@ -122,30 +122,30 @@ readspec(void) error("too many columns in table"); sawchar = 1; continue; - case 'b': + case 'b': case 'i': c += 'A' - 'a'; - case 'B': + case 'B': case 'I': - if (icol == 0) + if (icol == 0) continue; snp = font[icol-1][nclin]; snp[0] = (c == 'I' ? '2' : '3'); snp[1] = 0; continue; - case 't': + case 't': case 'T': if (icol > 0) flags[icol-1][nclin] |= CTOP; continue; - case 'd': + case 'd': case 'D': if (icol > 0) flags[icol-1][nclin] |= CDOWN; continue; - case 'f': + case 'f': case 'F': - if (icol == 0) + if (icol == 0) continue; snp = font[icol-1][nclin]; snp[0] = snp[1] = stopc = 0; @@ -155,34 +155,34 @@ readspec(void) stopc = ')'; c = get1char(); } - if (c == 0) + if (c == 0) break; if (c == stopc) { - stopc = 0; + stopc = 0; break; } - if (stopc == 0) - if (c == ' ' || c == tab ) + if (stopc == 0) + if (c == ' ' || c == tab ) break; if (c == '\n' || c == '|') { - un1getc(c); + un1getc(c); break; } snp[i] = c; - if (c >= '0' && c <= '9') + if (c >= '0' && c <= '9') break; } - if (stopc) + if (stopc) if (get1char() != stopc) error("Nonterminated font name"); continue; - case 'P': + case 'P': case 'p': - if (icol <= 0) + if (icol <= 0) continue; temp = snp = csize[icol-1][nclin]; while (c = get1char()) { - if (c == ' ' || c == tab || c == '\n') + if (c == ' ' || c == tab || c == '\n') break; if (c == '-' || c == '+') if (snp > temp) @@ -191,7 +191,7 @@ readspec(void) *snp++ = c; else if (digit(c)) *snp++ = c; - else + else break; if (snp - temp > 4) error("point size too large"); @@ -201,13 +201,13 @@ readspec(void) error("point size unreasonable"); un1getc (c); continue; - case 'V': + case 'V': case 'v': - if (icol <= 0) + if (icol <= 0) continue; temp = snp = vsize[icol-1][nclin]; while (c = get1char()) { - if (c == ' ' || c == tab || c == '\n') + if (c == ' ' || c == tab || c == '\n') break; if (c == '-' || c == '+') if (snp > temp) @@ -216,7 +216,7 @@ readspec(void) *snp++ = c; else if (digit(c)) *snp++ = c; - else + else break; if (snp - temp > 4) error("vertical spacing value too large"); @@ -224,7 +224,7 @@ readspec(void) *snp = 0; un1getc(c); continue; - case 'w': + case 'w': case 'W': snp = cll [icol-1]; /* Dale Smith didn't like this check - possible to have two text blocks @@ -253,34 +253,34 @@ readspec(void) if (!stopc) un1getc(c); continue; - case 'e': + case 'e': case 'E': - if (icol < 1) + if (icol < 1) continue; evenup[icol-1] = 1; evenflg = 1; continue; - case 'z': + case 'z': case 'Z': /* zero width-ignre width this item */ - if (icol < 1) + if (icol < 1) continue; flags[icol-1][nclin] |= ZEROW; continue; - case 'u': + case 'u': case 'U': /* half line up */ - if (icol < 1) + if (icol < 1) continue; flags[icol-1][nclin] |= HALFUP; continue; - case '0': - case '1': - case '2': - case '3': + case '0': + case '1': + case '2': + case '3': case '4': - case '5': - case '6': - case '7': - case '8': + case '5': + case '6': + case '7': + case '8': case '9': sn[0] = c; snp = sn + 1; @@ -291,7 +291,7 @@ readspec(void) continue; case '|': lefline[icol][nclin]++; - if (icol == 0) + if (icol == 0) left1flg = 1; continue; } @@ -313,9 +313,9 @@ findcol(void) if (c != '\n') un1getc(c); for (s = line; *s = c = get1char(); s++) { - if (c == ')') + if (c == ')') inpar = 0; - if (inpar) + if (inpar) continue; if (c == '\n' || c == 0 || c == '.' || c == ',') break; @@ -326,20 +326,20 @@ findcol(void) } for (p = line; p < s; p++) switch (*p) { - case 'l': - case 'r': - case 'c': - case 'n': - case 'a': + case 'l': + case 'r': + case 'c': + case 'n': + case 'a': case 's': - case 'L': - case 'R': - case 'C': - case 'N': - case 'A': + case 'L': + case 'R': + case 'C': + case 'N': + case 'A': case 'S': - case '-': - case '=': + case '-': + case '=': case '_': n++; } @@ -401,5 +401,3 @@ freearr(void) free(acase); free(topat); } - - diff --git a/src/cmd/tbl/t5.c b/src/cmd/tbl/t5.c index e23784be..c50077e7 100644 --- a/src/cmd/tbl/t5.c +++ b/src/cmd/tbl/t5.c @@ -28,7 +28,7 @@ gettbl(void) while (*cstore++) ; continue; - } else + } else instead[nlin] = 0; if (nodata(nlin)) { if (ch = oneh(nlin)) @@ -46,11 +46,11 @@ gettbl(void) table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0])); if (cstore[1] == 0) switch (cstore[0]) { - case '_': - fullbot[nlin] = '-'; + case '_': + fullbot[nlin] = '-'; continue; - case '=': - fullbot[nlin] = '='; + case '=': + fullbot[nlin] = '='; continue; } stynum[nlin] = nslin; @@ -60,7 +60,7 @@ gettbl(void) table[nlin][icol].rcol = 0; ch = 1; if (match(cstore, "T{")) { /* text follows */ - table[nlin][icol].col = + table[nlin][icol].col = (char *)(uintptr)gettext(cstore, nlin, icol, font[icol][stynum[nlin]], csize[icol][stynum[nlin]]); @@ -81,7 +81,7 @@ gettbl(void) } while (ctype(nlin, icol + 1) == 's') /* spanning */ table[nlin][++icol].col = ""; - if (ch == '\0') + if (ch == '\0') break; } while (++icol < ncol + 2) { @@ -95,7 +95,7 @@ gettbl(void) } last = cstore; permute(); - if (textflg) + if (textflg) untext(); return; } @@ -108,11 +108,11 @@ nodata(int il) for (c = 0; c < ncol; c++) { switch (ctype(il, c)) { - case 'c': - case 'n': - case 'r': - case 'l': - case 's': + case 'c': + case 'n': + case 'r': + case 'l': + case 's': case 'a': return(0); } @@ -169,17 +169,17 @@ permute(void) int vspand(int ir, int ij, int ifform) { - if (ir < 0) + if (ir < 0) return(0); if (ir >= nlin) return(0); - if (instead[ir]) + if (instead[ir]) return(0); - if (ifform == 0 && ctype(ir, ij) == '^') + if (ifform == 0 && ctype(ir, ij) == '^') return(1); - if (table[ir][ij].rcol != 0) + if (table[ir][ij].rcol != 0) return(0); - if (fullbot[ir]) + if (fullbot[ir]) return(0); return(vspen(table[ir][ij].col)); } @@ -188,11 +188,9 @@ vspand(int ir, int ij, int ifform) int vspen(char *s) { - if (s == 0) + if (s == 0) return(0); - if (!point(s)) + if (!point(s)) return(0); return(match(s, SPAN)); } - - diff --git a/src/cmd/tbl/t6.c b/src/cmd/tbl/t6.c index 463bfa10..aed42a07 100644 --- a/src/cmd/tbl/t6.c +++ b/src/cmd/tbl/t6.c @@ -20,16 +20,16 @@ maktab(void) /* define the tab stops of the table */ Bprint(&tabout, ".%2s\n.rm %2s\n", reg(icol, CRIGHT), reg(icol, CRIGHT)); for (ilin = 0; ilin < nlin; ilin++) { - if (instead[ilin] || fullbot[ilin]) + if (instead[ilin] || fullbot[ilin]) continue; vforml = ilin; for (il = prev(ilin); il >= 0 && vspen(table[il][icol].col); il = prev(il)) vforml = il; - if (fspan(vforml, icol)) + if (fspan(vforml, icol)) continue; - if (filler(table[ilin][icol].col)) + if (filler(table[ilin][icol].col)) continue; - if ((flags[icol][stynum[ilin]] & ZEROW) != 0) + if ((flags[icol][stynum[ilin]] & ZEROW) != 0) continue; switch (ctype(vforml, icol)) { case 'a': @@ -52,10 +52,10 @@ maktab(void) /* define the tab stops of the table */ doubled[icol] = 1; if (real(ss = table[ilin][icol].col) && !vspen(ss)) { s = (int)(uintptr)ss; - if (tx(s) != text) + if (tx(s) != text) continue; Bprint(&tabout, ".nr %d ", TMP); - wide(ss, FN(vforml, icol), SZ(vforml, icol)); + wide(ss, FN(vforml, icol), SZ(vforml, icol)); Bprint(&tabout, "\n"); Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S1, TMP, S1, TMP); @@ -73,10 +73,10 @@ maktab(void) /* define the tab stops of the table */ case 'l': if (real(ss = table[ilin][icol].col) && !vspen(ss)) { s = (int)(uintptr)ss; - if (tx(s) != text) + if (tx(s) != text) continue; Bprint(&tabout, ".nr %d ", TMP); - wide(ss, FN(vforml, icol), SZ(vforml, icol)); + wide(ss, FN(vforml, icol), SZ(vforml, icol)); Bprint(&tabout, "\n"); Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP); @@ -85,7 +85,7 @@ maktab(void) /* define the tab stops of the table */ } } if (acase[icol]) { - Bprint(&tabout, ".if \\n(%d>=\\n(%2s .nr %2s \\n(%du+2n\n", + Bprint(&tabout, ".if \\n(%d>=\\n(%2s .nr %2s \\n(%du+2n\n", S2, reg(icol, CRIGHT), reg(icol, CRIGHT), S2); } if (doubled[icol]) { @@ -104,13 +104,13 @@ maktab(void) /* define the tab stops of the table */ for (ilin = 0; ilin < nlin; ilin++) if (k = lspan(ilin, icol)) { ss = table[ilin][icol-k].col; - if (!real(ss) || barent(ss) || vspen(ss) ) + if (!real(ss) || barent(ss) || vspen(ss) ) continue; Bprint(&tabout, ".nr %d ", TMP); wide(table[ilin][icol-k].col, FN(ilin, icol - k), SZ(ilin, icol - k)); for (ik = k; ik >= 0; ik--) { Bprint(&tabout, "-\\n(%2s", reg(icol - ik, CRIGHT)); - if (!expflg && ik > 0) + if (!expflg && ik > 0) Bprint(&tabout, "-%dn", sep[icol-ik]); } Bprint(&tabout, "\n"); @@ -126,13 +126,13 @@ maktab(void) /* define the tab stops of the table */ } } } - if (textflg) + if (textflg) untext(); /* if even requested, make all columns widest width */ if (evenflg) { Bprint(&tabout, ".nr %d 0\n", TMP); for (icol = 0; icol < ncol; icol++) { - if (evenup[icol] == 0) + if (evenup[icol] == 0) continue; Bprint(&tabout, ".if \\n(%2s>\\n(%d .nr %d \\n(%2s\n", reg(icol, CRIGHT), TMP, TMP, reg(icol, CRIGHT)); @@ -169,7 +169,7 @@ maktab(void) /* define the tab stops of the table */ Bprint(&tabout, ".nr %d 1n\n", TMP); Bprint(&tabout, ".nr %2s 0\n", reg(-1, CRIGHT)); tsep = (boxflg || allflg || dboxflg || left1flg) ? 2 : 0; - if (sep[-1] >= 0) + if (sep[-1] >= 0) tsep = sep[-1]; for (icol = 0; icol < ncol; icol++) { Bprint(&tabout, ".nr %2s \\n(%2s+((%d*\\n(%d)/2)\n", reg(icol, CLEFT), @@ -202,14 +202,14 @@ wide(char *s, char *fn, char *size) { if (point(s)) { Bprint(&tabout, "\\w%c", F1); - if (*fn > 0) + if (*fn > 0) putfont(fn); - if (*size) + if (*size) putsize(size); Bprint(&tabout, "%s", s); - if (*fn > 0) + if (*fn > 0) putfont("P"); - if (*size) + if (*size) putsize("0"); Bprint(&tabout, "%c", F1); } else @@ -222,5 +222,3 @@ filler(char *s) { return (point(s) && s[0] == '\\' && s[1] == 'R'); } - - diff --git a/src/cmd/tbl/t7.c b/src/cmd/tbl/t7.c index 2fa9de53..6a873d61 100644 --- a/src/cmd/tbl/t7.c +++ b/src/cmd/tbl/t7.c @@ -7,7 +7,7 @@ runout(void) { int i; - if (boxflg || allflg || dboxflg) + if (boxflg || allflg || dboxflg) need(); if (ctrflg) { Bprint(&tabout, ".nr #I \\n(.i\n"); @@ -65,15 +65,15 @@ runtabs(int lform, int ldata) int ifline(char *s) { - if (!point(s)) + if (!point(s)) return(0); - if (s[0] == '\\') + if (s[0] == '\\') s++; - if (s[1] ) + if (s[1] ) return(0); - if (s[0] == '_') + if (s[0] == '_') return('-'); - if (s[0] == '=') + if (s[0] == '=') return('='); return(0); } @@ -124,7 +124,7 @@ deftail(void) Bprint(&tabout, ".if \\n(T. "); drawline(nlin, 0, ncol, dboxflg ? '=' : '-', 1, 0); Bprint(&tabout, "\n.if \\n(T. .vs\n"); - /* T. is really an argument to a macro but because of + /* T. is really an argument to a macro but because of eqn we don't dare pass it as an argument and reference by $1 */ } for (c = 0; c < ncol; c++) { @@ -146,5 +146,3 @@ deftail(void) Bprint(&tabout, "..\n"); Bprint(&tabout, ".ec\n"); } - - diff --git a/src/cmd/tbl/t8.c b/src/cmd/tbl/t8.c index bfa21ecf..26375df5 100644 --- a/src/cmd/tbl/t8.c +++ b/src/cmd/tbl/t8.c @@ -14,25 +14,25 @@ putline(int i, int nl) char *ss, *size, *fn, *rct; cmidx = watchout = vspf = exvspen = 0; - if (i == 0) + if (i == 0) once = 0; if (i == 0 && ( allflg || boxflg || dboxflg)) fullwide(0, dboxflg ? '=' : '-'); if (instead[nl] == 0 && fullbot[nl] == 0) for (c = 0; c < ncol; c++) { ss = table[nl][c].col; - if (ss == 0) + if (ss == 0) continue; if (vspen(ss)) { for (ip = nl; ip < nlin; ip = next(ip)) - if (!vspen(ss = table[ip][c].col)) + if (!vspen(ss = table[ip][c].col)) break; s = (int)(uintptr)ss; if (s > 0 && s < 128) Bprint(&tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s); continue; } - if (point(ss)) + if (point(ss)) continue; s = (int)(uintptr)ss; Bprint(&tabout, ".ne \\n(%c|u+\\n(.Vu\n", s); @@ -55,10 +55,10 @@ putline(int i, int nl) } for (c = 0; c < ncol; c++) { if (instead[nl] == 0 && fullbot[nl] == 0) - if (vspen(table[nl][c].col)) + if (vspen(table[nl][c].col)) vspf = 1; if (lf >= 0) - if (vspen(table[lf][c].col)) + if (vspen(table[lf][c].col)) vspf = 1; } if (vspf) { @@ -69,7 +69,7 @@ putline(int i, int nl) chfont = 0; for (c = 0; c < ncol; c++) { ss = table[nl][c].col; - if (ss == 0) + if (ss == 0) continue; if(font[c][stynum[nl]]) chfont = 1; @@ -107,7 +107,7 @@ putline(int i, int nl) drawvert(lf, i, c, lwid); vct += 2; } - if (rightl && c + 1 == ncol) + if (rightl && c + 1 == ncol) continue; vforml = i; for (lf = prev(nl); lf >= 0 && vspen(table[lf][c].col); lf = prev(lf)) @@ -115,9 +115,9 @@ putline(int i, int nl) form = ctype(vforml, c); if (form != 's') { rct = reg(c, CLEFT); - if (form == 'a') + if (form == 'a') rct = reg(c, CMID); - if (form == 'n' && table[nl][c].rcol && lused[c] == 0) + if (form == 'n' && table[nl][c].rcol && lused[c] == 0) rct = reg(c, CMID); Bprint(&tabout, "\\h'|\\n(%2su'", rct); } @@ -152,10 +152,10 @@ putline(int i, int nl) } } Bprint(&tabout, "%c%c", F1, F2); - if (uphalf) + if (uphalf) Bprint(&tabout, "\\u"); puttext(ss, fn, size); - if (uphalf) + if (uphalf) Bprint(&tabout, "\\d"); Bprint(&tabout, "%c", F1); } @@ -164,13 +164,13 @@ putline(int i, int nl) break; } case 'c': - form = 3; + form = 3; break; case 'r': - form = 2; + form = 2; break; case 'l': - form = 1; + form = 1; break; case '-': case '=': @@ -212,10 +212,10 @@ putline(int i, int nl) vspf = 1; else { - if (uphalf) + if (uphalf) Bprint(&tabout, "\\u"); puttext(ss, fn, size); - if (uphalf) + if (uphalf) Bprint(&tabout, "\\d"); } if (form != 2) @@ -225,8 +225,8 @@ putline(int i, int nl) ip = prev(nl); if (ip >= 0) if (vspen(table[ip][c].col)) { - exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) && - (topat[c] == topat[c+1]) && + exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) && + (topat[c] == topat[c+1]) && (cmidx == (flags[c+1] [stynum[nl]] & (CTOP | CDOWN) == 0)) && (left(i, c + 1, &lwid) < 0); if (exvspen == 0) { @@ -248,7 +248,7 @@ putline(int i, int nl) } } Bprint(&tabout, "\n"); - if (allh(i) && !pr1403) + if (allh(i) && !pr1403) Bprint(&tabout, ".vs \\n(%du\n", SVS); if (watchout) funnies(i, nl); @@ -270,9 +270,9 @@ puttext(char *s, char *fn, char *size) putfont(fn); putsize(size); Bprint(&tabout, "%s", s); - if (*fn > 0) + if (*fn > 0) Bprint(&tabout, "\\f\\n(%2d", S1); - if (size != 0) + if (size != 0) putsize("0"); } } @@ -289,9 +289,9 @@ funnies(int stl, int lin) Bprint(&tabout, ".nr %d \\n(##\n", S1); /* bottom position */ for (c = 0; c < ncol; c++) { ss = table[lin][c].col; - if (point(ss)) + if (point(ss)) continue; - if (ss == 0) + if (ss == 0) continue; s = (int)(uintptr)ss; Bprint(&tabout, ".sp |\\n(##u-1v\n"); @@ -333,7 +333,7 @@ funnies(int stl, int lin) } Bprint(&tabout, ".%c+\n", s); Bprint(&tabout, ".in -\\n(%du\n", SIND); - if (*fn > 0) + if (*fn > 0) putfont("P"); Bprint(&tabout, ".mk %d\n", S2); Bprint(&tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2, S1, S1, S2); @@ -367,5 +367,3 @@ putsize(char *s) if (s && *s) Bprint(&tabout, "\\s%s", s); } - - diff --git a/src/cmd/tbl/t9.c b/src/cmd/tbl/t9.c index 69e9d6c7..db3a4d11 100644 --- a/src/cmd/tbl/t9.c +++ b/src/cmd/tbl/t9.c @@ -37,13 +37,13 @@ domore(char *dataln) instead[0] = (char *)0; if (dataln[1] == 0) switch (dataln[0]) { - case '_': - fullbot[0] = '-'; - putline(useln, 0); + case '_': + fullbot[0] = '-'; + putline(useln, 0); return(1); - case '=': - fullbot[0] = '='; - putline(useln, 0); + case '=': + fullbot[0] = '='; + putline(useln, 0); return(1); } for (icol = 0; icol < ncol; icol++) { @@ -63,7 +63,7 @@ domore(char *dataln) } while (ctype(useln, icol + 1) == 's') /* spanning */ table[0][++icol].col = ""; - if (ch == '\0') + if (ch == '\0') break; } while (++icol < ncol) @@ -72,5 +72,3 @@ domore(char *dataln) exstore = exspace; /* reuse space for numerical items */ return(1); } - - diff --git a/src/cmd/tbl/tb.c b/src/cmd/tbl/tb.c index 5cc59880..213d371c 100644 --- a/src/cmd/tbl/tb.c +++ b/src/cmd/tbl/tb.c @@ -9,10 +9,10 @@ checkuse(void) for (c = 0; c < ncol; c++) { used[c] = lused[c] = rused[c] = 0; for (i = 0; i < nlin; i++) { - if (instead[i] || fullbot[i]) + if (instead[i] || fullbot[i]) continue; k = ctype(i, c); - if (k == '-' || k == '=') + if (k == '-' || k == '=') continue; if ((k == 'n' || k == 'a')) { rused[c] |= real(table[i][c].rcol); @@ -30,11 +30,11 @@ checkuse(void) int real(char *s) { - if (s == 0) + if (s == 0) return(0); - if (!point(s)) + if (!point(s)) return(1); - if (*s == 0) + if (*s == 0) return(0); return(1); } @@ -97,5 +97,3 @@ release(void) tpcount = -1; exstore = 0; } - - diff --git a/src/cmd/tbl/tc.c b/src/cmd/tbl/tc.c index a89fc0f0..0b9d1961 100644 --- a/src/cmd/tbl/tc.c +++ b/src/cmd/tbl/tc.c @@ -12,9 +12,9 @@ choochar(void) had[icol] = 0; F1 = F2 = 0; for (ilin = 0; ilin < nlin; ilin++) { - if (instead[ilin]) + if (instead[ilin]) continue; - if (fullbot[ilin]) + if (fullbot[ilin]) continue; for (icol = 0; icol < ncol; icol++) { k = ctype(ilin, icol); @@ -32,7 +32,7 @@ choochar(void) } /* choose first funny character */ for ( - s = "\002\003\005\006\007!%&#/?,:;<=>@`^~_{}+-*ABCDEFGHIJKMNOPQRSTUVWXYZabcdefgjkoqrstwxyz"; + s = "\002\003\005\006\007!%&#/?,:;<=>@`^~_{}+-*ABCDEFGHIJKMNOPQRSTUVWXYZabcdefgjkoqrstwxyz"; *s; s++) { if (had[(unsigned char)*s] == 0) { F1 = (unsigned char)*s; @@ -42,7 +42,7 @@ choochar(void) } /* choose second funny character */ for ( - s = "\002\003\005\006\007:_~^`@;,<=>#%&!/?{}+-*ABCDEFGHIJKMNOPQRSTUVWXZabcdefgjkoqrstuwxyz"; + s = "\002\003\005\006\007:_~^`@;,<=>#%&!/?{}+-*ABCDEFGHIJKMNOPQRSTUVWXZabcdefgjkoqrstuwxyz"; *s; s++) { if (had[(unsigned char)*s] == 0) { F2 = (unsigned char)*s; @@ -61,5 +61,3 @@ point(char *ss) int s = (int)(uintptr)ss; return(s >= 128 || s < 0); } - - diff --git a/src/cmd/tbl/te.c b/src/cmd/tbl/te.c index 3df8d445..54df7e82 100644 --- a/src/cmd/tbl/te.c +++ b/src/cmd/tbl/te.c @@ -71,5 +71,3 @@ get1char(void) iline++; return(c); } - - diff --git a/src/cmd/tbl/tf.c b/src/cmd/tbl/tf.c index 3791c32f..097dfe36 100644 --- a/src/cmd/tbl/tf.c +++ b/src/cmd/tbl/tf.c @@ -70,5 +70,3 @@ cleanfc(void) { Bprint(&tabout, ".fc\n"); } - - diff --git a/src/cmd/tbl/tg.c b/src/cmd/tbl/tg.c index 3afc88c6..7b5374bd 100644 --- a/src/cmd/tbl/tg.c +++ b/src/cmd/tbl/tg.c @@ -10,7 +10,7 @@ gettext(char *sp, int ilin, int icol, char *fn, char *sz) char *vs; startline = iline; - if (texname == 0) + if (texname == 0) error("Too many text block diversions"); if (textflg == 0) { Bprint(&tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */ @@ -21,13 +21,13 @@ gettext(char *sp, int ilin, int icol, char *fn, char *sz) Bprint(&tabout, ".br\n"); Bprint(&tabout, ".di %c+\n", texname); rstofill(); - if (fn && *fn) + if (fn && *fn) Bprint(&tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn); Bprint(&tabout, ".ft \\n(.f\n"); /* protect font */ vs = vsize[icol][stynum[ilin]]; if ((sz && *sz) || (vs && *vs)) { Bprint(&tabout, ".nr %d \\n(.v\n", S9); - if (vs == 0 || *vs == 0) + if (vs == 0 || *vs == 0) vs = "\\n(.s+2"; if (sz && *sz) Bprint(&tabout, ".ps %s\n", sz); @@ -48,15 +48,15 @@ gettext(char *sp, int ilin, int icol, char *fn, char *sz) iline = startline; error("missing closing T}"); } - if (line[0] == 'T' && line[1] == '}' && line[2] == tab) + if (line[0] == 'T' && line[1] == '}' && line[2] == tab) break; - if (match("T}", line)) + if (match("T}", line)) break; Bprint(&tabout, "%s\n", line); } - if (fn && *fn) + if (fn && *fn) Bprint(&tabout, ".ft \\n(%d\n", S1); - if (sz && *sz) + if (sz && *sz) Bprint(&tabout, ".br\n.ps\n.vs\n"); Bprint(&tabout, ".br\n"); Bprint(&tabout, ".di\n"); @@ -82,5 +82,3 @@ untext(void) Bprint(&tabout, ".nf\n"); Bprint(&tabout, ".ll \\n(%du\n", SL); } - - diff --git a/src/cmd/tbl/ti.c b/src/cmd/tbl/ti.c index ef995bbb..d4a2ab4d 100644 --- a/src/cmd/tbl/ti.c +++ b/src/cmd/tbl/ti.c @@ -9,9 +9,9 @@ interv(int i, int c) if (c >= ncol || c == 0) { if (dboxflg) { - if (i == 0) + if (i == 0) return(BOT); - if (i >= nlin) + if (i >= nlin) return(TOP); return(THRU); } @@ -23,11 +23,11 @@ interv(int i, int c) kl = 0; else kl = lefdata(allh(i) ? i + 1 : i, c); - if (ku == 2 && kl == 2) + if (ku == 2 && kl == 2) return(THRU); - if (ku == 2) + if (ku == 2) return(TOP); - if (kl == BOT) + if (kl == BOT) return(2); return(0); } @@ -45,7 +45,7 @@ interh(int i, int c) return(RIGHT); return(THRU); } - if (i >= nlin) + if (i >= nlin) return(0); kl = c > 0 ? thish (i, c - 1) : 0; if (kl <= 1 && i > 0 && allh(up1(i))) @@ -53,11 +53,11 @@ interh(int i, int c) kr = thish(i, c); if (kr <= 1 && i > 0 && allh(up1(i))) kr = c > 0 ? thish(up1(i), c) : 0; - if (kl == '=' && kr == '=') + if (kl == '=' && kr == '=') return(THRU); - if (kl == '=') + if (kl == '=') return(LEFT); - if (kr == '=') + if (kr == '=') return(RIGHT); return(0); } @@ -67,9 +67,7 @@ int up1(int i) { i--; - while (instead[i] && i > 0) + while (instead[i] && i > 0) i--; return(i); } - - diff --git a/src/cmd/tbl/tm.c b/src/cmd/tbl/tm.c index 5b58f0d1..cee294c4 100644 --- a/src/cmd/tbl/tm.c +++ b/src/cmd/tbl/tm.c @@ -15,8 +15,8 @@ maknew(char *str) str = p; if (ba == 0) { for (dpoint = 0; *str; str++) { - if (*str == '.' && !ineqn(str, p) && - (str > p && digit(*(str - 1)) || + if (*str == '.' && !ineqn(str, p) && + (str > p && digit(*(str - 1)) || digit(*(str + 1)))) dpoint = str; } @@ -27,7 +27,7 @@ maknew(char *str) } if (!dpoint && p == str) /* not numerical, don't split */ return(0); - if (dpoint) + if (dpoint) str = dpoint; } else str = ba; @@ -61,5 +61,3 @@ ineqn (char *s, char *p) } return(0); } - - diff --git a/src/cmd/tbl/tr.c b/src/cmd/tbl/tr.c index 7d586e8b..6a626115 100644 --- a/src/cmd/tbl/tr.c +++ b/src/cmd/tbl/tr.c @@ -24,5 +24,3 @@ reg(int col, int place) error("Too many columns for registers"); return (nregs[qcol*place+col]); } - - diff --git a/src/cmd/tbl/ts.c b/src/cmd/tbl/ts.c index 43cc84ec..2a98b5d6 100644 --- a/src/cmd/tbl/ts.c +++ b/src/cmd/tbl/ts.c @@ -19,7 +19,7 @@ prefix(char *small, char *big) int c; while ((c = *small++) == *big++) - if (c == 0) + if (c == 0) return(1); return(c == 0); } @@ -67,5 +67,3 @@ tcopy (char *s, char *t) while (*s++ = *t++) ; } - - diff --git a/src/cmd/tbl/tt.c b/src/cmd/tbl/tt.c index 96270b75..54c6180e 100644 --- a/src/cmd/tbl/tt.c +++ b/src/cmd/tbl/tt.c @@ -33,7 +33,7 @@ lspan(int i, int c) { int k; - if (ctype(i, c) != 's') + if (ctype(i, c) != 's') return(0); c++; if (c < ncol && ctype(i, c) == 's') @@ -73,15 +73,15 @@ allh(int i) /* also at least one must be horizontl */ int c, one, k; - if (fullbot[i]) + if (fullbot[i]) return(1); - if (i >= nlin) + if (i >= nlin) return(dboxflg || boxflg); for (one = c = 0; c < ncol; c++) { k = thish(i, c); - if (k == 0) + if (k == 0) return(0); - if (k == 1) + if (k == 1) continue; one = 1; } @@ -98,30 +98,28 @@ thish(int i, int c) if (c < 0) return(0); - if (i < 0) + if (i < 0) return(0); t = ctype(i, c); if (t == '_' || t == '-') return('-'); if (t == '=') return('='); - if (t == '^') + if (t == '^') return(1); if (fullbot[i] ) return(fullbot[i]); - if (t == 's') + if (t == 's') return(thish(i, c - 1)); - if (t == 0) + if (t == 0) return(1); pc = &table[i][c]; s = (t == 'a' ? pc->rcol : pc->col); if (s == 0 || (point(s) && *s == 0)) return(1); - if (vspen(s)) + if (vspen(s)) return(1); if (t = barent( s)) return(t); return(0); } - - diff --git a/src/cmd/tbl/tu.c b/src/cmd/tbl/tu.c index 217869e1..94089577 100644 --- a/src/cmd/tbl/tu.c +++ b/src/cmd/tbl/tu.c @@ -7,7 +7,7 @@ makeline(int i, int c, int lintype) int cr, type, shortl; type = thish(i, c); - if (type == 0) + if (type == 0) return; shortl = (table[i][c].col[0] == '\\'); if (c > 0 && !shortl && thish(i, c - 1) == type) @@ -55,17 +55,17 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl) lcount = 0; exhr = exhl = ""; switch (lintype) { - case '-': + case '-': lcount = 1; break; - case '=': - lcount = pr1403 ? 1 : 2; + case '=': + lcount = pr1403 ? 1 : 2; break; - case SHORTLINE: - lcount = 1; + case SHORTLINE: + lcount = 1; break; } - if (lcount <= 0) + if (lcount <= 0) return; nodata = cr - cl >= ncol || noheight || allh(i); if (!nodata) @@ -79,26 +79,26 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl) tohcol(cl); if (lcount > 1) { switch (interv(i, cl)) { - case TOP: - exhl = ln == 0 ? "1p" : "-1p"; + case TOP: + exhl = ln == 0 ? "1p" : "-1p"; break; - case BOT: - exhl = ln == 1 ? "1p" : "-1p"; + case BOT: + exhl = ln == 1 ? "1p" : "-1p"; break; - case THRU: - exhl = "1p"; + case THRU: + exhl = "1p"; break; } if (exhl[0]) Bprint(&tabout, "\\h'%s'", exhl); } else if (lcount == 1) { switch (interv(i, cl)) { - case TOP: - case BOT: - exhl = "-1p"; + case TOP: + case BOT: + exhl = "-1p"; break; - case THRU: - exhl = "1p"; + case THRU: + exhl = "1p"; break; } if (exhl[0]) @@ -106,24 +106,24 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl) } if (lcount > 1) { switch (interv(i, cr + 1)) { - case TOP: - exhr = ln == 0 ? "-1p" : "+1p"; + case TOP: + exhr = ln == 0 ? "-1p" : "+1p"; break; - case BOT: - exhr = ln == 1 ? "-1p" : "+1p"; + case BOT: + exhr = ln == 1 ? "-1p" : "+1p"; break; - case THRU: - exhr = "-1p"; + case THRU: + exhr = "-1p"; break; } } else if (lcount == 1) { switch (interv(i, cr + 1)) { - case TOP: - case BOT: - exhr = "+1p"; + case TOP: + case BOT: + exhr = "+1p"; break; - case THRU: - exhr = "-1p"; + case THRU: + exhr = "-1p"; break; } } @@ -183,18 +183,18 @@ left(int i, int c, int *lwidp) /* returns number of line where it starts */ /* stores into lwid the kind of line */ *lwidp = 0; - if (i < 0) + if (i < 0) return(-1); kind = lefdata(i, c); - if (kind == 0) + if (kind == 0) return(-1); if (i + 1 < nlin) - if (lefdata(next(i), c) == kind) + if (lefdata(next(i), c) == kind) return(-1); li = i; while (i >= 0 && lefdata(i, c) == kind) i = prev(li = i); - if (prev(li) == -1) + if (prev(li) == -1) li = 0; *lwidp = kind; for (lj = i + 1; lj < li; lj++) @@ -212,7 +212,7 @@ lefdata(int i, int c) { int ck; - if (i >= nlin) + if (i >= nlin) i = nlin - 1; if (ctype(i, c) == 's') { for (ck = c; ctype(i, ck) == 's'; ck--) @@ -222,13 +222,13 @@ lefdata(int i, int c) } i = stynum[i]; i = lefline[c][i]; - if (i > 0) + if (i > 0) return(i); - if (dboxflg && c == 0) + if (dboxflg && c == 0) return(2); if (allflg) return(1); - if (boxflg && c == 0) + if (boxflg && c == 0) return(1); return(0); } @@ -239,7 +239,7 @@ next(int i) { while (i + 1 < nlin) { i++; - if (!fullbot[i] && !instead[i]) + if (!fullbot[i] && !instead[i]) break; } return(i); @@ -253,5 +253,3 @@ prev(int i) ; return(i); } - - diff --git a/src/cmd/tbl/tv.c b/src/cmd/tbl/tv.c index 19a4b03f..0fb330cc 100644 --- a/src/cmd/tbl/tv.c +++ b/src/cmd/tbl/tv.c @@ -10,12 +10,12 @@ drawvert(int start, int end, int c, int lwid) end++; vm = 'v'; /* note: nr 35 has value of 1m outside of linesize */ - while (instead[end]) + while (instead[end]) end++; for (ln = 0; ln < lwid; ln++) { epb = ept = 0; pos = 2 * ln - lwid + 1; - if (pos != tp) + if (pos != tp) Bprint(&tabout, "\\h'%dp'", pos - tp); tp = pos; if (end < nlin) { @@ -24,53 +24,53 @@ drawvert(int start, int end, int c, int lwid) else switch (midbar(end, c)) { case '-': - exb = "1v-.5m"; + exb = "1v-.5m"; break; case '=': exb = "1v-.5m"; - epb = 1; + epb = 1; break; } } if (lwid > 1) switch (interh(end, c)) { - case THRU: - epb -= 1; + case THRU: + epb -= 1; break; - case RIGHT: - epb += (ln == 0 ? 1 : -1); + case RIGHT: + epb += (ln == 0 ? 1 : -1); break; - case LEFT: - epb += (ln == 1 ? 1 : -1); + case LEFT: + epb += (ln == 1 ? 1 : -1); break; } if (lwid == 1) switch (interh(end, c)) { - case THRU: - epb -= 1; + case THRU: + epb -= 1; break; - case RIGHT: - case LEFT: - epb += 1; + case RIGHT: + case LEFT: + epb += 1; break; } if (start > 0) { sl = start - 1; - while (sl >= 0 && instead[sl]) + while (sl >= 0 && instead[sl]) sl--; if (sl >= 0 && (fullbot[sl] || allh(sl))) ept = 0; else if (sl >= 0) switch (midbar(sl, c)) { case '-': - ext = ".5m"; + ext = ".5m"; break; case '=': - ext = ".5m"; - ept = -1; + ext = ".5m"; + ept = -1; break; default: - vm = 'm'; + vm = 'm'; break; } else @@ -81,24 +81,24 @@ drawvert(int start, int end, int c, int lwid) } if (lwid > 1) switch (interh(start, c)) { - case THRU: - ept += 1; + case THRU: + ept += 1; break; - case LEFT: - ept += (ln == 0 ? 1 : -1); + case LEFT: + ept += (ln == 0 ? 1 : -1); break; - case RIGHT: - ept += (ln == 1 ? 1 : -1); + case RIGHT: + ept += (ln == 1 ? 1 : -1); break; } else if (lwid == 1) switch (interh(start, c)) { - case THRU: - ept += 1; + case THRU: + ept += 1; break; - case LEFT: - case RIGHT: - ept -= 1; + case LEFT: + case RIGHT: + ept -= 1; break; } if (exb) @@ -163,11 +163,11 @@ midbcol(int i, int c) int barent(char *s) { - if (s == 0) + if (s == 0) return (1); - if (!point(s)) + if (!point(s)) return(0); - if (s[0] == '\\') + if (s[0] == '\\') s++; if (s[1] != 0) return(0); @@ -179,5 +179,3 @@ barent(char *s) } return(0); } - - |