Make tbl compile silently.

This commit is contained in:
wkj 2004-05-17 02:23:43 +00:00
parent 1f72bc47fe
commit 8a3cbc1579
19 changed files with 321 additions and 328 deletions

View file

@ -1,9 +1,9 @@
/* t..c : external declarations */ /* t..c : external declarations */
#include <stdio.h> #include <u.h>
#include <stdlib.h> #include <libc.h>
#include <string.h> #include <bio.h>
#include <ctype.h> # include <ctype.h>
# define MAXLIN 250 # define MAXLIN 250
# define MAXHEAD 44 # define MAXHEAD 44
@ -62,7 +62,7 @@ extern char texstr[];
extern int linstart; extern int linstart;
extern FILE *tabin, *tabout; extern Biobuf *tabin, tabout;
# define CRIGHT 2 # define CRIGHT 2
# define CLEFT 0 # define CLEFT 0
# define CMID 1 # define CMID 1

View file

@ -45,5 +45,5 @@ int texct = 0;
char texstr[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ0123456789"; char texstr[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ0123456789";
int linstart; int linstart;
char *exstore, *exlim, *exspace; char *exstore, *exlim, *exspace;
FILE *tabin; Biobuf *tabin /*= stdin */;
FILE *tabout; Biobuf tabout /* = stdout */;

View file

@ -8,17 +8,10 @@
# define ever (;;) # define ever (;;)
int void
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
tabin = stdin; exits(tbl(argc, argv)? "error" : 0);
tabout = stdout;
if(tbl(argc, argv)){
fprintf(stderr, "error");
return 1;
}
return 0;
} }
@ -28,14 +21,14 @@ tbl(int argc, char *argv[])
char line[5120]; char line[5120];
/*int x;*/ /*int x;*/
/*x=malloc((char *)0); uncomment when allocation breaks*/ /*x=malloc((char *)0); uncomment when allocation breaks*/
/*Binit(&tabout, 1, OWRITE); /* tabout=stdout */ Binit(&tabout, 1, OWRITE);
setinp(argc, argv); setinp(argc, argv);
while (gets1(line, sizeof(line))) { while (gets1(line, sizeof(line))) {
fprintf(tabout, "%s\n", line); Bprint(&tabout, "%s\n", line);
if (prefix(".TS", line)) if (prefix(".TS", line))
tableput(); tableput();
} }
fclose(tabin); Bterm(tabin);
return(0); return(0);
} }
@ -52,8 +45,10 @@ setinp(int argc, char **argv)
sargv++; sargv++;
if (sargc > 0) if (sargc > 0)
swapin(); swapin();
else else {
tabin = stdin; tabin = (Biobuf*)getcore(sizeof(Biobuf), 1);
Binit(tabin, 0, OREAD);
}
} }
@ -81,16 +76,17 @@ swapin(void)
return(0); return(0);
/* file closing is done by GCOS troff preprocessor */ /* file closing is done by GCOS troff preprocessor */
if(tabin) if(tabin)
fclose(tabin); Bterm(tabin);
ifile = *sargv; ifile = *sargv;
name = ifile; name = ifile;
if (match(ifile, "-")) { if (match(ifile, "-")) {
tabin = stdin; tabin = (Biobuf*)getcore(sizeof(Biobuf), 1);
Binit(tabin, 0, OREAD);
} else } else
tabin = fopen(ifile, "r"); tabin = Bopen(ifile, OREAD);
iline = 1; iline = 1;
fprintf(tabout, ".ds f. %s\n", ifile); Bprint(&tabout, ".ds f. %s\n", ifile);
fprintf(tabout, ".lf %d %s\n", iline, name); Bprint(&tabout, ".lf %d %s\n", iline, name);
if (tabin == 0) if (tabin == 0)
error("Can't open file"); error("Can't open file");
sargc--; sargc--;

View file

