1: #include "ne.h"
   2: 
   3: column(type, p1, p2) int type, p1, p2; {
   4:     int i, n;
   5:     lp[p1] = ct - p1 - 1;
   6:     if( dbg ){
   7:         printf(".\t%c column of", type);
   8:         for( i=p1+1; i<ct; i++ )
   9:             printf(" S%d", lp[i]);
  10:         printf(", rows=%d\n",lp[p1]);
  11:     }
  12:     lp[ct++] = type;
  13: }
  14: 
  15: matrix(p1,p2) int p1, p2; {
  16:     int nrow, ncol, i, j, k, hb, b, val[100], db;
  17:     int w;
  18:     char *space;
  19:     space = "\\ \\ ";
  20:     nrow = lp[p1];  /* disaster if rows inconsistent */
  21:     ncol = 0;
  22:     for( i=p1; i<ct; i =+ lp[i]+2 ){
  23:         ncol++;
  24:         if(dbg)printf(".\tcolct=%d\n",lp[i]);
  25:     }
  26:     for( k=1; k<=nrow; k++ ) {
  27:         hb = b = 0;
  28:         j = p1 + k;
  29:         for( i=0; i<ncol; i++ ) {
  30:             hb = max(hb, eht[lp[j]]-ebase[lp[j]]);
  31:             b = max(b, ebase[lp[j]]);
  32:             j =+ nrow + 2;
  33:         }
  34:         if(dbg)printf(".\trow %d: b=%d, hb=%d\n", k, b, hb);
  35:         j = p1 + k;
  36:         for( i=0; i<ncol; i++ ) {
  37:             ebase[lp[j]] = b;
  38:             eht[lp[j]] = b + hb;
  39:             j =+ nrow + 2;
  40:         }
  41:     }
  42:     j = p1;
  43:     w = 0;
  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:         w =+ ewid[yyval];
  48:         j =+ nrow + 2;
  49:     }
  50:     yyval = oalloc();
  51:     eht[yyval] = eht[val[0]];
  52:     ebase[yyval] = ebase[val[0]];
  53:     ewid[yyval] = w + 2 * (ncol-1); /* 2 = width(space) */
  54:     if(dbg)printf(".\tmatrix S%d: r=%d, c=%d, h=%d, b=%d, w=%d\n",
  55:         yyval,nrow,ncol,eht[yyval],ebase[yyval], ewid[yyval]);
  56:     printf(".ds %d \"", yyval);
  57:     for( i=0; i<ncol; i++ )  {
  58:         printf("\\*(%d%s", val[i], i==ncol-1 ? "" : space);
  59:         ofree(val[i]);
  60:     }
  61:     printf("\n");
  62:     ct = p1;
  63: }

Defined functions

column defined in line 3; used 4 times
matrix defined in line 15; used 1 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 668
Valid CSS Valid XHTML 1.0 Strict