static char sccsid
[] = "@(#)t8.c 4.2 %G%";
/* t8.c: write out one line of output table */
# define realsplit ((ct=='a'||ct=='n') && table[nl][c].rcol)
/* i is line number for deciding format */
/* nl is line number for finding data usually identical */
int c
, lf
, ct
, form
, lwid
, vspf
, ip
, cmidx
, exvspen
, vforml
;
if (i
==0 && ( allflg
|| boxflg
|| dboxflg
))
fullwide(0, dboxflg
? '=' : '-');
if (instead
[nl
]==0 && fullbot
[nl
] ==0)
for(ip
=nl
; ip
<nlin
; ip
=next(ip
))
if (!vspen(s
=table
[ip
][c
].col
)) break;
fprintf(tabout
, ".ne \\n(%c|u+\\n(.Vu\n",s
);
fprintf(tabout
, ".ne \\n(%c|u+\\n(.Vu\n",s
);
fprintf(tabout
, ".mk #%c\n", linestop
[nl
]+'a'-1);
if (instead
[nl
]==0 && fullbot
[nl
]==0)
if (vspen(table
[nl
][c
].col
)) vspf
=1;
if (vspen(table
[lf
][c
].col
)) vspf
=1;
fprintf(tabout
, ".nr #^ \\n(\\*(#du\n");
fprintf(tabout
, ".nr #- \\n(#^\n"); /* current line position relative to bottom */
chfont
|= (int)(font
[stynum
[nl
]][c
]);
if (lf
>=0 && vspen(table
[lf
][c
].col
))
fprintf(tabout
, ".if (\\n(%c|+\\n(^%c-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(^%c-\\n(#--1v)\n",s
,'a'+c
,s
,'a'+c
);
fprintf(tabout
, ".if (\\n(%c|+\\n(#^-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(#^-\\n(#--1v)\n",s
,s
);
fprintf(tabout
, ".nr %d \\n(.v\n", SVS
);
fprintf(tabout
, ".vs \\n(.vu-\\n(.sp\n");
fprintf(tabout
, ".nr %2d \\n(.f\n", S1
);
fprintf(tabout
, ".nr 35 1m\n");
if (watchout
==0 && i
+1<nlin
&& (lf
=left(i
,c
, &lwid
))>=0)
drawvert(lf
, i
, c
, lwid
);
if (rightl
&& c
+1==ncol
) continue;
for(lf
=prev(nl
); lf
>=0 && vspen(table
[lf
][c
].col
); lf
=prev(lf
))
if (form
=='a') ct
= c
+CMID
;
if (form
=='n' && table
[nl
][c
].rcol
&& lused
[c
]==0) ct
= c
+CMID
;
fprintf(tabout
, "\\h'|\\n(%du'", ct
);
fn
= font
[stynum
[vforml
]][c
];
size
= csize
[stynum
[vforml
]][c
];
switch(ct
=ctype(vforml
, c
))
if (lused
[c
]) /*Zero field width*/
if (vspen(table
[ip
][c
].col
))
fprintf(tabout
, "\\v'-(\\n(\\*(#du-\\n(^%cu", c
+'a');
fprintf(tabout
, "-((\\n(#-u-\\n(^%cu)/2u)", c
+'a');
fprintf(tabout
, "%c%c",F1
,F2
);
fprintf(tabout
, "%c",F1
);
if (real(table
[nl
][c
].col
))
fprintf(stderr
,"%s: line %d: Data ignored on table line %d\n", ifile
, iline
-1, i
+1);
if (realsplit
? rused
[c
]: used
[c
]) /*Zero field width*/
/* form: 1 left, 2 right, 3 center adjust */
printf("\\l'|\\n(%du\\&%s'", c
+CRIGHT
, s
+2);
cmidx
= ctop
[stynum
[nl
]][c
]==0;
if (vspen(table
[ip
][c
].col
))
fprintf(tabout
, "\\v'-(\\n(\\*(#du-\\n(^%cu", c
+'a');
fprintf(tabout
, "-((\\n(#-u-\\n(^%cu)/2u)", c
+'a');
fprintf(tabout
, "%c", F1
);
fprintf(tabout
, "%c", F2
);
fprintf(tabout
, "%c", F2
);
fprintf(tabout
, "%c", F1
);
if (vspen(table
[ip
][c
].col
))
exvspen
= (c
+1 < ncol
) && vspen(table
[ip
][c
+1].col
) &&
(topat
[c
] == topat
[c
+1]) &&
(cmidx
== (ctop
[stynum
[nl
]][c
+1]==0)) && (left(i
,c
+1,&lwid
)<0);
fprintf(tabout
, "\\v'(\\n(\\*(#du-\\n(^%cu", c
+'a');
fprintf(tabout
, "-((\\n(#-u-\\n(^%cu)/2u)", c
+'a');
/* if lines need to be split for gcos here is the place for a backslash */
fprintf(tabout
, "\n.sp-1\n\\&");
if (allh(i
) && !pr1403
) fprintf(tabout
, ".vs \\n(%du\n", SVS
);
if (vspen(table
[nl
][c
].col
) && (nl
==0 || (lf
=prev(nl
))<0 || !vspen(table
[lf
][c
].col
)))
fprintf(tabout
, ".nr ^%c \\n(#^u\n", 'a'+c
);
if (*fn
>0) fprintf(tabout
, "\\f\\n(%2d", S1
);
if (size
!=0) putsize("0");
/* write out funny diverted things */
int c
, s
, pl
, lwid
, dv
, lf
, ct
;
fprintf(tabout
, ".mk ##\n"); /* rmember current vertical position */
fprintf(tabout
, ".nr %d \\n(##\n", S1
); /* bottom position */
fprintf(tabout
, ".sp |\\n(##u-1v\n");
fprintf(tabout
, ".nr %d ", SIND
);
for(pl
=stl
; pl
>=0 && !isalpha(ct
=ctype(pl
,c
)); pl
=prev(pl
))
fprintf(tabout
, "(\\n(%du+\\n(%du-\\n(%c-u)/2u\n",c
+CLEFT
,c
-1+ctspan(lin
,c
)+CRIGHT
, s
);
fprintf(tabout
, "\\n(%du\n",c
+CLEFT
);
fprintf(tabout
, "\\n(%du\n",c
+CMID
);
fprintf(tabout
, "\\n(%du-\\n(%c-u\n", c
+CRIGHT
, s
);
fprintf(tabout
, ".in +\\n(%du\n", SIND
);
if (stl
>0 && pl
>=0 && vspen(table
[pl
][c
].col
))
fprintf(tabout
, ".sp |\\n(^%cu\n", 'a'+c
);
if (ctop
[stynum
[stl
]][c
]==0)
fprintf(tabout
, ".nr %d \\n(#-u-\\n(^%c-\\n(%c|+1v\n",TMP
, 'a'+c
, s
);
fprintf(tabout
, ".if \\n(%d>0 .sp \\n(%du/2u\n", TMP
, TMP
);
fprintf(tabout
, ".%c+\n",s
);
fprintf(tabout
, ".in -\\n(%du\n", SIND
);
fprintf(tabout
, ".mk %d\n", S2
);
fprintf(tabout
, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2
, S1
, S1
, S2
);
fprintf(tabout
, ".sp |\\n(%du\n", S1
);
if (stl
+1< nlin
&& (lf
=left(stl
,c
,&lwid
))>=0)
fprintf(tabout
, ".sp -1\n");
drawvert(lf
, stl
, c
, lwid
);
fprintf(tabout
, fn
[1] ? "\\f(%.2s" : "\\f%.2s", fn
);
fprintf(tabout
, "\\s%s",s
);