@ -4,28 +4,27 @@ struct optstr {
char *optnam; char *optnam;
int *optadd; int *optadd;
} options [] = { } options [] = {
{ "expand", &expflg }, "expand", &expflg,
{ "EXPAND", &expflg }, "EXPAND", &expflg,
{ "center", &ctrflg }, "center", &ctrflg,
{ "CENTER", &ctrflg }, "CENTER", &ctrflg,
{ "box", &boxflg }, "box", &boxflg,
{ "BOX", &boxflg }, "BOX", &boxflg,
{ "allbox", &allflg }, "allbox", &allflg,
{ "ALLBOX", &allflg }, "ALLBOX", &allflg,
{ "doublebox", &dboxflg }, "doublebox", &dboxflg,
{ "DOUBLEBOX", &dboxflg }, "DOUBLEBOX", &dboxflg,
{ "frame", &boxflg }, "frame", &boxflg,
{ "FRAME", &boxflg }, "FRAME", &boxflg,
{ "doubleframe", &dboxflg }, "doubleframe", &dboxflg,
{ "DOUBLEFRAME", &dboxflg }, "DOUBLEFRAME", &dboxflg,
{ "tab", &tab }, "tab", &tab,
{ "TAB", &tab }, "TAB", &tab,
{ "linesize", &linsize }, "linesize", &linsize,
{ "LINESIZE", &linsize }, "LINESIZE", &linsize,
{ "delim", &delim1 }, "delim", &delim1,
{ "DELIM", &delim1 }, "DELIM", &delim1,
{ 0, 0} 0, 0};
};
void void
@ -39,7 +38,7 @@ getcomm(void)
*(lp->optadd) = 0; *(lp->optadd) = 0;
texname = texstr[texct=0]; texname = texstr[texct=0];
tab = '\t'; tab = '\t';
fprintf(tabout, ".nr %d \\n(.s\n", LSIZE); Bprint(&tabout, ".nr %d \\n(.s\n", LSIZE);
gets1(line, sizeof(line)); gets1(line, sizeof(line));
/* see if this is a command line */ /* see if this is a command line */
if (strchr(line, ';') == 0) { if (strchr(line, ';') == 0) {
@ -71,7 +70,7 @@ getcomm(void)
*(lp->optadd) = nb[0]; *(lp->optadd) = nb[0];
} }
if (lp->optadd == &linsize) if (lp->optadd == &linsize)
fprintf(tabout, ".nr %d %s\n", LSIZE, nb); Bprint(&tabout, ".nr %d %s\n", LSIZE, nb);
if (lp->optadd == &delim1) { if (lp->optadd == &delim1) {
delim1 = nb[0]; delim1 = nb[0];
delim2 = nb[1]; delim2 = nb[1];

View file

@ -28,10 +28,10 @@ getspec(void)
oncol = 0; oncol = 0;
left1flg = rightl = 0; left1flg = rightl = 0;
readspec(); readspec();
fprintf(tabout, ".rm"); Bprint(&tabout, ".rm");
for (i = 0; i < ncol; i++) for (i = 0; i < ncol; i++)
fprintf(tabout, " %2s", reg(i, CRIGHT)); Bprint(&tabout, " %2s", reg(i, CRIGHT));
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
} }
@ -42,12 +42,12 @@ readspec(void)
char sn[10], *snp, *temp; char sn[10], *snp, *temp;
sawchar = icol = 0; sawchar = icol = 0;
while ((c = get1char())) { while (c = get1char()) {
switch (c) { switch (c) {
default: default:
if (c != tab) { if (c != tab) {
char buf[64]; char buf[64];
sprintf(buf, "bad table specification character %c", c); sprint(buf, "bad table specification character %c", c);
error(buf); error(buf);
} }
case ' ': /* note this is also case tab */ case ' ': /* note this is also case tab */
@ -108,11 +108,11 @@ readspec(void)
if (c == 's' && icol <= 0) if (c == 's' && icol <= 0)
error("first column can not be S-type"); error("first column can not be S-type");
if (c == 's' && style[icol-1][nclin] == 'a') { if (c == 's' && style[icol-1][nclin] == 'a') {
fprintf(tabout, ".tm warning: can't span a-type cols, changed to l\n"); Bprint(&tabout, ".tm warning: can't span a-type cols, changed to l\n");
style[icol-1][nclin] = 'l'; style[icol-1][nclin] = 'l';
} }
if (c == 's' && style[icol-1][nclin] == 'n') { if (c == 's' && style[icol-1][nclin] == 'n') {
fprintf(tabout, ".tm warning: can't span n-type cols, changed to c\n"); Bprint(&tabout, ".tm warning: can't span n-type cols, changed to c\n");
style[icol-1][nclin] = 'c'; style[icol-1][nclin] = 'c';
} }
icol++; icol++;
@ -181,7 +181,7 @@ readspec(void)
if (icol <= 0) if (icol <= 0)
continue; continue;
temp = snp = csize[icol-1][nclin]; temp = snp = csize[icol-1][nclin];
while ((c = get1char())) { while (c = get1char()) {
if (c == ' ' || c == tab || c == '\n') if (c == ' ' || c == tab || c == '\n')
break; break;
if (c == '-' || c == '+') if (c == '-' || c == '+')
@ -206,7 +206,7 @@ readspec(void)
if (icol <= 0) if (icol <= 0)
continue; continue;
temp = snp = vsize[icol-1][nclin]; temp = snp = vsize[icol-1][nclin];
while ((c = get1char())) { while (c = get1char()) {
if (c == ' ' || c == tab || c == '\n') if (c == ' ' || c == tab || c == '\n')
break; break;
if (c == '-' || c == '+') if (c == '-' || c == '+')
@ -231,12 +231,12 @@ readspec(void)
of different widths now .... of different widths now ....
if (*snp) if (*snp)
{ {
fprintf(tabout, "Ignored second width specification"); Bprint(&tabout, "Ignored second width specification");
continue; continue;
} }
/* end commented out code ... */ /* end commented out code ... */
stopc = 0; stopc = 0;
while ((c = get1char())) { while (c = get1char()) {
if (snp == cll[icol-1] && c == '(') { if (snp == cll[icol-1] && c == '(') {
stopc = ')'; stopc = ')';
continue; continue;
@ -312,7 +312,7 @@ findcol(void)
; ;
if (c != '\n') if (c != '\n')
un1getc(c); un1getc(c);
for (s = line; (*s = c = get1char()); s++) { for (s = line; *s = c = get1char(); s++) {
if (c == ')') if (c == ')')
inpar = 0; inpar = 0;
if (inpar) if (inpar)
@ -371,7 +371,7 @@ garray(int qcol)
} }
char* char *
getcore(int a, int b) getcore(int a, int b)
{ {
char *x; char *x;

View file

@ -31,7 +31,7 @@ gettbl(void)
} else } else
instead[nlin] = 0; instead[nlin] = 0;
if (nodata(nlin)) { if (nodata(nlin)) {
if ((ch = oneh(nlin))) if (ch = oneh(nlin))
fullbot[nlin] = ch; fullbot[nlin] = ch;
table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0])); table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0]));
for (icol = 0; icol < ncol; icol++) { for (icol = 0; icol < ncol; icol++) {

View file

@ -14,10 +14,10 @@ maktab(void) /* define the tab stops of the table */
for (icol = 0; icol < ncol; icol++) { for (icol = 0; icol < ncol; icol++) {
doubled[icol] = acase[icol] = 0; doubled[icol] = acase[icol] = 0;
fprintf(tabout, ".nr %2s 0\n", reg(icol, CRIGHT)); Bprint(&tabout, ".nr %2s 0\n", reg(icol, CRIGHT));
for (text = 0; text < 2; text++) { for (text = 0; text < 2; text++) {
if (text) if (text)
fprintf(tabout, ".%2s\n.rm %2s\n", reg(icol, CRIGHT), Bprint(&tabout, ".%2s\n.rm %2s\n", reg(icol, CRIGHT),
reg(icol, CRIGHT)); reg(icol, CRIGHT));
for (ilin = 0; ilin < nlin; ilin++) { for (ilin = 0; ilin < nlin; ilin++) {
if (instead[ilin] || fullbot[ilin]) if (instead[ilin] || fullbot[ilin])
@ -37,31 +37,31 @@ maktab(void) /* define the tab stops of the table */
s = table[ilin][icol].col; s = table[ilin][icol].col;
if ((int)s > 0 && (int)s < 128 && text) { if ((int)s > 0 && (int)s < 128 && text) {
if (doubled[icol] == 0) if (doubled[icol] == 0)
fprintf(tabout, ".nr %d 0\n.nr %d 0\n", Bprint(&tabout, ".nr %d 0\n.nr %d 0\n",
S1, S2); S1, S2);
doubled[icol] = 1; doubled[icol] = 1;
fprintf(tabout, ".if \\n(%c->\\n(%d .nr %d \\n(%c-\n", Bprint(&tabout, ".if \\n(%c->\\n(%d .nr %d \\n(%c-\n",
(int)s, S2, S2, (int)s); (int)s, S2, S2, (int)s);
} }
case 'n': case 'n':
if (table[ilin][icol].rcol != 0) { if (table[ilin][icol].rcol != 0) {
if (doubled[icol] == 0 && text == 0) if (doubled[icol] == 0 && text == 0)
fprintf(tabout, ".nr %d 0\n.nr %d 0\n", Bprint(&tabout, ".nr %d 0\n.nr %d 0\n",
S1, S2); S1, S2);
doubled[icol] = 1; doubled[icol] = 1;
if (real(s = table[ilin][icol].col) && !vspen(s)) { if (real(s = table[ilin][icol].col) && !vspen(s)) {
if (tx((int)s) != text) if (tx((int)s) != text)
continue; continue;
fprintf(tabout, ".nr %d ", TMP); Bprint(&tabout, ".nr %d ", TMP);
wide(s, FN(vforml, icol), SZ(vforml, icol)); wide(s, FN(vforml, icol), SZ(vforml, icol));
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n",
S1, TMP, S1, TMP); S1, TMP, S1, TMP);
} }
if (text == 0 && real(s = table[ilin][icol].rcol) && !vspen(s) && !barent(s)) { if (text == 0 && real(s = table[ilin][icol].rcol) && !vspen(s) && !barent(s)) {
fprintf(tabout, ".nr %d \\w%c%s%c\n", Bprint(&tabout, ".nr %d \\w%c%s%c\n",
TMP, F1, s, F1); TMP, F1, s, F1);
fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S2, TMP, S2, Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S2, TMP, S2,
TMP); TMP);
} }
continue; continue;
@ -72,53 +72,53 @@ maktab(void) /* define the tab stops of the table */
if (real(s = table[ilin][icol].col) && !vspen(s)) { if (real(s = table[ilin][icol].col) && !vspen(s)) {
if (tx((int)s) != text) if (tx((int)s) != text)
continue; continue;
fprintf(tabout, ".nr %d ", TMP); Bprint(&tabout, ".nr %d ", TMP);
wide(s, FN(vforml, icol), SZ(vforml, icol)); wide(s, FN(vforml, icol), SZ(vforml, icol));
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
fprintf(tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n", Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP); reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
} }
} }
} }
} }
if (acase[icol]) { if (acase[icol]) {
fprintf(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); S2, reg(icol, CRIGHT), reg(icol, CRIGHT), S2);
} }
if (doubled[icol]) { if (doubled[icol]) {
fprintf(tabout, ".nr %2s \\n(%d\n", reg(icol, CMID), S1); Bprint(&tabout, ".nr %2s \\n(%d\n", reg(icol, CMID), S1);
fprintf(tabout, ".nr %d \\n(%2s+\\n(%d\n", TMP, reg(icol, CMID), S2); Bprint(&tabout, ".nr %d \\n(%2s+\\n(%d\n", TMP, reg(icol, CMID), S2);
fprintf(tabout, ".if \\n(%d>\\n(%2s .nr %2s \\n(%d\n", TMP, Bprint(&tabout, ".if \\n(%d>\\n(%2s .nr %2s \\n(%d\n", TMP,
reg(icol, CRIGHT), reg(icol, CRIGHT), TMP); reg(icol, CRIGHT), reg(icol, CRIGHT), TMP);
fprintf(tabout, ".if \\n(%d<\\n(%2s .nr %2s +(\\n(%2s-\\n(%d)/2\n", Bprint(&tabout, ".if \\n(%d<\\n(%2s .nr %2s +(\\n(%2s-\\n(%d)/2\n",
TMP, reg(icol, CRIGHT), reg(icol, CMID), reg(icol, CRIGHT), TMP); TMP, reg(icol, CRIGHT), reg(icol, CMID), reg(icol, CRIGHT), TMP);
} }
if (cll[icol][0]) { if (cll[icol][0]) {
fprintf(tabout, ".nr %d %sn\n", TMP, cll[icol]); Bprint(&tabout, ".nr %d %sn\n", TMP, cll[icol]);
fprintf(tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n", Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP); reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
} }
for (ilin = 0; ilin < nlin; ilin++) for (ilin = 0; ilin < nlin; ilin++)
if ((k = lspan(ilin, icol))) { if (k = lspan(ilin, icol)) {
s = table[ilin][icol-k].col; s = table[ilin][icol-k].col;
if (!real(s) || barent(s) || vspen(s) ) if (!real(s) || barent(s) || vspen(s) )
continue; continue;
fprintf(tabout, ".nr %d ", TMP); Bprint(&tabout, ".nr %d ", TMP);
wide(table[ilin][icol-k].col, FN(ilin, icol - k), SZ(ilin, icol - k)); wide(table[ilin][icol-k].col, FN(ilin, icol - k), SZ(ilin, icol - k));
for (ik = k; ik >= 0; ik--) { for (ik = k; ik >= 0; ik--) {
fprintf(tabout, "-\\n(%2s", reg(icol - ik, CRIGHT)); Bprint(&tabout, "-\\n(%2s", reg(icol - ik, CRIGHT));
if (!expflg && ik > 0) if (!expflg && ik > 0)
fprintf(tabout, "-%dn", sep[icol-ik]); Bprint(&tabout, "-%dn", sep[icol-ik]);
} }
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
fprintf(tabout, ".if \\n(%d>0 .nr %d \\n(%d/%d\n", TMP, Bprint(&tabout, ".if \\n(%d>0 .nr %d \\n(%d/%d\n", TMP,
TMP, TMP, k); TMP, TMP, k);
fprintf(tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP); Bprint(&tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP);
for (ik = 1; ik <= k; ik++) { for (ik = 1; ik <= k; ik++) {
if (doubled[icol-k+ik]) if (doubled[icol-k+ik])
fprintf(tabout, ".nr %2s +\\n(%d/2\n", Bprint(&tabout, ".nr %2s +\\n(%d/2\n",
reg(icol - k + ik, CMID), TMP); reg(icol - k + ik, CMID), TMP);
fprintf(tabout, ".nr %2s +\\n(%d\n", Bprint(&tabout, ".nr %2s +\\n(%d\n",
reg(icol - k + ik, CRIGHT), TMP); reg(icol - k + ik, CRIGHT), TMP);
} }
} }
@ -127,11 +127,11 @@ maktab(void) /* define the tab stops of the table */
untext(); untext();
/* if even requested, make all columns widest width */ /* if even requested, make all columns widest width */
if (evenflg) { if (evenflg) {
fprintf(tabout, ".nr %d 0\n", TMP); Bprint(&tabout, ".nr %d 0\n", TMP);
for (icol = 0; icol < ncol; icol++) { for (icol = 0; icol < ncol; icol++) {
if (evenup[icol] == 0) if (evenup[icol] == 0)
continue; continue;
fprintf(tabout, ".if \\n(%2s>\\n(%d .nr %d \\n(%2s\n", Bprint(&tabout, ".if \\n(%2s>\\n(%d .nr %d \\n(%2s\n",
reg(icol, CRIGHT), TMP, TMP, reg(icol, CRIGHT)); reg(icol, CRIGHT), TMP, TMP, reg(icol, CRIGHT));
} }
for (icol = 0; icol < ncol; icol++) { for (icol = 0; icol < ncol; icol++) {
@ -139,56 +139,56 @@ maktab(void) /* define the tab stops of the table */
/* if column not evened just retain old interval */ /* if column not evened just retain old interval */
continue; continue;
if (doubled[icol]) if (doubled[icol])
fprintf(tabout, ".nr %2s (100*\\n(%2s/\\n(%2s)*\\n(%d/100\n", Bprint(&tabout, ".nr %2s (100*\\n(%2s/\\n(%2s)*\\n(%d/100\n",
reg(icol, CMID), reg(icol, CMID), reg(icol, CRIGHT), TMP); reg(icol, CMID), reg(icol, CMID), reg(icol, CRIGHT), TMP);
/* that nonsense with the 100's and parens tries /* that nonsense with the 100's and parens tries
to avoid overflow while proportionally shifting to avoid overflow while proportionally shifting
the middle of the number */ the middle of the number */
fprintf(tabout, ".nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP); Bprint(&tabout, ".nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP);
} }
} }
/* now adjust for total table width */ /* now adjust for total table width */
for (tsep = icol = 0; icol < ncol; icol++) for (tsep = icol = 0; icol < ncol; icol++)
tsep += sep[icol]; tsep += sep[icol];
if (expflg) { if (expflg) {
fprintf(tabout, ".nr %d 0", TMP); Bprint(&tabout, ".nr %d 0", TMP);
for (icol = 0; icol < ncol; icol++) for (icol = 0; icol < ncol; icol++)
fprintf(tabout, "+\\n(%2s", reg(icol, CRIGHT)); Bprint(&tabout, "+\\n(%2s", reg(icol, CRIGHT));
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
fprintf(tabout, ".nr %d \\n(.l-\\n(%d\n", TMP, TMP); Bprint(&tabout, ".nr %d \\n(.l-\\n(%d\n", TMP, TMP);
if (boxflg || dboxflg || allflg) if (boxflg || dboxflg || allflg)
/* tsep += 1; */ ; /* tsep += 1; */ {}
else else
tsep -= sep[ncol-1]; tsep -= sep[ncol-1];
fprintf(tabout, ".nr %d \\n(%d/%d\n", TMP, TMP, tsep); Bprint(&tabout, ".nr %d \\n(%d/%d\n", TMP, TMP, tsep);
fprintf(tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP); Bprint(&tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP);
} else } else
fprintf(tabout, ".nr %d 1n\n", TMP); Bprint(&tabout, ".nr %d 1n\n", TMP);
fprintf(tabout, ".nr %2s 0\n", reg(-1, CRIGHT)); Bprint(&tabout, ".nr %2s 0\n", reg(-1, CRIGHT));
tsep = (boxflg || allflg || dboxflg || left1flg) ? 2 : 0; tsep = (boxflg || allflg || dboxflg || left1flg) ? 2 : 0;
if (sep[-1] >= 0) if (sep[-1] >= 0)
tsep = sep[-1]; tsep = sep[-1];
for (icol = 0; icol < ncol; icol++) { for (icol = 0; icol < ncol; icol++) {
fprintf(tabout, ".nr %2s \\n(%2s+((%d*\\n(%d)/2)\n", reg(icol, CLEFT), Bprint(&tabout, ".nr %2s \\n(%2s+((%d*\\n(%d)/2)\n", reg(icol, CLEFT),
reg(icol - 1, CRIGHT), tsep, TMP); reg(icol - 1, CRIGHT), tsep, TMP);
fprintf(tabout, ".nr %2s +\\n(%2s\n", reg(icol, CRIGHT), reg(icol, CLEFT)); Bprint(&tabout, ".nr %2s +\\n(%2s\n", reg(icol, CRIGHT), reg(icol, CLEFT));
if (doubled[icol]) { if (doubled[icol]) {
/* the next line is last-ditch effort to avoid zero field width */ /* the next line is last-ditch effort to avoid zero field width */
/*fprintf(tabout, ".if \\n(%2s=0 .nr %2s 1\n",reg(icol,CMID), reg(icol,CMID));*/ /*Bprint(&tabout, ".if \\n(%2s=0 .nr %2s 1\n",reg(icol,CMID), reg(icol,CMID));*/
fprintf(tabout, ".nr %2s +\\n(%2s\n", reg(icol, CMID), Bprint(&tabout, ".nr %2s +\\n(%2s\n", reg(icol, CMID),
reg(icol, CLEFT)); reg(icol, CLEFT));
/* fprintf(tabout, ".if n .if \\n(%s%%24>0 .nr %s +12u\n",reg(icol,CMID), reg(icol,CMID)); */ /* Bprint(&tabout, ".if n .if \\n(%s%%24>0 .nr %s +12u\n",reg(icol,CMID), reg(icol,CMID)); */
} }
tsep = sep[icol] * 2; tsep = sep[icol] * 2;
} }
if (rightl) if (rightl)
fprintf(tabout, ".nr %s (\\n(%s+\\n(%s)/2\n", reg(ncol - 1, CRIGHT), Bprint(&tabout, ".nr %s (\\n(%s+\\n(%s)/2\n", reg(ncol - 1, CRIGHT),
reg(ncol - 1, CLEFT), reg(ncol - 2, CRIGHT)); reg(ncol - 1, CLEFT), reg(ncol - 2, CRIGHT));
fprintf(tabout, ".nr TW \\n(%2s\n", reg(ncol - 1, CRIGHT)); Bprint(&tabout, ".nr TW \\n(%2s\n", reg(ncol - 1, CRIGHT));
tsep = sep[ncol-1]; tsep = sep[ncol-1];
if (boxflg || allflg || dboxflg) if (boxflg || allflg || dboxflg)
fprintf(tabout, ".nr TW +((%d*\\n(%d)/2)\n", tsep, TMP); Bprint(&tabout, ".nr TW +((%d*\\n(%d)/2)\n", tsep, TMP);
fprintf(tabout, Bprint(&tabout,
".if t .if (\\n(TW+\\n(.o)>7.65i .tm Table at line %d file %s is too wide - \\n(TW units\n", iline - 1, ifile); ".if t .if (\\n(TW+\\n(.o)>7.65i .tm Table at line %d file %s is too wide - \\n(TW units\n", iline - 1, ifile);
return; return;
} }
@ -198,19 +198,19 @@ void
wide(char *s, char *fn, char *size) wide(char *s, char *fn, char *size)
{ {
if (point(s)) { if (point(s)) {
fprintf(tabout, "\\w%c", F1); Bprint(&tabout, "\\w%c", F1);
if (*fn > 0) if (*fn > 0)
putfont(fn); putfont(fn);
if (*size) if (*size)
putsize(size); putsize(size);
fprintf(tabout, "%s", s); Bprint(&tabout, "%s", s);
if (*fn > 0) if (*fn > 0)
putfont("P"); putfont("P");
if (*size) if (*size)
putsize("0"); putsize("0");
fprintf(tabout, "%c", F1); Bprint(&tabout, "%c", F1);
} else } else
fprintf(tabout, "\\n(%c-", (int)s); Bprint(&tabout, "\\n(%c-", (int)s);
} }

View file

@ -10,21 +10,21 @@ runout(void)
if (boxflg || allflg || dboxflg) if (boxflg || allflg || dboxflg)
need(); need();
if (ctrflg) { if (ctrflg) {
fprintf(tabout, ".nr #I \\n(.i\n"); Bprint(&tabout, ".nr #I \\n(.i\n");
fprintf(tabout, ".in +(\\n(.lu-\\n(TWu-\\n(.iu)/2u\n"); Bprint(&tabout, ".in +(\\n(.lu-\\n(TWu-\\n(.iu)/2u\n");
} }
fprintf(tabout, ".fc %c %c\n", F1, F2); Bprint(&tabout, ".fc %c %c\n", F1, F2);
fprintf(tabout, ".nr #T 0-1\n"); Bprint(&tabout, ".nr #T 0-1\n");
deftail(); deftail();
for (i = 0; i < nlin; i++) for (i = 0; i < nlin; i++)
putline(i, i); putline(i, i);
if (leftover) if (leftover)
yetmore(); yetmore();
fprintf(tabout, ".fc\n"); Bprint(&tabout, ".fc\n");
fprintf(tabout, ".nr T. 1\n"); Bprint(&tabout, ".nr T. 1\n");
fprintf(tabout, ".T# 1\n"); Bprint(&tabout, ".T# 1\n");
if (ctrflg) if (ctrflg)
fprintf(tabout, ".in \\n(#Iu\n"); Bprint(&tabout, ".in \\n(#Iu\n");
} }
@ -33,7 +33,7 @@ runtabs(int lform, int ldata)
{ {
int c, ct, vforml, lf; int c, ct, vforml, lf;
fprintf(tabout, ".ta "); Bprint(&tabout, ".ta ");
for (c = 0; c < ncol; c++) { for (c = 0; c < ncol; c++) {
vforml = lform; vforml = lform;
for (lf = prev(lform); lf >= 0 && vspen(table[lf][c].col); lf = prev(lf)) for (lf = prev(lform); lf >= 0 && vspen(table[lf][c].col); lf = prev(lf))
@ -45,20 +45,20 @@ runtabs(int lform, int ldata)
case 'a': case 'a':
if (table[ldata][c].rcol) if (table[ldata][c].rcol)
if (lused[c]) /*Zero field width*/ if (lused[c]) /*Zero field width*/
fprintf(tabout, "\\n(%2su ", reg(c, CMID)); Bprint(&tabout, "\\n(%2su ", reg(c, CMID));
case 'c': case 'c':
case 'l': case 'l':
case 'r': case 'r':
if (realsplit ? rused[c] : (used[c] + lused[c])) if (realsplit ? rused[c] : (used[c] + lused[c]))
fprintf(tabout, "\\n(%2su ", reg(c, CRIGHT)); Bprint(&tabout, "\\n(%2su ", reg(c, CRIGHT));
continue; continue;
case 's': case 's':
if (lspan(lform, c)) if (lspan(lform, c))
fprintf(tabout, "\\n(%2su ", reg(c, CRIGHT)); Bprint(&tabout, "\\n(%2su ", reg(c, CRIGHT));
continue; continue;
} }
} }
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
} }
@ -92,7 +92,7 @@ need(void)
else else
texlin++; texlin++;
} }
fprintf(tabout, ".ne %dv+%dp\n", texlin, 2 * horlin); Bprint(&tabout, ".ne %dv+%dp\n", texlin, 2 * horlin);
} }
@ -103,48 +103,48 @@ deftail(void)
for (i = 0; i < MAXHEAD; i++) for (i = 0; i < MAXHEAD; i++)
if (linestop[i]) if (linestop[i])
fprintf(tabout, ".nr #%c 0-1\n", linestop[i] + 'a' - 1); Bprint(&tabout, ".nr #%c 0-1\n", linestop[i] + 'a' - 1);
fprintf(tabout, ".nr #a 0-1\n"); Bprint(&tabout, ".nr #a 0-1\n");
fprintf(tabout, ".eo\n"); Bprint(&tabout, ".eo\n");
fprintf(tabout, ".de T#\n"); Bprint(&tabout, ".de T#\n");
fprintf(tabout, ".nr 35 1m\n"); Bprint(&tabout, ".nr 35 1m\n");
fprintf(tabout, ".ds #d .d\n"); Bprint(&tabout, ".ds #d .d\n");
fprintf(tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n"); Bprint(&tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
fprintf(tabout, ".mk ##\n"); Bprint(&tabout, ".mk ##\n");
fprintf(tabout, ".nr ## -1v\n"); Bprint(&tabout, ".nr ## -1v\n");
fprintf(tabout, ".ls 1\n"); Bprint(&tabout, ".ls 1\n");
for (i = 0; i < MAXHEAD; i++) for (i = 0; i < MAXHEAD; i++)
if (linestop[i]) if (linestop[i])
fprintf(tabout, ".if \\n(#T>=0 .nr #%c \\n(#T\n", Bprint(&tabout, ".if \\n(#T>=0 .nr #%c \\n(#T\n",
linestop[i] + 'a' - 1); linestop[i] + 'a' - 1);
if (boxflg || allflg || dboxflg) /* bottom of table line */ if (boxflg || allflg || dboxflg) /* bottom of table line */
if (fullbot[nlin-1] == 0) { if (fullbot[nlin-1] == 0) {
if (!pr1403) if (!pr1403)
fprintf(tabout, ".if \\n(T. .vs \\n(.vu-\\n(.sp\n"); Bprint(&tabout, ".if \\n(T. .vs \\n(.vu-\\n(.sp\n");
fprintf(tabout, ".if \\n(T. "); Bprint(&tabout, ".if \\n(T. ");
drawline(nlin, 0, ncol, dboxflg ? '=' : '-', 1, 0); drawline(nlin, 0, ncol, dboxflg ? '=' : '-', 1, 0);
fprintf(tabout, "\n.if \\n(T. .vs\n"); 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 */ eqn we don't dare pass it as an argument and reference by $1 */
} }
for (c = 0; c < ncol; c++) { for (c = 0; c < ncol; c++) {
if ((lf = left(nlin - 1, c, &lwid)) >= 0) { if ((lf = left(nlin - 1, c, &lwid)) >= 0) {
fprintf(tabout, ".if \\n(#%c>=0 .sp -1\n", linestop[lf] + 'a' - 1); Bprint(&tabout, ".if \\n(#%c>=0 .sp -1\n", linestop[lf] + 'a' - 1);
fprintf(tabout, ".if \\n(#%c>=0 ", linestop[lf] + 'a' - 1); Bprint(&tabout, ".if \\n(#%c>=0 ", linestop[lf] + 'a' - 1);
tohcol(c); tohcol(c);
drawvert(lf, nlin - 1, c, lwid); drawvert(lf, nlin - 1, c, lwid);
fprintf(tabout, "\\h'|\\n(TWu'\n"); Bprint(&tabout, "\\h'|\\n(TWu'\n");
} }
} }
if (boxflg || allflg || dboxflg) /* right hand line */ { if (boxflg || allflg || dboxflg) /* right hand line */ {
fprintf(tabout, ".if \\n(#a>=0 .sp -1\n"); Bprint(&tabout, ".if \\n(#a>=0 .sp -1\n");
fprintf(tabout, ".if \\n(#a>=0 \\h'|\\n(TWu'"); Bprint(&tabout, ".if \\n(#a>=0 \\h'|\\n(TWu'");
drawvert (0, nlin - 1, ncol, dboxflg ? 2 : 1); drawvert (0, nlin - 1, ncol, dboxflg ? 2 : 1);
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
} }
fprintf(tabout, ".ls\n"); Bprint(&tabout, ".ls\n");
fprintf(tabout, "..\n"); Bprint(&tabout, "..\n");
fprintf(tabout, ".ec\n"); Bprint(&tabout, ".ec\n");
} }

