|
|
1.1 ! root 1: #include "e.h" ! 2: ! 3: startcol(type) /* mark start of column in lp[] array */ ! 4: int type; ! 5: { ! 6: int oct = ct; ! 7: ! 8: lp[ct++] = type; ! 9: lp[ct++] = 0; /* count, to come */ ! 10: lp[ct++] = 0; /* separation, to come */ ! 11: return oct; ! 12: } ! 13: ! 14: column(oct, sep) /* remember end of column that started at lp[oct] */ ! 15: int oct, sep; ! 16: { ! 17: int i, type; ! 18: ! 19: lp[oct+1] = ct - oct - 3; ! 20: lp[oct+2] = sep; ! 21: type = lp[oct]; ! 22: if (dbg) { ! 23: printf(".\t%d column of", type); ! 24: for (i = oct+3; i < ct; i++ ) ! 25: printf(" S%d", lp[i]); ! 26: printf(", rows=%d, sep=%d\n", lp[oct+1], lp[oct+2]); ! 27: } ! 28: } ! 29: ! 30: matrix(oct) /* matrix is list of columns */ ! 31: int oct; ! 32: { ! 33: int nrow, ncol, i, j, k, val[100]; ! 34: float b, hb; ! 35: char *space; ! 36: extern char *Matspace; ! 37: ! 38: space = Matspace; /* between columns of matrix */ ! 39: nrow = lp[oct+1]; /* disaster if rows inconsistent */ ! 40: /* also assumes just columns */ ! 41: /* fix when add other things */ ! 42: ncol = 0; ! 43: for (i = oct+1; i < ct; i += lp[i]+3 ) { ! 44: ncol++; ! 45: dprintf(".\tcolct=%d\n", lp[i]); ! 46: } ! 47: for (k=1; k <= nrow; k++) { ! 48: hb = b = 0; ! 49: j = oct + k + 2; ! 50: for (i=0; i < ncol; i++) { ! 51: hb = max(hb, eht[lp[j]]-ebase[lp[j]]); ! 52: b = max(b, ebase[lp[j]]); ! 53: j += nrow + 3; ! 54: } ! 55: dprintf(".\trow %d: b=%g, hb=%g\n", k, b, hb); ! 56: j = oct + k + 2; ! 57: for (i=0; i<ncol; i++) { ! 58: ebase[lp[j]] = b; ! 59: eht[lp[j]] = b + hb; ! 60: j += nrow + 3; ! 61: } ! 62: } ! 63: j = oct; ! 64: for (i=0; i<ncol; i++) { ! 65: pile(j); ! 66: val[i] = yyval; ! 67: j += nrow + 3; ! 68: } ! 69: yyval = salloc(); ! 70: eht[yyval] = eht[val[0]]; ! 71: ebase[yyval] = ebase[val[0]]; ! 72: lfont[yyval] = rfont[yyval] = 0; ! 73: dprintf(".\tmatrix S%d: r=%d, c=%d, h=%g, b=%g\n", ! 74: yyval,nrow,ncol,eht[yyval],ebase[yyval]); ! 75: printf(".ds %d \"", yyval); ! 76: for( i=0; i<ncol; i++ ) { ! 77: printf("\\*(%d%s", val[i], i==ncol-1 ? "" : space); ! 78: sfree(val[i]); ! 79: } ! 80: printf("\n"); ! 81: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.