Annotation of 42BSD/usr.bin/tbl/tt.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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