|
|
1.1 ! root 1: #include "e.h" ! 2: ! 3: column(type, p1) int type, p1; { ! 4: int i; ! 5: ! 6: lp[p1] = ct - p1 - 1; ! 7: if( dbg ){ ! 8: printf(".\t%d column of", type); ! 9: for( i=p1+1; i<ct; i++ ) ! 10: printf(" S%d", lp[i]); ! 11: printf(", rows=%d\n",lp[p1]); ! 12: } ! 13: lp[ct++] = type; ! 14: } ! 15: ! 16: matrix(p1) int p1; { ! 17: int nrow, ncol, i, j, k, hb, b, val[100]; ! 18: char *space; ! 19: ! 20: space = "\\ \\ "; ! 21: nrow = lp[p1]; /* disaster if rows inconsistent */ ! 22: ncol = 0; ! 23: for( i=p1; i<ct; i += lp[i]+2 ){ ! 24: ncol++; ! 25: if(dbg)printf(".\tcolct=%d\n",lp[i]); ! 26: } ! 27: for( k=1; k<=nrow; k++ ) { ! 28: hb = b = 0; ! 29: j = p1 + k; ! 30: for( i=0; i<ncol; i++ ) { ! 31: hb = max(hb, eht[lp[j]]-ebase[lp[j]]); ! 32: b = max(b, ebase[lp[j]]); ! 33: j += nrow + 2; ! 34: } ! 35: if(dbg)printf(".\trow %d: b=%d, hb=%d\n", k, b, hb); ! 36: j = p1 + k; ! 37: for( i=0; i<ncol; i++ ) { ! 38: ebase[lp[j]] = b; ! 39: eht[lp[j]] = b + hb; ! 40: j += nrow + 2; ! 41: } ! 42: } ! 43: j = p1; ! 44: for( i=0; i<ncol; i++ ) { ! 45: lpile(lp[j+lp[j]+1], j+1, j+lp[j]+1); ! 46: val[i] = yyval; ! 47: j += nrow + 2; ! 48: } ! 49: yyval = oalloc(); ! 50: eht[yyval] = eht[val[0]]; ! 51: ebase[yyval] = ebase[val[0]]; ! 52: lfont[yyval] = rfont[yyval] = 0; ! 53: if(dbg)printf(".\tmatrix S%d: r=%d, c=%d, h=%d, b=%d\n", ! 54: yyval,nrow,ncol,eht[yyval],ebase[yyval]); ! 55: printf(".ds %d \"", yyval); ! 56: for( i=0; i<ncol; i++ ) { ! 57: printf("\\*(%d%s", val[i], i==ncol-1 ? "" : space); ! 58: ofree(val[i]); ! 59: } ! 60: printf("\n"); ! 61: ct = p1; ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.