1*48252Sbostic /*-
2*48252Sbostic * Copyright (c) 1991 The Regents of the University of California.
3*48252Sbostic * All rights reserved.
4*48252Sbostic *
5*48252Sbostic * %sccs.include.proprietary.c%
6*48252Sbostic */
7*48252Sbostic
814485Ssam #ifndef lint
9*48252Sbostic static char sccsid[] = "@(#)fromto.c 4.4 (Berkeley) 04/17/91";
10*48252Sbostic #endif /* not lint */
1111003Sshannon
1211003Sshannon # include "e.h"
1311003Sshannon
fromto(p1,p2,p3)1411003Sshannon fromto(p1, p2, p3) int p1, p2, p3; {
1511003Sshannon int b, h1, b1, pss;
1611003Sshannon yyval = oalloc();
1711003Sshannon lfont[yyval] = rfont[yyval] = 0;
1811003Sshannon h1 = eht[yyval] = eht[p1];
1911003Sshannon b1 = ebase[p1];
2011003Sshannon b = 0;
2111003Sshannon pss = EFFPS(ps);
2211003Sshannon ps += 3;
2311003Sshannon nrwid(p1, ps, p1);
2411003Sshannon printf(".nr %d \\n(%d\n", yyval, p1);
2511003Sshannon if( p2>0 ) {
2611003Sshannon nrwid(p2, pss, p2);
2711003Sshannon printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, yyval, yyval, p2);
2811003Sshannon eht[yyval] += eht[p2];
2911003Sshannon b = eht[p2];
3011003Sshannon }
3111003Sshannon if( p3>0 ) {
3211003Sshannon nrwid(p3, pss, p3);
3311003Sshannon printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p3, yyval, yyval, p3);
3411003Sshannon eht[yyval] += eht[p3];
3511003Sshannon }
3611003Sshannon printf(".ds %d ", yyval); /* bottom of middle box */
3711003Sshannon if( p2>0 ) {
3811003Sshannon printf("\\v'%du'\\h'\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d",
3911003Sshannon eht[p2]-ebase[p2]+b1, yyval, p2, pss, p2, EFFPS(ps));
4011003Sshannon printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
4111003Sshannon yyval, p2, -(eht[p2]-ebase[p2]+b1));
4211003Sshannon }
4311023Sshannon #ifndef NEQN
4411003Sshannon printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du/2u'\\\n",
4511023Sshannon #else NEQN
4611023Sshannon printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du+2u/2u'\\\n",
4711023Sshannon #endif NEQN
4811003Sshannon yyval, p1, p1, yyval, p1);
4911003Sshannon if( p3>0 ) {
5011003Sshannon printf("\\v'%du'\\h'-\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d\\h'\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
5111003Sshannon -(h1-b1+ebase[p3]), yyval, p3, pss, p3, EFFPS(ps), yyval, p3, (h1-b1+ebase[p3]));
5211003Sshannon }
5311003Sshannon printf("\n");
5411003Sshannon ebase[yyval] = b + b1;
5511003Sshannon if(dbg)printf(".\tfrom to: S%d <- %d f %d t %d; h=%d b=%d\n",
5611003Sshannon yyval, p1, p2, p3, eht[yyval], ebase[yyval]);
5711003Sshannon ofree(p1);
5811003Sshannon if( p2>0 ) ofree(p2);
5911003Sshannon if( p3>0 ) ofree(p3);
6011003Sshannon }
61