View file

@ -28,19 +28,19 @@ putline(int i, int nl)
if (!vspen(s = table[ip][c].col)) if (!vspen(s = table[ip][c].col))
break; break;
if ((int)s > 0 && (int)s < 128) if ((int)s > 0 && (int)s < 128)
fprintf(tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s); Bprint(&tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s);
continue; continue;
} }
if (point(s)) if (point(s))
continue; continue;
fprintf(tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s); Bprint(&tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s);
watchout = 1; watchout = 1;
} }
if (linestop[nl]) if (linestop[nl])
fprintf(tabout, ".mk #%c\n", linestop[nl] + 'a' - 1); Bprint(&tabout, ".mk #%c\n", linestop[nl] + 'a' - 1);
lf = prev(nl); lf = prev(nl);
if (instead[nl]) { if (instead[nl]) {
fprintf(tabout, "%s\n", instead[nl]); Bprint(&tabout, "%s\n", instead[nl]);
return; return;
} }
if (fullbot[nl]) { if (fullbot[nl]) {
@ -60,8 +60,8 @@ putline(int i, int nl)
vspf = 1; vspf = 1;
} }
if (vspf) { if (vspf) {
fprintf(tabout, ".nr #^ \\n(\\*(#du\n"); Bprint(&tabout, ".nr #^ \\n(\\*(#du\n");
fprintf(tabout, ".nr #- \\n(#^\n"); /* current line position relative to bottom */ Bprint(&tabout, ".nr #- \\n(#^\n"); /* current line position relative to bottom */
} }
vspf = 0; vspf = 0;
chfont = 0; chfont = 0;
@ -74,11 +74,11 @@ putline(int i, int nl)
continue; continue;
lf = prev(nl); lf = prev(nl);
if (lf >= 0 && vspen(table[lf][c].col)) if (lf >= 0 && vspen(table[lf][c].col))
fprintf(tabout, Bprint(&tabout,
".if (\\n(%c|+\\n(^%c-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(^%c-\\n(#--1v)\n", ".if (\\n(%c|+\\n(^%c-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(^%c-\\n(#--1v)\n",
(int)s, 'a' + c, (int)s, 'a' + c); (int)s, 'a' + c, (int)s, 'a' + c);
else else
fprintf(tabout, Bprint(&tabout,
".if (\\n(%c|+\\n(#^-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(#^-\\n(#--1v)\n", ".if (\\n(%c|+\\n(#^-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(#^-\\n(#--1v)\n",
(int)s, (int)s); (int)s, (int)s);
} }
@ -87,14 +87,14 @@ putline(int i, int nl)
once = 1; once = 1;
runtabs(i, nl); runtabs(i, nl);
if (allh(i) && !pr1403) { if (allh(i) && !pr1403) {
fprintf(tabout, ".nr %d \\n(.v\n", SVS); Bprint(&tabout, ".nr %d \\n(.v\n", SVS);
fprintf(tabout, ".vs \\n(.vu-\\n(.sp\n"); Bprint(&tabout, ".vs \\n(.vu-\\n(.sp\n");
fprintf(tabout, ".nr 35 \\n(.vu\n"); Bprint(&tabout, ".nr 35 \\n(.vu\n");
} else } else
fprintf(tabout, ".nr 35 1m\n"); Bprint(&tabout, ".nr 35 1m\n");
if (chfont) if (chfont)
fprintf(tabout, ".nr %2d \\n(.f\n", S1); Bprint(&tabout, ".nr %2d \\n(.f\n", S1);
fprintf(tabout, "\\&"); Bprint(&tabout, "\\&");
vct = 0; vct = 0;
for (c = 0; c < ncol; c++) { for (c = 0; c < ncol; c++) {
uphalf = 0; uphalf = 0;
@ -115,7 +115,7 @@ putline(int i, int nl)
rct = reg(c, CMID); 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); rct = reg(c, CMID);
fprintf(tabout, "\\h'|\\n(%2su'", rct); Bprint(&tabout, "\\h'|\\n(%2su'", rct);
} }
s = table[nl][c].col; s = table[nl][c].col;
fn = font[c][stynum[vforml]]; fn = font[c][stynum[vforml]];
@ -133,27 +133,27 @@ putline(int i, int nl)
if (ip >= 0) if (ip >= 0)
if (vspen(table[ip][c].col)) { if (vspen(table[ip][c].col)) {
if (exvspen == 0) { if (exvspen == 0) {
fprintf(tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a'); Bprint(&tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a');
if (cmidx) if (cmidx)
/* code folded from here */ /* code folded from here */
fprintf(tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a'); Bprint(&tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
/* unfolding */ /* unfolding */
vct++; vct++;
if (pr1403) /* must round to whole lines */ if (pr1403) /* must round to whole lines */
/* code folded from here */ /* code folded from here */
fprintf(tabout, "/1v*1v"); Bprint(&tabout, "/1v*1v");
/* unfolding */ /* unfolding */
fprintf(tabout, "'"); Bprint(&tabout, "'");
exvspen = 1; exvspen = 1;
} }
} }
fprintf(tabout, "%c%c", F1, F2); Bprint(&tabout, "%c%c", F1, F2);
if (uphalf) if (uphalf)
fprintf(tabout, "\\u"); Bprint(&tabout, "\\u");
puttext(s, fn, size); puttext(s, fn, size);
if (uphalf) if (uphalf)
fprintf(tabout, "\\d"); Bprint(&tabout, "\\d");
fprintf(tabout, "%c", F1); Bprint(&tabout, "%c", F1);
} }
s = table[nl][c].rcol; s = table[nl][c].rcol;
form = 1; form = 1;
@ -171,7 +171,7 @@ putline(int i, int nl)
case '-': case '-':
case '=': case '=':
if (real(table[nl][c].col)) if (real(table[nl][c].col))
fprintf(stderr, "%s: line %d: Data ignored on table line %d\n", ifile, iline - 1, i + 1); fprint(2, "%s: line %d: Data ignored on table line %d\n", ifile, iline - 1, i + 1);
makeline(i, c, ct); makeline(i, c, ct);
continue; continue;
default: default:
@ -184,7 +184,7 @@ putline(int i, int nl)
continue; continue;
} }
if (filler(s)) { if (filler(s)) {
fprintf(tabout, "\\l'|\\n(%2su\\&%s'", reg(c, CRIGHT), s + 2); Bprint(&tabout, "\\l'|\\n(%2su\\&%s'", reg(c, CRIGHT), s + 2);
continue; continue;
} }
ip = prev(nl); ip = prev(nl);
@ -192,68 +192,67 @@ putline(int i, int nl)
if (ip >= 0) if (ip >= 0)
if (vspen(table[ip][c].col)) { if (vspen(table[ip][c].col)) {
if (exvspen == 0) { if (exvspen == 0) {
fprintf(tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a'); Bprint(&tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a');
if (cmidx) if (cmidx)
fprintf(tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a'); Bprint(&tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
vct++; vct++;
if (pr1403) /* round to whole lines */ if (pr1403) /* round to whole lines */
fprintf(tabout, "/1v*1v"); Bprint(&tabout, "/1v*1v");
fprintf(tabout, "'"); Bprint(&tabout, "'");
} }
} }
fprintf(tabout, "%c", F1); Bprint(&tabout, "%c", F1);
if (form != 1) if (form != 1)
fprintf(tabout, "%c", F2); Bprint(&tabout, "%c", F2);
if (vspen(s)) if (vspen(s))
vspf = 1; vspf = 1;
else else
{ {
if (uphalf) if (uphalf)
fprintf(tabout, "\\u"); Bprint(&tabout, "\\u");
puttext(s, fn, size); puttext(s, fn, size);
if (uphalf) if (uphalf)
fprintf(tabout, "\\d"); Bprint(&tabout, "\\d");
} }
if (form != 2) if (form != 2)
fprintf(tabout, "%c", F2); Bprint(&tabout, "%c", F2);
fprintf(tabout, "%c", F1); Bprint(&tabout, "%c", F1);
} }
ip = prev(nl); ip = prev(nl);
if (ip >= 0) { if (ip >= 0)
if (vspen(table[ip][c].col)) { if (vspen(table[ip][c].col)) {
exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) && exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) &&
(topat[c] == topat[c+1]) && (topat[c] == topat[c+1]) &&
(cmidx == ((flags[c+1] [stynum[nl]] & (CTOP | CDOWN)) == 0)) (cmidx == (flags[c+1] [stynum[nl]] & (CTOP | CDOWN) == 0))
&& (left(i, c + 1, &lwid) < 0); && (left(i, c + 1, &lwid) < 0);
if (exvspen == 0) { if (exvspen == 0) {
fprintf(tabout, "\\v'(\\n(\\*(#du-\\n(^%cu", c + 'a'); Bprint(&tabout, "\\v'(\\n(\\*(#du-\\n(^%cu", c + 'a');
if (cmidx) if (cmidx)
fprintf(tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a'); Bprint(&tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
vct++; vct++;
if (pr1403) /* round to whole lines */ if (pr1403) /* round to whole lines */
fprintf(tabout, "/1v*1v"); Bprint(&tabout, "/1v*1v");
fprintf(tabout, "'"); Bprint(&tabout, "'");
} }
} }
else else
exvspen = 0; exvspen = 0;
}
/* if lines need to be split for gcos here is the place for a backslash */ /* if lines need to be split for gcos here is the place for a backslash */
if (vct > 7 && c < ncol) { if (vct > 7 && c < ncol) {
fprintf(tabout, "\n.sp-1\n\\&"); Bprint(&tabout, "\n.sp-1\n\\&");
vct = 0; vct = 0;
} }
} }
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
if (allh(i) && !pr1403) if (allh(i) && !pr1403)
fprintf(tabout, ".vs \\n(%du\n", SVS); Bprint(&tabout, ".vs \\n(%du\n", SVS);
if (watchout) if (watchout)
funnies(i, nl); funnies(i, nl);
if (vspf) { if (vspf) {
for (c = 0; c < ncol; c++) for (c = 0; c < ncol; c++)
if (vspen(table[nl][c].col) && (nl == 0 || (lf = prev(nl)) < 0 || if (vspen(table[nl][c].col) && (nl == 0 || (lf = prev(nl)) < 0 ||
!vspen(table[lf][c].col))) { !vspen(table[lf][c].col))) {
fprintf(tabout, ".nr ^%c \\n(#^u\n", 'a' + c); Bprint(&tabout, ".nr ^%c \\n(#^u\n", 'a' + c);
topat[c] = nl; topat[c] = nl;
} }
} }
@ -266,9 +265,9 @@ puttext(char *s, char *fn, char *size)
if (point(s)) { if (point(s)) {
putfont(fn); putfont(fn);
putsize(size); putsize(size);
fprintf(tabout, "%s", s); Bprint(&tabout, "%s", s);
if (*fn > 0) if (*fn > 0)
fprintf(tabout, "\\f\\n(%2d", S1); Bprint(&tabout, "\\f\\n(%2d", S1);
if (size != 0) if (size != 0)
putsize("0"); putsize("0");
} }
@ -282,8 +281,8 @@ funnies(int stl, int lin)
int c, s, pl, lwid, dv, lf, ct; int c, s, pl, lwid, dv, lf, ct;
char *fn, *ss; char *fn, *ss;
fprintf(tabout, ".mk ##\n"); /* rmember current vertical position */ Bprint(&tabout, ".mk ##\n"); /* rmember current vertical position */
fprintf(tabout, ".nr %d \\n(##\n", S1); /* bottom position */ Bprint(&tabout, ".nr %d \\n(##\n", S1); /* bottom position */
for (c = 0; c < ncol; c++) { for (c = 0; c < ncol; c++) {
ss = table[lin][c].col; ss = table[lin][c].col;
if (point(ss)) if (point(ss))
@ -291,62 +290,62 @@ funnies(int stl, int lin)
if (ss == 0) if (ss == 0)
continue; continue;
s = (int)ss; s = (int)ss;
fprintf(tabout, ".sp |\\n(##u-1v\n"); Bprint(&tabout, ".sp |\\n(##u-1v\n");
fprintf(tabout, ".nr %d ", SIND); Bprint(&tabout, ".nr %d ", SIND);
ct = 0; ct = 0;
for (pl = stl; pl >= 0 && !isalpha(ct = ctype(pl, c)); pl = prev(pl)) for (pl = stl; pl >= 0 && !isalpha(ct = ctype(pl, c)); pl = prev(pl))
; ;
switch (ct) { switch (ct) {
case 'n': case 'n':
case 'c': case 'c':
fprintf(tabout, "(\\n(%2su+\\n(%2su-\\n(%c-u)/2u\n", reg(c, CLEFT), Bprint(&tabout, "(\\n(%2su+\\n(%2su-\\n(%c-u)/2u\n", reg(c, CLEFT),
reg(c - 1 + ctspan(lin, c), CRIGHT), reg(c - 1 + ctspan(lin, c), CRIGHT),
s); s);
break; break;
case 'l': case 'l':
fprintf(tabout, "\\n(%2su\n", reg(c, CLEFT)); Bprint(&tabout, "\\n(%2su\n", reg(c, CLEFT));
break; break;
case 'a': case 'a':
fprintf(tabout, "\\n(%2su\n", reg(c, CMID)); Bprint(&tabout, "\\n(%2su\n", reg(c, CMID));
break; break;
case 'r': case 'r':
fprintf(tabout, "\\n(%2su-\\n(%c-u\n", reg(c, CRIGHT), s); Bprint(&tabout, "\\n(%2su-\\n(%c-u\n", reg(c, CRIGHT), s);
break; break;
} }
fprintf(tabout, ".in +\\n(%du\n", SIND); Bprint(&tabout, ".in +\\n(%du\n", SIND);
fn = font[c][stynum[stl]]; fn = font[c][stynum[stl]];
putfont(fn); putfont(fn);
pl = prev(stl); pl = prev(stl);
if (stl > 0 && pl >= 0 && vspen(table[pl][c].col)) { if (stl > 0 && pl >= 0 && vspen(table[pl][c].col)) {
fprintf(tabout, ".sp |\\n(^%cu\n", 'a' + c); Bprint(&tabout, ".sp |\\n(^%cu\n", 'a' + c);
if ((flags[c][stynum[stl]] & (CTOP | CDOWN)) == 0) { if ((flags[c][stynum[stl]] & (CTOP | CDOWN)) == 0) {
fprintf(tabout, ".nr %d \\n(#-u-\\n(^%c-\\n(%c|+1v\n", Bprint(&tabout, ".nr %d \\n(#-u-\\n(^%c-\\n(%c|+1v\n",
TMP, 'a' + c, s); TMP, 'a' + c, s);
fprintf(tabout, ".if \\n(%d>0 .sp \\n(%du/2u", TMP, TMP); Bprint(&tabout, ".if \\n(%d>0 .sp \\n(%du/2u", TMP, TMP);
if (pr1403) /* round */ if (pr1403) /* round */
fprintf(tabout, "/1v*1v"); Bprint(&tabout, "/1v*1v");
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
} }
} }
fprintf(tabout, ".%c+\n", s); Bprint(&tabout, ".%c+\n", s);
fprintf(tabout, ".in -\\n(%du\n", SIND); Bprint(&tabout, ".in -\\n(%du\n", SIND);
if (*fn > 0) if (*fn > 0)
putfont("P"); putfont("P");
fprintf(tabout, ".mk %d\n", S2); Bprint(&tabout, ".mk %d\n", S2);
fprintf(tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2, S1, S1, S2); Bprint(&tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2, S1, S1, S2);
} }
fprintf(tabout, ".sp |\\n(%du\n", S1); Bprint(&tabout, ".sp |\\n(%du\n", S1);
for (c = dv = 0; c < ncol; c++) { for (c = dv = 0; c < ncol; c++) {
if (stl + 1 < nlin && (lf = left(stl, c, &lwid)) >= 0) { if (stl + 1 < nlin && (lf = left(stl, c, &lwid)) >= 0) {
if (dv++ == 0) if (dv++ == 0)
fprintf(tabout, ".sp -1\n"); Bprint(&tabout, ".sp -1\n");
tohcol(c); tohcol(c);
dv++; dv++;
drawvert(lf, stl, c, lwid); drawvert(lf, stl, c, lwid);
} }
} }
if (dv) if (dv)
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
} }
@ -354,7 +353,7 @@ void
putfont(char *fn) putfont(char *fn)
{ {
if (fn && *fn) if (fn && *fn)
fprintf(tabout, fn[1] ? "\\f(%.2s" : "\\f%.2s", fn); Bprint(&tabout, fn[1] ? "\\f(%.2s" : "\\f%.2s", fn);
} }
@ -362,7 +361,7 @@ void
putsize(char *s) putsize(char *s)
{ {
if (s && *s) if (s && *s)
fprintf(tabout, "\\s%s", s); Bprint(&tabout, "\\s%s", s);
} }

