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((uchar)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();
109 for (c = 0; c < ncol; c++) {
110 switch (ctype(il, c)) {
130 for (icol = 1; icol < ncol; icol++) {
131 if (k != ctype(lin, icol))
146 for (jcol = 0; jcol < ncol; jcol++) {
147 for (irow = 1; irow < nlin; irow++) {
148 if (vspand(irow, jcol, 0)) {
151 error("Vertical spanning in first row not allowed");
152 start = table[is][jcol].col;
153 strig = table[is][jcol].rcol;
154 while (irow < nlin && vspand(irow, jcol, 0))
156 table[--irow][jcol].col = start;
157 table[irow][jcol].rcol = strig;
159 table[is][jcol].rcol = 0;
160 table[is][jcol].col = SPAN;
170 vspand(int ir, int ij, int ifform)
178 if (ifform == 0 && ctype(ir, ij) == '^')
180 if (table[ir][ij].rcol != 0)
184 return(vspen(table[ir][ij].col));
195 return(match(s, SPAN));