1: #ifndef lint
2: static char sccsid[] = "@(#)matrix.c 4.2 8/11/83";
3: #endif
4:
5: #include "e.h"
6:
7: column(type, p1) int type, p1; {
8: int i;
9:
10: lp[p1] = ct - p1 - 1;
11: if( dbg ){
12: printf(".\t%d column of", type);
13: for( i=p1+1; i<ct; i++ )
14: printf(" S%d", lp[i]);
15: printf(", rows=%d\n",lp[p1]);
16: }
17: lp[ct++] = type;
18: }
19:
20: matrix(p1) int p1; {
21: int nrow, ncol, i, j, k, hb, b, val[100];
22: char *space;
23:
24: space = "\\ \\ ";
25: nrow = lp[p1]; /* disaster if rows inconsistent */
26: ncol = 0;
27: for( i=p1; i<ct; i += lp[i]+2 ){
28: ncol++;
29: if(dbg)printf(".\tcolct=%d\n",lp[i]);
30: }
31: for( k=1; k<=nrow; k++ ) {
32: hb = b = 0;
33: j = p1 + k;
34: for( i=0; i<ncol; i++ ) {
35: hb = max(hb, eht[lp[j]]-ebase[lp[j]]);
36: b = max(b, ebase[lp[j]]);
37: j += nrow + 2;
38: }
39: if(dbg)printf(".\trow %d: b=%d, hb=%d\n", k, b, hb);
40: j = p1 + k;
41: for( i=0; i<ncol; i++ ) {
42: ebase[lp[j]] = b;
43: eht[lp[j]] = b + hb;
44: j += nrow + 2;
45: }
46: }
47: j = p1;
48: for( i=0; i<ncol; i++ ) {
49: lpile(lp[j+lp[j]+1], j+1, j+lp[j]+1);
50: val[i] = yyval;
51: j += nrow + 2;
52: }
53: yyval = oalloc();
54: eht[yyval] = eht[val[0]];
55: ebase[yyval] = ebase[val[0]];
56: lfont[yyval] = rfont[yyval] = 0;
57: if(dbg)printf(".\tmatrix S%d: r=%d, c=%d, h=%d, b=%d\n",
58: yyval,nrow,ncol,eht[yyval],ebase[yyval]);
59: printf(".ds %d \"", yyval);
60: for( i=0; i<ncol; i++ ) {
61: printf("\\*(%d%s", val[i], i==ncol-1 ? "" : space);
62: ofree(val[i]);
63: }
64: printf("\n");
65: ct = p1;
66: }
Defined functions
column
defined in line
7; used 4 times
Defined variables
sccsid
defined in line
2;
never used