View file

@ -30,7 +30,7 @@ domore(char *dataln)
if (prefix(".TE", dataln)) if (prefix(".TE", dataln))
return(0); return(0);
if (dataln[0] == '.' && !isdigit(dataln[1])) { if (dataln[0] == '.' && !isdigit(dataln[1])) {
fprintf(tabout, "%s\n", dataln); Bprint(&tabout, "%s\n", dataln);
return(1); return(1);
} }
fullbot[0] = 0; fullbot[0] = 0;

View file

@ -4,9 +4,9 @@
void void
choochar(void) choochar(void)
{ {
/* choose funny characters to delimit fields */ /* choose funny characters to delimit fields */
int had[128], ilin, icol, k; int had[128], ilin, icol, k;
unsigned char *s; unsigned char *s;
for (icol = 0; icol < 128; icol++) for (icol = 0; icol < 128; icol++)
had[icol] = 0; had[icol] = 0;

View file

@ -4,9 +4,9 @@
void void
error(char *s) error(char *s)
{ {
fprintf(stderr, "\n%s:%d: %s\n", ifile, iline, s); fprint(2, "\n%s:%d: %s\n", ifile, iline, s);
fprintf(stderr, "tbl quits\n"); fprint(2, "tbl quits\n");
exit(1); exits(s);
} }
@ -18,14 +18,13 @@ gets1(char *s, int size)
iline++; iline++;
ns = s; ns = s;
p = fgetln(tabin, &nbl); p = Brdline(tabin, '\n');
while (p == 0) { while (p == 0) {
if (swapin() == 0) if (swapin() == 0)
return(0); return(0);
p = fgetln(tabin, &nbl); p = Brdline(tabin, '\n');
} }
if(p != 0 && p[nbl-1] == '\n') nbl = Blinelen(tabin)-1;
nbl--;
if(nbl >= size) if(nbl >= size)
error("input buffer too small"); error("input buffer too small");
p[nbl] = 0; p[nbl] = 0;
@ -62,11 +61,11 @@ get1char(void)
if (backp > backup) if (backp > backup)
c = *--backp; c = *--backp;
else else
c = fgetc(tabin); c = Bgetc(tabin);
if (c == 0) /* EOF */ { if (c == 0) /* EOF */ {
if (swapin() == 0) if (swapin() == 0)
error("unexpected EOF"); error("unexpected EOF");
c = fgetc(tabin); c = Bgetc(tabin);
} }
if (c == '\n') if (c == '\n')
iline++; iline++;

View file

@ -5,25 +5,25 @@ void
savefill(void) savefill(void)
{ {
/* remembers various things: fill mode, vs, ps in mac 35 (SF) */ /* remembers various things: fill mode, vs, ps in mac 35 (SF) */
fprintf(tabout, ".de %d\n", SF); Bprint(&tabout, ".de %d\n", SF);
fprintf(tabout, ".ps \\n(.s\n"); Bprint(&tabout, ".ps \\n(.s\n");
fprintf(tabout, ".vs \\n(.vu\n"); Bprint(&tabout, ".vs \\n(.vu\n");
fprintf(tabout, ".in \\n(.iu\n"); Bprint(&tabout, ".in \\n(.iu\n");
fprintf(tabout, ".if \\n(.u .fi\n"); Bprint(&tabout, ".if \\n(.u .fi\n");
fprintf(tabout, ".if \\n(.j .ad\n"); Bprint(&tabout, ".if \\n(.j .ad\n");
fprintf(tabout, ".if \\n(.j=0 .na\n"); Bprint(&tabout, ".if \\n(.j=0 .na\n");
fprintf(tabout, "..\n"); Bprint(&tabout, "..\n");
fprintf(tabout, ".nf\n"); Bprint(&tabout, ".nf\n");
/* set obx offset if useful */ /* set obx offset if useful */
fprintf(tabout, ".nr #~ 0\n"); Bprint(&tabout, ".nr #~ 0\n");
fprintf(tabout, ".if \\n(.T .if n .nr #~ 0.6n\n"); Bprint(&tabout, ".if \\n(.T .if n .nr #~ 0.6n\n");
} }
void void
rstofill(void) rstofill(void)
{ {
fprintf(tabout, ".%d\n", SF); Bprint(&tabout, ".%d\n", SF);
} }
@ -34,25 +34,25 @@ endoff(void)
for (i = 0; i < MAXHEAD; i++) for (i = 0; i < MAXHEAD; i++)
if (linestop[i]) if (linestop[i])
fprintf(tabout, ".nr #%c 0\n", linestop[i] + 'a' - 1); Bprint(&tabout, ".nr #%c 0\n", linestop[i] + 'a' - 1);
for (i = 0; i < texct; i++) for (i = 0; i < texct; i++)
fprintf(tabout, ".rm %c+\n", texstr[i]); Bprint(&tabout, ".rm %c+\n", texstr[i]);
fprintf(tabout, "%s\n", last); Bprint(&tabout, "%s\n", last);
} }
void void
ifdivert(void) ifdivert(void)
{ {
fprintf(tabout, ".ds #d .d\n"); Bprint(&tabout, ".ds #d .d\n");
fprintf(tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n"); Bprint(&tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
} }
void void
saveline(void) saveline(void)
{ {
fprintf(tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n"); Bprint(&tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n");
linstart = iline; linstart = iline;
} }
@ -60,7 +60,7 @@ saveline(void)
void void
restline(void) restline(void)
{ {
fprintf(tabout, ".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline - linstart); Bprint(&tabout, ".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline - linstart);
linstart = 0; linstart = 0;
} }
@ -68,7 +68,7 @@ restline(void)
void void
cleanfc(void) cleanfc(void)
{ {
fprintf(tabout, ".fc\n"); Bprint(&tabout, ".fc\n");
} }

View file

@ -12,53 +12,53 @@ gettext(char *sp, int ilin, int icol, char *fn, char *sz)
if (texname == 0) if (texname == 0)
error("Too many text block diversions"); error("Too many text block diversions");
if (textflg == 0) { if (textflg == 0) {
fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */ Bprint(&tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
textflg = 1; textflg = 1;
} }
fprintf(tabout, ".eo\n"); Bprint(&tabout, ".eo\n");
fprintf(tabout, ".am %s\n", reg(icol, CRIGHT)); Bprint(&tabout, ".am %s\n", reg(icol, CRIGHT));
fprintf(tabout, ".br\n"); Bprint(&tabout, ".br\n");
fprintf(tabout, ".di %c+\n", texname); Bprint(&tabout, ".di %c+\n", texname);
rstofill(); rstofill();
if (fn && *fn) if (fn && *fn)
fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn); Bprint(&tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
fprintf(tabout, ".ft \\n(.f\n"); /* protect font */ Bprint(&tabout, ".ft \\n(.f\n"); /* protect font */
vs = vsize[icol][stynum[ilin]]; vs = vsize[icol][stynum[ilin]];
if ((sz && *sz) || (vs && *vs)) { if ((sz && *sz) || (vs && *vs)) {
fprintf(tabout, ".nr %d \\n(.v\n", S9); Bprint(&tabout, ".nr %d \\n(.v\n", S9);
if (vs == 0 || *vs == 0) if (vs == 0 || *vs == 0)
vs = "\\n(.s+2"; vs = "\\n(.s+2";
if (sz && *sz) if (sz && *sz)
fprintf(tabout, ".ps %s\n", sz); Bprint(&tabout, ".ps %s\n", sz);
fprintf(tabout, ".vs %s\n", vs); Bprint(&tabout, ".vs %s\n", vs);
fprintf(tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S9, S9); Bprint(&tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S9, S9);
} }
if (cll[icol][0]) if (cll[icol][0])
fprintf(tabout, ".ll %sn\n", cll[icol]); Bprint(&tabout, ".ll %sn\n", cll[icol]);
else else
fprintf(tabout, ".ll \\n(%du*%du/%du\n", SL, ctspan(ilin, icol), ncol + 1); Bprint(&tabout, ".ll \\n(%du*%du/%du\n", SL, ctspan(ilin, icol), ncol + 1);
fprintf(tabout, ".if \\n(.l<\\n(%2s .ll \\n(%2su\n", reg(icol, CRIGHT), Bprint(&tabout, ".if \\n(.l<\\n(%2s .ll \\n(%2su\n", reg(icol, CRIGHT),
reg(icol, CRIGHT)); reg(icol, CRIGHT));
if (ctype(ilin, icol) == 'a') if (ctype(ilin, icol) == 'a')
fprintf(tabout, ".ll -2n\n"); Bprint(&tabout, ".ll -2n\n");
fprintf(tabout, ".in 0\n"); Bprint(&tabout, ".in 0\n");
while (gets1(line, sizeof(line))) { while (gets1(line, sizeof(line))) {
if (line[0] == 'T' && line[1] == '}' && line[2] == tab) if (line[0] == 'T' && line[1] == '}' && line[2] == tab)
break; break;
if (match("T}", line)) if (match("T}", line))
break; break;
fprintf(tabout, "%s\n", line); Bprint(&tabout, "%s\n", line);
} }
if (fn && *fn) if (fn && *fn)
fprintf(tabout, ".ft \\n(%d\n", S1); Bprint(&tabout, ".ft \\n(%d\n", S1);
if (sz && *sz) if (sz && *sz)
fprintf(tabout, ".br\n.ps\n.vs\n"); Bprint(&tabout, ".br\n.ps\n.vs\n");
fprintf(tabout, ".br\n"); Bprint(&tabout, ".br\n");
fprintf(tabout, ".di\n"); Bprint(&tabout, ".di\n");
fprintf(tabout, ".nr %c| \\n(dn\n", texname); Bprint(&tabout, ".nr %c| \\n(dn\n", texname);
fprintf(tabout, ".nr %c- \\n(dl\n", texname); Bprint(&tabout, ".nr %c- \\n(dl\n", texname);
fprintf(tabout, "..\n"); Bprint(&tabout, "..\n");
fprintf(tabout, ".ec \\\n"); Bprint(&tabout, ".ec \\\n");
/* copy remainder of line */ /* copy remainder of line */
if (line[2]) if (line[2])
tcopy (sp, line + 3); tcopy (sp, line + 3);
@ -74,8 +74,8 @@ void
untext(void) untext(void)
{ {
rstofill(); rstofill();
fprintf(tabout, ".nf\n"); Bprint(&tabout, ".nf\n");
fprintf(tabout, ".ll \\n(%du\n", SL); Bprint(&tabout, ".ll \\n(%du\n", SL);
} }

View file

@ -9,14 +9,14 @@ maknew(char *str)
char *p, *q, *ba; char *p, *q, *ba;
p = str; p = str;
for (ba = 0; (c = *str); str++) for (ba = 0; c = *str; str++)
if (c == '\\' && *(str + 1) == '&') if (c == '\\' && *(str + 1) == '&')
ba = str; ba = str;
str = p; str = p;
if (ba == 0) { if (ba == 0) {
for (dpoint = 0; *str; str++) { for (dpoint = 0; *str; str++) {
if (*str == '.' && !ineqn(str, p) && if (*str == '.' && !ineqn(str, p) &&
((str > p && digit(*(str - 1))) || (str > p && digit(*(str - 1)) ||
digit(*(str + 1)))) digit(*(str + 1))))
dpoint = (int)str; dpoint = (int)str;
} }
@ -37,7 +37,7 @@ maknew(char *str)
exlim = exstore + MAXCHS; exlim = exstore + MAXCHS;
} }
q = exstore; q = exstore;
while ((*exstore++ = *str++)) while (*exstore++ = *str++)
; ;
*p = 0; *p = 0;
return(q); return(q);
@ -50,7 +50,7 @@ ineqn (char *s, char *p)
/* true if s is in a eqn within p */ /* true if s is in a eqn within p */
int ineq = 0, c; int ineq = 0, c;
while ((c = *p)) { while (c = *p) {
if (s == p) if (s == p)
return(ineq); return(ineq);
p++; p++;

View file

@ -64,7 +64,7 @@ max(int a, int b)
void void
tcopy (char *s, char *t) tcopy (char *s, char *t)
{ {
while ((*s++ = *t++)) while (*s++ = *t++)
; ;
} }

View file

@ -59,9 +59,9 @@ void
tohcol(int ic) tohcol(int ic)
{ {
if (ic == 0) if (ic == 0)
fprintf(tabout, "\\h'|0'"); Bprint(&tabout, "\\h'|0'");
else else
fprintf(tabout, "\\h'(|\\n(%2su+|\\n(%2su)/2u'", reg(ic, CLEFT), Bprint(&tabout, "\\h'(|\\n(%2su+|\\n(%2su)/2u'", reg(ic, CLEFT),
reg(ic - 1, CRIGHT)); reg(ic - 1, CRIGHT));
} }
@ -119,7 +119,7 @@ thish(int i, int c)
return(1); return(1);
if (vspen(s)) if (vspen(s))
return(1); return(1);
if ((t = barent( s))) if (t = barent( s))
return(t); return(t);
return(0); return(0);
} }

View file

@ -28,7 +28,7 @@ fullwide(int i, int lintype)
int cr, cl; int cr, cl;
if (!pr1403) if (!pr1403)
fprintf(tabout, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS); Bprint(&tabout, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS);
cr = 0; cr = 0;
while (cr < ncol) { while (cr < ncol) {
cl = cr; cl = cr;
@ -40,9 +40,9 @@ fullwide(int i, int lintype)
if (cl < ncol) if (cl < ncol)
drawline(i, cl, (cr < ncol ? cr - 1 : cr), lintype, 1, 0); drawline(i, cl, (cr < ncol ? cr - 1 : cr), lintype, 1, 0);
} }
fprintf(tabout, "\n"); Bprint(&tabout, "\n");
if (!pr1403) if (!pr1403)
fprintf(tabout, ".vs \\n(%du\n", SVS); Bprint(&tabout, ".vs \\n(%du\n", SVS);
} }
@ -69,11 +69,11 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
return; return;
nodata = cr - cl >= ncol || noheight || allh(i); nodata = cr - cl >= ncol || noheight || allh(i);
if (!nodata) if (!nodata)
fprintf(tabout, "\\v'-.5m'"); Bprint(&tabout, "\\v'-.5m'");
for (ln = oldpos = 0; ln < lcount; ln++) { for (ln = oldpos = 0; ln < lcount; ln++) {
linpos = 2 * ln - lcount + 1; linpos = 2 * ln - lcount + 1;
if (linpos != oldpos) if (linpos != oldpos)
fprintf(tabout, "\\v'%dp'", linpos - oldpos); Bprint(&tabout, "\\v'%dp'", linpos - oldpos);
oldpos = linpos; oldpos = linpos;
if (shortl == 0) { if (shortl == 0) {
tohcol(cl); tohcol(cl);
@ -90,7 +90,7 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
break; break;
} }
if (exhl[0]) if (exhl[0])
fprintf(tabout, "\\h'%s'", exhl); Bprint(&tabout, "\\h'%s'", exhl);
} else if (lcount == 1) { } else if (lcount == 1) {
switch (interv(i, cl)) { switch (interv(i, cl)) {
case TOP: case TOP:
@ -102,7 +102,7 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
break; break;
} }
if (exhl[0]) if (exhl[0])
fprintf(tabout, "\\h'%s'", exhl); Bprint(&tabout, "\\h'%s'", exhl);
} }
if (lcount > 1) { if (lcount > 1) {
switch (interv(i, cr + 1)) { switch (interv(i, cr + 1)) {
@ -128,31 +128,31 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
} }
} }
} else } else
fprintf(tabout, "\\h'|\\n(%2su'", reg(cl, CLEFT)); Bprint(&tabout, "\\h'|\\n(%2su'", reg(cl, CLEFT));
fprintf(tabout, "\\s\\n(%d", LSIZE); Bprint(&tabout, "\\s\\n(%d", LSIZE);
if (linsize) if (linsize)
fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE); Bprint(&tabout, "\\v'-\\n(%dp/6u'", LSIZE);
if (shortl) if (shortl)
fprintf(tabout, "\\l'|\\n(%2su'", reg(cr, CRIGHT)); Bprint(&tabout, "\\l'|\\n(%2su'", reg(cr, CRIGHT));
else else
{ {
lnch = "\\(ul"; lnch = "\\(ul";
if (pr1403) if (pr1403)
lnch = lintype == 2 ? "=" : "\\(ru"; lnch = lintype == 2 ? "=" : "\\(ru";
if (cr + 1 >= ncol) if (cr + 1 >= ncol)
fprintf(tabout, "\\l'|\\n(TWu%s%s'", exhr, lnch); Bprint(&tabout, "\\l'|\\n(TWu%s%s'", exhr, lnch);
else else
fprintf(tabout, "\\l'(|\\n(%2su+|\\n(%2su)/2u%s%s'", reg(cr, CRIGHT), Bprint(&tabout, "\\l'(|\\n(%2su+|\\n(%2su)/2u%s%s'", reg(cr, CRIGHT),
reg(cr + 1, CLEFT), exhr, lnch); reg(cr + 1, CLEFT), exhr, lnch);
} }
if (linsize) if (linsize)
fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE); Bprint(&tabout, "\\v'\\n(%dp/6u'", LSIZE);
fprintf(tabout, "\\s0"); Bprint(&tabout, "\\s0");
} }
if (oldpos != 0) if (oldpos != 0)
fprintf(tabout, "\\v'%dp'", -oldpos); Bprint(&tabout, "\\v'%dp'", -oldpos);
if (!nodata) if (!nodata)
fprintf(tabout, "\\v'+.5m'"); Bprint(&tabout, "\\v'+.5m'");
} }

