|
|
1.1 root 1: /* t7.c: control to write table entries */
2: # include "t..c"
3: # define realsplit ((ct=='a'||ct=='n') && table[ldata][c].rcol)
4: runout()
5: {
6: int i;
7: if (boxflg || allflg || dboxflg) need();
8: if (ctrflg)
9: {
10: fprintf(tabout, ".nr #I \\n(.i\n");
11: fprintf(tabout, ".in +(\\n(.lu-\\n(TWu-\\n(.iu)/2u\n");
12: }
13: fprintf(tabout, ".fc %c %c\n", F1, F2);
14: fprintf(tabout, ".nr #T 0-1\n");
15: deftail();
16: for(i=0; i<nlin; i++)
17: putline(i,i);
18: if (leftover)
19: yetmore();
20: fprintf(tabout, ".fc\n");
21: fprintf(tabout, ".nr T. 1\n");
22: fprintf(tabout, ".T# 1\n");
23: if (ctrflg)
24: fprintf(tabout, ".in \\n(#Iu\n");
25: }
26: runtabs(lform, ldata)
27: {
28: int c, ct, vforml, lf;
29: fprintf(tabout, ".ta ");
30: for(c=0; c<ncol; c++)
31: {
32: vforml=lform;
33: for(lf=prev(lform); lf>=0 && vspen(table[lf][c].col); lf=prev(lf))
34: vforml=lf;
35: if (fspan(vforml,c))
36: continue;
37: switch(ct=ctype(vforml,c))
38: {
39: case 'n':
40: case 'a':
41: if (table[ldata][c].rcol)
42: if (lused[c]) /*Zero field width*/
43: fprintf(tabout, "\\n(%2su ",reg(c,CMID));
44: case 'c':
45: case 'l':
46: case 'r':
47: if (realsplit? rused[c]: (used[c]+lused[c]))
48: fprintf(tabout, "\\n(%2su ",reg(c,CRIGHT));
49: continue;
50: case 's':
51: if (lspan(lform, c))
52: fprintf(tabout, "\\n(%2su ", reg(c,CRIGHT));
53: continue;
54: }
55: }
56: fprintf(tabout, "\n");
57: }
58: ifline(s)
59: char *s;
60: {
61: if (!point(s)) return(0);
62: if (s[0] == '\\') s++;
63: if (s[1] ) return(0);
64: if (s[0] == '_') return('-');
65: if (s[0] == '=') return('=');
66: return(0);
67: }
68: need()
69: {
70: int texlin, horlin, i;
71: for(texlin=horlin=i=0; i<nlin; i++)
72: {
73: if (fullbot[i]!=0)
74: horlin++;
75: else
76: if (instead[i]!=0)
77: continue;
78: else
79: texlin++;
80: }
81: fprintf(tabout, ".ne %dv+%dp\n",texlin,2*horlin);
82: }
83: deftail()
84: {
85: int i, c, lf, lwid;
86: for(i=0; i<MAXHEAD; i++)
87: if (linestop[i])
88: fprintf(tabout, ".nr #%c 0-1\n", linestop[i]+'a'-1);
89: fprintf(tabout, ".nr #a 0-1\n");
90: fprintf(tabout, ".eo\n");
91: fprintf(tabout, ".de T#\n");
92: fprintf(tabout, ".nr 35 1m\n");
93: fprintf(tabout, ".ds #d .d\n");
94: fprintf(tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
95: fprintf(tabout, ".mk ##\n");
96: fprintf(tabout, ".nr ## -1v\n");
97: fprintf(tabout, ".ls 1\n");
98: for(i=0; i<MAXHEAD; i++)
99: if (linestop[i])
100: fprintf(tabout, ".if \\n(#T>=0 .nr #%c \\n(#T\n",linestop[i]+'a'-1);
101: if (boxflg || allflg || dboxflg) /* bottom of table line */
102: if (fullbot[nlin-1]==0)
103: {
104: if (!pr1403)
105: fprintf(tabout, ".if \\n(T. .vs \\n(.vu-\\n(.sp\n");
106: fprintf(tabout, ".if \\n(T. ");
107: drawline(nlin,0,ncol, dboxflg ? '=' : '-',1,0);
108: fprintf(tabout, "\n.if \\n(T. .vs\n");
109: /* T. is really an argument to a macro but because of
110: eqn we don't dare pass it as an argument and reference by $1 */
111: }
112: for(c=0; c<ncol; c++)
113: {
114: if ((lf=left(nlin-1,c, &lwid))>=0)
115: {
116: fprintf(tabout, ".if \\n(#%c>=0 .sp -1\n",linestop[lf]+'a'-1);
117: fprintf(tabout, ".if \\n(#%c>=0 ", linestop[lf]+'a'-1);
118: tohcol(c);
119: drawvert(lf, nlin-1, c, lwid);
120: fprintf(tabout, "\\h'|\\n(TWu'\n");
121: }
122: }
123: if (boxflg || allflg || dboxflg) /* right hand line */
124: {
125: fprintf(tabout, ".if \\n(#a>=0 .sp -1\n");
126: fprintf(tabout, ".if \\n(#a>=0 \\h'|\\n(TWu'");
127: drawvert (0, nlin-1, ncol, dboxflg? 2 : 1);
128: fprintf(tabout, "\n");
129: }
130: fprintf(tabout, ".ls\n");
131: fprintf(tabout, "..\n");
132: fprintf(tabout, ".ec\n");
133: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.