1 /* t5.c: read data for table */
9 cstore = cspace = chspace();
11 for (nlin = nslin = 0; gets1(cstore, MAXCHS - (cstore - cspace)); nlin++) {
13 if (prefix(".TE", cstore)) {
17 if (prefix(".TC", cstore) || prefix(".T&", cstore)) {
26 if (cstore[0] == '.' && !isdigit(cstore[1])) {
27 instead[nlin] = cstore;
36 table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0]));
37 for (icol = 0; icol < ncol; icol++) {
38 table[nlin][icol].rcol = "";
39 table[nlin][icol].col = "";
44 instead[nlin] = (char *) 0;
46 table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0]));
57 nslin = min(nslin + 1, nclin - 1);
58 for (icol = 0; icol < ncol; icol++) {
59 table[nlin][icol].col = cstore;
60 table[nlin][icol].rcol = 0;
62 if (match(cstore, "T{")) { /* text follows */
63 table[nlin][icol].col =
64 (char *)gettext(cstore, nlin, icol,
65 font[icol][stynum[nlin]],
66 csize[icol][stynum[nlin]]);
69 for (; (ch = *cstore) != '\0' && ch != tab; cstore++)
72 switch (ctype(nlin, icol)) /* numerical or alpha, subcol */ {
74 table[nlin][icol].rcol = maknew(table[nlin][icol].col);
77 table[nlin][icol].rcol = table[nlin][icol].col;
78 table[nlin][icol].col = "";
82 while (ctype(nlin, icol + 1) == 's') /* spanning */
83 table[nlin][++icol].col = "";
87 while (++icol < ncol + 2) {
88 table[nlin][icol].col = "";
89 table [nlin][icol].rcol = 0;
91 while (*cstore != '\0')
93 if (cstore - cspace + MAXLINLEN > MAXCHS)
94 cstore = cspace = chspace();
108 for (c = 0; c < ncol; c++) {
109 switch (ctype(il, c)) {
129 for (icol = 1; icol < ncol; icol++) {
130 if (k != ctype(lin, icol))
145 for (jcol = 0; jcol < ncol; jcol++) {
146 for (irow = 1; irow < nlin; irow++) {
147 if (vspand(irow, jcol, 0)) {
150 error("Vertical spanning in first row not allowed");
151 start = table[is][jcol].col;
152 strig = table[is][jcol].rcol;
153 while (irow < nlin && vspand(irow, jcol, 0))
155 table[--irow][jcol].col = start;
156 table[irow][jcol].rcol = strig;
158 table[is][jcol].rcol = 0;
159 table[is][jcol].col = SPAN;
169 vspand(int ir, int ij, int ifform)
177 if (ifform == 0 && ctype(ir, ij) == '^')
179 if (table[ir][ij].rcol != 0)
183 return(vspen(table[ir][ij].col));
194 return(match(s, SPAN));