fromto.c (1442B)
1 # include "e.h" 2 3 void fromto(int p1, int p2, int p3) 4 { 5 double b, h1, b1, t; 6 int subps; 7 8 yyval = salloc(); 9 lfont[yyval] = rfont[yyval] = 0; 10 h1 = eht[yyval] = eht[p1]; 11 b1 = ebase[p1]; 12 b = 0; 13 subps = ps; 14 ps += deltaps; 15 nrwid(p1, ps, p1); 16 printf(".nr %d \\n(%d\n", (int)yyval, p1); 17 if (p2 > 0) { 18 nrwid(p2, subps, p2); 19 printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, (int)yyval, (int)yyval, p2); 20 eht[yyval] += eht[p2]; 21 b = eht[p2]; 22 } 23 if (p3 > 0) { 24 nrwid(p3, subps, p3); 25 printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p3, (int)yyval, (int)yyval, p3); 26 eht[yyval] += eht[p3]; 27 } 28 printf(".ds %d ", (int)yyval); /* bottom of middle box */ 29 if (p2 > 0) { 30 t = eht[p2]-ebase[p2]+b1; 31 printf("\\v'%gm'\\h'\\n(%du-\\n(%du/2u'%s\\*(%d%s", 32 REL(t,ps), (int)yyval, p2, DPS(ps,subps), p2, DPS(subps,ps)); 33 printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%gm'\\\n", 34 (int)yyval, p2, REL(-t,ps)); 35 } 36 printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du/2u'\\\n", 37 (int)yyval, p1, p1, (int)yyval, p1); 38 if (p3 >0) { 39 t = h1-b1+ebase[p3]; 40 printf("\\v'%gm'\\h'-\\n(%du-\\n(%du/2u'%s\\*(%d%s\\h'\\n(%du-\\n(%du/2u'\\v'%gm'\\\n", 41 REL(-t,ps), (int)yyval, p3, DPS(ps,subps), p3, DPS(subps,ps), (int)yyval, p3, REL(t,ps)); 42 } 43 printf("\n"); 44 ebase[yyval] = b + b1; 45 dprintf(".\tS%d <- %d from %d to %d; h=%g b=%g\n", 46 (int)yyval, p1, p2, p3, eht[yyval], ebase[yyval]); 47 sfree(p1); 48 if (p2 > 0) 49 sfree(p2); 50 if (p3 > 0) 51 sfree(p3); 52 }