xref: /titanic_52/usr/src/cmd/eqn/over.c (revision 779fc935796a940997d18b31d64a9fec9c6b40f6)
1*779fc935Sceastha /*
2*779fc935Sceastha  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*779fc935Sceastha  * Use is subject to license terms.
4*779fc935Sceastha  */
5*779fc935Sceastha 
67c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
77c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate /*
107c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
117c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
127c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
137c478bd9Sstevel@tonic-gate  */
147c478bd9Sstevel@tonic-gate 
15*779fc935Sceastha #pragma ident	"%Z%%M%	%I%	%E% SMI"
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate #include "e.h"
187c478bd9Sstevel@tonic-gate 
19*779fc935Sceastha void
20*779fc935Sceastha boverb(int p1, int p2)
21*779fc935Sceastha {
227c478bd9Sstevel@tonic-gate 	int h, b, treg, d;
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 	treg = oalloc();
257c478bd9Sstevel@tonic-gate 	yyval = p1;
267c478bd9Sstevel@tonic-gate #ifndef NEQN
277c478bd9Sstevel@tonic-gate 	d = VERT(EM(0.3, ps));
287c478bd9Sstevel@tonic-gate 	h = eht[p1] + eht[p2] + d;
29*779fc935Sceastha #else	/* NEQN */
307c478bd9Sstevel@tonic-gate 	d = VERT(1);
317c478bd9Sstevel@tonic-gate 	h = eht[p1] + eht[p2];
32*779fc935Sceastha #endif	/* NEQN */
337c478bd9Sstevel@tonic-gate 	b = eht[p2] - d;
34*779fc935Sceastha 	if (dbg)
35*779fc935Sceastha 		printf(".\tb:bob: S%d <- S%d over S%d; b=%d, h=%d\n",
367c478bd9Sstevel@tonic-gate 		    yyval, p1, p2, b, h);
377c478bd9Sstevel@tonic-gate 	nrwid(p1, ps, p1);
387c478bd9Sstevel@tonic-gate 	nrwid(p2, ps, p2);
397c478bd9Sstevel@tonic-gate 	printf(".nr %d \\n(%d\n", treg, p1);
407c478bd9Sstevel@tonic-gate 	printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, treg, treg, p2);
417c478bd9Sstevel@tonic-gate #ifndef NEQN
427c478bd9Sstevel@tonic-gate 	printf(".nr %d \\n(%d+\\s%d.5m\\s0\n", treg, treg, EFFPS(ps));
43*779fc935Sceastha #endif	/* NEQN */
447c478bd9Sstevel@tonic-gate 	printf(".ds %d \\v'%du'\\h'\\n(%du-\\n(%du/2u'\\*(%d\\\n",
457c478bd9Sstevel@tonic-gate 	    yyval, eht[p2]-ebase[p2]-d, treg, p2, p2);
467c478bd9Sstevel@tonic-gate #ifndef	NEQN
47*779fc935Sceastha 	printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\*(%d\\\n",
487c478bd9Sstevel@tonic-gate 	    p2, p1, -(eht[p2]-ebase[p2]+d+ebase[p1]), p1);
49*779fc935Sceastha 	printf("\\h'-\\n(%du-\\n(%du/2u+.1m'\\v'%du'\\l'\\n"
50*779fc935Sceastha 	    "(%du-.2m'\\h'.1m'\\v'%du'\n", treg, p1, ebase[p1]+d, treg, d);
51*779fc935Sceastha #else	/* NEQN */
52*779fc935Sceastha 	printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\*(%d\\\n",
537c478bd9Sstevel@tonic-gate 	    p2, p1, -eht[p2]+ebase[p2]-ebase[p1], p1);
547c478bd9Sstevel@tonic-gate 	printf("\\h'-\\n(%du-\\n(%du-2u/2u'\\v'%du'\\l'\\n(%du'\\v'%du'\n",
557c478bd9Sstevel@tonic-gate 	    treg, p1, ebase[p1], treg, d);
56*779fc935Sceastha #endif	/* NEQN */
577c478bd9Sstevel@tonic-gate 	ebase[yyval] = b;
587c478bd9Sstevel@tonic-gate 	eht[yyval] = h;
597c478bd9Sstevel@tonic-gate 	lfont[yyval] = rfont[yyval] = 0;
607c478bd9Sstevel@tonic-gate 	ofree(p2);
617c478bd9Sstevel@tonic-gate 	ofree(treg);
627c478bd9Sstevel@tonic-gate }
63