|
|
1.1 root 1: #include "e.h"
2: #include "e.def"
3:
4: pile(oct)
5: int oct;
6: {
7: int i, nlist, nlist2, mid;
8: float bi, hi, h, b, gap;
9: int type, p1, p2;
10:
11: yyval = salloc();
12: type = lp[oct];
13: p1 = oct + 3; /* first entry */
14: p2 = p1 + lp[oct+1]; /* 1 after last */
15: gap = lp[oct+2];
16: if (gap != DEFGAP)
17: gap = EM(gap/100.0, ps);
18: else if (type == COL)
19: gap = 0;
20: else
21: gap = EM(0.4, ps); /* 0.4 m between LCOL, etc. */
22: nlist = p2 - p1;
23: nlist2 = (nlist+1)/2;
24: mid = p1 + nlist2 - 1;
25: h = 0;
26: for (i = p1; i < p2; i++)
27: h += eht[lp[i]];
28: eht[yyval] = h + (nlist-1)*gap;
29: b = 0;
30: for (i = p2-1; i > mid; i--)
31: b += eht[lp[i]] + gap;
32: ebase[yyval] = (nlist%2) ? b + ebase[lp[mid]]
33: : b - EM(0.5, ps) - gap;
34: if (dbg) {
35: printf(".\tS%d <- %d pile of:", yyval, type);
36: for (i = p1; i < p2; i++)
37: printf(" S%d", lp[i]);
38: printf("; h=%g b=%g\n", eht[yyval], ebase[yyval]);
39: }
40: nrwid(lp[p1], ps, lp[p1]);
41: printf(".nr %d \\n(%d\n", yyval, lp[p1]);
42: for (i = p1+1; i < p2; i++) {
43: nrwid(lp[i], ps, lp[i]);
44: printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n",
45: lp[i], yyval, yyval, lp[i]);
46: }
47: printf(".ds %d \\v'%gm'\\h'%du*\\n(%du'\\\n", yyval, REL(ebase[yyval],ps),
48: type==RCOL ? 1 : 0, yyval);
49: for (i = p2-1; i >= p1; i--) {
50: hi = eht[lp[i]];
51: bi = ebase[lp[i]];
52: switch (type) {
53: case LCOL:
54: printf("\\v'%gm'\\*(%d\\h'-\\n(%du'\\v'0-%gm'\\\n",
55: REL(-bi,ps), lp[i], lp[i], REL(hi-bi+gap,ps));
56: continue;
57: case RCOL:
58: printf("\\v'%gm'\\h'-\\n(%du'\\*(%d\\v'0-%gm'\\\n",
59: REL(-bi,ps), lp[i], lp[i], REL(hi-bi+gap,ps));
60: continue;
61: case CCOL:
62: case COL:
63: printf("\\v'%gm'\\h'\\n(%du-\\n(%du/2u'\\*(%d",
64: REL(-bi,ps), yyval, lp[i], lp[i]);
65: printf("\\h'-\\n(%du-\\n(%du/2u'\\v'0-%gm'\\\n",
66: yyval, lp[i], REL(hi-bi+gap,ps));
67: continue;
68: }
69: }
70: printf("\\v'%gm'\\h'%du*\\n(%du'\n", REL(eht[yyval]-ebase[yyval]+gap,ps),
71: type!=RCOL ? 1 : 0, yyval);
72: for (i = p1; i < p2; i++)
73: sfree(lp[i]);
74: lfont[yyval] = rfont[yyval] = 0;
75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.