Annotation of researchv9/cmd/tbl/tt.c, revision 1.1.1.1

1.1       root        1:  /* tt.c: subroutines for drawing horizontal lines */
                      2: # include "t..c"
                      3: ctype(il, ic)
                      4: {
                      5: if (instead[il])
                      6:        return(0);
                      7: if (fullbot[il])
                      8:        return(0);
                      9: il = stynum[il];
                     10: return(style[ic][il]);
                     11: }
                     12: min(a,b)
                     13: {
                     14: return(a<b ? a : b);
                     15: }
                     16: fspan(i,c)
                     17: {
                     18: c++;
                     19: return(c<ncol && ctype(i,c)=='s');
                     20: }
                     21: lspan(i,c)
                     22: {
                     23: int k;
                     24: if (ctype(i,c) != 's') return(0);
                     25: c++;
                     26: if (c < ncol && ctype(i,c)== 's') 
                     27:        return(0);
                     28: for(k=0; ctype(i,--c) == 's'; k++);
                     29: return(k);
                     30: }
                     31: ctspan(i,c)
                     32: {
                     33: int k;
                     34: c++;
                     35: for(k=1; c<ncol && ctype(i,c)=='s'; k++)
                     36:        c++;
                     37: return(k);
                     38: }
                     39: tohcol(ic)
                     40: {
                     41:                        if (ic==0)
                     42:                                fprintf(tabout, "\\h'|0'");
                     43:                        else
                     44:                                fprintf(tabout, "\\h'(|\\n(%2su+|\\n(%2su)/2u'", reg(ic,CLEFT), reg(ic-1,CRIGHT));
                     45: }
                     46: allh(i)
                     47: {
                     48: /* return true if every element in line i is horizontal */
                     49: /* also at least one must be horizontl */
                     50: int c, one, k;
                     51: if (fullbot[i]) return(1);
                     52: if (i>=nlin) return(dboxflg||boxflg);
                     53: for(one=c=0; c<ncol; c++)
                     54:        {
                     55:        k = thish(i,c);
                     56:        if (k==0) return(0);
                     57:        if (k==1) continue;
                     58:        one=1;
                     59:        }
                     60: return(one);
                     61: }
                     62: thish(i,c)
                     63: {
                     64:        int t;
                     65:        char *s;
                     66:        struct colstr *pc;
                     67:        if (c<0)return(0);
                     68:        if (i<0) return(0);
                     69:        t = ctype(i,c);
                     70:        if (t=='_' || t == '-')
                     71:                return('-');
                     72:        if (t=='=')return('=');
                     73:        if (t=='^') return(1);
                     74:        if (fullbot[i] )
                     75:                return(fullbot[i]);
                     76:        if (t=='s') return(thish(i,c-1));
                     77:        if (t==0) return(1);
                     78:        pc = &table[i][c];
                     79:        s = (t=='a' ? pc->rcol : pc->col);
                     80:        if (s==0 || (point(s) && *s==0))
                     81:                return(1);
                     82:        if (vspen(s)) return(1);
                     83:        if (t=barent( s))
                     84:                return(t);
                     85:        return(0);
                     86: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.