View file

@ -16,7 +16,7 @@ drawvert(int start, int end, int c, int lwid)
epb = ept = 0; epb = ept = 0;
pos = 2 * ln - lwid + 1; pos = 2 * ln - lwid + 1;
if (pos != tp) if (pos != tp)
fprintf(tabout, "\\h'%dp'", pos - tp); Bprint(&tabout, "\\h'%dp'", pos - tp);
tp = pos; tp = pos;
if (end < nlin) { if (end < nlin) {
if (fullbot[end] || (!instead[end] && allh(end))) if (fullbot[end] || (!instead[end] && allh(end)))
@ -102,33 +102,33 @@ drawvert(int start, int end, int c, int lwid)
break; break;
} }
if (exb) if (exb)
fprintf(tabout, "\\v'%s'", exb); Bprint(&tabout, "\\v'%s'", exb);
if (epb) if (epb)
fprintf(tabout, "\\v'%dp'", epb); Bprint(&tabout, "\\v'%dp'", epb);
fprintf(tabout, "\\s\\n(%d", LSIZE); Bprint(&tabout, "\\s\\n(%d", LSIZE);
if (linsize) if (linsize)
fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE); Bprint(&tabout, "\\v'-\\n(%dp/6u'", LSIZE);
fprintf(tabout, "\\h'-\\n(#~u'"); /* adjustment for T450 nroff boxes */ Bprint(&tabout, "\\h'-\\n(#~u'"); /* adjustment for T450 nroff boxes */
fprintf(tabout, "\\L'|\\n(#%cu-%s", linestop[start] + 'a' - 1, Bprint(&tabout, "\\L'|\\n(#%cu-%s", linestop[start] + 'a' - 1,
vm == 'v' ? "1v" : "\\n(35u"); vm == 'v' ? "1v" : "\\n(35u");
if (ext) if (ext)
fprintf(tabout, "-(%s)", ext); Bprint(&tabout, "-(%s)", ext);
if (exb) if (exb)
fprintf(tabout, "-(%s)", exb); Bprint(&tabout, "-(%s)", exb);
pos = ept - epb; pos = ept - epb;
if (pos) if (pos)
fprintf(tabout, "%s%dp", pos >= 0 ? "+" : "", pos); Bprint(&tabout, "%s%dp", pos >= 0 ? "+" : "", pos);
/* the string #d is either "nl" or ".d" depending /* the string #d is either "nl" or ".d" depending
on diversions; on GCOS not the same */ on diversions; on GCOS not the same */
fprintf(tabout, "'\\s0\\v'\\n(\\*(#du-\\n(#%cu+%s", Bprint(&tabout, "'\\s0\\v'\\n(\\*(#du-\\n(#%cu+%s",
linestop[start] + 'a' - 1, vm == 'v' ? "1v" : "\\n(35u"); linestop[start] + 'a' - 1, vm == 'v' ? "1v" : "\\n(35u");
if (ext) if (ext)
fprintf(tabout, "+%s", ext); Bprint(&tabout, "+%s", ext);
if (ept) if (ept)
fprintf(tabout, "%s%dp", (-ept) > 0 ? "+" : "", (-ept)); Bprint(&tabout, "%s%dp", (-ept) > 0 ? "+" : "", (-ept));
fprintf(tabout, "'"); Bprint(&tabout, "'");
if (linsize) if (linsize)
fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE); Bprint(&tabout, "\\v'\\n(%dp/6u'", LSIZE);
} }
} }
@ -154,7 +154,7 @@ midbcol(int i, int c)
c--; c--;
if (ct == '-' || ct == '=') if (ct == '-' || ct == '=')
return(ct); return(ct);
if ((ct = barent(table[i][c].col))) if (ct = barent(table[i][c].col))
return(ct); return(ct);
return(0); return(0);
} }