1 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2 /*	  All Rights Reserved  	*/
3 
4 
5 /*
6  * Copyright (c) 1980 Regents of the University of California.
7  * All rights reserved. The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10 
11 /*
12  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13  * All Rights Reserved.
14  */
15 
16 /*	from OpenSolaris "over.c	1.4	05/06/02 SMI"	 SVr4.0 1.1		*/
17 
18 /*
19  * Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany
20  *
21  * Sccsid @(#)over.c	1.5 (gritter) 10/19/06
22  */
23 
24 /*
25  * Changes Copyright (c) 2014 Carsten Kunze (carsten.kunze at arcor.de)
26  */
27 
28 # include "e.h"
29 #include "y.tab.h"
30 
31 extern YYSTYPE yyval;
32 
33 void
boverb(int p1,int p2)34 boverb(int p1, int p2) {
35 	int treg;
36 #ifndef	NEQN
37 	float h, b, d;
38 #else	/* NEQN */
39 	int h, b, d;
40 #endif	/* NEQN */
41 
42 	treg = oalloc();
43 	yyval.token = p1;
44 #ifndef NEQN
45 	d = VERT(EM(0.3, ps));
46 	h = eht[p1] + eht[p2] + d;
47 #else /* NEQN */
48 	d = VERT(1);
49 	h = eht[p1] + eht[p2];
50 #endif /* NEQN */
51 	b = eht[p2] - d;
52 #ifndef	NEQN
53 	if(dbg)printf(".\tb:bob: S%d <- S%d over S%d; b=%g, h=%g\n",
54 		yyval.token, p1, p2, b, h);
55 #else	/* NEQN */
56 	if(dbg)printf(".\tb:bob: S%d <- S%d over S%d; b=%d, h=%d\n",
57 		yyval.token, p1, p2, b, h);
58 #endif	/* NEQN */
59 	nrwid(p1, ps, p1);
60 	nrwid(p2, ps, p2);
61 	printf(".nr %d \\n(%d\n", treg, p1);
62 	printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, treg, treg, p2);
63 #ifndef NEQN
64 	printf(".nr %d \\n(%d+\\s%s.5m\\s0\n", treg, treg, tsize(EFFPS(ps)));
65 	printf(".ds %d \\v'%gp'\\h'\\n(%du-\\n(%du/2u'\\*(%d\\\n",
66 		yyval.token, eht[p2]-ebase[p2]-d, treg, p2, p2);
67 	printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%gp'\\*(%d\\\n",
68 		p2, p1, -(eht[p2]-ebase[p2]+d+ebase[p1]), p1);
69 	printf("\\h'-\\n(%du-\\n(%du/2u+.1m'\\v'%gp'\\l'\\n(%du-.2m'\\h'.1m'\\v'%gp'\n",
70 		 treg, p1, ebase[p1]+d, treg, d);
71 #else /* NEQN */
72 	printf(".ds %d \\v'%du'\\h'\\n(%du-\\n(%du/2u'\\*(%d\\\n",
73 		yyval.token, eht[p2]-ebase[p2]-d, treg, p2, p2);
74 	printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\*(%d\\\n",
75 		p2, p1, -eht[p2]+ebase[p2]-ebase[p1], p1);
76 	printf("\\h'-\\n(%du-\\n(%du-2u/2u'\\v'%du'\\l'\\n(%du'\\v'%du'\n",
77 		 treg, p1, ebase[p1], treg, d);
78 #endif /* NEQN */
79 	ebase[yyval.token] = b;
80 	eht[yyval.token] = h;
81 	lfont[yyval.token] = rfont[yyval.token] = 0;
82 	ofree(p2);
83 	ofree(treg);
84 }
85